The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
feat(workflow): add core-backed workflows index page behind a flag (#24350)
Thomas Trompette56d62a4ef066
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphqlindex a719d3cf25c..9ddb5626aee 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql@@ -1748,6 +1748,7 @@ enum FeatureFlagKey {IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLEDIS_SETTINGS_DISCOVERY_HERO_ENABLEDIS_WORKFLOW_VERSION_IN_CORE_ENABLED+ IS_WORKFLOW_CORE_INDEX_PAGE_ENABLEDIS_WORKFLOW_DISPATCH_FROM_CORE_ENABLEDIS_NATIVE_CALL_RECORDING_TABS_ENABLEDIS_ORM_V2_READ_PATH_ENABLEDdiff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.tsindex 715784fa374..bc0daae5964 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts@@ -1405,7 +1405,7 @@ export interface FeatureFlag {__typename: 'FeatureFlag'}-export type FeatureFlagKey = 'IS_APP_CLAIMING_ENABLED' | 'IS_UNIQUE_INDEXES_ENABLED' | 'IS_JSON_FILTER_ENABLED' | 'IS_CALENDAR_WEEK_VIEW_ENABLED' | 'IS_EMAIL_GROUP_ENABLED' | 'IS_JUNCTION_RELATIONS_ENABLED' | 'IS_LIST_VIEW_ENABLED' | 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT' | 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED' | 'IS_SETTINGS_DISCOVERY_HERO_ENABLED' | 'IS_WORKFLOW_VERSION_IN_CORE_ENABLED' | 'IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED' | 'IS_NATIVE_CALL_RECORDING_TABS_ENABLED' | 'IS_ORM_V2_READ_PATH_ENABLED'+export type FeatureFlagKey = 'IS_APP_CLAIMING_ENABLED' | 'IS_UNIQUE_INDEXES_ENABLED' | 'IS_JSON_FILTER_ENABLED' | 'IS_CALENDAR_WEEK_VIEW_ENABLED' | 'IS_EMAIL_GROUP_ENABLED' | 'IS_JUNCTION_RELATIONS_ENABLED' | 'IS_LIST_VIEW_ENABLED' | 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT' | 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED' | 'IS_SETTINGS_DISCOVERY_HERO_ENABLED' | 'IS_WORKFLOW_VERSION_IN_CORE_ENABLED' | 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED' | 'IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED' | 'IS_NATIVE_CALL_RECORDING_TABS_ENABLED' | 'IS_ORM_V2_READ_PATH_ENABLED'export interface WorkspaceUrls {customUrl?: Scalars['String']@@ -9682,6 +9682,7 @@ export const enumFeatureFlagKey = {IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED: 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED' as const,IS_SETTINGS_DISCOVERY_HERO_ENABLED: 'IS_SETTINGS_DISCOVERY_HERO_ENABLED' as const,IS_WORKFLOW_VERSION_IN_CORE_ENABLED: 'IS_WORKFLOW_VERSION_IN_CORE_ENABLED' as const,+ IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED: 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED' as const,IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED: 'IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED' as const,IS_NATIVE_CALL_RECORDING_TABS_ENABLED: 'IS_NATIVE_CALL_RECORDING_TABS_ENABLED' as const,IS_ORM_V2_READ_PATH_ENABLED: 'IS_ORM_V2_READ_PATH_ENABLED' as constdiff --git a/packages/twenty-front/codegen.cjs b/packages/twenty-front/codegen.cjsindex 3919c7dce64..fccefa35fd7 100644--- a/packages/twenty-front/codegen.cjs+++ b/packages/twenty-front/codegen.cjs@@ -6,6 +6,7 @@ module.exports = {'/graphql',documents: ['./src/modules/workflow/**/graphql/**/*.{ts,tsx}',+ './src/modules/object-core/**/graphql/**/*.{ts,tsx}','./src/modules/activities/emails/graphql/queries/**/*.{ts,tsx}','./src/modules/activities/emails/graphql/operation-signatures/**/*.{ts,tsx}','./src/modules/activities/calendar/graphql/**/*.{ts,tsx}',diff --git a/packages/twenty-front/src/generated-admin/graphql.ts b/packages/twenty-front/src/generated-admin/graphql.tsindex 9b560bb76eb..7d0a80434ae 100644--- a/packages/twenty-front/src/generated-admin/graphql.ts+++ b/packages/twenty-front/src/generated-admin/graphql.ts@@ -404,6 +404,7 @@ export enum FeatureFlagKey {IS_REST_METADATA_API_NEW_FORMAT_DIRECT = 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT',IS_SETTINGS_DISCOVERY_HERO_ENABLED = 'IS_SETTINGS_DISCOVERY_HERO_ENABLED',IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED',+ IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED = 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED',IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED = 'IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED',IS_WORKFLOW_VERSION_IN_CORE_ENABLED = 'IS_WORKFLOW_VERSION_IN_CORE_ENABLED'}diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.tsindex d9266b3c586..a1ff2ebeec5 100644--- a/packages/twenty-front/src/generated-metadata/graphql.ts+++ b/packages/twenty-front/src/generated-metadata/graphql.ts@@ -1812,6 +1812,7 @@ export enum FeatureFlagKey {IS_REST_METADATA_API_NEW_FORMAT_DIRECT = 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT',IS_SETTINGS_DISCOVERY_HERO_ENABLED = 'IS_SETTINGS_DISCOVERY_HERO_ENABLED',IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED',+ IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED = 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED',IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED = 'IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED',IS_WORKFLOW_VERSION_IN_CORE_ENABLED = 'IS_WORKFLOW_VERSION_IN_CORE_ENABLED'}diff --git a/packages/twenty-front/src/generated/graphql.ts b/packages/twenty-front/src/generated/graphql.tsindex bc95e7d596c..5362b698656 100644--- a/packages/twenty-front/src/generated/graphql.ts+++ b/packages/twenty-front/src/generated/graphql.ts@@ -48,6 +48,45 @@ export type ConnectedAccountHandleDto = {provider: Scalars['String']['output'];};+export type CoreWorkflowConnection = {+ __typename?: 'CoreWorkflowConnection';+ edges: Array<CoreWorkflowEdge>;+ pageInfo: CoreWorkflowPageInfo;+ totalCount: Scalars['Int']['output'];+};++export type CoreWorkflowDto = {+ __typename?: 'CoreWorkflowDTO';+ applicationId?: Maybe<Scalars['UUID']['output']>;+ id: Scalars['UUID']['output'];+ name?: Maybe<Scalars['String']['output']>;+ statuses: Array<Scalars['String']['output']>;+ updatedAt: Scalars['String']['output'];+ workspaceWorkflowId?: Maybe<Scalars['UUID']['output']>;+};++export type CoreWorkflowEdge = {+ __typename?: 'CoreWorkflowEdge';+ cursor: Scalars['String']['output'];+ node: CoreWorkflowDto;+};++export enum CoreWorkflowOrderByDirection {+ ASC = 'ASC',+ DESC = 'DESC'+}++export enum CoreWorkflowOrderByField {+ NAME = 'NAME',+ UPDATED_AT = 'UPDATED_AT'+}++export type CoreWorkflowPageInfo = {+ __typename?: 'CoreWorkflowPageInfo';+ endCursor?: Maybe<Scalars['String']['output']>;+ hasNextPage: Scalars['Boolean']['output'];+};+export type CreateDraftFromWorkflowVersionInput = {/** Workflow ID */workflowId: Scalars['UUID']['input'];@@ -348,6 +387,7 @@ export type ObjectRecordFilterInput = {export type Query = {__typename?: 'Query';+ coreWorkflows: CoreWorkflowConnection;dpaAgreements: Array<DpaAgreement>;dpaPreview: DpaDocument;/** @deprecated Use getTimelineCalendarEventsFromObjectRecord instead */@@ -371,6 +411,14 @@ export type Query = {};+export type QueryCoreWorkflowsArgs = {+ after?: InputMaybe<Scalars['String']['input']>;+ first?: InputMaybe<Scalars['Int']['input']>;+ orderBy?: InputMaybe<CoreWorkflowOrderByField>;+ orderByDirection?: InputMaybe<CoreWorkflowOrderByDirection>;+};++export type QueryGetTimelineCalendarEventsFromCompanyIdArgs = {companyId: Scalars['UUID']['input'];page: Scalars['Int']['input'];@@ -787,6 +835,16 @@ export type SearchQueryVariables = Exact<{export type SearchQuery = { __typename?: 'Query', search: { __typename?: 'SearchResultConnection', edges: Array<{ __typename?: 'SearchResultEdge', cursor: string, node: { __typename?: 'SearchRecord', recordId: any, objectNameSingular: string, objectLabelSingular: string, label: string, imageUrl?: string | null, tsRankCD: number, tsRank: number } }>, pageInfo: { __typename?: 'SearchResultPageInfo', hasNextPage: boolean, endCursor?: string | null } } };+export type GetCoreWorkflowsQueryVariables = Exact<{+ first?: InputMaybe<Scalars['Int']['input']>;+ after?: InputMaybe<Scalars['String']['input']>;+ orderBy?: InputMaybe<CoreWorkflowOrderByField>;+ orderByDirection?: InputMaybe<CoreWorkflowOrderByDirection>;+}>;+++export type GetCoreWorkflowsQuery = { __typename?: 'Query', coreWorkflows: { __typename?: 'CoreWorkflowConnection', totalCount: number, edges: Array<{ __typename?: 'CoreWorkflowEdge', cursor: string, node: { __typename?: 'CoreWorkflowDTO', id: any, name?: string | null, statuses: Array<string>, applicationId?: any | null, workspaceWorkflowId?: any | null, updatedAt: string } }>, pageInfo: { __typename?: 'CoreWorkflowPageInfo', endCursor?: string | null, hasNextPage: boolean } } };+export type WorkflowDiffFragmentFragment = { __typename?: 'WorkflowVersionStepChanges', triggerDiff?: any | null, stepsDiff?: any | null };export type ActivateWorkflowVersionMutationVariables = Exact<{@@ -947,6 +1005,7 @@ export const WorkflowDiffFragmentFragmentDoc = {"kind":"Document","definitions":export const GetTimelineCalendarEventsFromObjectRecordDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTimelineCalendarEventsFromObjectRecord"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"objectNameSingular"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"recordId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"page"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"pageSize"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getTimelineCalendarEventsFromObjectRecord"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"objectNameSingular"},"value":{"kind":"Variable","name":{"kind":"Name","value":"objectNameSingular"}}},{"kind":"Argument","name":{"kind":"Name","value":"recordId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"recordId"}}},{"kind":"Argument","name":{"kind":"Name","value":"page"},"value":{"kind":"Variable","name":{"kind":"Name","value":"page"}}},{"kind":"Argument","name":{"kind":"Name","value":"pageSize"},"value":{"kind":"Variable","name":{"kind":"Name","value":"pageSize"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TimelineCalendarEventsWithTotalFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TimelineCalendarEventParticipantFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TimelineCalendarEventParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"personId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberId"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"handle"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TimelineCalendarEventCallRecordingFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TimelineCalendarEventCallRecording"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TimelineCalendarEventFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TimelineCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"location"}},{"kind":"Field","name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","name":{"kind":"Name","value":"isFullDay"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TimelineCalendarEventParticipantFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"callRecordings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TimelineCalendarEventCallRecordingFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TimelineCalendarEventsWithTotalFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TimelineCalendarEventsWithTotal"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalNumberOfCalendarEvents"}},{"kind":"Field","name":{"kind":"Name","value":"relatedPersonIds"}},{"kind":"Field","name":{"kind":"Name","value":"timelineCalendarEvents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TimelineCalendarEventFragment"}}]}}]}}]} as unknown as DocumentNode<GetTimelineCalendarEventsFromObjectRecordQuery, GetTimelineCalendarEventsFromObjectRecordQueryVariables>;export const GetTimelineThreadsFromObjectRecordDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTimelineThreadsFromObjectRecord"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"objectNameSingular"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"recordId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"page"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"pageSize"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getTimelineThreadsFromObjectRecord"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"objectNameSingular"},"value":{"kind":"Variable","name":{"kind":"Name","value":"objectNameSingular"}}},{"kind":"Argument","name":{"kind":"Name","value":"recordId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"recordId"}}},{"kind":"Argument","name":{"kind":"Name","value":"page"},"value":{"kind":"Variable","name":{"kind":"Name","value":"page"}}},{"kind":"Argument","name":{"kind":"Name","value":"pageSize"},"value":{"kind":"Variable","name":{"kind":"Name","value":"pageSize"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TimelineThreadsWithTotalFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ParticipantFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TimelineThreadParticipant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"personId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberId"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"handle"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TimelineThreadFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TimelineThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"read"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"firstParticipant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ParticipantFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lastTwoParticipants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ParticipantFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lastMessageReceivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"lastMessageBody"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"numberOfMessagesInThread"}},{"kind":"Field","name":{"kind":"Name","value":"participantCount"}},{"kind":"Field","name":{"kind":"Name","value":"lastMessageIsDraft"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TimelineThreadsWithTotalFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TimelineThreadsWithTotal"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalNumberOfThreads"}},{"kind":"Field","name":{"kind":"Name","value":"relatedPersonIds"}},{"kind":"Field","name":{"kind":"Name","value":"timelineThreads"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TimelineThreadFragment"}}]}}]}}]} as unknown as DocumentNode<GetTimelineThreadsFromObjectRecordQuery, GetTimelineThreadsFromObjectRecordQueryVariables>;export const SearchDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Search"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"searchInput"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"excludedObjectNameSingulars"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"includedObjectNameSingulars"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filter"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ObjectRecordFilterInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"search"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"searchInput"},"value":{"kind":"Variable","name":{"kind":"Name","value":"searchInput"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}},{"kind":"Argument","name":{"kind":"Name","value":"excludedObjectNameSingulars"},"value":{"kind":"Variable","name":{"kind":"Name","value":"excludedObjectNameSingulars"}}},{"kind":"Argument","name":{"kind":"Name","value":"includedObjectNameSingulars"},"value":{"kind":"Variable","name":{"kind":"Name","value":"includedObjectNameSingulars"}}},{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filter"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"recordId"}},{"kind":"Field","name":{"kind":"Name","value":"objectNameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"objectLabelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"tsRankCD"}},{"kind":"Field","name":{"kind":"Name","value":"tsRank"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}}]}}]}}]} as unknown as DocumentNode<SearchQuery, SearchQueryVariables>;+export const GetCoreWorkflowsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCoreWorkflows"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"CoreWorkflowOrderByField"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderByDirection"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"CoreWorkflowOrderByDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"coreWorkflows"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderByDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderByDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"statuses"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceWorkflowId"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"endCursor"}},{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode<GetCoreWorkflowsQuery, GetCoreWorkflowsQueryVariables>;export const ActivateWorkflowVersionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ActivateWorkflowVersion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workflowVersionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activateWorkflowVersion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"workflowVersionId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workflowVersionId"}}}]}]}}]} as unknown as DocumentNode<ActivateWorkflowVersionMutation, ActivateWorkflowVersionMutationVariables>;export const ComputeStepOutputSchemaDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ComputeStepOutputSchema"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ComputeStepOutputSchemaInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"computeStepOutputSchema"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}]}]}}]} as unknown as DocumentNode<ComputeStepOutputSchemaMutation, ComputeStepOutputSchemaMutationVariables>;export const CreateDraftFromWorkflowVersionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateDraftFromWorkflowVersion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateDraftFromWorkflowVersionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createDraftFromWorkflowVersion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"trigger"}},{"kind":"Field","name":{"kind":"Name","value":"steps"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<CreateDraftFromWorkflowVersionMutation, CreateDraftFromWorkflowVersionMutationVariables>;diff --git a/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts b/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.tsindex 4f030dccc31..12c5d03e098 100644--- a/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts+++ b/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts@@ -344,6 +344,16 @@ const testCases: {{ loc: AppPath.RecordShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.BOOK_CALL, res: AppPath.BookCall },{ loc: AppPath.RecordShowPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.COMPLETED, res: undefined },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.PLAN_REQUIRED, res: AppPath.PlanRequired },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: true, isWorkspaceSuspended: true, onboardingStatus: OnboardingStatus.COMPLETED, res: getSettingsPath(SettingsPath.Billing) },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: false, isWorkspaceSuspended: false, onboardingStatus: undefined, res: AppPath.SignInUp },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.WORKSPACE_ACTIVATION, res: AppPath.WorkspaceActivation },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.PROFILE_CREATION, res: AppPath.CreateProfile },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.SYNC_EMAIL, res: AppPath.SyncEmails },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.APPS_INSTALLATION, res: AppPath.InstallApps },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.INVITE_TEAM, res: AppPath.InviteTeam },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.BOOK_CALL, res: AppPath.BookCall },+ { loc: AppPath.WorkflowCoreIndexPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.COMPLETED, res: undefined },{ loc: AppPath.PageLayoutPage, isLogged: true, isWorkspaceSuspended: false, onboardingStatus: OnboardingStatus.PLAN_REQUIRED, res: AppPath.PlanRequired },{ loc: AppPath.PageLayoutPage, isLogged: true, isWorkspaceSuspended: true, onboardingStatus: OnboardingStatus.COMPLETED, res: getSettingsPath(SettingsPath.Billing) },{ loc: AppPath.PageLayoutPage, isLogged: false, isWorkspaceSuspended: false, onboardingStatus: undefined, res: AppPath.SignInUp },diff --git a/packages/twenty-front/src/modules/app/components/WorkspaceApp.tsx b/packages/twenty-front/src/modules/app/components/WorkspaceApp.tsxindex 5ab093fbc8a..c6cddb022f7 100644--- a/packages/twenty-front/src/modules/app/components/WorkspaceApp.tsx+++ b/packages/twenty-front/src/modules/app/components/WorkspaceApp.tsx@@ -3,6 +3,8 @@ import { RouterProvider } from 'react-router-dom';import { useCreateWorkspaceAppRouter } from '@/app/hooks/useCreateWorkspaceAppRouter';import { currentUserState } from '@/auth/states/currentUserState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';+import { FeatureFlagKey } from '~/generated-metadata/graphql';export const WorkspaceApp = () => {const isFunctionSettingsEnabled = false;@@ -13,12 +15,17 @@ export const WorkspaceApp = () => {(currentUser?.canImpersonate || currentUser?.canAccessFullAdminPanel) ??false;+ const isWorkflowCoreIndexPageEnabled = useIsFeatureEnabled(+ FeatureFlagKey.IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED,+ );+return (<RouterProvider- router={useCreateWorkspaceAppRouter(+ router={useCreateWorkspaceAppRouter({isFunctionSettingsEnabled,isAdminPageEnabled,- )}+ isWorkflowCoreIndexPageEnabled,+ })}/>);};diff --git a/packages/twenty-front/src/modules/app/hooks/useCreateWorkspaceAppRouter.tsx b/packages/twenty-front/src/modules/app/hooks/useCreateWorkspaceAppRouter.tsxindex 5b9c925c5d2..60a98afe12c 100644--- a/packages/twenty-front/src/modules/app/hooks/useCreateWorkspaceAppRouter.tsx+++ b/packages/twenty-front/src/modules/app/hooks/useCreateWorkspaceAppRouter.tsx@@ -1,4 +1,5 @@import { lazy, useMemo } from 'react';+import {createBrowserRouter,createRoutesFromElements,@@ -27,6 +28,12 @@ import { MainAppLayoutWithSidePanel } from '@/ui/layout/page/components/MainAppLimport { Verify } from '~/pages/onboarding/Verify';import { lazyWithPreload } from '~/utils/lazyWithPreload';+const WorkflowCoreIndexPage = lazy(() =>+ import('~/pages/object-core/WorkflowCoreIndexPage').then((module) => ({+ default: module.WorkflowCoreIndexPage,+ })),+);+const RecordIndexPage = lazy(() =>import('~/pages/object-record/RecordIndexPage').then((module) => ({default: module.RecordIndexPage,@@ -141,10 +148,17 @@ const preloadOnboardingPages = () => {return null;};-const createWorkspaceAppRouter = (- isFunctionSettingsEnabled?: boolean,- isAdminPageEnabled?: boolean,-) =>+type CreateWorkspaceAppRouterArgs = {+ isFunctionSettingsEnabled?: boolean;+ isAdminPageEnabled?: boolean;+ isWorkflowCoreIndexPageEnabled?: boolean;+};++const createWorkspaceAppRouter = ({+ isFunctionSettingsEnabled,+ isAdminPageEnabled,+ isWorkflowCoreIndexPageEnabled,+}: CreateWorkspaceAppRouterArgs) =>createBrowserRouter(createRoutesFromElements(<Route@@ -154,6 +168,16 @@ const createWorkspaceAppRouter = (<Route element={<MinimalMetadataGate />}><Route element={<DefaultLayout />}><Route element={<MainAppLayoutWithSidePanel />}>+ {isWorkflowCoreIndexPageEnabled && (+ <Route+ path={AppPath.WorkflowCoreIndexPage}+ element={+ <LazyRoute>+ <WorkflowCoreIndexPage />+ </LazyRoute>+ }+ />+ )}<Routepath={indexAppPath.getIndexAppPath()}element={<RecordIndexSkeletonLoader />}@@ -348,12 +372,21 @@ const createWorkspaceAppRouter = (),);-export const useCreateWorkspaceAppRouter = (- isFunctionSettingsEnabled?: boolean,- isAdminPageEnabled?: boolean,-) =>+export const useCreateWorkspaceAppRouter = ({+ isFunctionSettingsEnabled,+ isAdminPageEnabled,+ isWorkflowCoreIndexPageEnabled,+}: CreateWorkspaceAppRouterArgs) =>useMemo(() =>- createWorkspaceAppRouter(isFunctionSettingsEnabled, isAdminPageEnabled),- [isFunctionSettingsEnabled, isAdminPageEnabled],+ createWorkspaceAppRouter({+ isFunctionSettingsEnabled,+ isAdminPageEnabled,+ isWorkflowCoreIndexPageEnabled,+ }),+ [+ isFunctionSettingsEnabled,+ isAdminPageEnabled,+ isWorkflowCoreIndexPageEnabled,+ ],);diff --git a/packages/twenty-front/src/modules/object-core/components/CoreObjectTable.tsx b/packages/twenty-front/src/modules/object-core/components/CoreObjectTable.tsxnew file mode 100644index 00000000000..c7fbfe53786--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/components/CoreObjectTable.tsx@@ -0,0 +1,82 @@+import { useLingui } from '@lingui/react/macro';+import { isDefined } from 'twenty-shared/utils';++import { type CoreObjectTableColumn } from '@/object-core/types/CoreObjectTableColumn';+import { SortableTableHeader } from '@/ui/layout/table/components/SortableTableHeader';+import { Table } from '@/ui/layout/table/components/Table';+import { TableBody } from '@/ui/layout/table/components/TableBody';+import { TableCell } from '@/ui/layout/table/components/TableCell';+import { TableHeader } from '@/ui/layout/table/components/TableHeader';+import { TableHeaderText } from '@/ui/layout/table/components/TableHeaderText';+import { TableRow } from '@/ui/layout/table/components/TableRow';+import { type TableFieldMetadata } from '@/ui/layout/table/types/TableFieldMetadata';+import { type TableMetadata } from '@/ui/layout/table/types/TableMetadata';++type CoreObjectTableProps<TItem> = {+ tableId: string;+ columns: CoreObjectTableColumn<TItem>[];+ items: TItem[];+ getItemKey: (item: TItem) => string;+ getItemLink?: (item: TItem) => string | undefined;+ initialSort?: TableMetadata<TItem>['initialSort'];+};++const isSortableColumn = <TItem,>(+ column: CoreObjectTableColumn<TItem>,+): column is CoreObjectTableColumn<TItem> & TableFieldMetadata<TItem> =>+ isDefined(column.fieldType);++export const CoreObjectTable = <TItem,>({+ tableId,+ columns,+ items,+ getItemKey,+ getItemLink,+ initialSort,+}: CoreObjectTableProps<TItem>) => {+ const { t } = useLingui();++ const gridTemplateColumns = columns+ .map((column) => column.gridTrack)+ .join(' ');++ return (+ <Table>+ <TableRow gridTemplateColumns={gridTemplateColumns}>+ {columns.map((column) =>+ isSortableColumn(column) ? (+ <SortableTableHeader+ key={column.fieldName}+ tableId={tableId}+ fieldName={column.fieldName}+ label={t(column.fieldLabel)}+ align={column.align}+ initialSort={initialSort}+ Icon={column.FieldIcon}+ />+ ) : (+ <TableHeader key={column.fieldName} align={column.align}>+ {isDefined(column.FieldIcon) && <column.FieldIcon size={14} />}+ <TableHeaderText>{t(column.fieldLabel)}</TableHeaderText>+ </TableHeader>+ ),+ )}+ </TableRow>+ <TableBody>+ {items.map((item) => (+ <TableRow+ key={getItemKey(item)}+ gridTemplateColumns={gridTemplateColumns}+ to={getItemLink?.(item)}+ >+ {columns.map((column) => (+ <TableCell key={column.fieldName} align={column.align}>+ {column.renderCell(item)}+ </TableCell>+ ))}+ </TableRow>+ ))}+ </TableBody>+ </Table>+ );+};diff --git a/packages/twenty-front/src/modules/object-core/components/cells/CoreObjectNameCell.tsx b/packages/twenty-front/src/modules/object-core/components/cells/CoreObjectNameCell.tsxnew file mode 100644index 00000000000..ea4440acd29--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/components/cells/CoreObjectNameCell.tsx@@ -0,0 +1,41 @@+import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';+import { isNonEmptyString } from '@sniptt/guards';+import { type IconComponent } from 'twenty-ui/icon';+import { OverflowingTextWithTooltip } from 'twenty-ui/surfaces';+import { themeCssVariables } from 'twenty-ui/theme-constants';++const StyledContainer = styled.div`+ align-items: center;+ color: ${themeCssVariables.font.color.primary};+ display: flex;+ gap: ${themeCssVariables.spacing[2]};+ min-width: 0;+ overflow: hidden;+`;++const StyledIconContainer = styled.span`+ align-items: center;+ display: flex;+ flex-shrink: 0;+`;++type CoreObjectNameCellProps = {+ name: string | null | undefined;+ Icon: IconComponent;+};++export const CoreObjectNameCell = ({ name, Icon }: CoreObjectNameCellProps) => {+ const { t } = useLingui();++ return (+ <StyledContainer>+ <StyledIconContainer>+ <Icon size={16} />+ </StyledIconContainer>+ <OverflowingTextWithTooltip+ text={isNonEmptyString(name) ? name : t`Untitled`}+ />+ </StyledContainer>+ );+};diff --git a/packages/twenty-front/src/modules/object-core/types/CoreObjectTableColumn.ts b/packages/twenty-front/src/modules/object-core/types/CoreObjectTableColumn.tsnew file mode 100644index 00000000000..8ac14233b17--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/types/CoreObjectTableColumn.ts@@ -0,0 +1,16 @@+import { type MessageDescriptor } from '@lingui/core';+import { type ReactNode } from 'react';++import { type TableFieldMetadata } from '@/ui/layout/table/types/TableFieldMetadata';++// A column without a fieldType is not sortable and renders a plain header+export type CoreObjectTableColumn<TItem> = Pick<+ TableFieldMetadata<TItem>,+ 'align' | 'FieldIcon'+> & {+ fieldName: keyof TItem & string;+ fieldLabel: MessageDescriptor;+ fieldType?: TableFieldMetadata<TItem>['fieldType'];+ gridTrack: string;+ renderCell: (item: TItem) => ReactNode;+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowNameCell.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowNameCell.tsxnew file mode 100644index 00000000000..b8d8be058c0--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowNameCell.tsx@@ -0,0 +1,20 @@+import { CoreObjectNameSingular } from 'twenty-shared/types';+import { useIcons } from 'twenty-ui/icon';++import { CoreObjectNameCell } from '@/object-core/components/cells/CoreObjectNameCell';+import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';++type CoreWorkflowNameCellProps = {+ name: string | null | undefined;+};++export const CoreWorkflowNameCell = ({ name }: CoreWorkflowNameCellProps) => {+ const { objectMetadataItem } = useObjectMetadataItem({+ objectNameSingular: CoreObjectNameSingular.Workflow,+ });+ const { getIcon } = useIcons();++ return (+ <CoreObjectNameCell name={name} Icon={getIcon(objectMetadataItem.icon)} />+ );+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowStatusesCell.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowStatusesCell.tsxnew file mode 100644index 00000000000..690b703da4e--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowStatusesCell.tsx@@ -0,0 +1,14 @@+import { MultiSelectDisplay } from '@/ui/field/display/components/MultiSelectDisplay';+import { useCoreWorkflowStatusOptions } from '@/object-core/workflows/hooks/useCoreWorkflowStatusOptions';++type CoreWorkflowStatusesCellProps = {+ statuses: string[];+};++export const CoreWorkflowStatusesCell = ({+ statuses,+}: CoreWorkflowStatusesCellProps) => {+ const statusOptions = useCoreWorkflowStatusOptions();++ return <MultiSelectDisplay values={statuses} options={statusOptions} />;+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/constants/WorkflowCoreTableColumns.tsx b/packages/twenty-front/src/modules/object-core/workflows/constants/WorkflowCoreTableColumns.tsxnew file mode 100644index 00000000000..d3ed1b1aec0--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/constants/WorkflowCoreTableColumns.tsx@@ -0,0 +1,46 @@+import { msg } from '@lingui/core/macro';++import { AppChip } from '@/applications/components/AppChip';+import { CoreWorkflowNameCell } from '@/object-core/workflows/components/CoreWorkflowNameCell';+import { CoreWorkflowStatusesCell } from '@/object-core/workflows/components/CoreWorkflowStatusesCell';+import { type CoreObjectTableColumn } from '@/object-core/types/CoreObjectTableColumn';+import { DateTimeDisplay } from '@/ui/field/display/components/DateTimeDisplay';+import { type CoreWorkflow } from '@/object-core/workflows/types/CoreWorkflow';++export const WORKFLOW_CORE_TABLE_COLUMNS: CoreObjectTableColumn<CoreWorkflow>[] =+ [+ {+ fieldName: 'name',+ fieldLabel: msg`Name`,+ fieldType: 'string',+ align: 'left',+ gridTrack: 'minmax(0, 1fr)',+ renderCell: (workflow) => <CoreWorkflowNameCell name={workflow.name} />,+ },+ {+ fieldName: 'statuses',+ fieldLabel: msg`Status`,+ align: 'left',+ gridTrack: '160px',+ renderCell: (workflow) => (+ <CoreWorkflowStatusesCell statuses={workflow.statuses} />+ ),+ },+ {+ fieldName: 'applicationId',+ fieldLabel: msg`App`,+ align: 'left',+ gridTrack: '160px',+ renderCell: (workflow) => (+ <AppChip applicationId={workflow.applicationId} />+ ),+ },+ {+ fieldName: 'updatedAt',+ fieldLabel: msg`Last update`,+ fieldType: 'string',+ align: 'left',+ gridTrack: '180px',+ renderCell: (workflow) => <DateTimeDisplay value={workflow.updatedAt} />,+ },+ ];diff --git a/packages/twenty-front/src/modules/object-core/workflows/graphql/queries/getCoreWorkflows.ts b/packages/twenty-front/src/modules/object-core/workflows/graphql/queries/getCoreWorkflows.tsnew file mode 100644index 00000000000..9d56eb7f5b2--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/graphql/queries/getCoreWorkflows.ts@@ -0,0 +1,34 @@+import { gql } from '@apollo/client';++export const GET_CORE_WORKFLOWS = gql`+ query GetCoreWorkflows(+ $first: Int+ $after: String+ $orderBy: CoreWorkflowOrderByField+ $orderByDirection: CoreWorkflowOrderByDirection+ ) {+ coreWorkflows(+ first: $first+ after: $after+ orderBy: $orderBy+ orderByDirection: $orderByDirection+ ) {+ edges {+ node {+ id+ name+ statuses+ applicationId+ workspaceWorkflowId+ updatedAt+ }+ cursor+ }+ pageInfo {+ endCursor+ hasNextPage+ }+ totalCount+ }+ }+`;diff --git a/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflowStatusOptions.ts b/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflowStatusOptions.tsnew file mode 100644index 00000000000..e20710bbe1a--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflowStatusOptions.ts@@ -0,0 +1,15 @@+import { CoreObjectNameSingular } from 'twenty-shared/types';+import { type SelectOption } from 'twenty-ui/input';++import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';++export const useCoreWorkflowStatusOptions = (): SelectOption[] => {+ const { objectMetadataItem } = useObjectMetadataItem({+ objectNameSingular: CoreObjectNameSingular.Workflow,+ });++ return (+ objectMetadataItem.fields.find((field) => field.name === 'statuses')+ ?.options ?? []+ );+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflows.ts b/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflows.tsnew file mode 100644index 00000000000..27fa1d5c6bd--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflows.ts@@ -0,0 +1,95 @@+import { useState } from 'react';++import { useQuery } from '@apollo/client/react';++import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';+import { sortedFieldByTableFamilyState } from '@/ui/layout/table/states/sortedFieldByTableFamilyState';+import { type TableSortValue } from '@/ui/layout/table/types/TableSortValue';+import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';+import {+ CoreWorkflowOrderByDirection,+ CoreWorkflowOrderByField,+ GetCoreWorkflowsDocument,+} from '~/generated/graphql';++export const CORE_WORKFLOWS_TABLE_ID = 'workflowCore';+export const CORE_WORKFLOWS_PAGE_SIZE = 60;++export const CORE_WORKFLOWS_INITIAL_SORT: TableSortValue = {+ fieldName: 'updatedAt',+ orderBy: 'DescNullsLast',+};++const ORDER_BY_FIELD_BY_FIELD_NAME: Record<string, CoreWorkflowOrderByField> = {+ name: CoreWorkflowOrderByField.NAME,+ updatedAt: CoreWorkflowOrderByField.UPDATED_AT,+};++export const useCoreWorkflows = () => {+ const apolloCoreClient = useApolloCoreClient();++ const sortedFieldByTable = useAtomFamilyStateValue(+ sortedFieldByTableFamilyState,+ { tableId: CORE_WORKFLOWS_TABLE_ID },+ );++ const sortValue = sortedFieldByTable ?? CORE_WORKFLOWS_INITIAL_SORT;++ const orderBy =+ ORDER_BY_FIELD_BY_FIELD_NAME[sortValue.fieldName] ??+ CoreWorkflowOrderByField.UPDATED_AT;+ const orderByDirection = sortValue.orderBy.startsWith('Asc')+ ? CoreWorkflowOrderByDirection.ASC+ : CoreWorkflowOrderByDirection.DESC;++ const [isFetchingMore, setIsFetchingMore] = useState(false);++ const { data, loading, error, fetchMore } = useQuery(+ GetCoreWorkflowsDocument,+ {+ client: apolloCoreClient,+ fetchPolicy: 'cache-and-network',+ notifyOnNetworkStatusChange: true,+ variables: {+ first: CORE_WORKFLOWS_PAGE_SIZE,+ orderBy,+ orderByDirection,+ },+ },+ );++ const connection = data?.coreWorkflows;++ const fetchNextPage = async () => {+ if (connection?.pageInfo.hasNextPage !== true || isFetchingMore) {+ return;+ }++ setIsFetchingMore(true);++ await fetchMore({+ variables: { after: connection.pageInfo.endCursor },+ updateQuery: (previousResult, { fetchMoreResult }) => ({+ ...fetchMoreResult,+ coreWorkflows: {+ ...fetchMoreResult.coreWorkflows,+ edges: [+ ...previousResult.coreWorkflows.edges,+ ...fetchMoreResult.coreWorkflows.edges,+ ],+ },+ }),+ }).finally(() => {+ setIsFetchingMore(false);+ });+ };++ return {+ coreWorkflows: connection?.edges.map((edge) => edge.node) ?? [],+ totalCount: connection?.totalCount ?? 0,+ hasNextPage: connection?.pageInfo.hasNextPage ?? false,+ fetchNextPage,+ loading,+ error,+ };+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/types/CoreWorkflow.ts b/packages/twenty-front/src/modules/object-core/workflows/types/CoreWorkflow.tsnew file mode 100644index 00000000000..d09c3d41f1f--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/types/CoreWorkflow.ts@@ -0,0 +1,4 @@+import { type GetCoreWorkflowsQuery } from '~/generated/graphql';++export type CoreWorkflow =+ GetCoreWorkflowsQuery['coreWorkflows']['edges'][number]['node'];diff --git a/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsx b/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsxnew file mode 100644index 00000000000..289c2e0c274--- /dev/null+++ b/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsx@@ -0,0 +1,82 @@+import { useEffect } from 'react';+import { styled } from '@linaria/react';+import { useInView } from 'react-intersection-observer';+import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';+import { getAppPath, isDefined } from 'twenty-shared/utils';++import { CoreObjectTable } from '@/object-core/components/CoreObjectTable';+import { WORKFLOW_CORE_TABLE_COLUMNS } from '@/object-core/workflows/constants/WorkflowCoreTableColumns';+import {+ CORE_WORKFLOWS_INITIAL_SORT,+ CORE_WORKFLOWS_TABLE_ID,+ useCoreWorkflows,+} from '@/object-core/workflows/hooks/useCoreWorkflows';+import { type CoreWorkflow } from '@/object-core/workflows/types/CoreWorkflow';+import { ObjectMetadataIcon } from '@/object-metadata/components/ObjectMetadataIcon';+import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';+import { PageCardHeader } from '@/ui/layout/page/components/PageCardHeader';+import { PageCardLayout } from '@/ui/layout/page/components/PageCardLayout';+import { PageTitle } from '@/ui/utilities/page-title/components/PageTitle';++const StyledTableContainer = styled.div`+ height: 100%;+ overflow: auto;+ width: 100%;+`;++const StyledFetchMoreSentinel = styled.div`+ height: 1px;+`;++const getCoreWorkflowLink = (workflow: CoreWorkflow) =>+ isDefined(workflow.workspaceWorkflowId)+ ? getAppPath(AppPath.RecordShowPage, {+ objectNameSingular: CoreObjectNameSingular.Workflow,+ objectRecordId: workflow.workspaceWorkflowId,+ })+ : undefined;++export const WorkflowCoreIndexPage = () => {+ const { objectMetadataItem } = useObjectMetadataItem({+ objectNameSingular: CoreObjectNameSingular.Workflow,+ });++ const { coreWorkflows, hasNextPage, loading, fetchNextPage } =+ useCoreWorkflows();++ const { ref: fetchMoreRef, inView } = useInView();++ useEffect(() => {+ if (inView && hasNextPage && !loading) {+ void fetchNextPage();+ }+ }, [inView, hasNextPage, loading, fetchNextPage]);++ return (+ <>+ <PageTitle title={objectMetadataItem.labelPlural} />+ <PageCardLayout+ header={+ <PageCardHeader+ icon={+ <ObjectMetadataIcon objectMetadataItem={objectMetadataItem} />+ }+ title={objectMetadataItem.labelPlural}+ />+ }+ >+ <StyledTableContainer>+ <CoreObjectTable+ tableId={CORE_WORKFLOWS_TABLE_ID}+ columns={WORKFLOW_CORE_TABLE_COLUMNS}+ items={coreWorkflows}+ getItemKey={(workflow) => workflow.id}+ getItemLink={getCoreWorkflowLink}+ initialSort={CORE_WORKFLOWS_INITIAL_SORT}+ />+ {hasNextPage && <StyledFetchMoreSentinel ref={fetchMoreRef} />}+ </StyledTableContainer>+ </PageCardLayout>+ </>+ );+};diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflow-connection.dto.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflow-connection.dto.tsnew file mode 100644index 00000000000..eb5b9ee0f1d--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflow-connection.dto.ts@@ -0,0 +1,33 @@+import { Field, Int, ObjectType } from '@nestjs/graphql';++import { CoreWorkflowDTO } from 'src/engine/core-modules/workflow/dtos/core-workflow.dto';++@ObjectType('CoreWorkflowEdge')+export class CoreWorkflowEdgeDTO {+ @Field(() => CoreWorkflowDTO)+ node: CoreWorkflowDTO;++ @Field(() => String)+ cursor: string;+}++@ObjectType('CoreWorkflowPageInfo')+export class CoreWorkflowPageInfoDTO {+ @Field(() => String, { nullable: true })+ endCursor: string | null;++ @Field(() => Boolean)+ hasNextPage: boolean;+}++@ObjectType('CoreWorkflowConnection')+export class CoreWorkflowConnectionDTO {+ @Field(() => [CoreWorkflowEdgeDTO])+ edges: CoreWorkflowEdgeDTO[];++ @Field(() => CoreWorkflowPageInfoDTO)+ pageInfo: CoreWorkflowPageInfoDTO;++ @Field(() => Int)+ totalCount: number;+}diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflow.dto.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflow.dto.tsnew file mode 100644index 00000000000..94ddeda7a4c--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflow.dto.ts@@ -0,0 +1,24 @@+import { Field, ObjectType } from '@nestjs/graphql';++import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';++@ObjectType('CoreWorkflowDTO')+export class CoreWorkflowDTO {+ @Field(() => UUIDScalarType)+ id: string;++ @Field(() => String, { nullable: true })+ name: string | null;++ @Field(() => [String])+ statuses: string[];++ @Field(() => UUIDScalarType, { nullable: true })+ applicationId: string | null;++ @Field(() => UUIDScalarType, { nullable: true })+ workspaceWorkflowId: string | null;++ @Field(() => String)+ updatedAt: string;+}diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflows.input.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflows.input.tsnew file mode 100644index 00000000000..b5e7b8e8720--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflows.input.ts@@ -0,0 +1,49 @@+import { ArgsType, Field, Int, registerEnumType } from '@nestjs/graphql';++import { IsEnum, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';++export enum CoreWorkflowOrderByField {+ NAME = 'name',+ UPDATED_AT = 'updatedAt',+}++export enum CoreWorkflowOrderByDirection {+ ASC = 'ASC',+ DESC = 'DESC',+}++registerEnumType(CoreWorkflowOrderByField, {+ name: 'CoreWorkflowOrderByField',+});++registerEnumType(CoreWorkflowOrderByDirection, {+ name: 'CoreWorkflowOrderByDirection',+});++@ArgsType()+export class CoreWorkflowsArgs {+ @Field(() => Int, { nullable: true, defaultValue: 60 })+ @IsInt()+ @Min(1)+ @Max(200)+ first: number;++ @Field(() => String, { nullable: true })+ @IsOptional()+ @IsString()+ after?: string;++ @Field(() => CoreWorkflowOrderByField, {+ nullable: true,+ defaultValue: CoreWorkflowOrderByField.UPDATED_AT,+ })+ @IsEnum(CoreWorkflowOrderByField)+ orderBy: CoreWorkflowOrderByField;++ @Field(() => CoreWorkflowOrderByDirection, {+ nullable: true,+ defaultValue: CoreWorkflowOrderByDirection.DESC,+ })+ @IsEnum(CoreWorkflowOrderByDirection)+ orderByDirection: CoreWorkflowOrderByDirection;+}diff --git a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/core-workflow.resolver.ts b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/core-workflow.resolver.tsnew file mode 100644index 00000000000..e59a28e5af3--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/core-workflow.resolver.ts@@ -0,0 +1,45 @@+import { UseFilters, UseGuards, UsePipes } from '@nestjs/common';+import { Args, Query } from '@nestjs/graphql';++import { PermissionFlagType } from 'twenty-shared/constants';++import { CoreResolver } from 'src/engine/api/graphql/graphql-config/decorators/core-resolver.decorator';+import { PreventNestToAutoLogGraphqlErrorsFilter } from 'src/engine/core-modules/graphql/filters/prevent-nest-to-auto-log-graphql-errors.filter';+import { ResolverValidationPipe } from 'src/engine/core-modules/graphql/pipes/resolver-validation.pipe';+import { CoreWorkflowConnectionDTO } from 'src/engine/core-modules/workflow/dtos/core-workflow-connection.dto';+import { CoreWorkflowsArgs } from 'src/engine/core-modules/workflow/dtos/core-workflows.input';+import { CoreWorkflowListService } from 'src/engine/core-modules/workflow/services/core-workflow-list.service';+import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';+import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';+import { SettingsPermissionGuard } from 'src/engine/guards/settings-permission.guard';+import { UserAuthGuard } from 'src/engine/guards/user-auth.guard';+import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';+import { PermissionsGraphqlApiExceptionFilter } from 'src/engine/metadata-modules/permissions/utils/permissions-graphql-api-exception.filter';++@CoreResolver()+@UsePipes(ResolverValidationPipe)+@UseGuards(+ WorkspaceAuthGuard,+ UserAuthGuard,+ SettingsPermissionGuard(PermissionFlagType.WORKFLOWS),+)+@UseFilters(+ PermissionsGraphqlApiExceptionFilter,+ PreventNestToAutoLogGraphqlErrorsFilter,+)+export class CoreWorkflowResolver {+ constructor(+ private readonly coreWorkflowListService: CoreWorkflowListService,+ ) {}++ @Query(() => CoreWorkflowConnectionDTO)+ async coreWorkflows(+ @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,+ @Args() coreWorkflowsArgs: CoreWorkflowsArgs,+ ): Promise<CoreWorkflowConnectionDTO> {+ return this.coreWorkflowListService.findManyByWorkspaceId(+ workspaceId,+ coreWorkflowsArgs,+ );+ }+}diff --git a/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-list.service.ts b/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-list.service.tsnew file mode 100644index 00000000000..5deb5ec33c6--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-list.service.ts@@ -0,0 +1,163 @@+import { Injectable } from '@nestjs/common';+import { InjectDataSource } from '@nestjs/typeorm';++import { isDefined } from 'twenty-shared/utils';+import { DataSource } from 'typeorm';++import {+ decodeCursor,+ encodeCursorData,+} from 'src/engine/api/graphql/graphql-query-runner/utils/cursors.util';+import { type CoreWorkflowConnectionDTO } from 'src/engine/core-modules/workflow/dtos/core-workflow-connection.dto';+import {+ CoreWorkflowOrderByDirection,+ CoreWorkflowOrderByField,+ type CoreWorkflowsArgs,+} from 'src/engine/core-modules/workflow/dtos/core-workflows.input';+import { computeCoreWorkflowStatuses } from 'src/engine/core-modules/workflow/utils/compute-core-workflow-statuses.util';+import { escapeIdentifier } from 'src/engine/workspace-manager/workspace-migration/utils/remove-sql-injection.util';+import { getWorkspaceSchemaName } from 'src/engine/workspace-datasource/utils/get-workspace-schema-name.util';++type CoreWorkflowRow = {+ id: string;+ cursorSortValue: string | null;+ name: string | null;+ applicationId: string | null;+ workspaceWorkflowId: string | null;+ updatedAt: Date;+ hasDraftVersion: boolean;+ hasActiveVersion: boolean;+ hasDeactivatedVersion: boolean;+};++type CoreWorkflowCursor = {+ sortValue: string | null;+ id: string;+};++// sorting and the keyset comparison stay on the raw columns so a btree index+// can serve them; only the cursor value is rendered to text+const SORT_COLUMN_BY_FIELD: Record<+ CoreWorkflowOrderByField,+ { column: string; cursorExpression: string; nullable: boolean; cast: string }+> = {+ [CoreWorkflowOrderByField.NAME]: {+ column: 'c.name',+ cursorExpression: 'c.name',+ nullable: true,+ cast: '',+ },+ [CoreWorkflowOrderByField.UPDATED_AT]: {+ column: 'c."updatedAt"',+ // microsecond-precise text so the cursor round-trips exactly+ cursorExpression: `to_char(c."updatedAt" at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"')`,+ nullable: false,+ cast: '::timestamptz',+ },+};++@Injectable()+export class CoreWorkflowListService {+ constructor(+ @InjectDataSource()+ private readonly coreDataSource: DataSource,+ ) {}++ async findManyByWorkspaceId(+ workspaceId: string,+ { first, after, orderBy, orderByDirection }: CoreWorkflowsArgs,+ ): Promise<CoreWorkflowConnectionDTO> {+ const schemaName = escapeIdentifier(getWorkspaceSchemaName(workspaceId));+ const { column, cursorExpression, nullable, cast } =+ SORT_COLUMN_BY_FIELD[orderBy];+ const isAscending = orderByDirection === CoreWorkflowOrderByDirection.ASC;+ const comparator = isAscending ? '>' : '<';+ const direction = isAscending ? 'ASC' : 'DESC';+ const nullsClause = nullable ? ' NULLS LAST' : '';++ const parameters: unknown[] = [workspaceId];+ let keysetCondition = '';++ if (isDefined(after)) {+ const cursor = decodeCursor<CoreWorkflowCursor>(after);++ if (cursor.sortValue === null) {+ parameters.push(cursor.id);+ keysetCondition = `AND (${column} IS NULL AND c.id ${comparator} $2::uuid)`;+ } else {+ parameters.push(cursor.sortValue, cursor.id);+ keysetCondition = nullable+ ? `AND (${column} ${comparator} $2${cast}+ OR (${column} = $2${cast} AND c.id ${comparator} $3::uuid)+ OR ${column} IS NULL)`+ : `AND (${column}, c.id) ${comparator} ($2${cast}, $3::uuid)`;+ }+ }++ parameters.push(first + 1);+ const limitParameter = `$${parameters.length}`;++ const rows: CoreWorkflowRow[] = await this.coreDataSource.query(+ `SELECT+ c.id,+ ${cursorExpression} AS "cursorSortValue",+ c.name,+ c."applicationId",+ min(wf.id::text) AS "workspaceWorkflowId",+ c."updatedAt",+ coalesce(bool_or(v.status = 'DRAFT'), false) AS "hasDraftVersion",+ coalesce(bool_or(v.status = 'ACTIVE'), false) AS "hasActiveVersion",+ coalesce(bool_or(v.status = 'DEACTIVATED'), false) AS "hasDeactivatedVersion"+ FROM core."workflow" c+ LEFT JOIN ${schemaName}."workflow" wf+ ON wf."coreWorkflowId" = c.id AND wf."deletedAt" IS NULL+ LEFT JOIN core."workflowVersion" v+ ON v."workflowId" = wf.id AND v."workspaceId" = $1+ WHERE c."workspaceId" = $1+ ${keysetCondition}+ GROUP BY c.id, c.name, c."applicationId", c."updatedAt"+ ORDER BY ${column} ${direction}${nullsClause}, c.id ${direction}+ LIMIT ${limitParameter}`,+ parameters,+ );++ const [{ totalCount }]: [{ totalCount: number }] =+ await this.coreDataSource.query(+ `SELECT count(*)::int AS "totalCount"+ FROM core."workflow" c+ WHERE c."workspaceId" = $1`,+ [workspaceId],+ );++ const hasNextPage = rows.length > first;+ const pageRows = hasNextPage ? rows.slice(0, first) : rows;++ const edges = pageRows.map((row) => ({+ node: {+ id: row.id,+ name: row.name,+ statuses: computeCoreWorkflowStatuses({+ hasDraftVersion: row.hasDraftVersion,+ hasActiveVersion: row.hasActiveVersion,+ hasDeactivatedVersion: row.hasDeactivatedVersion,+ }),+ applicationId: row.applicationId,+ workspaceWorkflowId: row.workspaceWorkflowId,+ updatedAt: row.updatedAt.toISOString(),+ },+ cursor: encodeCursorData({+ sortValue: row.cursorSortValue,+ id: row.id,+ } satisfies CoreWorkflowCursor),+ }));++ return {+ edges,+ pageInfo: {+ endCursor: edges.length > 0 ? edges[edges.length - 1].cursor : null,+ hasNextPage,+ },+ totalCount,+ };+ }+}diff --git a/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/compute-core-workflow-statuses.util.spec.ts b/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/compute-core-workflow-statuses.util.spec.tsnew file mode 100644index 00000000000..e57ed1dfd13--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/compute-core-workflow-statuses.util.spec.ts@@ -0,0 +1,51 @@+import { computeCoreWorkflowStatuses } from 'src/engine/core-modules/workflow/utils/compute-core-workflow-statuses.util';++describe('computeCoreWorkflowStatuses', () => {+ it('should return an empty list when the workflow has no non-archived version', () => {+ expect(+ computeCoreWorkflowStatuses({+ hasDraftVersion: false,+ hasActiveVersion: false,+ hasDeactivatedVersion: false,+ }),+ ).toEqual([]);+ });++ it('should return DRAFT then ACTIVE, and hide DEACTIVATED behind an active version', () => {+ expect(+ computeCoreWorkflowStatuses({+ hasDraftVersion: true,+ hasActiveVersion: true,+ hasDeactivatedVersion: true,+ }),+ ).toEqual(['DRAFT', 'ACTIVE']);+ });++ it('should return DEACTIVATED only when no version is active', () => {+ expect(+ computeCoreWorkflowStatuses({+ hasDraftVersion: false,+ hasActiveVersion: false,+ hasDeactivatedVersion: true,+ }),+ ).toEqual(['DEACTIVATED']);+ });++ it('should return only the statuses that are present', () => {+ expect(+ computeCoreWorkflowStatuses({+ hasDraftVersion: false,+ hasActiveVersion: true,+ hasDeactivatedVersion: false,+ }),+ ).toEqual(['ACTIVE']);++ expect(+ computeCoreWorkflowStatuses({+ hasDraftVersion: true,+ hasActiveVersion: false,+ hasDeactivatedVersion: true,+ }),+ ).toEqual(['DRAFT', 'DEACTIVATED']);+ });+});diff --git a/packages/twenty-server/src/engine/core-modules/workflow/utils/compute-core-workflow-statuses.util.ts b/packages/twenty-server/src/engine/core-modules/workflow/utils/compute-core-workflow-statuses.util.tsnew file mode 100644index 00000000000..f9cb6ddc34f--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/utils/compute-core-workflow-statuses.util.ts@@ -0,0 +1,29 @@+import { WorkflowStatus } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';++// Shared with WorkflowStatusesUpdateJob so the core page and the workspace+// statuses field cannot drift+export const computeCoreWorkflowStatuses = ({+ hasDraftVersion,+ hasActiveVersion,+ hasDeactivatedVersion,+}: {+ hasDraftVersion: boolean;+ hasActiveVersion: boolean;+ hasDeactivatedVersion: boolean;+}): WorkflowStatus[] => {+ const statuses: WorkflowStatus[] = [];++ if (hasDraftVersion) {+ statuses.push(WorkflowStatus.DRAFT);+ }++ if (hasActiveVersion) {+ statuses.push(WorkflowStatus.ACTIVE);+ }++ if (!hasActiveVersion && hasDeactivatedVersion) {+ statuses.push(WorkflowStatus.DEACTIVATED);+ }++ return statuses;+};diff --git a/packages/twenty-server/src/engine/core-modules/workflow/workflow-api.module.ts b/packages/twenty-server/src/engine/core-modules/workflow/workflow-api.module.tsindex 06fb39e977c..3f3ed8665ab 100644--- a/packages/twenty-server/src/engine/core-modules/workflow/workflow-api.module.ts+++ b/packages/twenty-server/src/engine/core-modules/workflow/workflow-api.module.ts@@ -3,11 +3,13 @@ import { TypeOrmModule } from '@nestjs/typeorm';import { ToolModule } from 'src/engine/core-modules/tool/tool.module';import { WorkflowTriggerController } from 'src/engine/core-modules/workflow/controllers/workflow-trigger.controller';+import { CoreWorkflowResolver } from 'src/engine/core-modules/workflow/resolvers/core-workflow.resolver';import { WorkflowBuilderResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-builder.resolver';import { WorkflowTriggerResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-trigger.resolver';import { WorkflowVersionEdgeResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-version-edge.resolver';import { WorkflowVersionStepResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-version-step.resolver';import { WorkflowVersionResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-version.resolver';+import { CoreWorkflowListService } from 'src/engine/core-modules/workflow/services/core-workflow-list.service';import { WorkflowVersionCoreModule } from 'src/engine/core-modules/workflow/workflow-version-core.module';import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';import { ConnectedAccountMetadataModule } from 'src/engine/metadata-modules/connected-account/connected-account-metadata.module';@@ -46,6 +48,8 @@ import { WorkflowTriggerModule } from 'src/modules/workflow/workflow-trigger/worWorkflowVersionStepResolver,WorkflowVersionEdgeResolver,WorkflowVersionResolver,+ CoreWorkflowResolver,+ CoreWorkflowListService,],})export class WorkflowApiModule {}diff --git a/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts b/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.tsindex babed066702..a2d5db30c95 100644--- a/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts+++ b/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts@@ -253,6 +253,7 @@ describe('WorkspaceEntityManager', () => {IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED: false,IS_SETTINGS_DISCOVERY_HERO_ENABLED: false,IS_WORKFLOW_VERSION_IN_CORE_ENABLED: false,+ IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED: false,IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED: false,IS_NATIVE_CALL_RECORDING_TABS_ENABLED: false,IS_ORM_V2_READ_PATH_ENABLED: false,diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.tsindex fc51af51e2c..59a554f4477 100644--- a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts+++ b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts@@ -3,6 +3,7 @@ import { Logger, Scope } from '@nestjs/common';import isEqual from 'lodash.isequal';import { In } from 'typeorm';+import { computeCoreWorkflowStatuses } from 'src/engine/core-modules/workflow/utils/compute-core-workflow-statuses.util';import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator';import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator';import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants';@@ -13,10 +14,7 @@ import {WorkflowVersionStatus,type WorkflowVersionWorkspaceEntity,} from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity';-import {- WorkflowStatus,- type WorkflowWorkspaceEntity,-} from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';+import { type WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';export enum WorkflowVersionEventType {CREATE = 'CREATE',@@ -196,8 +194,6 @@ export class WorkflowStatusesUpdateJob {workflowId: string;workflowVersionRepository: WorkspaceRepository<WorkflowVersionWorkspaceEntity>;}) {- const statuses: WorkflowStatus[] = [];-const workflowVersions = await workflowVersionRepository.find({where: {workflowId,@@ -209,30 +205,16 @@ export class WorkflowStatusesUpdateJob {},});- const hasDraftVersion = workflowVersions.some(- (version) => version.status === WorkflowVersionStatus.DRAFT,- );-- if (hasDraftVersion) {- statuses.push(WorkflowStatus.DRAFT);- }-- const hasActiveVersion = workflowVersions.some(- (version) => version.status === WorkflowVersionStatus.ACTIVE,- );-- if (hasActiveVersion) {- statuses.push(WorkflowStatus.ACTIVE);- }-- const hasDeactivatedVersion = workflowVersions.some(- (version) => version.status === WorkflowVersionStatus.DEACTIVATED,- );-- if (!hasActiveVersion && hasDeactivatedVersion) {- statuses.push(WorkflowStatus.DEACTIVATED);- }-- return statuses;+ return computeCoreWorkflowStatuses({+ hasDraftVersion: workflowVersions.some(+ (version) => version.status === WorkflowVersionStatus.DRAFT,+ ),+ hasActiveVersion: workflowVersions.some(+ (version) => version.status === WorkflowVersionStatus.ACTIVE,+ ),+ hasDeactivatedVersion: workflowVersions.some(+ (version) => version.status === WorkflowVersionStatus.DEACTIVATED,+ ),+ });}}diff --git a/packages/twenty-server/test/integration/graphql/suites/workflow/core-workflows.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/workflow/core-workflows.integration-spec.tsnew file mode 100644index 00000000000..0f5727913dd--- /dev/null+++ b/packages/twenty-server/test/integration/graphql/suites/workflow/core-workflows.integration-spec.ts@@ -0,0 +1,289 @@+import request from 'supertest';+import { updateWorkflowVersionTrigger } from 'test/integration/graphql/suites/workflow/utils/update-workflow-version-trigger.util';+import { isDefined } from 'twenty-shared/utils';++const POLL_ATTEMPTS = 20;+const POLL_INTERVAL_MS = 250;++const client = request(`http://localhost:${APP_PORT}`);++const graphql = (query: string, variables?: object) =>+ client+ .post('/graphql')+ .set('Authorization', `Bearer ${APPLE_JANE_ADMIN_ACCESS_TOKEN}`)+ .send({ query, variables });++const CORE_WORKFLOWS_QUERY = `+ query CoreWorkflows {+ coreWorkflows(first: 200) {+ edges {+ node {+ id+ name+ statuses+ applicationId+ workspaceWorkflowId+ updatedAt+ }+ cursor+ }+ pageInfo {+ endCursor+ hasNextPage+ }+ totalCount+ }+ }+`;++type CoreWorkflow = {+ id: string;+ name: string | null;+ statuses: string[];+ applicationId: string | null;+ workspaceWorkflowId: string | null;+ updatedAt: string;+};++describe('coreWorkflows (e2e)', () => {+ let workflowId: string;+ let firstVersionId: string;+ let alreadyDestroyed = false;++ const findCoreWorkflow = async (): Promise<CoreWorkflow | undefined> => {+ const response = await graphql(CORE_WORKFLOWS_QUERY);++ expect(response.body.errors).toBeUndefined();++ return (response.body.data.coreWorkflows.edges as { node: CoreWorkflow }[])+ .map((edge) => edge.node)+ .find((workflow) => workflow.workspaceWorkflowId === workflowId);+ };++ // the core mirror and the statuses update are async listeners, so the row+ // lands shortly after the mutation returns rather than within it+ const waitForCoreWorkflow = async (+ predicate: (workflow: CoreWorkflow | undefined) => boolean,+ ): Promise<CoreWorkflow | undefined> => {+ for (let attempt = 0; attempt < POLL_ATTEMPTS; attempt++) {+ const coreWorkflow = await findCoreWorkflow();++ if (predicate(coreWorkflow)) {+ return coreWorkflow;+ }++ await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));+ }++ return findCoreWorkflow();+ };++ beforeAll(async () => {+ const createResponse = await graphql(`+ mutation {+ createWorkflow(data: { name: "Core Workflows List" }) {+ id+ }+ }+ `);++ expect(createResponse.body.errors).toBeUndefined();+ workflowId = createResponse.body.data.createWorkflow.id;++ const getResponse = await graphql(+ `+ query GetWorkflow($id: UUID!) {+ workflow(filter: { id: { eq: $id } }) {+ versions {+ edges {+ node {+ id+ }+ }+ }+ }+ }+ `,+ { id: workflowId },+ );++ firstVersionId = getResponse.body.data.workflow.versions.edges[0].node.id;+ });++ afterAll(async () => {+ if (alreadyDestroyed) {+ return;+ }++ await graphql(+ `+ mutation DestroyWorkflow($id: UUID!) {+ destroyWorkflow(id: $id) {+ id+ }+ }+ `,+ { id: workflowId },+ );+ });++ it('should list the workflow as DRAFT right after creation', async () => {+ const coreWorkflow = await waitForCoreWorkflow((workflow) =>+ isDefined(workflow),+ );++ expect(coreWorkflow).toBeDefined();+ expect(coreWorkflow?.name).toBe('Core Workflows List');+ expect(coreWorkflow?.statuses).toEqual(['DRAFT']);+ });++ it('should list the workflow as ACTIVE once its version is activated', async () => {+ await updateWorkflowVersionTrigger({+ workflowVersionId: firstVersionId,+ trigger: {+ name: 'Manual Trigger',+ type: 'MANUAL',+ settings: { outputSchema: {} },+ nextStepIds: [],+ position: { x: 0, y: 0 },+ },+ });++ const stepResponse = await graphql(+ `+ mutation CreateWorkflowVersionStep(+ $input: CreateWorkflowVersionStepInput!+ ) {+ createWorkflowVersionStep(input: $input) {+ stepsDiff+ }+ }+ `,+ {+ input: {+ workflowVersionId: firstVersionId,+ stepType: 'FIND_RECORDS',+ parentStepId: 'trigger',+ position: { x: 200, y: 0 },+ },+ },+ );++ expect(stepResponse.body.errors).toBeUndefined();++ const activateResponse = await graphql(+ `+ mutation ActivateWorkflowVersion($workflowVersionId: UUID!) {+ activateWorkflowVersion(workflowVersionId: $workflowVersionId)+ }+ `,+ { workflowVersionId: firstVersionId },+ );++ expect(activateResponse.body.errors).toBeUndefined();++ const coreWorkflow = await waitForCoreWorkflow(+ (workflow) => workflow?.statuses[0] === 'ACTIVE',+ );++ expect(coreWorkflow?.statuses).toEqual(['ACTIVE']);+ });++ it('should list the workflow as DEACTIVATED once its version is deactivated', async () => {+ const deactivateResponse = await graphql(+ `+ mutation DeactivateWorkflowVersion($workflowVersionId: UUID!) {+ deactivateWorkflowVersion(workflowVersionId: $workflowVersionId)+ }+ `,+ { workflowVersionId: firstVersionId },+ );++ expect(deactivateResponse.body.errors).toBeUndefined();++ const coreWorkflow = await waitForCoreWorkflow(+ (workflow) => workflow?.statuses[0] === 'DEACTIVATED',+ );++ expect(coreWorkflow?.statuses).toEqual(['DEACTIVATED']);+ });++ it('should paginate with a stable keyset cursor', async () => {+ const firstPageResponse = await graphql(`+ query {+ coreWorkflows(first: 1, orderBy: NAME, orderByDirection: ASC) {+ edges {+ node {+ id+ }+ cursor+ }+ pageInfo {+ endCursor+ hasNextPage+ }+ totalCount+ }+ }+ `);++ expect(firstPageResponse.body.errors).toBeUndefined();++ const firstPage = firstPageResponse.body.data.coreWorkflows;++ expect(firstPage.edges).toHaveLength(1);+ expect(firstPage.totalCount).toBeGreaterThanOrEqual(1);++ if (!firstPage.pageInfo.hasNextPage) {+ return;+ }++ const secondPageResponse = await graphql(+ `+ query SecondPage($after: String!) {+ coreWorkflows(+ first: 1+ after: $after+ orderBy: NAME+ orderByDirection: ASC+ ) {+ edges {+ node {+ id+ }+ cursor+ }+ }+ }+ `,+ { after: firstPage.pageInfo.endCursor },+ );++ expect(secondPageResponse.body.errors).toBeUndefined();++ const secondPage = secondPageResponse.body.data.coreWorkflows;++ expect(secondPage.edges[0].node.id).not.toBe(firstPage.edges[0].node.id);+ });++ it('should not list the workflow once it is destroyed', async () => {+ await graphql(+ `+ mutation DestroyWorkflow($id: UUID!) {+ destroyWorkflow(id: $id) {+ id+ }+ }+ `,+ { id: workflowId },+ );++ alreadyDestroyed = true;++ const coreWorkflow = await waitForCoreWorkflow(+ (workflow) => !isDefined(workflow),+ );++ expect(coreWorkflow).toBeUndefined();+ });+});diff --git a/packages/twenty-shared/src/types/AppPath.ts b/packages/twenty-shared/src/types/AppPath.tsindex 9cdbf65ec40..bf89b3db6ef 100644--- a/packages/twenty-shared/src/types/AppPath.ts+++ b/packages/twenty-shared/src/types/AppPath.ts@@ -27,6 +27,7 @@ export enum AppPath {RecordIndexPage = '/objects/:objectNamePlural',RecordShowPage = '/object/:objectNameSingular/:objectRecordId',PageLayoutPage = '/page/:pageLayoutId',+ WorkflowCoreIndexPage = '/workflow-core',Settings = `settings`,SettingsCatchAll = `/${Settings}/*`,diff --git a/packages/twenty-shared/src/types/FeatureFlagKey.ts b/packages/twenty-shared/src/types/FeatureFlagKey.tsindex cf582086eb3..f4b091de54e 100644--- a/packages/twenty-shared/src/types/FeatureFlagKey.ts+++ b/packages/twenty-shared/src/types/FeatureFlagKey.ts@@ -10,6 +10,7 @@ export enum FeatureFlagKey {IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED = 'IS_LOGIC_FUNCTION_PREBUILT_MODE_ENABLED',IS_SETTINGS_DISCOVERY_HERO_ENABLED = 'IS_SETTINGS_DISCOVERY_HERO_ENABLED',IS_WORKFLOW_VERSION_IN_CORE_ENABLED = 'IS_WORKFLOW_VERSION_IN_CORE_ENABLED',+ IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED = 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED',IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED = 'IS_WORKFLOW_DISPATCH_FROM_CORE_ENABLED',IS_NATIVE_CALL_RECORDING_TABS_ENABLED = 'IS_NATIVE_CALL_RECORDING_TABS_ENABLED',IS_ORM_V2_READ_PATH_ENABLED = 'IS_ORM_V2_READ_PATH_ENABLED',