@clockworkdog/cogs-client 1.5.5 → 2.0.0-beta.1

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/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 * from './types/valueTypes';
5
+ export * 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';
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
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.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
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];
@@ -16,7 +20,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
20
  exports.preloadUrl = exports.assetUrl = exports.CogsVideoPlayer = exports.LIVE_VIDEO_PLAYBACK_RATE = exports.CogsRtspStreamer = exports.CogsAudioPlayer = exports.CogsConnection = void 0;
17
21
  var CogsConnection_1 = require("./CogsConnection");
18
22
  Object.defineProperty(exports, "CogsConnection", { enumerable: true, get: function () { return __importDefault(CogsConnection_1).default; } });
19
- __exportStar(require("./types/valueTypes"), exports);
23
+ __exportStar(require("./CogsConnection"), exports);
24
+ __exportStar(require("./types/ShowPhase"), exports);
20
25
  var AudioPlayer_1 = require("./AudioPlayer");
21
26
  Object.defineProperty(exports, "CogsAudioPlayer", { enumerable: true, get: function () { return __importDefault(AudioPlayer_1).default; } });
22
27
  var RtspStreamer_1 = require("./RtspStreamer");
@@ -1,4 +1,4 @@
1
- export declare type MediaStatus = 'playing' | 'paused' | 'stopped';
1
+ export type MediaStatus = 'playing' | 'paused' | 'stopped';
2
2
  export default interface AllMediaClipStatesMessage {
3
3
  mediaType: 'audio' | 'video';
4
4
  files: [string, MediaStatus][];
@@ -1,4 +1,4 @@
1
- export declare type ActiveAudioClipState = {
1
+ export type ActiveAudioClipState = {
2
2
  type: 'paused';
3
3
  } | {
4
4
  type: 'pause_requested';
@@ -1,5 +1,5 @@
1
1
  import MediaObjectFit from './MediaObjectFit';
2
- import { ShowPhase } from './valueTypes';
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 declare type Media = {
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
- declare type MediaClientMessage = {
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 declare type CogsClientMessage<CustomConfig = {}> = ShowResetMessage | ShowPhaseMessage | AdjustableTimerUpdateMessage | TextHintsUpdateMessage | (MediaClientConfigMessage & CustomConfig) | MediaClientMessage;
84
+ export type CogsClientMessage<CustomConfig = {}> = ShowResetMessage | ShowPhaseMessage | AdjustableTimerUpdateMessage | TextHintsUpdateMessage | (MediaClientConfigMessage & CustomConfig) | MediaClientMessage;
85
85
  export default CogsClientMessage;
@@ -0,0 +1,33 @@
1
+ import { CogsValueType, CogsValueTypeBoolean, CogsValueTypeNumber, CogsValueTypeOption, CogsValueTypeString, PluginManifestJson, PluginManifestJsonReadonly, PluginManifestStateJson } from './PluginManifestJson';
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
+ /**
5
+ * Allow readonly (i.e. `const`) versions of a manifest as well as a regular PluginManifestJson
6
+ */
7
+ export type PluginManifest = PluginManifestJson | PluginManifestJsonReadonly;
8
+ export type ConfigKey<Manifest extends Pick<PluginManifest, 'config'>> = NonNullable<Manifest['config']>[number]['name'];
9
+ export type ConfigAsObject<Manifest extends Pick<PluginManifest, 'config'>> = DistributeObject<{
10
+ [Key in ConfigKey<Manifest>]: TypeFromCogsValueType<Extract<DeepMutable<NonNullable<Manifest['config']>[number]>, {
11
+ name: Key;
12
+ }>['value']>;
13
+ }>;
14
+ export type StateKey<Manifest extends Pick<PluginManifest, 'state'>, Constraints extends Partial<PluginManifestStateJson> = Record<never, never>> = Extract<DeepMutable<NonNullable<Manifest['state']>[number]>, Constraints>['name'];
15
+ export type StateAsObject<Manifest extends Pick<PluginManifest, 'state'>, Constraints extends Partial<PluginManifestStateJson> = Record<never, never>> = DistributeObject<{
16
+ [Key in StateKey<Manifest, Constraints>]: TypeFromCogsValueType<Extract<DeepMutable<NonNullable<Manifest['state']>[number]>, {
17
+ name: Key;
18
+ }>['value']>;
19
+ }>;
20
+ export type EventFromCogsKey<Manifest extends PluginManifest> = NonNullable<NonNullable<Manifest['events']>['fromCogs']>[number]['name'];
21
+ export type EventsFromCogs<Manifest extends PluginManifest> = NonNullable<NonNullable<Manifest['events']>['fromCogs']>[number];
22
+ export type EventFromCogsAsObject<Manifest extends PluginManifest> = DistributeObject<{
23
+ [Key in EventFromCogsKey<Manifest>]: TypeFromCogsValueType<Extract<DeepMutable<EventsFromCogs<Manifest>>, {
24
+ name: Key;
25
+ }>['value']>;
26
+ }>;
27
+ export type EventToCogsKey<Manifest extends PluginManifest> = NonNullable<NonNullable<Manifest['events']>['toCogs']>[number]['name'];
28
+ export type EventsToCogs<Manifest extends PluginManifest> = NonNullable<NonNullable<Manifest['events']>['toCogs']>[number];
29
+ export type EventToCogsAsObject<Manifest extends PluginManifest> = DistributeObject<{
30
+ [Key in EventToCogsKey<Manifest>]: TypeFromCogsValueType<Extract<DeepMutable<EventsToCogs<Manifest>>, {
31
+ name: Key;
32
+ }>['value']>;
33
+ }>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- export declare type MediaStatus = 'playing' | 'paused' | 'stopped';
1
+ export type MediaStatus = 'playing' | 'paused' | 'stopped';
2
2
  export default interface MediaClipStateMessage {
3
3
  playId: string;
4
4
  mediaType: 'audio' | 'video';
@@ -1,2 +1,2 @@
1
- export declare type MediaObjectFit = 'contain' | 'cover' | 'none';
1
+ export type MediaObjectFit = 'contain' | 'cover' | 'none';
2
2
  export default MediaObjectFit;
@@ -1,40 +1,41 @@
1
- export declare type FontAwesomeIconId = string;
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 declare type CogsValueTypeString = CogsValueTypeBase<'string'>;
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 declare type CogsValueTypeBoolean = CogsValueTypeBase<'boolean'>;
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 declare type CogsValueType = CogsValueTypeString | CogsValueTypeNumber | CogsValueTypeBoolean | CogsValueTypeOption<string[]>;
16
- export declare type CogsValueTypeStringWithDefault = CogsValueTypeString & {
16
+ export type CogsValueType = CogsValueTypeString | CogsValueTypeNumber | CogsValueTypeBoolean | CogsValueTypeOption<string[]>;
17
+ export type CogsValueTypeStringWithDefault = CogsValueTypeString & {
17
18
  default: string;
18
19
  };
19
- export declare type CogsValueTypeNumberWithDefault = CogsValueTypeNumber & {
20
+ export type CogsValueTypeNumberWithDefault = CogsValueTypeNumber & {
20
21
  default: number;
21
22
  };
22
- export declare type CogsValueTypeBooleanWithDefault = CogsValueTypeBoolean & {
23
+ export type CogsValueTypeBooleanWithDefault = CogsValueTypeBoolean & {
23
24
  default: boolean;
24
25
  };
25
- export declare type CogsValueTypeOptionWithDefault = CogsValueTypeOption<string[]> & {
26
+ export type CogsValueTypeOptionWithDefault = CogsValueTypeOption<string[]> & {
26
27
  default: string;
27
28
  };
28
- export declare type CogsValueTypeWithDefault = CogsValueTypeStringWithDefault | CogsValueTypeNumberWithDefault | CogsValueTypeBooleanWithDefault | CogsValueTypeOptionWithDefault;
29
- export declare type PluginManifestConfigJson = {
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 declare type PluginManifestEventJson = {
34
+ export type PluginManifestEventJson = {
34
35
  name: string;
35
36
  value?: CogsValueType;
36
37
  };
37
- export declare type PluginManifestStateJson = {
38
+ export type PluginManifestStateJson = {
38
39
  name: string;
39
40
  value: CogsValueTypeWithDefault;
40
41
  writableFromCogs?: true;
@@ -69,9 +70,15 @@ export interface PluginManifestJson {
69
70
  */
70
71
  description?: string;
71
72
  /**
72
- * A FontAwesome 5.X icon shown alongside `name`, in the COGS navigation bar, and in the [COGS plugins directory](/plugins)
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?: FontAwesomeIconId;
81
+ icon?: string;
75
82
  /**
76
83
  * The HTML entrypoint for the plugin
77
84
  *
@@ -114,3 +121,9 @@ 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 PluginManifestJsonReadonly = DeepReadonly<PluginManifestJson>;
@@ -0,0 +1,7 @@
1
+ declare enum ShowPhase {
2
+ Setup = "setup",
3
+ Preshow = "pre-show",
4
+ InProgress = "in progress",
5
+ Finished = "finished"
6
+ }
7
+ export default ShowPhase;
@@ -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 = exports.ShowPhase || (exports.ShowPhase = {}));
9
+ })(ShowPhase || (ShowPhase = {}));
10
+ exports.default = ShowPhase;
@@ -5,4 +5,4 @@ var ActiveVideoClipState;
5
5
  (function (ActiveVideoClipState) {
6
6
  ActiveVideoClipState["Paused"] = "paused";
7
7
  ActiveVideoClipState["Playing"] = "playing";
8
- })(ActiveVideoClipState = exports.ActiveVideoClipState || (exports.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;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clockworkdog/cogs-client",
3
- "version": "v1.5.5",
3
+ "version": "v2.0.0-beta.1",
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,11 +25,11 @@
24
25
  "eslint-config-prettier": "^7.1.0",
25
26
  "eslint-plugin-prettier": "^3.3.1",
26
27
  "prettier": "^2.2.1",
27
- "typescript": "^4.1.3"
28
+ "typescript": "^5.1.6"
28
29
  },
29
30
  "dependencies": {
30
31
  "@clockworkdog/media-stream-library-browser": "^11.1.1-fixes.6",
31
- "howler": "2.2.1",
32
+ "howler": "clockwork-dog/howler.js#fix-looping-clips",
32
33
  "reconnecting-websocket": "^4.4.0"
33
34
  },
34
35
  "description": "Connect to COGS to build a custom Media Master",
@@ -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;