Merge pull request #15383 from Budibase/pro-279-pull-automation-definitions-into-shared-core
Extract automation step definitions out into shared-core.
This commit is contained in:
commit
1211811302
|
@ -19,9 +19,11 @@ import {
|
||||||
Table,
|
Table,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { mocks } from "@budibase/backend-core/tests"
|
import { mocks } from "@budibase/backend-core/tests"
|
||||||
import { FilterConditions } from "../../../automations/steps/filter"
|
|
||||||
import { removeDeprecated } from "../../../automations/utils"
|
import { removeDeprecated } from "../../../automations/utils"
|
||||||
import { createAutomationBuilder } from "../../../automations/tests/utilities/AutomationTestBuilder"
|
import { createAutomationBuilder } from "../../../automations/tests/utilities/AutomationTestBuilder"
|
||||||
|
import { automations } from "@budibase/shared-core"
|
||||||
|
|
||||||
|
const FilterConditions = automations.steps.filter.FilterConditions
|
||||||
|
|
||||||
const MAX_RETRIES = 4
|
const MAX_RETRIES = 4
|
||||||
let {
|
let {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { automations } from "@budibase/shared-core"
|
||||||
import * as sendSmtpEmail from "./steps/sendSmtpEmail"
|
import * as sendSmtpEmail from "./steps/sendSmtpEmail"
|
||||||
import * as createRow from "./steps/createRow"
|
import * as createRow from "./steps/createRow"
|
||||||
import * as updateRow from "./steps/updateRow"
|
import * as updateRow from "./steps/updateRow"
|
||||||
|
@ -14,11 +15,10 @@ import * as make from "./steps/make"
|
||||||
import * as filter from "./steps/filter"
|
import * as filter from "./steps/filter"
|
||||||
import * as delay from "./steps/delay"
|
import * as delay from "./steps/delay"
|
||||||
import * as queryRow from "./steps/queryRows"
|
import * as queryRow from "./steps/queryRows"
|
||||||
import * as loop from "./steps/loop"
|
|
||||||
import * as collect from "./steps/collect"
|
import * as collect from "./steps/collect"
|
||||||
import * as branch from "./steps/branch"
|
|
||||||
import * as triggerAutomationRun from "./steps/triggerAutomationRun"
|
import * as triggerAutomationRun from "./steps/triggerAutomationRun"
|
||||||
import * as openai from "./steps/openai"
|
import * as openai from "./steps/openai"
|
||||||
|
import * as bash from "./steps/bash"
|
||||||
import env from "../environment"
|
import env from "../environment"
|
||||||
import {
|
import {
|
||||||
PluginType,
|
PluginType,
|
||||||
|
@ -62,42 +62,39 @@ export const BUILTIN_ACTION_DEFINITIONS: Record<
|
||||||
string,
|
string,
|
||||||
AutomationStepDefinition
|
AutomationStepDefinition
|
||||||
> = {
|
> = {
|
||||||
SEND_EMAIL_SMTP: sendSmtpEmail.definition,
|
SEND_EMAIL_SMTP: automations.steps.sendSmtpEmail.definition,
|
||||||
CREATE_ROW: createRow.definition,
|
CREATE_ROW: automations.steps.createRow.definition,
|
||||||
UPDATE_ROW: updateRow.definition,
|
UPDATE_ROW: automations.steps.updateRow.definition,
|
||||||
DELETE_ROW: deleteRow.definition,
|
DELETE_ROW: automations.steps.deleteRow.definition,
|
||||||
OUTGOING_WEBHOOK: outgoingWebhook.definition,
|
OUTGOING_WEBHOOK: automations.steps.outgoingWebhook.definition,
|
||||||
EXECUTE_SCRIPT: executeScript.definition,
|
EXECUTE_SCRIPT: automations.steps.executeScript.definition,
|
||||||
EXECUTE_QUERY: executeQuery.definition,
|
EXECUTE_QUERY: automations.steps.executeQuery.definition,
|
||||||
SERVER_LOG: serverLog.definition,
|
SERVER_LOG: automations.steps.serverLog.definition,
|
||||||
DELAY: delay.definition,
|
DELAY: automations.steps.delay.definition,
|
||||||
FILTER: filter.definition,
|
FILTER: automations.steps.filter.definition,
|
||||||
QUERY_ROWS: queryRow.definition,
|
QUERY_ROWS: automations.steps.queryRows.definition,
|
||||||
LOOP: loop.definition,
|
LOOP: automations.steps.loop.definition,
|
||||||
COLLECT: collect.definition,
|
COLLECT: automations.steps.collect.definition,
|
||||||
TRIGGER_AUTOMATION_RUN: triggerAutomationRun.definition,
|
TRIGGER_AUTOMATION_RUN: automations.steps.triggerAutomationRun.definition,
|
||||||
BRANCH: branch.definition,
|
BRANCH: automations.steps.branch.definition,
|
||||||
// these used to be lowercase step IDs, maintain for backwards compat
|
// these used to be lowercase step IDs, maintain for backwards compat
|
||||||
discord: discord.definition,
|
discord: automations.steps.discord.definition,
|
||||||
slack: slack.definition,
|
slack: automations.steps.slack.definition,
|
||||||
zapier: zapier.definition,
|
zapier: automations.steps.zapier.definition,
|
||||||
integromat: make.definition,
|
integromat: automations.steps.make.definition,
|
||||||
n8n: n8n.definition,
|
n8n: automations.steps.n8n.definition,
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't add the bash script/definitions unless in self host
|
// don't add the bash script/definitions unless in self host
|
||||||
// the fact this isn't included in any definitions means it cannot be
|
// the fact this isn't included in any definitions means it cannot be
|
||||||
// ran at all
|
// ran at all
|
||||||
if (env.SELF_HOSTED) {
|
if (env.SELF_HOSTED) {
|
||||||
const bash = require("./steps/bash")
|
// @ts-expect-error
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
ACTION_IMPLS["EXECUTE_BASH"] = bash.run
|
ACTION_IMPLS["EXECUTE_BASH"] = bash.run
|
||||||
// @ts-ignore
|
BUILTIN_ACTION_DEFINITIONS["EXECUTE_BASH"] = automations.steps.bash.definition
|
||||||
BUILTIN_ACTION_DEFINITIONS["EXECUTE_BASH"] = bash.definition
|
|
||||||
|
|
||||||
if (env.isTest()) {
|
if (env.isTest()) {
|
||||||
BUILTIN_ACTION_DEFINITIONS["OPENAI"] = openai.definition
|
BUILTIN_ACTION_DEFINITIONS["OPENAI"] = automations.steps.openai.definition
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +102,7 @@ export async function getActionDefinitions(): Promise<
|
||||||
Record<keyof typeof AutomationActionStepId, AutomationStepDefinition>
|
Record<keyof typeof AutomationActionStepId, AutomationStepDefinition>
|
||||||
> {
|
> {
|
||||||
if (env.SELF_HOSTED) {
|
if (env.SELF_HOSTED) {
|
||||||
BUILTIN_ACTION_DEFINITIONS["OPENAI"] = openai.definition
|
BUILTIN_ACTION_DEFINITIONS["OPENAI"] = automations.steps.openai.definition
|
||||||
}
|
}
|
||||||
|
|
||||||
const actionDefinitions = BUILTIN_ACTION_DEFINITIONS
|
const actionDefinitions = BUILTIN_ACTION_DEFINITIONS
|
||||||
|
|
|
@ -2,55 +2,7 @@ import { execSync } from "child_process"
|
||||||
import { processStringSync } from "@budibase/string-templates"
|
import { processStringSync } from "@budibase/string-templates"
|
||||||
import * as automationUtils from "../automationUtils"
|
import * as automationUtils from "../automationUtils"
|
||||||
import environment from "../../environment"
|
import environment from "../../environment"
|
||||||
import {
|
import { BashStepInputs, BashStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationCustomIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
BashStepInputs,
|
|
||||||
BashStepOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Bash Scripting",
|
|
||||||
tagline: "Execute a bash command",
|
|
||||||
icon: "JourneyEvent",
|
|
||||||
description: "Run a bash script",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
stepId: AutomationActionStepId.EXECUTE_BASH,
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
code: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
customType: AutomationCustomIOType.CODE,
|
|
||||||
title: "Code",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["code"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
stdout: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "Standard output of your bash command or script",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the command was successful",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["stdout"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -1,48 +1,4 @@
|
||||||
import {
|
import { CollectStepInputs, CollectStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
CollectStepInputs,
|
|
||||||
CollectStepOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Collect Data",
|
|
||||||
tagline: "Collect data to be sent to design",
|
|
||||||
icon: "Collection",
|
|
||||||
description:
|
|
||||||
"Collects specified data so it can be provided to the design section",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
features: {},
|
|
||||||
stepId: AutomationActionStepId.COLLECT,
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
collection: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "What to Collect",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["collection"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the action was successful",
|
|
||||||
},
|
|
||||||
value: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "Collected data",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success", "value"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -5,77 +5,9 @@ import {
|
||||||
sendAutomationAttachmentsToStorage,
|
sendAutomationAttachmentsToStorage,
|
||||||
} from "../automationUtils"
|
} from "../automationUtils"
|
||||||
import { buildCtx } from "./utils"
|
import { buildCtx } from "./utils"
|
||||||
import {
|
import { CreateRowStepInputs, CreateRowStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationCustomIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
CreateRowStepInputs,
|
|
||||||
CreateRowStepOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
import { EventEmitter } from "events"
|
import { EventEmitter } from "events"
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Create Row",
|
|
||||||
tagline: "Create a {{inputs.enriched.table.name}} row",
|
|
||||||
icon: "TableRowAddBottom",
|
|
||||||
description: "Add a row to your database",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
stepId: AutomationActionStepId.CREATE_ROW,
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
row: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
properties: {
|
|
||||||
tableId: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
customType: AutomationCustomIOType.TABLE,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
customType: AutomationCustomIOType.ROW,
|
|
||||||
title: "Table",
|
|
||||||
required: ["tableId"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["row"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
row: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
customType: AutomationCustomIOType.ROW,
|
|
||||||
description: "The new row",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description: "The response from the table",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the row creation was successful",
|
|
||||||
},
|
|
||||||
id: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "The identifier of the new row",
|
|
||||||
},
|
|
||||||
revision: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "The revision of the new row",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success", "id", "revision"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
appId,
|
appId,
|
||||||
|
|
|
@ -1,44 +1,5 @@
|
||||||
import { wait } from "../../utilities"
|
import { wait } from "../../utilities"
|
||||||
import {
|
import { DelayStepInputs, DelayStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
DelayStepInputs,
|
|
||||||
DelayStepOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Delay",
|
|
||||||
icon: "Clock",
|
|
||||||
tagline: "Delay for {{inputs.time}} milliseconds",
|
|
||||||
description: "Delay the automation until an amount of time has passed",
|
|
||||||
stepId: AutomationActionStepId.DELAY,
|
|
||||||
internal: true,
|
|
||||||
features: {},
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
time: {
|
|
||||||
type: AutomationIOType.NUMBER,
|
|
||||||
title: "Delay in milliseconds",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["time"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the delay was successful",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
type: AutomationStepType.LOGIC,
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -2,64 +2,7 @@ import { EventEmitter } from "events"
|
||||||
import { destroy } from "../../api/controllers/row"
|
import { destroy } from "../../api/controllers/row"
|
||||||
import { buildCtx } from "./utils"
|
import { buildCtx } from "./utils"
|
||||||
import { getError } from "../automationUtils"
|
import { getError } from "../automationUtils"
|
||||||
import {
|
import { DeleteRowStepInputs, DeleteRowStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationCustomIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
DeleteRowStepInputs,
|
|
||||||
DeleteRowStepOutputs,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
description: "Delete a row from your database",
|
|
||||||
icon: "TableRowRemoveCenter",
|
|
||||||
name: "Delete Row",
|
|
||||||
tagline: "Delete a {{inputs.enriched.table.name}} row",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
stepId: AutomationActionStepId.DELETE_ROW,
|
|
||||||
internal: true,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
tableId: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
customType: AutomationCustomIOType.TABLE,
|
|
||||||
title: "Table",
|
|
||||||
},
|
|
||||||
id: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Row ID",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["tableId", "id"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
row: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
customType: AutomationCustomIOType.ROW,
|
|
||||||
description: "The deleted row",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description: "The response from the table",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the deletion was successful",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["row", "success"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -1,71 +1,10 @@
|
||||||
import fetch from "node-fetch"
|
import fetch from "node-fetch"
|
||||||
import { getFetchResponse } from "./utils"
|
import { getFetchResponse } from "./utils"
|
||||||
import {
|
import { ExternalAppStepOutputs, DiscordStepInputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
ExternalAppStepOutputs,
|
|
||||||
DiscordStepInputs,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
const DEFAULT_USERNAME = "Budibase Automate"
|
const DEFAULT_USERNAME = "Budibase Automate"
|
||||||
const DEFAULT_AVATAR_URL = "https://i.imgur.com/a1cmTKM.png"
|
const DEFAULT_AVATAR_URL = "https://i.imgur.com/a1cmTKM.png"
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Discord Message",
|
|
||||||
tagline: "Send a message to a Discord server",
|
|
||||||
description: "Send a message to a Discord server",
|
|
||||||
icon: "ri-discord-line",
|
|
||||||
stepId: AutomationActionStepId.discord,
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: false,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
url: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Discord Webhook URL",
|
|
||||||
},
|
|
||||||
username: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Bot Name",
|
|
||||||
},
|
|
||||||
avatar_url: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Bot Avatar URL",
|
|
||||||
},
|
|
||||||
content: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Message",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["url", "content"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
httpStatus: {
|
|
||||||
type: AutomationIOType.NUMBER,
|
|
||||||
description: "The HTTP status code of the request",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "The response from the Discord Webhook",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the message sent successfully",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
}: {
|
}: {
|
||||||
|
|
|
@ -3,67 +3,10 @@ import * as queryController from "../../api/controllers/query"
|
||||||
import { buildCtx } from "./utils"
|
import { buildCtx } from "./utils"
|
||||||
import * as automationUtils from "../automationUtils"
|
import * as automationUtils from "../automationUtils"
|
||||||
import {
|
import {
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationCustomIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
ExecuteQueryStepInputs,
|
ExecuteQueryStepInputs,
|
||||||
ExecuteQueryStepOutputs,
|
ExecuteQueryStepOutputs,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "External Data Connector",
|
|
||||||
tagline: "Execute Data Connector",
|
|
||||||
icon: "Data",
|
|
||||||
description: "Execute a query in an external data connector",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
stepId: AutomationActionStepId.EXECUTE_QUERY,
|
|
||||||
internal: true,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
query: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
properties: {
|
|
||||||
queryId: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
customType: AutomationCustomIOType.QUERY,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
customType: AutomationCustomIOType.QUERY_PARAMS,
|
|
||||||
title: "Parameters",
|
|
||||||
required: ["queryId"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["query"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description: "The response from the datasource execution",
|
|
||||||
},
|
|
||||||
info: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description:
|
|
||||||
"Some query types may return extra data, like headers from a REST query",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the action was successful",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["response", "success"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
appId,
|
appId,
|
||||||
|
|
|
@ -2,56 +2,11 @@ import * as scriptController from "../../api/controllers/script"
|
||||||
import { buildCtx } from "./utils"
|
import { buildCtx } from "./utils"
|
||||||
import * as automationUtils from "../automationUtils"
|
import * as automationUtils from "../automationUtils"
|
||||||
import {
|
import {
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationCustomIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
ExecuteScriptStepInputs,
|
ExecuteScriptStepInputs,
|
||||||
ExecuteScriptStepOutputs,
|
ExecuteScriptStepOutputs,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { EventEmitter } from "events"
|
import { EventEmitter } from "events"
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "JS Scripting",
|
|
||||||
tagline: "Execute JavaScript Code",
|
|
||||||
icon: "Code",
|
|
||||||
description: "Run a piece of JavaScript code in your automation",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
stepId: AutomationActionStepId.EXECUTE_SCRIPT,
|
|
||||||
inputs: {},
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
code: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
customType: AutomationCustomIOType.CODE,
|
|
||||||
title: "Code",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["code"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
value: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "The result of the return statement",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the action was successful",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
appId,
|
appId,
|
||||||
|
|
|
@ -1,74 +1,7 @@
|
||||||
import {
|
import { FilterStepInputs, FilterStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
import { automations } from "@budibase/shared-core"
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
FilterStepInputs,
|
|
||||||
FilterStepOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const FilterConditions = {
|
const FilterConditions = automations.steps.filter.FilterConditions
|
||||||
EQUAL: "EQUAL",
|
|
||||||
NOT_EQUAL: "NOT_EQUAL",
|
|
||||||
GREATER_THAN: "GREATER_THAN",
|
|
||||||
LESS_THAN: "LESS_THAN",
|
|
||||||
}
|
|
||||||
|
|
||||||
export const PrettyFilterConditions = {
|
|
||||||
[FilterConditions.EQUAL]: "Equals",
|
|
||||||
[FilterConditions.NOT_EQUAL]: "Not equals",
|
|
||||||
[FilterConditions.GREATER_THAN]: "Greater than",
|
|
||||||
[FilterConditions.LESS_THAN]: "Less than",
|
|
||||||
}
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Condition",
|
|
||||||
tagline: "{{inputs.field}} {{inputs.condition}} {{inputs.value}}",
|
|
||||||
icon: "Branch2",
|
|
||||||
description:
|
|
||||||
"Conditionally halt automations which do not meet certain conditions",
|
|
||||||
type: AutomationStepType.LOGIC,
|
|
||||||
internal: true,
|
|
||||||
features: {},
|
|
||||||
stepId: AutomationActionStepId.FILTER,
|
|
||||||
inputs: {
|
|
||||||
condition: FilterConditions.EQUAL,
|
|
||||||
},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
field: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Reference Value",
|
|
||||||
},
|
|
||||||
condition: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Condition",
|
|
||||||
enum: Object.values(FilterConditions),
|
|
||||||
pretty: Object.values(PrettyFilterConditions),
|
|
||||||
},
|
|
||||||
value: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Comparison Value",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["field", "condition", "value"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the action was successful",
|
|
||||||
},
|
|
||||||
result: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the logic block passed",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success", "result"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -1,62 +1,6 @@
|
||||||
import fetch from "node-fetch"
|
import fetch from "node-fetch"
|
||||||
import { getFetchResponse } from "./utils"
|
import { getFetchResponse } from "./utils"
|
||||||
import {
|
import { ExternalAppStepOutputs, MakeIntegrationInputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
ExternalAppStepOutputs,
|
|
||||||
MakeIntegrationInputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Make Integration",
|
|
||||||
stepTitle: "Make",
|
|
||||||
tagline: "Trigger a Make scenario",
|
|
||||||
description:
|
|
||||||
"Performs a webhook call to Make and gets the response (if configured)",
|
|
||||||
icon: "ri-shut-down-line",
|
|
||||||
stepId: AutomationActionStepId.integromat,
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: false,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
url: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Webhook URL",
|
|
||||||
},
|
|
||||||
body: {
|
|
||||||
type: AutomationIOType.JSON,
|
|
||||||
title: "Payload",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["url", "body"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether call was successful",
|
|
||||||
},
|
|
||||||
httpStatus: {
|
|
||||||
type: AutomationIOType.NUMBER,
|
|
||||||
description: "The HTTP status code returned",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description: "The webhook response - this can have properties",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success", "response"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -1,73 +1,11 @@
|
||||||
import fetch, { HeadersInit } from "node-fetch"
|
import fetch, { HeadersInit } from "node-fetch"
|
||||||
import { getFetchResponse } from "./utils"
|
import { getFetchResponse } from "./utils"
|
||||||
import {
|
import {
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
HttpMethod,
|
HttpMethod,
|
||||||
ExternalAppStepOutputs,
|
ExternalAppStepOutputs,
|
||||||
n8nStepInputs,
|
n8nStepInputs,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "n8n Integration",
|
|
||||||
stepTitle: "n8n",
|
|
||||||
tagline: "Trigger an n8n workflow",
|
|
||||||
description:
|
|
||||||
"Performs a webhook call to n8n and gets the response (if configured)",
|
|
||||||
icon: "ri-shut-down-line",
|
|
||||||
stepId: AutomationActionStepId.n8n,
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: false,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
url: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Webhook URL",
|
|
||||||
},
|
|
||||||
method: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Method",
|
|
||||||
enum: Object.values(HttpMethod),
|
|
||||||
},
|
|
||||||
authorization: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Authorization",
|
|
||||||
},
|
|
||||||
body: {
|
|
||||||
type: AutomationIOType.JSON,
|
|
||||||
title: "Payload",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["url", "method"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether call was successful",
|
|
||||||
},
|
|
||||||
httpStatus: {
|
|
||||||
type: AutomationIOType.NUMBER,
|
|
||||||
description: "The HTTP status code returned",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description: "The webhook response - this can have properties",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success", "response"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
}: {
|
}: {
|
||||||
|
|
|
@ -1,67 +1,10 @@
|
||||||
import { OpenAI } from "openai"
|
import { OpenAI } from "openai"
|
||||||
|
|
||||||
import {
|
import { OpenAIStepInputs, OpenAIStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
OpenAIStepInputs,
|
|
||||||
OpenAIStepOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
import { env } from "@budibase/backend-core"
|
import { env } from "@budibase/backend-core"
|
||||||
import * as automationUtils from "../automationUtils"
|
import * as automationUtils from "../automationUtils"
|
||||||
import * as pro from "@budibase/pro"
|
import * as pro from "@budibase/pro"
|
||||||
|
|
||||||
enum Model {
|
|
||||||
GPT_4O_MINI = "gpt-4o-mini",
|
|
||||||
GPT_4O = "gpt-4o",
|
|
||||||
GPT_4 = "gpt-4",
|
|
||||||
GPT_35_TURBO = "gpt-3.5-turbo",
|
|
||||||
}
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "OpenAI",
|
|
||||||
tagline: "Send prompts to ChatGPT",
|
|
||||||
icon: "Algorithm",
|
|
||||||
description: "Interact with the OpenAI ChatGPT API.",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
features: {},
|
|
||||||
stepId: AutomationActionStepId.OPENAI,
|
|
||||||
inputs: {
|
|
||||||
prompt: "",
|
|
||||||
},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
prompt: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Prompt",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Model",
|
|
||||||
enum: Object.values(Model),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["prompt", "model"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the action was successful",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "What was output",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success", "response"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maintains backward compatibility with automation steps created before the introduction
|
* Maintains backward compatibility with automation steps created before the introduction
|
||||||
* of custom configurations and Budibase AI
|
* of custom configurations and Budibase AI
|
||||||
|
|
|
@ -2,12 +2,6 @@ import fetch from "node-fetch"
|
||||||
import { getFetchResponse } from "./utils"
|
import { getFetchResponse } from "./utils"
|
||||||
import * as automationUtils from "../automationUtils"
|
import * as automationUtils from "../automationUtils"
|
||||||
import {
|
import {
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationCustomIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
ExternalAppStepOutputs,
|
ExternalAppStepOutputs,
|
||||||
OutgoingWebhookStepInputs,
|
OutgoingWebhookStepInputs,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
@ -26,69 +20,6 @@ const BODY_REQUESTS = [RequestType.POST, RequestType.PUT, RequestType.PATCH]
|
||||||
* NOTE: this functionality is deprecated - it no longer should be used.
|
* NOTE: this functionality is deprecated - it no longer should be used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
deprecated: true,
|
|
||||||
name: "Outgoing webhook",
|
|
||||||
tagline: "Send a {{inputs.requestMethod}} request",
|
|
||||||
icon: "Send",
|
|
||||||
description: "Send a request of specified method to a URL",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
stepId: AutomationActionStepId.OUTGOING_WEBHOOK,
|
|
||||||
inputs: {
|
|
||||||
requestMethod: "POST",
|
|
||||||
url: "http://",
|
|
||||||
requestBody: "{}",
|
|
||||||
headers: "{}",
|
|
||||||
},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
requestMethod: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
enum: Object.values(RequestType),
|
|
||||||
title: "Request method",
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "URL",
|
|
||||||
},
|
|
||||||
requestBody: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "JSON Body",
|
|
||||||
customType: AutomationCustomIOType.WIDE,
|
|
||||||
},
|
|
||||||
headers: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Headers",
|
|
||||||
customType: AutomationCustomIOType.WIDE,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["requestMethod", "url"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description: "The response from the webhook",
|
|
||||||
},
|
|
||||||
httpStatus: {
|
|
||||||
type: AutomationIOType.NUMBER,
|
|
||||||
description: "The HTTP status code returned",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the action was successful",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["response", "success"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
}: {
|
}: {
|
||||||
|
|
|
@ -4,84 +4,12 @@ import { buildCtx } from "./utils"
|
||||||
import * as automationUtils from "../automationUtils"
|
import * as automationUtils from "../automationUtils"
|
||||||
import {
|
import {
|
||||||
FieldType,
|
FieldType,
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationCustomIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
EmptyFilterOption,
|
EmptyFilterOption,
|
||||||
SortOrder,
|
SortOrder,
|
||||||
QueryRowsStepInputs,
|
QueryRowsStepInputs,
|
||||||
QueryRowsStepOutputs,
|
QueryRowsStepOutputs,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
|
||||||
const SortOrderPretty = {
|
|
||||||
[SortOrder.ASCENDING]: "Ascending",
|
|
||||||
[SortOrder.DESCENDING]: "Descending",
|
|
||||||
}
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
description: "Query rows from the database",
|
|
||||||
icon: "Search",
|
|
||||||
name: "Query rows",
|
|
||||||
tagline: "Query rows from {{inputs.enriched.table.name}} table",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
stepId: AutomationActionStepId.QUERY_ROWS,
|
|
||||||
internal: true,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
tableId: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
customType: AutomationCustomIOType.TABLE,
|
|
||||||
title: "Table",
|
|
||||||
},
|
|
||||||
filters: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
customType: AutomationCustomIOType.FILTERS,
|
|
||||||
title: "Filtering",
|
|
||||||
},
|
|
||||||
sortColumn: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Sort Column",
|
|
||||||
customType: AutomationCustomIOType.COLUMN,
|
|
||||||
},
|
|
||||||
sortOrder: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Sort Order",
|
|
||||||
enum: Object.values(SortOrder),
|
|
||||||
pretty: Object.values(SortOrderPretty),
|
|
||||||
},
|
|
||||||
limit: {
|
|
||||||
type: AutomationIOType.NUMBER,
|
|
||||||
title: "Limit",
|
|
||||||
customType: AutomationCustomIOType.QUERY_LIMIT,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["tableId"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
rows: {
|
|
||||||
type: AutomationIOType.ARRAY,
|
|
||||||
customType: AutomationCustomIOType.ROWS,
|
|
||||||
description: "The rows that were found",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the query was successful",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["rows", "success"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getTable(appId: string, tableId: string) {
|
async function getTable(appId: string, tableId: string) {
|
||||||
const ctx: any = buildCtx(appId, null, {
|
const ctx: any = buildCtx(appId, null, {
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -1,102 +1,6 @@
|
||||||
import { sendSmtpEmail } from "../../utilities/workerRequests"
|
import { sendSmtpEmail } from "../../utilities/workerRequests"
|
||||||
import * as automationUtils from "../automationUtils"
|
import * as automationUtils from "../automationUtils"
|
||||||
import {
|
import { SmtpEmailStepInputs, BaseAutomationOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
AutomationCustomIOType,
|
|
||||||
SmtpEmailStepInputs,
|
|
||||||
BaseAutomationOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
description: "Send an email using SMTP",
|
|
||||||
tagline: "Send SMTP email to {{inputs.to}}",
|
|
||||||
icon: "Email",
|
|
||||||
name: "Send Email (SMTP)",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
stepId: AutomationActionStepId.SEND_EMAIL_SMTP,
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
to: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Send To",
|
|
||||||
},
|
|
||||||
from: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Send From",
|
|
||||||
},
|
|
||||||
cc: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "CC",
|
|
||||||
},
|
|
||||||
bcc: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "BCC",
|
|
||||||
},
|
|
||||||
subject: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Email Subject",
|
|
||||||
},
|
|
||||||
contents: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "HTML Contents",
|
|
||||||
},
|
|
||||||
addInvite: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
title: "Add calendar invite",
|
|
||||||
},
|
|
||||||
startTime: {
|
|
||||||
type: AutomationIOType.DATE,
|
|
||||||
title: "Start Time",
|
|
||||||
dependsOn: "addInvite",
|
|
||||||
},
|
|
||||||
endTime: {
|
|
||||||
type: AutomationIOType.DATE,
|
|
||||||
title: "End Time",
|
|
||||||
dependsOn: "addInvite",
|
|
||||||
},
|
|
||||||
summary: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Meeting Summary",
|
|
||||||
dependsOn: "addInvite",
|
|
||||||
},
|
|
||||||
location: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Location",
|
|
||||||
dependsOn: "addInvite",
|
|
||||||
},
|
|
||||||
attachments: {
|
|
||||||
type: AutomationIOType.ATTACHMENT,
|
|
||||||
customType: AutomationCustomIOType.MULTI_ATTACHMENTS,
|
|
||||||
title: "Attachments",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["to", "from", "subject", "contents"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the email was sent",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description: "A response from the email client, this may be an error",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -1,58 +1,4 @@
|
||||||
import {
|
import { ServerLogStepInputs, ServerLogStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
ServerLogStepInputs,
|
|
||||||
ServerLogStepOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Note, there is some functionality in this that is not currently exposed as it
|
|
||||||
* is complex and maybe better to be opinionated here.
|
|
||||||
* GET/DELETE requests cannot handle body elements so they will not be sent if configured.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Backend log",
|
|
||||||
tagline: "Console log a value in the backend",
|
|
||||||
icon: "Monitoring",
|
|
||||||
description: "Logs the given text to the server (using console.log)",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
stepId: AutomationActionStepId.SERVER_LOG,
|
|
||||||
inputs: {
|
|
||||||
text: "",
|
|
||||||
},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
text: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Log",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["text"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the action was successful",
|
|
||||||
},
|
|
||||||
message: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "What was output",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success", "message"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -1,59 +1,6 @@
|
||||||
import fetch from "node-fetch"
|
import fetch from "node-fetch"
|
||||||
import { getFetchResponse } from "./utils"
|
import { getFetchResponse } from "./utils"
|
||||||
import {
|
import { ExternalAppStepOutputs, SlackStepInputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
ExternalAppStepOutputs,
|
|
||||||
SlackStepInputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Slack Message",
|
|
||||||
tagline: "Send a message to Slack",
|
|
||||||
description: "Send a message to Slack",
|
|
||||||
icon: "ri-slack-line",
|
|
||||||
stepId: AutomationActionStepId.slack,
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: false,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
url: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Incoming Webhook URL",
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Message",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["url", "text"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
httpStatus: {
|
|
||||||
type: AutomationIOType.NUMBER,
|
|
||||||
description: "The HTTP status code of the request",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the message sent successfully",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "The response from the Slack Webhook",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
import {
|
import {
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
Automation,
|
Automation,
|
||||||
AutomationCustomIOType,
|
|
||||||
TriggerAutomationStepInputs,
|
TriggerAutomationStepInputs,
|
||||||
TriggerAutomationStepOutputs,
|
TriggerAutomationStepOutputs,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
@ -13,54 +8,6 @@ import { context } from "@budibase/backend-core"
|
||||||
import { features } from "@budibase/pro"
|
import { features } from "@budibase/pro"
|
||||||
import env from "../../environment"
|
import env from "../../environment"
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Trigger an automation",
|
|
||||||
tagline: "Triggers an automation synchronously",
|
|
||||||
icon: "Sync",
|
|
||||||
description: "Triggers an automation synchronously",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
features: {},
|
|
||||||
stepId: AutomationActionStepId.TRIGGER_AUTOMATION_RUN,
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
automation: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
properties: {
|
|
||||||
automationId: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
customType: AutomationCustomIOType.AUTOMATION,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
customType: AutomationCustomIOType.AUTOMATION_FIELDS,
|
|
||||||
title: "automatioFields",
|
|
||||||
required: ["automationId"],
|
|
||||||
},
|
|
||||||
timeout: {
|
|
||||||
type: AutomationIOType.NUMBER,
|
|
||||||
title: "Timeout (ms)",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["automationId"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the automation was successful",
|
|
||||||
},
|
|
||||||
value: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description: "Automation Result",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success", "value"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
}: {
|
}: {
|
||||||
|
|
|
@ -2,76 +2,8 @@ import { EventEmitter } from "events"
|
||||||
import * as rowController from "../../api/controllers/row"
|
import * as rowController from "../../api/controllers/row"
|
||||||
import * as automationUtils from "../automationUtils"
|
import * as automationUtils from "../automationUtils"
|
||||||
import { buildCtx } from "./utils"
|
import { buildCtx } from "./utils"
|
||||||
import {
|
import { UpdateRowStepInputs, UpdateRowStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationCustomIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
UpdateRowStepInputs,
|
|
||||||
UpdateRowStepOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Update Row",
|
|
||||||
tagline: "Update a {{inputs.enriched.table.name}} row",
|
|
||||||
icon: "Refresh",
|
|
||||||
description: "Update a row in your database",
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: true,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
stepId: AutomationActionStepId.UPDATE_ROW,
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
meta: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
title: "Field settings",
|
|
||||||
},
|
|
||||||
row: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
customType: AutomationCustomIOType.ROW,
|
|
||||||
title: "Table",
|
|
||||||
},
|
|
||||||
rowId: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Row ID",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["row", "rowId"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
row: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
customType: AutomationCustomIOType.ROW,
|
|
||||||
description: "The updated row",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.OBJECT,
|
|
||||||
description: "The response from the table",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
type: AutomationIOType.BOOLEAN,
|
|
||||||
description: "Whether the action was successful",
|
|
||||||
},
|
|
||||||
id: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "The identifier of the updated row",
|
|
||||||
},
|
|
||||||
revision: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "The revision of the updated row",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["success", "id", "revision"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
appId,
|
appId,
|
||||||
|
|
|
@ -1,55 +1,6 @@
|
||||||
import fetch from "node-fetch"
|
import fetch from "node-fetch"
|
||||||
import { getFetchResponse } from "./utils"
|
import { getFetchResponse } from "./utils"
|
||||||
import {
|
import { ZapierStepInputs, ZapierStepOutputs } from "@budibase/types"
|
||||||
AutomationActionStepId,
|
|
||||||
AutomationStepDefinition,
|
|
||||||
AutomationStepType,
|
|
||||||
AutomationIOType,
|
|
||||||
AutomationFeature,
|
|
||||||
ZapierStepInputs,
|
|
||||||
ZapierStepOutputs,
|
|
||||||
} from "@budibase/types"
|
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
|
||||||
name: "Zapier Webhook",
|
|
||||||
stepId: AutomationActionStepId.zapier,
|
|
||||||
type: AutomationStepType.ACTION,
|
|
||||||
internal: false,
|
|
||||||
features: {
|
|
||||||
[AutomationFeature.LOOPING]: true,
|
|
||||||
},
|
|
||||||
description: "Trigger a Zapier Zap via webhooks",
|
|
||||||
tagline: "Trigger a Zapier Zap",
|
|
||||||
icon: "ri-flashlight-line",
|
|
||||||
inputs: {},
|
|
||||||
schema: {
|
|
||||||
inputs: {
|
|
||||||
properties: {
|
|
||||||
url: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
title: "Webhook URL",
|
|
||||||
},
|
|
||||||
body: {
|
|
||||||
type: AutomationIOType.JSON,
|
|
||||||
title: "Payload",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["url"],
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
properties: {
|
|
||||||
httpStatus: {
|
|
||||||
type: AutomationIOType.NUMBER,
|
|
||||||
description: "The HTTP status code of the request",
|
|
||||||
},
|
|
||||||
response: {
|
|
||||||
type: AutomationIOType.STRING,
|
|
||||||
description: "The response from Zapier",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import * as setup from "./utilities"
|
import * as setup from "./utilities"
|
||||||
import { FilterConditions } from "../steps/filter"
|
import { automations } from "@budibase/shared-core"
|
||||||
|
|
||||||
|
const FilterConditions = automations.steps.filter.FilterConditions
|
||||||
|
|
||||||
describe("test the filter logic", () => {
|
describe("test the filter logic", () => {
|
||||||
const config = setup.getConfig()
|
const config = setup.getConfig()
|
||||||
|
|
|
@ -6,9 +6,11 @@ import {
|
||||||
DatabaseName,
|
DatabaseName,
|
||||||
datasourceDescribe,
|
datasourceDescribe,
|
||||||
} from "../../../integrations/tests/utils"
|
} from "../../../integrations/tests/utils"
|
||||||
import { FilterConditions } from "../../../automations/steps/filter"
|
|
||||||
import { Knex } from "knex"
|
import { Knex } from "knex"
|
||||||
import { generator } from "@budibase/backend-core/tests"
|
import { generator } from "@budibase/backend-core/tests"
|
||||||
|
import { automations } from "@budibase/shared-core"
|
||||||
|
|
||||||
|
const FilterConditions = automations.steps.filter.FilterConditions
|
||||||
|
|
||||||
describe("Automation Scenarios", () => {
|
describe("Automation Scenarios", () => {
|
||||||
let config = setup.getConfig()
|
let config = setup.getConfig()
|
||||||
|
|
|
@ -42,7 +42,7 @@ import {
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import TestConfiguration from "../../../tests/utilities/TestConfiguration"
|
import TestConfiguration from "../../../tests/utilities/TestConfiguration"
|
||||||
import * as setup from "../utilities"
|
import * as setup from "../utilities"
|
||||||
import { definition } from "../../../automations/steps/branch"
|
import { automations } from "@budibase/shared-core"
|
||||||
|
|
||||||
type TriggerOutputs =
|
type TriggerOutputs =
|
||||||
| RowCreatedTriggerOutputs
|
| RowCreatedTriggerOutputs
|
||||||
|
@ -103,7 +103,7 @@ class BaseStepBuilder {
|
||||||
branchStepInputs.children![branchId] = stepBuilder.build()
|
branchStepInputs.children![branchId] = stepBuilder.build()
|
||||||
})
|
})
|
||||||
const branchStep: AutomationStep = {
|
const branchStep: AutomationStep = {
|
||||||
...definition,
|
...automations.steps.branch.definition,
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
stepId: AutomationActionStepId.BRANCH,
|
stepId: AutomationActionStepId.BRANCH,
|
||||||
inputs: branchStepInputs,
|
inputs: branchStepInputs,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export * as steps from "./steps/index"
|
|
@ -0,0 +1,47 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Bash Scripting",
|
||||||
|
tagline: "Execute a bash command",
|
||||||
|
icon: "JourneyEvent",
|
||||||
|
description: "Run a bash script",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
stepId: AutomationActionStepId.EXECUTE_BASH,
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
code: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
customType: AutomationCustomIOType.CODE,
|
||||||
|
title: "Code",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["code"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
stdout: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "Standard output of your bash command or script",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the command was successful",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["stdout"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Collect Data",
|
||||||
|
tagline: "Collect data to be sent to design",
|
||||||
|
icon: "Collection",
|
||||||
|
description:
|
||||||
|
"Collects specified data so it can be provided to the design section",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
features: {},
|
||||||
|
stepId: AutomationActionStepId.COLLECT,
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
collection: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "What to Collect",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["collection"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the action was successful",
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "Collected data",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success", "value"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Create Row",
|
||||||
|
tagline: "Create a {{inputs.enriched.table.name}} row",
|
||||||
|
icon: "TableRowAddBottom",
|
||||||
|
description: "Add a row to your database",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
stepId: AutomationActionStepId.CREATE_ROW,
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
row: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
properties: {
|
||||||
|
tableId: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
customType: AutomationCustomIOType.TABLE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
customType: AutomationCustomIOType.ROW,
|
||||||
|
title: "Table",
|
||||||
|
required: ["tableId"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["row"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
row: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
customType: AutomationCustomIOType.ROW,
|
||||||
|
description: "The new row",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description: "The response from the table",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the row creation was successful",
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "The identifier of the new row",
|
||||||
|
},
|
||||||
|
revision: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "The revision of the new row",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success", "id", "revision"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Delay",
|
||||||
|
icon: "Clock",
|
||||||
|
tagline: "Delay for {{inputs.time}} milliseconds",
|
||||||
|
description: "Delay the automation until an amount of time has passed",
|
||||||
|
stepId: AutomationActionStepId.DELAY,
|
||||||
|
internal: true,
|
||||||
|
features: {},
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
time: {
|
||||||
|
type: AutomationIOType.NUMBER,
|
||||||
|
title: "Delay in milliseconds",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["time"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the delay was successful",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
type: AutomationStepType.LOGIC,
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
description: "Delete a row from your database",
|
||||||
|
icon: "TableRowRemoveCenter",
|
||||||
|
name: "Delete Row",
|
||||||
|
tagline: "Delete a {{inputs.enriched.table.name}} row",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
stepId: AutomationActionStepId.DELETE_ROW,
|
||||||
|
internal: true,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
tableId: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
customType: AutomationCustomIOType.TABLE,
|
||||||
|
title: "Table",
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Row ID",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["tableId", "id"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
row: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
customType: AutomationCustomIOType.ROW,
|
||||||
|
description: "The deleted row",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description: "The response from the table",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the deletion was successful",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["row", "success"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Discord Message",
|
||||||
|
tagline: "Send a message to a Discord server",
|
||||||
|
description: "Send a message to a Discord server",
|
||||||
|
icon: "ri-discord-line",
|
||||||
|
stepId: AutomationActionStepId.discord,
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: false,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
url: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Discord Webhook URL",
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Bot Name",
|
||||||
|
},
|
||||||
|
avatar_url: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Bot Avatar URL",
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Message",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["url", "content"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
httpStatus: {
|
||||||
|
type: AutomationIOType.NUMBER,
|
||||||
|
description: "The HTTP status code of the request",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "The response from the Discord Webhook",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the message sent successfully",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "External Data Connector",
|
||||||
|
tagline: "Execute Data Connector",
|
||||||
|
icon: "Data",
|
||||||
|
description: "Execute a query in an external data connector",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
stepId: AutomationActionStepId.EXECUTE_QUERY,
|
||||||
|
internal: true,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
query: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
properties: {
|
||||||
|
queryId: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
customType: AutomationCustomIOType.QUERY,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
customType: AutomationCustomIOType.QUERY_PARAMS,
|
||||||
|
title: "Parameters",
|
||||||
|
required: ["queryId"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["query"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description: "The response from the datasource execution",
|
||||||
|
},
|
||||||
|
info: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description:
|
||||||
|
"Some query types may return extra data, like headers from a REST query",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the action was successful",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["response", "success"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "JS Scripting",
|
||||||
|
tagline: "Execute JavaScript Code",
|
||||||
|
icon: "Code",
|
||||||
|
description: "Run a piece of JavaScript code in your automation",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
stepId: AutomationActionStepId.EXECUTE_SCRIPT,
|
||||||
|
inputs: {},
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
code: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
customType: AutomationCustomIOType.CODE,
|
||||||
|
title: "Code",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["code"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
value: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "The result of the return statement",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the action was successful",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const FilterConditions = {
|
||||||
|
EQUAL: "EQUAL",
|
||||||
|
NOT_EQUAL: "NOT_EQUAL",
|
||||||
|
GREATER_THAN: "GREATER_THAN",
|
||||||
|
LESS_THAN: "LESS_THAN",
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PrettyFilterConditions = {
|
||||||
|
[FilterConditions.EQUAL]: "Equals",
|
||||||
|
[FilterConditions.NOT_EQUAL]: "Not equals",
|
||||||
|
[FilterConditions.GREATER_THAN]: "Greater than",
|
||||||
|
[FilterConditions.LESS_THAN]: "Less than",
|
||||||
|
}
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Condition",
|
||||||
|
tagline: "{{inputs.field}} {{inputs.condition}} {{inputs.value}}",
|
||||||
|
icon: "Branch2",
|
||||||
|
description:
|
||||||
|
"Conditionally halt automations which do not meet certain conditions",
|
||||||
|
type: AutomationStepType.LOGIC,
|
||||||
|
internal: true,
|
||||||
|
features: {},
|
||||||
|
stepId: AutomationActionStepId.FILTER,
|
||||||
|
inputs: {
|
||||||
|
condition: FilterConditions.EQUAL,
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
field: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Reference Value",
|
||||||
|
},
|
||||||
|
condition: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Condition",
|
||||||
|
enum: Object.values(FilterConditions),
|
||||||
|
pretty: Object.values(PrettyFilterConditions),
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Comparison Value",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["field", "condition", "value"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the action was successful",
|
||||||
|
},
|
||||||
|
result: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the logic block passed",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success", "result"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
export * as bash from "./bash"
|
||||||
|
export * as branch from "./branch"
|
||||||
|
export * as collect from "./collect"
|
||||||
|
export * as createRow from "./createRow"
|
||||||
|
export * as delay from "./delay"
|
||||||
|
export * as deleteRow from "./deleteRow"
|
||||||
|
export * as discord from "./discord"
|
||||||
|
export * as executeQuery from "./executeQuery"
|
||||||
|
export * as executeScript from "./executeScript"
|
||||||
|
export * as filter from "./filter"
|
||||||
|
export * as loop from "./loop"
|
||||||
|
export * as make from "./make"
|
||||||
|
export * as n8n from "./n8n"
|
||||||
|
export * as openai from "./openai"
|
||||||
|
export * as outgoingWebhook from "./outgoingWebhook"
|
||||||
|
export * as queryRows from "./queryRows"
|
||||||
|
export * as sendSmtpEmail from "./sendSmtpEmail"
|
||||||
|
export * as serverLog from "./serverLog"
|
||||||
|
export * as slack from "./slack"
|
||||||
|
export * as triggerAutomationRun from "./triggerAutomationRun"
|
||||||
|
export * as updateRow from "./updateRow"
|
||||||
|
export * as zapier from "./zapier"
|
|
@ -0,0 +1,55 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Make Integration",
|
||||||
|
stepTitle: "Make",
|
||||||
|
tagline: "Trigger a Make scenario",
|
||||||
|
description:
|
||||||
|
"Performs a webhook call to Make and gets the response (if configured)",
|
||||||
|
icon: "ri-shut-down-line",
|
||||||
|
stepId: AutomationActionStepId.integromat,
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: false,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
url: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Webhook URL",
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
type: AutomationIOType.JSON,
|
||||||
|
title: "Payload",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["url", "body"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether call was successful",
|
||||||
|
},
|
||||||
|
httpStatus: {
|
||||||
|
type: AutomationIOType.NUMBER,
|
||||||
|
description: "The HTTP status code returned",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description: "The webhook response - this can have properties",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success", "response"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
HttpMethod,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "n8n Integration",
|
||||||
|
stepTitle: "n8n",
|
||||||
|
tagline: "Trigger an n8n workflow",
|
||||||
|
description:
|
||||||
|
"Performs a webhook call to n8n and gets the response (if configured)",
|
||||||
|
icon: "ri-shut-down-line",
|
||||||
|
stepId: AutomationActionStepId.n8n,
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: false,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
url: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Webhook URL",
|
||||||
|
},
|
||||||
|
method: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Method",
|
||||||
|
enum: Object.values(HttpMethod),
|
||||||
|
},
|
||||||
|
authorization: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Authorization",
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
type: AutomationIOType.JSON,
|
||||||
|
title: "Payload",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["url", "method"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether call was successful",
|
||||||
|
},
|
||||||
|
httpStatus: {
|
||||||
|
type: AutomationIOType.NUMBER,
|
||||||
|
description: "The HTTP status code returned",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description: "The webhook response - this can have properties",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success", "response"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
enum Model {
|
||||||
|
GPT_4O_MINI = "gpt-4o-mini",
|
||||||
|
GPT_4O = "gpt-4o",
|
||||||
|
GPT_4 = "gpt-4",
|
||||||
|
GPT_35_TURBO = "gpt-3.5-turbo",
|
||||||
|
}
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "OpenAI",
|
||||||
|
tagline: "Send prompts to ChatGPT",
|
||||||
|
icon: "Algorithm",
|
||||||
|
description: "Interact with the OpenAI ChatGPT API.",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
features: {},
|
||||||
|
stepId: AutomationActionStepId.OPENAI,
|
||||||
|
inputs: {
|
||||||
|
prompt: "",
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
prompt: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Prompt",
|
||||||
|
},
|
||||||
|
model: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Model",
|
||||||
|
enum: Object.values(Model),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["prompt", "model"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the action was successful",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "What was output",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success", "response"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
enum RequestType {
|
||||||
|
POST = "POST",
|
||||||
|
GET = "GET",
|
||||||
|
PUT = "PUT",
|
||||||
|
DELETE = "DELETE",
|
||||||
|
PATCH = "PATCH",
|
||||||
|
}
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
deprecated: true,
|
||||||
|
name: "Outgoing webhook",
|
||||||
|
tagline: "Send a {{inputs.requestMethod}} request",
|
||||||
|
icon: "Send",
|
||||||
|
description: "Send a request of specified method to a URL",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
stepId: AutomationActionStepId.OUTGOING_WEBHOOK,
|
||||||
|
inputs: {
|
||||||
|
requestMethod: "POST",
|
||||||
|
url: "http://",
|
||||||
|
requestBody: "{}",
|
||||||
|
headers: "{}",
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
requestMethod: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
enum: Object.values(RequestType),
|
||||||
|
title: "Request method",
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "URL",
|
||||||
|
},
|
||||||
|
requestBody: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "JSON Body",
|
||||||
|
customType: AutomationCustomIOType.WIDE,
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Headers",
|
||||||
|
customType: AutomationCustomIOType.WIDE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["requestMethod", "url"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description: "The response from the webhook",
|
||||||
|
},
|
||||||
|
httpStatus: {
|
||||||
|
type: AutomationIOType.NUMBER,
|
||||||
|
description: "The HTTP status code returned",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the action was successful",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["response", "success"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
SortOrder,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
const SortOrderPretty = {
|
||||||
|
[SortOrder.ASCENDING]: "Ascending",
|
||||||
|
[SortOrder.DESCENDING]: "Descending",
|
||||||
|
}
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
description: "Query rows from the database",
|
||||||
|
icon: "Search",
|
||||||
|
name: "Query rows",
|
||||||
|
tagline: "Query rows from {{inputs.enriched.table.name}} table",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
stepId: AutomationActionStepId.QUERY_ROWS,
|
||||||
|
internal: true,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
tableId: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
customType: AutomationCustomIOType.TABLE,
|
||||||
|
title: "Table",
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
customType: AutomationCustomIOType.FILTERS,
|
||||||
|
title: "Filtering",
|
||||||
|
},
|
||||||
|
sortColumn: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Sort Column",
|
||||||
|
customType: AutomationCustomIOType.COLUMN,
|
||||||
|
},
|
||||||
|
sortOrder: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Sort Order",
|
||||||
|
enum: Object.values(SortOrder),
|
||||||
|
pretty: Object.values(SortOrderPretty),
|
||||||
|
},
|
||||||
|
limit: {
|
||||||
|
type: AutomationIOType.NUMBER,
|
||||||
|
title: "Limit",
|
||||||
|
customType: AutomationCustomIOType.QUERY_LIMIT,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["tableId"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
rows: {
|
||||||
|
type: AutomationIOType.ARRAY,
|
||||||
|
customType: AutomationCustomIOType.ROWS,
|
||||||
|
description: "The rows that were found",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the query was successful",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["rows", "success"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
description: "Send an email using SMTP",
|
||||||
|
tagline: "Send SMTP email to {{inputs.to}}",
|
||||||
|
icon: "Email",
|
||||||
|
name: "Send Email (SMTP)",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
stepId: AutomationActionStepId.SEND_EMAIL_SMTP,
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
to: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Send To",
|
||||||
|
},
|
||||||
|
from: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Send From",
|
||||||
|
},
|
||||||
|
cc: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "CC",
|
||||||
|
},
|
||||||
|
bcc: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "BCC",
|
||||||
|
},
|
||||||
|
subject: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Email Subject",
|
||||||
|
},
|
||||||
|
contents: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "HTML Contents",
|
||||||
|
},
|
||||||
|
addInvite: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
title: "Add calendar invite",
|
||||||
|
},
|
||||||
|
startTime: {
|
||||||
|
type: AutomationIOType.DATE,
|
||||||
|
title: "Start Time",
|
||||||
|
dependsOn: "addInvite",
|
||||||
|
},
|
||||||
|
endTime: {
|
||||||
|
type: AutomationIOType.DATE,
|
||||||
|
title: "End Time",
|
||||||
|
dependsOn: "addInvite",
|
||||||
|
},
|
||||||
|
summary: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Meeting Summary",
|
||||||
|
dependsOn: "addInvite",
|
||||||
|
},
|
||||||
|
location: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Location",
|
||||||
|
dependsOn: "addInvite",
|
||||||
|
},
|
||||||
|
attachments: {
|
||||||
|
type: AutomationIOType.ATTACHMENT,
|
||||||
|
customType: AutomationCustomIOType.MULTI_ATTACHMENTS,
|
||||||
|
title: "Attachments",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["to", "from", "subject", "contents"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the email was sent",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description: "A response from the email client, this may be an error",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Backend log",
|
||||||
|
tagline: "Console log a value in the backend",
|
||||||
|
icon: "Monitoring",
|
||||||
|
description: "Logs the given text to the server (using console.log)",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
stepId: AutomationActionStepId.SERVER_LOG,
|
||||||
|
inputs: {
|
||||||
|
text: "",
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
text: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Log",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["text"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the action was successful",
|
||||||
|
},
|
||||||
|
message: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "What was output",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success", "message"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Slack Message",
|
||||||
|
tagline: "Send a message to Slack",
|
||||||
|
description: "Send a message to Slack",
|
||||||
|
icon: "ri-slack-line",
|
||||||
|
stepId: AutomationActionStepId.slack,
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: false,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
url: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Incoming Webhook URL",
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Message",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["url", "text"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
httpStatus: {
|
||||||
|
type: AutomationIOType.NUMBER,
|
||||||
|
description: "The HTTP status code of the request",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the message sent successfully",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "The response from the Slack Webhook",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Trigger an automation",
|
||||||
|
tagline: "Triggers an automation synchronously",
|
||||||
|
icon: "Sync",
|
||||||
|
description: "Triggers an automation synchronously",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
features: {},
|
||||||
|
stepId: AutomationActionStepId.TRIGGER_AUTOMATION_RUN,
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
automation: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
properties: {
|
||||||
|
automationId: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
customType: AutomationCustomIOType.AUTOMATION,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
customType: AutomationCustomIOType.AUTOMATION_FIELDS,
|
||||||
|
title: "automatioFields",
|
||||||
|
required: ["automationId"],
|
||||||
|
},
|
||||||
|
timeout: {
|
||||||
|
type: AutomationIOType.NUMBER,
|
||||||
|
title: "Timeout (ms)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["automationId"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the automation was successful",
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description: "Automation Result",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success", "value"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationCustomIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Update Row",
|
||||||
|
tagline: "Update a {{inputs.enriched.table.name}} row",
|
||||||
|
icon: "Refresh",
|
||||||
|
description: "Update a row in your database",
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: true,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
stepId: AutomationActionStepId.UPDATE_ROW,
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
meta: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
title: "Field settings",
|
||||||
|
},
|
||||||
|
row: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
customType: AutomationCustomIOType.ROW,
|
||||||
|
title: "Table",
|
||||||
|
},
|
||||||
|
rowId: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Row ID",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["row", "rowId"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
row: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
customType: AutomationCustomIOType.ROW,
|
||||||
|
description: "The updated row",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.OBJECT,
|
||||||
|
description: "The response from the table",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: AutomationIOType.BOOLEAN,
|
||||||
|
description: "Whether the action was successful",
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "The identifier of the updated row",
|
||||||
|
},
|
||||||
|
revision: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "The revision of the updated row",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["success", "id", "revision"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
import {
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationStepDefinition,
|
||||||
|
AutomationStepType,
|
||||||
|
AutomationIOType,
|
||||||
|
AutomationFeature,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
export const definition: AutomationStepDefinition = {
|
||||||
|
name: "Zapier Webhook",
|
||||||
|
stepId: AutomationActionStepId.zapier,
|
||||||
|
type: AutomationStepType.ACTION,
|
||||||
|
internal: false,
|
||||||
|
features: {
|
||||||
|
[AutomationFeature.LOOPING]: true,
|
||||||
|
},
|
||||||
|
description: "Trigger a Zapier Zap via webhooks",
|
||||||
|
tagline: "Trigger a Zapier Zap",
|
||||||
|
icon: "ri-flashlight-line",
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
url: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
title: "Webhook URL",
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
type: AutomationIOType.JSON,
|
||||||
|
title: "Payload",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["url"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
httpStatus: {
|
||||||
|
type: AutomationIOType.NUMBER,
|
||||||
|
description: "The HTTP status code of the request",
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
type: AutomationIOType.STRING,
|
||||||
|
description: "The response from Zapier",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -5,3 +5,4 @@ export * as utils from "./utils"
|
||||||
export * as sdk from "./sdk"
|
export * as sdk from "./sdk"
|
||||||
export * from "./table"
|
export * from "./table"
|
||||||
export * from "./themes"
|
export * from "./themes"
|
||||||
|
export * as automations from "./automations"
|
||||||
|
|
Loading…
Reference in New Issue