diff --git a/packages/timeline-state-resolver-types/src/generated/httpSend.ts b/packages/timeline-state-resolver-types/src/generated/httpSend.ts index 0163cab7e..1990252ad 100644 --- a/packages/timeline-state-resolver-types/src/generated/httpSend.ts +++ b/packages/timeline-state-resolver-types/src/generated/httpSend.ts @@ -46,16 +46,7 @@ export enum TimelineContentTypeHTTPParamType { export type SomeMappingHttpSend = Record -export interface SendCommandPayload { - type: string - url: string - params: { - [k: string]: unknown - } - paramsType?: string - temporalPriority?: number - queueId?: string -} +export type SendCommandPayload = HTTPSendCommandContent export enum HttpSendActions { Resync = 'resync', diff --git a/packages/timeline-state-resolver/src/integrations/httpSend/$schemas/actions.json b/packages/timeline-state-resolver/src/integrations/httpSend/$schemas/actions.json index 9319ea409..51094d8f1 100644 --- a/packages/timeline-state-resolver/src/integrations/httpSend/$schemas/actions.json +++ b/packages/timeline-state-resolver/src/integrations/httpSend/$schemas/actions.json @@ -12,18 +12,54 @@ "destructive": false, "payload": { "type": "object", + "tsType": "HTTPSendCommandContent", "properties": { "type": { - "type": "string" + "type": "string", + "title": "TimelineContentTypeHTTP", + "ui:title": "Type", + "ui:summaryTitle": "Type", + "default": "", + "enum": ["get", "post", "put", "delete"], + "tsEnumNames": ["GET", "POST", "PUT", "DELETE"] }, - "url": { "type": "string" }, - "params": { "type": "object" }, - "paramsType": { "type": "string" }, - "temporalPriority": { "type": "number" }, - "queueId": { "type": "string" } + "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" + } }, - "additionalProperties": false, - "required": ["type", "url", "params"] + "required": ["type", "url", "params"], + "additionalProperties": false } } ] diff --git a/packages/timeline-state-resolver/src/integrations/httpSend/index.ts b/packages/timeline-state-resolver/src/integrations/httpSend/index.ts index 5cc5f74c9..2b24b997f 100644 --- a/packages/timeline-state-resolver/src/integrations/httpSend/index.ts +++ b/packages/timeline-state-resolver/src/integrations/httpSend/index.ts @@ -155,7 +155,7 @@ export class HTTPSendDevice extends DeviceWithState(TimelineContentTypeHTTP).includes(cmd.type as TimelineContentTypeHTTP)) { + if (Object.values(TimelineContentTypeHTTP).includes(cmd.type)) { return { result: ActionExecutionResultCode.Error, response: t('Failed to send command: type is invalid'), @@ -174,7 +174,7 @@ export class HTTPSendDevice extends DeviceWithState