@companion-module/base 1.13.3 → 1.13.4
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 +7 -0
- package/dist/common/json-value.d.ts +33 -0
- package/dist/common/json-value.d.ts.map +1 -0
- package/dist/common/json-value.js +5 -0
- package/dist/common/json-value.js.map +1 -0
- package/dist/common/osc.d.ts +17 -0
- package/dist/common/osc.d.ts.map +1 -0
- package/dist/common/osc.js +7 -0
- package/dist/common/osc.js.map +1 -0
- package/dist/entrypoint.d.ts +11 -0
- package/dist/entrypoint.d.ts.map +1 -0
- package/dist/entrypoint.js +134 -0
- package/dist/entrypoint.js.map +1 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +10 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/tcp.d.ts +31 -0
- package/dist/helpers/tcp.d.ts.map +1 -0
- package/dist/helpers/tcp.js +164 -0
- package/dist/helpers/tcp.js.map +1 -0
- package/dist/helpers/telnet.d.ts +18 -0
- package/dist/helpers/telnet.d.ts.map +1 -0
- package/dist/helpers/telnet.js +169 -0
- package/dist/helpers/telnet.js.map +1 -0
- package/dist/helpers/udp.d.ts +33 -0
- package/dist/helpers/udp.d.ts.map +1 -0
- package/dist/helpers/udp.js +126 -0
- package/dist/helpers/udp.js.map +1 -0
- package/dist/host-api/api.d.ts +383 -0
- package/dist/host-api/api.d.ts.map +1 -0
- package/dist/host-api/api.js +9 -0
- package/dist/host-api/api.js.map +1 -0
- package/dist/host-api/ipc-wrapper.d.ts +37 -0
- package/dist/host-api/ipc-wrapper.d.ts.map +1 -0
- package/dist/host-api/ipc-wrapper.js +129 -0
- package/dist/host-api/ipc-wrapper.js.map +1 -0
- package/dist/host-api/versions.d.ts +12 -0
- package/dist/host-api/versions.d.ts.map +1 -0
- package/dist/host-api/versions.js +5 -0
- package/dist/host-api/versions.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/instance-base.d.ts +12 -0
- package/dist/instance-base.d.ts.map +1 -0
- package/dist/instance-base.js +3 -0
- package/dist/instance-base.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 +207 -0
- package/dist/internal/actions.js.map +1 -0
- package/dist/internal/base.d.ts +11 -0
- package/dist/internal/base.d.ts.map +1 -0
- package/dist/internal/base.js +39 -0
- package/dist/internal/base.js.map +1 -0
- package/dist/internal/feedback.d.ts +20 -0
- package/dist/internal/feedback.d.ts.map +1 -0
- package/dist/internal/feedback.js +307 -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 +174 -0
- package/dist/internal/upgrade.js.map +1 -0
- package/dist/manifest.d.ts +5 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +37 -0
- package/dist/manifest.js.map +1 -0
- package/dist/module-api/action.d.ts +100 -0
- package/dist/module-api/action.d.ts.map +1 -0
- package/dist/module-api/action.js +3 -0
- package/dist/module-api/action.js.map +1 -0
- package/dist/module-api/base.d.ts +199 -0
- package/dist/module-api/base.d.ts.map +1 -0
- package/dist/module-api/base.js +481 -0
- package/dist/module-api/base.js.map +1 -0
- package/dist/module-api/common.d.ts +14 -0
- package/dist/module-api/common.d.ts.map +1 -0
- package/dist/module-api/common.js +3 -0
- package/dist/module-api/common.js.map +1 -0
- package/dist/module-api/config.d.ts +12 -0
- package/dist/module-api/config.d.ts.map +1 -0
- package/dist/module-api/config.js +3 -0
- package/dist/module-api/config.js.map +1 -0
- package/dist/module-api/enums.d.ts +31 -0
- package/dist/module-api/enums.d.ts.map +1 -0
- package/dist/module-api/enums.js +37 -0
- package/dist/module-api/enums.js.map +1 -0
- package/dist/module-api/feedback.d.ts +147 -0
- package/dist/module-api/feedback.d.ts.map +1 -0
- package/dist/module-api/feedback.js +3 -0
- package/dist/module-api/feedback.js.map +1 -0
- package/dist/module-api/http.d.ts +17 -0
- package/dist/module-api/http.d.ts.map +1 -0
- package/dist/module-api/http.js +3 -0
- package/dist/module-api/http.js.map +1 -0
- package/dist/module-api/index.d.ts +13 -0
- package/dist/module-api/index.d.ts.map +1 -0
- package/dist/module-api/index.js +15 -0
- package/dist/module-api/index.js.map +1 -0
- package/dist/module-api/input.d.ts +392 -0
- package/dist/module-api/input.d.ts.map +1 -0
- package/dist/module-api/input.js +3 -0
- package/dist/module-api/input.js.map +1 -0
- package/dist/module-api/preset.d.ts +111 -0
- package/dist/module-api/preset.d.ts.map +1 -0
- package/dist/module-api/preset.js +3 -0
- package/dist/module-api/preset.js.map +1 -0
- package/dist/module-api/shared-udp-socket.d.ts +60 -0
- package/dist/module-api/shared-udp-socket.d.ts.map +1 -0
- package/dist/module-api/shared-udp-socket.js +178 -0
- package/dist/module-api/shared-udp-socket.js.map +1 -0
- package/dist/module-api/style.d.ts +20 -0
- package/dist/module-api/style.d.ts.map +1 -0
- package/dist/module-api/style.js +3 -0
- package/dist/module-api/style.js.map +1 -0
- package/dist/module-api/upgrade.d.ts +118 -0
- package/dist/module-api/upgrade.d.ts.map +1 -0
- package/dist/module-api/upgrade.js +95 -0
- package/dist/module-api/upgrade.js.map +1 -0
- package/dist/module-api/variable.d.ts +18 -0
- package/dist/module-api/variable.d.ts.map +1 -0
- package/dist/module-api/variable.js +3 -0
- package/dist/module-api/variable.js.map +1 -0
- package/dist/util.d.ts +97 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +177 -0
- package/dist/util.js.map +1 -0
- package/generated/manifest.d.ts +133 -0
- package/generated/validate_manifest.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstanceBase = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const util_js_1 = require("../util.js");
|
|
6
|
+
// eslint-disable-next-line n/no-missing-import
|
|
7
|
+
const p_queue_1 = tslib_1.__importDefault(require("p-queue"));
|
|
8
|
+
const base_js_1 = require("../internal/base.js");
|
|
9
|
+
const upgrade_js_1 = require("../internal/upgrade.js");
|
|
10
|
+
const feedback_js_1 = require("../internal/feedback.js");
|
|
11
|
+
const ipc_wrapper_js_1 = require("../host-api/ipc-wrapper.js");
|
|
12
|
+
const actions_js_1 = require("../internal/actions.js");
|
|
13
|
+
const shared_udp_socket_js_1 = require("./shared-udp-socket.js");
|
|
14
|
+
class InstanceBase {
|
|
15
|
+
#ipcWrapper;
|
|
16
|
+
#upgradeScripts;
|
|
17
|
+
id;
|
|
18
|
+
#lifecycleQueue = new p_queue_1.default({ concurrency: 1 });
|
|
19
|
+
#initialized = false;
|
|
20
|
+
#recordingActions = false;
|
|
21
|
+
#lastConfig = {};
|
|
22
|
+
#lastSecrets = {};
|
|
23
|
+
#actionManager;
|
|
24
|
+
#feedbackManager;
|
|
25
|
+
#sharedUdpSocketHandlers = new Map();
|
|
26
|
+
#variableDefinitions = new Map();
|
|
27
|
+
#variableValues = new Map();
|
|
28
|
+
#options;
|
|
29
|
+
#label;
|
|
30
|
+
get instanceOptions() {
|
|
31
|
+
return this.#options;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The user chosen name for this instance.
|
|
35
|
+
* This can be changed just before `configUpdated` is called
|
|
36
|
+
*/
|
|
37
|
+
get label() {
|
|
38
|
+
return this.#label;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create an instance of the module
|
|
42
|
+
*/
|
|
43
|
+
constructor(internal) {
|
|
44
|
+
if (!(0, base_js_1.isInstanceBaseProps)(internal) || !internal._isInstanceBaseProps)
|
|
45
|
+
throw new Error(`Module instance is being constructed incorrectly. Make sure you aren't trying to do this manually`);
|
|
46
|
+
this.createSharedUdpSocket = this.createSharedUdpSocket.bind(this);
|
|
47
|
+
this.#options = {
|
|
48
|
+
disableVariableValidation: false,
|
|
49
|
+
};
|
|
50
|
+
this.#ipcWrapper = new ipc_wrapper_js_1.IpcWrapper({
|
|
51
|
+
init: this._handleInit.bind(this),
|
|
52
|
+
destroy: this._handleDestroy.bind(this),
|
|
53
|
+
updateConfigAndLabel: this._handleConfigUpdateAndLabel.bind(this),
|
|
54
|
+
updateConfig: async () => undefined, // Replaced by updateConfigAndLabel
|
|
55
|
+
executeAction: this._handleExecuteAction.bind(this),
|
|
56
|
+
updateFeedbacks: this._handleUpdateFeedbacks.bind(this),
|
|
57
|
+
updateActions: this._handleUpdateActions.bind(this),
|
|
58
|
+
upgradeActionsAndFeedbacks: this._handleUpgradeActionsAndFeedbacks.bind(this),
|
|
59
|
+
getConfigFields: this._handleGetConfigFields.bind(this),
|
|
60
|
+
handleHttpRequest: this._handleHttpRequest.bind(this),
|
|
61
|
+
learnAction: this._handleLearnAction.bind(this),
|
|
62
|
+
learnFeedback: this._handleLearnFeedback.bind(this),
|
|
63
|
+
startStopRecordActions: this._handleStartStopRecordActions.bind(this),
|
|
64
|
+
variablesChanged: async () => undefined, // Not needed since 1.13.0
|
|
65
|
+
sharedUdpSocketMessage: this._handleSharedUdpSocketMessage.bind(this),
|
|
66
|
+
sharedUdpSocketError: this._handleSharedUdpSocketError.bind(this),
|
|
67
|
+
}, (msg) => {
|
|
68
|
+
process.send(msg);
|
|
69
|
+
}, 5000);
|
|
70
|
+
process.on('message', (msg) => {
|
|
71
|
+
this.#ipcWrapper.receivedMessage(msg);
|
|
72
|
+
});
|
|
73
|
+
const parseVariablesInStringIfNeeded = async (msg) => {
|
|
74
|
+
// Shortcut in case there is definitely nothing to parse
|
|
75
|
+
if (!msg.text.includes('$('))
|
|
76
|
+
return {
|
|
77
|
+
text: msg.text,
|
|
78
|
+
variableIds: undefined,
|
|
79
|
+
};
|
|
80
|
+
return this.#ipcWrapper.sendWithCb('parseVariablesInString', msg);
|
|
81
|
+
};
|
|
82
|
+
this.#actionManager = new actions_js_1.ActionManager(parseVariablesInStringIfNeeded, (msg) => this.#ipcWrapper.sendWithNoCb('setActionDefinitions', msg), (msg) => this.#ipcWrapper.sendWithNoCb('setCustomVariable', msg), this.log.bind(this));
|
|
83
|
+
this.#feedbackManager = new feedback_js_1.FeedbackManager(parseVariablesInStringIfNeeded, (msg) => this.#ipcWrapper.sendWithNoCb('updateFeedbackValues', msg), (msg) => this.#ipcWrapper.sendWithNoCb('setFeedbackDefinitions', msg), this.log.bind(this));
|
|
84
|
+
this.#upgradeScripts = internal.upgradeScripts;
|
|
85
|
+
this.id = internal.id;
|
|
86
|
+
this.#label = internal.id; // Temporary
|
|
87
|
+
this.log('debug', 'Initializing');
|
|
88
|
+
}
|
|
89
|
+
async _handleInit(msg) {
|
|
90
|
+
return this.#lifecycleQueue.add(async () => {
|
|
91
|
+
if (this.#initialized)
|
|
92
|
+
throw new Error('Already initialized');
|
|
93
|
+
this.#lastConfig = msg.config;
|
|
94
|
+
this.#lastSecrets = msg.secrets;
|
|
95
|
+
this.#label = msg.label;
|
|
96
|
+
// Create initial config object
|
|
97
|
+
if (msg.isFirstInit) {
|
|
98
|
+
const newConfig = {};
|
|
99
|
+
const newSecrets = {};
|
|
100
|
+
const fields = this.getConfigFields();
|
|
101
|
+
for (const field of fields) {
|
|
102
|
+
if ('default' in field) {
|
|
103
|
+
if (field.type.startsWith('secret')) {
|
|
104
|
+
newSecrets[field.id] = field.default;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
newConfig[field.id] = field.default;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
this.#lastConfig = newConfig;
|
|
112
|
+
this.#lastSecrets = newSecrets;
|
|
113
|
+
this.saveConfig(this.#lastConfig, this.#lastSecrets);
|
|
114
|
+
// this is new, so there is no point attempting to run any upgrade scripts
|
|
115
|
+
msg.lastUpgradeIndex = this.#upgradeScripts.length - 1;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Making this handle actions/feedbacks is hard now due to the structure of options, so instead we just upgrade the config, and the actions/feedbacks will be handled in their own calls soon after this
|
|
119
|
+
*/
|
|
120
|
+
const { updatedConfig, updatedSecrets } = (0, upgrade_js_1.runThroughUpgradeScripts)([], [], msg.lastUpgradeIndex, this.#upgradeScripts, this.#lastConfig, this.#lastSecrets, false);
|
|
121
|
+
this.#lastConfig = updatedConfig ?? this.#lastConfig;
|
|
122
|
+
this.#lastSecrets = updatedSecrets ?? this.#lastSecrets;
|
|
123
|
+
// Now we can initialise the module
|
|
124
|
+
try {
|
|
125
|
+
await this.init(this.#lastConfig, !!msg.isFirstInit, this.#lastSecrets);
|
|
126
|
+
this.#initialized = true;
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
console.trace(`Init failed: ${e}`);
|
|
130
|
+
throw e;
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
hasHttpHandler: typeof this.handleHttpRequest === 'function',
|
|
134
|
+
hasRecordActionsHandler: typeof this.handleStartStopRecordActions == 'function',
|
|
135
|
+
newUpgradeIndex: this.#upgradeScripts.length - 1,
|
|
136
|
+
updatedConfig: this.#lastConfig,
|
|
137
|
+
updatedSecrets: this.#lastSecrets,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async _handleDestroy() {
|
|
142
|
+
await this.#lifecycleQueue.add(async () => {
|
|
143
|
+
if (!this.#initialized)
|
|
144
|
+
throw new Error('Not initialized');
|
|
145
|
+
await this.destroy();
|
|
146
|
+
this.#initialized = false;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
async _handleConfigUpdateAndLabel(msg) {
|
|
150
|
+
await this.#lifecycleQueue.add(async () => {
|
|
151
|
+
if (!this.#initialized)
|
|
152
|
+
throw new Error('Not initialized');
|
|
153
|
+
this.#label = msg.label;
|
|
154
|
+
this.#lastConfig = msg.config;
|
|
155
|
+
await this.configUpdated(this.#lastConfig, this.#lastSecrets);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
async _handleExecuteAction(msg) {
|
|
159
|
+
return this.#actionManager.handleExecuteAction(msg);
|
|
160
|
+
}
|
|
161
|
+
async _handleUpdateFeedbacks(msg) {
|
|
162
|
+
this.#feedbackManager.handleUpdateFeedbacks(msg.feedbacks);
|
|
163
|
+
}
|
|
164
|
+
async _handleUpdateActions(msg) {
|
|
165
|
+
this.#actionManager.handleUpdateActions(msg.actions);
|
|
166
|
+
}
|
|
167
|
+
async _handleUpgradeActionsAndFeedbacks(msg) {
|
|
168
|
+
return (0, upgrade_js_1.runThroughUpgradeScripts)(msg.actions, msg.feedbacks, null, this.#upgradeScripts, this.#lastConfig, this.#lastSecrets, true);
|
|
169
|
+
}
|
|
170
|
+
async _handleGetConfigFields(_msg) {
|
|
171
|
+
return {
|
|
172
|
+
fields: (0, base_js_1.serializeIsVisibleFn)(this.getConfigFields()),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async _handleHttpRequest(msg) {
|
|
176
|
+
if (!this.handleHttpRequest)
|
|
177
|
+
throw new Error(`handleHttpRequest is not supported!`);
|
|
178
|
+
const res = await this.handleHttpRequest(msg.request);
|
|
179
|
+
return { response: res };
|
|
180
|
+
}
|
|
181
|
+
async _handleLearnAction(msg) {
|
|
182
|
+
return this.#actionManager.handleLearnAction(msg);
|
|
183
|
+
}
|
|
184
|
+
async _handleLearnFeedback(msg) {
|
|
185
|
+
return this.#feedbackManager.handleLearnFeedback(msg);
|
|
186
|
+
}
|
|
187
|
+
async _handleStartStopRecordActions(msg) {
|
|
188
|
+
if (!msg.recording) {
|
|
189
|
+
if (!this.#recordingActions) {
|
|
190
|
+
// Already stopped
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
if (this.#recordingActions) {
|
|
196
|
+
// Already running
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (!this.handleStartStopRecordActions) {
|
|
201
|
+
this.#recordingActions = false;
|
|
202
|
+
throw new Error('Recording actions is not supported by this module!');
|
|
203
|
+
}
|
|
204
|
+
this.#recordingActions = msg.recording;
|
|
205
|
+
this.handleStartStopRecordActions(this.#recordingActions);
|
|
206
|
+
}
|
|
207
|
+
async _handleSharedUdpSocketMessage(msg) {
|
|
208
|
+
for (const socket of this.#sharedUdpSocketHandlers.values()) {
|
|
209
|
+
if (socket.handleId === msg.handleId) {
|
|
210
|
+
socket.receiveSocketMessage(msg);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
async _handleSharedUdpSocketError(msg) {
|
|
215
|
+
for (const socket of this.#sharedUdpSocketHandlers.values()) {
|
|
216
|
+
if (socket.handleId === msg.handleId) {
|
|
217
|
+
socket.receiveSocketError(msg.error);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
saveConfig(newConfig, newSecrets) {
|
|
222
|
+
if (newConfig)
|
|
223
|
+
this.#lastConfig = newConfig;
|
|
224
|
+
if (newSecrets)
|
|
225
|
+
this.#lastSecrets = newSecrets;
|
|
226
|
+
this.#ipcWrapper.sendWithNoCb('saveConfig', { config: newConfig, secrets: newSecrets });
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Set the action definitions for this instance
|
|
230
|
+
* @param actions The action definitions
|
|
231
|
+
*/
|
|
232
|
+
setActionDefinitions(actions) {
|
|
233
|
+
this.#actionManager.setActionDefinitions(actions);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Set the feedback definitions for this instance
|
|
237
|
+
* @param feedbacks The feedback definitions
|
|
238
|
+
*/
|
|
239
|
+
setFeedbackDefinitions(feedbacks) {
|
|
240
|
+
this.#feedbackManager.setFeedbackDefinitions(feedbacks);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Set the peset definitions for this instance
|
|
244
|
+
* @param presets The preset definitions
|
|
245
|
+
*/
|
|
246
|
+
setPresetDefinitions(presets) {
|
|
247
|
+
const hostPresets = [];
|
|
248
|
+
for (const [id, preset] of Object.entries(presets)) {
|
|
249
|
+
if (preset) {
|
|
250
|
+
hostPresets.push({
|
|
251
|
+
...preset,
|
|
252
|
+
id,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
this.#ipcWrapper.sendWithNoCb('setPresetDefinitions', { presets: hostPresets });
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Set the variable definitions for this instance
|
|
260
|
+
* @param variables The variable definitions
|
|
261
|
+
*/
|
|
262
|
+
setVariableDefinitions(variables) {
|
|
263
|
+
const hostVariables = [];
|
|
264
|
+
const hostValues = [];
|
|
265
|
+
this.#variableDefinitions.clear();
|
|
266
|
+
for (const variable of variables) {
|
|
267
|
+
hostVariables.push({
|
|
268
|
+
id: variable.variableId,
|
|
269
|
+
name: variable.name,
|
|
270
|
+
});
|
|
271
|
+
// Remember the definition locally
|
|
272
|
+
this.#variableDefinitions.set(variable.variableId, variable);
|
|
273
|
+
if (!this.#variableValues.has(variable.variableId)) {
|
|
274
|
+
// Give us a local cached value of something
|
|
275
|
+
this.#variableValues.set(variable.variableId, '');
|
|
276
|
+
hostValues.push({
|
|
277
|
+
id: variable.variableId,
|
|
278
|
+
value: '',
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (!this.#options.disableVariableValidation) {
|
|
283
|
+
const validIds = new Set(this.#variableDefinitions.keys());
|
|
284
|
+
for (const id of this.#variableValues.keys()) {
|
|
285
|
+
if (!validIds.has(id)) {
|
|
286
|
+
// Delete any local cached value
|
|
287
|
+
this.#variableValues.delete(id);
|
|
288
|
+
hostValues.push({
|
|
289
|
+
id: id,
|
|
290
|
+
value: undefined,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
this.#ipcWrapper.sendWithNoCb('setVariableDefinitions', { variables: hostVariables, newValues: hostValues });
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Set the values of some variables
|
|
299
|
+
* @param values The new values for the variables
|
|
300
|
+
*/
|
|
301
|
+
setVariableValues(values) {
|
|
302
|
+
const hostValues = [];
|
|
303
|
+
for (const [variableId, value] of Object.entries(values)) {
|
|
304
|
+
if (this.#options.disableVariableValidation) {
|
|
305
|
+
// update the cached value
|
|
306
|
+
if (value === undefined) {
|
|
307
|
+
this.#variableValues.delete(variableId);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
this.#variableValues.set(variableId, value);
|
|
311
|
+
}
|
|
312
|
+
hostValues.push({
|
|
313
|
+
id: variableId,
|
|
314
|
+
value: value,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
else if (this.#variableDefinitions.has(variableId)) {
|
|
318
|
+
// update the cached value
|
|
319
|
+
this.#variableValues.set(variableId, value ?? '');
|
|
320
|
+
hostValues.push({
|
|
321
|
+
id: variableId,
|
|
322
|
+
value: value ?? '',
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
// tell companion to delete the value
|
|
327
|
+
hostValues.push({
|
|
328
|
+
id: variableId,
|
|
329
|
+
value: undefined,
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
this.#ipcWrapper.sendWithNoCb('setVariableValues', { newValues: hostValues });
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Get the last set value of a variable from this connection
|
|
337
|
+
* @param variableId id of the variable
|
|
338
|
+
* @returns The value
|
|
339
|
+
*/
|
|
340
|
+
getVariableValue(variableId) {
|
|
341
|
+
return this.#variableValues.get(variableId);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* @deprecated Companion now handles this for you, for actions and feedbacks. If you need this for another purpose, let us know as we intend to remove this
|
|
345
|
+
*
|
|
346
|
+
* Parse and replace all the variables in a string
|
|
347
|
+
* Note: You must not use this for feedbacks, as your feedback will not update when the variable changes.
|
|
348
|
+
* There is an alternate version of this supplied to each of the action/feedback callbacks that tracks
|
|
349
|
+
* usages properly and will retrigger the feedback when the variables change.
|
|
350
|
+
* @param text The text to parse
|
|
351
|
+
* @returns The string with variables replaced with their values
|
|
352
|
+
*/
|
|
353
|
+
async parseVariablesInString(text) {
|
|
354
|
+
const currentContext = this.#feedbackManager.parseVariablesContext;
|
|
355
|
+
if (currentContext) {
|
|
356
|
+
this.log('debug', `parseVariablesInString called while in: ${currentContext}. You should use the parseVariablesInString provided to the callback instead`);
|
|
357
|
+
}
|
|
358
|
+
// If there are no variables, just return the text
|
|
359
|
+
if (!text.includes('$('))
|
|
360
|
+
return text;
|
|
361
|
+
const res = await this.#ipcWrapper.sendWithCb('parseVariablesInString', {
|
|
362
|
+
text: text,
|
|
363
|
+
controlId: undefined,
|
|
364
|
+
actionInstanceId: undefined,
|
|
365
|
+
feedbackInstanceId: undefined,
|
|
366
|
+
});
|
|
367
|
+
return res.text;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Request all feedbacks of the specified types to be checked for changes
|
|
371
|
+
* @param feedbackTypes The feedback types to check
|
|
372
|
+
*/
|
|
373
|
+
checkFeedbacks(...feedbackTypes) {
|
|
374
|
+
this.#feedbackManager.checkFeedbacks(feedbackTypes);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Request the specified feedback instances to be checked for changes
|
|
378
|
+
* @param feedbackIds The ids of the feedback instances to check
|
|
379
|
+
*/
|
|
380
|
+
checkFeedbacksById(...feedbackIds) {
|
|
381
|
+
this.#feedbackManager.checkFeedbacksById(feedbackIds);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Call subscribe on all currently known placed actions.
|
|
385
|
+
* It can be useful to trigger this upon establishing a connection, to ensure all data is loaded.
|
|
386
|
+
* @param actionIds The actionIds to call subscribe for. If no values are provided, then all are called.
|
|
387
|
+
*/
|
|
388
|
+
subscribeActions(...actionIds) {
|
|
389
|
+
this.#actionManager.subscribeActions(actionIds);
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Call unsubscribe on all currently known placed actions.
|
|
393
|
+
* It can be useful to do some cleanup upon a connection closing.
|
|
394
|
+
* @param actionIds The actionIds to call subscribe for. If no values are provided, then all are called.
|
|
395
|
+
*/
|
|
396
|
+
unsubscribeActions(...actionIds) {
|
|
397
|
+
this.#actionManager.unsubscribeActions(actionIds);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Call subscribe on all currently known placed feedbacks.
|
|
401
|
+
* It can be useful to trigger this upon establishing a connection, to ensure all data is loaded.
|
|
402
|
+
* @param feedbackIds The feedbackIds to call subscribe for. If no values are provided, then all are called.
|
|
403
|
+
*/
|
|
404
|
+
subscribeFeedbacks(...feedbackIds) {
|
|
405
|
+
this.#feedbackManager.subscribeFeedbacks(feedbackIds);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Call unsubscribe on all currently known placed feedbacks.
|
|
409
|
+
* It can be useful to do some cleanup upon a connection closing.
|
|
410
|
+
* @param feedbackIds The feedbackIds to call subscribe for. If no values are provided, then all are called.
|
|
411
|
+
*/
|
|
412
|
+
unsubscribeFeedbacks(...feedbackIds) {
|
|
413
|
+
this.#feedbackManager.unsubscribeFeedbacks(feedbackIds);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Add an action to the current recording session
|
|
417
|
+
* @param action The action to be added to the recording session
|
|
418
|
+
* @param uniquenessId A unique id for the action being recorded. This should be different for each action, but by passing the same as a previous call will replace the previous value.
|
|
419
|
+
*/
|
|
420
|
+
recordAction(action, uniquenessId) {
|
|
421
|
+
if (!this.#recordingActions)
|
|
422
|
+
throw new Error('Not currently recording actions');
|
|
423
|
+
this.#ipcWrapper.sendWithNoCb('recordAction', {
|
|
424
|
+
uniquenessId: uniquenessId ?? null,
|
|
425
|
+
actionId: action.actionId,
|
|
426
|
+
options: action.options,
|
|
427
|
+
delay: action.delay,
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Send an osc message from the system osc sender
|
|
432
|
+
* @param host destination ip address
|
|
433
|
+
* @param port destination port number
|
|
434
|
+
* @param path message path
|
|
435
|
+
* @param args mesage arguments
|
|
436
|
+
*/
|
|
437
|
+
oscSend(host, port, path, args) {
|
|
438
|
+
this.#ipcWrapper.sendWithNoCb('send-osc', (0, util_js_1.literal)({
|
|
439
|
+
host,
|
|
440
|
+
port,
|
|
441
|
+
path,
|
|
442
|
+
args,
|
|
443
|
+
}));
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Update the status of this connection
|
|
447
|
+
* @param status The status level
|
|
448
|
+
* @param message Additional information about the status
|
|
449
|
+
*
|
|
450
|
+
* ### Example
|
|
451
|
+
* ```js
|
|
452
|
+
* this.updateStatus(InstanceStatus.Ok)
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
updateStatus(status, message) {
|
|
456
|
+
this.#ipcWrapper.sendWithNoCb('set-status', (0, util_js_1.literal)({
|
|
457
|
+
status,
|
|
458
|
+
message: message ?? null,
|
|
459
|
+
}));
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Write a line to the log
|
|
463
|
+
* @param level The level of the message
|
|
464
|
+
* @param message The message text to write
|
|
465
|
+
*/
|
|
466
|
+
log(level, message) {
|
|
467
|
+
this.#ipcWrapper.sendWithNoCb('log-message', (0, util_js_1.literal)({
|
|
468
|
+
level,
|
|
469
|
+
message,
|
|
470
|
+
}));
|
|
471
|
+
}
|
|
472
|
+
createSharedUdpSocket(typeOrOptions, callback) {
|
|
473
|
+
const options = typeof typeOrOptions === 'string' ? { type: typeOrOptions } : typeOrOptions;
|
|
474
|
+
const socket = new shared_udp_socket_js_1.SharedUdpSocketImpl(this.#ipcWrapper, this.#sharedUdpSocketHandlers, options);
|
|
475
|
+
if (callback)
|
|
476
|
+
socket.on('message', callback);
|
|
477
|
+
return socket;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
exports.InstanceBase = InstanceBase;
|
|
481
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/module-api/base.ts"],"names":[],"mappings":";;;;AAmCA,wCAAoC;AAEpC,+CAA+C;AAC/C,8DAA4B;AAK5B,iDAA+E;AAC/E,uDAAiE;AACjE,yDAAyD;AAEzD,+DAAuD;AACvD,uDAAsD;AACtD,iEAK+B;AAU/B,MAAsB,YAAY;IACxB,WAAW,CAAwD;IACnE,eAAe,CAAmD;IAC3D,EAAE,CAAQ;IAEjB,eAAe,GAAW,IAAI,iBAAM,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,CAAA;IACjE,YAAY,GAAG,KAAK,CAAA;IACpB,iBAAiB,GAAG,KAAK,CAAA;IAEzB,WAAW,GAAY,EAAS,CAAA;IAChC,YAAY,GAAa,EAAS,CAAA;IAEzB,cAAc,CAAe;IAC7B,gBAAgB,CAAiB;IAEjC,wBAAwB,GAAG,IAAI,GAAG,EAA+B,CAAA;IACjE,oBAAoB,GAAG,IAAI,GAAG,EAAuC,CAAA;IAErE,eAAe,GAAG,IAAI,GAAG,EAAkC,CAAA;IAE3D,QAAQ,CAAqB;IACtC,MAAM,CAAQ;IAEd,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAA;IACrB,CAAC;IAED;;;OAGG;IACH,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAA;IACnB,CAAC;IAED;;OAEG;IACH,YAAY,QAAiB;QAC5B,IAAI,CAAC,IAAA,6BAAmB,EAAoB,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB;YACtF,MAAM,IAAI,KAAK,CACd,mGAAmG,CACnG,CAAA;QAEF,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC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AAU,EACV,IAAA,iBAAO,EAAiB;YACvB,IAAI;YACJ,IAAI;YACJ,IAAI;YACJ,IAAI;SACJ,CAAC,CACF,CAAA;IACF,CAAC;IAED;;;;;;;;;OASG;IACH,YAAY,CAAC,MAAsB,EAAE,OAAuB;QAC3D,IAAI,CAAC,WAAW,CAAC,YAAY,CAC5B,YAAY,EACZ,IAAA,iBAAO,EAAmB;YACzB,MAAM;YACN,OAAO,EAAE,OAAO,IAAI,IAAI;SACxB,CAAC,CACF,CAAA;IACF,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,KAAe,EAAE,OAAe;QACnC,IAAI,CAAC,WAAW,CAAC,YAAY,CAC5B,aAAa,EACb,IAAA,iBAAO,EAAoB;YAC1B,KAAK;YACL,OAAO;SACP,CAAC,CACF,CAAA;IACF,CAAC;IAYD,qBAAqB,CACpB,aAAuD,EACvD,QAAyC;QAEzC,MAAM,OAAO,GAA2B,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,aAAa,CAAA;QAEnH,MAAM,MAAM,GAAG,IAAI,0CAAmB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAA;QAChG,IAAI,QAAQ;YAAE,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAE5C,OAAO,MAAM,CAAA;IACd,CAAC;CACD;AAnnBD,oCAmnBC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions available in the context of an action/feedback
|
|
3
|
+
*/
|
|
4
|
+
export interface CompanionCommonCallbackContext {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Companion now handles this for you, you should no longer need to use this
|
|
7
|
+
* Parse and replace all the variables in a string
|
|
8
|
+
* Note: it is important to use this version when in a feedback, so that the feedback will react properly when the variables parsed change
|
|
9
|
+
* @param text The text to parse
|
|
10
|
+
* @returns The string with variables replaced with their values
|
|
11
|
+
*/
|
|
12
|
+
parseVariablesInString(text: string): Promise<string>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/module-api/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;;;OAMG;IACH,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/module-api/common.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CompanionInputFieldBase, CompanionInputFieldBonjourDevice, CompanionInputFieldCheckbox, CompanionInputFieldColor, CompanionInputFieldDropdown, CompanionInputFieldMultiDropdown, CompanionInputFieldNumber, CompanionInputFieldSecret, CompanionInputFieldStaticText, CompanionInputFieldTextInput } from './input.js';
|
|
2
|
+
/**
|
|
3
|
+
* A configuration input field
|
|
4
|
+
*/
|
|
5
|
+
export interface CompanionConfigField extends CompanionInputFieldBase {
|
|
6
|
+
width: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Some configuration input field
|
|
10
|
+
*/
|
|
11
|
+
export type SomeCompanionConfigField = (CompanionInputFieldStaticText | CompanionInputFieldColor | CompanionInputFieldTextInput | CompanionInputFieldDropdown | CompanionInputFieldMultiDropdown | CompanionInputFieldNumber | CompanionInputFieldCheckbox | CompanionInputFieldBonjourDevice | CompanionInputFieldSecret) & CompanionConfigField;
|
|
12
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/module-api/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,uBAAuB,EACvB,gCAAgC,EAChC,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,gCAAgC,EAChC,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,4BAA4B,EAC5B,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,uBAAuB;IACpE,KAAK,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACpC,6BAA6B,GAC7B,wBAAwB,GACxB,4BAA4B,GAC5B,2BAA2B,GAC3B,gCAAgC,GAChC,yBAAyB,GACzB,2BAA2B,GAC3B,gCAAgC,GAChC,yBAAyB,CAC3B,GACA,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/module-api/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All the possible status levels that an instance can use.
|
|
3
|
+
* Note: When adding more, companion needs to be updated to know how they should be displayed
|
|
4
|
+
*/
|
|
5
|
+
export declare enum InstanceStatus {
|
|
6
|
+
Ok = "ok",
|
|
7
|
+
Connecting = "connecting",
|
|
8
|
+
Disconnected = "disconnected",
|
|
9
|
+
ConnectionFailure = "connection_failure",
|
|
10
|
+
BadConfig = "bad_config",
|
|
11
|
+
UnknownError = "unknown_error",
|
|
12
|
+
UnknownWarning = "unknown_warning",
|
|
13
|
+
AuthenticationFailure = "authentication_failure"
|
|
14
|
+
}
|
|
15
|
+
export type LogLevel = 'info' | 'warn' | 'error' | 'debug';
|
|
16
|
+
export declare namespace Regex {
|
|
17
|
+
const IP = "/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/";
|
|
18
|
+
const HOSTNAME = "/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/";
|
|
19
|
+
const BOOLEAN = "/^(true|false|0|1)$/i";
|
|
20
|
+
const PORT = "/^([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-4])$/";
|
|
21
|
+
const MAC_ADDRESS = "/^(?:[a-fA-F0-9]{2}:){5}([a-fA-F0-9]{2})$/";
|
|
22
|
+
const PERCENT = "/^(100|[0-9]|[0-9][0-9])$/";
|
|
23
|
+
const FLOAT = "/^([0-9]*\\.)?[0-9]+$/";
|
|
24
|
+
const SIGNED_FLOAT = "/^[+-]?([0-9]*\\.)?[0-9]+$/";
|
|
25
|
+
const FLOAT_OR_INT = "/^([0-9]+)(\\.[0-9]+)?$/";
|
|
26
|
+
const NUMBER = "/^\\d+$/";
|
|
27
|
+
const SIGNED_NUMBER = "/^[+-]?\\d+$/";
|
|
28
|
+
const SOMETHING = "/^.+$/";
|
|
29
|
+
const TIMECODE = "/^(0*[0-9]|1[0-9]|2[0-4]):(0*[0-9]|[1-5][0-9]|60):(0*[0-9]|[1-5][0-9]|60):(0*[0-9]|[12][0-9]|30)$/";
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/module-api/enums.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,cAAc;IACzB,EAAE,OAAO;IACT,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,iBAAiB,uBAAuB;IACxC,SAAS,eAAe;IACxB,YAAY,kBAAkB;IAC9B,cAAc,oBAAoB;IAClC,qBAAqB,2BAA2B;CAChD;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;AAG1D,yBAAiB,KAAK,CAAC;IAEf,MAAM,EAAE,mGAAmG,CAAA;IAC3G,MAAM,QAAQ,iHAC0F,CAAA;IACxG,MAAM,OAAO,0BAA0B,CAAA;IACvC,MAAM,IAAI,4LACyK,CAAA;IACnL,MAAM,WAAW,+CAA+C,CAAA;IAChE,MAAM,OAAO,+BAA+B,CAAA;IAC5C,MAAM,KAAK,2BAA2B,CAAA;IACtC,MAAM,YAAY,gCAAgC,CAAA;IAClD,MAAM,YAAY,6BAA6B,CAAA;IAC/C,MAAM,MAAM,aAAa,CAAA;IACzB,MAAM,aAAa,kBAAkB,CAAA;IACrC,MAAM,SAAS,WAAW,CAAA;IAC1B,MAAM,QAAQ,uGACgF,CAAA;CACrG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Regex = exports.InstanceStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* All the possible status levels that an instance can use.
|
|
6
|
+
* Note: When adding more, companion needs to be updated to know how they should be displayed
|
|
7
|
+
*/
|
|
8
|
+
var InstanceStatus;
|
|
9
|
+
(function (InstanceStatus) {
|
|
10
|
+
InstanceStatus["Ok"] = "ok";
|
|
11
|
+
InstanceStatus["Connecting"] = "connecting";
|
|
12
|
+
InstanceStatus["Disconnected"] = "disconnected";
|
|
13
|
+
InstanceStatus["ConnectionFailure"] = "connection_failure";
|
|
14
|
+
InstanceStatus["BadConfig"] = "bad_config";
|
|
15
|
+
InstanceStatus["UnknownError"] = "unknown_error";
|
|
16
|
+
InstanceStatus["UnknownWarning"] = "unknown_warning";
|
|
17
|
+
InstanceStatus["AuthenticationFailure"] = "authentication_failure";
|
|
18
|
+
})(InstanceStatus || (exports.InstanceStatus = InstanceStatus = {}));
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
20
|
+
var Regex;
|
|
21
|
+
(function (Regex) {
|
|
22
|
+
// TODO - are all of these needed?
|
|
23
|
+
Regex.IP = '/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/';
|
|
24
|
+
Regex.HOSTNAME = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/';
|
|
25
|
+
Regex.BOOLEAN = '/^(true|false|0|1)$/i';
|
|
26
|
+
Regex.PORT = '/^([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-4])$/';
|
|
27
|
+
Regex.MAC_ADDRESS = '/^(?:[a-fA-F0-9]{2}:){5}([a-fA-F0-9]{2})$/';
|
|
28
|
+
Regex.PERCENT = '/^(100|[0-9]|[0-9][0-9])$/';
|
|
29
|
+
Regex.FLOAT = '/^([0-9]*\\.)?[0-9]+$/';
|
|
30
|
+
Regex.SIGNED_FLOAT = '/^[+-]?([0-9]*\\.)?[0-9]+$/';
|
|
31
|
+
Regex.FLOAT_OR_INT = '/^([0-9]+)(\\.[0-9]+)?$/';
|
|
32
|
+
Regex.NUMBER = '/^\\d+$/';
|
|
33
|
+
Regex.SIGNED_NUMBER = '/^[+-]?\\d+$/';
|
|
34
|
+
Regex.SOMETHING = '/^.+$/';
|
|
35
|
+
Regex.TIMECODE = '/^(0*[0-9]|1[0-9]|2[0-4]):(0*[0-9]|[1-5][0-9]|60):(0*[0-9]|[1-5][0-9]|60):(0*[0-9]|[12][0-9]|30)$/';
|
|
36
|
+
})(Regex || (exports.Regex = Regex = {}));
|
|
37
|
+
//# sourceMappingURL=enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/module-api/enums.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,cASX;AATD,WAAY,cAAc;IACzB,2BAAS,CAAA;IACT,2CAAyB,CAAA;IACzB,+CAA6B,CAAA;IAC7B,0DAAwC,CAAA;IACxC,0CAAwB,CAAA;IACxB,gDAA8B,CAAA;IAC9B,oDAAkC,CAAA;IAClC,kEAAgD,CAAA;AACjD,CAAC,EATW,cAAc,8BAAd,cAAc,QASzB;AAID,2DAA2D;AAC3D,IAAiB,KAAK,CAkBrB;AAlBD,WAAiB,KAAK;IACrB,kCAAkC;IACrB,QAAE,GAAG,gGAAgG,CAAA;IACrG,cAAQ,GACpB,8GAA8G,CAAA;IAClG,aAAO,GAAG,uBAAuB,CAAA;IACjC,UAAI,GAChB,yLAAyL,CAAA;IAC7K,iBAAW,GAAG,4CAA4C,CAAA;IAC1D,aAAO,GAAG,4BAA4B,CAAA;IACtC,WAAK,GAAG,wBAAwB,CAAA;IAChC,kBAAY,GAAG,6BAA6B,CAAA;IAC5C,kBAAY,GAAG,0BAA0B,CAAA;IACzC,YAAM,GAAG,UAAU,CAAA;IACnB,mBAAa,GAAG,eAAe,CAAA;IAC/B,eAAS,GAAG,QAAQ,CAAA;IACpB,cAAQ,GACpB,oGAAoG,CAAA;AACtG,CAAC,EAlBgB,KAAK,qBAAL,KAAK,QAkBrB"}
|