mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 03:43:50 +00:00
feat: automation service
This commit is contained in:
committed by
Carlos Valente
parent
a8fe4c8e68
commit
05e61e7bf8
@@ -1,4 +1,5 @@
|
||||
import type {
|
||||
AutomationSettings,
|
||||
CustomFields,
|
||||
HttpSettings,
|
||||
OntimeRundown,
|
||||
@@ -18,4 +19,5 @@ export type DatabaseModel = {
|
||||
customFields: CustomFields;
|
||||
osc: OSCSettings;
|
||||
http: HttpSettings;
|
||||
automation: AutomationSettings;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import type { TimerLifeCycle } from './TimerLifecycle.type.js';
|
||||
|
||||
export type AutomationSettings = {
|
||||
enabledAutomations: boolean;
|
||||
enabledOscIn: boolean;
|
||||
oscPortIn: number;
|
||||
automations: Automation[];
|
||||
blueprints: NormalisedAutomationBlueprint;
|
||||
};
|
||||
|
||||
type BlueprintId = string;
|
||||
export type FilterRule = 'all' | 'any';
|
||||
|
||||
export type AutomationBlueprint = {
|
||||
id: BlueprintId;
|
||||
title: string;
|
||||
filterRule: FilterRule;
|
||||
filters: AutomationFilter[];
|
||||
outputs: AutomationOutput[];
|
||||
};
|
||||
|
||||
export type AutomationBlueprintDTO = Omit<AutomationBlueprint, 'id'>;
|
||||
|
||||
export type NormalisedAutomationBlueprint = Record<BlueprintId, AutomationBlueprint>;
|
||||
|
||||
export type Automation = {
|
||||
id: string;
|
||||
title: string;
|
||||
trigger: TimerLifeCycle;
|
||||
blueprintId: BlueprintId;
|
||||
};
|
||||
|
||||
export type AutomationDTO = Omit<Automation, 'id'>;
|
||||
|
||||
export type AutomationFilter = {
|
||||
field: string; // this should be a key of a OntimeEvent + custom fields
|
||||
operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'contains' | 'not_contains';
|
||||
value: string; // we use string but would coerce to the field value
|
||||
};
|
||||
|
||||
export type AutomationOutput = OSCOutput | HTTPOutput;
|
||||
|
||||
export type OSCOutput = {
|
||||
type: 'osc';
|
||||
targetIP: string;
|
||||
targetPort: number;
|
||||
address: string;
|
||||
args: string;
|
||||
};
|
||||
|
||||
export type HTTPOutput = {
|
||||
type: 'http';
|
||||
url: string;
|
||||
};
|
||||
@@ -11,3 +11,5 @@ export enum TimerLifeCycle {
|
||||
}
|
||||
|
||||
export type TimerLifeCycleKey = keyof typeof TimerLifeCycle;
|
||||
|
||||
export const timerLifecycleValues = Object.keys(TimerLifeCycle);
|
||||
|
||||
@@ -16,6 +16,21 @@ export type { OntimeEntryCommonKeys, OntimeRundown, OntimeRundownEntry } from '.
|
||||
export { TimeStrategy } from './definitions/TimeStrategy.type.js';
|
||||
export { TimerType } from './definitions/TimerType.type.js';
|
||||
|
||||
// ---> Automations
|
||||
export type {
|
||||
AutomationSettings,
|
||||
AutomationBlueprint,
|
||||
AutomationBlueprintDTO,
|
||||
Automation,
|
||||
AutomationDTO,
|
||||
AutomationFilter,
|
||||
AutomationOutput,
|
||||
FilterRule,
|
||||
HTTPOutput,
|
||||
NormalisedAutomationBlueprint,
|
||||
OSCOutput,
|
||||
} from './definitions/core/Automation.type.js';
|
||||
|
||||
// ---> Project Data
|
||||
export type { ProjectData } from './definitions/core/ProjectData.type.js';
|
||||
|
||||
@@ -67,7 +82,7 @@ export type {
|
||||
// SERVER RUNTIME
|
||||
export { type Log, LogLevel, type LogMessage, LogOrigin } from './definitions/runtime/Logger.type.js';
|
||||
export { Playback } from './definitions/runtime/Playback.type.js';
|
||||
export { TimerLifeCycle } from './definitions/core/TimerLifecycle.type.js';
|
||||
export { TimerLifeCycle, timerLifecycleValues } from './definitions/core/TimerLifecycle.type.js';
|
||||
export type { TimerMessage, MessageState } from './definitions/runtime/MessageControl.type.js';
|
||||
|
||||
export type { Runtime } from './definitions/runtime/Runtime.type.js';
|
||||
|
||||
Reference in New Issue
Block a user