The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
feat(workflow): filters on the core workflows index (#25109)
Thomas Trompette1c0c7dac4897
diff --git a/packages/twenty-front/src/generated/graphql.ts b/packages/twenty-front/src/generated/graphql.tsindex 25abb7e5f4a..fa56d7109f9 100644--- a/packages/twenty-front/src/generated/graphql.ts+++ b/packages/twenty-front/src/generated/graphql.ts@@ -61,7 +61,7 @@ export type CoreWorkflowDto = {applicationId?: Maybe<Scalars['UUID']['output']>;id: Scalars['UUID']['output'];name?: Maybe<Scalars['String']['output']>;- statuses: Array<Scalars['String']['output']>;+ statuses: Array<CoreWorkflowStatus>;updatedAt: Scalars['String']['output'];workspaceWorkflowId?: Maybe<Scalars['UUID']['output']>;};@@ -72,6 +72,44 @@ export type CoreWorkflowEdge = {node: CoreWorkflowDto;};+export enum CoreWorkflowFilterFieldKey {+ NAME = 'NAME',+ STATUSES = 'STATUSES',+ UPDATED_AT = 'UPDATED_AT'+}++export type CoreWorkflowFilterInput = {+ logicalOperator: CoreWorkflowFilterLogicalOperator;+ rules: Array<CoreWorkflowFilterRuleInput>;+};++export enum CoreWorkflowFilterLogicalOperator {+ AND = 'AND',+ OR = 'OR'+}++export enum CoreWorkflowFilterOperand {+ CONTAINS = 'CONTAINS',+ DOES_NOT_CONTAIN = 'DOES_NOT_CONTAIN',+ IS = 'IS',+ IS_AFTER = 'IS_AFTER',+ IS_BEFORE = 'IS_BEFORE',+ IS_EMPTY = 'IS_EMPTY',+ IS_IN_FUTURE = 'IS_IN_FUTURE',+ IS_IN_PAST = 'IS_IN_PAST',+ IS_NOT = 'IS_NOT',+ IS_NOT_EMPTY = 'IS_NOT_EMPTY',+ IS_RELATIVE = 'IS_RELATIVE',+ IS_TODAY = 'IS_TODAY'+}++export type CoreWorkflowFilterRuleInput = {+ fieldKey: CoreWorkflowFilterFieldKey;+ operand: CoreWorkflowFilterOperand;+ timezone?: InputMaybe<Scalars['String']['input']>;+ value?: InputMaybe<Scalars['String']['input']>;+};+export enum CoreWorkflowOrderByDirection {ASC = 'ASC',DESC = 'DESC'@@ -88,6 +126,12 @@ export type CoreWorkflowPageInfo = {hasNextPage: Scalars['Boolean']['output'];};+export enum CoreWorkflowStatus {+ ACTIVE = 'ACTIVE',+ DEACTIVATED = 'DEACTIVATED',+ DRAFT = 'DRAFT'+}+export type CreateDraftFromWorkflowVersionInput = {/** Workflow ID */workflowId: Scalars['UUID']['input'];@@ -414,6 +458,7 @@ export type Query = {export type QueryCoreWorkflowsArgs = {after?: InputMaybe<Scalars['String']['input']>;+ filter?: InputMaybe<CoreWorkflowFilterInput>;first?: InputMaybe<Scalars['Int']['input']>;orderBy?: InputMaybe<CoreWorkflowOrderByField>;orderByDirection?: InputMaybe<CoreWorkflowOrderByDirection>;@@ -841,10 +886,11 @@ export type GetCoreWorkflowsQueryVariables = Exact<{after?: InputMaybe<Scalars['String']['input']>;orderBy?: InputMaybe<CoreWorkflowOrderByField>;orderByDirection?: InputMaybe<CoreWorkflowOrderByDirection>;+ filter?: InputMaybe<CoreWorkflowFilterInput>;}>;-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 GetCoreWorkflowsQuery = { __typename?: 'Query', coreWorkflows: { __typename?: 'CoreWorkflowConnection', totalCount: number, edges: Array<{ __typename?: 'CoreWorkflowEdge', cursor: string, node: { __typename?: 'CoreWorkflowDTO', id: any, name?: string | null, statuses: Array<CoreWorkflowStatus>, workspaceWorkflowId?: any | null, updatedAt: string } }>, pageInfo: { __typename?: 'CoreWorkflowPageInfo', endCursor?: string | null, hasNextPage: boolean } } };export type WorkflowDiffFragmentFragment = { __typename?: 'WorkflowVersionStepChanges', triggerDiff?: any | null, stepsDiff?: any | null };@@ -1006,7 +1052,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 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"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filter"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"CoreWorkflowFilterInput"}}}],"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"}}},{"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":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"statuses"}},{"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/modules/command-menu-item/display/components/SidePanelCommandMenuItemDisplayPage.tsx b/packages/twenty-front/src/modules/command-menu-item/display/components/SidePanelCommandMenuItemDisplayPage.tsxindex 8b17f200de0..5ebecbb2573 100644--- a/packages/twenty-front/src/modules/command-menu-item/display/components/SidePanelCommandMenuItemDisplayPage.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/display/components/SidePanelCommandMenuItemDisplayPage.tsx@@ -6,6 +6,8 @@ import { commandMenuPinnedInlineLayoutFamilyState } from '@/command-menu-item/diimport { getVisibleCommandMenuItemCountForContainerWidth } from '@/command-menu-item/display/utils/getVisibleCommandMenuItemCountForContainerWidth';import { groupCommandMenuItems } from '@/command-menu-item/utils/groupCommandMenuItems';import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';+import { CoreObjectsCommands } from '@/object-core/commands/components/CoreObjectsCommands';+import { useCoreObjectsCommands } from '@/object-core/commands/hooks/useCoreObjectsCommands';import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup';import { SidePanelList } from '@/side-panel/components/SidePanelList';import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';@@ -28,6 +30,8 @@ export const SidePanelCommandMenuItemDisplayPage = () => {const { commandMenuItems, commandMenuContextApi } =useContext(CommandMenuContext);+ const { coreObjectsCommandIds } = useCoreObjectsCommands();+// The command menu list surfaces whatever overflowed out of the page header.const commandMenuPinnedInlineLayout = useAtomFamilyStateValue(commandMenuPinnedInlineLayoutFamilyState,@@ -103,7 +107,8 @@ export const SidePanelCommandMenuItemDisplayPage = () => {const hasNoMatchingItems =!matchingPinnedItems.length &&!matchingOtherItems.length &&- appActions.length === 0;+ appActions.length === 0 &&+ coreObjectsCommandIds.length === 0;const shouldDisplayFallbackItems =hasNoMatchingItems && fallbackCommandMenuItems.length > 0;@@ -115,6 +120,7 @@ export const SidePanelCommandMenuItemDisplayPage = () => {...matchingPinnedItems.map((item) => item.id),...matchingOtherItems.map((item) => item.id),...appActions.map((item) => item.id),+ ...coreObjectsCommandIds,...(shouldDisplayFallbackItems? fallbackCommandMenuItems.map((item) => item.id): []),@@ -132,7 +138,9 @@ export const SidePanelCommandMenuItemDisplayPage = () => {))}</SidePanelGroup>)}- {(matchingOtherItems.length > 0 || appActions.length > 0) && (+ {(matchingOtherItems.length > 0 ||+ appActions.length > 0 ||+ coreObjectsCommandIds.length > 0) && (<SidePanelGroup heading={t`Other`}>{matchingOtherItems.map((item) => (<CommandMenuItemRenderer item={item} key={item.id} />@@ -158,6 +166,7 @@ export const SidePanelCommandMenuItemDisplayPage = () => {</SelectableListItem>);})}+ <CoreObjectsCommands /></SidePanelGroup>)}{shouldDisplayFallbackItems && (diff --git a/packages/twenty-front/src/modules/object-core/commands/components/CoreObjectsCommands.tsx b/packages/twenty-front/src/modules/object-core/commands/components/CoreObjectsCommands.tsxnew file mode 100644index 00000000000..8d16b735030--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/commands/components/CoreObjectsCommands.tsx@@ -0,0 +1,35 @@+import { IconFilter } from 'twenty-ui/icon';++import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';+import { CORE_WORKFLOW_FILTERS_COMMAND_ID } from '@/object-core/commands/constants/CoreWorkflowFiltersCommandId';+import { useCoreObjectsCommands } from '@/object-core/commands/hooks/useCoreObjectsCommands';+import { useOpenCoreWorkflowFiltersSidePanel } from '@/object-core/workflows/hooks/useOpenCoreWorkflowFiltersSidePanel';+import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';++export const CoreObjectsCommands = () => {+ const {+ coreWorkflowFiltersCommandLabel,+ shouldDisplayCoreWorkflowFiltersCommand,+ } = useCoreObjectsCommands();++ const { openCoreWorkflowFiltersSidePanel } =+ useOpenCoreWorkflowFiltersSidePanel();++ if (!shouldDisplayCoreWorkflowFiltersCommand) {+ return null;+ }++ return (+ <SelectableListItem+ itemId={CORE_WORKFLOW_FILTERS_COMMAND_ID}+ onEnter={openCoreWorkflowFiltersSidePanel}+ >+ <CommandMenuItem+ id={CORE_WORKFLOW_FILTERS_COMMAND_ID}+ label={coreWorkflowFiltersCommandLabel}+ Icon={IconFilter}+ onClick={openCoreWorkflowFiltersSidePanel}+ />+ </SelectableListItem>+ );+};diff --git a/packages/twenty-front/src/modules/object-core/commands/constants/CoreWorkflowFiltersCommandId.ts b/packages/twenty-front/src/modules/object-core/commands/constants/CoreWorkflowFiltersCommandId.tsnew file mode 100644index 00000000000..008a11fafe3--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/commands/constants/CoreWorkflowFiltersCommandId.ts@@ -0,0 +1 @@+export const CORE_WORKFLOW_FILTERS_COMMAND_ID = 'core-workflow-filters';diff --git a/packages/twenty-front/src/modules/object-core/commands/hooks/useCoreObjectsCommands.ts b/packages/twenty-front/src/modules/object-core/commands/hooks/useCoreObjectsCommands.tsnew file mode 100644index 00000000000..670fe70ca73--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/commands/hooks/useCoreObjectsCommands.ts@@ -0,0 +1,54 @@+import { useLingui } from '@lingui/react/macro';+import { useContext } from 'react';+import { useLocation } from 'react-router-dom';+import { AppPath, FeatureFlagKey } from 'twenty-shared/types';++import { CommandMenuContext } from '@/command-menu-item/contexts/CommandMenuContext';+import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';+import { CORE_WORKFLOW_FILTERS_COMMAND_ID } from '@/object-core/commands/constants/CoreWorkflowFiltersCommandId';+import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';+import { isMatchingLocation } from '~/utils/isMatchingLocation';+import { normalizeSearchText } from '~/utils/normalizeSearchText';++export const useCoreObjectsCommands = () => {+ const { t } = useLingui();+ const location = useLocation();+ const { isInPreviewMode } = useContext(CommandMenuContext);+ const sidePanelSearch = useAtomStateValue(sidePanelSearchState);++ const isWorkflowCoreIndexPageEnabled = useIsFeatureEnabled(+ FeatureFlagKey.IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED,+ );++ const isOnCoreWorkflowsIndex =+ isMatchingLocation(location, AppPath.WorkflowCoreIndexPage) ||+ (isWorkflowCoreIndexPageEnabled &&+ isMatchingLocation(+ location,+ AppPath.RecordIndexPage.replace(+ ':objectNamePlural',+ CoreObjectNamePlural.Workflow,+ ),+ ));++ const coreWorkflowFiltersCommandLabel = t`Filter workflows`;++ const shouldDisplayCoreWorkflowFiltersCommand =+ isOnCoreWorkflowsIndex &&+ !isInPreviewMode &&+ normalizeSearchText(coreWorkflowFiltersCommandLabel).includes(+ normalizeSearchText(sidePanelSearch.trim()),+ );++ const coreObjectsCommandIds = shouldDisplayCoreWorkflowFiltersCommand+ ? [CORE_WORKFLOW_FILTERS_COMMAND_ID]+ : [];++ return {+ coreObjectsCommandIds,+ coreWorkflowFiltersCommandLabel,+ shouldDisplayCoreWorkflowFiltersCommand,+ };+};diff --git a/packages/twenty-front/src/modules/object-core/components/CoreObjectTable.tsx b/packages/twenty-front/src/modules/object-core/components/CoreObjectTable.tsxindex c7fbfe53786..ad21899cbb4 100644--- a/packages/twenty-front/src/modules/object-core/components/CoreObjectTable.tsx+++ b/packages/twenty-front/src/modules/object-core/components/CoreObjectTable.tsx@@ -1,10 +1,13 @@import { useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';+import {+ CoreObjectTableBody,+ CoreObjectTableRow,+} from '@/object-core/components/CoreObjectTableRow';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';@@ -62,9 +65,9 @@ export const CoreObjectTable = <TItem,>({),)}</TableRow>- <TableBody>+ <CoreObjectTableBody>{items.map((item) => (- <TableRow+ <CoreObjectTableRowkey={getItemKey(item)}gridTemplateColumns={gridTemplateColumns}to={getItemLink?.(item)}@@ -74,9 +77,9 @@ export const CoreObjectTable = <TItem,>({{column.renderCell(item)}</TableCell>))}- </TableRow>+ </CoreObjectTableRow>))}- </TableBody>+ </CoreObjectTableBody></Table>);};diff --git a/packages/twenty-front/src/modules/object-core/components/CoreObjectTableRow.tsx b/packages/twenty-front/src/modules/object-core/components/CoreObjectTableRow.tsxnew file mode 100644index 00000000000..f768171bfc5--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/components/CoreObjectTableRow.tsx@@ -0,0 +1,22 @@+import { styled } from '@linaria/react';+import { themeCssVariables } from 'twenty-ui/theme-constants';++import { TableBody } from '@/ui/layout/table/components/TableBody';+import { TableRow } from '@/ui/layout/table/components/TableRow';++const StyledCoreObjectTableBody = styled(TableBody)`+ gap: 0;+`;++const StyledCoreObjectTableRow = styled(TableRow)`+ border-radius: 0;++ &:not(:last-child) {+ border-bottom: 1px solid ${themeCssVariables.border.color.light};+ }+`;++export {+ StyledCoreObjectTableBody as CoreObjectTableBody,+ StyledCoreObjectTableRow as CoreObjectTableRow,+};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.tsxindex ea4440acd29..2971dafc970 100644--- a/packages/twenty-front/src/modules/object-core/components/cells/CoreObjectNameCell.tsx+++ b/packages/twenty-front/src/modules/object-core/components/cells/CoreObjectNameCell.tsx@@ -1,8 +1,10 @@import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';+import { TintedIconTile } from 'twenty-ui/data-display';import { type IconComponent } from 'twenty-ui/icon';import { OverflowingTextWithTooltip } from 'twenty-ui/surfaces';+import { type ThemeColor } from 'twenty-ui/theme';import { themeCssVariables } from 'twenty-ui/theme-constants';const StyledContainer = styled.div`@@ -23,15 +25,20 @@ const StyledIconContainer = styled.span`type CoreObjectNameCellProps = {name: string | null | undefined;Icon: IconComponent;+ iconColor?: ThemeColor;};-export const CoreObjectNameCell = ({ name, Icon }: CoreObjectNameCellProps) => {+export const CoreObjectNameCell = ({+ name,+ Icon,+ iconColor,+}: CoreObjectNameCellProps) => {const { t } = useLingui();return (<StyledContainer><StyledIconContainer>- <Icon size={16} />+ <TintedIconTile Icon={Icon} color={iconColor} size={16} /></StyledIconContainer><OverflowingTextWithTooltiptext={isNonEmptyString(name) ? name : t`Untitled`}diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterAddRuleButton.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterAddRuleButton.tsxnew file mode 100644index 00000000000..f443f8d9d83--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterAddRuleButton.tsx@@ -0,0 +1,30 @@+import { t } from '@lingui/core/macro';+import { type StepFilterGroup } from 'twenty-shared/types';+import { IconPlus } from 'twenty-ui/icon';++import { CommandMenuButton } from '@/command-menu/components/CommandMenuButton';+import { useAddStepFilterToGroup } from '@/workflow/workflow-steps/filters/hooks/useAddStepFilterToGroup';++type CoreWorkflowFilterAddRuleButtonProps = {+ stepFilterGroup: StepFilterGroup;+};++export const CoreWorkflowFilterAddRuleButton = ({+ stepFilterGroup,+}: CoreWorkflowFilterAddRuleButtonProps) => {+ const { addStepFilterToGroup } = useAddStepFilterToGroup({+ stepFilterGroup,+ });++ return (+ <CommandMenuButton+ command={{+ Icon: IconPlus,+ label: t`Add rule`,+ shortLabel: t`Add rule`,+ key: 'add-rule',+ }}+ onClick={addStepFilterToGroup}+ />+ );+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterColumn.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterColumn.tsxnew file mode 100644index 00000000000..a98e6acf4df--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterColumn.tsx@@ -0,0 +1,50 @@+import { styled } from '@linaria/react';+import { useContext } from 'react';+import { type StepFilter, type StepFilterGroup } from 'twenty-shared/types';+import { themeCssVariables } from 'twenty-ui/theme-constants';++import { CoreWorkflowFilterFieldSelect } from '@/object-core/workflows/components/CoreWorkflowFilterFieldSelect';+import { CoreWorkflowFilterValueInput } from '@/object-core/workflows/components/CoreWorkflowFilterValueInput';+import { AdvancedFilterSidePanelColumn } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelColumn';+import { WorkflowStepFilterLogicalOperatorCell } from '@/workflow/workflow-steps/filters/components/WorkflowStepFilterLogicalOperatorCell';+import { WorkflowStepFilterOperandSelect } from '@/workflow/workflow-steps/filters/components/WorkflowStepFilterOperandSelect';+import { WorkflowStepFilterOptionsDropdown } from '@/workflow/workflow-steps/filters/components/WorkflowStepFilterOptionsDropdown';+import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext';++type CoreWorkflowFilterColumnProps = {+ stepFilterGroup: StepFilterGroup;+ stepFilter: StepFilter;+ stepFilterIndex: number;+};++const StyledContainer = styled.div`+ display: flex;+ flex-direction: row;+ gap: ${themeCssVariables.spacing[1]};+ justify-content: space-between;+`;++export const CoreWorkflowFilterColumn = ({+ stepFilterGroup,+ stepFilter,+ stepFilterIndex,+}: CoreWorkflowFilterColumnProps) => {+ const { readonly } = useContext(WorkflowStepFilterContext);++ return (+ <AdvancedFilterSidePanelColumn>+ <StyledContainer>+ <WorkflowStepFilterLogicalOperatorCell+ index={stepFilterIndex}+ stepFilterGroup={stepFilterGroup}+ />+ {!readonly && (+ <WorkflowStepFilterOptionsDropdown stepFilterId={stepFilter.id} />+ )}+ </StyledContainer>+ <CoreWorkflowFilterFieldSelect stepFilter={stepFilter} />+ <WorkflowStepFilterOperandSelect stepFilter={stepFilter} />+ <CoreWorkflowFilterValueInput stepFilter={stepFilter} />+ </AdvancedFilterSidePanelColumn>+ );+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterFieldSelect.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterFieldSelect.tsxnew file mode 100644index 00000000000..bd4cad582e4--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterFieldSelect.tsx@@ -0,0 +1,63 @@+import { useLingui } from '@lingui/react/macro';+import { useContext } from 'react';+import { ViewFilterOperand, type StepFilter } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';++import { CORE_WORKFLOW_FILTER_FIELDS } from '@/object-core/workflows/constants/CoreWorkflowFilterFields';+import { findCoreWorkflowFilterField } from '@/object-core/workflows/utils/findCoreWorkflowFilterField';+import { Select } from '@/ui/input/components/Select';+import { useUpsertStepFilterSettings } from '@/workflow/workflow-steps/filters/hooks/useUpsertStepFilterSettings';+import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext';+import { getStepFilterOperands } from '@/workflow/workflow-steps/filters/utils/getStepFilterOperands';++type CoreWorkflowFilterFieldSelectProps = {+ stepFilter: StepFilter;+};++export const CoreWorkflowFilterFieldSelect = ({+ stepFilter,+}: CoreWorkflowFilterFieldSelectProps) => {+ const { t } = useLingui();+ const { readonly } = useContext(WorkflowStepFilterContext);+ const { upsertStepFilterSettings } = useUpsertStepFilterSettings();++ const handleFieldChange = (fieldKey: string) => {+ const selectedField = findCoreWorkflowFilterField(fieldKey);++ if (!isDefined(selectedField)) {+ return;+ }++ const [defaultOperand] = getStepFilterOperands({+ filterType: selectedField.filterType,+ subFieldName: undefined,+ });++ upsertStepFilterSettings({+ stepFilterToUpsert: {+ ...stepFilter,+ stepOutputKey: selectedField.key,+ type: selectedField.filterType,+ operand: defaultOperand ?? ViewFilterOperand.IS,+ value: '',+ },+ });+ };++ return (+ <Select+ dropdownId={`core-workflow-filter-field-${stepFilter.id}`}+ options={CORE_WORKFLOW_FILTER_FIELDS.map((field) => ({+ value: field.key,+ label: t(field.label),+ Icon: field.Icon,+ }))}+ value={stepFilter.stepOutputKey}+ onChange={handleFieldChange}+ disabled={readonly}+ fullWidth+ dropdownWidthAuto+ emptyOption={{ value: '', label: t`Select a field` }}+ />+ );+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterValueInput.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterValueInput.tsxnew file mode 100644index 00000000000..ea5c5bc6b28--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFilterValueInput.tsx@@ -0,0 +1,108 @@+import { useLingui } from '@lingui/react/macro';+import { useContext } from 'react';+import { ViewFilterOperand, type StepFilter } from 'twenty-shared/types';+import {+ isDefined,+ isRecordFilterOperandExpectingValue,+ safeParseRelativeDateFilterJsonStringified,+ type RelativeDateFilter,+} from 'twenty-shared/utils';++import { findCoreWorkflowFilterField } from '@/object-core/workflows/utils/findCoreWorkflowFilterField';+import { FormDateTimeFieldInput } from '@/object-record/record-field/ui/form-types/components/FormDateTimeFieldInput';+import { FormMultiSelectFieldInput } from '@/object-record/record-field/ui/form-types/components/FormMultiSelectFieldInput';+import { FormRelativeDatePicker } from '@/object-record/record-field/ui/form-types/components/FormRelativeDatePicker';+import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput';+import { stringifyRelativeDateFilter } from '@/views/view-filter-value/utils/stringifyRelativeDateFilter';+import { useUpsertStepFilterSettings } from '@/workflow/workflow-steps/filters/hooks/useUpsertStepFilterSettings';+import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext';++type CoreWorkflowFilterValueInputProps = {+ stepFilter: StepFilter;+};++export const CoreWorkflowFilterValueInput = ({+ stepFilter,+}: CoreWorkflowFilterValueInputProps) => {+ const { t } = useLingui();+ const { readonly } = useContext(WorkflowStepFilterContext);+ const { upsertStepFilterSettings } = useUpsertStepFilterSettings();++ const persistValue = (value: string) => {+ upsertStepFilterSettings({+ stepFilterToUpsert: { ...stepFilter, value },+ });+ };++ const selectedField = findCoreWorkflowFilterField(stepFilter.stepOutputKey);++ if (+ !isDefined(selectedField) ||+ !isRecordFilterOperandExpectingValue(stepFilter.operand)+ ) {+ return null;+ }++ if (selectedField.filterType === 'MULTI_SELECT') {+ return (+ <FormMultiSelectFieldInput+ key={`${stepFilter.id}-${stepFilter.operand}`}+ label=""+ defaultValue={stepFilter.value}+ options={(selectedField.options ?? []).map((option) => ({+ value: option.value,+ label: t(option.label),+ color: option.color,+ }))}+ onChange={(value) =>+ persistValue(+ typeof value === 'string' ? value : JSON.stringify(value),+ )+ }+ readonly={readonly}+ />+ );+ }++ if (selectedField.filterType === 'DATE_TIME') {+ if (stepFilter.operand === ViewFilterOperand.IS_RELATIVE) {+ const relativeDateFilter = safeParseRelativeDateFilterJsonStringified(+ stepFilter.value,+ );++ return (+ <FormRelativeDatePicker+ defaultValue={+ isDefined(relativeDateFilter)+ ? stringifyRelativeDateFilter(relativeDateFilter)+ : ''+ }+ onChange={(newRelativeDateFilter: RelativeDateFilter) =>+ persistValue(JSON.stringify(newRelativeDateFilter))+ }+ readonly={readonly}+ isDateTimeField+ />+ );+ }++ return (+ <FormDateTimeFieldInput+ key={`${stepFilter.id}-${stepFilter.operand}`}+ defaultValue={stepFilter.value}+ onChange={(value) => persistValue(value ?? '')}+ readonly={readonly}+ />+ );+ }++ return (+ <FormTextFieldInput+ key={`${stepFilter.id}-${stepFilter.operand}`}+ defaultValue={stepFilter.value}+ onChange={persistValue}+ readonly={readonly}+ placeholder={t`Enter value`}+ />+ );+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFiltersBuilder.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFiltersBuilder.tsxnew file mode 100644index 00000000000..5ea6999d9d4--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowFiltersBuilder.tsx@@ -0,0 +1,108 @@+import { styled } from '@linaria/react';+import { t } from '@lingui/core/macro';+import { type StepFilter } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';+import { InputLabel } from 'twenty-ui/input';+import { themeCssVariables } from 'twenty-ui/theme-constants';++import { CoreWorkflowFilterAddRuleButton } from '@/object-core/workflows/components/CoreWorkflowFilterAddRuleButton';+import { CoreWorkflowFilterColumn } from '@/object-core/workflows/components/CoreWorkflowFilterColumn';+import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';+import { WorkflowEditActionFilterBodyEffect } from '@/workflow/workflow-steps/filters/components/WorkflowEditActionFilterBodyEffect';+import { WorkflowStepFilterAddRootStepFilterButton } from '@/workflow/workflow-steps/filters/components/WorkflowStepFilterAddRootStepFilterButton';+import { useChildStepFiltersAndChildStepFilterGroups } from '@/workflow/workflow-steps/filters/hooks/useChildStepFiltersAndChildStepFilterGroups';+import { StepFilterGroupsComponentInstanceContext } from '@/workflow/workflow-steps/filters/states/context/StepFilterGroupsComponentInstanceContext';+import { StepFiltersComponentInstanceContext } from '@/workflow/workflow-steps/filters/states/context/StepFiltersComponentInstanceContext';+import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext';+import { rootLevelStepFilterGroupComponentSelector } from '@/workflow/workflow-steps/filters/states/rootLevelStepFilterGroupComponentSelector';+import { type FilterSettings } from '@/workflow/workflow-steps/filters/types/FilterSettings';+import { isStepFilterGroupChildAStepFilterGroup } from '@/workflow/workflow-steps/filters/utils/isStepFilterGroupChildAStepFilterGroup';++const StyledContainer = styled.div`+ align-items: start;+ display: flex;+ flex-direction: column;+ gap: ${themeCssVariables.spacing[2]};+`;++const StyledChildContainer = styled.div`+ display: flex;+ flex-direction: column;+ gap: ${themeCssVariables.spacing[6]};+ width: 100%;+`;++const StyledConditions = styled.div`+ display: flex;+ flex-direction: column;+ row-gap: ${themeCssVariables.spacing[0]};+`;++type CoreWorkflowFiltersBuilderProps = {+ instanceId: string;+ defaultValue?: FilterSettings;+ onFilterSettingsUpdate: (filterSettings: FilterSettings) => void;+};++const CoreWorkflowFiltersBuilderConditions = () => {+ const rootStepFilterGroup = useAtomComponentSelectorValue(+ rootLevelStepFilterGroupComponentSelector,+ );++ const { childStepFiltersAndChildStepFilterGroups } =+ useChildStepFiltersAndChildStepFilterGroups({+ stepFilterGroupId: rootStepFilterGroup?.id ?? '',+ });++ return (+ <StyledConditions>+ <InputLabel>{t`Conditions`}</InputLabel>+ {isDefined(rootStepFilterGroup) ? (+ <StyledContainer>+ <StyledChildContainer>+ {childStepFiltersAndChildStepFilterGroups+ .filter(+ (stepFilterGroupChild): stepFilterGroupChild is StepFilter =>+ !isStepFilterGroupChildAStepFilterGroup(stepFilterGroupChild),+ )+ .map((stepFilter, stepFilterIndex) => (+ <CoreWorkflowFilterColumn+ key={stepFilter.id}+ stepFilterGroup={rootStepFilterGroup}+ stepFilter={stepFilter}+ stepFilterIndex={stepFilterIndex}+ />+ ))}+ </StyledChildContainer>+ <CoreWorkflowFilterAddRuleButton+ stepFilterGroup={rootStepFilterGroup}+ />+ </StyledContainer>+ ) : (+ <WorkflowStepFilterAddRootStepFilterButton />+ )}+ </StyledConditions>+ );+};++export const CoreWorkflowFiltersBuilder = ({+ instanceId,+ defaultValue,+ onFilterSettingsUpdate,+}: CoreWorkflowFiltersBuilderProps) => {+ return (+ <StepFiltersComponentInstanceContext.Provider value={{ instanceId }}>+ <StepFilterGroupsComponentInstanceContext.Provider value={{ instanceId }}>+ <WorkflowStepFilterContext.Provider+ value={{+ stepId: instanceId,+ onFilterSettingsUpdate,+ }}+ >+ <CoreWorkflowFiltersBuilderConditions />+ </WorkflowStepFilterContext.Provider>+ <WorkflowEditActionFilterBodyEffect defaultValue={defaultValue} />+ </StepFilterGroupsComponentInstanceContext.Provider>+ </StepFiltersComponentInstanceContext.Provider>+ );+};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.tsxindex b8d8be058c0..addbb8e7f27 100644--- a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowNameCell.tsx+++ b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowNameCell.tsx@@ -1,20 +1,29 @@import { CoreObjectNameSingular } from 'twenty-shared/types';import { useIcons } from 'twenty-ui/icon';+import { stringToThemeColor } from 'twenty-ui/utilities';import { CoreObjectNameCell } from '@/object-core/components/cells/CoreObjectNameCell';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';type CoreWorkflowNameCellProps = {name: string | null | undefined;+ workflowId: string;};-export const CoreWorkflowNameCell = ({ name }: CoreWorkflowNameCellProps) => {+export const CoreWorkflowNameCell = ({+ name,+ workflowId,+}: CoreWorkflowNameCellProps) => {const { objectMetadataItem } = useObjectMetadataItem({objectNameSingular: CoreObjectNameSingular.Workflow,});const { getIcon } = useIcons();return (- <CoreObjectNameCell name={name} Icon={getIcon(objectMetadataItem.icon)} />+ <CoreObjectNameCell+ name={name}+ Icon={getIcon(objectMetadataItem.icon)}+ iconColor={stringToThemeColor(workflowId)}+ />);};diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowsFilterBar.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowsFilterBar.tsxnew file mode 100644index 00000000000..06bd6012253--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowsFilterBar.tsx@@ -0,0 +1,71 @@+import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';+import { IconFilter } from 'twenty-ui/icon';+import { IconButton } from 'twenty-ui/input';+import { themeCssVariables } from 'twenty-ui/theme-constants';++import { findCoreWorkflowFilterField } from '@/object-core/workflows/utils/findCoreWorkflowFilterField';+import { useOpenCoreWorkflowFiltersSidePanel } from '@/object-core/workflows/hooks/useOpenCoreWorkflowFiltersSidePanel';+import { coreWorkflowsFilterSettingsState } from '@/object-core/workflows/states/coreWorkflowsFilterSettingsState';+import { getCoreWorkflowFilterChipLabel } from '@/object-core/workflows/utils/getCoreWorkflowFilterChipLabel';+import { isUsableCoreWorkflowFilterRule } from '@/object-core/workflows/utils/isUsableCoreWorkflowFilterRule';+import { MAX_CORE_WORKFLOW_FILTER_RULES } from 'twenty-shared/constants';+import { removeCoreWorkflowFilterRule } from '@/object-core/workflows/utils/removeCoreWorkflowFilterRule';+import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { SortOrFilterChip } from '@/views/components/SortOrFilterChip';++const StyledContainer = styled.div`+ align-items: center;+ display: flex;+ flex-wrap: wrap;+ gap: ${themeCssVariables.spacing[2]};+ min-width: 0;+`;++export const CoreWorkflowsFilterBar = () => {+ const { t } = useLingui();+ const { openCoreWorkflowFiltersSidePanel } =+ useOpenCoreWorkflowFiltersSidePanel();++ const [coreWorkflowsFilterSettings, setCoreWorkflowsFilterSettings] =+ useAtomState(coreWorkflowsFilterSettingsState);+ const { userTimezone } = useUserTimezone();++ const appliedStepFilters = (coreWorkflowsFilterSettings.stepFilters ?? [])+ .filter(isUsableCoreWorkflowFilterRule)+ .slice(0, MAX_CORE_WORKFLOW_FILTER_RULES);++ return (+ <StyledContainer>+ {appliedStepFilters.map((stepFilter) => (+ <SortOrFilterChip+ key={stepFilter.id}+ type="filter"+ labelValue={getCoreWorkflowFilterChipLabel({+ stepFilter,+ timezone: userTimezone,+ })}+ Icon={findCoreWorkflowFilterField(stepFilter.stepOutputKey)?.Icon}+ testId={`core-workflow-filter-${stepFilter.id}`}+ onClick={openCoreWorkflowFiltersSidePanel}+ onRemove={() =>+ setCoreWorkflowsFilterSettings((previousFilterSettings) =>+ removeCoreWorkflowFilterRule({+ filterSettings: previousFilterSettings,+ stepFilterId: stepFilter.id,+ }),+ )+ }+ />+ ))}+ <IconButton+ Icon={IconFilter}+ variant="secondary"+ size="medium"+ ariaLabel={t`Filter`}+ onClick={openCoreWorkflowFiltersSidePanel}+ />+ </StyledContainer>+ );+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/SidePanelCoreWorkflowFiltersPage.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/SidePanelCoreWorkflowFiltersPage.tsxnew file mode 100644index 00000000000..538ab317b07--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/components/SidePanelCoreWorkflowFiltersPage.tsx@@ -0,0 +1,30 @@+import { styled } from '@linaria/react';+import { themeCssVariables } from 'twenty-ui/theme-constants';++import { CoreWorkflowFiltersBuilder } from '@/object-core/workflows/components/CoreWorkflowFiltersBuilder';+import {+ CORE_WORKFLOWS_FILTER_INSTANCE_ID,+ coreWorkflowsFilterSettingsState,+} from '@/object-core/workflows/states/coreWorkflowsFilterSettingsState';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';++const StyledPageContainer = styled.div`+ display: flex;+ flex-direction: column;+ padding: ${themeCssVariables.spacing[2]};+`;++export const SidePanelCoreWorkflowFiltersPage = () => {+ const [coreWorkflowsFilterSettings, setCoreWorkflowsFilterSettings] =+ useAtomState(coreWorkflowsFilterSettingsState);++ return (+ <StyledPageContainer>+ <CoreWorkflowFiltersBuilder+ instanceId={CORE_WORKFLOWS_FILTER_INSTANCE_ID}+ defaultValue={coreWorkflowsFilterSettings}+ onFilterSettingsUpdate={setCoreWorkflowsFilterSettings}+ />+ </StyledPageContainer>+ );+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterFields.ts b/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterFields.tsnew file mode 100644index 00000000000..825d07e918d--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterFields.ts@@ -0,0 +1,51 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import {+ IconCalendarTime,+ IconStatusChange,+ IconTextSize,+ type IconComponent,+} from 'twenty-ui/icon';+import { type ThemeColor } from 'twenty-ui/theme';++import { CORE_WORKFLOW_STATUS_FILTER_OPTIONS } from '@/object-core/workflows/constants/CoreWorkflowStatusFilterOptions';+import { CoreWorkflowFilterFieldKey } from '~/generated/graphql';++export type CoreWorkflowFilterFieldType = 'TEXT' | 'MULTI_SELECT' | 'DATE_TIME';++export type CoreWorkflowFilterFieldOption = {+ value: string;+ label: MessageDescriptor;+ color: ThemeColor;+};++export type CoreWorkflowFilterFieldDefinition = {+ key: CoreWorkflowFilterFieldKey;+ label: MessageDescriptor;+ filterType: CoreWorkflowFilterFieldType;+ Icon: IconComponent;+ options?: CoreWorkflowFilterFieldOption[];+};++export const CORE_WORKFLOW_FILTER_FIELDS: CoreWorkflowFilterFieldDefinition[] =+ [+ {+ key: CoreWorkflowFilterFieldKey.NAME,+ label: msg`Name`,+ filterType: 'TEXT',+ Icon: IconTextSize,+ },+ {+ key: CoreWorkflowFilterFieldKey.STATUSES,+ label: msg`Statuses`,+ filterType: 'MULTI_SELECT',+ Icon: IconStatusChange,+ options: CORE_WORKFLOW_STATUS_FILTER_OPTIONS,+ },+ {+ key: CoreWorkflowFilterFieldKey.UPDATED_AT,+ label: msg`Last update`,+ filterType: 'DATE_TIME',+ Icon: IconCalendarTime,+ },+ ];diff --git a/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterOperandByViewFilterOperand.ts b/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterOperandByViewFilterOperand.tsnew file mode 100644index 00000000000..b0083b7c1b5--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterOperandByViewFilterOperand.ts@@ -0,0 +1,20 @@+import { ViewFilterOperand } from 'twenty-shared/types';++import { CoreWorkflowFilterOperand } from '~/generated/graphql';++export const CORE_WORKFLOW_FILTER_OPERAND_BY_VIEW_FILTER_OPERAND: Partial<+ Record<ViewFilterOperand, CoreWorkflowFilterOperand>+> = {+ [ViewFilterOperand.CONTAINS]: CoreWorkflowFilterOperand.CONTAINS,+ [ViewFilterOperand.DOES_NOT_CONTAIN]:+ CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,+ [ViewFilterOperand.IS]: CoreWorkflowFilterOperand.IS,+ [ViewFilterOperand.IS_EMPTY]: CoreWorkflowFilterOperand.IS_EMPTY,+ [ViewFilterOperand.IS_NOT_EMPTY]: CoreWorkflowFilterOperand.IS_NOT_EMPTY,+ [ViewFilterOperand.IS_BEFORE]: CoreWorkflowFilterOperand.IS_BEFORE,+ [ViewFilterOperand.IS_AFTER]: CoreWorkflowFilterOperand.IS_AFTER,+ [ViewFilterOperand.IS_IN_PAST]: CoreWorkflowFilterOperand.IS_IN_PAST,+ [ViewFilterOperand.IS_IN_FUTURE]: CoreWorkflowFilterOperand.IS_IN_FUTURE,+ [ViewFilterOperand.IS_TODAY]: CoreWorkflowFilterOperand.IS_TODAY,+ [ViewFilterOperand.IS_RELATIVE]: CoreWorkflowFilterOperand.IS_RELATIVE,+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowStatusFilterOptions.ts b/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowStatusFilterOptions.tsnew file mode 100644index 00000000000..a72a50144b7--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowStatusFilterOptions.ts@@ -0,0 +1,30 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import { type ThemeColor } from 'twenty-ui/theme';++import { CoreWorkflowStatus } from '~/generated/graphql';++export type CoreWorkflowStatusFilterOption = {+ value: CoreWorkflowStatus;+ label: MessageDescriptor;+ color: ThemeColor;+};++export const CORE_WORKFLOW_STATUS_FILTER_OPTIONS: CoreWorkflowStatusFilterOption[] =+ [+ {+ value: CoreWorkflowStatus.DRAFT,+ label: msg`Draft`,+ color: 'yellow',+ },+ {+ value: CoreWorkflowStatus.ACTIVE,+ label: msg`Active`,+ color: 'green',+ },+ {+ value: CoreWorkflowStatus.DEACTIVATED,+ label: msg`Deactivated`,+ color: 'gray',+ },+ ];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.tsxindex d3ed1b1aec0..3f24e27a426 100644--- a/packages/twenty-front/src/modules/object-core/workflows/constants/WorkflowCoreTableColumns.tsx+++ b/packages/twenty-front/src/modules/object-core/workflows/constants/WorkflowCoreTableColumns.tsx@@ -1,6 +1,5 @@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';@@ -15,24 +14,17 @@ export const WORKFLOW_CORE_TABLE_COLUMNS: CoreObjectTableColumn<CoreWorkflow>[]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} />+ <CoreWorkflowNameCell name={workflow.name} workflowId={workflow.id} />),},{- fieldName: 'applicationId',- fieldLabel: msg`App`,+ fieldName: 'statuses',+ fieldLabel: msg`Statuses`,align: 'left',gridTrack: '160px',renderCell: (workflow) => (- <AppChip applicationId={workflow.applicationId} />+ <CoreWorkflowStatusesCell statuses={workflow.statuses} />),},{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.tsindex 9d56eb7f5b2..60117d2106b 100644--- 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.ts@@ -6,19 +6,20 @@ export const GET_CORE_WORKFLOWS = gql`$after: String$orderBy: CoreWorkflowOrderByField$orderByDirection: CoreWorkflowOrderByDirection+ $filter: CoreWorkflowFilterInput) {coreWorkflows(first: $firstafter: $afterorderBy: $orderByorderByDirection: $orderByDirection+ filter: $filter) {edges {node {idnamestatuses- applicationIdworkspaceWorkflowIdupdatedAt}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.tsindex 2d20da0390a..6ddff0379e2 100644--- a/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflows.ts+++ b/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflows.ts@@ -3,10 +3,14 @@ import { useState } from 'react';import { useQuery } from '@apollo/client/react';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';+import { coreWorkflowsFilterSettingsState } from '@/object-core/workflows/states/coreWorkflowsFilterSettingsState';+import { buildCoreWorkflowFilterInput } from '@/object-core/workflows/utils/buildCoreWorkflowFilterInput';+import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone';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 { useWorkspaceSurfaceScopedComponentInstanceId } from '@/ui/layout/hooks/useWorkspaceSurfaceScopedComponentInstanceId';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import {CoreWorkflowOrderByDirection,CoreWorkflowOrderByField,@@ -49,9 +53,19 @@ export const useCoreWorkflows = ({? CoreWorkflowOrderByDirection.ASC: CoreWorkflowOrderByDirection.DESC;+ const coreWorkflowsFilterSettings = useAtomStateValue(+ coreWorkflowsFilterSettingsState,+ );++ const { userTimezone } = useUserTimezone();+ const filter = buildCoreWorkflowFilterInput({+ filterSettings: coreWorkflowsFilterSettings,+ timezone: userTimezone,+ });+const [isFetchingMore, setIsFetchingMore] = useState(false);- const { data, loading, error, fetchMore } = useQuery(+ const { data, previousData, loading, error, fetchMore } = useQuery(GetCoreWorkflowsDocument,{client: apolloCoreClient,@@ -61,11 +75,11 @@ export const useCoreWorkflows = ({first: CORE_WORKFLOWS_PAGE_SIZE,orderBy,orderByDirection,+ filter,},},);-- const connection = data?.coreWorkflows;+ const connection = (data ?? previousData)?.coreWorkflows;const fetchNextPage = async () => {if (connection?.pageInfo.hasNextPage !== true || isFetchingMore) {diff --git a/packages/twenty-front/src/modules/object-core/workflows/hooks/useOpenCoreWorkflowFiltersSidePanel.ts b/packages/twenty-front/src/modules/object-core/workflows/hooks/useOpenCoreWorkflowFiltersSidePanel.tsnew file mode 100644index 00000000000..1dc9ed4590d--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/hooks/useOpenCoreWorkflowFiltersSidePanel.ts@@ -0,0 +1,21 @@+import { useLingui } from '@lingui/react/macro';+import { SidePanelPages } from 'twenty-shared/types';+import { IconFilter } from 'twenty-ui/icon';++import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel';++export const useOpenCoreWorkflowFiltersSidePanel = () => {+ const { t } = useLingui();+ const { navigateSidePanel } = useNavigateSidePanel();++ const openCoreWorkflowFiltersSidePanel = () => {+ navigateSidePanel({+ page: SidePanelPages.WorkflowCoreFilters,+ pageTitle: t`Filter`,+ pageIcon: IconFilter,+ resetNavigationStack: true,+ });+ };++ return { openCoreWorkflowFiltersSidePanel };+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/states/coreWorkflowsFilterSettingsState.ts b/packages/twenty-front/src/modules/object-core/workflows/states/coreWorkflowsFilterSettingsState.tsnew file mode 100644index 00000000000..37c21423a09--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/states/coreWorkflowsFilterSettingsState.ts@@ -0,0 +1,20 @@+import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';+import { type FilterSettings } from '@/workflow/workflow-steps/filters/types/FilterSettings';++export const CORE_WORKFLOWS_FILTER_INSTANCE_ID = 'core-workflows-filters';++export const coreWorkflowsFilterSettingsState = createAtomState<FilterSettings>(+ {+ key: 'coreWorkflowsFilterSettingsState',+ defaultValue: {},+ useLocalStorage: true,+ localStorageOptions: { getOnInit: true },+ validateInitFn: (filterSettings) =>+ typeof filterSettings === 'object' &&+ filterSettings !== null &&+ (!('stepFilters' in filterSettings) ||+ Array.isArray(filterSettings.stepFilters)) &&+ (!('stepFilterGroups' in filterSettings) ||+ Array.isArray(filterSettings.stepFilterGroups)),+ },+);diff --git a/packages/twenty-front/src/modules/object-core/workflows/utils/__tests__/buildCoreWorkflowFilterInput.test.ts b/packages/twenty-front/src/modules/object-core/workflows/utils/__tests__/buildCoreWorkflowFilterInput.test.tsnew file mode 100644index 00000000000..8fee51a0a3f--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/utils/__tests__/buildCoreWorkflowFilterInput.test.ts@@ -0,0 +1,158 @@+import {+ StepLogicalOperator,+ ViewFilterOperand,+ type StepFilter,+} from 'twenty-shared/types';++import { CORE_WORKFLOW_FILTER_FIELDS } from '@/object-core/workflows/constants/CoreWorkflowFilterFields';+import { buildCoreWorkflowFilterInput } from '@/object-core/workflows/utils/buildCoreWorkflowFilterInput';+import { getStepFilterOperands } from '@/workflow/workflow-steps/filters/utils/getStepFilterOperands';+import {+ CoreWorkflowFilterFieldKey,+ CoreWorkflowFilterLogicalOperator,+ CoreWorkflowFilterOperand,+} from '~/generated/graphql';++const buildStepFilter = (overrides: Partial<StepFilter> = {}): StepFilter => ({+ id: 'filter-1',+ type: 'TEXT',+ stepOutputKey: CoreWorkflowFilterFieldKey.NAME,+ operand: ViewFilterOperand.CONTAINS,+ value: 'sync',+ stepFilterGroupId: 'group-1',+ positionInStepFilterGroup: 1,+ ...overrides,+});++describe('buildCoreWorkflowFilterInput', () => {+ it('should return undefined when there is no usable rule', () => {+ expect(+ buildCoreWorkflowFilterInput({ filterSettings: {} }),+ ).toBeUndefined();+ expect(+ buildCoreWorkflowFilterInput({+ filterSettings: { stepFilters: [buildStepFilter({ value: '' })] },+ }),+ ).toBeUndefined();+ });++ it('should map a text rule', () => {+ expect(+ buildCoreWorkflowFilterInput({+ filterSettings: { stepFilters: [buildStepFilter()] },+ }),+ ).toEqual({+ logicalOperator: CoreWorkflowFilterLogicalOperator.AND,+ rules: [+ {+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: 'sync',+ timezone: null,+ },+ ],+ });+ });++ it('should keep the root logical operator', () => {+ expect(+ buildCoreWorkflowFilterInput({+ filterSettings: {+ stepFilters: [buildStepFilter()],+ stepFilterGroups: [+ { id: 'group-1', logicalOperator: StepLogicalOperator.OR },+ ],+ },+ })?.logicalOperator,+ ).toBe(CoreWorkflowFilterLogicalOperator.OR);+ });++ it('should send no value for value-less operands', () => {+ expect(+ buildCoreWorkflowFilterInput({+ filterSettings: {+ stepFilters: [+ buildStepFilter({ operand: ViewFilterOperand.IS_EMPTY, value: '' }),+ ],+ },+ })?.rules[0],+ ).toEqual({+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand: CoreWorkflowFilterOperand.IS_EMPTY,+ value: null,+ timezone: null,+ });+ });++ it('should stamp the timezone on date rules only', () => {+ const rules = buildCoreWorkflowFilterInput({+ filterSettings: {+ stepFilters: [+ buildStepFilter(),+ buildStepFilter({+ id: 'filter-2',+ stepOutputKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: ViewFilterOperand.IS_TODAY,+ value: '',+ }),+ ],+ },+ timezone: 'Asia/Tokyo',+ })?.rules;++ expect(rules?.[0].timezone).toBeNull();+ expect(rules?.[1].timezone).toBe('Asia/Tokyo');+ });++ it('should drop a rule whose multi select value has no option left', () => {+ expect(+ buildCoreWorkflowFilterInput({+ filterSettings: {+ stepFilters: [+ buildStepFilter({+ stepOutputKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand: ViewFilterOperand.CONTAINS,+ value: JSON.stringify([]),+ }),+ ],+ },+ }),+ ).toBeUndefined();+ });++ it('should drop rules on unknown fields', () => {+ expect(+ buildCoreWorkflowFilterInput({+ filterSettings: {+ stepFilters: [buildStepFilter({ stepOutputKey: 'unknown' })],+ },+ }),+ ).toBeUndefined();+ });++ const fieldOperandPairs = CORE_WORKFLOW_FILTER_FIELDS.flatMap((field) =>+ getStepFilterOperands({+ filterType: field.filterType,+ subFieldName: undefined,+ }).map((operand) => [field.key, operand] as const),+ );++ it.each(fieldOperandPairs)(+ 'should map every operand the builder offers on %s (%s)',+ (fieldKey, operand) => {+ const rules = buildCoreWorkflowFilterInput({+ filterSettings: {+ stepFilters: [+ buildStepFilter({+ stepOutputKey: fieldKey,+ operand,+ value: 'sync',+ }),+ ],+ },+ })?.rules;++ expect(rules).toHaveLength(1);+ },+ );+});diff --git a/packages/twenty-front/src/modules/object-core/workflows/utils/buildCoreWorkflowFilterInput.ts b/packages/twenty-front/src/modules/object-core/workflows/utils/buildCoreWorkflowFilterInput.tsnew file mode 100644index 00000000000..3565e5c2c02--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/utils/buildCoreWorkflowFilterInput.ts@@ -0,0 +1,72 @@+import { MAX_CORE_WORKFLOW_FILTER_RULES } from 'twenty-shared/constants';+import { StepLogicalOperator, type StepFilter } from 'twenty-shared/types';+import {+ isDefined,+ isRecordFilterOperandExpectingValue,+} from 'twenty-shared/utils';++import { CORE_WORKFLOW_FILTER_OPERAND_BY_VIEW_FILTER_OPERAND } from '@/object-core/workflows/constants/CoreWorkflowFilterOperandByViewFilterOperand';+import { findCoreWorkflowFilterField } from '@/object-core/workflows/utils/findCoreWorkflowFilterField';+import { isUsableCoreWorkflowFilterRule } from '@/object-core/workflows/utils/isUsableCoreWorkflowFilterRule';+import { type FilterSettings } from '@/workflow/workflow-steps/filters/types/FilterSettings';+import {+ CoreWorkflowFilterLogicalOperator,+ type CoreWorkflowFilterInput,+ type CoreWorkflowFilterRuleInput,+} from '~/generated/graphql';++const toCoreWorkflowFilterRule = ({+ stepFilter,+ timezone,+}: {+ stepFilter: StepFilter;+ timezone: string | undefined;+}): CoreWorkflowFilterRuleInput | undefined => {+ const selectedField = findCoreWorkflowFilterField(stepFilter.stepOutputKey);+ const operand =+ CORE_WORKFLOW_FILTER_OPERAND_BY_VIEW_FILTER_OPERAND[stepFilter.operand];++ if (!isDefined(selectedField) || !isDefined(operand)) {+ return undefined;+ }++ const expectsValue = isRecordFilterOperandExpectingValue(stepFilter.operand);++ return {+ fieldKey: selectedField.key,+ operand,+ value: expectsValue ? stepFilter.value : null,+ timezone:+ selectedField.filterType === 'DATE_TIME' && isDefined(timezone)+ ? timezone+ : null,+ };+};++export const buildCoreWorkflowFilterInput = ({+ filterSettings,+ timezone,+}: {+ filterSettings: FilterSettings;+ timezone?: string;+}): CoreWorkflowFilterInput | undefined => {+ const rules = (filterSettings.stepFilters ?? [])+ .filter(isUsableCoreWorkflowFilterRule)+ .slice(0, MAX_CORE_WORKFLOW_FILTER_RULES)+ .map((stepFilter) => toCoreWorkflowFilterRule({ stepFilter, timezone }))+ .filter(isDefined);++ if (rules.length === 0) {+ return undefined;+ }++ const [rootStepFilterGroup] = filterSettings.stepFilterGroups ?? [];++ return {+ logicalOperator:+ rootStepFilterGroup?.logicalOperator === StepLogicalOperator.OR+ ? CoreWorkflowFilterLogicalOperator.OR+ : CoreWorkflowFilterLogicalOperator.AND,+ rules,+ };+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/utils/findCoreWorkflowFilterField.ts b/packages/twenty-front/src/modules/object-core/workflows/utils/findCoreWorkflowFilterField.tsnew file mode 100644index 00000000000..7e9867a3a35--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/utils/findCoreWorkflowFilterField.ts@@ -0,0 +1,4 @@+import { CORE_WORKFLOW_FILTER_FIELDS } from '@/object-core/workflows/constants/CoreWorkflowFilterFields';++export const findCoreWorkflowFilterField = (fieldKey: string | undefined) =>+ CORE_WORKFLOW_FILTER_FIELDS.find((field) => field.key === fieldKey);diff --git a/packages/twenty-front/src/modules/object-core/workflows/utils/getCoreWorkflowFilterChipLabel.ts b/packages/twenty-front/src/modules/object-core/workflows/utils/getCoreWorkflowFilterChipLabel.tsnew file mode 100644index 00000000000..3fb9e8db804--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/utils/getCoreWorkflowFilterChipLabel.ts@@ -0,0 +1,89 @@+import { t } from '@lingui/core/macro';+import { ViewFilterOperand, type StepFilter } from 'twenty-shared/types';+import {+ isDefined,+ parseJson,+ safeParseRelativeDateFilterJsonStringified,+} from 'twenty-shared/utils';++import { type CoreWorkflowFilterFieldDefinition } from '@/object-core/workflows/constants/CoreWorkflowFilterFields';+import { findCoreWorkflowFilterField } from '@/object-core/workflows/utils/findCoreWorkflowFilterField';+import { getOperandLabelShort } from '@/object-record/object-filter-dropdown/utils/getOperandLabel';+import { getRelativeDateDisplayValue } from '@/object-record/object-filter-dropdown/utils/getRelativeDateDisplayValue';++const getReadableValue = ({+ stepFilter,+ selectedField,+ timezone,+}: {+ stepFilter: StepFilter;+ selectedField: CoreWorkflowFilterFieldDefinition;+ timezone: string | undefined;+}): string => {+ if (stepFilter.operand === ViewFilterOperand.IS_RELATIVE) {+ const relativeDateFilter = safeParseRelativeDateFilterJsonStringified(+ stepFilter.value,+ );++ return isDefined(relativeDateFilter)+ ? getRelativeDateDisplayValue(relativeDateFilter)+ : '';+ }++ if (selectedField.filterType === 'MULTI_SELECT') {+ const parsedValue = parseJson<string[]>(stepFilter.value);+ const selectedValues = Array.isArray(parsedValue)+ ? parsedValue+ : [stepFilter.value];++ return selectedValues+ .map((value) => {+ const option = selectedField.options?.find(+ (fieldOption) => fieldOption.value === value,+ );++ return isDefined(option) ? t(option.label) : value;+ })+ .join(', ');+ }++ if (selectedField.filterType === 'DATE_TIME') {+ const parsedValue = parseJson<string>(stepFilter.value);+ const date = new Date(+ typeof parsedValue === 'string' ? parsedValue : stepFilter.value,+ );++ return Number.isNaN(date.getTime())+ ? ''+ : new Intl.DateTimeFormat(undefined, {+ dateStyle: 'medium',+ timeStyle: 'short',+ timeZone: timezone,+ }).format(date);+ }++ return stepFilter.value;+};++export const getCoreWorkflowFilterChipLabel = ({+ stepFilter,+ timezone,+}: {+ stepFilter: StepFilter;+ timezone?: string;+}): string => {+ const selectedField = findCoreWorkflowFilterField(stepFilter.stepOutputKey);++ if (!isDefined(selectedField)) {+ return '';+ }++ const readableValue = getReadableValue({+ stepFilter,+ selectedField,+ timezone,+ });+ const operandLabel = getOperandLabelShort(stepFilter.operand);++ return `${t(selectedField.label)} ${operandLabel} ${readableValue}`.trim();+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/utils/isUsableCoreWorkflowFilterRule.ts b/packages/twenty-front/src/modules/object-core/workflows/utils/isUsableCoreWorkflowFilterRule.tsnew file mode 100644index 00000000000..abc96829448--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/utils/isUsableCoreWorkflowFilterRule.ts@@ -0,0 +1,45 @@+import { type StepFilter } from 'twenty-shared/types';+import {+ isDefined,+ isRecordFilterOperandExpectingValue,+ parseJson,+} from 'twenty-shared/utils';++import { CORE_WORKFLOW_FILTER_OPERAND_BY_VIEW_FILTER_OPERAND } from '@/object-core/workflows/constants/CoreWorkflowFilterOperandByViewFilterOperand';+import { type CoreWorkflowFilterFieldDefinition } from '@/object-core/workflows/constants/CoreWorkflowFilterFields';+import { findCoreWorkflowFilterField } from '@/object-core/workflows/utils/findCoreWorkflowFilterField';++const isEmptyValue = ({+ value,+ selectedField,+}: {+ value: string;+ selectedField: CoreWorkflowFilterFieldDefinition;+}): boolean => {+ if (selectedField.filterType === 'MULTI_SELECT') {+ const parsedValue = parseJson<unknown>(value);++ return Array.isArray(parsedValue)+ ? parsedValue.length === 0+ : value.trim() === '';+ }++ return value.trim() === '';+};++export const isUsableCoreWorkflowFilterRule = (+ stepFilter: StepFilter,+): boolean => {+ const selectedField = findCoreWorkflowFilterField(stepFilter.stepOutputKey);+ const operand =+ CORE_WORKFLOW_FILTER_OPERAND_BY_VIEW_FILTER_OPERAND[stepFilter.operand];++ if (!isDefined(selectedField) || !isDefined(operand)) {+ return false;+ }++ return (+ !isRecordFilterOperandExpectingValue(stepFilter.operand) ||+ !isEmptyValue({ value: stepFilter.value, selectedField })+ );+};diff --git a/packages/twenty-front/src/modules/object-core/workflows/utils/removeCoreWorkflowFilterRule.ts b/packages/twenty-front/src/modules/object-core/workflows/utils/removeCoreWorkflowFilterRule.tsnew file mode 100644index 00000000000..c6d5fd85791--- /dev/null+++ b/packages/twenty-front/src/modules/object-core/workflows/utils/removeCoreWorkflowFilterRule.ts@@ -0,0 +1,14 @@+import { type FilterSettings } from '@/workflow/workflow-steps/filters/types/FilterSettings';++export const removeCoreWorkflowFilterRule = ({+ filterSettings,+ stepFilterId,+}: {+ filterSettings: FilterSettings;+ stepFilterId: string;+}): FilterSettings => ({+ ...filterSettings,+ stepFilters: (filterSettings.stepFilters ?? []).filter(+ (stepFilter) => stepFilter.id !== stepFilterId,+ ),+});diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelPagesConfig.tsx b/packages/twenty-front/src/modules/side-panel/constants/SidePanelPagesConfig.tsxindex 0f61742fd9c..d63adc675ed 100644--- a/packages/twenty-front/src/modules/side-panel/constants/SidePanelPagesConfig.tsx+++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelPagesConfig.tsx@@ -1,6 +1,7 @@import { SidePanelCommandMenuItemDisplayPage } from '@/command-menu-item/display/components/SidePanelCommandMenuItemDisplayPage';import { SidePanelCommandMenuItemEditPage } from '@/command-menu-item/edit/components/SidePanelCommandMenuItemEditPage';import { SidePanelNavigationMenuItemEditPage } from '@/navigation-menu-item/edit/side-panel/components/SidePanelNavigationMenuItemEditPage';+import { SidePanelCoreWorkflowFiltersPage } from '@/object-core/workflows/components/SidePanelCoreWorkflowFiltersPage';import { SidePanelSettingsMetadataTranslationsPage } from '@/settings/translations/components/SidePanelSettingsMetadataTranslationsPage';import { SidePanelRoutedPage } from '@/side-panel/routing/components/SidePanelRoutedPage';import { SidePanelNewSidebarItemPage } from '@/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemPage';@@ -99,4 +100,5 @@ export const SIDE_PANEL_PAGES_CONFIG = new Map<<SidePanelSettingsMetadataTranslationsPage />,],[SidePanelPages.RoutedPage, <SidePanelRoutedPage />],+ [SidePanelPages.WorkflowCoreFilters, <SidePanelCoreWorkflowFiltersPage />],]);diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterAddFilterRuleSelect.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterAddFilterRuleSelect.tsxindex 170a6490f3a..a26e3ef0939 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterAddFilterRuleSelect.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterAddFilterRuleSelect.tsx@@ -4,14 +4,11 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';+import { useAddStepFilterToGroup } from '@/workflow/workflow-steps/filters/hooks/useAddStepFilterToGroup';import { useChildStepFiltersAndChildStepFilterGroups } from '@/workflow/workflow-steps/filters/hooks/useChildStepFiltersAndChildStepFilterGroups';import { useUpsertStepFilterSettings } from '@/workflow/workflow-steps/filters/hooks/useUpsertStepFilterSettings';-import {- StepLogicalOperator,- ViewFilterOperand,- type StepFilter,- type StepFilterGroup,-} from 'twenty-shared/types';+import { buildEmptyStepFilter } from '@/workflow/workflow-steps/filters/utils/buildEmptyStepFilter';+import { StepLogicalOperator, type StepFilterGroup } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { t } from '@lingui/core/macro';import { IconLibraryPlus, IconPlus } from 'twenty-ui/icon';@@ -22,16 +19,6 @@ type WorkflowStepFilterAddFilterRuleSelectProps = {stepFilterGroup: StepFilterGroup;};-const BASE_NEW_STEP_FILTER = {- type: 'unknown',- label: '',- value: '',- operand: ViewFilterOperand.IS,- displayValue: '',- stepFilterGroupId: '',- stepOutputKey: '',-};-export const WorkflowStepFilterAddFilterRuleSelect = ({stepFilterGroup,}: WorkflowStepFilterAddFilterRuleSelectProps) => {@@ -49,19 +36,14 @@ export const WorkflowStepFilterAddFilterRuleSelect = ({const { closeDropdown } = useCloseDropdown();+ const { addStepFilterToGroup } = useAddStepFilterToGroup({+ stepFilterGroup,+ });+const handleAddFilter = () => {closeDropdown(dropdownId);- const newStepFilter = {- id: v4(),- ...BASE_NEW_STEP_FILTER,- stepFilterGroupId: stepFilterGroup.id,- positionInStepFilterGroup: newPositionInStepFilterGroup,- } satisfies StepFilter;-- upsertStepFilterSettings({- stepFilterToUpsert: newStepFilter,- });+ addStepFilterToGroup();};const handleAddFilterGroup = () => {@@ -76,15 +58,11 @@ export const WorkflowStepFilterAddFilterRuleSelect = ({positionInStepFilterGroup: newPositionInStepFilterGroup,};- const newStepFilter: StepFilter = {- id: v4(),- ...BASE_NEW_STEP_FILTER,- stepFilterGroupId: newStepFilterGroupId,- positionInStepFilterGroup: 1,- };-upsertStepFilterSettings({- stepFilterToUpsert: newStepFilter,+ stepFilterToUpsert: buildEmptyStepFilter({+ stepFilterGroupId: newStepFilterGroupId,+ positionInStepFilterGroup: 1,+ }),stepFilterGroupToUpsert: newStepFilterGroup,});};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddRootStepFilter.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddRootStepFilter.tsindex ef02fe5c3ca..32b733c8b91 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddRootStepFilter.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddRootStepFilter.ts@@ -2,14 +2,10 @@ import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/himport { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext';import { currentStepFilterGroupsComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState';import { currentStepFiltersComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFiltersComponentState';+import { buildEmptyStepFilter } from '@/workflow/workflow-steps/filters/utils/buildEmptyStepFilter';import { useStore } from 'jotai';import { useCallback, useContext } from 'react';-import {- type StepFilter,- type StepFilterGroup,- StepLogicalOperator,- ViewFilterOperand,-} from 'twenty-shared/types';+import { type StepFilterGroup, StepLogicalOperator } from 'twenty-shared/types';import { v4 } from 'uuid';export const useAddRootStepFilter = () => {@@ -30,15 +26,10 @@ export const useAddRootStepFilter = () => {logicalOperator: StepLogicalOperator.AND,};- const newStepFilter: StepFilter = {- id: v4(),- type: 'unknown',- value: '',- operand: ViewFilterOperand.IS,+ const newStepFilter = buildEmptyStepFilter({stepFilterGroupId: newStepFilterGroup.id,- stepOutputKey: '',positionInStepFilterGroup: 0,- };+ });store.set(currentStepFilterGroups, [newStepFilterGroup]);store.set(currentStepFilters, [newStepFilter]);diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddStepFilterToGroup.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddStepFilterToGroup.tsnew file mode 100644index 00000000000..8b25c849f3d--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddStepFilterToGroup.ts@@ -0,0 +1,29 @@+import { useChildStepFiltersAndChildStepFilterGroups } from '@/workflow/workflow-steps/filters/hooks/useChildStepFiltersAndChildStepFilterGroups';+import { useUpsertStepFilterSettings } from '@/workflow/workflow-steps/filters/hooks/useUpsertStepFilterSettings';+import { buildEmptyStepFilter } from '@/workflow/workflow-steps/filters/utils/buildEmptyStepFilter';+import { type StepFilterGroup } from 'twenty-shared/types';++export const useAddStepFilterToGroup = ({+ stepFilterGroup,+}: {+ stepFilterGroup: StepFilterGroup;+}) => {+ const { upsertStepFilterSettings } = useUpsertStepFilterSettings();++ const { lastChildPosition } = useChildStepFiltersAndChildStepFilterGroups({+ stepFilterGroupId: stepFilterGroup.id,+ });++ const addStepFilterToGroup = () => {+ upsertStepFilterSettings({+ stepFilterToUpsert: buildEmptyStepFilter({+ stepFilterGroupId: stepFilterGroup.id,+ positionInStepFilterGroup: lastChildPosition + 1,+ }),+ });+ };++ return {+ addStepFilterToGroup,+ };+};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/buildEmptyStepFilter.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/buildEmptyStepFilter.tsnew file mode 100644index 00000000000..eac4a82d7f3--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/buildEmptyStepFilter.ts@@ -0,0 +1,18 @@+import { ViewFilterOperand, type StepFilter } from 'twenty-shared/types';+import { v4 } from 'uuid';++export const buildEmptyStepFilter = ({+ stepFilterGroupId,+ positionInStepFilterGroup,+}: {+ stepFilterGroupId: string;+ positionInStepFilterGroup: number;+}): StepFilter => ({+ id: v4(),+ type: 'unknown',+ value: '',+ operand: ViewFilterOperand.IS,+ stepOutputKey: '',+ stepFilterGroupId,+ positionInStepFilterGroup,+});diff --git a/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsx b/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsxindex df2d33b1dc4..25d79279213 100644--- a/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsx+++ b/packages/twenty-front/src/pages/object-core/WorkflowCoreIndexPage.tsx@@ -5,6 +5,7 @@ import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';import { getAppPath, isDefined } from 'twenty-shared/utils';import { CoreObjectTable } from '@/object-core/components/CoreObjectTable';+import { CoreWorkflowsFilterBar } from '@/object-core/workflows/components/CoreWorkflowsFilterBar';import { WORKFLOW_CORE_TABLE_COLUMNS } from '@/object-core/workflows/constants/WorkflowCoreTableColumns';import {CORE_WORKFLOWS_INITIAL_SORT,@@ -14,6 +15,7 @@ import {import { type CoreWorkflow } from '@/object-core/workflows/types/CoreWorkflow';import { ObjectMetadataIcon } from '@/object-metadata/components/ObjectMetadataIcon';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';+import { SidePanelToggleButton } from '@/side-panel/components/SidePanelToggleButton';import { PageCardHeader } from '@/ui/layout/page/components/PageCardHeader';import { PageCardLayout } from '@/ui/layout/page/components/PageCardLayout';import { useWorkspaceSurfaceScopedComponentInstanceId } from '@/ui/layout/hooks/useWorkspaceSurfaceScopedComponentInstanceId';@@ -67,6 +69,12 @@ export const WorkflowCoreIndexPage = () => {<ObjectMetadataIcon objectMetadataItem={objectMetadataItem} />}title={objectMetadataItem.labelPlural}+ actionButton={+ <>+ <CoreWorkflowsFilterBar />+ <SidePanelToggleButton />+ </>+ }/>}>diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflow-filter.input.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflow-filter.input.tsnew file mode 100644index 00000000000..069fe41632f--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/dtos/core-workflow-filter.input.ts@@ -0,0 +1,88 @@+import { Field, InputType, registerEnumType } from '@nestjs/graphql';++import { Type } from 'class-transformer';+import {+ ArrayMaxSize,+ IsEnum,+ IsOptional,+ IsString,+ IsTimeZone,+ MaxLength,+ ValidateNested,+} from 'class-validator';+import { MAX_CORE_WORKFLOW_FILTER_RULES } from 'twenty-shared/constants';++export const MAX_CORE_WORKFLOW_FILTER_VALUE_LENGTH = 2000;++export enum CoreWorkflowFilterFieldKey {+ NAME = 'NAME',+ STATUSES = 'STATUSES',+ UPDATED_AT = 'UPDATED_AT',+}++export enum CoreWorkflowFilterOperand {+ CONTAINS = 'CONTAINS',+ DOES_NOT_CONTAIN = 'DOES_NOT_CONTAIN',+ IS = 'IS',+ IS_NOT = 'IS_NOT',+ IS_EMPTY = 'IS_EMPTY',+ IS_NOT_EMPTY = 'IS_NOT_EMPTY',+ IS_BEFORE = 'IS_BEFORE',+ IS_AFTER = 'IS_AFTER',+ IS_IN_PAST = 'IS_IN_PAST',+ IS_IN_FUTURE = 'IS_IN_FUTURE',+ IS_TODAY = 'IS_TODAY',+ IS_RELATIVE = 'IS_RELATIVE',+}++export enum CoreWorkflowFilterLogicalOperator {+ AND = 'AND',+ OR = 'OR',+}++registerEnumType(CoreWorkflowFilterFieldKey, {+ name: 'CoreWorkflowFilterFieldKey',+});++registerEnumType(CoreWorkflowFilterOperand, {+ name: 'CoreWorkflowFilterOperand',+});++registerEnumType(CoreWorkflowFilterLogicalOperator, {+ name: 'CoreWorkflowFilterLogicalOperator',+});++@InputType()+export class CoreWorkflowFilterRuleInput {+ @Field(() => CoreWorkflowFilterFieldKey)+ @IsEnum(CoreWorkflowFilterFieldKey)+ fieldKey: CoreWorkflowFilterFieldKey;++ @Field(() => CoreWorkflowFilterOperand)+ @IsEnum(CoreWorkflowFilterOperand)+ operand: CoreWorkflowFilterOperand;++ @Field(() => String, { nullable: true })+ @IsOptional()+ @IsString()+ @MaxLength(MAX_CORE_WORKFLOW_FILTER_VALUE_LENGTH)+ value?: string | null;++ @Field(() => String, { nullable: true })+ @IsOptional()+ @IsTimeZone()+ timezone?: string | null;+}++@InputType()+export class CoreWorkflowFilterInput {+ @Field(() => CoreWorkflowFilterLogicalOperator)+ @IsEnum(CoreWorkflowFilterLogicalOperator)+ logicalOperator: CoreWorkflowFilterLogicalOperator;++ @Field(() => [CoreWorkflowFilterRuleInput])+ @ArrayMaxSize(MAX_CORE_WORKFLOW_FILTER_RULES)+ @ValidateNested({ each: true })+ @Type(() => CoreWorkflowFilterRuleInput)+ rules: CoreWorkflowFilterRuleInput[];+}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.tsindex 94ddeda7a4c..5a6821cb845 100644--- 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.ts@@ -1,6 +1,11 @@-import { Field, ObjectType } from '@nestjs/graphql';+import { Field, ObjectType, registerEnumType } from '@nestjs/graphql';import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';+import { WorkflowStatus } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';++registerEnumType(WorkflowStatus, {+ name: 'CoreWorkflowStatus',+});@ObjectType('CoreWorkflowDTO')export class CoreWorkflowDTO {@@ -10,8 +15,8 @@ export class CoreWorkflowDTO {@Field(() => String, { nullable: true })name: string | null;- @Field(() => [String])- statuses: string[];+ @Field(() => [WorkflowStatus])+ statuses: WorkflowStatus[];@Field(() => UUIDScalarType, { nullable: true })applicationId: string | null;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.tsindex b5e7b8e8720..dd14aea0218 100644--- 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.ts@@ -1,6 +1,17 @@import { ArgsType, Field, Int, registerEnumType } from '@nestjs/graphql';-import { IsEnum, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';+import { Type } from 'class-transformer';+import {+ IsEnum,+ IsInt,+ IsOptional,+ IsString,+ Max,+ Min,+ ValidateNested,+} from 'class-validator';++import { CoreWorkflowFilterInput } from 'src/engine/core-modules/workflow/dtos/core-workflow-filter.input';export enum CoreWorkflowOrderByField {NAME = 'name',@@ -46,4 +57,10 @@ export class CoreWorkflowsArgs {})@IsEnum(CoreWorkflowOrderByDirection)orderByDirection: CoreWorkflowOrderByDirection;++ @Field(() => CoreWorkflowFilterInput, { nullable: true })+ @IsOptional()+ @ValidateNested()+ @Type(() => CoreWorkflowFilterInput)+ filter?: CoreWorkflowFilterInput | null;}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.tsindex 5deb5ec33c6..3d440632b02 100644--- 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.ts@@ -14,7 +14,9 @@ import {CoreWorkflowOrderByField,type CoreWorkflowsArgs,} from 'src/engine/core-modules/workflow/dtos/core-workflows.input';+import { buildCoreWorkflowFilterPredicate } from 'src/engine/core-modules/workflow/utils/build-core-workflow-filter-predicate.util';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';@@ -56,6 +58,14 @@ const SORT_COLUMN_BY_FIELD: Record<},};+const GROUPED_WORKFLOW_COLUMNS = `c.id, c.name, c."updatedAt"`;++const buildWorkflowVersionsJoinClause = (schemaName: string) =>+ `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`;+@Injectable()export class CoreWorkflowListService {constructor(@@ -65,7 +75,7 @@ export class CoreWorkflowListService {async findManyByWorkspaceId(workspaceId: string,- { first, after, orderBy, orderByDirection }: CoreWorkflowsArgs,+ { first, after, orderBy, orderByDirection, filter }: CoreWorkflowsArgs,): Promise<CoreWorkflowConnectionDTO> {const schemaName = escapeIdentifier(getWorkspaceSchemaName(workspaceId));const { column, cursorExpression, nullable, cast } =@@ -76,6 +86,15 @@ export class CoreWorkflowListService {const nullsClause = nullable ? ' NULLS LAST' : '';const parameters: unknown[] = [workspaceId];++ const { predicate: filterPredicate, parameters: filterParameters } =+ buildCoreWorkflowFilterPredicate({+ filter,+ firstParameterIndex: parameters.length + 1,+ });++ parameters.push(...filterParameters);+let keysetCondition = '';if (isDefined(after)) {@@ -83,17 +102,26 @@ export class CoreWorkflowListService {if (cursor.sortValue === null) {parameters.push(cursor.id);- keysetCondition = `AND (${column} IS NULL AND c.id ${comparator} $2::uuid)`;+ keysetCondition = `AND (${column} IS NULL AND c.id ${comparator} $${parameters.length}::uuid)`;} else {- parameters.push(cursor.sortValue, cursor.id);+ parameters.push(cursor.sortValue);+ const sortValueParameter = `$${parameters.length}`;++ parameters.push(cursor.id);+ const idParameter = `$${parameters.length}`;+keysetCondition = nullable- ? `AND (${column} ${comparator} $2${cast}- OR (${column} = $2${cast} AND c.id ${comparator} $3::uuid)+ ? `AND (${column} ${comparator} ${sortValueParameter}${cast}+ OR (${column} = ${sortValueParameter}${cast} AND c.id ${comparator} ${idParameter}::uuid)OR ${column} IS NULL)`- : `AND (${column}, c.id) ${comparator} ($2${cast}, $3::uuid)`;+ : `AND (${column}, c.id) ${comparator} (${sortValueParameter}${cast}, ${idParameter}::uuid)`;}}+ const havingClause = isDefined(filterPredicate)+ ? `HAVING ${filterPredicate}`+ : '';+parameters.push(first + 1);const limitParameter = `$${parameters.length}`;@@ -109,25 +137,22 @@ export class CoreWorkflowListService {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+ ${buildWorkflowVersionsJoinClause(schemaName)}WHERE c."workspaceId" = $1${keysetCondition}- GROUP BY c.id, c.name, c."applicationId", c."updatedAt"+ GROUP BY ${GROUPED_WORKFLOW_COLUMNS}, c."applicationId"+ ${havingClause}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 totalCount = await this.countByWorkspaceId({+ workspaceId,+ schemaName,+ filterPredicate,+ filterParameters,+ });const hasNextPage = rows.length > first;const pageRows = hasNextPage ? rows.slice(0, first) : rows;@@ -160,4 +185,48 @@ export class CoreWorkflowListService {totalCount,};}++ private async countByWorkspaceId({+ workspaceId,+ schemaName,+ filterPredicate,+ filterParameters,+ }: {+ workspaceId: string;+ schemaName: string;+ filterPredicate?: string;+ filterParameters: unknown[];+ }): Promise<number> {+ const parameters: unknown[] = [workspaceId];++ if (!isDefined(filterPredicate)) {+ const [{ totalCount }]: [{ totalCount: number }] =+ await this.coreDataSource.query(+ `SELECT count(*)::int AS "totalCount"+ FROM core."workflow" c+ WHERE c."workspaceId" = $1`,+ parameters,+ );++ return totalCount;+ }++ parameters.push(...filterParameters);++ const [{ totalCount }]: [{ totalCount: number }] =+ await this.coreDataSource.query(+ `SELECT count(*)::int AS "totalCount"+ FROM (+ SELECT c.id+ FROM core."workflow" c+ ${buildWorkflowVersionsJoinClause(schemaName)}+ WHERE c."workspaceId" = $1+ GROUP BY ${GROUPED_WORKFLOW_COLUMNS}+ HAVING ${filterPredicate}+ ) filtered`,+ parameters,+ );++ return totalCount;+ }}diff --git a/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-filter-predicate.util.spec.ts b/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-filter-predicate.util.spec.tsnew file mode 100644index 00000000000..22e8fd62df7--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-filter-predicate.util.spec.ts@@ -0,0 +1,664 @@+import { UserInputError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util';+import {+ CoreWorkflowFilterFieldKey,+ CoreWorkflowFilterLogicalOperator,+ CoreWorkflowFilterOperand,+ type CoreWorkflowFilterRuleInput,+} from 'src/engine/core-modules/workflow/dtos/core-workflow-filter.input';+import { buildCoreWorkflowFilterPredicate } from 'src/engine/core-modules/workflow/utils/build-core-workflow-filter-predicate.util';+import { computeCoreWorkflowStatuses } from 'src/engine/core-modules/workflow/utils/compute-core-workflow-statuses.util';+import { WorkflowStatus } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';++const FIRST_PARAMETER_INDEX = 2;++const RELATIVE_DATE_FILTER_VALUE = JSON.stringify({+ direction: 'PAST',+ amount: 3,+ unit: 'DAY',+ timezone: 'UTC',+});++const buildPredicate = (+ rules: CoreWorkflowFilterRuleInput[],+ logicalOperator: CoreWorkflowFilterLogicalOperator = CoreWorkflowFilterLogicalOperator.AND,+) =>+ buildCoreWorkflowFilterPredicate({+ filter: { logicalOperator, rules },+ firstParameterIndex: FIRST_PARAMETER_INDEX,+ });++type VersionFlags = {+ hasDraftVersion: boolean;+ hasActiveVersion: boolean;+ hasDeactivatedVersion: boolean;+};++const ALL_VERSION_FLAG_COMBINATIONS: VersionFlags[] = [false, true].flatMap(+ (hasDraftVersion) =>+ [false, true].flatMap((hasActiveVersion) =>+ [false, true].map((hasDeactivatedVersion) => ({+ hasDraftVersion,+ hasActiveVersion,+ hasDeactivatedVersion,+ })),+ ),+);++const evaluateStatusPredicate = (+ predicate: string,+ { hasDraftVersion, hasActiveVersion, hasDeactivatedVersion }: VersionFlags,+): boolean => {+ const booleanExpression = predicate+ .split(`coalesce(bool_or(v.status = 'DRAFT'), false)`)+ .join(String(hasDraftVersion))+ .split(`coalesce(bool_or(v.status = 'ACTIVE'), false)`)+ .join(String(hasActiveVersion))+ .split(`coalesce(bool_or(v.status = 'DEACTIVATED'), false)`)+ .join(String(hasDeactivatedVersion))+ .split('NOT')+ .join('!')+ .split('AND')+ .join('&&')+ .split('OR')+ .join('||');++ return new Function(`return ${booleanExpression};`)() as boolean;+};++describe('buildCoreWorkflowFilterPredicate', () => {+ it('should not filter when no filter is provided', () => {+ expect(+ buildCoreWorkflowFilterPredicate({ firstParameterIndex: 2 }),+ ).toEqual({ parameters: [] });++ expect(+ buildCoreWorkflowFilterPredicate({+ filter: null,+ firstParameterIndex: 2,+ }),+ ).toEqual({ parameters: [] });+ });++ it('should not filter when the rule list is empty', () => {+ expect(buildPredicate([])).toEqual({ parameters: [] });+ });++ describe('NAME rules', () => {+ it('should build a case-insensitive contains predicate', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: 'invoice',+ },+ ]),+ ).toEqual({+ predicate: `(c.name ILIKE $2 ESCAPE '\\')`,+ parameters: ['%invoice%'],+ });+ });++ it('should escape ILIKE wildcards in the bound pattern', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: '100%_off',+ },+ ]).parameters,+ ).toEqual(['%100\\%\\_off%']);+ });++ it('should let an unnamed workflow match a negative text predicate', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand: CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,+ value: 'invoice',+ },+ ]),+ ).toEqual({+ predicate: `((c.name IS NULL OR c.name NOT ILIKE $2 ESCAPE '\\'))`,+ parameters: ['%invoice%'],+ });+ });++ it('should reject IS and IS_NOT, which the builder does not offer on NAME', () => {+ for (const operand of [+ CoreWorkflowFilterOperand.IS,+ CoreWorkflowFilterOperand.IS_NOT,+ ]) {+ expect(() =>+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand,+ value: 'Send invoice',+ },+ ]),+ ).toThrow(UserInputError);+ }+ });++ it('should treat a blank name as empty', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand: CoreWorkflowFilterOperand.IS_EMPTY,+ },+ ]),+ ).toEqual({+ predicate: `((c.name IS NULL OR c.name = ''))`,+ parameters: [],+ });++ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand: CoreWorkflowFilterOperand.IS_NOT_EMPTY,+ },+ ]),+ ).toEqual({+ predicate: `((c.name IS NOT NULL AND c.name <> ''))`,+ parameters: [],+ });+ });++ it.each([+ CoreWorkflowFilterOperand.CONTAINS,+ CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,+ ])('should reject %s without a value', (operand) => {+ expect(() =>+ buildPredicate([+ { fieldKey: CoreWorkflowFilterFieldKey.NAME, operand, value: ' ' },+ ]),+ ).toThrow(UserInputError);+ });+ });++ describe('STATUSES rules', () => {+ it('should build a predicate per selected status', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: JSON.stringify([+ WorkflowStatus.DRAFT,+ WorkflowStatus.ACTIVE,+ ]),+ },+ ]),+ ).toEqual({+ predicate: `((coalesce(bool_or(v.status = 'DRAFT'), false) OR coalesce(bool_or(v.status = 'ACTIVE'), false)))`,+ parameters: [],+ });+ });++ it('should accept a bare status alongside a JSON encoded array', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: 'ACTIVE',+ },+ ]).predicate,+ ).toBe(`((coalesce(bool_or(v.status = 'ACTIVE'), false)))`);+ });++ it('should negate the selected statuses for DOES NOT CONTAIN', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand: CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,+ value: JSON.stringify([WorkflowStatus.ACTIVE]),+ },+ ]).predicate,+ ).toBe(`((NOT (coalesce(bool_or(v.status = 'ACTIVE'), false))))`);+ });++ it('should reject an unknown status', () => {+ expect(() =>+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: JSON.stringify(['ARCHIVED']),+ },+ ]),+ ).toThrow(UserInputError);+ });++ it('should reject an empty status selection', () => {+ expect(() =>+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: JSON.stringify([]),+ },+ ]),+ ).toThrow(UserInputError);+ });++ it.each([+ CoreWorkflowFilterOperand.CONTAINS,+ CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,+ CoreWorkflowFilterOperand.IS_EMPTY,+ CoreWorkflowFilterOperand.IS_NOT_EMPTY,+ ])(+ 'should match exactly the workflows computeCoreWorkflowStatuses derives for %s',+ (operand) => {+ const selectedStatuses = [+ WorkflowStatus.ACTIVE,+ WorkflowStatus.DEACTIVATED,+ ];+ const { predicate } = buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand,+ value: JSON.stringify(selectedStatuses),+ },+ ]);++ for (const versionFlags of ALL_VERSION_FLAG_COMBINATIONS) {+ const derivedStatuses: string[] =+ computeCoreWorkflowStatuses(versionFlags);+ const matchesSelection = selectedStatuses.some((status) =>+ derivedStatuses.includes(status),+ );+ const expectedMatchByOperand: Partial<+ Record<CoreWorkflowFilterOperand, boolean>+ > = {+ [CoreWorkflowFilterOperand.CONTAINS]: matchesSelection,+ [CoreWorkflowFilterOperand.DOES_NOT_CONTAIN]: !matchesSelection,+ [CoreWorkflowFilterOperand.IS_EMPTY]: derivedStatuses.length === 0,+ [CoreWorkflowFilterOperand.IS_NOT_EMPTY]:+ derivedStatuses.length > 0,+ };+ const expectedMatch = expectedMatchByOperand[operand];++ expect(evaluateStatusPredicate(predicate ?? '', versionFlags)).toBe(+ expectedMatch,+ );+ }+ },+ );+ });++ describe('STATUSES value shapes', () => {+ it('should accept a bare status string but reject a JSON encoded scalar', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: 'ACTIVE',+ },+ ]).predicate,+ ).toContain("v.status = 'ACTIVE'");++ expect(() =>+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: JSON.stringify('ACTIVE'),+ },+ ]),+ ).toThrow(UserInputError);+ });+ });++ describe('UPDATED_AT rules', () => {+ it('should bind UTC day bounds for IS when no timezone travels with the rule', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS,+ value: JSON.stringify('2026-08-31T13:45:00.000Z'),+ },+ ]),+ ).toEqual({+ predicate: `((c."updatedAt" >= $2::timestamptz AND c."updatedAt" < $3::timestamptz))`,+ parameters: ['2026-08-31T00:00:00Z', '2026-09-01T00:00:00Z'],+ });+ });++ it('should bind the day bounds of the rule timezone for IS', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS,+ value: JSON.stringify('2026-08-31T23:30:00.000Z'),+ timezone: 'Asia/Tokyo',+ },+ ]),+ ).toEqual({+ predicate: `((c."updatedAt" >= $2::timestamptz AND c."updatedAt" < $3::timestamptz))`,+ parameters: ['2026-08-31T15:00:00Z', '2026-09-01T15:00:00Z'],+ });+ });++ it('should accept a bare ISO string alongside a JSON encoded one', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_BEFORE,+ value: '2026-08-31T13:45:00.000Z',+ },+ ]),+ ).toEqual({+ predicate: `(c."updatedAt" < $2::timestamptz)`,+ parameters: ['2026-08-31T13:45:00.000Z'],+ });+ });++ it('should build an IS AFTER predicate', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_AFTER,+ value: JSON.stringify('2026-08-31T13:45:00.000Z'),+ },+ ]),+ ).toEqual({+ predicate: `(c."updatedAt" >= $2::timestamptz)`,+ parameters: ['2026-08-31T13:45:00.000Z'],+ });+ });++ it('should build emptiness predicates', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_EMPTY,+ },+ ]),+ ).toEqual({+ predicate: `(c."updatedAt" IS NULL)`,+ parameters: [],+ });++ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_NOT_EMPTY,+ },+ ]),+ ).toEqual({+ predicate: `(c."updatedAt" IS NOT NULL)`,+ parameters: [],+ });+ });++ it('should compare against now for the operands that take now as reference', () => {+ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_IN_PAST,+ },+ ]),+ ).toEqual({ predicate: `(c."updatedAt" < now())`, parameters: [] });++ expect(+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_IN_FUTURE,+ },+ ]),+ ).toEqual({ predicate: `(c."updatedAt" > now())`, parameters: [] });++ const todayPredicate = buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_TODAY,+ timezone: 'Asia/Tokyo',+ },+ ]);++ expect(todayPredicate.predicate).toBe(+ `((c."updatedAt" >= $2::timestamptz AND c."updatedAt" < $3::timestamptz))`,+ );++ const [todayStart, tomorrowStart] = todayPredicate.parameters as string[];+ const dayInMilliseconds = 24 * 60 * 60 * 1000;++ expect(+ new Date(tomorrowStart).getTime() - new Date(todayStart).getTime(),+ ).toBe(dayInMilliseconds);+ expect(new Date(todayStart).getTime()).toBeLessThanOrEqual(Date.now());+ expect(new Date(tomorrowStart).getTime()).toBeGreaterThan(Date.now());+ });++ it('should fall back to the rule timezone when the relative value carries none', () => {+ const { parameters } = buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_RELATIVE,+ value: JSON.stringify({ direction: 'THIS', unit: 'DAY' }),+ timezone: 'Asia/Tokyo',+ },+ ]);+ const [start, end] = parameters as string[];++ expect(new Date(end).getTime() - new Date(start).getTime()).toBe(+ 24 * 60 * 60 * 1000,+ );+ expect(start.endsWith('T15:00:00Z')).toBe(true);+ });++ it('should reject a relative filter carrying an invalid timezone', () => {+ expect(() =>+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_RELATIVE,+ value: JSON.stringify({+ direction: 'PAST',+ amount: 1,+ unit: 'DAY',+ timezone: 'Not/AZone',+ }),+ },+ ]),+ ).toThrow(UserInputError);+ });++ it('should resolve a relative date filter into a bound range', () => {+ const { predicate, parameters } = buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_RELATIVE,+ value: RELATIVE_DATE_FILTER_VALUE,+ },+ ]);++ expect(predicate).toBe(+ `((c."updatedAt" >= $2::timestamptz AND c."updatedAt" < $3::timestamptz))`,+ );++ const [start, end] = parameters as [string, string];++ expect(new Date(end).getTime() - new Date(start).getTime()).toBe(+ 3 * 24 * 60 * 60 * 1000,+ );+ });++ it('should reject a relative date filter value that cannot be parsed', () => {+ expect(() =>+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_RELATIVE,+ value: JSON.stringify({ direction: 'SOMEDAY', unit: 'DAY' }),+ },+ ]),+ ).toThrow(UserInputError);+ });++ it('should reject a value that is not a date', () => {+ expect(() =>+ buildPredicate([+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS_AFTER,+ value: 'not a date',+ },+ ]),+ ).toThrow(UserInputError);+ });+ });++ describe('supported operands', () => {+ const VALUE_BY_FIELD_KEY: Record<CoreWorkflowFilterFieldKey, string> = {+ [CoreWorkflowFilterFieldKey.NAME]: 'invoice',+ [CoreWorkflowFilterFieldKey.STATUSES]: JSON.stringify([+ WorkflowStatus.ACTIVE,+ ]),+ [CoreWorkflowFilterFieldKey.UPDATED_AT]: JSON.stringify(+ '2026-08-31T13:45:00.000Z',+ ),+ };++ const SUPPORTED_OPERANDS_BY_FIELD_KEY: Record<+ CoreWorkflowFilterFieldKey,+ CoreWorkflowFilterOperand[]+ > = {+ [CoreWorkflowFilterFieldKey.NAME]: [+ CoreWorkflowFilterOperand.CONTAINS,+ CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,+ CoreWorkflowFilterOperand.IS_EMPTY,+ CoreWorkflowFilterOperand.IS_NOT_EMPTY,+ ],+ [CoreWorkflowFilterFieldKey.STATUSES]: [+ CoreWorkflowFilterOperand.CONTAINS,+ CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,+ CoreWorkflowFilterOperand.IS_EMPTY,+ CoreWorkflowFilterOperand.IS_NOT_EMPTY,+ ],+ [CoreWorkflowFilterFieldKey.UPDATED_AT]: [+ CoreWorkflowFilterOperand.IS,+ CoreWorkflowFilterOperand.IS_BEFORE,+ CoreWorkflowFilterOperand.IS_AFTER,+ CoreWorkflowFilterOperand.IS_IN_PAST,+ CoreWorkflowFilterOperand.IS_IN_FUTURE,+ CoreWorkflowFilterOperand.IS_TODAY,+ CoreWorkflowFilterOperand.IS_RELATIVE,+ CoreWorkflowFilterOperand.IS_EMPTY,+ CoreWorkflowFilterOperand.IS_NOT_EMPTY,+ ],+ };++ const fieldOperandPairs = Object.values(CoreWorkflowFilterFieldKey).flatMap(+ (fieldKey) =>+ Object.values(CoreWorkflowFilterOperand).map(+ (operand) => [fieldKey, operand] as const,+ ),+ );++ it.each(fieldOperandPairs)(+ 'should accept %s only with the operands its type allows (%s)',+ (fieldKey, operand) => {+ const value =+ operand === CoreWorkflowFilterOperand.IS_RELATIVE+ ? RELATIVE_DATE_FILTER_VALUE+ : VALUE_BY_FIELD_KEY[fieldKey];+ const build = () => buildPredicate([{ fieldKey, operand, value }]);++ if (SUPPORTED_OPERANDS_BY_FIELD_KEY[fieldKey].includes(operand)) {+ expect(build().predicate).toEqual(expect.any(String));++ return;+ }++ expect(build).toThrow(UserInputError);+ },+ );+ });++ describe('rule composition', () => {+ const nameRule: CoreWorkflowFilterRuleInput = {+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: 'invoice',+ };+ const statusRule: CoreWorkflowFilterRuleInput = {+ fieldKey: CoreWorkflowFilterFieldKey.STATUSES,+ operand: CoreWorkflowFilterOperand.CONTAINS,+ value: JSON.stringify([WorkflowStatus.ACTIVE]),+ };++ it('should join rules with AND', () => {+ expect(+ buildPredicate(+ [nameRule, statusRule],+ CoreWorkflowFilterLogicalOperator.AND,+ ),+ ).toEqual({+ predicate: `(c.name ILIKE $2 ESCAPE '\\' AND (coalesce(bool_or(v.status = 'ACTIVE'), false)))`,+ parameters: ['%invoice%'],+ });+ });++ it('should join a row level rule and a status rule with OR', () => {+ expect(+ buildPredicate(+ [nameRule, statusRule],+ CoreWorkflowFilterLogicalOperator.OR,+ ),+ ).toEqual({+ predicate: `(c.name ILIKE $2 ESCAPE '\\' OR (coalesce(bool_or(v.status = 'ACTIVE'), false)))`,+ parameters: ['%invoice%'],+ });+ });++ it('should number bound parameters from the given index across rules', () => {+ expect(+ buildCoreWorkflowFilterPredicate({+ filter: {+ logicalOperator: CoreWorkflowFilterLogicalOperator.OR,+ rules: [+ nameRule,+ {+ fieldKey: CoreWorkflowFilterFieldKey.UPDATED_AT,+ operand: CoreWorkflowFilterOperand.IS,+ value: JSON.stringify('2026-08-31T13:45:00.000Z'),+ },+ statusRule,+ {+ fieldKey: CoreWorkflowFilterFieldKey.NAME,+ operand: CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,+ value: 'Draft',+ },+ ],+ },+ firstParameterIndex: 5,+ }),+ ).toEqual({+ predicate: `(c.name ILIKE $5 ESCAPE '\\' OR (c."updatedAt" >= $6::timestamptz AND c."updatedAt" < $7::timestamptz) OR (coalesce(bool_or(v.status = 'ACTIVE'), false)) OR (c.name IS NULL OR c.name NOT ILIKE $8 ESCAPE '\\'))`,+ parameters: [+ '%invoice%',+ '2026-08-31T00:00:00Z',+ '2026-09-01T00:00:00Z',+ '%Draft%',+ ],+ });+ });+ });+});diff --git a/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-status-predicate.util.spec.ts b/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-status-predicate.util.spec.tsnew file mode 100644index 00000000000..8908b688976--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-status-predicate.util.spec.ts@@ -0,0 +1,36 @@+import { WorkflowStatus } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';+import {+ buildCoreWorkflowHasAnyOfStatusesPredicate,+ CORE_WORKFLOW_HAS_ANY_STATUS_PREDICATE,+} from 'src/engine/core-modules/workflow/utils/build-core-workflow-status-predicate.util';++describe('buildCoreWorkflowHasAnyOfStatusesPredicate', () => {+ it('should build a single predicate per requested status', () => {+ expect(+ buildCoreWorkflowHasAnyOfStatusesPredicate([WorkflowStatus.DRAFT]),+ ).toBe(`(coalesce(bool_or(v.status = 'DRAFT'), false))`);++ expect(+ buildCoreWorkflowHasAnyOfStatusesPredicate([WorkflowStatus.DEACTIVATED]),+ ).toBe(+ `((NOT coalesce(bool_or(v.status = 'ACTIVE'), false) AND coalesce(bool_or(v.status = 'DEACTIVATED'), false)))`,+ );+ });++ it('should join multiple requested statuses with OR', () => {+ expect(+ buildCoreWorkflowHasAnyOfStatusesPredicate([+ WorkflowStatus.DRAFT,+ WorkflowStatus.ACTIVE,+ ]),+ ).toBe(+ `(coalesce(bool_or(v.status = 'DRAFT'), false) OR coalesce(bool_or(v.status = 'ACTIVE'), false))`,+ );+ });++ it('should expose a predicate covering every status', () => {+ expect(CORE_WORKFLOW_HAS_ANY_STATUS_PREDICATE).toBe(+ `(coalesce(bool_or(v.status = 'DRAFT'), false) OR coalesce(bool_or(v.status = 'ACTIVE'), false) OR (NOT coalesce(bool_or(v.status = 'ACTIVE'), false) AND coalesce(bool_or(v.status = 'DEACTIVATED'), false)))`,+ );+ });+});diff --git a/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-filter-predicate.util.ts b/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-filter-predicate.util.tsnew file mode 100644index 00000000000..49c57571da8--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-filter-predicate.util.ts@@ -0,0 +1,384 @@+import { isNonEmptyString } from '@sniptt/guards';+import { Temporal } from 'temporal-polyfill';+import {+ escapeForIlike,+ getNextPeriodStart,+ getPeriodStart,+ isDefined,+ isNonEmptyArray,+ resolveRelativeDateTimeFilter,+ safeParseRelativeDateFilterJsonStringified,+} from 'twenty-shared/utils';++import { UserInputError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util';+import {+ CoreWorkflowFilterFieldKey,+ type CoreWorkflowFilterInput,+ CoreWorkflowFilterLogicalOperator,+ CoreWorkflowFilterOperand,+ type CoreWorkflowFilterRuleInput,+} from 'src/engine/core-modules/workflow/dtos/core-workflow-filter.input';+import {+ buildCoreWorkflowHasAnyOfStatusesPredicate,+ CORE_WORKFLOW_HAS_ANY_STATUS_PREDICATE,+} from 'src/engine/core-modules/workflow/utils/build-core-workflow-status-predicate.util';+import { WorkflowStatus } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';++const NAME_COLUMN = 'c.name';+const UPDATED_AT_COLUMN = 'c."updatedAt"';+const CORE_WORKFLOW_STATUS_VALUES: WorkflowStatus[] =+ Object.values(WorkflowStatus);++type BindParameter = (value: unknown) => string;++type RulePredicateBuilder = (context: {+ rule: CoreWorkflowFilterRuleInput;+ bindParameter: BindParameter;+}) => string;++export type CoreWorkflowFilterPredicate = {+ predicate?: string;+ parameters: unknown[];+};++const requireTextValue = (rule: CoreWorkflowFilterRuleInput): string => {+ const trimmedValue = rule.value?.trim();++ if (!isNonEmptyString(trimmedValue)) {+ throw new UserInputError(+ `Operand ${rule.operand} on field ${rule.fieldKey} requires a value`,+ );+ }++ return trimmedValue;+};++const parseJsonValue = (value: string): unknown => {+ try {+ return JSON.parse(value);+ } catch {+ return value;+ }+};++const parseStatusValue = ({+ candidate,+ rule,+}: {+ candidate: unknown;+ rule: CoreWorkflowFilterRuleInput;+}): WorkflowStatus => {+ const status =+ typeof candidate === 'string'+ ? CORE_WORKFLOW_STATUS_VALUES.find(+ (statusValue) => statusValue === candidate,+ )+ : undefined;++ if (!isDefined(status)) {+ throw new UserInputError(+ `Operand ${rule.operand} on field ${rule.fieldKey} requires workflow statuses among ${CORE_WORKFLOW_STATUS_VALUES.join(', ')}`,+ );+ }++ return status;+};++const parseStatusesValue = (+ rule: CoreWorkflowFilterRuleInput,+): WorkflowStatus[] => {+ const rawValue = requireTextValue(rule);+ let candidates: unknown[];++ try {+ const parsedValue: unknown = JSON.parse(rawValue);++ if (!Array.isArray(parsedValue)) {+ throw new UserInputError(+ `Operand ${rule.operand} on field ${rule.fieldKey} requires a JSON array of workflow statuses`,+ );+ }++ candidates = parsedValue;+ } catch (error) {+ if (error instanceof UserInputError) {+ throw error;+ }++ candidates = [rawValue];+ }++ const statuses = candidates.map((candidate) =>+ parseStatusValue({ candidate, rule }),+ );++ if (!isNonEmptyArray(statuses)) {+ throw new UserInputError(+ `Operand ${rule.operand} on field ${rule.fieldKey} requires at least one workflow status`,+ );+ }++ return statuses;+};++const parseDateValue = (rule: CoreWorkflowFilterRuleInput): Date => {+ const rawValue = requireTextValue(rule);+ const parsedValue = parseJsonValue(rawValue);+ const date = new Date(+ typeof parsedValue === 'string' ? parsedValue : rawValue,+ );++ if (Number.isNaN(date.getTime())) {+ throw new UserInputError(+ `Operand ${rule.operand} on field ${rule.fieldKey} requires an ISO 8601 date value`,+ );+ }++ return date;+};++const computeDayBounds = (+ zonedDateTime: Temporal.ZonedDateTime,+): { dayStart: string; nextDayStart: string } => ({+ dayStart: getPeriodStart(zonedDateTime, 'DAY').toInstant().toString(),+ nextDayStart: getNextPeriodStart(zonedDateTime, 'DAY').toInstant().toString(),+});++const toRuleZonedDateTime = ({+ date,+ rule,+}: {+ date: Date;+ rule: CoreWorkflowFilterRuleInput;+}): Temporal.ZonedDateTime =>+ Temporal.Instant.fromEpochMilliseconds(date.getTime()).toZonedDateTimeISO(+ rule.timezone ?? 'UTC',+ );++const parseRelativeDateRange = (+ rule: CoreWorkflowFilterRuleInput,+): { start: string; end: string } => {+ const relativeDateFilter = safeParseRelativeDateFilterJsonStringified(+ requireTextValue(rule),+ );++ if (!isDefined(relativeDateFilter)) {+ throw new UserInputError(+ `Operand ${rule.operand} on field ${rule.fieldKey} requires a relative date filter value`,+ );+ }++ let referenceZonedDateTime: Temporal.ZonedDateTime;++ try {+ referenceZonedDateTime = Temporal.Now.zonedDateTimeISO(+ relativeDateFilter.timezone ?? rule.timezone ?? 'UTC',+ );+ } catch {+ throw new UserInputError(+ `Operand ${rule.operand} on field ${rule.fieldKey} carries an invalid timezone`,+ );+ }++ const resolvedFilter = resolveRelativeDateTimeFilter(+ relativeDateFilter,+ referenceZonedDateTime.round({ smallestUnit: 'second' }),+ );++ return {+ start: resolvedFilter.start.toInstant().toString(),+ end: resolvedFilter.end.toInstant().toString(),+ };+};++const buildUpdatedAtRangePredicate = ({+ bindParameter,+ start,+ end,+}: {+ bindParameter: BindParameter;+ start: string;+ end: string;+}): string =>+ `(${UPDATED_AT_COLUMN} >= ${bindParameter(start)}::timestamptz AND ${UPDATED_AT_COLUMN} < ${bindParameter(end)}::timestamptz)`;++const buildNameIlikePredicate = ({+ bindParameter,+ pattern,+ negated,+}: {+ bindParameter: BindParameter;+ pattern: string;+ negated: boolean;+}): string => {+ const comparison = `${NAME_COLUMN} ${negated ? 'NOT ILIKE' : 'ILIKE'} ${bindParameter(pattern)} ESCAPE '\\'`;++ return negated ? `(${NAME_COLUMN} IS NULL OR ${comparison})` : comparison;+};++const buildUpdatedAtComparisonPredicate = ({+ bindParameter,+ rule,+ sqlOperator,+}: {+ bindParameter: BindParameter;+ rule: CoreWorkflowFilterRuleInput;+ sqlOperator: '<' | '>=';+}): string =>+ `${UPDATED_AT_COLUMN} ${sqlOperator} ${bindParameter(parseDateValue(rule).toISOString())}::timestamptz`;++const PREDICATE_BUILDER_BY_OPERAND_BY_FIELD_KEY: Record<+ CoreWorkflowFilterFieldKey,+ Record<CoreWorkflowFilterOperand, RulePredicateBuilder | null>+> = {+ [CoreWorkflowFilterFieldKey.NAME]: {+ [CoreWorkflowFilterOperand.CONTAINS]: ({ rule, bindParameter }) =>+ buildNameIlikePredicate({+ bindParameter,+ pattern: `%${escapeForIlike(requireTextValue(rule))}%`,+ negated: false,+ }),+ [CoreWorkflowFilterOperand.DOES_NOT_CONTAIN]: ({ rule, bindParameter }) =>+ buildNameIlikePredicate({+ bindParameter,+ pattern: `%${escapeForIlike(requireTextValue(rule))}%`,+ negated: true,+ }),+ [CoreWorkflowFilterOperand.IS]: null,+ [CoreWorkflowFilterOperand.IS_NOT]: null,+ [CoreWorkflowFilterOperand.IS_EMPTY]: () =>+ `(${NAME_COLUMN} IS NULL OR ${NAME_COLUMN} = '')`,+ [CoreWorkflowFilterOperand.IS_NOT_EMPTY]: () =>+ `(${NAME_COLUMN} IS NOT NULL AND ${NAME_COLUMN} <> '')`,+ [CoreWorkflowFilterOperand.IS_BEFORE]: null,+ [CoreWorkflowFilterOperand.IS_AFTER]: null,+ [CoreWorkflowFilterOperand.IS_IN_PAST]: null,+ [CoreWorkflowFilterOperand.IS_IN_FUTURE]: null,+ [CoreWorkflowFilterOperand.IS_TODAY]: null,+ [CoreWorkflowFilterOperand.IS_RELATIVE]: null,+ },+ [CoreWorkflowFilterFieldKey.STATUSES]: {+ [CoreWorkflowFilterOperand.CONTAINS]: ({ rule }) =>+ buildCoreWorkflowHasAnyOfStatusesPredicate(parseStatusesValue(rule)),+ [CoreWorkflowFilterOperand.DOES_NOT_CONTAIN]: ({ rule }) =>+ `(NOT ${buildCoreWorkflowHasAnyOfStatusesPredicate(parseStatusesValue(rule))})`,+ [CoreWorkflowFilterOperand.IS_EMPTY]: () =>+ `(NOT ${CORE_WORKFLOW_HAS_ANY_STATUS_PREDICATE})`,+ [CoreWorkflowFilterOperand.IS_NOT_EMPTY]: () =>+ CORE_WORKFLOW_HAS_ANY_STATUS_PREDICATE,+ [CoreWorkflowFilterOperand.IS]: null,+ [CoreWorkflowFilterOperand.IS_NOT]: null,+ [CoreWorkflowFilterOperand.IS_BEFORE]: null,+ [CoreWorkflowFilterOperand.IS_AFTER]: null,+ [CoreWorkflowFilterOperand.IS_IN_PAST]: null,+ [CoreWorkflowFilterOperand.IS_IN_FUTURE]: null,+ [CoreWorkflowFilterOperand.IS_TODAY]: null,+ [CoreWorkflowFilterOperand.IS_RELATIVE]: null,+ },+ [CoreWorkflowFilterFieldKey.UPDATED_AT]: {+ [CoreWorkflowFilterOperand.IS]: ({ rule, bindParameter }) => {+ const { dayStart, nextDayStart } = computeDayBounds(+ toRuleZonedDateTime({ date: parseDateValue(rule), rule }),+ );++ return buildUpdatedAtRangePredicate({+ bindParameter,+ start: dayStart,+ end: nextDayStart,+ });+ },+ [CoreWorkflowFilterOperand.IS_BEFORE]: ({ rule, bindParameter }) =>+ buildUpdatedAtComparisonPredicate({+ bindParameter,+ rule,+ sqlOperator: '<',+ }),+ [CoreWorkflowFilterOperand.IS_AFTER]: ({ rule, bindParameter }) =>+ buildUpdatedAtComparisonPredicate({+ bindParameter,+ rule,+ sqlOperator: '>=',+ }),+ [CoreWorkflowFilterOperand.IS_IN_PAST]: () =>+ `${UPDATED_AT_COLUMN} < now()`,+ [CoreWorkflowFilterOperand.IS_IN_FUTURE]: () =>+ `${UPDATED_AT_COLUMN} > now()`,+ [CoreWorkflowFilterOperand.IS_TODAY]: ({ rule, bindParameter }) => {+ const { dayStart, nextDayStart } = computeDayBounds(+ Temporal.Now.zonedDateTimeISO(rule.timezone ?? 'UTC'),+ );++ return buildUpdatedAtRangePredicate({+ bindParameter,+ start: dayStart,+ end: nextDayStart,+ });+ },+ [CoreWorkflowFilterOperand.IS_RELATIVE]: ({ rule, bindParameter }) => {+ const { start, end } = parseRelativeDateRange(rule);++ return buildUpdatedAtRangePredicate({ bindParameter, start, end });+ },+ [CoreWorkflowFilterOperand.IS_EMPTY]: () => `${UPDATED_AT_COLUMN} IS NULL`,+ [CoreWorkflowFilterOperand.IS_NOT_EMPTY]: () =>+ `${UPDATED_AT_COLUMN} IS NOT NULL`,+ [CoreWorkflowFilterOperand.CONTAINS]: null,+ [CoreWorkflowFilterOperand.DOES_NOT_CONTAIN]: null,+ [CoreWorkflowFilterOperand.IS_NOT]: null,+ },+};++const SEPARATOR_BY_LOGICAL_OPERATOR: Record<+ CoreWorkflowFilterLogicalOperator,+ string+> = {+ [CoreWorkflowFilterLogicalOperator.AND]: ' AND ',+ [CoreWorkflowFilterLogicalOperator.OR]: ' OR ',+};++const buildRulePredicate = ({+ rule,+ bindParameter,+}: {+ rule: CoreWorkflowFilterRuleInput;+ bindParameter: BindParameter;+}): string => {+ const buildPredicate =+ PREDICATE_BUILDER_BY_OPERAND_BY_FIELD_KEY[rule.fieldKey][rule.operand];++ if (!isDefined(buildPredicate)) {+ throw new UserInputError(+ `Operand ${rule.operand} is not supported on field ${rule.fieldKey}`,+ );+ }++ return buildPredicate({ rule, bindParameter });+};++export const buildCoreWorkflowFilterPredicate = ({+ filter,+ firstParameterIndex,+}: {+ filter?: CoreWorkflowFilterInput | null;+ firstParameterIndex: number;+}): CoreWorkflowFilterPredicate => {+ if (!isDefined(filter) || !isNonEmptyArray(filter.rules)) {+ return { parameters: [] };+ }++ const parameters: unknown[] = [];+ const bindParameter: BindParameter = (value) => {+ parameters.push(value);++ return `$${firstParameterIndex + parameters.length - 1}`;+ };++ const rulePredicates = filter.rules.map((rule) =>+ buildRulePredicate({ rule, bindParameter }),+ );++ return {+ predicate: `(${rulePredicates.join(SEPARATOR_BY_LOGICAL_OPERATOR[filter.logicalOperator])})`,+ parameters,+ };+};diff --git a/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-status-predicate.util.ts b/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-status-predicate.util.tsnew file mode 100644index 00000000000..f676587a59a--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-status-predicate.util.ts@@ -0,0 +1,19 @@+import { WorkflowStatus } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';++const HAS_DRAFT_VERSION = `coalesce(bool_or(v.status = 'DRAFT'), false)`;+const HAS_ACTIVE_VERSION = `coalesce(bool_or(v.status = 'ACTIVE'), false)`;+const HAS_DEACTIVATED_VERSION = `coalesce(bool_or(v.status = 'DEACTIVATED'), false)`;++const STATUS_PREDICATE_BY_STATUS: Record<WorkflowStatus, string> = {+ [WorkflowStatus.DRAFT]: HAS_DRAFT_VERSION,+ [WorkflowStatus.ACTIVE]: HAS_ACTIVE_VERSION,+ [WorkflowStatus.DEACTIVATED]: `(NOT ${HAS_ACTIVE_VERSION} AND ${HAS_DEACTIVATED_VERSION})`,+};++export const buildCoreWorkflowHasAnyOfStatusesPredicate = (+ statuses: WorkflowStatus[],+): string =>+ `(${statuses.map((status) => STATUS_PREDICATE_BY_STATUS[status]).join(' OR ')})`;++export const CORE_WORKFLOW_HAS_ANY_STATUS_PREDICATE =+ buildCoreWorkflowHasAnyOfStatusesPredicate(Object.values(WorkflowStatus));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.tsindex 0f5727913dd..8607cd60b52 100644--- 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.ts@@ -14,8 +14,8 @@ const graphql = (query: string, variables?: object) =>.send({ query, variables });const CORE_WORKFLOWS_QUERY = `- query CoreWorkflows {- coreWorkflows(first: 200) {+ query CoreWorkflows($filter: CoreWorkflowFilterInput) {+ coreWorkflows(first: 200, filter: $filter) {edges {node {id@@ -45,23 +45,53 @@ type CoreWorkflow = {updatedAt: string;};+type CoreWorkflowFilterRule = {+ fieldKey: 'NAME' | 'STATUSES' | 'UPDATED_AT';+ operand:+ | 'CONTAINS'+ | 'DOES_NOT_CONTAIN'+ | 'IS'+ | 'IS_NOT'+ | 'IS_EMPTY'+ | 'IS_NOT_EMPTY'+ | 'IS_BEFORE'+ | 'IS_AFTER';+ value?: string;+};++type CoreWorkflowFilter = {+ logicalOperator: 'AND' | 'OR';+ rules: CoreWorkflowFilterRule[];+};+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);+ const findCoreWorkflow = async (+ filter?: CoreWorkflowFilter,+ ): Promise<CoreWorkflow | undefined> => {+ const response = await graphql(CORE_WORKFLOWS_QUERY, { filter });expect(response.body.errors).toBeUndefined();- return (response.body.data.coreWorkflows.edges as { node: CoreWorkflow }[])+ const { edges, pageInfo, totalCount } = response.body.data+ .coreWorkflows as {+ edges: { node: CoreWorkflow }[];+ pageInfo: { hasNextPage: boolean };+ totalCount: number;+ };++ if (!pageInfo.hasNextPage) {+ expect(totalCount).toBe(edges.length);+ }++ return edges.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 itconst waitForCoreWorkflow = async (predicate: (workflow: CoreWorkflow | undefined) => boolean,): Promise<CoreWorkflow | undefined> => {@@ -137,6 +167,204 @@ describe('coreWorkflows (e2e)', () => {expect(coreWorkflow?.statuses).toEqual(['DRAFT']);});+ it('should filter by derived statuses', async () => {+ await waitForCoreWorkflow(+ (workflow) => workflow?.statuses.includes('DRAFT') === true,+ );++ const draftFiltered = await findCoreWorkflow({+ logicalOperator: 'AND',+ rules: [+ {+ fieldKey: 'STATUSES',+ operand: 'CONTAINS',+ value: JSON.stringify(['DRAFT']),+ },+ ],+ });++ expect(draftFiltered?.statuses).toEqual(['DRAFT']);++ const activeOrDeactivatedFiltered = await findCoreWorkflow({+ logicalOperator: 'AND',+ rules: [+ {+ fieldKey: 'STATUSES',+ operand: 'CONTAINS',+ value: JSON.stringify(['ACTIVE', 'DEACTIVATED']),+ },+ ],+ });++ expect(activeOrDeactivatedFiltered).toBeUndefined();+ });++ it('should filter by a case-insensitive name match', async () => {+ await waitForCoreWorkflow((workflow) => isDefined(workflow));++ const matching = await findCoreWorkflow({+ logicalOperator: 'AND',+ rules: [+ { fieldKey: 'NAME', operand: 'CONTAINS', value: 'core workflows li' },+ ],+ });++ expect(matching?.name).toBe('Core Workflows List');++ const notMatching = await findCoreWorkflow({+ logicalOperator: 'AND',+ rules: [+ {+ fieldKey: 'NAME',+ operand: 'CONTAINS',+ value: 'no workflow bears this name',+ },+ ],+ });++ expect(notMatching).toBeUndefined();+ });++ it('should compose a status rule and a name rule with AND', async () => {+ await waitForCoreWorkflow(+ (workflow) => workflow?.statuses.includes('DRAFT') === true,+ );++ const filtered = await findCoreWorkflow({+ logicalOperator: 'AND',+ rules: [+ {+ fieldKey: 'STATUSES',+ operand: 'CONTAINS',+ value: JSON.stringify(['DRAFT']),+ },+ { fieldKey: 'NAME', operand: 'CONTAINS', value: 'CORE WORKFLOWS LIST' },+ ],+ });++ expect(filtered?.statuses).toEqual(['DRAFT']);++ const filteredOut = await findCoreWorkflow({+ logicalOperator: 'AND',+ rules: [+ {+ fieldKey: 'STATUSES',+ operand: 'CONTAINS',+ value: JSON.stringify(['ACTIVE']),+ },+ { fieldKey: 'NAME', operand: 'CONTAINS', value: 'CORE WORKFLOWS LIST' },+ ],+ });++ expect(filteredOut).toBeUndefined();+ });++ it('should compose a name rule and a status rule with OR', async () => {+ await waitForCoreWorkflow(+ (workflow) => workflow?.statuses.includes('DRAFT') === true,+ );++ const matchedByStatusOnly = await findCoreWorkflow({+ logicalOperator: 'OR',+ rules: [+ {+ fieldKey: 'NAME',+ operand: 'CONTAINS',+ value: 'no workflow bears this name',+ },+ {+ fieldKey: 'STATUSES',+ operand: 'CONTAINS',+ value: JSON.stringify(['DRAFT']),+ },+ ],+ });++ expect(matchedByStatusOnly?.statuses).toEqual(['DRAFT']);++ const matchedByNeither = await findCoreWorkflow({+ logicalOperator: 'OR',+ rules: [+ {+ fieldKey: 'NAME',+ operand: 'CONTAINS',+ value: 'no workflow bears this name',+ },+ {+ fieldKey: 'STATUSES',+ operand: 'CONTAINS',+ value: JSON.stringify(['ACTIVE']),+ },+ ],+ });++ expect(matchedByNeither).toBeUndefined();+ });++ it('should filter by update date', async () => {+ const coreWorkflow = await waitForCoreWorkflow((workflow) =>+ isDefined(workflow),+ );++ expect(coreWorkflow).toBeDefined();++ const updatedAt = new Date(coreWorkflow?.updatedAt ?? '');+ const oneHourBefore = new Date(updatedAt.getTime() - 60 * 60 * 1000);++ const updatedAfter = await findCoreWorkflow({+ logicalOperator: 'AND',+ rules: [+ {+ fieldKey: 'UPDATED_AT',+ operand: 'IS_AFTER',+ value: JSON.stringify(oneHourBefore.toISOString()),+ },+ ],+ });++ expect(updatedAfter?.workspaceWorkflowId).toBe(workflowId);++ const updatedBefore = await findCoreWorkflow({+ logicalOperator: 'AND',+ rules: [+ {+ fieldKey: 'UPDATED_AT',+ operand: 'IS_BEFORE',+ value: JSON.stringify(oneHourBefore.toISOString()),+ },+ ],+ });++ expect(updatedBefore).toBeUndefined();++ const updatedOnTheSameDay = await findCoreWorkflow({+ logicalOperator: 'AND',+ rules: [+ {+ fieldKey: 'UPDATED_AT',+ operand: 'IS',+ value: JSON.stringify(updatedAt.toISOString()),+ },+ ],+ });++ expect(updatedOnTheSameDay?.workspaceWorkflowId).toBe(workflowId);+ });++ it('should reject an operand the field does not support', async () => {+ const response = await graphql(CORE_WORKFLOWS_QUERY, {+ filter: {+ logicalOperator: 'AND',+ rules: [{ fieldKey: 'STATUSES', operand: 'IS', value: 'ACTIVE' }],+ },+ });++ expect(response.body.errors).toBeDefined();+ expect(response.body.errors[0].message).toContain(+ 'Operand IS is not supported on field STATUSES',+ );+ });+it('should list the workflow as ACTIVE once its version is activated', async () => {await updateWorkflowVersionTrigger({workflowVersionId: firstVersionId,diff --git a/packages/twenty-shared/src/constants/MaxCoreWorkflowFilterRules.ts b/packages/twenty-shared/src/constants/MaxCoreWorkflowFilterRules.tsnew file mode 100644index 00000000000..820ee58163f--- /dev/null+++ b/packages/twenty-shared/src/constants/MaxCoreWorkflowFilterRules.ts@@ -0,0 +1 @@+export const MAX_CORE_WORKFLOW_FILTER_RULES = 50;diff --git a/packages/twenty-shared/src/constants/index.ts b/packages/twenty-shared/src/constants/index.tsindex 559116f4e5b..ce7d0ef28da 100644--- a/packages/twenty-shared/src/constants/index.ts+++ b/packages/twenty-shared/src/constants/index.ts@@ -45,6 +45,7 @@ export { GROUP_BY_DATE_GRANULARITY_THAT_REQUIRE_TIME_ZONE } from './GroupByDateGexport { IANA_TIME_ZONES } from './IanaTimeZones';export { IMAGE_IDENTIFIER_FIELD_METADATA_TYPES } from './ImageIdentifierFieldMetadataTypes';export { LABEL_IDENTIFIER_FIELD_METADATA_TYPES } from './LabelIdentifierFieldMetadataTypes';+export { MAX_CORE_WORKFLOW_FILTER_RULES } from './MaxCoreWorkflowFilterRules';export { MAX_CUSTOM_INDEXES_PER_OBJECT } from './MaxCustomIndexesPerObject';export { MAX_EMAIL_RECIPIENTS } from './MaxEmailRecipients';export { MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES } from './MultiItemFieldDefaultMaxValues';diff --git a/packages/twenty-shared/src/types/SidePanelPages.ts b/packages/twenty-shared/src/types/SidePanelPages.tsindex c2f6ba8ef34..41070818bdc 100644--- a/packages/twenty-shared/src/types/SidePanelPages.ts+++ b/packages/twenty-shared/src/types/SidePanelPages.ts@@ -37,4 +37,5 @@ export enum SidePanelPages {EmailBlockSettings = 'email-block-settings',SettingsMetadataTranslations = 'settings-metadata-translations',RoutedPage = 'routed-page',+ WorkflowCoreFilters = 'workflow-core-filters',}