Skip to content

Commit

Permalink
merge branch "SOFIE-1162-http-commands-cache-dns-lookup" into "releas…
Browse files Browse the repository at this point in the history
…e51"
  • Loading branch information
mint-dewit committed Jul 13, 2023
2 parents 5278800 + 41ed289 commit 2e7c069
Show file tree
Hide file tree
Showing 11 changed files with 475 additions and 614 deletions.
32 changes: 0 additions & 32 deletions packages/timeline-state-resolver-types/src/generated/httpSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,10 @@
*/

export interface HTTPSendOptions {
/**
* Whether a makeReady should be treated as a reset of the device. It should be assumed clean, with the queue discarded, and state reapplied from empty
*/
makeReadyDoesReset?: boolean
/**
* Minimum time in ms before a command is resent, set to <= 0 or undefined to disable
*/
resendTime?: number
makeReadyCommands?: HTTPSendCommandContent[]
}
export interface HTTPSendCommandContent {
type: TimelineContentTypeHTTP
url: string
params: {
[k: string]: unknown
}
paramsType?: TimelineContentTypeHTTPParamType
headers?: {
[k: string]: string
}
temporalPriority?: number
/**
* Commands in the same queue will be sent in order (will wait for the previous to finish before sending next
*/
queueId?: string
}

export enum TimelineContentTypeHTTP {
GET = 'get',
POST = 'post',
PUT = 'put',
DELETE = 'delete'
}
export enum TimelineContentTypeHTTPParamType {
JSON = 'json',
FORM = 'form'
}

export type SomeMappingHttpSend = Record<string, never>
Expand Down
30 changes: 29 additions & 1 deletion packages/timeline-state-resolver-types/src/httpSend.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
import { DeviceType, HTTPSendCommandContent } from '.'
import { DeviceType } from '.'

export type TimelineContentHTTPSendAny = TimelineContentHTTPRequest
export interface TimelineContentHTTPSendBase {
deviceType: DeviceType.HTTPSEND
}

export type TimelineContentHTTPRequest = TimelineContentHTTPSendBase & HTTPSendCommandContent

export interface HTTPSendCommandContent {
type: TimelineContentTypeHTTP
url: string
params: {
[k: string]: unknown
}
paramsType?: TimelineContentTypeHTTPParamType
headers?: {
[k: string]: string
}
temporalPriority?: number
/**
* Commands in the same queue will be sent in order (will wait for the previous to finish before sending next
*/
queueId?: string
}

export enum TimelineContentTypeHTTP {
GET = 'get',
POST = 'post',
PUT = 'put',
DELETE = 'delete',
}
export enum TimelineContentTypeHTTPParamType {
JSON = 'json',
FORM = 'form',
}
1 change: 1 addition & 0 deletions packages/timeline-state-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"@tv2media/v-connection": "^7.3.0",
"atem-connection": "2.4.0",
"atem-state": "^0.12.2",
"cacheable-lookup": "^5.0.3",
"casparcg-connection": "^6.0.3",
"casparcg-state": "^3.0.2",
"debug": "^4.3.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,6 @@ describe('Conductor', () => {
const commandReceiver2 = jest.fn(async () => {
return Promise.resolve()
})
const commandReceiver3 = jest.fn(async () => {
return Promise.resolve()
})
const commandReceiver4 = jest.fn(async () => {
return Promise.resolve()
})
Expand Down Expand Up @@ -363,7 +360,6 @@ describe('Conductor', () => {
await conductor.addDevice('device3', {
type: DeviceType.HTTPSEND,
options: {},
commandReceiver: commandReceiver3,
})
await conductor.addDevice('device4', {
type: DeviceType.LAWO,
Expand Down
12 changes: 2 additions & 10 deletions packages/timeline-state-resolver/src/conductor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { DeviceContainer } from './devices/deviceContainer'

import { CasparCGDevice, DeviceOptionsCasparCGInternal } from './integrations/casparCG'
import { AbstractDevice, DeviceOptionsAbstractInternal } from './integrations/abstract'
import { HTTPSendDevice, DeviceOptionsHTTPSendInternal } from './integrations/httpSend'
import { DeviceOptionsHTTPSendInternal } from './integrations/httpSend'
import { AtemDevice, DeviceOptionsAtemInternal } from './integrations/atem'
import { LawoDevice, DeviceOptionsLawoInternal } from './integrations/lawo'
import { PanasonicPtzDevice, DeviceOptionsPanasonicPTZInternal } from './integrations/panasonicPTZ'
Expand Down Expand Up @@ -524,15 +524,6 @@ export class Conductor extends EventEmitter<ConductorEvents> {
getCurrentTime,
threadedClassOptions
)
case DeviceType.HTTPSEND:
return DeviceContainer.create<DeviceOptionsHTTPSendInternal, typeof HTTPSendDevice>(
'../../dist/integrations/httpSend/index.js',
'HTTPSendDevice',
deviceId,
deviceOptions,
getCurrentTime,
threadedClassOptions
)
case DeviceType.HTTPWATCHER:
return DeviceContainer.create<DeviceOptionsHTTPWatcherInternal, typeof HTTPWatcherDevice>(
'../../dist/integrations/httpWatcher/index.js',
Expand Down Expand Up @@ -686,6 +677,7 @@ export class Conductor extends EventEmitter<ConductorEvents> {
getCurrentTime,
threadedClassOptions
)
case DeviceType.HTTPSEND:
case DeviceType.OSC:
// presumably this device is implemented in the new service handler
return RemoteDeviceInstance.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,76 +3,14 @@
"title": "HTTP Send Options",
"type": "object",
"properties": {
"makeReadyDoesReset": {
"type": "boolean",
"ui:title": "Whether Make Ready triggers a state reset",
"description": "Whether a makeReady should be treated as a reset of the device. It should be assumed clean, with the queue discarded, and state reapplied from empty",
"default": false
},
"resendTime": {
"type": "integer",
"description": "Minimum time in ms before a command is resent, set to <= 0 or undefined to disable",
"ui:description": "Minimum time in ms before a command is resent, set to a number > 0 to enable",
"ui:title": "Resend time in ms",
"default": 0
},
"makeReadyCommands": {
"type": "array",
"ui:title": "Make Ready Commands",
"items": {
"type": "object",
"title": "HTTPSendCommandContent",
"todo": "should this be pulled in from elsewhere? its a timeline object type too",
"properties": {
"type": {
"type": "string",
"title": "TimelineContentTypeHTTP",
"ui:title": "Type",
"ui:summaryTitle": "Type",
"default": "",
"enum": ["get", "post", "put", "delete"],
"tsEnumNames": ["GET", "POST", "PUT", "DELETE"]
},
"url": {
"type": "string",
"ui:title": "Url",
"ui:summaryTitle": "URL",
"default": ""
},
"params": {
"type": "object",
"ui:title": "Params",
"ui:displayType": "json",
"additionalProperties": true
},
"paramsType": {
"type": "string",
"title": "TimelineContentTypeHTTPParamType",
"ui:title": "Params type",
"default": "json",
"enum": ["json", "form"],
"tsEnumNames": ["JSON", "FORM"]
},
"headers": {
"type": "object",
"additionalProperties": { "type": "string" }
},
"temporalPriority": {
"type": "integer",
"ui:title": "Temporal Priority",
"default": 0
},
"queueId": {
"type": "string",
"description": "Commands in the same queue will be sent in order (will wait for the previous to finish before sending next",
"ui:title": "Send Queue Id"
}
},
"required": ["type", "url", "params"],
"additionalProperties": false
}
}
},
"required": ["host"],
"required": [],
"additionalProperties": false
}
Loading

0 comments on commit 2e7c069

Please sign in to comment.