From af83f1b2e15a0268efb7bcac7abcd784575c9208 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 7 Jan 2025 17:18:36 +0000 Subject: [PATCH 1/2] Delete old feature flags. --- packages/builder/src/stores/portal/menu.js | 10 +++------- packages/pro | 2 +- .../src/api/controllers/row/staticFormula.ts | 17 ++++------------- packages/server/src/automations/actions.ts | 12 ++---------- packages/server/src/automations/steps/openai.ts | 11 +++-------- packages/types/src/sdk/featureFlag.ts | 8 -------- 6 files changed, 13 insertions(+), 47 deletions(-) diff --git a/packages/builder/src/stores/portal/menu.js b/packages/builder/src/stores/portal/menu.js index 75a9b363be..4f87a5bfde 100644 --- a/packages/builder/src/stores/portal/menu.js +++ b/packages/builder/src/stores/portal/menu.js @@ -1,9 +1,7 @@ import { derived } from "svelte/store" import { admin } from "./admin" import { auth } from "./auth" -import { isEnabled } from "@/helpers/featureFlags" import { sdk } from "@budibase/shared-core" -import { FeatureFlag } from "@budibase/types" export const menu = derived([admin, auth], ([$admin, $auth]) => { const user = $auth?.user @@ -63,13 +61,11 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => { title: "Environment", href: "/builder/portal/settings/environment", }, - ] - if (isEnabled(FeatureFlag.AI_CUSTOM_CONFIGS)) { - settingsSubPages.push({ + { title: "AI", href: "/builder/portal/settings/ai", - }) - } + }, + ] if (!cloud) { settingsSubPages.push({ diff --git a/packages/pro b/packages/pro index 32d84f109d..23fdd50b7e 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 32d84f109d4edc526145472a7446327312151442 +Subproject commit 23fdd50b7ef28cf320716ed2c46e15d63185daa7 diff --git a/packages/server/src/api/controllers/row/staticFormula.ts b/packages/server/src/api/controllers/row/staticFormula.ts index b81a164807..678e824b94 100644 --- a/packages/server/src/api/controllers/row/staticFormula.ts +++ b/packages/server/src/api/controllers/row/staticFormula.ts @@ -4,15 +4,8 @@ import { processAIColumns, processFormulas, } from "../../../utilities/rowProcessor" -import { context, features } from "@budibase/backend-core" -import { - Table, - Row, - FeatureFlag, - FormulaType, - FieldType, - ViewV2, -} from "@budibase/types" +import { context } from "@budibase/backend-core" +import { Table, Row, FormulaType, FieldType, ViewV2 } from "@budibase/types" import * as linkRows from "../../../db/linkedRows" import isEqual from "lodash/isEqual" import { cloneDeep, merge } from "lodash/fp" @@ -163,10 +156,8 @@ export async function finaliseRow( contextRows: [enrichedRow], }) const aiEnabled = - ((await features.isEnabled(FeatureFlag.BUDIBASE_AI)) && - (await pro.features.isBudibaseAIEnabled())) || - ((await features.isEnabled(FeatureFlag.AI_CUSTOM_CONFIGS)) && - (await pro.features.isAICustomConfigsEnabled())) + (await pro.features.isBudibaseAIEnabled()) || + (await pro.features.isAICustomConfigsEnabled()) if (aiEnabled) { row = await processAIColumns(table, row, { contextRows: [enrichedRow], diff --git a/packages/server/src/automations/actions.ts b/packages/server/src/automations/actions.ts index 1c201d1f64..537b6befc3 100644 --- a/packages/server/src/automations/actions.ts +++ b/packages/server/src/automations/actions.ts @@ -27,11 +27,9 @@ import { Hosting, ActionImplementation, AutomationStepDefinition, - FeatureFlag, } from "@budibase/types" import sdk from "../sdk" import { getAutomationPlugin } from "../utilities/fileSystem" -import { features } from "@budibase/backend-core" type ActionImplType = ActionImplementations< typeof env.SELF_HOSTED extends "true" ? Hosting.SELF : Hosting.CLOUD @@ -78,6 +76,7 @@ export const BUILTIN_ACTION_DEFINITIONS: Record< LOOP: loop.definition, COLLECT: collect.definition, TRIGGER_AUTOMATION_RUN: triggerAutomationRun.definition, + BRANCH: branch.definition, // these used to be lowercase step IDs, maintain for backwards compat discord: discord.definition, slack: slack.definition, @@ -105,14 +104,7 @@ if (env.SELF_HOSTED) { export async function getActionDefinitions(): Promise< Record > { - if (await features.isEnabled(FeatureFlag.AUTOMATION_BRANCHING)) { - BUILTIN_ACTION_DEFINITIONS["BRANCH"] = branch.definition - } - if ( - env.SELF_HOSTED || - (await features.isEnabled(FeatureFlag.BUDIBASE_AI)) || - (await features.isEnabled(FeatureFlag.AI_CUSTOM_CONFIGS)) - ) { + if (env.SELF_HOSTED) { BUILTIN_ACTION_DEFINITIONS["OPENAI"] = openai.definition } diff --git a/packages/server/src/automations/steps/openai.ts b/packages/server/src/automations/steps/openai.ts index 19595cc0d0..53e41ceb09 100644 --- a/packages/server/src/automations/steps/openai.ts +++ b/packages/server/src/automations/steps/openai.ts @@ -7,9 +7,8 @@ import { AutomationIOType, OpenAIStepInputs, OpenAIStepOutputs, - FeatureFlag, } from "@budibase/types" -import { env, features } from "@budibase/backend-core" +import { env } from "@budibase/backend-core" import * as automationUtils from "../automationUtils" import * as pro from "@budibase/pro" @@ -99,12 +98,8 @@ export async function run({ try { let response - const customConfigsEnabled = - (await features.isEnabled(FeatureFlag.AI_CUSTOM_CONFIGS)) && - (await pro.features.isAICustomConfigsEnabled()) - const budibaseAIEnabled = - (await features.isEnabled(FeatureFlag.BUDIBASE_AI)) && - (await pro.features.isBudibaseAIEnabled()) + const customConfigsEnabled = await pro.features.isAICustomConfigsEnabled() + const budibaseAIEnabled = await pro.features.isBudibaseAIEnabled() let llmWrapper if (budibaseAIEnabled || customConfigsEnabled) { diff --git a/packages/types/src/sdk/featureFlag.ts b/packages/types/src/sdk/featureFlag.ts index 725ae0feb1..7b61b70772 100644 --- a/packages/types/src/sdk/featureFlag.ts +++ b/packages/types/src/sdk/featureFlag.ts @@ -1,16 +1,8 @@ export enum FeatureFlag { - AUTOMATION_BRANCHING = "AUTOMATION_BRANCHING", - AI_CUSTOM_CONFIGS = "AI_CUSTOM_CONFIGS", - DEFAULT_VALUES = "DEFAULT_VALUES", - BUDIBASE_AI = "BUDIBASE_AI", USE_ZOD_VALIDATOR = "USE_ZOD_VALIDATOR", } export const FeatureFlagDefaults = { - [FeatureFlag.DEFAULT_VALUES]: true, - [FeatureFlag.AUTOMATION_BRANCHING]: true, - [FeatureFlag.AI_CUSTOM_CONFIGS]: true, - [FeatureFlag.BUDIBASE_AI]: true, [FeatureFlag.USE_ZOD_VALIDATOR]: false, } From ace5099a8cf25f6eb73878d295568cb4130ea344 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Thu, 9 Jan 2025 12:05:45 +0000 Subject: [PATCH 2/2] Update pro reference. --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 23fdd50b7e..193476cdfa 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 23fdd50b7ef28cf320716ed2c46e15d63185daa7 +Subproject commit 193476cdfade6d3c613e6972f16ee0c527e01ff6