@clockworkdog/cogs-client 1.5.6 → 2.0.0-beta.2
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/LICENSE +21 -0
- package/README.md +90 -21
- package/dist/AudioPlayer.d.ts +2 -2
- package/dist/AudioPlayer.js +2 -3
- package/dist/CogsConnection.d.ts +62 -55
- package/dist/CogsConnection.js +88 -42
- package/dist/RtspStreamer.js +1 -1
- package/dist/VideoPlayer.d.ts +2 -2
- package/dist/VideoPlayer.js +4 -4
- package/dist/browser/index.js +144 -78
- package/dist/index.d.ts +4 -2
- package/dist/index.js +23 -4
- package/dist/types/AllMediaClipStatesMessage.d.ts +1 -1
- package/dist/types/AudioState.d.ts +1 -1
- package/dist/types/CogsClientMessage.d.ts +4 -4
- package/dist/types/{PluginManifestJson.d.ts → CogsPluginManifestJson.d.ts} +32 -15
- package/dist/types/ManifestTypes.d.ts +30 -0
- package/dist/types/ManifestTypes.js +2 -0
- package/dist/types/MediaClipStateMessage.d.ts +1 -1
- package/dist/types/MediaObjectFit.d.ts +1 -1
- package/dist/types/ShowPhase.d.ts +7 -0
- package/dist/types/{valueTypes.js → ShowPhase.js} +2 -2
- package/dist/types/VideoState.js +1 -1
- package/dist/types/utils.d.ts +9 -0
- package/dist/types/utils.js +2 -0
- package/package.json +3 -2
- package/dist/types/valueTypes.d.ts +0 -18
- /package/dist/types/{PluginManifestJson.js → CogsPluginManifestJson.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { default as CogsConnection } from './CogsConnection';
|
|
2
|
+
export * from './CogsConnection';
|
|
2
3
|
export { default as CogsClientMessage } from './types/CogsClientMessage';
|
|
3
4
|
export { default as MediaClipStateMessage } from './types/MediaClipStateMessage';
|
|
4
|
-
export
|
|
5
|
+
export { default as ShowPhase } from './types/ShowPhase';
|
|
5
6
|
export { default as MediaObjectFit } from './types/MediaObjectFit';
|
|
6
7
|
export { default as CogsAudioPlayer } from './AudioPlayer';
|
|
7
8
|
export { default as CogsRtspStreamer, LIVE_VIDEO_PLAYBACK_RATE } from './RtspStreamer';
|
|
@@ -9,4 +10,5 @@ export { default as CogsVideoPlayer } from './VideoPlayer';
|
|
|
9
10
|
export * from './types/AudioState';
|
|
10
11
|
export { assetUrl } from './helpers/urls';
|
|
11
12
|
export { preloadUrl } from './helpers/urls';
|
|
12
|
-
export * from './types/
|
|
13
|
+
export * from './types/CogsPluginManifestJson';
|
|
14
|
+
export * as ManifestTypes from './types/ManifestTypes';
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
9
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
20
|
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
12
28
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
30
|
};
|
|
15
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.preloadUrl = exports.assetUrl = exports.CogsVideoPlayer = exports.LIVE_VIDEO_PLAYBACK_RATE = exports.CogsRtspStreamer = exports.CogsAudioPlayer = exports.CogsConnection = void 0;
|
|
32
|
+
exports.ManifestTypes = exports.preloadUrl = exports.assetUrl = exports.CogsVideoPlayer = exports.LIVE_VIDEO_PLAYBACK_RATE = exports.CogsRtspStreamer = exports.CogsAudioPlayer = exports.ShowPhase = exports.CogsConnection = void 0;
|
|
17
33
|
var CogsConnection_1 = require("./CogsConnection");
|
|
18
34
|
Object.defineProperty(exports, "CogsConnection", { enumerable: true, get: function () { return __importDefault(CogsConnection_1).default; } });
|
|
19
|
-
__exportStar(require("./
|
|
35
|
+
__exportStar(require("./CogsConnection"), exports);
|
|
36
|
+
var ShowPhase_1 = require("./types/ShowPhase");
|
|
37
|
+
Object.defineProperty(exports, "ShowPhase", { enumerable: true, get: function () { return __importDefault(ShowPhase_1).default; } });
|
|
20
38
|
var AudioPlayer_1 = require("./AudioPlayer");
|
|
21
39
|
Object.defineProperty(exports, "CogsAudioPlayer", { enumerable: true, get: function () { return __importDefault(AudioPlayer_1).default; } });
|
|
22
40
|
var RtspStreamer_1 = require("./RtspStreamer");
|
|
@@ -29,4 +47,5 @@ var urls_1 = require("./helpers/urls");
|
|
|
29
47
|
Object.defineProperty(exports, "assetUrl", { enumerable: true, get: function () { return urls_1.assetUrl; } });
|
|
30
48
|
var urls_2 = require("./helpers/urls");
|
|
31
49
|
Object.defineProperty(exports, "preloadUrl", { enumerable: true, get: function () { return urls_2.preloadUrl; } });
|
|
32
|
-
__exportStar(require("./types/
|
|
50
|
+
__exportStar(require("./types/CogsPluginManifestJson"), exports);
|
|
51
|
+
exports.ManifestTypes = __importStar(require("./types/ManifestTypes"));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MediaObjectFit from './MediaObjectFit';
|
|
2
|
-
import
|
|
2
|
+
import ShowPhase from './ShowPhase';
|
|
3
3
|
interface ShowResetMessage {
|
|
4
4
|
type: 'show_reset';
|
|
5
5
|
}
|
|
@@ -16,7 +16,7 @@ interface TextHintsUpdateMessage {
|
|
|
16
16
|
type: 'text_hints_update';
|
|
17
17
|
lastSentHint: string;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export type Media = {
|
|
20
20
|
type: 'audio';
|
|
21
21
|
preload: boolean;
|
|
22
22
|
} | {
|
|
@@ -31,7 +31,7 @@ interface MediaClientConfigMessage {
|
|
|
31
31
|
[path: string]: Media;
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
type MediaClientMessage = {
|
|
35
35
|
type: 'audio_play';
|
|
36
36
|
playId: string;
|
|
37
37
|
file: string;
|
|
@@ -81,5 +81,5 @@ declare type MediaClientMessage = {
|
|
|
81
81
|
file: string;
|
|
82
82
|
fit: MediaObjectFit;
|
|
83
83
|
};
|
|
84
|
-
export
|
|
84
|
+
export type CogsClientMessage<CustomConfig = {}> = ShowResetMessage | ShowPhaseMessage | AdjustableTimerUpdateMessage | TextHintsUpdateMessage | (MediaClientConfigMessage & CustomConfig) | MediaClientMessage;
|
|
85
85
|
export default CogsClientMessage;
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import { DeepReadonly } from './utils';
|
|
2
|
+
export type FontAwesomeIconId = string;
|
|
2
3
|
export interface CogsValueTypeBase<Id extends string> {
|
|
3
4
|
type: Id;
|
|
4
5
|
}
|
|
5
|
-
export
|
|
6
|
+
export type CogsValueTypeString = CogsValueTypeBase<'string'>;
|
|
6
7
|
export interface CogsValueTypeNumber extends CogsValueTypeBase<'number'> {
|
|
7
8
|
integer?: true;
|
|
8
9
|
min?: number;
|
|
9
10
|
max?: number;
|
|
10
11
|
}
|
|
11
|
-
export
|
|
12
|
+
export type CogsValueTypeBoolean = CogsValueTypeBase<'boolean'>;
|
|
12
13
|
export interface CogsValueTypeOption<Options extends string[]> extends CogsValueTypeBase<'option'> {
|
|
13
14
|
options: Options;
|
|
14
15
|
}
|
|
15
|
-
export
|
|
16
|
-
export
|
|
16
|
+
export type CogsValueType = CogsValueTypeString | CogsValueTypeNumber | CogsValueTypeBoolean | CogsValueTypeOption<string[]>;
|
|
17
|
+
export type CogsValueTypeStringWithDefault = CogsValueTypeString & {
|
|
17
18
|
default: string;
|
|
18
19
|
};
|
|
19
|
-
export
|
|
20
|
+
export type CogsValueTypeNumberWithDefault = CogsValueTypeNumber & {
|
|
20
21
|
default: number;
|
|
21
22
|
};
|
|
22
|
-
export
|
|
23
|
+
export type CogsValueTypeBooleanWithDefault = CogsValueTypeBoolean & {
|
|
23
24
|
default: boolean;
|
|
24
25
|
};
|
|
25
|
-
export
|
|
26
|
+
export type CogsValueTypeOptionWithDefault = CogsValueTypeOption<string[]> & {
|
|
26
27
|
default: string;
|
|
27
28
|
};
|
|
28
|
-
export
|
|
29
|
-
export
|
|
29
|
+
export type CogsValueTypeWithDefault = CogsValueTypeStringWithDefault | CogsValueTypeNumberWithDefault | CogsValueTypeBooleanWithDefault | CogsValueTypeOptionWithDefault;
|
|
30
|
+
export type PluginManifestConfigJson = {
|
|
30
31
|
name: string;
|
|
31
32
|
value: CogsValueType | CogsValueTypeWithDefault;
|
|
32
33
|
};
|
|
33
|
-
export
|
|
34
|
+
export type PluginManifestEventJson = {
|
|
34
35
|
name: string;
|
|
35
36
|
value?: CogsValueType;
|
|
36
37
|
};
|
|
37
|
-
export
|
|
38
|
+
export type PluginManifestStateJson = {
|
|
38
39
|
name: string;
|
|
39
40
|
value: CogsValueTypeWithDefault;
|
|
40
41
|
writableFromCogs?: true;
|
|
@@ -48,7 +49,7 @@ export declare type PluginManifestStateJson = {
|
|
|
48
49
|
*
|
|
49
50
|
* The [COGS plugins directory](/plugins) contains a number of plugins you can use out of the box
|
|
50
51
|
*/
|
|
51
|
-
export interface
|
|
52
|
+
export interface CogsPluginManifestJson {
|
|
52
53
|
/**
|
|
53
54
|
* e.g. `1.0.0`
|
|
54
55
|
*/
|
|
@@ -69,9 +70,15 @@ export interface PluginManifestJson {
|
|
|
69
70
|
*/
|
|
70
71
|
description?: string;
|
|
71
72
|
/**
|
|
72
|
-
*
|
|
73
|
+
* An icon shown alongside `name`, in the COGS navigation bar, and in the [COGS plugins directory](/plugins)
|
|
74
|
+
*
|
|
75
|
+
* The icon can be either:
|
|
76
|
+
* - A FontAwesome 5 icon
|
|
77
|
+
* - The relative path to an image in your plugin folder (Requires COGS 4.13 or later)
|
|
78
|
+
* - Must start with `./`
|
|
79
|
+
* - Alpha channel is used as a mask
|
|
73
80
|
*/
|
|
74
|
-
icon?:
|
|
81
|
+
icon?: string;
|
|
75
82
|
/**
|
|
76
83
|
* The HTML entrypoint for the plugin
|
|
77
84
|
*
|
|
@@ -114,3 +121,13 @@ export interface PluginManifestJson {
|
|
|
114
121
|
images?: true;
|
|
115
122
|
};
|
|
116
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* A readonly version of `PluginManifestJson`
|
|
126
|
+
* to help editors and IDEs provide autocomplete and type checking
|
|
127
|
+
* with `@type {const}` enabled
|
|
128
|
+
*/
|
|
129
|
+
export type CogsPluginManifestJsonReadonly = DeepReadonly<CogsPluginManifestJson>;
|
|
130
|
+
/**
|
|
131
|
+
* Allow readonly (i.e. `const`) versions of a manifest as well as a regular PluginManifestJson
|
|
132
|
+
*/
|
|
133
|
+
export type CogsPluginManifest = CogsPluginManifestJson | CogsPluginManifestJsonReadonly;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CogsValueType, CogsValueTypeBoolean, CogsValueTypeNumber, CogsValueTypeOption, CogsValueTypeString, CogsPluginManifest, PluginManifestStateJson } from './CogsPluginManifestJson';
|
|
2
|
+
import { DeepMutable, DistributeObject } from './utils';
|
|
3
|
+
export type TypeFromCogsValueType<ValueType extends Pick<CogsValueType, 'type'> | undefined> = ValueType extends CogsValueTypeOption<string[]> ? ValueType['options'][number] : ValueType extends CogsValueTypeString ? Readonly<string> : ValueType extends CogsValueTypeNumber ? number : ValueType extends CogsValueTypeBoolean ? boolean : undefined;
|
|
4
|
+
export type ConfigName<Manifest extends Pick<CogsPluginManifest, 'config'>> = NonNullable<Manifest['config']>[number]['name'];
|
|
5
|
+
export type ConfigAsObject<Manifest extends Pick<CogsPluginManifest, 'config'>> = DistributeObject<{
|
|
6
|
+
[Name in ConfigName<Manifest>]: TypeFromCogsValueType<Extract<DeepMutable<NonNullable<Manifest['config']>[number]>, {
|
|
7
|
+
name: Name;
|
|
8
|
+
}>['value']>;
|
|
9
|
+
}>;
|
|
10
|
+
export type StateName<Manifest extends Pick<CogsPluginManifest, 'state'>, Constraints extends Partial<PluginManifestStateJson> = Record<never, never>> = Extract<DeepMutable<NonNullable<Manifest['state']>[number]>, Constraints>['name'];
|
|
11
|
+
export type StateValue<Manifest extends Pick<CogsPluginManifest, 'state'>, Name extends StateName<Manifest>> = TypeFromCogsValueType<Extract<DeepMutable<NonNullable<Manifest['state']>[number]>, {
|
|
12
|
+
name: Name;
|
|
13
|
+
}>['value']>;
|
|
14
|
+
export type StateAsObject<Manifest extends Pick<CogsPluginManifest, 'state'>, Constraints extends Partial<PluginManifestStateJson> = Record<never, never>> = DistributeObject<{
|
|
15
|
+
[Name in StateName<Manifest, Constraints>]: StateValue<Manifest, Name>;
|
|
16
|
+
}>;
|
|
17
|
+
export type EventNameFromCogs<Manifest extends CogsPluginManifest> = NonNullable<NonNullable<Manifest['events']>['fromCogs']>[number]['name'];
|
|
18
|
+
export type EventFromCogs<Manifest extends CogsPluginManifest> = NonNullable<NonNullable<Manifest['events']>['fromCogs']>[number];
|
|
19
|
+
export type EventFromCogsAsObject<Manifest extends CogsPluginManifest> = DistributeObject<{
|
|
20
|
+
[Name in EventNameFromCogs<Manifest>]: TypeFromCogsValueType<Extract<DeepMutable<EventFromCogs<Manifest>>, {
|
|
21
|
+
name: Name;
|
|
22
|
+
}>['value']>;
|
|
23
|
+
}>;
|
|
24
|
+
export type EventNameToCogs<Manifest extends CogsPluginManifest> = NonNullable<NonNullable<Manifest['events']>['toCogs']>[number]['name'];
|
|
25
|
+
export type EventToCogs<Manifest extends CogsPluginManifest> = NonNullable<NonNullable<Manifest['events']>['toCogs']>[number];
|
|
26
|
+
export type EventToCogsAsObject<Manifest extends CogsPluginManifest> = DistributeObject<{
|
|
27
|
+
[Name in EventNameToCogs<Manifest>]: TypeFromCogsValueType<Extract<DeepMutable<EventToCogs<Manifest>>, {
|
|
28
|
+
name: Name;
|
|
29
|
+
}>['value']>;
|
|
30
|
+
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type MediaObjectFit = 'contain' | 'cover' | 'none';
|
|
2
2
|
export default MediaObjectFit;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ShowPhase = void 0;
|
|
4
3
|
var ShowPhase;
|
|
5
4
|
(function (ShowPhase) {
|
|
6
5
|
ShowPhase["Setup"] = "setup";
|
|
7
6
|
ShowPhase["Preshow"] = "pre-show";
|
|
8
7
|
ShowPhase["InProgress"] = "in progress";
|
|
9
8
|
ShowPhase["Finished"] = "finished";
|
|
10
|
-
})(ShowPhase
|
|
9
|
+
})(ShowPhase || (ShowPhase = {}));
|
|
10
|
+
exports.default = ShowPhase;
|
package/dist/types/VideoState.js
CHANGED
|
@@ -5,4 +5,4 @@ var ActiveVideoClipState;
|
|
|
5
5
|
(function (ActiveVideoClipState) {
|
|
6
6
|
ActiveVideoClipState["Paused"] = "paused";
|
|
7
7
|
ActiveVideoClipState["Playing"] = "playing";
|
|
8
|
-
})(ActiveVideoClipState
|
|
8
|
+
})(ActiveVideoClipState || (exports.ActiveVideoClipState = ActiveVideoClipState = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type DeepReadonly<T> = T extends unknown ? {
|
|
2
|
+
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
3
|
+
} : never;
|
|
4
|
+
export type DeepMutable<T> = T extends unknown ? {
|
|
5
|
+
-readonly [P in keyof T]: DeepMutable<T[P]>;
|
|
6
|
+
} : never;
|
|
7
|
+
export type DistributeObject<T> = T extends Record<string | number | symbol, unknown> ? {
|
|
8
|
+
[K in keyof T]: T[K];
|
|
9
|
+
} : T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clockworkdog/cogs-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "v2.0.0-beta.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"unpkg": "dist/browser/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/howler": "2.2.7",
|
|
20
|
+
"@types/node": "^18.14.1",
|
|
20
21
|
"@typescript-eslint/eslint-plugin": "^4.12.0",
|
|
21
22
|
"@typescript-eslint/parser": "^4.12.0",
|
|
22
23
|
"browserify": "^17.0.0",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"eslint-config-prettier": "^7.1.0",
|
|
25
26
|
"eslint-plugin-prettier": "^3.3.1",
|
|
26
27
|
"prettier": "^2.2.1",
|
|
27
|
-
"typescript": "^
|
|
28
|
+
"typescript": "^5.1.6"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"@clockworkdog/media-stream-library-browser": "^11.1.1-fixes.6",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare type PortValue = string | number | boolean;
|
|
2
|
-
export declare type ConfigValue = string | number | boolean;
|
|
3
|
-
export declare type EventValue = string | number | boolean;
|
|
4
|
-
export declare enum ShowPhase {
|
|
5
|
-
Setup = "setup",
|
|
6
|
-
Preshow = "pre-show",
|
|
7
|
-
InProgress = "in progress",
|
|
8
|
-
Finished = "finished"
|
|
9
|
-
}
|
|
10
|
-
export declare type EventKeyValue<TypeMap extends {
|
|
11
|
-
[key: string]: EventValue | null;
|
|
12
|
-
}, Key extends keyof TypeMap = keyof TypeMap> = Key extends string ? TypeMap[Key] extends null ? {
|
|
13
|
-
key: Key;
|
|
14
|
-
value: undefined;
|
|
15
|
-
} : {
|
|
16
|
-
key: Key;
|
|
17
|
-
value: TypeMap[Key];
|
|
18
|
-
} : never;
|
|
File without changes
|