diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index af83f73dc6..aecdff0246 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -155,6 +155,7 @@ const automationActions = store => ({ await store.actions.save(newAutomation) }, test: async (automation, testData) => { + console.log(testData) const result = await API.testAutomation({ automationId: automation?._id, testData, diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte index a0da8e455a..6c84875996 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte @@ -19,6 +19,7 @@ export let lastStep let syncAutomationsEnabled = $licensing.syncAutomationsEnabled + let triggerAutomationsEnabled = $licensing.triggerAutomationsEnabled let collectBlockAllowedSteps = [TriggerStepID.APP, TriggerStepID.WEBHOOK] let selectedAction let actionVal @@ -35,6 +36,10 @@ disabled: !lastStep || !syncAutomationsEnabled || collectBlockExists, message: collectDisabledMessage(), }, + TRIGGER: { + disabled: !triggerAutomationsEnabled, + message: collectDisabledMessage(), + }, } } @@ -98,6 +103,9 @@ notifications.error("Error saving automation") } } + + let lockedFeatures = [ActionStepID.COLLECT, ActionStepID.TRIGGER] + $: console.log {action.name} - {#if isDisabled && !syncAutomationsEnabled && action.stepId === ActionStepID.COLLECT} + {#if isDisabled && !syncAutomationsEnabled && !triggerAutomationsEnabled && lockedFeatures.includes(action.stepId)}
Business diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte index 76def72bf6..70162a9368 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte @@ -46,6 +46,8 @@ } const testAutomation = async () => { + console.log(testData) + console.log($selectedAutomation) try { await automationStore.actions.test($selectedAutomation, testData) $automationStore.showTestPanel = true diff --git a/packages/builder/src/constants/backend/automations.js b/packages/builder/src/constants/backend/automations.js index f89a126d3c..f26e2a7424 100644 --- a/packages/builder/src/constants/backend/automations.js +++ b/packages/builder/src/constants/backend/automations.js @@ -21,6 +21,7 @@ export const ActionStepID = { QUERY_ROWS: "QUERY_ROWS", LOOP: "LOOP", COLLECT: "COLLECT", + TRIGGER: "TRIGGER", // these used to be lowercase step IDs, maintain for backwards compat discord: "discord", slack: "slack", diff --git a/packages/builder/src/stores/portal/licensing.js b/packages/builder/src/stores/portal/licensing.js index 3197822e53..daf4b0ce86 100644 --- a/packages/builder/src/stores/portal/licensing.js +++ b/packages/builder/src/stores/portal/licensing.js @@ -125,6 +125,10 @@ export const createLicensingStore = () => { const syncAutomationsEnabled = license.features.includes( Constants.Features.SYNC_AUTOMATIONS ) + const triggerAutomationsEnabled = license.features.includes( + Constants.Features.SYNC_AUTOMATIONS + ) + const perAppBuildersEnabled = license.features.includes( Constants.Features.APP_BUILDERS ) @@ -147,6 +151,7 @@ export const createLicensingStore = () => { auditLogsEnabled, enforceableSSO, syncAutomationsEnabled, + triggerAutomationsEnabled, isViewPermissionsEnabled, perAppBuildersEnabled, } diff --git a/packages/pro b/packages/pro index 992486c100..82de3443fd 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 992486c10044a7495496b97bdf5f454d4020bfba +Subproject commit 82de3443fd03b272555d23c42ead3a611302277d diff --git a/packages/server/src/automations/actions.ts b/packages/server/src/automations/actions.ts index 7025a2f64c..2fb08f754f 100644 --- a/packages/server/src/automations/actions.ts +++ b/packages/server/src/automations/actions.ts @@ -42,7 +42,7 @@ const ACTION_IMPLS: Record< FILTER: filter.run, QUERY_ROWS: queryRow.run, COLLECT: collect.run, - TRIGGER_AUTOMATION: trigger.run, + TRIGGER: trigger.run, // these used to be lowercase step IDs, maintain for backwards compat discord: discord.run, slack: slack.run, diff --git a/packages/server/src/automations/steps/trigger.ts b/packages/server/src/automations/steps/trigger.ts index 7624bef817..f85c24e963 100644 --- a/packages/server/src/automations/steps/trigger.ts +++ b/packages/server/src/automations/steps/trigger.ts @@ -26,7 +26,11 @@ export const definition: AutomationStepSchema = { properties: { automationId: { type: AutomationIOType.STRING, - title: "Automation ID to trigger", + title: "Automation ID", + }, + timeout: { + type: AutomationIOType.NUMBER, + title: "Timeout (ms)", }, }, required: ["automationId"], @@ -48,8 +52,6 @@ export const definition: AutomationStepSchema = { } export async function run({ inputs }: AutomationStepInput) { - console.log("??: " + inputs.automationId) - console.log("???DSAASDFAFSDFDSFDS") if (!inputs.automationId) { return { success: false, @@ -62,7 +64,7 @@ export async function run({ inputs }: AutomationStepInput) { automation, { fields: {}, - timeout: 120000, + timeout: inputs.timeout * 1000 || 120000, }, { getResponses: true } ) diff --git a/packages/types/src/sdk/licensing/feature.ts b/packages/types/src/sdk/licensing/feature.ts index 732a4a6c77..65d852e627 100644 --- a/packages/types/src/sdk/licensing/feature.ts +++ b/packages/types/src/sdk/licensing/feature.ts @@ -9,6 +9,7 @@ export enum Feature { BRANDING = "branding", SCIM = "scim", SYNC_AUTOMATIONS = "syncAutomations", + TRIGGER_AUTOMATION = "triggerAutomation", APP_BUILDERS = "appBuilders", OFFLINE = "offline", EXPANDED_PUBLIC_API = "expandedPublicApi",