add features property to automation defintions

This commit is contained in:
Peter Clement 2023-05-22 15:46:42 +01:00
parent d7ae338bc5
commit 754b30dd5c
20 changed files with 39 additions and 21 deletions

View File

@ -187,7 +187,7 @@
{#if !isTrigger} {#if !isTrigger}
<div> <div>
<div class="block-options"> <div class="block-options">
{#if block?.canLoop} {#if block?.features.includes("LOOPING")}
<ActionButton on:click={() => addLooping()} icon="Reuse"> <ActionButton on:click={() => addLooping()} icon="Reuse">
Add Looping Add Looping
</ActionButton> </ActionButton>

View File

@ -5,6 +5,7 @@ import environment from "../../environment"
import { import {
AutomationActionStepId, AutomationActionStepId,
AutomationCustomIOType, AutomationCustomIOType,
AutomationFeature,
AutomationIOType, AutomationIOType,
AutomationStepInput, AutomationStepInput,
AutomationStepSchema, AutomationStepSchema,
@ -18,7 +19,7 @@ export const definition: AutomationStepSchema = {
description: "Run a bash script", description: "Run a bash script",
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: true, internal: true,
canLoop: true, features: [AutomationFeature.LOOPING],
stepId: AutomationActionStepId.EXECUTE_BASH, stepId: AutomationActionStepId.EXECUTE_BASH,
inputs: {}, inputs: {},
schema: { schema: {

View File

@ -4,6 +4,7 @@ import {
AutomationStepInput, AutomationStepInput,
AutomationStepType, AutomationStepType,
AutomationIOType, AutomationIOType,
AutomationFeature,
} from "@budibase/types" } from "@budibase/types"
export const definition: AutomationStepSchema = { export const definition: AutomationStepSchema = {
@ -14,7 +15,7 @@ export const definition: AutomationStepSchema = {
"Collects specified data so it can be provided to the design section", "Collects specified data so it can be provided to the design section",
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: true, internal: true,
canLoop: false, features: [],
stepId: AutomationActionStepId.COLLECT, stepId: AutomationActionStepId.COLLECT,
inputs: { inputs: {
text: "", text: "",

View File

@ -4,6 +4,7 @@ import { buildCtx } from "./utils"
import { import {
AutomationActionStepId, AutomationActionStepId,
AutomationCustomIOType, AutomationCustomIOType,
AutomationFeature,
AutomationIOType, AutomationIOType,
AutomationStepInput, AutomationStepInput,
AutomationStepSchema, AutomationStepSchema,
@ -17,7 +18,7 @@ export const definition: AutomationStepSchema = {
description: "Add a row to your database", description: "Add a row to your database",
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: true, internal: true,
canLoop: true, features: [AutomationFeature.LOOPING],
stepId: AutomationActionStepId.CREATE_ROW, stepId: AutomationActionStepId.CREATE_ROW,
inputs: {}, inputs: {},
schema: { schema: {

View File

@ -14,7 +14,7 @@ export const definition: AutomationStepSchema = {
description: "Delay the automation until an amount of time has passed", description: "Delay the automation until an amount of time has passed",
stepId: AutomationActionStepId.DELAY, stepId: AutomationActionStepId.DELAY,
internal: true, internal: true,
canLoop: false, features: [],
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {

View File

@ -8,6 +8,7 @@ import {
AutomationStepType, AutomationStepType,
AutomationIOType, AutomationIOType,
AutomationCustomIOType, AutomationCustomIOType,
AutomationFeature,
} from "@budibase/types" } from "@budibase/types"
export const definition: AutomationStepSchema = { export const definition: AutomationStepSchema = {
@ -18,7 +19,7 @@ export const definition: AutomationStepSchema = {
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
stepId: AutomationActionStepId.DELETE_ROW, stepId: AutomationActionStepId.DELETE_ROW,
internal: true, internal: true,
canLoop: true, features: [AutomationFeature.LOOPING],
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {

View File

@ -6,6 +6,7 @@ import {
AutomationStepInput, AutomationStepInput,
AutomationStepType, AutomationStepType,
AutomationIOType, AutomationIOType,
AutomationFeature,
} from "@budibase/types" } from "@budibase/types"
const DEFAULT_USERNAME = "Budibase Automate" const DEFAULT_USERNAME = "Budibase Automate"
@ -19,7 +20,7 @@ export const definition: AutomationStepSchema = {
stepId: AutomationActionStepId.discord, stepId: AutomationActionStepId.discord,
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: false, internal: false,
canLoop: true, features: [AutomationFeature.LOOPING],
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {

View File

@ -4,6 +4,7 @@ import * as automationUtils from "../automationUtils"
import { import {
AutomationActionStepId, AutomationActionStepId,
AutomationCustomIOType, AutomationCustomIOType,
AutomationFeature,
AutomationIOType, AutomationIOType,
AutomationStepInput, AutomationStepInput,
AutomationStepSchema, AutomationStepSchema,
@ -18,7 +19,7 @@ export const definition: AutomationStepSchema = {
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
stepId: AutomationActionStepId.EXECUTE_QUERY, stepId: AutomationActionStepId.EXECUTE_QUERY,
internal: true, internal: true,
canLoop: true, features: [AutomationFeature.LOOPING],
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {

View File

@ -4,6 +4,7 @@ import * as automationUtils from "../automationUtils"
import { import {
AutomationActionStepId, AutomationActionStepId,
AutomationCustomIOType, AutomationCustomIOType,
AutomationFeature,
AutomationIOType, AutomationIOType,
AutomationStepInput, AutomationStepInput,
AutomationStepSchema, AutomationStepSchema,
@ -19,7 +20,7 @@ export const definition: AutomationStepSchema = {
internal: true, internal: true,
stepId: AutomationActionStepId.EXECUTE_SCRIPT, stepId: AutomationActionStepId.EXECUTE_SCRIPT,
inputs: {}, inputs: {},
canLoop: true, features: [AutomationFeature.LOOPING],
schema: { schema: {
inputs: { inputs: {
properties: { properties: {

View File

@ -28,7 +28,7 @@ export const definition: AutomationStepSchema = {
"Conditionally halt automations which do not meet certain conditions", "Conditionally halt automations which do not meet certain conditions",
type: AutomationStepType.LOGIC, type: AutomationStepType.LOGIC,
internal: true, internal: true,
canLoop: false, features: [],
stepId: AutomationActionStepId.FILTER, stepId: AutomationActionStepId.FILTER,
inputs: { inputs: {
condition: FilterConditions.EQUAL, condition: FilterConditions.EQUAL,

View File

@ -13,8 +13,7 @@ export const definition: AutomationStepSchema = {
description: "Loop", description: "Loop",
stepId: AutomationActionStepId.LOOP, stepId: AutomationActionStepId.LOOP,
internal: true, internal: true,
canLoop: false, features: [],
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {

View File

@ -6,6 +6,7 @@ import {
AutomationStepInput, AutomationStepInput,
AutomationStepType, AutomationStepType,
AutomationIOType, AutomationIOType,
AutomationFeature,
} from "@budibase/types" } from "@budibase/types"
export const definition: AutomationStepSchema = { export const definition: AutomationStepSchema = {
@ -18,7 +19,7 @@ export const definition: AutomationStepSchema = {
stepId: AutomationActionStepId.integromat, stepId: AutomationActionStepId.integromat,
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: false, internal: false,
canLoop: true, features: [AutomationFeature.LOOPING],
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {

View File

@ -4,6 +4,7 @@ import * as automationUtils from "../automationUtils"
import { import {
AutomationActionStepId, AutomationActionStepId,
AutomationCustomIOType, AutomationCustomIOType,
AutomationFeature,
AutomationIOType, AutomationIOType,
AutomationStepInput, AutomationStepInput,
AutomationStepSchema, AutomationStepSchema,
@ -32,7 +33,7 @@ export const definition: AutomationStepSchema = {
description: "Send a request of specified method to a URL", description: "Send a request of specified method to a URL",
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: true, internal: true,
canLoop: true, features: [AutomationFeature.LOOPING],
stepId: AutomationActionStepId.OUTGOING_WEBHOOK, stepId: AutomationActionStepId.OUTGOING_WEBHOOK,
inputs: { inputs: {
requestMethod: "POST", requestMethod: "POST",

View File

@ -6,6 +6,7 @@ import * as automationUtils from "../automationUtils"
import { import {
AutomationActionStepId, AutomationActionStepId,
AutomationCustomIOType, AutomationCustomIOType,
AutomationFeature,
AutomationIOType, AutomationIOType,
AutomationStepInput, AutomationStepInput,
AutomationStepSchema, AutomationStepSchema,
@ -42,7 +43,7 @@ export const definition: AutomationStepSchema = {
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
stepId: AutomationActionStepId.QUERY_ROWS, stepId: AutomationActionStepId.QUERY_ROWS,
internal: true, internal: true,
canLoop: true, features: [AutomationFeature.LOOPING],
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {

View File

@ -6,6 +6,7 @@ import {
AutomationStepInput, AutomationStepInput,
AutomationStepType, AutomationStepType,
AutomationIOType, AutomationIOType,
AutomationFeature,
} from "@budibase/types" } from "@budibase/types"
export const definition: AutomationStepSchema = { export const definition: AutomationStepSchema = {
@ -15,7 +16,7 @@ export const definition: AutomationStepSchema = {
name: "Send Email (SMTP)", name: "Send Email (SMTP)",
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: true, internal: true,
canLoop: true, features: [AutomationFeature.LOOPING],
stepId: AutomationActionStepId.SEND_EMAIL_SMTP, stepId: AutomationActionStepId.SEND_EMAIL_SMTP,
inputs: {}, inputs: {},
schema: { schema: {

View File

@ -4,6 +4,7 @@ import {
AutomationStepInput, AutomationStepInput,
AutomationStepType, AutomationStepType,
AutomationIOType, AutomationIOType,
AutomationFeature,
} from "@budibase/types" } from "@budibase/types"
/** /**
@ -19,7 +20,7 @@ export const definition: AutomationStepSchema = {
description: "Logs the given text to the server (using console.log)", description: "Logs the given text to the server (using console.log)",
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: true, internal: true,
canLoop: true, features: [AutomationFeature.LOOPING],
stepId: AutomationActionStepId.SERVER_LOG, stepId: AutomationActionStepId.SERVER_LOG,
inputs: { inputs: {
text: "", text: "",

View File

@ -6,6 +6,7 @@ import {
AutomationStepInput, AutomationStepInput,
AutomationStepType, AutomationStepType,
AutomationIOType, AutomationIOType,
AutomationFeature,
} from "@budibase/types" } from "@budibase/types"
export const definition: AutomationStepSchema = { export const definition: AutomationStepSchema = {
@ -16,7 +17,7 @@ export const definition: AutomationStepSchema = {
stepId: AutomationActionStepId.slack, stepId: AutomationActionStepId.slack,
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: false, internal: false,
canLoop: true, features: [AutomationFeature.LOOPING],
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {

View File

@ -4,6 +4,7 @@ import { buildCtx } from "./utils"
import { import {
AutomationActionStepId, AutomationActionStepId,
AutomationCustomIOType, AutomationCustomIOType,
AutomationFeature,
AutomationIOType, AutomationIOType,
AutomationStepInput, AutomationStepInput,
AutomationStepSchema, AutomationStepSchema,
@ -17,7 +18,7 @@ export const definition: AutomationStepSchema = {
description: "Update a row in your database", description: "Update a row in your database",
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: true, internal: true,
canLoop: true, features: [AutomationFeature.LOOPING],
stepId: AutomationActionStepId.UPDATE_ROW, stepId: AutomationActionStepId.UPDATE_ROW,
inputs: {}, inputs: {},
schema: { schema: {

View File

@ -6,6 +6,7 @@ import {
AutomationStepInput, AutomationStepInput,
AutomationStepType, AutomationStepType,
AutomationIOType, AutomationIOType,
AutomationFeature,
} from "@budibase/types" } from "@budibase/types"
export const definition: AutomationStepSchema = { export const definition: AutomationStepSchema = {
@ -13,7 +14,7 @@ export const definition: AutomationStepSchema = {
stepId: AutomationActionStepId.zapier, stepId: AutomationActionStepId.zapier,
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: false, internal: false,
canLoop: true, features: [AutomationFeature.LOOPING],
description: "Trigger a Zapier Zap via webhooks", description: "Trigger a Zapier Zap via webhooks",
tagline: "Trigger a Zapier Zap", tagline: "Trigger a Zapier Zap",
icon: "ri-flashlight-line", icon: "ri-flashlight-line",

View File

@ -123,7 +123,11 @@ export interface AutomationStepSchema {
outputs: InputOutputBlock outputs: InputOutputBlock
} }
custom?: boolean custom?: boolean
canLoop?: boolean features?: AutomationFeature[]
}
export enum AutomationFeature {
LOOPING = "LOOPING",
} }
export interface AutomationStep extends AutomationStepSchema { export interface AutomationStep extends AutomationStepSchema {