condition + repeat node

This commit is contained in:
ari committed 2022-07-14 15:24:35 -04:00
1 parent 89c7007612
commit 07ab4b9089
22 files changed
+631 -282

No files matched your search

+17 -1
View File
@@ -9,8 +9,12 @@ import { AutomationTrigger, TriggerType } from "types/automations/triggers";
import { MiniFailure } from "types/validators/helper";
import { getFailures } from "../types/validators/helper";
import { ActionType } from "types/automations/actions";
import { ConditionType } from "types/automations/conditions";
import {
ConditionType,
AutomationCondition,
} from "types/automations/conditions";
import * as st from "superstruct";
import { ScriptConditionField } from "types/automations/common";
export const getNodeTypeAndValidate = (
node: AutomationNode,
@@ -236,3 +240,15 @@ export const entityDomainsAreBinary = (domains: string[]): boolean => {
return true;
}
};
export const convertScriptConditionFieldToAutomationConditions = (
field: ScriptConditionField | undefined
): AutomationCondition[] => {
if (!field) {
return [];
} else if (typeof field === "string") {
return [{ condition: "template", value_template: field }];
} else {
return field;
}
};