From ac1b56db6f69e04f0d539063070be47407bec888 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 20 Dec 2024 14:54:37 +0000 Subject: [PATCH] type errors --- packages/builder/src/stores/builder/automations.ts | 11 ++++++----- packages/server/src/tests/utilities/structures.ts | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/stores/builder/automations.ts b/packages/builder/src/stores/builder/automations.ts index e2af403d7f..031a261498 100644 --- a/packages/builder/src/stores/builder/automations.ts +++ b/packages/builder/src/stores/builder/automations.ts @@ -564,11 +564,12 @@ const automationActions = (store: AutomationStore) => ({ automation.definition.stepNames?.[pathBlock.id] || pathBlock.name let schema = cloneDeep(pathBlock?.schema?.outputs?.properties) ?? {} - - const isLoopBlock = - pathBlock.stepId === ActionStepID.LOOP && - pathBlock.blockToLoop! in blocks - + let isLoopBlock = false + if (pathBlock.blockToLoop) { + isLoopBlock = + pathBlock.stepId === ActionStepID.LOOP && + pathBlock.blockToLoop in blocks + } const isTrigger = pathBlock.type === AutomationStepType.TRIGGER if (isLoopBlock && loopBlockCount == 0) { diff --git a/packages/server/src/tests/utilities/structures.ts b/packages/server/src/tests/utilities/structures.ts index 33e6e407dc..3058a706c1 100644 --- a/packages/server/src/tests/utilities/structures.ts +++ b/packages/server/src/tests/utilities/structures.ts @@ -456,7 +456,7 @@ export function filterAutomation(appId: string, tableId?: string): Automation { icon: "Icon", id: "a", type: AutomationStepType.TRIGGER, - event: "row:save", + event: AutomationEventType.ROW_SAVE, stepId: AutomationTriggerStepId.ROW_SAVED, inputs: { tableId: tableId!, @@ -498,7 +498,7 @@ export function updateRowAutomationWithFilters( icon: "Icon", id: "a", type: AutomationStepType.TRIGGER, - event: "row:update", + event: AutomationEventType.ROW_UPDATE, stepId: AutomationTriggerStepId.ROW_UPDATED, inputs: { tableId }, schema: TRIGGER_DEFINITIONS.ROW_UPDATED.schema, @@ -513,7 +513,7 @@ export function basicAutomationResults( return { automationId, status: AutomationStatus.SUCCESS, - trigger: "trigger", + trigger: "trigger" as any, steps: [ { stepId: AutomationActionStepId.SERVER_LOG,