Fix types

This commit is contained in:
Paulus Schoutsen 2021-03-22 22:43:08 +00:00
parent 4b664cc142
commit 20da329a21
3 changed files with 19 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import { DemoTrace } from "./types";
export const motionLightTrace: DemoTrace = { export const motionLightTrace: DemoTrace = {
trace: { trace: {
automation_id: "",
last_action: "action/3", last_action: "action/3",
last_condition: null, last_condition: null,
run_id: "1", run_id: "1",

View File

@ -18,6 +18,14 @@ export interface ConditionTrace extends BaseTrace {
result: { result: boolean }; result: { result: boolean };
} }
export interface CallServiceActionTrace extends BaseTrace {
result: {
limit: number;
running_script: boolean;
params: Record<string, unknown>;
};
}
export interface ChooseActionTrace extends BaseTrace { export interface ChooseActionTrace extends BaseTrace {
result: { choice: number }; result: { choice: number };
} }
@ -28,10 +36,13 @@ export interface ChooseChoiceActionTrace extends BaseTrace {
export type ActionTrace = export type ActionTrace =
| BaseTrace | BaseTrace
| CallServiceActionTrace
| ChooseActionTrace | ChooseActionTrace
| ChooseChoiceActionTrace; | ChooseChoiceActionTrace;
export interface AutomationTrace { export interface AutomationTrace {
automation_id: string;
unique_id: string;
last_action: string | null; last_action: string | null;
last_condition: string | null; last_condition: string | null;
run_id: string; run_id: string;
@ -41,7 +52,6 @@ export interface AutomationTrace {
finish: string | null; finish: string | null;
}; };
trigger: unknown; trigger: unknown;
unique_id: string;
} }
export interface AutomationTraceExtended extends AutomationTrace { export interface AutomationTraceExtended extends AutomationTrace {

View File

@ -104,8 +104,13 @@ export interface UntilRepeat extends BaseRepeat {
} }
export interface ChooseAction { export interface ChooseAction {
choose: [
{
alias?: string; alias?: string;
choose: [{ conditions: Condition[]; sequence: Action[] }]; conditions: string | Condition[];
sequence: Action[];
}
];
default?: Action[]; default?: Action[];
} }