diff --git a/packages/timeline-state-resolver-tools/bin/schema-types.mjs b/packages/timeline-state-resolver-tools/bin/schema-types.mjs index 6fbd3a670..c0f5ea108 100755 --- a/packages/timeline-state-resolver-tools/bin/schema-types.mjs +++ b/packages/timeline-state-resolver-tools/bin/schema-types.mjs @@ -227,7 +227,7 @@ for (const dir of dirs) { const dirId = capitalise(dir) - let output = '' + let output = "import type { DeviceType } from './device-options.js'\n" // compile options from file try { @@ -401,14 +401,6 @@ ${actionDefinitions }"\n` + output } - output += ` -export interface ${dirId}DeviceTypes { - Options: ${dirId}Options - Mappings: SomeMapping${dirId} - Actions: ${actionDefinitions.length > 0 ? `${dirId}ActionMethods` : 'null'} -} -` - let deviceTypeId = toConstantCase(dir) // Special case handling for some devices, for backwards compatibility if ( @@ -422,10 +414,17 @@ export interface ${dirId}DeviceTypes { } deviceTypeEnum.push(deviceTypeId) + output += ` +export interface ${dirId}DeviceTypes { + Type: DeviceType.${deviceTypeId}, + Options: ${dirId}Options + Mappings: SomeMapping${dirId} + Actions: ${actionDefinitions.length > 0 ? `${dirId}ActionMethods` : 'null'} +} +` + deviceOptionsFile += `import type { ${dirId}Options } from './${dir}' -export interface DeviceOptions${dirId} extends DeviceOptionsBase<${dirId}Options> { - type: DeviceType.${deviceTypeId} -}\n\n` +export type DeviceOptions${dirId} = DeviceOptionsBase\n\n` deviceOptionsTypes.push(`DeviceOptions${dirId}`) manifestFileSubdevices += `\t\t[DeviceType.${deviceTypeId}]: { diff --git a/packages/timeline-state-resolver-types/src/device.ts b/packages/timeline-state-resolver-types/src/device.ts index 59250550b..3fb743980 100644 --- a/packages/timeline-state-resolver-types/src/device.ts +++ b/packages/timeline-state-resolver-types/src/device.ts @@ -15,11 +15,11 @@ export interface DeviceStatus { active: boolean } -export interface DeviceOptionsBase extends SlowReportOptions, DeviceCommonOptions { - type: DeviceType +export interface DeviceOptionsBase extends SlowReportOptions, DeviceCommonOptions { + type: TType isMultiThreaded?: boolean reportAllCommands?: boolean - options?: T + options?: TOptions } export interface SlowReportOptions { diff --git a/packages/timeline-state-resolver-types/src/generated/abstract.ts b/packages/timeline-state-resolver-types/src/generated/abstract.ts index 2e05701ff..4c0f332fd 100644 --- a/packages/timeline-state-resolver-types/src/generated/abstract.ts +++ b/packages/timeline-state-resolver-types/src/generated/abstract.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface AbstractOptions {} @@ -18,6 +19,7 @@ export interface AbstractActionMethods { } export interface AbstractDeviceTypes { + Type: DeviceType.ABSTRACT, Options: AbstractOptions Mappings: SomeMappingAbstract Actions: AbstractActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/atem.ts b/packages/timeline-state-resolver-types/src/generated/atem.ts index 54b2cb65b..c77368ed9 100644 --- a/packages/timeline-state-resolver-types/src/generated/atem.ts +++ b/packages/timeline-state-resolver-types/src/generated/atem.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface AtemOptions { host: string @@ -113,6 +114,7 @@ export interface AtemActionMethods { } export interface AtemDeviceTypes { + Type: DeviceType.ATEM, Options: AtemOptions Mappings: SomeMappingAtem Actions: AtemActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/casparCG.ts b/packages/timeline-state-resolver-types/src/generated/casparCG.ts index 6785573a2..6a88c1079 100644 --- a/packages/timeline-state-resolver-types/src/generated/casparCG.ts +++ b/packages/timeline-state-resolver-types/src/generated/casparCG.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface CasparCGOptions { /** @@ -66,6 +67,7 @@ export interface CasparCGActionMethods { } export interface CasparCGDeviceTypes { + Type: DeviceType.CASPARCG, Options: CasparCGOptions Mappings: SomeMappingCasparCG Actions: CasparCGActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/device-options.ts b/packages/timeline-state-resolver-types/src/generated/device-options.ts index afd6845e6..2379cd246 100644 --- a/packages/timeline-state-resolver-types/src/generated/device-options.ts +++ b/packages/timeline-state-resolver-types/src/generated/device-options.ts @@ -7,129 +7,79 @@ import type { DeviceOptionsBase } from '../device' import type { AbstractOptions } from './abstract' -export interface DeviceOptionsAbstract extends DeviceOptionsBase { - type: DeviceType.ABSTRACT -} +export type DeviceOptionsAbstract = DeviceOptionsBase import type { AtemOptions } from './atem' -export interface DeviceOptionsAtem extends DeviceOptionsBase { - type: DeviceType.ATEM -} +export type DeviceOptionsAtem = DeviceOptionsBase import type { CasparCGOptions } from './casparCG' -export interface DeviceOptionsCasparCG extends DeviceOptionsBase { - type: DeviceType.CASPARCG -} +export type DeviceOptionsCasparCG = DeviceOptionsBase import type { HttpSendOptions } from './httpSend' -export interface DeviceOptionsHttpSend extends DeviceOptionsBase { - type: DeviceType.HTTPSEND -} +export type DeviceOptionsHttpSend = DeviceOptionsBase import type { HttpWatcherOptions } from './httpWatcher' -export interface DeviceOptionsHttpWatcher extends DeviceOptionsBase { - type: DeviceType.HTTPWATCHER -} +export type DeviceOptionsHttpWatcher = DeviceOptionsBase import type { HyperdeckOptions } from './hyperdeck' -export interface DeviceOptionsHyperdeck extends DeviceOptionsBase { - type: DeviceType.HYPERDECK -} +export type DeviceOptionsHyperdeck = DeviceOptionsBase import type { KairosOptions } from './kairos' -export interface DeviceOptionsKairos extends DeviceOptionsBase { - type: DeviceType.KAIROS -} +export type DeviceOptionsKairos = DeviceOptionsBase import type { LawoOptions } from './lawo' -export interface DeviceOptionsLawo extends DeviceOptionsBase { - type: DeviceType.LAWO -} +export type DeviceOptionsLawo = DeviceOptionsBase import type { MultiOscOptions } from './multiOsc' -export interface DeviceOptionsMultiOsc extends DeviceOptionsBase { - type: DeviceType.MULTI_OSC -} +export type DeviceOptionsMultiOsc = DeviceOptionsBase import type { ObsOptions } from './obs' -export interface DeviceOptionsObs extends DeviceOptionsBase { - type: DeviceType.OBS -} +export type DeviceOptionsObs = DeviceOptionsBase import type { OscOptions } from './osc' -export interface DeviceOptionsOsc extends DeviceOptionsBase { - type: DeviceType.OSC -} +export type DeviceOptionsOsc = DeviceOptionsBase import type { PanasonicPTZOptions } from './panasonicPTZ' -export interface DeviceOptionsPanasonicPTZ extends DeviceOptionsBase { - type: DeviceType.PANASONIC_PTZ -} +export type DeviceOptionsPanasonicPTZ = DeviceOptionsBase import type { PharosOptions } from './pharos' -export interface DeviceOptionsPharos extends DeviceOptionsBase { - type: DeviceType.PHAROS -} +export type DeviceOptionsPharos = DeviceOptionsBase import type { QuantelOptions } from './quantel' -export interface DeviceOptionsQuantel extends DeviceOptionsBase { - type: DeviceType.QUANTEL -} +export type DeviceOptionsQuantel = DeviceOptionsBase import type { ShotokuOptions } from './shotoku' -export interface DeviceOptionsShotoku extends DeviceOptionsBase { - type: DeviceType.SHOTOKU -} +export type DeviceOptionsShotoku = DeviceOptionsBase import type { SingularLiveOptions } from './singularLive' -export interface DeviceOptionsSingularLive extends DeviceOptionsBase { - type: DeviceType.SINGULAR_LIVE -} +export type DeviceOptionsSingularLive = DeviceOptionsBase import type { SisyfosOptions } from './sisyfos' -export interface DeviceOptionsSisyfos extends DeviceOptionsBase { - type: DeviceType.SISYFOS -} +export type DeviceOptionsSisyfos = DeviceOptionsBase import type { SofieChefOptions } from './sofieChef' -export interface DeviceOptionsSofieChef extends DeviceOptionsBase { - type: DeviceType.SOFIE_CHEF -} +export type DeviceOptionsSofieChef = DeviceOptionsBase import type { TcpSendOptions } from './tcpSend' -export interface DeviceOptionsTcpSend extends DeviceOptionsBase { - type: DeviceType.TCPSEND -} +export type DeviceOptionsTcpSend = DeviceOptionsBase import type { TelemetricsOptions } from './telemetrics' -export interface DeviceOptionsTelemetrics extends DeviceOptionsBase { - type: DeviceType.TELEMETRICS -} +export type DeviceOptionsTelemetrics = DeviceOptionsBase import type { TricasterOptions } from './tricaster' -export interface DeviceOptionsTricaster extends DeviceOptionsBase { - type: DeviceType.TRICASTER -} +export type DeviceOptionsTricaster = DeviceOptionsBase import type { ViscaOverIPOptions } from './viscaOverIP' -export interface DeviceOptionsViscaOverIP extends DeviceOptionsBase { - type: DeviceType.VISCA_OVER_IP -} +export type DeviceOptionsViscaOverIP = DeviceOptionsBase import type { VizMSEOptions } from './vizMSE' -export interface DeviceOptionsVizMSE extends DeviceOptionsBase { - type: DeviceType.VIZMSE -} +export type DeviceOptionsVizMSE = DeviceOptionsBase import type { VmixOptions } from './vmix' -export interface DeviceOptionsVmix extends DeviceOptionsBase { - type: DeviceType.VMIX -} +export type DeviceOptionsVmix = DeviceOptionsBase import type { WebsocketClientOptions } from './websocketClient' -export interface DeviceOptionsWebsocketClient extends DeviceOptionsBase { - type: DeviceType.WEBSOCKET_CLIENT -} +export type DeviceOptionsWebsocketClient = DeviceOptionsBase export type DeviceOptionsAny = | DeviceOptionsAbstract diff --git a/packages/timeline-state-resolver-types/src/generated/httpSend.ts b/packages/timeline-state-resolver-types/src/generated/httpSend.ts index f60efa702..b3ea39457 100644 --- a/packages/timeline-state-resolver-types/src/generated/httpSend.ts +++ b/packages/timeline-state-resolver-types/src/generated/httpSend.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface HttpSendOptions { /** @@ -79,6 +80,7 @@ export interface HttpSendActionMethods { } export interface HttpSendDeviceTypes { + Type: DeviceType.HTTPSEND, Options: HttpSendOptions Mappings: SomeMappingHttpSend Actions: HttpSendActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/httpWatcher.ts b/packages/timeline-state-resolver-types/src/generated/httpWatcher.ts index 428ea965f..145b6818d 100644 --- a/packages/timeline-state-resolver-types/src/generated/httpWatcher.ts +++ b/packages/timeline-state-resolver-types/src/generated/httpWatcher.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface HttpWatcherOptions { uri: string @@ -26,6 +27,7 @@ export enum HttpMethod { export type SomeMappingHttpWatcher = Record export interface HttpWatcherDeviceTypes { + Type: DeviceType.HTTPWATCHER, Options: HttpWatcherOptions Mappings: SomeMappingHttpWatcher Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/hyperdeck.ts b/packages/timeline-state-resolver-types/src/generated/hyperdeck.ts index e5ee11652..cf32ba5de 100644 --- a/packages/timeline-state-resolver-types/src/generated/hyperdeck.ts +++ b/packages/timeline-state-resolver-types/src/generated/hyperdeck.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface HyperdeckOptions { host: string @@ -36,6 +37,7 @@ export interface HyperdeckActionMethods { } export interface HyperdeckDeviceTypes { + Type: DeviceType.HYPERDECK, Options: HyperdeckOptions Mappings: SomeMappingHyperdeck Actions: HyperdeckActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/kairos.ts b/packages/timeline-state-resolver-types/src/generated/kairos.ts index 981c8069d..95a89e7be 100644 --- a/packages/timeline-state-resolver-types/src/generated/kairos.ts +++ b/packages/timeline-state-resolver-types/src/generated/kairos.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface KairosOptions { /** @@ -377,6 +378,7 @@ export interface KairosActionMethods { } export interface KairosDeviceTypes { + Type: DeviceType.KAIROS, Options: KairosOptions Mappings: SomeMappingKairos Actions: KairosActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/lawo.ts b/packages/timeline-state-resolver-types/src/generated/lawo.ts index 51764fe26..359c4892c 100644 --- a/packages/timeline-state-resolver-types/src/generated/lawo.ts +++ b/packages/timeline-state-resolver-types/src/generated/lawo.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface LawoOptions { host: string @@ -78,6 +79,7 @@ export enum MappingLawoType { export type SomeMappingLawo = MappingLawoSource | MappingLawoSources | MappingLawoFullpath | MappingLawoTriggerValue export interface LawoDeviceTypes { + Type: DeviceType.LAWO, Options: LawoOptions Mappings: SomeMappingLawo Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/multiOsc.ts b/packages/timeline-state-resolver-types/src/generated/multiOsc.ts index 641354e4c..c80af6ab6 100644 --- a/packages/timeline-state-resolver-types/src/generated/multiOsc.ts +++ b/packages/timeline-state-resolver-types/src/generated/multiOsc.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface MultiOscOptions { connections: { @@ -32,6 +33,7 @@ export enum MappingMultiOscType { export type SomeMappingMultiOsc = MappingMultiOscLayer export interface MultiOscDeviceTypes { + Type: DeviceType.MULTI_OSC, Options: MultiOscOptions Mappings: SomeMappingMultiOsc Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/obs.ts b/packages/timeline-state-resolver-types/src/generated/obs.ts index 0cf5e25cc..98d5b9ece 100644 --- a/packages/timeline-state-resolver-types/src/generated/obs.ts +++ b/packages/timeline-state-resolver-types/src/generated/obs.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface ObsOptions { host: string @@ -77,6 +78,7 @@ export enum MappingObsType { export type SomeMappingObs = MappingObsCurrentScene | MappingObsCurrentTransition | MappingObsRecording | MappingObsStreaming | MappingObsSceneItem | MappingObsInputAudio | MappingObsInputSettings | MappingObsInputMedia export interface ObsDeviceTypes { + Type: DeviceType.OBS, Options: ObsOptions Mappings: SomeMappingObs Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/osc.ts b/packages/timeline-state-resolver-types/src/generated/osc.ts index 1bb82de07..1447e5bf1 100644 --- a/packages/timeline-state-resolver-types/src/generated/osc.ts +++ b/packages/timeline-state-resolver-types/src/generated/osc.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface OscOptions { host: string @@ -19,6 +20,7 @@ export enum OSCDeviceType { export type SomeMappingOsc = Record export interface OscDeviceTypes { + Type: DeviceType.OSC, Options: OscOptions Mappings: SomeMappingOsc Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/panasonicPTZ.ts b/packages/timeline-state-resolver-types/src/generated/panasonicPTZ.ts index 731ec0072..e78fe7ac2 100644 --- a/packages/timeline-state-resolver-types/src/generated/panasonicPTZ.ts +++ b/packages/timeline-state-resolver-types/src/generated/panasonicPTZ.ts @@ -7,6 +7,7 @@ import type { ActionExecutionResult } from "../actions" import type { SetPanTiltSpeedPayload, GetPanTiltPositionResult, SetZoomSpeedPayload, GetZoomPositionResult, StorePresetPayload, RecallPresetPayload, ResetPresetPayload, SetFocusSpeedPayload, SetFocusModePayload, GetFocusPositionResult, GetFocusModeResult } from './generic-ptz-actions' +import type { DeviceType } from './device-options.js' export interface PanasonicPTZOptions { host: string @@ -69,6 +70,7 @@ export interface PanasonicPTZActionMethods { } export interface PanasonicPTZDeviceTypes { + Type: DeviceType.PANASONIC_PTZ, Options: PanasonicPTZOptions Mappings: SomeMappingPanasonicPTZ Actions: PanasonicPTZActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/pharos.ts b/packages/timeline-state-resolver-types/src/generated/pharos.ts index 2183ce387..e974e422f 100644 --- a/packages/timeline-state-resolver-types/src/generated/pharos.ts +++ b/packages/timeline-state-resolver-types/src/generated/pharos.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface PharosOptions { host: string @@ -13,6 +14,7 @@ export interface PharosOptions { export type SomeMappingPharos = Record export interface PharosDeviceTypes { + Type: DeviceType.PHAROS, Options: PharosOptions Mappings: SomeMappingPharos Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/quantel.ts b/packages/timeline-state-resolver-types/src/generated/quantel.ts index 92be5e1cb..e4606baa8 100644 --- a/packages/timeline-state-resolver-types/src/generated/quantel.ts +++ b/packages/timeline-state-resolver-types/src/generated/quantel.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface QuantelOptions { /** @@ -74,6 +75,7 @@ export interface QuantelActionMethods { } export interface QuantelDeviceTypes { + Type: DeviceType.QUANTEL, Options: QuantelOptions Mappings: SomeMappingQuantel Actions: QuantelActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/shotoku.ts b/packages/timeline-state-resolver-types/src/generated/shotoku.ts index 744ae240b..26273a7f2 100644 --- a/packages/timeline-state-resolver-types/src/generated/shotoku.ts +++ b/packages/timeline-state-resolver-types/src/generated/shotoku.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface ShotokuOptions { host: string @@ -13,6 +14,7 @@ export interface ShotokuOptions { export type SomeMappingShotoku = Record export interface ShotokuDeviceTypes { + Type: DeviceType.SHOTOKU, Options: ShotokuOptions Mappings: SomeMappingShotoku Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/singularLive.ts b/packages/timeline-state-resolver-types/src/generated/singularLive.ts index aef43d30e..d28e5453e 100644 --- a/packages/timeline-state-resolver-types/src/generated/singularLive.ts +++ b/packages/timeline-state-resolver-types/src/generated/singularLive.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface SingularLiveOptions { accessToken: string @@ -21,6 +22,7 @@ export enum MappingSingularLiveType { export type SomeMappingSingularLive = MappingSingularLiveComposition export interface SingularLiveDeviceTypes { + Type: DeviceType.SINGULAR_LIVE, Options: SingularLiveOptions Mappings: SomeMappingSingularLive Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/sisyfos.ts b/packages/timeline-state-resolver-types/src/generated/sisyfos.ts index ef185e2b5..e1ab6ab52 100644 --- a/packages/timeline-state-resolver-types/src/generated/sisyfos.ts +++ b/packages/timeline-state-resolver-types/src/generated/sisyfos.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface SisyfosOptions { host: string @@ -60,6 +61,7 @@ export interface SisyfosActionMethods { } export interface SisyfosDeviceTypes { + Type: DeviceType.SISYFOS, Options: SisyfosOptions Mappings: SomeMappingSisyfos Actions: SisyfosActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/sofieChef.ts b/packages/timeline-state-resolver-types/src/generated/sofieChef.ts index 206195f37..e13622ce5 100644 --- a/packages/timeline-state-resolver-types/src/generated/sofieChef.ts +++ b/packages/timeline-state-resolver-types/src/generated/sofieChef.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface SofieChefOptions { /** @@ -42,6 +43,7 @@ export interface SofieChefActionMethods { } export interface SofieChefDeviceTypes { + Type: DeviceType.SOFIE_CHEF, Options: SofieChefOptions Mappings: SomeMappingSofieChef Actions: SofieChefActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/tcpSend.ts b/packages/timeline-state-resolver-types/src/generated/tcpSend.ts index eee8570c4..395c6e076 100644 --- a/packages/timeline-state-resolver-types/src/generated/tcpSend.ts +++ b/packages/timeline-state-resolver-types/src/generated/tcpSend.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface TcpSendOptions { host: string @@ -43,6 +44,7 @@ export interface TcpSendActionMethods { } export interface TcpSendDeviceTypes { + Type: DeviceType.TCPSEND, Options: TcpSendOptions Mappings: SomeMappingTcpSend Actions: TcpSendActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/telemetrics.ts b/packages/timeline-state-resolver-types/src/generated/telemetrics.ts index 35d8c4aa7..dcfe0722c 100644 --- a/packages/timeline-state-resolver-types/src/generated/telemetrics.ts +++ b/packages/timeline-state-resolver-types/src/generated/telemetrics.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface TelemetricsOptions { host: string @@ -13,6 +14,7 @@ export interface TelemetricsOptions { export type SomeMappingTelemetrics = Record export interface TelemetricsDeviceTypes { + Type: DeviceType.TELEMETRICS, Options: TelemetricsOptions Mappings: SomeMappingTelemetrics Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/tricaster.ts b/packages/timeline-state-resolver-types/src/generated/tricaster.ts index 958ebbaf6..c6731d2b5 100644 --- a/packages/timeline-state-resolver-types/src/generated/tricaster.ts +++ b/packages/timeline-state-resolver-types/src/generated/tricaster.ts @@ -4,6 +4,7 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and re-run the "tsr-schema-types" tool to regenerate this file. */ +import type { DeviceType } from './device-options.js' export interface TricasterOptions { host: string @@ -61,6 +62,7 @@ export enum MappingTricasterType { export type SomeMappingTricaster = MappingTricasterME | MappingTricasterDSK | MappingTricasterINPUT | MappingTricasterAUDIOCHANNEL | MappingTricasterMIXOUTPUT | MappingTricasterMATRIXOUTPUT export interface TricasterDeviceTypes { + Type: DeviceType.TRICASTER, Options: TricasterOptions Mappings: SomeMappingTricaster Actions: null diff --git a/packages/timeline-state-resolver-types/src/generated/viscaOverIP.ts b/packages/timeline-state-resolver-types/src/generated/viscaOverIP.ts index 7dafb82f6..bf30eb6cb 100644 --- a/packages/timeline-state-resolver-types/src/generated/viscaOverIP.ts +++ b/packages/timeline-state-resolver-types/src/generated/viscaOverIP.ts @@ -7,6 +7,7 @@ import type { ActionExecutionResult } from "../actions" import type { SetPanTiltSpeedPayload, GetPanTiltPositionResult, SetZoomSpeedPayload, GetZoomPositionResult, StorePresetPayload, RecallPresetPayload, ResetPresetPayload, SetFocusSpeedPayload, SetFocusModePayload, GetFocusPositionResult, GetFocusModeResult } from './generic-ptz-actions' +import type { DeviceType } from './device-options.js' export interface ViscaOverIPOptions { host: string @@ -45,6 +46,7 @@ export interface ViscaOverIPActionMethods { } export interface ViscaOverIPDeviceTypes { + Type: DeviceType.VISCA_OVER_IP, Options: ViscaOverIPOptions Mappings: SomeMappingViscaOverIP Actions: ViscaOverIPActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/vizMSE.ts b/packages/timeline-state-resolver-types/src/generated/vizMSE.ts index 73cfe190a..224005975 100644 --- a/packages/timeline-state-resolver-types/src/generated/vizMSE.ts +++ b/packages/timeline-state-resolver-types/src/generated/vizMSE.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface VizMSEOptions { /** @@ -96,6 +97,7 @@ export interface VizMSEActionMethods { } export interface VizMSEDeviceTypes { + Type: DeviceType.VIZMSE, Options: VizMSEOptions Mappings: SomeMappingVizMSE Actions: VizMSEActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/vmix.ts b/packages/timeline-state-resolver-types/src/generated/vmix.ts index d1c499479..242e34de6 100644 --- a/packages/timeline-state-resolver-types/src/generated/vmix.ts +++ b/packages/timeline-state-resolver-types/src/generated/vmix.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface VmixOptions { host: string @@ -185,6 +186,7 @@ export interface VmixActionMethods { } export interface VmixDeviceTypes { + Type: DeviceType.VMIX, Options: VmixOptions Mappings: SomeMappingVmix Actions: VmixActionMethods diff --git a/packages/timeline-state-resolver-types/src/generated/websocketClient.ts b/packages/timeline-state-resolver-types/src/generated/websocketClient.ts index bac58a54f..a9eae57bc 100644 --- a/packages/timeline-state-resolver-types/src/generated/websocketClient.ts +++ b/packages/timeline-state-resolver-types/src/generated/websocketClient.ts @@ -5,6 +5,7 @@ * and re-run the "tsr-schema-types" tool to regenerate this file. */ import type { ActionExecutionResult } from "../actions" +import type { DeviceType } from './device-options.js' export interface WebsocketClientOptions { webSocket: { @@ -54,6 +55,7 @@ export interface WebsocketClientActionMethods { } export interface WebsocketClientDeviceTypes { + Type: DeviceType.WEBSOCKET_CLIENT, Options: WebsocketClientOptions Mappings: SomeMappingWebsocketClient Actions: WebsocketClientActionMethods diff --git a/packages/timeline-state-resolver/src/conductor.ts b/packages/timeline-state-resolver/src/conductor.ts index 3cdff092a..b94cac334 100644 --- a/packages/timeline-state-resolver/src/conductor.ts +++ b/packages/timeline-state-resolver/src/conductor.ts @@ -363,7 +363,7 @@ export class Conductor extends EventEmitter { private async _mapAllConnections( includeUninitialized: boolean, - fcn: (d: BaseRemoteDeviceIntegration>) => Promise + fcn: (d: BaseRemoteDeviceIntegration>) => Promise ): Promise { return PAll( this.connectionManager.getConnections(includeUninitialized).map((d) => async () => fcn(d)), @@ -476,7 +476,7 @@ export class Conductor extends EventEmitter { const pPrepareForHandleStates: Promise = Promise.all( this.connectionManager .getConnections(false) - .map(async (device: BaseRemoteDeviceIntegration>): Promise => { + .map(async (device: BaseRemoteDeviceIntegration>): Promise => { await device.device.prepareForHandleState(resolveTime) }) ).catch((error) => { @@ -573,7 +573,7 @@ export class Conductor extends EventEmitter { // Push state to the right device: await this._mapAllConnections( false, - async (device: BaseRemoteDeviceIntegration>): Promise => { + async (device: BaseRemoteDeviceIntegration>): Promise => { if (this._options.optimizeForProduction) { // Don't send any state to the abstract device, since it doesn't do anything anyway if (device.deviceType === DeviceType.ABSTRACT) return @@ -604,16 +604,19 @@ export class Conductor extends EventEmitter { if (!nextEventTime && tlState.time < this._resolved.validTo) { // There's nothing ahead in the timeline (as far as we can see, ref: this._resolved.validTo) // Tell the devices that the future is clear: - await this._mapAllConnections(true, async (device: BaseRemoteDeviceIntegration>) => { - try { - await device.device.clearFuture(tlState.time) - } catch (e) { - this.emit( - 'error', - 'Error in device "' + device.deviceId + '", clearFuture: ' + e + ' ' + (e as Error).stack - ) + await this._mapAllConnections( + true, + async (device: BaseRemoteDeviceIntegration>) => { + try { + await device.device.clearFuture(tlState.time) + } catch (e) { + this.emit( + 'error', + 'Error in device "' + device.deviceId + '", clearFuture: ' + e + ' ' + (e as Error).stack + ) + } } - }) + ) } const nowPostExec = this.getCurrentTime() @@ -1084,7 +1087,7 @@ export class Conductor extends EventEmitter { */ private filterLayersPerDevice( layers: Timeline.StateInTime, - devices: BaseRemoteDeviceIntegration>[] + devices: BaseRemoteDeviceIntegration>[] ) { const filteredStates: { [deviceId: string]: { [layerId: string]: ResolvedTimelineObjectInstanceExtended } } = {} diff --git a/packages/timeline-state-resolver/src/devices/device.ts b/packages/timeline-state-resolver/src/devices/device.ts index 7d01cde34..ba4a8680e 100644 --- a/packages/timeline-state-resolver/src/devices/device.ts +++ b/packages/timeline-state-resolver/src/devices/device.ts @@ -72,7 +72,7 @@ export type DeviceEventsOLD = { timeTrace: [trace: FinishedTrace] } -export interface IDevice> { +export interface IDevice> { init: (initOptions: TOptions['options'], activeRundownPlaylistId: string | undefined) => Promise getCurrentTime: () => number @@ -98,8 +98,8 @@ export interface IDevice> { * class will use. */ export abstract class Device< - DeviceTypes extends { Options: any; Mappings: any; Actions: Record }, // TODO: This type is not used as much as it should be, but as this class is deprecated it is not worth the effort to fix it - TOptions extends DeviceOptionsBase + DeviceTypes extends { Type: DeviceType; Options: any; Mappings: any; Actions: Record }, // TODO: This type is not used as much as it should be, but as this class is deprecated it is not worth the effort to fix it + TOptions extends DeviceOptionsBase > extends EventEmitter implements IDevice @@ -319,8 +319,8 @@ export abstract class Device< */ export abstract class DeviceWithState< TState, - DeviceTypes extends { Options: any; Mappings: any; Actions: Record }, - TOptions extends DeviceOptionsBase + DeviceTypes extends { Type: DeviceType; Options: any; Mappings: any; Actions: Record }, + TOptions extends DeviceOptionsBase > extends Device { private _states: { [time: string]: TState } = {} private _setStateCount = 0 diff --git a/packages/timeline-state-resolver/src/devices/deviceContainer.ts b/packages/timeline-state-resolver/src/devices/deviceContainer.ts index cfef1bf25..784c035f3 100644 --- a/packages/timeline-state-resolver/src/devices/deviceContainer.ts +++ b/packages/timeline-state-resolver/src/devices/deviceContainer.ts @@ -1,6 +1,6 @@ import { ThreadedClass, threadedClass, ThreadedClassConfig, ThreadedClassManager } from 'threadedclass' import { Device } from './device' -import { DeviceOptionsBase } from 'timeline-state-resolver-types' +import { DeviceOptionsBase, DeviceType } from 'timeline-state-resolver-types' import { BaseRemoteDeviceIntegration, DeviceContainerEvents } from '../service/remoteDeviceInstance' export { DeviceContainerEvents } @@ -10,7 +10,9 @@ export { DeviceContainerEvents } * keeps a local property of some basic information about the device (like * names and id's) to prevent a costly round trip over IPC. */ -export class DeviceContainer> extends BaseRemoteDeviceIntegration { +export class DeviceContainer< + TOptions extends DeviceOptionsBase +> extends BaseRemoteDeviceIntegration { protected readonly _device: ThreadedClass> public onChildClose: (() => void) | undefined @@ -24,7 +26,7 @@ export class DeviceContainer> extends Ba } static async create< - TOptions extends DeviceOptionsBase, + TOptions extends DeviceOptionsBase, TCtor extends new (...args: any[]) => Device >( orgModule: string, diff --git a/packages/timeline-state-resolver/src/service/ConnectionManager.ts b/packages/timeline-state-resolver/src/service/ConnectionManager.ts index 5b217a5cf..14589dddf 100644 --- a/packages/timeline-state-resolver/src/service/ConnectionManager.ts +++ b/packages/timeline-state-resolver/src/service/ConnectionManager.ts @@ -27,7 +27,7 @@ export interface ConnectionManagerIntEvents { error: [context: string, err?: Error] debug: [...debug: any[]] - connectionAdded: [id: string, container: BaseRemoteDeviceIntegration>] + connectionAdded: [id: string, container: BaseRemoteDeviceIntegration>] connectionInitialised: [id: string] connectionRemoved: [id: string] } @@ -68,7 +68,7 @@ export class ConnectionManager extends EventEmitter { this._updateConnections() } - public getConnections(includeUninitialized = false): Array>> { + public getConnections(includeUninitialized = false): Array>> { if (includeUninitialized) { return Array.from(this._connections.values()) } else { @@ -79,7 +79,7 @@ export class ConnectionManager extends EventEmitter { public getConnection( connectionId: string, includeUninitialized = false - ): BaseRemoteDeviceIntegration> | undefined { + ): BaseRemoteDeviceIntegration> | undefined { if (includeUninitialized) { return this._connections.get(connectionId) } else { @@ -372,15 +372,15 @@ export class ConnectionManager extends EventEmitter { * consideration. In addition, the debug logging flag should be ignored as that can be changed at runtime. */ function connectionConfigHasChanged( - connection: BaseRemoteDeviceIntegration>, - config: DeviceOptionsBase + connection: BaseRemoteDeviceIntegration>, + config: DeviceOptionsBase ): boolean { const oldConfig = connection.deviceOptions // now check device specific options return configHasChanged(oldConfig, config) } -function configHasChanged(oldConfig: DeviceOptionsBase, config: DeviceOptionsBase): boolean { +function configHasChanged(oldConfig: DeviceOptionsBase, config: DeviceOptionsBase): boolean { // now check device specific options return !_.isEqual(_.omit(oldConfig, 'debug', 'debugState'), _.omit(config, 'debug', 'debugState')) } @@ -391,7 +391,7 @@ function createContainer( deviceId: string, getCurrentTime: () => number, threadedClassOptions: ThreadedClassConfig -): Promise>> | null { +): Promise>> | null { switch (deviceOptions.type) { case DeviceType.CASPARCG: return DeviceContainer.create( diff --git a/packages/timeline-state-resolver/src/service/remoteDeviceInstance.ts b/packages/timeline-state-resolver/src/service/remoteDeviceInstance.ts index 27885a789..8e8c5bc5b 100644 --- a/packages/timeline-state-resolver/src/service/remoteDeviceInstance.ts +++ b/packages/timeline-state-resolver/src/service/remoteDeviceInstance.ts @@ -9,7 +9,7 @@ export type DeviceContainerEvents = { } export abstract class BaseRemoteDeviceIntegration< - TOptions extends DeviceOptionsBase + TOptions extends DeviceOptionsBase > extends EventEmitter { public abstract onChildClose: (() => void) | undefined @@ -105,7 +105,7 @@ export abstract class BaseRemoteDeviceIntegration< * names and id's) to prevent a costly round trip over IPC. */ export class RemoteDeviceInstance< - TOptions extends DeviceOptionsBase + TOptions extends DeviceOptionsBase > extends BaseRemoteDeviceIntegration { protected _device!: ThreadedClass public onChildClose: (() => void) | undefined @@ -114,7 +114,7 @@ export class RemoteDeviceInstance< super(deviceOptions, threadConfig) } - static async create>( + static async create>( pluginPath: string | null, deviceId: string, deviceOptions: TOptions,