From d271bbdadb1d80d1a41c4162c92c56d8ca5314a2 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 19 May 2023 10:07:02 +0100 Subject: [PATCH] rename syncWebHooks to syncAutomations --- .../tests/core/utilities/mocks/licenses.ts | 4 ++-- .../AutomationBuilder/FlowChart/ActionModal.svelte | 6 +++--- packages/builder/src/stores/portal/licensing.js | 6 +++--- packages/frontend-core/src/constants.js | 2 +- packages/server/src/api/controllers/webhook.ts | 2 +- packages/server/src/threads/automation.ts | 14 +++++--------- packages/types/src/sdk/licensing/feature.ts | 2 +- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/packages/backend-core/tests/core/utilities/mocks/licenses.ts b/packages/backend-core/tests/core/utilities/mocks/licenses.ts index 6e74294417..4272e78eb8 100644 --- a/packages/backend-core/tests/core/utilities/mocks/licenses.ts +++ b/packages/backend-core/tests/core/utilities/mocks/licenses.ts @@ -90,8 +90,8 @@ export const useScimIntegration = () => { return useFeature(Feature.SCIM) } -export const useSyncWebhook = () => { - return useFeature(Feature.SYNC_WEBHOOKS) +export const useSyncAutomations = () => { + return useFeature(Feature.SYNC_AUTOMATIONS) } // QUOTAS diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte index 25db2ce5e4..c8de0b5692 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte @@ -18,7 +18,7 @@ export let blockIdx export let lastStep - let syncWebhooksEnabled = $licensing.syncWebhooksEnabled + let syncAutomationsEnabled = $licensing.syncAutomationsEnabled let collectBlockAllowedSteps = [TriggerStepID.APP, TriggerStepID.WEBHOOK] let selectedAction let actionVal @@ -33,7 +33,7 @@ message: "Please configure SMTP", }, COLLECT: { - disabled: !lastStep || !syncWebhooksEnabled || collectBlockExists, + disabled: !lastStep || !syncAutomationsEnabled || collectBlockExists, message: collectDisabledMessage(), }, } @@ -149,7 +149,7 @@
{action.name} - {#if isDisabled && !syncWebhooksEnabled} + {#if isDisabled && !syncAutomationsEnabled}
Business diff --git a/packages/builder/src/stores/portal/licensing.js b/packages/builder/src/stores/portal/licensing.js index 4e2de2a001..ded77894f9 100644 --- a/packages/builder/src/stores/portal/licensing.js +++ b/packages/builder/src/stores/portal/licensing.js @@ -116,8 +116,8 @@ export const createLicensingStore = () => { const auditLogsEnabled = license.features.includes( Constants.Features.AUDIT_LOGS ) - const syncWebhooksEnabled = license.features.includes( - Constants.Features.SYNC_WEBHOOKS + const syncAutomationsEnabled = license.features.includes( + Constants.Features.SYNC_AUTOMATIONS ) store.update(state => { return { @@ -133,7 +133,7 @@ export const createLicensingStore = () => { environmentVariablesEnabled, auditLogsEnabled, enforceableSSO, - syncWebhooksEnabled, + syncAutomationsEnabled, } }) }, diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index f1f4cf1d7f..f897feee86 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -70,7 +70,7 @@ export const Features = { ENFORCEABLE_SSO: "enforceableSSO", BRANDING: "branding", SCIM: "scim", - SYNC_WEBHOOKS: "syncWebhooks", + SYNC_AUTOMATIONS: "syncAutoamtions", } // Role IDs diff --git a/packages/server/src/api/controllers/webhook.ts b/packages/server/src/api/controllers/webhook.ts index 01bb43046b..ee92c70628 100644 --- a/packages/server/src/api/controllers/webhook.ts +++ b/packages/server/src/api/controllers/webhook.ts @@ -83,7 +83,7 @@ export async function trigger(ctx: BBContext) { // incase the user has produced a schema to bind to let hasCollectStep = sdk.automations.utils.checkForCollectStep(target) - if (hasCollectStep && (await pro.features.isSyncWebhookEnabled())) { + if (hasCollectStep && (await pro.features.isSyncAutomationsEnabled())) { const response = await triggers.externalTrigger( target, { diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index d9e0bc9c5d..e2c9de20a5 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -512,15 +512,11 @@ export function executeSynchronously(job: Job) { // put into automation thread for whole context return context.doInEnvironmentContext(envVars, async () => { const automationOrchestrator = new Orchestrator(job) - try { - const response = await Promise.race([ - automationOrchestrator.execute(), - timeoutPromise, - ]) - return response - } catch (err) { - throw err - } + const response = await Promise.race([ + automationOrchestrator.execute(), + timeoutPromise, + ]) + return response }) }) } diff --git a/packages/types/src/sdk/licensing/feature.ts b/packages/types/src/sdk/licensing/feature.ts index d5b5fe6e24..1cbdd55bcf 100644 --- a/packages/types/src/sdk/licensing/feature.ts +++ b/packages/types/src/sdk/licensing/feature.ts @@ -8,7 +8,7 @@ export enum Feature { ENFORCEABLE_SSO = "enforceableSSO", BRANDING = "branding", SCIM = "scim", - SYNC_WEBHOOKS = "syncWebhooks", + SYNC_AUTOMATIONS = "syncAutomations", } export type PlanFeatures = { [key in PlanType]: Feature[] | undefined }