The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Ship junction relations and remove IS_JUNCTION_RELATIONS_ENABLED (#27053)
Félix Malfait0a1b17b25f29
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphqlindex 4cb7c2cd422..54dd8c87327 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql@@ -2073,7 +2073,6 @@ enum FeatureFlagKey {IS_CONFIGURABLE_SEARCH_FIELDS_ENABLEDIS_JSON_FILTER_ENABLEDIS_MESSAGE_CAMPAIGN_ENABLED- IS_JUNCTION_RELATIONS_ENABLEDIS_REST_METADATA_API_NEW_FORMAT_DIRECTIS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLEDIS_WORKFLOW_CORE_INDEX_PAGE_ENABLEDdiff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.tsindex 02dfcd38776..7dfaae6b171 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts@@ -1683,7 +1683,7 @@ export interface FeatureFlag {__typename: 'FeatureFlag'}-export type FeatureFlagKey = 'IS_ASYNC_CSV_EXPORT_ENABLED' | 'IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED' | 'IS_JSON_FILTER_ENABLED' | 'IS_MESSAGE_CAMPAIGN_ENABLED' | 'IS_JUNCTION_RELATIONS_ENABLED' | 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT' | 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED' | 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED' | 'IS_AI_CHAT_SHARING_DROPDOWN_ENABLED' | 'IS_INITIAL_OBJECT_VIEW_ENABLED' | 'IS_WEBHOOK_RATE_LIMIT_ENABLED' | 'IS_DEFERRED_WORKSPACE_MIGRATION_ACTIONS_ENABLED' | 'IS_EXECUTION_QUOTA_ENABLED' | 'IS_RECORD_CREATION_FORM_ENABLED' | 'IS_LOGS_SETTINGS_SECTION_ENABLED' | 'IS_CONVERSATIONS_TAB_ENABLED' | 'IS_VALIDATION_RULES_ENABLED'+export type FeatureFlagKey = 'IS_ASYNC_CSV_EXPORT_ENABLED' | 'IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED' | 'IS_JSON_FILTER_ENABLED' | 'IS_MESSAGE_CAMPAIGN_ENABLED' | 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT' | 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED' | 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED' | 'IS_AI_CHAT_SHARING_DROPDOWN_ENABLED' | 'IS_INITIAL_OBJECT_VIEW_ENABLED' | 'IS_WEBHOOK_RATE_LIMIT_ENABLED' | 'IS_DEFERRED_WORKSPACE_MIGRATION_ACTIONS_ENABLED' | 'IS_EXECUTION_QUOTA_ENABLED' | 'IS_RECORD_CREATION_FORM_ENABLED' | 'IS_LOGS_SETTINGS_SECTION_ENABLED' | 'IS_CONVERSATIONS_TAB_ENABLED' | 'IS_VALIDATION_RULES_ENABLED'export interface WorkspaceUrls {customUrl?: Scalars['String']@@ -11275,7 +11275,6 @@ export const enumFeatureFlagKey = {IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED: 'IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED' as const,IS_JSON_FILTER_ENABLED: 'IS_JSON_FILTER_ENABLED' as const,IS_MESSAGE_CAMPAIGN_ENABLED: 'IS_MESSAGE_CAMPAIGN_ENABLED' as const,- IS_JUNCTION_RELATIONS_ENABLED: 'IS_JUNCTION_RELATIONS_ENABLED' as const,IS_REST_METADATA_API_NEW_FORMAT_DIRECT: 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT' as const,IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED: 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED' as const,IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED: 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED' as const,diff --git a/packages/twenty-docs/user-guide/data-model/capabilities/relation-fields.mdx b/packages/twenty-docs/user-guide/data-model/capabilities/relation-fields.mdxindex 9a387afe060..fb4f22b8c3e 100644--- a/packages/twenty-docs/user-guide/data-model/capabilities/relation-fields.mdx+++ b/packages/twenty-docs/user-guide/data-model/capabilities/relation-fields.mdx@@ -39,9 +39,9 @@ Many records in Object A can be linked to many records in Object B.Many-to-many relations use a **junction object** pattern: an intermediate object that connects both sides. With the junction relation feature, Twenty displays the final linked records directly, hiding the intermediate object from the UI.-<Warning>-**Beta Feature**: Junction relations must be enabled at **Settings → Community → Features** before use.-</Warning>+<Note>+Configuring a junction relation requires **Advanced mode** to be enabled (toggle at the bottom left of Settings).+</Note>See [How to Create Many-to-Many Relations](/user-guide/data-model/how-tos/create-many-to-many-relations) for a complete step-by-step guide.diff --git a/packages/twenty-docs/user-guide/data-model/how-tos/create-many-to-many-relations.mdx b/packages/twenty-docs/user-guide/data-model/how-tos/create-many-to-many-relations.mdxindex 554a4b6ff03..736aa68627c 100644--- a/packages/twenty-docs/user-guide/data-model/how-tos/create-many-to-many-relations.mdx+++ b/packages/twenty-docs/user-guide/data-model/how-tos/create-many-to-many-relations.mdx@@ -5,10 +5,6 @@ description: Connect records where many items on both sides can be linked togethMany-to-many relations let you connect multiple records on both sides. For example: many People can work on many Projects, and each Project can have many People.-<Warning>-**Beta Feature**: Junction relations are currently in beta. Enable them at **Settings → Community → Features** before following this guide.-</Warning>-<Note>This feature also requires **Advanced mode** to be enabled (toggle at the bottom left of Settings).</Note>@@ -39,9 +35,8 @@ When you enable the junction relation toggle, Twenty displays linked records dir## Prerequisites-1. **Enable Junction Relations in Beta Features**: Go to **Settings → Community → Features** and enable **Junction Relations**-2. **Enable Advanced mode**: Toggle on **Advanced mode** at the bottom left of the Settings sidebar-3. Plan your data model:+1. **Enable Advanced mode**: Toggle on **Advanced mode** at the bottom left of the Settings sidebar+2. Plan your data model:- Which two objects are you connecting?- What should the junction object be called?diff --git a/packages/twenty-docs/user-guide/settings/capabilities/community-settings.mdx b/packages/twenty-docs/user-guide/settings/capabilities/community-settings.mdxindex 0561230473f..d8427d14b75 100644--- a/packages/twenty-docs/user-guide/settings/capabilities/community-settings.mdx+++ b/packages/twenty-docs/user-guide/settings/capabilities/community-settings.mdx@@ -11,8 +11,7 @@ The Community section allows you to enable Early Access features before they'reEarly Access features are capabilities that are still being tested before general availability.-**Currently in Early Access:**-- **Junction relations** — Many-to-many relations+No features are in Early Access right now. New ones will appear in the **Features** section when they become available.### How to Enable Early Access Features1. Go to **Settings → Community**diff --git a/packages/twenty-front/src/generated-admin/graphql.ts b/packages/twenty-front/src/generated-admin/graphql.tsindex e8d5d0e962a..625c810848f 100644--- a/packages/twenty-front/src/generated-admin/graphql.ts+++ b/packages/twenty-front/src/generated-admin/graphql.ts@@ -483,7 +483,6 @@ export enum FeatureFlagKey {IS_EXECUTION_QUOTA_ENABLED = 'IS_EXECUTION_QUOTA_ENABLED',IS_INITIAL_OBJECT_VIEW_ENABLED = 'IS_INITIAL_OBJECT_VIEW_ENABLED',IS_JSON_FILTER_ENABLED = 'IS_JSON_FILTER_ENABLED',- IS_JUNCTION_RELATIONS_ENABLED = 'IS_JUNCTION_RELATIONS_ENABLED',IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED = 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED',IS_LOGS_SETTINGS_SECTION_ENABLED = 'IS_LOGS_SETTINGS_SECTION_ENABLED',IS_MESSAGE_CAMPAIGN_ENABLED = 'IS_MESSAGE_CAMPAIGN_ENABLED',diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.tsindex 4af89d1177c..4075c60bb1a 100644--- a/packages/twenty-front/src/generated-metadata/graphql.ts+++ b/packages/twenty-front/src/generated-metadata/graphql.ts@@ -2138,7 +2138,6 @@ export enum FeatureFlagKey {IS_EXECUTION_QUOTA_ENABLED = 'IS_EXECUTION_QUOTA_ENABLED',IS_INITIAL_OBJECT_VIEW_ENABLED = 'IS_INITIAL_OBJECT_VIEW_ENABLED',IS_JSON_FILTER_ENABLED = 'IS_JSON_FILTER_ENABLED',- IS_JUNCTION_RELATIONS_ENABLED = 'IS_JUNCTION_RELATIONS_ENABLED',IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED = 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED',IS_LOGS_SETTINGS_SECTION_ENABLED = 'IS_LOGS_SETTINGS_SECTION_ENABLED',IS_MESSAGE_CAMPAIGN_ENABLED = 'IS_MESSAGE_CAMPAIGN_ENABLED',diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationFormCard.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationFormCard.tsxindex 5b10fa66fa3..55b6c8bae6b 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationFormCard.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationFormCard.tsx@@ -12,13 +12,8 @@ import { SettingsDataModelFieldRelationPreviewContent } from '@/settings/data-moimport { SettingsDataModelRelationPreviewImage } from '@/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationPreviewImageCard';import { SettingsDataModelRelationFieldPreviewSubWidget } from '@/settings/data-model/fields/preview/components/SettingsDataModelRelationFieldPreviewSubWidget';import { useIsMobile } from 'twenty-ui/utilities';-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { isDefined } from 'twenty-shared/utils';-import {- FieldMetadataType,- RelationType,- FeatureFlagKey,-} from '~/generated-metadata/graphql';+import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql';import { type SettingsDataModelFieldEditFormValues } from '@/settings/data-model/types/SettingsDataModelFieldEditFormValues';type SettingsDataModelFieldRelationFormCardProps = {@@ -37,9 +32,6 @@ export const SettingsDataModelFieldRelationFormCard = ({SettingsDataModelFieldEditFormValues>();const isMobile = useIsMobile();- const isJunctionRelationsEnabled = useIsFeatureEnabled(- FeatureFlagKey.IS_JUNCTION_RELATIONS_ENABLED,- );const { objectMetadataItems } = useObjectMetadataItems();@@ -132,12 +124,11 @@ export const SettingsDataModelFieldRelationFormCard = ({sourceObjectMetadataId={sourceObjectMetadataItem?.id}disabled={disabled}/>- {isJunctionRelationsEnabled && (- <SettingsDataModelFieldRelationJunctionForm- objectNameSingular={objectNameSingular}- existingFieldMetadataId={existingFieldMetadataId}- />- )}+ <SettingsDataModelFieldRelationJunctionForm+ objectNameSingular={objectNameSingular}+ existingFieldMetadataId={existingFieldMetadataId}+ disabled={disabled}+ /></>}/>diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsxindex dcd7d54d2ea..dc39e8f6f54 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx@@ -20,11 +20,13 @@ import { type SettingsDataModelFieldEditFormValues } from '@/settings/data-modeltype SettingsDataModelFieldRelationJunctionFormProps = {objectNameSingular: string;existingFieldMetadataId: string;+ disabled?: boolean;};export const SettingsDataModelFieldRelationJunctionForm = ({objectNameSingular,existingFieldMetadataId,+ disabled = false,}: SettingsDataModelFieldRelationJunctionFormProps) => {const { t } = useLingui();const { watch, setValue } =@@ -162,6 +164,7 @@ export const SettingsDataModelFieldRelationJunctionForm = ({description={t`Build many-to-many relations`}checked={isJunctionConfigEnabled}onChange={handleJunctionToggle}+ disabled={disabled}divider={isJunctionConfigEnabled && junctionFieldOptions.length > 0}advancedMode/>@@ -186,6 +189,7 @@ export const SettingsDataModelFieldRelationJunctionForm = ({}options={junctionFieldOptions}onChange={handleSelectionChange}+ disabled={disabled}/></SettingsOptionCardContentSelect>)}diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/__mocks__/feature-flag-gated-front-component.ts b/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/__mocks__/feature-flag-gated-front-component.tsindex c49c072aa05..0eaa8058d11 100644--- a/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/__mocks__/feature-flag-gated-front-component.ts+++ b/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/__mocks__/feature-flag-gated-front-component.ts@@ -9,6 +9,6 @@ export default defineCommandMenuItem({label: 'Feature Flag Gated',frontComponentUniversalIdentifier: 'feature-flag-gated',conditionalAvailabilityExpression:- featureFlags.IS_JUNCTION_RELATIONS_ENABLED &&+ featureFlags.IS_EXAMPLE_FEATURE_ENABLED &&objectPermissions.canReadObjectRecords,});diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/transform-conditional-availability-expressions.test.ts b/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/transform-conditional-availability-expressions.test.tsindex 78f84312282..2d0175f8144 100644--- a/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/transform-conditional-availability-expressions.test.ts+++ b/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/transform-conditional-availability-expressions.test.ts@@ -278,7 +278,7 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {describe('feature-flag-gated-front-component', () => {it('should allow when feature flag is enabled', () => {const context = buildMockCommandMenuContextApi({- featureFlags: { IS_JUNCTION_RELATIONS_ENABLED: true },+ featureFlags: { IS_EXAMPLE_FEATURE_ENABLED: true },});expect(@@ -291,7 +291,7 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {it('should deny when feature flag is disabled', () => {const context = buildMockCommandMenuContextApi({- featureFlags: { IS_JUNCTION_RELATIONS_ENABLED: false },+ featureFlags: { IS_EXAMPLE_FEATURE_ENABLED: false },});expect(diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.tsindex 313fdbc3aa8..8e67afd95fe 100644--- a/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts@@ -13,15 +13,6 @@ export type PublicFeatureFlag = {};export const PUBLIC_FEATURE_FLAGS: PublicFeatureFlag[] = [- {- key: FeatureFlagKey.IS_JUNCTION_RELATIONS_ENABLED,- metadata: {- label: 'Junction Relations',- description:- 'Enable many-to-many relations through junction tables configuration',- icon: 'IconRelationManyToMany',- },- },...(process.env.CLOUDFLARE_API_KEY? [// {diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/validates/feature-flag.validate.spec.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/validates/feature-flag.validate.spec.tsindex cf6523a6d60..ae3e7e56821 100644--- a/packages/twenty-server/src/engine/core-modules/feature-flag/validates/feature-flag.validate.spec.ts+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/validates/feature-flag.validate.spec.ts@@ -8,7 +8,7 @@ describe('featureFlagValidator', () => {it('should not throw error if featureFlagKey is valid', () => {expect(() =>featureFlagValidator.assertIsFeatureFlagKey(- 'IS_JUNCTION_RELATIONS_ENABLED',+ 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED',new UnknownException('Error', 'Error', {userFriendlyMessage: msg`Error`,}),diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-feature-flags.util.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-feature-flags.util.tsindex 737275e91e0..30471d2ab12 100644--- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-feature-flags.util.ts+++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-feature-flags.util.ts@@ -4,7 +4,6 @@ import { type QueryRunner } from 'typeorm';const tableName = 'featureFlag';const DEFAULT_SEEDED_FEATURE_FLAGS: Partial<Record<FeatureFlagKey, boolean>> = {- [FeatureFlagKey.IS_JUNCTION_RELATIONS_ENABLED]: true,[FeatureFlagKey.IS_MESSAGE_CAMPAIGN_ENABLED]: true,[FeatureFlagKey.IS_AI_CHAT_SHARING_DROPDOWN_ENABLED]: false,[FeatureFlagKey.IS_INITIAL_OBJECT_VIEW_ENABLED]: false,diff --git a/packages/twenty-shared/src/types/FeatureFlagKey.ts b/packages/twenty-shared/src/types/FeatureFlagKey.tsindex 2590afc15b7..40fbabb184b 100644--- a/packages/twenty-shared/src/types/FeatureFlagKey.ts+++ b/packages/twenty-shared/src/types/FeatureFlagKey.ts@@ -3,7 +3,6 @@ export enum FeatureFlagKey {IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED = 'IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED',IS_JSON_FILTER_ENABLED = 'IS_JSON_FILTER_ENABLED',IS_MESSAGE_CAMPAIGN_ENABLED = 'IS_MESSAGE_CAMPAIGN_ENABLED',- IS_JUNCTION_RELATIONS_ENABLED = 'IS_JUNCTION_RELATIONS_ENABLED',IS_REST_METADATA_API_NEW_FORMAT_DIRECT = 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT',IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED = 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED',IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED = 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED',