diff --git a/packages/server/src/sdk/app/automations/utils.ts b/packages/server/src/sdk/app/automations/utils.ts index f5ae8bf948..79e70923f1 100644 --- a/packages/server/src/sdk/app/automations/utils.ts +++ b/packages/server/src/sdk/app/automations/utils.ts @@ -1,56 +1,7 @@ -import { - Automation, - AutomationActionStepId, - AutomationBuilderData, -} from "@budibase/types" -import { sdk as coreSdk } from "@budibase/shared-core" -import sdk from "../../../sdk" +import { Automation, AutomationActionStepId } from "@budibase/types" export function checkForCollectStep(automation: Automation) { return automation.definition.steps.some( (step: any) => step.stepId === AutomationActionStepId.COLLECT ) } - -export async function getBuilderData( - automations: Automation[] -): Promise> { - const tableNameCache: Record = {} - async function getTableName(tableId: string) { - if (!tableNameCache[tableId]) { - const table = await sdk.tables.getTable(tableId) - tableNameCache[tableId] = table.name - } - - return tableNameCache[tableId] - } - - const result: Record = {} - for (const automation of automations) { - const isRowAction = coreSdk.automations.isRowAction(automation) - if (!isRowAction) { - result[automation._id!] = { displayName: automation.name } - continue - } - - const { tableId, rowActionId } = automation.definition.trigger.inputs - if (!tableId || !rowActionId) { - continue - } - - const tableName = await getTableName(tableId) - const rowActionName = automation.name - result[automation._id!] = { - displayName: rowActionName, - triggerInfo: { - type: "Automation trigger", - table: { id: tableId, name: tableName }, - rowAction: { - id: rowActionId, - name: rowActionName, - }, - }, - } - } - return result -}