@companion-module/base 1.5.0 → 1.6.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 +22 -1
- package/README.md +11 -4
- package/assets/manifest.schema.json +37 -0
- package/dist/host-api/ipc-wrapper.d.ts +4 -4
- package/dist/host-api/ipc-wrapper.d.ts.map +1 -1
- package/dist/host-api/ipc-wrapper.js +11 -7
- package/dist/host-api/ipc-wrapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/module-api/base.d.ts +1 -1
- package/dist/module-api/base.js +1 -1
- package/dist/module-api/config.d.ts +2 -2
- package/dist/module-api/config.d.ts.map +1 -1
- package/dist/module-api/input.d.ts +72 -3
- package/dist/module-api/input.d.ts.map +1 -1
- package/dist/module-api/style.d.ts +2 -1
- package/dist/module-api/style.d.ts.map +1 -1
- package/dist/util.d.ts +30 -4
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +85 -11
- package/dist/util.js.map +1 -1
- package/generated/manifest.d.ts +26 -1
- package/generated/validate_manifest.js +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [1.
|
|
3
|
+
## [1.6.0](https://github.com/bitfocus/companion-module-base/compare/v1.5.1...v1.6.0) (2023-10-14)
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* bonjour discovery config fields ([#57](https://github.com/bitfocus/companion-module-base/issues/57)) ([37d3cd9](https://github.com/bitfocus/companion-module-base/commit/37d3cd91aea400eb2685954ba6b792fd58559973))
|
|
9
|
+
* support css colors and alpha colorpicker ([1660c3b](https://github.com/bitfocus/companion-module-base/commit/1660c3b37395c5fd240579b3ae4ed864c3f337a1))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* expose ipc type ([c66d6f2](https://github.com/bitfocus/companion-module-base/commit/c66d6f2344ee5f4f239256765a9ec0fe559dc556))
|
|
15
|
+
|
|
16
|
+
## [1.5.1](https://github.com/bitfocus/companion-module-base/compare/v1.5.0...v1.5.1) (2023-10-02)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* use sequential ids in ipcWrapper, to ensure nanoid doesn't drain the system entropy pool ([5b5c32c](https://github.com/bitfocus/companion-module-base/commit/5b5c32cf3b9a1fe5b9b900c90d02a1970fd0a7c1))
|
|
22
|
+
|
|
23
|
+
## [1.5.0](https://github.com/bitfocus/companion-module-base/compare/v1.4.3...v1.5.0) (2023-08-27)
|
|
24
|
+
|
|
25
|
+
Requires Companion 3.1 or later
|
|
26
|
+
|
|
6
27
|
### Features
|
|
7
28
|
|
|
8
29
|
* boolean feedback invert ([#59](https://github.com/bitfocus/companion-module-base/issues/59)) ([aa28207](https://github.com/bitfocus/companion-module-base/commit/aa28207ee5f71f280a5c61d78424f9f6a03e12f9))
|
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# @companion-module/base
|
|
2
2
|
|
|
3
|
-
If you have found this without being directed here, then this is not for you.
|
|
4
|
-
Companion 3.0 is not ready for users yet, so you should not be targetting a module to it yet. We will make some announcements when we are ready
|
|
5
|
-
|
|
6
3
|
This module provides the base class and framework needed to write a module for [Companion 3.0](https://github.com/bitfocus/companion) and later in NodeJS.
|
|
7
4
|
|
|
8
5
|
In the future it will be possible to write modules in other languages, but it is not recommended as it will reduce the change of gettings other in the community to contribute features and fixes. If you interested in doing this then reach out and we can work together on creating an alternate framework for the language you are using.
|
|
9
6
|
|
|
7
|
+
## Supported versions of this library
|
|
8
|
+
|
|
9
|
+
Each version of Companion supports a limited range of versions of this library listed below. Any patch version (the third number) are not relevant for the compatibility check, so are not listed here
|
|
10
|
+
|
|
11
|
+
| Companion | Module-base |
|
|
12
|
+
| --------- | ------------------------- |
|
|
13
|
+
| v3.0 | v1.0 - v1.4 |
|
|
14
|
+
| v3.1 | v1.0 - v1.5 |
|
|
15
|
+
| v3.2 | v1.0 - v1.6 (unconfirmed) |
|
|
16
|
+
|
|
10
17
|
## Getting started with a new module
|
|
11
18
|
|
|
12
19
|
To get started with creating a new module, you should start with one of the following templates. These should be kept up to date, but you should make sure all the dependencies are up to date before you begin.
|
|
13
20
|
|
|
14
|
-
-
|
|
21
|
+
- https://github.com/bitfocus/companion-module-template
|
|
15
22
|
|
|
16
23
|
## Documentation
|
|
17
24
|
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
"type": "object",
|
|
4
4
|
"title": "ModuleManifest",
|
|
5
5
|
"properties": {
|
|
6
|
+
"$schema": {
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
6
9
|
"id": {
|
|
7
10
|
"type": "string",
|
|
8
11
|
"description": "Unique identifier for the module"
|
|
@@ -104,8 +107,42 @@
|
|
|
104
107
|
"items": {
|
|
105
108
|
"type": "string"
|
|
106
109
|
}
|
|
110
|
+
},
|
|
111
|
+
"bonjourQueries": {
|
|
112
|
+
"type": "object",
|
|
113
|
+
"description": "If the device or software for your module supports bonjour announcements, Companion will offer an easy way to watch for these announcements.\nEach query you define must have a matching config field of type 'bonjour-device' with the same name",
|
|
114
|
+
"patternProperties": {
|
|
115
|
+
"": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"title": "ModuleBonjourQuery",
|
|
118
|
+
"description": "",
|
|
119
|
+
"properties": {
|
|
120
|
+
"type": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
},
|
|
123
|
+
"protocol": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"enum": ["tcp", "udp"]
|
|
126
|
+
},
|
|
127
|
+
"txt": {
|
|
128
|
+
"type": "object",
|
|
129
|
+
"description": "Match on any txt values returned in the query. This is useful to filter out devices of the same 'type' that are not supported",
|
|
130
|
+
"patternProperties": {
|
|
131
|
+
"": {
|
|
132
|
+
"type": "string"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"additionalProperties": false
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"required": ["type", "protocol"],
|
|
139
|
+
"additionalProperties": false
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"additionalProperties": false
|
|
107
143
|
}
|
|
108
144
|
},
|
|
145
|
+
"additionalProperties": false,
|
|
109
146
|
"required": [
|
|
110
147
|
"id",
|
|
111
148
|
"name",
|
|
@@ -5,7 +5,7 @@ type HandlerFunction<T extends (...args: any) => any> = (data: Parameters<T>[0])
|
|
|
5
5
|
type HandlerReturnType<T extends (...args: any) => any> = ReturnType<T> extends never ? Promise<void> : Promise<ReturnType<T>>;
|
|
6
6
|
type HandlerFunctionOrNever<T> = T extends (...args: any) => any ? HandlerFunction<T> : never;
|
|
7
7
|
/** Map of handler functions */
|
|
8
|
-
type
|
|
8
|
+
export type IpcEventHandlers<T extends object> = {
|
|
9
9
|
[K in keyof T]: HandlerFunctionOrNever<T[K]>;
|
|
10
10
|
};
|
|
11
11
|
type ParamsIfReturnIsNever<T extends (...args: any[]) => any> = ReturnType<T> extends never ? Parameters<T> : never;
|
|
@@ -14,11 +14,11 @@ interface IpcCallMessagePacket {
|
|
|
14
14
|
direction: 'call';
|
|
15
15
|
name: string;
|
|
16
16
|
payload: string;
|
|
17
|
-
callbackId:
|
|
17
|
+
callbackId: number | undefined;
|
|
18
18
|
}
|
|
19
19
|
interface IpcResponseMessagePacket {
|
|
20
20
|
direction: 'response';
|
|
21
|
-
callbackId:
|
|
21
|
+
callbackId: number;
|
|
22
22
|
success: boolean;
|
|
23
23
|
payload: string;
|
|
24
24
|
}
|
|
@@ -28,7 +28,7 @@ export declare class IpcWrapper<TOutbound extends {
|
|
|
28
28
|
[key: string]: any;
|
|
29
29
|
}> {
|
|
30
30
|
#private;
|
|
31
|
-
constructor(handlers:
|
|
31
|
+
constructor(handlers: IpcEventHandlers<TInbound>, sendMessage: (message: IpcCallMessagePacket | IpcResponseMessagePacket) => void, defaultTimeout: number);
|
|
32
32
|
sendWithCb<T extends keyof TOutbound>(name: T, msg: ParamsIfReturnIsValid<TOutbound[T]>[0], defaultResponse?: () => Error, timeout?: number): Promise<ReturnType<TOutbound[T]>>;
|
|
33
33
|
sendWithNoCb<T extends keyof TOutbound>(name: T, msg: ParamsIfReturnIsNever<TOutbound[T]>[0]): void;
|
|
34
34
|
receivedMessage(msg: IpcCallMessagePacket | IpcResponseMessagePacket): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipc-wrapper.d.ts","sourceRoot":"","sources":["../../src/host-api/ipc-wrapper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ipc-wrapper.d.ts","sourceRoot":"","sources":["../../src/host-api/ipc-wrapper.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,KAAK,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC,CAAC,CAAA;AAExG,KAAK,iBAAiB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,SAAS,KAAK,GAClF,OAAO,CAAC,IAAI,CAAC,GACb,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;AAEzB,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;AAE7F,+BAA+B;AAC/B,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;KAC/C,CAAC,IAAI,MAAM,CAAC,GAAG,sBAAsB,C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AAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAgCpC,YAAY,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IASnG,eAAe,CAAC,GAAG,EAAE,oBAAoB,GAAG,wBAAwB,GAAG,IAAI;CA+E3E"}
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IpcWrapper = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const nanoid_1 = require("nanoid");
|
|
6
5
|
const util_1 = require("../util");
|
|
7
6
|
const ejson_1 = tslib_1.__importDefault(require("ejson"));
|
|
7
|
+
const MAX_CALLBACK_ID = 1 << 28;
|
|
8
8
|
class IpcWrapper {
|
|
9
9
|
#handlers;
|
|
10
10
|
#sendMessage;
|
|
11
11
|
#defaultTimeout;
|
|
12
|
-
#
|
|
12
|
+
#nextCallbackId = 1;
|
|
13
|
+
#pendingCallbacks = new Map();
|
|
13
14
|
constructor(handlers, sendMessage, defaultTimeout) {
|
|
14
15
|
this.#handlers = handlers;
|
|
15
16
|
this.#sendMessage = sendMessage;
|
|
@@ -23,8 +24,11 @@ class IpcWrapper {
|
|
|
23
24
|
callbacks.resolve = resolve;
|
|
24
25
|
callbacks.reject = reject;
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
-
this.#
|
|
27
|
+
// Reset the id when it gets really high
|
|
28
|
+
if (this.#nextCallbackId > MAX_CALLBACK_ID)
|
|
29
|
+
this.#nextCallbackId = 1;
|
|
30
|
+
const id = this.#nextCallbackId++;
|
|
31
|
+
this.#pendingCallbacks.set(id, callbacks);
|
|
28
32
|
this.#sendMessage({
|
|
29
33
|
direction: 'call',
|
|
30
34
|
name: String(name),
|
|
@@ -35,7 +39,7 @@ class IpcWrapper {
|
|
|
35
39
|
const timeoutError = new Error('Call timed out');
|
|
36
40
|
callbacks.timeout = setTimeout(() => {
|
|
37
41
|
callbacks.reject(defaultResponse ? defaultResponse() : timeoutError);
|
|
38
|
-
|
|
42
|
+
this.#pendingCallbacks.delete(id);
|
|
39
43
|
}, timeout);
|
|
40
44
|
return promise;
|
|
41
45
|
}
|
|
@@ -91,8 +95,8 @@ class IpcWrapper {
|
|
|
91
95
|
console.error(`Ipc: Response message has no callbackId`);
|
|
92
96
|
return;
|
|
93
97
|
}
|
|
94
|
-
const callbacks = this.#pendingCallbacks
|
|
95
|
-
|
|
98
|
+
const callbacks = this.#pendingCallbacks.get(msg.callbackId);
|
|
99
|
+
this.#pendingCallbacks.delete(msg.callbackId);
|
|
96
100
|
if (!callbacks) {
|
|
97
101
|
// Likely timed out, we should ignore
|
|
98
102
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipc-wrapper.js","sourceRoot":"","sources":["../../src/host-api/ipc-wrapper.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ipc-wrapper.js","sourceRoot":"","sources":["../../src/host-api/ipc-wrapper.ts"],"names":[],"mappings":";;;;AAAA,kCAAqC;AACrC,0DAAyB;AAEzB,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,CAAA;AAwC/B,MAAa,UAAU;IACtB,SAAS,CAA4B;IACrC,YAAY,CAAoE;IAChF,eAAe,CAAQ;IAEvB,eAAe,GAAG,CAAC,CAAA;IACnB,iBAAiB,GAAG,IAAI,GAAG,EAA2B,CAAA;IAEtD,YACC,QAAoC,EACpC,WAA+E,EAC/E,cAAsB;QAEtB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;QAC/B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,UAAU,CACf,IAAO,EACP,GAA2C,EAC3C,eAA6B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AAG,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;wBAC7B,IAAI,IAAI,CAAC,KAAK;4BAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;qBACtC;oBACD,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;iBACrB;gBAED,MAAK;aACL;YACD;gBACC,IAAA,kBAAW,EAAC,GAAG,CAAC,CAAA;gBAChB,OAAO,CAAC,KAAK,CAAC,sCAAsC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAA;gBACxE,MAAK;SACN;IACF,CAAC;CACD;AA/ID,gCA+IC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './manifest';
|
|
2
2
|
export * from './module-api/index';
|
|
3
3
|
export * from './common/osc';
|
|
4
|
-
export { literal, combineRgb, splitRgb, RgbComponents, assertNever } from './util';
|
|
4
|
+
export { literal, combineRgb, splitRgb, splitHsl, splitHsv, splitHex, RgbComponents, assertNever } from './util';
|
|
5
5
|
export * from './helpers/index';
|
|
6
6
|
export { runEntrypoint } from './entrypoint';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAChH,cAAc,iBAAiB,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runEntrypoint = exports.assertNever = exports.splitRgb = exports.combineRgb = exports.literal = void 0;
|
|
3
|
+
exports.runEntrypoint = exports.assertNever = exports.splitHex = exports.splitHsv = exports.splitHsl = exports.splitRgb = exports.combineRgb = exports.literal = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("./manifest"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./module-api/index"), exports);
|
|
@@ -9,6 +9,9 @@ var util_1 = require("./util");
|
|
|
9
9
|
Object.defineProperty(exports, "literal", { enumerable: true, get: function () { return util_1.literal; } });
|
|
10
10
|
Object.defineProperty(exports, "combineRgb", { enumerable: true, get: function () { return util_1.combineRgb; } });
|
|
11
11
|
Object.defineProperty(exports, "splitRgb", { enumerable: true, get: function () { return util_1.splitRgb; } });
|
|
12
|
+
Object.defineProperty(exports, "splitHsl", { enumerable: true, get: function () { return util_1.splitHsl; } });
|
|
13
|
+
Object.defineProperty(exports, "splitHsv", { enumerable: true, get: function () { return util_1.splitHsv; } });
|
|
14
|
+
Object.defineProperty(exports, "splitHex", { enumerable: true, get: function () { return util_1.splitHex; } });
|
|
12
15
|
Object.defineProperty(exports, "assertNever", { enumerable: true, get: function () { return util_1.assertNever; } });
|
|
13
16
|
tslib_1.__exportStar(require("./helpers/index"), exports);
|
|
14
17
|
var entrypoint_1 = require("./entrypoint");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,qDAA0B;AAC1B,6DAAkC;AAClC,uDAA4B;AAC5B,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,qDAA0B;AAC1B,6DAAkC;AAClC,uDAA4B;AAC5B,+BAAgH;AAAvG,+FAAA,OAAO,OAAA;AAAE,kGAAA,UAAU,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAAiB,mGAAA,WAAW,OAAA;AAChG,0DAA+B;AAE/B,2CAA4C;AAAnC,2GAAA,aAAa,OAAA"}
|
|
@@ -158,7 +158,7 @@ export declare abstract class InstanceBase<TConfig> implements InstanceBaseShare
|
|
|
158
158
|
*/
|
|
159
159
|
recordAction(action: Omit<CompanionActionInfo, 'id' | 'controlId'>, uniquenessId?: string): void;
|
|
160
160
|
/**
|
|
161
|
-
* Experimental: This method may change without notice. Do not use!
|
|
161
|
+
* @deprecated Experimental: This method may change without notice. Do not use!
|
|
162
162
|
* Set the value of a custom variable
|
|
163
163
|
* @param variableName
|
|
164
164
|
* @param value
|
package/dist/module-api/base.js
CHANGED
|
@@ -426,7 +426,7 @@ class InstanceBase {
|
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
428
|
/**
|
|
429
|
-
* Experimental: This method may change without notice. Do not use!
|
|
429
|
+
* @deprecated Experimental: This method may change without notice. Do not use!
|
|
430
430
|
* Set the value of a custom variable
|
|
431
431
|
* @param variableName
|
|
432
432
|
* @param value
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompanionInputFieldBase, CompanionInputFieldCheckbox, CompanionInputFieldColor, CompanionInputFieldDropdown, CompanionInputFieldMultiDropdown, CompanionInputFieldNumber, CompanionInputFieldStaticText, CompanionInputFieldTextInput } from './input';
|
|
1
|
+
import { CompanionInputFieldBase, CompanionInputFieldBonjourDevice, CompanionInputFieldCheckbox, CompanionInputFieldColor, CompanionInputFieldDropdown, CompanionInputFieldMultiDropdown, CompanionInputFieldNumber, CompanionInputFieldStaticText, CompanionInputFieldTextInput } from './input';
|
|
2
2
|
/**
|
|
3
3
|
* A configuration input field
|
|
4
4
|
*/
|
|
@@ -8,5 +8,5 @@ export interface CompanionConfigField extends CompanionInputFieldBase {
|
|
|
8
8
|
/**
|
|
9
9
|
* Some configuration input field
|
|
10
10
|
*/
|
|
11
|
-
export type SomeCompanionConfigField = (CompanionInputFieldStaticText | CompanionInputFieldColor | CompanionInputFieldTextInput | CompanionInputFieldDropdown | CompanionInputFieldMultiDropdown | CompanionInputFieldNumber | CompanionInputFieldCheckbox) & CompanionConfigField;
|
|
11
|
+
export type SomeCompanionConfigField = (CompanionInputFieldStaticText | CompanionInputFieldColor | CompanionInputFieldTextInput | CompanionInputFieldDropdown | CompanionInputFieldMultiDropdown | CompanionInputFieldNumber | CompanionInputFieldCheckbox | CompanionInputFieldBonjourDevice) & CompanionConfigField;
|
|
12
12
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/module-api/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,gCAAgC,EAChC,yBAAyB,EACzB,6BAA6B,EAC7B,4BAA4B,EAC5B,MAAM,SAAS,CAAA;AAEhB;;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,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/module-api/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,uBAAuB,EACvB,gCAAgC,EAChC,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,gCAAgC,EAChC,yBAAyB,EACzB,6BAA6B,EAC7B,4BAA4B,EAC5B,MAAM,SAAS,CAAA;AAEhB;;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,CAClC,GACA,oBAAoB,CAAA"}
|
|
@@ -9,7 +9,7 @@ export interface CompanionInputFieldBase {
|
|
|
9
9
|
/** The unique id of this input field within the input group */
|
|
10
10
|
id: string;
|
|
11
11
|
/** The type of this input field */
|
|
12
|
-
type: 'static-text' | 'textinput' | 'dropdown' | 'multidropdown' | 'colorpicker' | 'number' | 'checkbox' | 'custom-variable';
|
|
12
|
+
type: 'static-text' | 'textinput' | 'dropdown' | 'multidropdown' | 'colorpicker' | 'number' | 'checkbox' | 'custom-variable' | 'bonjour-device';
|
|
13
13
|
/** The label of the field */
|
|
14
14
|
label: string;
|
|
15
15
|
/** A hover tooltip for this field */
|
|
@@ -45,10 +45,18 @@ export interface CompanionInputFieldStaticText extends CompanionInputFieldBase {
|
|
|
45
45
|
/** The text to show */
|
|
46
46
|
value: string;
|
|
47
47
|
}
|
|
48
|
+
export type CompanionColorPresetValue = string | {
|
|
49
|
+
color: string;
|
|
50
|
+
title: string;
|
|
51
|
+
};
|
|
48
52
|
/**
|
|
49
53
|
* A colour picker input
|
|
50
54
|
*
|
|
51
55
|
* Available for actions/feedbacks/config
|
|
56
|
+
* Has three optional configuration properties:
|
|
57
|
+
* - {boolean} `enableAlpha` will show the colour picker with an additional alpha entry
|
|
58
|
+
* - {'string'|'number'} `returnType` do you want to get the results as CSS string or Companion color number
|
|
59
|
+
* - {string[]} `presetColors` replace the default swatch with your own colors when set
|
|
52
60
|
*
|
|
53
61
|
* ### Example
|
|
54
62
|
* ```js
|
|
@@ -56,7 +64,19 @@ export interface CompanionInputFieldStaticText extends CompanionInputFieldBase {
|
|
|
56
64
|
* id: 'bg',
|
|
57
65
|
* type: 'colorpicker',
|
|
58
66
|
* label: 'Background color',
|
|
59
|
-
*
|
|
67
|
+
* default: 'rgb(255, 0, 0)'
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* ```js
|
|
72
|
+
* {
|
|
73
|
+
* id: 'overlay',
|
|
74
|
+
* type: 'colorpicker',
|
|
75
|
+
* label: 'Overlay color',
|
|
76
|
+
* enableAlpha: true,
|
|
77
|
+
* returnType: 'string',
|
|
78
|
+
* default: 'rgba(100, 100, 255, 0.3)',
|
|
79
|
+
* presetColors: ['#000', '#ffffff', {color: 'rgba(255, 0, 0, 0.5)', title: 'semitransparent red'}]
|
|
60
80
|
* }
|
|
61
81
|
* ```
|
|
62
82
|
*/
|
|
@@ -64,8 +84,37 @@ export interface CompanionInputFieldColor extends CompanionInputFieldBase {
|
|
|
64
84
|
type: 'colorpicker';
|
|
65
85
|
/**
|
|
66
86
|
* The default color value to set when creating this action/feedback/instance
|
|
87
|
+
* Can be a color string or a color number
|
|
88
|
+
* Valid strings are CSS color strings in Hex, RGB, HSL or HSV notation with ot without alpha
|
|
89
|
+
* Valid numbers are 0x0 - 0xffffffff, where the components are ttrrggbb, you can generate the number with combineRgb()
|
|
90
|
+
*
|
|
91
|
+
* ### Examples for red
|
|
92
|
+
* ```
|
|
93
|
+
* '#f00'
|
|
94
|
+
* '#ff0000'
|
|
95
|
+
* '#ff0000ff'
|
|
96
|
+
* 'rgb(255,0,0)
|
|
97
|
+
* 'rgba(255, 0, 0, 1.0)
|
|
98
|
+
* 'hsl(0, 100, 50)'
|
|
99
|
+
* 'hsv(0, 100, 100)'
|
|
100
|
+
* 0xff0000
|
|
101
|
+
* ```
|
|
67
102
|
*/
|
|
68
|
-
default: number;
|
|
103
|
+
default: string | number;
|
|
104
|
+
/**
|
|
105
|
+
* This will enable a alpha entry slider and input
|
|
106
|
+
*/
|
|
107
|
+
enableAlpha?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Specify if you want the colorpicker returning it's value as a CSS string or as a color number.
|
|
110
|
+
* This will also be the format stored in the database for this value
|
|
111
|
+
*/
|
|
112
|
+
returnType?: 'string' | 'number';
|
|
113
|
+
/**
|
|
114
|
+
* If set, this will override the default colors shown in the swatch.
|
|
115
|
+
* Enter an array of either color strings or objects with color strings and titles
|
|
116
|
+
*/
|
|
117
|
+
presetColors?: CompanionColorPresetValue[];
|
|
69
118
|
}
|
|
70
119
|
/**
|
|
71
120
|
* A basic text input field
|
|
@@ -257,4 +306,24 @@ export interface CompanionInputFieldNumber extends CompanionInputFieldBase {
|
|
|
257
306
|
export interface CompanionInputFieldCustomVariable extends CompanionInputFieldBase {
|
|
258
307
|
type: 'custom-variable';
|
|
259
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* An input field to list and select devices discovered with a bonjour query
|
|
311
|
+
*
|
|
312
|
+
* Available for config
|
|
313
|
+
*
|
|
314
|
+
* Note: Bonjour does not work in all environments, so the user is always able to select 'Manual' (null).
|
|
315
|
+
* You must make sure to handle this, we recommend using the `isVisible` function to hide the manual input fields when a bonjour device is selected.
|
|
316
|
+
*
|
|
317
|
+
* ### Example
|
|
318
|
+
* ```js
|
|
319
|
+
* {
|
|
320
|
+
* id: 'my-device',
|
|
321
|
+
* type: 'bonjour-device',
|
|
322
|
+
* label: 'Device'
|
|
323
|
+
* }
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
export interface CompanionInputFieldBonjourDevice extends CompanionInputFieldBase {
|
|
327
|
+
type: 'bonjour-device';
|
|
328
|
+
}
|
|
260
329
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/module-api/input.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;AAE3E,MAAM,WAAW,qBAAqB;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAA;IACV,mCAAmC;IACnC,IAAI,EACD,aAAa,GACb,WAAW,GACX,UAAU,GACV,eAAe,GACf,aAAa,GACb,QAAQ,GACR,UAAU,GACV,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/module-api/input.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;AAE3E,MAAM,WAAW,qBAAqB;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAA;IACV,mCAAmC;IACnC,IAAI,EACD,aAAa,GACb,WAAW,GACX,UAAU,GACV,eAAe,GACf,aAAa,GACb,QAAQ,GACR,UAAU,GACV,iBAAiB,GACjB,gBAAgB,CAAA;IACnB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,GAAG,GAAG,SAAS,KAAK,OAAO,CAAA;IAC9E;;OAEG;IACH,aAAa,CA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ACH,MAAM,WAAW,iCAAkC,SAAQ,uBAAuB;IACjF,IAAI,EAAE,iBAAiB,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,gCAAiC,SAAQ,uBAAuB;IAChF,IAAI,EAAE,gBAAgB,CAAA;CACtB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type CompanionAlignment = 'left:top' | 'center:top' | 'right:top' | 'left:center' | 'center:center' | 'right:center' | 'left:bottom' | 'center:bottom' | 'right:bottom';
|
|
2
|
-
export type CompanionTextSize = 'auto' | '7' | '14' | '18' | '24' | '30' | '44';
|
|
2
|
+
export type CompanionTextSize = 'auto' | '7' | '14' | '18' | '24' | '30' | '44' | number;
|
|
3
3
|
/**
|
|
4
4
|
* The basic style properties for a button
|
|
5
5
|
*/
|
|
@@ -11,5 +11,6 @@ export interface CompanionButtonStyleProps {
|
|
|
11
11
|
alignment?: CompanionAlignment;
|
|
12
12
|
pngalignment?: CompanionAlignment;
|
|
13
13
|
png64?: string;
|
|
14
|
+
show_topbar?: boolean;
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/module-api/style.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAC3B,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAA;AAEjB,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/module-api/style.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAC3B,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAA;AAEjB,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAA;AAExF;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,iBAAiB,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,kBAAkB,CAAA;IAC9B,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB"}
|
package/dist/util.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HslaColor, HsvaColor } from 'colord';
|
|
1
2
|
/**
|
|
2
3
|
* Assert a certain type for a literal.
|
|
3
4
|
* This can be used to correctly type parts of an object in TypeScript.
|
|
@@ -29,9 +30,14 @@ export interface RgbComponents {
|
|
|
29
30
|
r: number;
|
|
30
31
|
g: number;
|
|
31
32
|
b: number;
|
|
33
|
+
a?: number;
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
|
-
* Combine separate RGB component to one single value
|
|
36
|
+
* Combine separate RGB component to one single numerical value.
|
|
37
|
+
* The RGB component have to be in a range of 0-255.
|
|
38
|
+
* There can also be an alpha component in a range of 0.0-1.0 (0 = transparent).
|
|
39
|
+
*
|
|
40
|
+
* **Note:** Companion's components can use any CSS color string and you should prefer these strings. E.g.for a button style you can also use `'#ff8800'` or `'rgb(255, 128, 0)'` without calling a function.
|
|
35
41
|
*
|
|
36
42
|
* ### Example
|
|
37
43
|
*
|
|
@@ -42,11 +48,31 @@ export interface RgbComponents {
|
|
|
42
48
|
* }
|
|
43
49
|
* ```
|
|
44
50
|
*/
|
|
45
|
-
export declare function combineRgb(r: number, g: number, b: number): number;
|
|
51
|
+
export declare function combineRgb(r: number, g: number, b: number, a?: number): number;
|
|
52
|
+
/**
|
|
53
|
+
* Split a combined color value to separate RGBA component values
|
|
54
|
+
* the color can be either the Companion color number or a CSS compatible color string
|
|
55
|
+
* return object will always include an alpha value (0.0-1.0), defaulting to 1 if input has no alpha information
|
|
56
|
+
*/
|
|
57
|
+
export declare function splitRgb(color: number | string): RgbComponents;
|
|
58
|
+
/**
|
|
59
|
+
* Split a combined color value to separate HSLA component values
|
|
60
|
+
* the color can be either the Companion color number or a CSS compatible color string
|
|
61
|
+
* return object will always include an alpha value (0.0-1.0), defaulting to 1 if input has no alpha information
|
|
62
|
+
*/
|
|
63
|
+
export declare function splitHsl(color: number | string): HslaColor;
|
|
64
|
+
/**
|
|
65
|
+
* Split a combined color value to separate HSVA component values
|
|
66
|
+
* the color can be either the Companion color number or a CSS compatible color string
|
|
67
|
+
* return object will always include an alpha value (0.0-1.0), defaulting to 1 if input has no alpha information
|
|
68
|
+
*/
|
|
69
|
+
export declare function splitHsv(color: number | string): HsvaColor;
|
|
46
70
|
/**
|
|
47
|
-
*
|
|
71
|
+
* Takes a color value and returns a string with Hex notation of that color
|
|
72
|
+
* the color can be either the Companion color number or a CSS compatible color string
|
|
73
|
+
* if input color has no alpha or alpha of 1, return will be in format '#rrggbb', else '#rrggbbaa'
|
|
48
74
|
*/
|
|
49
|
-
export declare function
|
|
75
|
+
export declare function splitHex(color: number | string): string;
|
|
50
76
|
/**
|
|
51
77
|
* Make all optional properties be required and `| undefined`
|
|
52
78
|
* This is useful to ensure that no property is missed, when manually converting between types, but allowing fields to be undefined
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAA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AM,MAAM,QAAQ,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CAC3F,CAAA"}
|
package/dist/util.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitRgb = exports.combineRgb = exports.assertNever = exports.literal = void 0;
|
|
3
|
+
exports.splitHex = exports.splitHsv = exports.splitHsl = exports.splitRgb = exports.combineRgb = exports.assertNever = exports.literal = void 0;
|
|
4
|
+
const colord_1 = require("colord");
|
|
4
5
|
/**
|
|
5
6
|
* Assert a certain type for a literal.
|
|
6
7
|
* This can be used to correctly type parts of an object in TypeScript.
|
|
@@ -35,7 +36,11 @@ function assertNever(_val) {
|
|
|
35
36
|
}
|
|
36
37
|
exports.assertNever = assertNever;
|
|
37
38
|
/**
|
|
38
|
-
* Combine separate RGB component to one single value
|
|
39
|
+
* Combine separate RGB component to one single numerical value.
|
|
40
|
+
* The RGB component have to be in a range of 0-255.
|
|
41
|
+
* There can also be an alpha component in a range of 0.0-1.0 (0 = transparent).
|
|
42
|
+
*
|
|
43
|
+
* **Note:** Companion's components can use any CSS color string and you should prefer these strings. E.g.for a button style you can also use `'#ff8800'` or `'rgb(255, 128, 0)'` without calling a function.
|
|
39
44
|
*
|
|
40
45
|
* ### Example
|
|
41
46
|
*
|
|
@@ -46,19 +51,88 @@ exports.assertNever = assertNever;
|
|
|
46
51
|
* }
|
|
47
52
|
* ```
|
|
48
53
|
*/
|
|
49
|
-
function combineRgb(r, g, b) {
|
|
50
|
-
|
|
54
|
+
function combineRgb(r, g, b, a) {
|
|
55
|
+
let colorNumber = ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);
|
|
56
|
+
if (a && a >= 0 && a < 1) {
|
|
57
|
+
colorNumber += 0x1000000 * Math.round(255 * (1 - a)); // add possible transparency to number
|
|
58
|
+
}
|
|
59
|
+
return colorNumber;
|
|
51
60
|
}
|
|
52
61
|
exports.combineRgb = combineRgb;
|
|
53
62
|
/**
|
|
54
|
-
* Split a combined color value to separate
|
|
63
|
+
* Split a combined color value to separate RGBA component values
|
|
64
|
+
* the color can be either the Companion color number or a CSS compatible color string
|
|
65
|
+
* return object will always include an alpha value (0.0-1.0), defaulting to 1 if input has no alpha information
|
|
55
66
|
*/
|
|
56
|
-
function splitRgb(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
function splitRgb(color) {
|
|
68
|
+
if (typeof color === 'number') {
|
|
69
|
+
if (color > 0xffffff) {
|
|
70
|
+
return {
|
|
71
|
+
r: (color >> 16) & 0xff,
|
|
72
|
+
g: (color >> 8) & 0xff,
|
|
73
|
+
b: color & 0xff,
|
|
74
|
+
a: (255 - ((color >> 24) & 0xff)) / 255,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return {
|
|
79
|
+
r: (color >> 16) & 0xff,
|
|
80
|
+
g: (color >> 8) & 0xff,
|
|
81
|
+
b: color & 0xff,
|
|
82
|
+
a: 1,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (typeof color === 'string' && (0, colord_1.colord)(color).isValid()) {
|
|
87
|
+
const rgb = (0, colord_1.colord)(color).toRgb();
|
|
88
|
+
return {
|
|
89
|
+
r: rgb.r,
|
|
90
|
+
g: rgb.g,
|
|
91
|
+
b: rgb.b,
|
|
92
|
+
a: rgb.a,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return {
|
|
97
|
+
r: 0,
|
|
98
|
+
g: 0,
|
|
99
|
+
b: 0,
|
|
100
|
+
a: 1,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
62
103
|
}
|
|
63
104
|
exports.splitRgb = splitRgb;
|
|
105
|
+
/**
|
|
106
|
+
* Split a combined color value to separate HSLA component values
|
|
107
|
+
* the color can be either the Companion color number or a CSS compatible color string
|
|
108
|
+
* return object will always include an alpha value (0.0-1.0), defaulting to 1 if input has no alpha information
|
|
109
|
+
*/
|
|
110
|
+
function splitHsl(color) {
|
|
111
|
+
const rgb = splitRgb(color);
|
|
112
|
+
const hsl = (0, colord_1.colord)(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${rgb.a})`).toHsl();
|
|
113
|
+
return hsl;
|
|
114
|
+
}
|
|
115
|
+
exports.splitHsl = splitHsl;
|
|
116
|
+
/**
|
|
117
|
+
* Split a combined color value to separate HSVA component values
|
|
118
|
+
* the color can be either the Companion color number or a CSS compatible color string
|
|
119
|
+
* return object will always include an alpha value (0.0-1.0), defaulting to 1 if input has no alpha information
|
|
120
|
+
*/
|
|
121
|
+
function splitHsv(color) {
|
|
122
|
+
const rgb = splitRgb(color);
|
|
123
|
+
const hsv = (0, colord_1.colord)(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${rgb.a})`).toHsv();
|
|
124
|
+
return hsv;
|
|
125
|
+
}
|
|
126
|
+
exports.splitHsv = splitHsv;
|
|
127
|
+
/**
|
|
128
|
+
* Takes a color value and returns a string with Hex notation of that color
|
|
129
|
+
* the color can be either the Companion color number or a CSS compatible color string
|
|
130
|
+
* if input color has no alpha or alpha of 1, return will be in format '#rrggbb', else '#rrggbbaa'
|
|
131
|
+
*/
|
|
132
|
+
function splitHex(color) {
|
|
133
|
+
const rgb = splitRgb(color);
|
|
134
|
+
const hex = (0, colord_1.colord)(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${rgb.a})`).toHex();
|
|
135
|
+
return hex;
|
|
136
|
+
}
|
|
137
|
+
exports.splitHex = splitHex;
|
|
64
138
|
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,OAAO,CAAI,CAAI;IAC9B,OAAO,CAAC,CAAA;AACT,CAAC;AAFD,0BAEC;AAED,wCAAwC;AACxC,SAAgB,WAAW,CAAC,IAAW;IACtC,gBAAgB;AACjB,CAAC;AAFD,kCAEC;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA,mCAAmD;AAGnD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,OAAO,CAAI,CAAI;IAC9B,OAAO,CAAC,CAAA;AACT,CAAC;AAFD,0BAEC;AAED,wCAAwC;AACxC,SAAgB,WAAW,CAAC,IAAW;IACtC,gBAAgB;AACjB,CAAC;AAFD,kCAEC;AASD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,UAAU,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAU;IACrE,IAAI,WAAW,GAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IAC7E,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACzB,WAAW,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA,CAAC,sCAAsC;KAC3F;IACD,OAAO,WAAW,CAAA;AACnB,CAAC;AAND,gCAMC;AAED;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,KAAoB;IAC5C,IAAI,OAAO,KAAK,KAAK,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,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAA;IAC1E,OAAO,GAAG,CAAA;AACX,CAAC;AAJD,4BAIC;AAED;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,KAAsB;IAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC3B,MAAM,GAAG,GAAG,IAAA,eAAM,EAAC,QAAQ,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAA;IAC1E,OAAO,GAAG,CAAA;AACX,CAAC;AAJD,4BAIC;AAED;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,KAAsB;IAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC3B,MAAM,GAAG,GAAG,IAAA,eAAM,EAAC,QAAQ,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAA;IAC1E,OAAO,GAAG,CAAA;AACX,CAAC;AAJD,4BAIC"}
|
package/generated/manifest.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export interface ModuleManifest {
|
|
9
|
+
$schema?: string;
|
|
9
10
|
/**
|
|
10
11
|
* Unique identifier for the module
|
|
11
12
|
*/
|
|
@@ -47,7 +48,13 @@ export interface ModuleManifest {
|
|
|
47
48
|
manufacturer: string;
|
|
48
49
|
products: string[];
|
|
49
50
|
keywords: string[];
|
|
50
|
-
|
|
51
|
+
/**
|
|
52
|
+
* If the device or software for your module supports bonjour announcements, Companion will offer an easy way to watch for these announcements.
|
|
53
|
+
* Each query you define must have a matching config field of type 'bonjour-device' with the same name
|
|
54
|
+
*/
|
|
55
|
+
bonjourQueries?: {
|
|
56
|
+
[k: string]: ModuleBonjourQuery;
|
|
57
|
+
};
|
|
51
58
|
}
|
|
52
59
|
export interface ModuleManifestMaintainer {
|
|
53
60
|
name: string;
|
|
@@ -77,3 +84,21 @@ export interface ModuleManifestRuntime {
|
|
|
77
84
|
entrypoint: string;
|
|
78
85
|
[k: string]: unknown;
|
|
79
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
89
|
+
* via the `patternProperty` "".
|
|
90
|
+
*/
|
|
91
|
+
export interface ModuleBonjourQuery {
|
|
92
|
+
type: string;
|
|
93
|
+
protocol: "tcp" | "udp";
|
|
94
|
+
/**
|
|
95
|
+
* Match on any txt values returned in the query. This is useful to filter out devices of the same 'type' that are not supported
|
|
96
|
+
*/
|
|
97
|
+
txt?: {
|
|
98
|
+
/**
|
|
99
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
100
|
+
* via the `patternProperty` "".
|
|
101
|
+
*/
|
|
102
|
+
[k: string]: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";module.exports = validate20;module.exports.default = validate20;const schema22 = {"$schema":"http://json-schema.org/draft-07/schema#","type":"object","title":"ModuleManifest","properties":{"id":{"type":"string","description":"Unique identifier for the module"},"name":{"type":"string","description":"Name of the module"},"shortname":{"type":"string"},"description":{"type":"string","description":"Description of the module "},"version":{"type":"string","description":"Current version of the module"},"license":{"type":"string","description":"SPDX identifier for license of the module"},"repository":{"type":"string","description":"URL to the source repository"},"bugs":{"type":"string","description":"URL to bug tracker"},"maintainers":{"type":"array","description":"List of active maintiners","uniqueItems":true,"items":{"type":"object","title":"ModuleManifestMaintainer","properties":{"name":{"type":"string"},"email":{"type":"string"},"github":{"type":"string"}},"required":["name"]}},"legacyIds":{"type":"array","description":"If the module had a different unique identifier previously, then specify it here","uniqueItems":true,"items":{"type":"string"}},"runtime":{"type":"object","title":"ModuleManifestRuntime","description":"Information on how to execute the module","properties":{"type":{"type":"string","description":"Type of the module. Must be: node18"},"api":{"type":"string","description":"Which host-api does it use. In the future alternate options will be allowed","enum":["nodejs-ipc"]},"apiVersion":{"type":"string","description":"The version of the host-api used"},"entrypoint":{"type":"string","description":"Entrypoint to pass to the runtime. eg index.js"}},"required":["type","api","apiVersion","entrypoint"]},"manufacturer":{"type":"string"},"products":{"type":"array","uniqueItems":true,"items":{"type":"string"}},"keywords":{"type":"array","uniqueItems":true,"items":{"type":"string"}}},"required":["id","name","shortname","description","version","license","repository","bugs","maintainers","legacyIds","runtime","manufacturer","products","keywords"]};const func0 = require("ajv/dist/runtime/equal").default;function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((((((((((((((data.id === undefined) && (missing0 = "id")) || ((data.name === undefined) && (missing0 = "name"))) || ((data.shortname === undefined) && (missing0 = "shortname"))) || ((data.description === undefined) && (missing0 = "description"))) || ((data.version === undefined) && (missing0 = "version"))) || ((data.license === undefined) && (missing0 = "license"))) || ((data.repository === undefined) && (missing0 = "repository"))) || ((data.bugs === undefined) && (missing0 = "bugs"))) || ((data.maintainers === undefined) && (missing0 = "maintainers"))) || ((data.legacyIds === undefined) && (missing0 = "legacyIds"))) || ((data.runtime === undefined) && (missing0 = "runtime"))) || ((data.manufacturer === undefined) && (missing0 = "manufacturer"))) || ((data.products === undefined) && (missing0 = "products"))) || ((data.keywords === undefined) && (missing0 = "keywords"))){validate20.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.id !== undefined){const _errs1 = errors;if(typeof data.id !== "string"){validate20.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs1 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs3 = errors;if(typeof data.name !== "string"){validate20.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs3 === errors;}else {var valid0 = true;}if(valid0){if(data.shortname !== undefined){const _errs5 = errors;if(typeof data.shortname !== "string"){validate20.errors = [{instancePath:instancePath+"/shortname",schemaPath:"#/properties/shortname/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs5 === errors;}else {var valid0 = true;}if(valid0){if(data.description !== undefined){const _errs7 = errors;if(typeof data.description !== "string"){validate20.errors = [{instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs7 === errors;}else {var valid0 = true;}if(valid0){if(data.version !== undefined){const _errs9 = errors;if(typeof data.version !== "string"){validate20.errors = [{instancePath:instancePath+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.license !== undefined){const _errs11 = errors;if(typeof data.license !== "string"){validate20.errors = [{instancePath:instancePath+"/license",schemaPath:"#/properties/license/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.repository !== undefined){const _errs13 = errors;if(typeof data.repository !== "string"){validate20.errors = [{instancePath:instancePath+"/repository",schemaPath:"#/properties/repository/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.bugs !== undefined){const _errs15 = errors;if(typeof data.bugs !== "string"){validate20.errors = [{instancePath:instancePath+"/bugs",schemaPath:"#/properties/bugs/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.maintainers !== undefined){let data8 = data.maintainers;const _errs17 = errors;if(errors === _errs17){if(Array.isArray(data8)){var valid1 = true;const len0 = data8.length;for(let i0=0; i0<len0; i0++){let data9 = data8[i0];const _errs19 = errors;if(errors === _errs19){if(data9 && typeof data9 == "object" && !Array.isArray(data9)){let missing1;if((data9.name === undefined) && (missing1 = "name")){validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0,schemaPath:"#/properties/maintainers/items/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data9.name !== undefined){const _errs21 = errors;if(typeof data9.name !== "string"){validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0+"/name",schemaPath:"#/properties/maintainers/items/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs21 === errors;}else {var valid2 = true;}if(valid2){if(data9.email !== undefined){const _errs23 = errors;if(typeof data9.email !== "string"){validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0+"/email",schemaPath:"#/properties/maintainers/items/properties/email/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs23 === errors;}else {var valid2 = true;}if(valid2){if(data9.github !== undefined){const _errs25 = errors;if(typeof data9.github !== "string"){validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0+"/github",schemaPath:"#/properties/maintainers/items/properties/github/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs25 === errors;}else {var valid2 = true;}}}}}else {validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0,schemaPath:"#/properties/maintainers/items/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid1 = _errs19 === errors;if(!valid1){break;}}if(valid1){let i1 = data8.length;let j0;if(i1 > 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data8[i1], data8[j0])){validate20.errors = [{instancePath:instancePath+"/maintainers",schemaPath:"#/properties/maintainers/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate20.errors = [{instancePath:instancePath+"/maintainers",schemaPath:"#/properties/maintainers/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.legacyIds !== undefined){let data13 = data.legacyIds;const _errs27 = errors;if(errors === _errs27){if(Array.isArray(data13)){var valid4 = true;const len1 = data13.length;for(let i2=0; i2<len1; i2++){const _errs29 = errors;if(typeof data13[i2] !== "string"){validate20.errors = [{instancePath:instancePath+"/legacyIds/" + i2,schemaPath:"#/properties/legacyIds/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs29 === errors;if(!valid4){break;}}if(valid4){let i3 = data13.length;let j1;if(i3 > 1){const indices0 = {};for(;i3--;){let item0 = data13[i3];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j1 = indices0[item0];validate20.errors = [{instancePath:instancePath+"/legacyIds",schemaPath:"#/properties/legacyIds/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)"}];return false;break;}indices0[item0] = i3;}}}}else {validate20.errors = [{instancePath:instancePath+"/legacyIds",schemaPath:"#/properties/legacyIds/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs27 === errors;}else {var valid0 = true;}if(valid0){if(data.runtime !== undefined){let data15 = data.runtime;const _errs31 = errors;if(errors === _errs31){if(data15 && typeof data15 == "object" && !Array.isArray(data15)){let missing2;if(((((data15.type === undefined) && (missing2 = "type")) || ((data15.api === undefined) && (missing2 = "api"))) || ((data15.apiVersion === undefined) && (missing2 = "apiVersion"))) || ((data15.entrypoint === undefined) && (missing2 = "entrypoint"))){validate20.errors = [{instancePath:instancePath+"/runtime",schemaPath:"#/properties/runtime/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];return false;}else {if(data15.type !== undefined){const _errs33 = errors;if(typeof data15.type !== "string"){validate20.errors = [{instancePath:instancePath+"/runtime/type",schemaPath:"#/properties/runtime/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs33 === errors;}else {var valid6 = true;}if(valid6){if(data15.api !== undefined){let data17 = data15.api;const _errs35 = errors;if(typeof data17 !== "string"){validate20.errors = [{instancePath:instancePath+"/runtime/api",schemaPath:"#/properties/runtime/properties/api/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}if(!(data17 === "nodejs-ipc")){validate20.errors = [{instancePath:instancePath+"/runtime/api",schemaPath:"#/properties/runtime/properties/api/enum",keyword:"enum",params:{allowedValues: schema22.properties.runtime.properties.api.enum},message:"must be equal to one of the allowed values"}];return false;}var valid6 = _errs35 === errors;}else {var valid6 = true;}if(valid6){if(data15.apiVersion !== undefined){const _errs37 = errors;if(typeof data15.apiVersion !== "string"){validate20.errors = [{instancePath:instancePath+"/runtime/apiVersion",schemaPath:"#/properties/runtime/properties/apiVersion/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs37 === errors;}else {var valid6 = true;}if(valid6){if(data15.entrypoint !== undefined){const _errs39 = errors;if(typeof data15.entrypoint !== "string"){validate20.errors = [{instancePath:instancePath+"/runtime/entrypoint",schemaPath:"#/properties/runtime/properties/entrypoint/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs39 === errors;}else {var valid6 = true;}}}}}}else {validate20.errors = [{instancePath:instancePath+"/runtime",schemaPath:"#/properties/runtime/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.manufacturer !== undefined){const _errs41 = errors;if(typeof data.manufacturer !== "string"){validate20.errors = [{instancePath:instancePath+"/manufacturer",schemaPath:"#/properties/manufacturer/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.products !== undefined){let data21 = data.products;const _errs43 = errors;if(errors === _errs43){if(Array.isArray(data21)){var valid7 = true;const len2 = data21.length;for(let i4=0; i4<len2; i4++){const _errs45 = errors;if(typeof data21[i4] !== "string"){validate20.errors = [{instancePath:instancePath+"/products/" + i4,schemaPath:"#/properties/products/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid7 = _errs45 === errors;if(!valid7){break;}}if(valid7){let i5 = data21.length;let j2;if(i5 > 1){const indices1 = {};for(;i5--;){let item1 = data21[i5];if(typeof item1 !== "string"){continue;}if(typeof indices1[item1] == "number"){j2 = indices1[item1];validate20.errors = [{instancePath:instancePath+"/products",schemaPath:"#/properties/products/uniqueItems",keyword:"uniqueItems",params:{i: i5, j: j2},message:"must NOT have duplicate items (items ## "+j2+" and "+i5+" are identical)"}];return false;break;}indices1[item1] = i5;}}}}else {validate20.errors = [{instancePath:instancePath+"/products",schemaPath:"#/properties/products/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs43 === errors;}else {var valid0 = true;}if(valid0){if(data.keywords !== undefined){let data23 = data.keywords;const _errs47 = errors;if(errors === _errs47){if(Array.isArray(data23)){var valid9 = true;const len3 = data23.length;for(let i6=0; i6<len3; i6++){const _errs49 = errors;if(typeof data23[i6] !== "string"){validate20.errors = [{instancePath:instancePath+"/keywords/" + i6,schemaPath:"#/properties/keywords/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid9 = _errs49 === errors;if(!valid9){break;}}if(valid9){let i7 = data23.length;let j3;if(i7 > 1){const indices2 = {};for(;i7--;){let item2 = data23[i7];if(typeof item2 !== "string"){continue;}if(typeof indices2[item2] == "number"){j3 = indices2[item2];validate20.errors = [{instancePath:instancePath+"/keywords",schemaPath:"#/properties/keywords/uniqueItems",keyword:"uniqueItems",params:{i: i7, j: j3},message:"must NOT have duplicate items (items ## "+j3+" and "+i7+" are identical)"}];return false;break;}indices2[item2] = i7;}}}}else {validate20.errors = [{instancePath:instancePath+"/keywords",schemaPath:"#/properties/keywords/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs47 === errors;}else {var valid0 = true;}}}}}}}}}}}}}}}}else {validate20.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate20.errors = vErrors;return errors === 0;}
|
|
1
|
+
"use strict";module.exports = validate20;module.exports.default = validate20;const schema22 = {"$schema":"http://json-schema.org/draft-07/schema#","type":"object","title":"ModuleManifest","properties":{"$schema":{"type":"string"},"id":{"type":"string","description":"Unique identifier for the module"},"name":{"type":"string","description":"Name of the module"},"shortname":{"type":"string"},"description":{"type":"string","description":"Description of the module "},"version":{"type":"string","description":"Current version of the module"},"license":{"type":"string","description":"SPDX identifier for license of the module"},"repository":{"type":"string","description":"URL to the source repository"},"bugs":{"type":"string","description":"URL to bug tracker"},"maintainers":{"type":"array","description":"List of active maintiners","uniqueItems":true,"items":{"type":"object","title":"ModuleManifestMaintainer","properties":{"name":{"type":"string"},"email":{"type":"string"},"github":{"type":"string"}},"required":["name"]}},"legacyIds":{"type":"array","description":"If the module had a different unique identifier previously, then specify it here","uniqueItems":true,"items":{"type":"string"}},"runtime":{"type":"object","title":"ModuleManifestRuntime","description":"Information on how to execute the module","properties":{"type":{"type":"string","description":"Type of the module. Must be: node18"},"api":{"type":"string","description":"Which host-api does it use. In the future alternate options will be allowed","enum":["nodejs-ipc"]},"apiVersion":{"type":"string","description":"The version of the host-api used"},"entrypoint":{"type":"string","description":"Entrypoint to pass to the runtime. eg index.js"}},"required":["type","api","apiVersion","entrypoint"]},"manufacturer":{"type":"string"},"products":{"type":"array","uniqueItems":true,"items":{"type":"string"}},"keywords":{"type":"array","uniqueItems":true,"items":{"type":"string"}},"bonjourQueries":{"type":"object","description":"If the device or software for your module supports bonjour announcements, Companion will offer an easy way to watch for these announcements.\nEach query you define must have a matching config field of type 'bonjour-device' with the same name","patternProperties":{"":{"type":"object","title":"ModuleBonjourQuery","description":"","properties":{"type":{"type":"string"},"protocol":{"type":"string","enum":["tcp","udp"]},"txt":{"type":"object","description":"Match on any txt values returned in the query. This is useful to filter out devices of the same 'type' that are not supported","patternProperties":{"":{"type":"string"}},"additionalProperties":false}},"required":["type","protocol"],"additionalProperties":false}},"additionalProperties":false}},"additionalProperties":false,"required":["id","name","shortname","description","version","license","repository","bugs","maintainers","legacyIds","runtime","manufacturer","products","keywords"]};const func4 = Object.prototype.hasOwnProperty;const func0 = require("ajv/dist/runtime/equal").default;const pattern0 = new RegExp("", "u");function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((((((((((((((data.id === undefined) && (missing0 = "id")) || ((data.name === undefined) && (missing0 = "name"))) || ((data.shortname === undefined) && (missing0 = "shortname"))) || ((data.description === undefined) && (missing0 = "description"))) || ((data.version === undefined) && (missing0 = "version"))) || ((data.license === undefined) && (missing0 = "license"))) || ((data.repository === undefined) && (missing0 = "repository"))) || ((data.bugs === undefined) && (missing0 = "bugs"))) || ((data.maintainers === undefined) && (missing0 = "maintainers"))) || ((data.legacyIds === undefined) && (missing0 = "legacyIds"))) || ((data.runtime === undefined) && (missing0 = "runtime"))) || ((data.manufacturer === undefined) && (missing0 = "manufacturer"))) || ((data.products === undefined) && (missing0 = "products"))) || ((data.keywords === undefined) && (missing0 = "keywords"))){validate20.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {const _errs1 = errors;for(const key0 in data){if(!(func4.call(schema22.properties, key0))){validate20.errors = [{instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"}];return false;break;}}if(_errs1 === errors){if(data.$schema !== undefined){const _errs2 = errors;if(typeof data.$schema !== "string"){validate20.errors = [{instancePath:instancePath+"/$schema",schemaPath:"#/properties/%24schema/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs4 = errors;if(typeof data.id !== "string"){validate20.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs6 = errors;if(typeof data.name !== "string"){validate20.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.shortname !== undefined){const _errs8 = errors;if(typeof data.shortname !== "string"){validate20.errors = [{instancePath:instancePath+"/shortname",schemaPath:"#/properties/shortname/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.description !== undefined){const _errs10 = errors;if(typeof data.description !== "string"){validate20.errors = [{instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.version !== undefined){const _errs12 = errors;if(typeof data.version !== "string"){validate20.errors = [{instancePath:instancePath+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.license !== undefined){const _errs14 = errors;if(typeof data.license !== "string"){validate20.errors = [{instancePath:instancePath+"/license",schemaPath:"#/properties/license/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.repository !== undefined){const _errs16 = errors;if(typeof data.repository !== "string"){validate20.errors = [{instancePath:instancePath+"/repository",schemaPath:"#/properties/repository/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.bugs !== undefined){const _errs18 = errors;if(typeof data.bugs !== "string"){validate20.errors = [{instancePath:instancePath+"/bugs",schemaPath:"#/properties/bugs/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.maintainers !== undefined){let data9 = data.maintainers;const _errs20 = errors;if(errors === _errs20){if(Array.isArray(data9)){var valid1 = true;const len0 = data9.length;for(let i0=0; i0<len0; i0++){let data10 = data9[i0];const _errs22 = errors;if(errors === _errs22){if(data10 && typeof data10 == "object" && !Array.isArray(data10)){let missing1;if((data10.name === undefined) && (missing1 = "name")){validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0,schemaPath:"#/properties/maintainers/items/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data10.name !== undefined){const _errs24 = errors;if(typeof data10.name !== "string"){validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0+"/name",schemaPath:"#/properties/maintainers/items/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs24 === errors;}else {var valid2 = true;}if(valid2){if(data10.email !== undefined){const _errs26 = errors;if(typeof data10.email !== "string"){validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0+"/email",schemaPath:"#/properties/maintainers/items/properties/email/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs26 === errors;}else {var valid2 = true;}if(valid2){if(data10.github !== undefined){const _errs28 = errors;if(typeof data10.github !== "string"){validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0+"/github",schemaPath:"#/properties/maintainers/items/properties/github/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs28 === errors;}else {var valid2 = true;}}}}}else {validate20.errors = [{instancePath:instancePath+"/maintainers/" + i0,schemaPath:"#/properties/maintainers/items/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid1 = _errs22 === errors;if(!valid1){break;}}if(valid1){let i1 = data9.length;let j0;if(i1 > 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data9[i1], data9[j0])){validate20.errors = [{instancePath:instancePath+"/maintainers",schemaPath:"#/properties/maintainers/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate20.errors = [{instancePath:instancePath+"/maintainers",schemaPath:"#/properties/maintainers/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.legacyIds !== undefined){let data14 = data.legacyIds;const _errs30 = errors;if(errors === _errs30){if(Array.isArray(data14)){var valid4 = true;const len1 = data14.length;for(let i2=0; i2<len1; i2++){const _errs32 = errors;if(typeof data14[i2] !== "string"){validate20.errors = [{instancePath:instancePath+"/legacyIds/" + i2,schemaPath:"#/properties/legacyIds/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs32 === errors;if(!valid4){break;}}if(valid4){let i3 = data14.length;let j1;if(i3 > 1){const indices0 = {};for(;i3--;){let item0 = data14[i3];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j1 = indices0[item0];validate20.errors = [{instancePath:instancePath+"/legacyIds",schemaPath:"#/properties/legacyIds/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)"}];return false;break;}indices0[item0] = i3;}}}}else {validate20.errors = [{instancePath:instancePath+"/legacyIds",schemaPath:"#/properties/legacyIds/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.runtime !== undefined){let data16 = data.runtime;const _errs34 = errors;if(errors === _errs34){if(data16 && typeof data16 == "object" && !Array.isArray(data16)){let missing2;if(((((data16.type === undefined) && (missing2 = "type")) || ((data16.api === undefined) && (missing2 = "api"))) || ((data16.apiVersion === undefined) && (missing2 = "apiVersion"))) || ((data16.entrypoint === undefined) && (missing2 = "entrypoint"))){validate20.errors = [{instancePath:instancePath+"/runtime",schemaPath:"#/properties/runtime/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];return false;}else {if(data16.type !== undefined){const _errs36 = errors;if(typeof data16.type !== "string"){validate20.errors = [{instancePath:instancePath+"/runtime/type",schemaPath:"#/properties/runtime/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs36 === errors;}else {var valid6 = true;}if(valid6){if(data16.api !== undefined){let data18 = data16.api;const _errs38 = errors;if(typeof data18 !== "string"){validate20.errors = [{instancePath:instancePath+"/runtime/api",schemaPath:"#/properties/runtime/properties/api/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}if(!(data18 === "nodejs-ipc")){validate20.errors = [{instancePath:instancePath+"/runtime/api",schemaPath:"#/properties/runtime/properties/api/enum",keyword:"enum",params:{allowedValues: schema22.properties.runtime.properties.api.enum},message:"must be equal to one of the allowed values"}];return false;}var valid6 = _errs38 === errors;}else {var valid6 = true;}if(valid6){if(data16.apiVersion !== undefined){const _errs40 = errors;if(typeof data16.apiVersion !== "string"){validate20.errors = [{instancePath:instancePath+"/runtime/apiVersion",schemaPath:"#/properties/runtime/properties/apiVersion/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs40 === errors;}else {var valid6 = true;}if(valid6){if(data16.entrypoint !== undefined){const _errs42 = errors;if(typeof data16.entrypoint !== "string"){validate20.errors = [{instancePath:instancePath+"/runtime/entrypoint",schemaPath:"#/properties/runtime/properties/entrypoint/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs42 === errors;}else {var valid6 = true;}}}}}}else {validate20.errors = [{instancePath:instancePath+"/runtime",schemaPath:"#/properties/runtime/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs34 === errors;}else {var valid0 = true;}if(valid0){if(data.manufacturer !== undefined){const _errs44 = errors;if(typeof data.manufacturer !== "string"){validate20.errors = [{instancePath:instancePath+"/manufacturer",schemaPath:"#/properties/manufacturer/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs44 === errors;}else {var valid0 = true;}if(valid0){if(data.products !== undefined){let data22 = data.products;const _errs46 = errors;if(errors === _errs46){if(Array.isArray(data22)){var valid7 = true;const len2 = data22.length;for(let i4=0; i4<len2; i4++){const _errs48 = errors;if(typeof data22[i4] !== "string"){validate20.errors = [{instancePath:instancePath+"/products/" + i4,schemaPath:"#/properties/products/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid7 = _errs48 === errors;if(!valid7){break;}}if(valid7){let i5 = data22.length;let j2;if(i5 > 1){const indices1 = {};for(;i5--;){let item1 = data22[i5];if(typeof item1 !== "string"){continue;}if(typeof indices1[item1] == "number"){j2 = indices1[item1];validate20.errors = [{instancePath:instancePath+"/products",schemaPath:"#/properties/products/uniqueItems",keyword:"uniqueItems",params:{i: i5, j: j2},message:"must NOT have duplicate items (items ## "+j2+" and "+i5+" are identical)"}];return false;break;}indices1[item1] = i5;}}}}else {validate20.errors = [{instancePath:instancePath+"/products",schemaPath:"#/properties/products/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs46 === errors;}else {var valid0 = true;}if(valid0){if(data.keywords !== undefined){let data24 = data.keywords;const _errs50 = errors;if(errors === _errs50){if(Array.isArray(data24)){var valid9 = true;const len3 = data24.length;for(let i6=0; i6<len3; i6++){const _errs52 = errors;if(typeof data24[i6] !== "string"){validate20.errors = [{instancePath:instancePath+"/keywords/" + i6,schemaPath:"#/properties/keywords/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid9 = _errs52 === errors;if(!valid9){break;}}if(valid9){let i7 = data24.length;let j3;if(i7 > 1){const indices2 = {};for(;i7--;){let item2 = data24[i7];if(typeof item2 !== "string"){continue;}if(typeof indices2[item2] == "number"){j3 = indices2[item2];validate20.errors = [{instancePath:instancePath+"/keywords",schemaPath:"#/properties/keywords/uniqueItems",keyword:"uniqueItems",params:{i: i7, j: j3},message:"must NOT have duplicate items (items ## "+j3+" and "+i7+" are identical)"}];return false;break;}indices2[item2] = i7;}}}}else {validate20.errors = [{instancePath:instancePath+"/keywords",schemaPath:"#/properties/keywords/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs50 === errors;}else {var valid0 = true;}if(valid0){if(data.bonjourQueries !== undefined){let data26 = data.bonjourQueries;const _errs54 = errors;if(errors === _errs54){if(data26 && typeof data26 == "object" && !Array.isArray(data26)){const _errs56 = errors;for(const key1 in data26){if(!(pattern0.test(key1))){validate20.errors = [{instancePath:instancePath+"/bonjourQueries",schemaPath:"#/properties/bonjourQueries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"}];return false;break;}}if(_errs56 === errors){var valid11 = true;for(const key2 in data26){if(pattern0.test(key2)){let data27 = data26[key2];const _errs57 = errors;if(errors === _errs57){if(data27 && typeof data27 == "object" && !Array.isArray(data27)){let missing3;if(((data27.type === undefined) && (missing3 = "type")) || ((data27.protocol === undefined) && (missing3 = "protocol"))){validate20.errors = [{instancePath:instancePath+"/bonjourQueries/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/bonjourQueries/patternProperties//required",keyword:"required",params:{missingProperty: missing3},message:"must have required property '"+missing3+"'"}];return false;}else {const _errs59 = errors;for(const key3 in data27){if(!(((key3 === "type") || (key3 === "protocol")) || (key3 === "txt"))){validate20.errors = [{instancePath:instancePath+"/bonjourQueries/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/bonjourQueries/patternProperties//additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"}];return false;break;}}if(_errs59 === errors){if(data27.type !== undefined){const _errs60 = errors;if(typeof data27.type !== "string"){validate20.errors = [{instancePath:instancePath+"/bonjourQueries/" + key2.replace(/~/g, "~0").replace(/\//g, "~1")+"/type",schemaPath:"#/properties/bonjourQueries/patternProperties//properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid12 = _errs60 === errors;}else {var valid12 = true;}if(valid12){if(data27.protocol !== undefined){let data29 = data27.protocol;const _errs62 = errors;if(typeof data29 !== "string"){validate20.errors = [{instancePath:instancePath+"/bonjourQueries/" + key2.replace(/~/g, "~0").replace(/\//g, "~1")+"/protocol",schemaPath:"#/properties/bonjourQueries/patternProperties//properties/protocol/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}if(!((data29 === "tcp") || (data29 === "udp"))){validate20.errors = [{instancePath:instancePath+"/bonjourQueries/" + key2.replace(/~/g, "~0").replace(/\//g, "~1")+"/protocol",schemaPath:"#/properties/bonjourQueries/patternProperties//properties/protocol/enum",keyword:"enum",params:{allowedValues: schema22.properties.bonjourQueries.patternProperties[""].properties.protocol.enum},message:"must be equal to one of the allowed values"}];return false;}var valid12 = _errs62 === errors;}else {var valid12 = true;}if(valid12){if(data27.txt !== undefined){let data30 = data27.txt;const _errs64 = errors;if(errors === _errs64){if(data30 && typeof data30 == "object" && !Array.isArray(data30)){const _errs66 = errors;for(const key4 in data30){if(!(pattern0.test(key4))){validate20.errors = [{instancePath:instancePath+"/bonjourQueries/" + key2.replace(/~/g, "~0").replace(/\//g, "~1")+"/txt",schemaPath:"#/properties/bonjourQueries/patternProperties//properties/txt/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"}];return false;break;}}if(_errs66 === errors){var valid13 = true;for(const key5 in data30){if(pattern0.test(key5)){const _errs67 = errors;if(typeof data30[key5] !== "string"){validate20.errors = [{instancePath:instancePath+"/bonjourQueries/" + key2.replace(/~/g, "~0").replace(/\//g, "~1")+"/txt/" + key5.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/bonjourQueries/patternProperties//properties/txt/patternProperties//type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid13 = _errs67 === errors;if(!valid13){break;}}}}}else {validate20.errors = [{instancePath:instancePath+"/bonjourQueries/" + key2.replace(/~/g, "~0").replace(/\//g, "~1")+"/txt",schemaPath:"#/properties/bonjourQueries/patternProperties//properties/txt/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid12 = _errs64 === errors;}else {var valid12 = true;}}}}}}else {validate20.errors = [{instancePath:instancePath+"/bonjourQueries/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/bonjourQueries/patternProperties//type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid11 = _errs57 === errors;if(!valid11){break;}}}}}else {validate20.errors = [{instancePath:instancePath+"/bonjourQueries",schemaPath:"#/properties/bonjourQueries/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs54 === errors;}else {var valid0 = true;}}}}}}}}}}}}}}}}}}}else {validate20.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate20.errors = vErrors;return errors === 0;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@companion-module/base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@sentry/node": "^7.63.0",
|
|
32
32
|
"@sentry/tracing": "^7.63.0",
|
|
33
33
|
"ajv": "^8.12.0",
|
|
34
|
+
"colord": "^2.9.3",
|
|
34
35
|
"ejson": "^2.2.3",
|
|
35
36
|
"eventemitter3": "^4.0.7",
|
|
36
37
|
"mimic-fn": "^3.0.0",
|