more naming
This commit is contained in:
parent
394a8c4d94
commit
41051a8d69
|
@ -10,6 +10,7 @@ import {
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import * as triggers from "../triggers"
|
import * as triggers from "../triggers"
|
||||||
import { db as dbCore, context } from "@budibase/backend-core"
|
import { db as dbCore, context } from "@budibase/backend-core"
|
||||||
|
import { features } from "@budibase/pro"
|
||||||
|
|
||||||
export const definition: AutomationStepSchema = {
|
export const definition: AutomationStepSchema = {
|
||||||
name: "Trigger an automation",
|
name: "Trigger an automation",
|
||||||
|
@ -62,26 +63,28 @@ export const definition: AutomationStepSchema = {
|
||||||
export async function run({ inputs }: AutomationStepInput) {
|
export async function run({ inputs }: AutomationStepInput) {
|
||||||
const { automationId, ...fieldParams } = inputs.automation
|
const { automationId, ...fieldParams } = inputs.automation
|
||||||
|
|
||||||
if (!inputs.automation.automationId) {
|
if (await features.isTriggerAutomationRunEnabled()) {
|
||||||
return {
|
if (!inputs.automation.automationId) {
|
||||||
success: false,
|
return {
|
||||||
}
|
success: false,
|
||||||
} else {
|
}
|
||||||
const db = context.getAppDB()
|
} else {
|
||||||
let automation = await db.get<Automation>(inputs.automation.automationId)
|
const db = context.getAppDB()
|
||||||
|
let automation = await db.get<Automation>(inputs.automation.automationId)
|
||||||
|
|
||||||
const response: AutomationResults = await triggers.externalTrigger(
|
const response: AutomationResults = await triggers.externalTrigger(
|
||||||
automation,
|
automation,
|
||||||
{
|
{
|
||||||
fields: { ...fieldParams },
|
fields: { ...fieldParams },
|
||||||
timeout: inputs.timeout * 1000 || 120000,
|
timeout: inputs.timeout * 1000 || 120000,
|
||||||
},
|
},
|
||||||
{ getResponses: true }
|
{ getResponses: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
value: response.steps,
|
value: response.steps,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue