The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add a pinned Duplicate List action copying a message list and its members (#25473)
Félix Malfaitdcab6a5cb3ed
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphqlindex 9eb1937b2a1..094dfccf24b 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql@@ -149,6 +149,7 @@ enum EngineComponentKey {SAVE_DASHBOARD_LAYOUTCANCEL_DASHBOARD_LAYOUTDUPLICATE_DASHBOARD+ DUPLICATE_MESSAGE_LISTACTIVATE_WORKFLOWDEACTIVATE_WORKFLOWDISCARD_DRAFT_WORKFLOW@@ -2925,6 +2926,16 @@ type SendMessageCampaignOutputDTO {audience: CampaignAudiencePreviewDTO!}+type DuplicatedMessageList {+ id: UUID!+ name: String+ description: String+ position: Float!+ memberCount: Float!+ createdAt: String!+ updatedAt: String!+}+type MessageSuppression {id: UUID!createdAt: DateTime!@@ -3891,6 +3902,7 @@ type Mutation {sendMessageCampaign(input: SendMessageCampaignInput!): SendMessageCampaignOutputDTO!cancelMessageCampaign(input: CancelMessageCampaignInput!): CancelMessageCampaignOutputDTO!sendMessageCampaignTest(input: SendMessageCampaignTestInput!): SendEmailViaDomainOutput!+ duplicateMessageList(id: UUID!): DuplicatedMessageList!createMessageSuppression(input: CreateMessageSuppressionInput!): MessageSuppression!deleteMessageSuppression(id: UUID!): Boolean!createUnsubscribeTopic(input: CreateUnsubscribeTopicInput!): UnsubscribeTopic!diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.tsindex afdfa037a06..9182e88ff02 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts@@ -127,7 +127,7 @@ export interface CommandMenuItem {__typename: 'CommandMenuItem'}-export type EngineComponentKey = 'NAVIGATE_TO_NEXT_RECORD' | 'NAVIGATE_TO_PREVIOUS_RECORD' | 'CREATE_NEW_RECORD' | 'DELETE_RECORDS' | 'RESTORE_RECORDS' | 'DESTROY_RECORDS' | 'ADD_TO_FAVORITES' | 'REMOVE_FROM_FAVORITES' | 'EXPORT_NOTE_TO_PDF' | 'EXPORT_RECORDS' | 'UPDATE_MULTIPLE_RECORDS' | 'MERGE_MULTIPLE_RECORDS' | 'IMPORT_RECORDS' | 'EXPORT_VIEW' | 'SEE_DELETED_RECORDS' | 'CREATE_NEW_VIEW' | 'HIDE_DELETED_RECORDS' | 'EDIT_RECORD_PAGE_LAYOUT' | 'EDIT_DASHBOARD_LAYOUT' | 'SAVE_DASHBOARD_LAYOUT' | 'CANCEL_DASHBOARD_LAYOUT' | 'DUPLICATE_DASHBOARD' | 'ACTIVATE_WORKFLOW' | 'DEACTIVATE_WORKFLOW' | 'DISCARD_DRAFT_WORKFLOW' | 'TEST_WORKFLOW' | 'SEE_ACTIVE_VERSION_WORKFLOW' | 'SEE_RUNS_WORKFLOW' | 'SEE_VERSIONS_WORKFLOW' | 'ADD_NODE_WORKFLOW' | 'TIDY_UP_WORKFLOW' | 'DUPLICATE_WORKFLOW' | 'SEE_VERSION_WORKFLOW_RUN' | 'SEE_WORKFLOW_WORKFLOW_RUN' | 'STOP_WORKFLOW_RUN' | 'RETRY_WORKFLOW_RUN' | 'SEE_RUNS_WORKFLOW_VERSION' | 'SEE_WORKFLOW_WORKFLOW_VERSION' | 'USE_AS_DRAFT_WORKFLOW_VERSION' | 'SEE_VERSIONS_WORKFLOW_VERSION' | 'SEARCH_RECORDS' | 'SEARCH_RECORDS_FALLBACK' | 'ASK_AI' | 'VIEW_PREVIOUS_AI_CHATS' | 'NAVIGATION' | 'TRIGGER_WORKFLOW_VERSION' | 'FRONT_COMPONENT_RENDERER' | 'REPLY_TO_EMAIL_THREAD' | 'COMPOSE_EMAIL' | 'COMPOSE_CAMPAIGN' | 'SEND_MESSAGE_CAMPAIGN' | 'SEND_MESSAGE_CAMPAIGN_TEST' | 'EMAIL_BLOCK_SETTINGS' | 'GO_TO_PEOPLE' | 'GO_TO_COMPANIES' | 'GO_TO_DASHBOARDS' | 'GO_TO_OPPORTUNITIES' | 'GO_TO_SETTINGS' | 'GO_TO_TASKS' | 'GO_TO_NOTES' | 'GO_TO_WORKFLOWS' | 'GO_TO_RUNS' | 'DELETE_SINGLE_RECORD' | 'DELETE_MULTIPLE_RECORDS' | 'RESTORE_SINGLE_RECORD' | 'RESTORE_MULTIPLE_RECORDS' | 'DESTROY_SINGLE_RECORD' | 'DESTROY_MULTIPLE_RECORDS' | 'EXPORT_FROM_RECORD_INDEX' | 'EXPORT_FROM_RECORD_SHOW' | 'EXPORT_MULTIPLE_RECORDS'+export type EngineComponentKey = 'NAVIGATE_TO_NEXT_RECORD' | 'NAVIGATE_TO_PREVIOUS_RECORD' | 'CREATE_NEW_RECORD' | 'DELETE_RECORDS' | 'RESTORE_RECORDS' | 'DESTROY_RECORDS' | 'ADD_TO_FAVORITES' | 'REMOVE_FROM_FAVORITES' | 'EXPORT_NOTE_TO_PDF' | 'EXPORT_RECORDS' | 'UPDATE_MULTIPLE_RECORDS' | 'MERGE_MULTIPLE_RECORDS' | 'IMPORT_RECORDS' | 'EXPORT_VIEW' | 'SEE_DELETED_RECORDS' | 'CREATE_NEW_VIEW' | 'HIDE_DELETED_RECORDS' | 'EDIT_RECORD_PAGE_LAYOUT' | 'EDIT_DASHBOARD_LAYOUT' | 'SAVE_DASHBOARD_LAYOUT' | 'CANCEL_DASHBOARD_LAYOUT' | 'DUPLICATE_DASHBOARD' | 'DUPLICATE_MESSAGE_LIST' | 'ACTIVATE_WORKFLOW' | 'DEACTIVATE_WORKFLOW' | 'DISCARD_DRAFT_WORKFLOW' | 'TEST_WORKFLOW' | 'SEE_ACTIVE_VERSION_WORKFLOW' | 'SEE_RUNS_WORKFLOW' | 'SEE_VERSIONS_WORKFLOW' | 'ADD_NODE_WORKFLOW' | 'TIDY_UP_WORKFLOW' | 'DUPLICATE_WORKFLOW' | 'SEE_VERSION_WORKFLOW_RUN' | 'SEE_WORKFLOW_WORKFLOW_RUN' | 'STOP_WORKFLOW_RUN' | 'RETRY_WORKFLOW_RUN' | 'SEE_RUNS_WORKFLOW_VERSION' | 'SEE_WORKFLOW_WORKFLOW_VERSION' | 'USE_AS_DRAFT_WORKFLOW_VERSION' | 'SEE_VERSIONS_WORKFLOW_VERSION' | 'SEARCH_RECORDS' | 'SEARCH_RECORDS_FALLBACK' | 'ASK_AI' | 'VIEW_PREVIOUS_AI_CHATS' | 'NAVIGATION' | 'TRIGGER_WORKFLOW_VERSION' | 'FRONT_COMPONENT_RENDERER' | 'REPLY_TO_EMAIL_THREAD' | 'COMPOSE_EMAIL' | 'COMPOSE_CAMPAIGN' | 'SEND_MESSAGE_CAMPAIGN' | 'SEND_MESSAGE_CAMPAIGN_TEST' | 'EMAIL_BLOCK_SETTINGS' | 'GO_TO_PEOPLE' | 'GO_TO_COMPANIES' | 'GO_TO_DASHBOARDS' | 'GO_TO_OPPORTUNITIES' | 'GO_TO_SETTINGS' | 'GO_TO_TASKS' | 'GO_TO_NOTES' | 'GO_TO_WORKFLOWS' | 'GO_TO_RUNS' | 'DELETE_SINGLE_RECORD' | 'DELETE_MULTIPLE_RECORDS' | 'RESTORE_SINGLE_RECORD' | 'RESTORE_MULTIPLE_RECORDS' | 'DESTROY_SINGLE_RECORD' | 'DESTROY_MULTIPLE_RECORDS' | 'EXPORT_FROM_RECORD_INDEX' | 'EXPORT_FROM_RECORD_SHOW' | 'EXPORT_MULTIPLE_RECORDS'export type CommandMenuItemAvailabilityType = 'GLOBAL' | 'GLOBAL_OBJECT_CONTEXT' | 'RECORD_SELECTION' | 'FALLBACK'@@ -2510,6 +2510,17 @@ export interface SendMessageCampaignOutputDTO {__typename: 'SendMessageCampaignOutputDTO'}+export interface DuplicatedMessageList {+ id: Scalars['UUID']+ name?: Scalars['String']+ description?: Scalars['String']+ position: Scalars['Float']+ memberCount: Scalars['Float']+ createdAt: Scalars['String']+ updatedAt: Scalars['String']+ __typename: 'DuplicatedMessageList'+}+export interface MessageSuppression {id: Scalars['UUID']createdAt: Scalars['DateTime']@@ -3333,6 +3344,7 @@ export interface Mutation {sendMessageCampaign: SendMessageCampaignOutputDTOcancelMessageCampaign: CancelMessageCampaignOutputDTOsendMessageCampaignTest: SendEmailViaDomainOutput+ duplicateMessageList: DuplicatedMessageListcreateMessageSuppression: MessageSuppressiondeleteMessageSuppression: Scalars['Boolean']createUnsubscribeTopic: UnsubscribeTopic@@ -6051,6 +6063,18 @@ export interface SendMessageCampaignOutputDTOGenqlSelection{__scalar?: boolean | number}+export interface DuplicatedMessageListGenqlSelection{+ id?: boolean | number+ name?: boolean | number+ description?: boolean | number+ position?: boolean | number+ memberCount?: boolean | number+ createdAt?: boolean | number+ updatedAt?: boolean | number+ __typename?: boolean | number+ __scalar?: boolean | number+}+export interface MessageSuppressionGenqlSelection{id?: boolean | numbercreatedAt?: boolean | number@@ -6946,6 +6970,7 @@ export interface MutationGenqlSelection{sendMessageCampaign?: (SendMessageCampaignOutputDTOGenqlSelection & { __args: {input: SendMessageCampaignInput} })cancelMessageCampaign?: (CancelMessageCampaignOutputDTOGenqlSelection & { __args: {input: CancelMessageCampaignInput} })sendMessageCampaignTest?: (SendEmailViaDomainOutputGenqlSelection & { __args: {input: SendMessageCampaignTestInput} })+ duplicateMessageList?: (DuplicatedMessageListGenqlSelection & { __args: {id: Scalars['UUID']} })createMessageSuppression?: (MessageSuppressionGenqlSelection & { __args: {input: CreateMessageSuppressionInput} })deleteMessageSuppression?: { __args: {id: Scalars['UUID']} }createUnsubscribeTopic?: (UnsubscribeTopicGenqlSelection & { __args: {input: CreateUnsubscribeTopicInput} })@@ -9316,6 +9341,14 @@ export interface LogicFunctionLogsInput {applicationId?: (Scalars['UUID'] | null+ const DuplicatedMessageList_possibleTypes: string[] = ['DuplicatedMessageList']+ export const isDuplicatedMessageList = (obj?: { __typename?: any } | null): obj is DuplicatedMessageList => {+ if (!obj?.__typename) throw new Error('__typename is missing in "isDuplicatedMessageList"')+ return DuplicatedMessageList_possibleTypes.includes(obj.__typename)+ }+++const MessageSuppression_possibleTypes: string[] = ['MessageSuppression']export const isMessageSuppression = (obj?: { __typename?: any } | null): obj is MessageSuppression => {if (!obj?.__typename) throw new Error('__typename is missing in "isMessageSuppression"')@@ -9809,6 +9842,7 @@ export const enumEngineComponentKey = {SAVE_DASHBOARD_LAYOUT: 'SAVE_DASHBOARD_LAYOUT' as const,CANCEL_DASHBOARD_LAYOUT: 'CANCEL_DASHBOARD_LAYOUT' as const,DUPLICATE_DASHBOARD: 'DUPLICATE_DASHBOARD' as const,+ DUPLICATE_MESSAGE_LIST: 'DUPLICATE_MESSAGE_LIST' as const,ACTIVATE_WORKFLOW: 'ACTIVATE_WORKFLOW' as const,DEACTIVATE_WORKFLOW: 'DEACTIVATE_WORKFLOW' as const,DISCARD_DRAFT_WORKFLOW: 'DISCARD_DRAFT_WORKFLOW' as const,diff --git a/packages/twenty-client-sdk/src/metadata/generated/types.ts b/packages/twenty-client-sdk/src/metadata/generated/types.tsindex 30f392b49d9..7d065fb1098 100644--- a/packages/twenty-client-sdk/src/metadata/generated/types.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/types.ts@@ -86,22 +86,22 @@ export default {313,314,315,- 322,323,- 326,- 363,- 370,- 372,+ 324,+ 327,+ 364,+ 371,373,374,375,- 377,- 379,- 384,- 399,- 411,- 526,- 551+ 376,+ 378,+ 380,+ 385,+ 400,+ 412,+ 527,+ 552],"types": {"BillingProductDTO": {@@ -5627,6 +5627,32 @@ export default {1]},+ "DuplicatedMessageList": {+ "id": [+ 3+ ],+ "name": [+ 1+ ],+ "description": [+ 1+ ],+ "position": [+ 15+ ],+ "memberCount": [+ 15+ ],+ "createdAt": [+ 1+ ],+ "updatedAt": [+ 1+ ],+ "__typename": [+ 1+ ]+ },"MessageSuppression": {"id": [3@@ -5638,10 +5664,10 @@ export default {1],"reason": [- 322+ 323],"source": [- 323+ 324],"unsubscribeTopicId": [3@@ -5654,7 +5680,7 @@ export default {"MessageSuppressionSource": {},"MessageSuppressionList": {"records": [- 321+ 322],"totalCount": [28@@ -5680,7 +5706,7 @@ export default {1],"visibility": [- 326+ 327],"__typename": [1@@ -5726,7 +5752,7 @@ export default {1],"location": [- 328+ 329],"__typename": [1@@ -5754,13 +5780,13 @@ export default {1],"IMAP": [- 330+ 331],"SMTP": [- 330+ 331],"CALDAV": [- 330+ 331],"__typename": [1@@ -5780,7 +5806,7 @@ export default {3],"connectionParameters": [- 331+ 332],"__typename": [1@@ -6005,7 +6031,7 @@ export default {1],"series": [- 340+ 341],"xAxisLabel": [1@@ -6054,7 +6080,7 @@ export default {1],"data": [- 342+ 343],"__typename": [1@@ -6062,7 +6088,7 @@ export default {},"LineChartData": {"series": [- 343+ 344],"xAxisLabel": [1@@ -6099,7 +6125,7 @@ export default {},"PieChartData": {"data": [- 345+ 346],"showLegend": [8@@ -6204,13 +6230,13 @@ export default {},"EventLogQueryResult": {"records": [- 350+ 351],"totalCount": [28],"pageInfo": [- 351+ 352],"__typename": [1@@ -6274,7 +6300,7 @@ export default {1],"parts": [- 336+ 337],"processedAt": [4@@ -6343,7 +6369,7 @@ export default {},"AiSystemPromptPreview": {"sections": [- 356+ 357],"estimatedTokenCount": [28@@ -6371,7 +6397,7 @@ export default {28],"error": [- 358+ 359],"__typename": [1@@ -6404,10 +6430,10 @@ export default {},"StartWorkspaceSetupChatResult": {"outcome": [- 363+ 364],"thread": [- 355+ 356],"__typename": [1@@ -6445,10 +6471,10 @@ export default {3],"evaluations": [- 364+ 365],"messages": [- 354+ 355],"createdAt": [4@@ -6510,7 +6536,7 @@ export default {9],"scope": [- 370+ 371],"__typename": [1@@ -6525,19 +6551,19 @@ export default {1],"syncStatus": [- 372+ 373],"syncStage": [- 373+ 374],"visibility": [- 374+ 375],"isContactAutoCreationEnabled": [8],"contactAutoCreationPolicy": [- 375+ 376],"isSyncEnabled": [8@@ -6588,7 +6614,7 @@ export default {1],"pendingSyncAction": [- 377+ 378],"messageChannelId": [3@@ -6630,7 +6656,7 @@ export default {1],"provenance": [- 379+ 380],"__typename": [1@@ -6659,7 +6685,7 @@ export default {3],"through": [- 380+ 381],"__typename": [1@@ -6679,7 +6705,7 @@ export default {1],"emit": [- 381+ 382],"action": [1@@ -6714,7 +6740,7 @@ export default {},"CollectionHash": {"collectionName": [- 384+ 385],"hash": [1@@ -6778,13 +6804,13 @@ export default {},"MinimalMetadata": {"objectMetadataItems": [- 385+ 386],"views": [- 386+ 387],"collectionHashes": [- 383+ 384],"__typename": [1@@ -6844,7 +6870,7 @@ export default {174,{"input": [- 389+ 390]}],@@ -6969,7 +6995,7 @@ export default {2,{"input": [- 390,+ 391,"GetApiKeyInput!"]}@@ -7078,7 +7104,7 @@ export default {10,{"input": [- 391,+ 392,"AgentIdInput!"]}@@ -7091,7 +7117,7 @@ export default {"CursorPaging!"],"filter": [- 392,+ 393,"ObjectFilter!"]}@@ -7121,7 +7147,7 @@ export default {21,{"input": [- 393,+ 394,"LogicFunctionIdInput!"]}@@ -7133,7 +7159,7 @@ export default {9,{"input": [- 393,+ 394,"LogicFunctionIdInput!"]}@@ -7142,7 +7168,7 @@ export default {1,{"input": [- 393,+ 394,"LogicFunctionIdInput!"]}@@ -7364,22 +7390,22 @@ export default {317,{"input": [- 394,+ 395,"PreviewMessageCampaignAudienceInput!"]}],"messageSuppressions": [- 324,+ 325,{"input": [- 395,+ 396,"FindMessageSuppressionsInput!"]}],"unsubscribeTopics": [- 325+ 326],"myMessageChannels": [308,@@ -7393,7 +7419,7 @@ export default {304],"getToolIndex": [- 335+ 336],"getToolInputSchema": [9,@@ -7405,10 +7431,10 @@ export default {}],"webhooks": [- 334+ 335],"webhook": [- 334,+ 335,{"id": [3,@@ -7417,7 +7443,7 @@ export default {}],"myMessageFolders": [- 376,+ 377,{"messageChannelId": [3@@ -7425,7 +7451,7 @@ export default {}],"myCalendarChannels": [- 371,+ 372,{"connectedAccountId": [3@@ -7433,17 +7459,17 @@ export default {}],"minimalMetadata": [- 387+ 388],"appKeyValue": [- 369,+ 370,{"key": [1,"String!"],"scope": [- 370+ 371]}],@@ -7460,7 +7486,7 @@ export default {221,{"filter": [- 396+ 397]}],@@ -7474,13 +7500,13 @@ export default {}],"findWorkspaceAiStats": [- 366+ 367],"chatThreads": [- 355+ 356],"chatThread": [- 355,+ 356,{"id": [3,@@ -7489,7 +7515,7 @@ export default {}],"chatMessages": [- 354,+ 355,{"threadId": [3,@@ -7498,7 +7524,7 @@ export default {}],"chatStreamCatchupChunks": [- 359,+ 360,{"threadId": [3,@@ -7507,13 +7533,13 @@ export default {}],"getAiSystemPromptPreview": [- 357+ 358],"skills": [- 353+ 354],"skill": [- 353,+ 354,{"id": [3,@@ -7522,7 +7548,7 @@ export default {}],"agentTurns": [- 365,+ 366,{"agentId": [3,@@ -7531,13 +7557,13 @@ export default {}],"timelineActivityTypes": [- 382+ 383],"metadataTranslations": [- 378,+ 379,{"input": [- 397,+ 398,"MetadataTranslationsInput!"]}@@ -7600,37 +7626,37 @@ export default {227],"eventLogs": [- 352,+ 353,{"input": [- 398,+ 399,"EventLogQueryInput!"]}],"pieChartData": [- 346,+ 347,{"input": [- 402,+ 403,"PieChartDataInput!"]}],"lineChartData": [- 344,+ 345,{"input": [- 403,+ 404,"LineChartDataInput!"]}],"barChartData": [- 341,+ 342,{"input": [- 404,+ 405,"BarChartDataInput!"]}@@ -7645,7 +7671,7 @@ export default {}],"getConnectedImapSmtpCaldavAccount": [- 332,+ 333,{"id": [3,@@ -7654,7 +7680,7 @@ export default {}],"getAutoCompleteAddress": [- 327,+ 328,{"address": [1,@@ -7673,7 +7699,7 @@ export default {}],"getAddressDetails": [- 329,+ 330,{"placeId": [1,@@ -7739,10 +7765,10 @@ export default {},"ObjectFilter": {"and": [- 392+ 393],"or": [- 392+ 393],"id": [31@@ -7796,7 +7822,7 @@ export default {},"FindMessageSuppressionsInput": {"reason": [- 322+ 323],"searchTerm": [1@@ -7844,10 +7870,10 @@ export default {},"EventLogQueryInput": {"table": [- 399+ 400],"filters": [- 400+ 401],"first": [28@@ -7868,7 +7894,7 @@ export default {1],"dateRange": [- 401+ 402],"recordId": [1@@ -7929,7 +7955,7 @@ export default {8,{"input": [- 406,+ 407,"AddQuerySubscriptionInput!"]}@@ -7938,7 +7964,7 @@ export default {8,{"input": [- 407,+ 408,"RemoveQueryFromEventStreamInput!"]}@@ -7947,7 +7973,7 @@ export default {153,{"inputs": [- 408,+ 409,"[CreateNavigationMenuItemInput!]!"]}@@ -7956,7 +7982,7 @@ export default {153,{"input": [- 408,+ 409,"CreateNavigationMenuItemInput!"]}@@ -7965,7 +7991,7 @@ export default {153,{"inputs": [- 409,+ 410,"[UpdateOneNavigationMenuItemInput!]!"]}@@ -7974,7 +8000,7 @@ export default {153,{"input": [- 409,+ 410,"UpdateOneNavigationMenuItemInput!"]}@@ -8048,7 +8074,7 @@ export default {150,{"file": [- 411,+ 412,"Upload!"]}@@ -8057,7 +8083,7 @@ export default {150,{"file": [- 411,+ 412,"Upload!"]}@@ -8066,7 +8092,7 @@ export default {150,{"file": [- 411,+ 412,"Upload!"],"fieldMetadataUniversalIdentifier": [@@ -8079,7 +8105,7 @@ export default {175,{"input": [- 412,+ 413,"UpsertUsageLimitInput!"]}@@ -8097,7 +8123,7 @@ export default {56,{"input": [- 413,+ 414,"CreateViewFilterGroupInput!"]}@@ -8110,7 +8136,7 @@ export default {"String!"],"input": [- 414,+ 415,"UpdateViewFilterGroupInput!"]}@@ -8137,7 +8163,7 @@ export default {58,{"input": [- 415,+ 416,"CreateViewFilterInput!"]}@@ -8146,7 +8172,7 @@ export default {58,{"input": [- 416,+ 417,"UpdateViewFilterInput!"]}@@ -8155,7 +8181,7 @@ export default {58,{"input": [- 418,+ 419,"DeleteViewFilterInput!"]}@@ -8164,7 +8190,7 @@ export default {58,{"input": [- 419,+ 420,"DestroyViewFilterInput!"]}@@ -8173,7 +8199,7 @@ export default {64,{"input": [- 420,+ 421,"CreateViewInput!"]}@@ -8186,7 +8212,7 @@ export default {"String!"],"input": [- 421,+ 422,"UpdateViewInput!"]}@@ -8213,7 +8239,7 @@ export default {64,{"input": [- 422,+ 423,"UpsertViewWidgetInput!"]}@@ -8222,7 +8248,7 @@ export default {61,{"input": [- 428,+ 429,"CreateViewSortInput!"]}@@ -8231,7 +8257,7 @@ export default {61,{"input": [- 429,+ 430,"UpdateViewSortInput!"]}@@ -8240,7 +8266,7 @@ export default {8,{"input": [- 431,+ 432,"DeleteViewSortInput!"]}@@ -8249,7 +8275,7 @@ export default {8,{"input": [- 432,+ 433,"DestroyViewSortInput!"]}@@ -8258,7 +8284,7 @@ export default {54,{"input": [- 433,+ 434,"UpdateViewFieldInput!"]}@@ -8267,7 +8293,7 @@ export default {54,{"input": [- 435,+ 436,"CreateViewFieldInput!"]}@@ -8276,7 +8302,7 @@ export default {54,{"inputs": [- 435,+ 436,"[CreateViewFieldInput!]!"]}@@ -8285,7 +8311,7 @@ export default {54,{"input": [- 436,+ 437,"DeleteViewFieldInput!"]}@@ -8294,7 +8320,7 @@ export default {54,{"input": [- 437,+ 438,"DestroyViewFieldInput!"]}@@ -8303,7 +8329,7 @@ export default {63,{"input": [- 438,+ 439,"UpdateViewFieldGroupInput!"]}@@ -8312,7 +8338,7 @@ export default {63,{"input": [- 440,+ 441,"CreateViewFieldGroupInput!"]}@@ -8321,7 +8347,7 @@ export default {63,{"inputs": [- 440,+ 441,"[CreateViewFieldGroupInput!]!"]}@@ -8330,7 +8356,7 @@ export default {63,{"input": [- 441,+ 442,"DeleteViewFieldGroupInput!"]}@@ -8339,7 +8365,7 @@ export default {63,{"input": [- 442,+ 443,"DestroyViewFieldGroupInput!"]}@@ -8348,7 +8374,7 @@ export default {64,{"input": [- 443,+ 444,"UpsertFieldsWidgetInput!"]}@@ -8357,7 +8383,7 @@ export default {2,{"input": [- 446,+ 447,"CreateApiKeyInput!"]}@@ -8366,7 +8392,7 @@ export default {2,{"input": [- 447,+ 448,"UpdateApiKeyInput!"]}@@ -8375,7 +8401,7 @@ export default {2,{"input": [- 448,+ 449,"RevokeApiKeyInput!"]}@@ -8577,7 +8603,7 @@ export default {179,{"input": [- 449,+ 450,"CreateApprovedAccessDomainInput!"]}@@ -8586,7 +8612,7 @@ export default {8,{"input": [- 450,+ 451,"DeleteApprovedAccessDomainInput!"]}@@ -8595,7 +8621,7 @@ export default {179,{"input": [- 451,+ 452,"ValidateApprovedAccessDomainInput!"]}@@ -8604,7 +8630,7 @@ export default {124,{"input": [- 452,+ 453,"CreatePageLayoutTabInput!"]}@@ -8617,7 +8643,7 @@ export default {"String!"],"input": [- 453,+ 454,"UpdatePageLayoutTabInput!"]}@@ -8635,7 +8661,7 @@ export default {125,{"input": [- 454,+ 455,"CreatePageLayoutInput!"]}@@ -8648,7 +8674,7 @@ export default {"String!"],"input": [- 455,+ 456,"UpdatePageLayoutInput!"]}@@ -8670,7 +8696,7 @@ export default {"String!"],"input": [- 456,+ 457,"UpdatePageLayoutWithTabsInput!"]}@@ -8706,7 +8732,7 @@ export default {81,{"input": [- 459,+ 460,"CreatePageLayoutWidgetInput!"]}@@ -8719,7 +8745,7 @@ export default {"String!"],"input": [- 460,+ 461,"UpdatePageLayoutWidgetInput!"]}@@ -8737,7 +8763,7 @@ export default {10,{"input": [- 461,+ 462,"CreateAgentInput!"]}@@ -8746,7 +8772,7 @@ export default {10,{"input": [- 462,+ 463,"UpdateAgentInput!"]}@@ -8755,7 +8781,7 @@ export default {10,{"input": [- 391,+ 392,"AgentIdInput!"]}@@ -8764,7 +8790,7 @@ export default {23,{"input": [- 463,+ 464,"CreateOneObjectInput!"]}@@ -8773,7 +8799,7 @@ export default {23,{"input": [- 465,+ 466,"DeleteOneObjectInput!"]}@@ -8782,7 +8808,7 @@ export default {23,{"input": [- 466,+ 467,"UpdateOneObjectInput!"]}@@ -8791,7 +8817,7 @@ export default {249,{"input": [- 469,+ 470,"CreateOneIndexInput!"]}@@ -8800,7 +8826,7 @@ export default {249,{"input": [- 472,+ 473,"DeleteOneIndexInput!"]}@@ -8809,7 +8835,7 @@ export default {21,{"input": [- 393,+ 394,"LogicFunctionIdInput!"]}@@ -8818,7 +8844,7 @@ export default {21,{"input": [- 473,+ 474,"CreateLogicFunctionFromSourceInput!"]}@@ -8827,7 +8853,7 @@ export default {146,{"input": [- 474,+ 475,"ExecuteOneLogicFunctionInput!"]}@@ -8836,7 +8862,7 @@ export default {8,{"input": [- 475,+ 476,"UpdateLogicFunctionFromSourceInput!"]}@@ -8845,7 +8871,7 @@ export default {14,{"input": [- 477,+ 478,"CreateCommandMenuItemInput!"]}@@ -8854,7 +8880,7 @@ export default {14,{"input": [- 478,+ 479,"UpdateCommandMenuItemInput!"]}@@ -8881,7 +8907,7 @@ export default {13,{"input": [- 479,+ 480,"CreateFrontComponentInput!"]}@@ -8890,7 +8916,7 @@ export default {13,{"input": [- 480,+ 481,"UpdateFrontComponentInput!"]}@@ -8908,7 +8934,7 @@ export default {70,{"data": [- 482,+ 483,"ActivateWorkspaceInput!"]}@@ -8917,7 +8943,7 @@ export default {70,{"data": [- 483,+ 484,"UpdateWorkspaceInput!"]}@@ -8948,7 +8974,7 @@ export default {218,{"input": [- 484,+ 485,"CreateApplicationRegistrationInput!"]}@@ -8957,7 +8983,7 @@ export default {76,{"input": [- 485,+ 486,"UpdateApplicationRegistrationInput!"]}@@ -8984,7 +9010,7 @@ export default {192,{"input": [- 487,+ 488,"CreateApplicationRegistrationVariableInput!"]}@@ -8993,7 +9019,7 @@ export default {192,{"input": [- 488,+ 489,"UpdateApplicationRegistrationVariableInput!"]}@@ -9011,7 +9037,7 @@ export default {76,{"file": [- 411,+ 412,"Upload!"],"universalIdentifier": [@@ -9073,7 +9099,7 @@ export default {"UUID!"],"input": [- 490,+ 491,"UpdateApplicationInput!"]}@@ -9094,7 +9120,7 @@ export default {241,{"input": [- 491,+ 492,"CreateOneFieldMetadataInput!"]}@@ -9103,7 +9129,7 @@ export default {241,{"input": [- 493,+ 494,"UpdateOneFieldMetadataInput!"]}@@ -9112,7 +9138,7 @@ export default {241,{"input": [- 495,+ 496,"DeleteOneFieldInput!"]}@@ -9121,7 +9147,7 @@ export default {60,{"input": [- 496,+ 497,"CreateViewGroupInput!"]}@@ -9130,7 +9156,7 @@ export default {60,{"inputs": [- 496,+ 497,"[CreateViewGroupInput!]!"]}@@ -9139,7 +9165,7 @@ export default {60,{"input": [- 497,+ 498,"UpdateViewGroupInput!"]}@@ -9148,7 +9174,7 @@ export default {60,{"inputs": [- 497,+ 498,"[UpdateViewGroupInput!]!"]}@@ -9157,7 +9183,7 @@ export default {60,{"input": [- 499,+ 500,"DeleteViewGroupInput!"]}@@ -9166,7 +9192,7 @@ export default {60,{"input": [- 500,+ 501,"DestroyViewGroupInput!"]}@@ -9188,7 +9214,7 @@ export default {48,{"createRoleInput": [- 501,+ 502,"CreateRoleInput!"]}@@ -9197,7 +9223,7 @@ export default {48,{"updateRoleInput": [- 502,+ 503,"UpdateRoleInput!"]}@@ -9215,7 +9241,7 @@ export default {45,{"upsertObjectPermissionsInput": [- 504,+ 505,"UpsertObjectPermissionsInput!"]}@@ -9224,7 +9250,7 @@ export default {46,{"upsertPermissionFlagsInput": [- 506,+ 507,"UpsertPermissionFlagsInput!"]}@@ -9233,7 +9259,7 @@ export default {40,{"upsertFieldPermissionsInput": [- 507,+ 508,"UpsertFieldPermissionsInput!"]}@@ -9242,7 +9268,7 @@ export default {262,{"input": [- 509,+ 510,"UpsertRowLevelPermissionPredicatesInput!"]}@@ -9273,7 +9299,7 @@ export default {319,{"input": [- 512,+ 513,"SendEmailViaDomainInput!"]}@@ -9282,7 +9308,7 @@ export default {320,{"input": [- 513,+ 514,"SendMessageCampaignInput!"]}@@ -9291,7 +9317,7 @@ export default {318,{"input": [- 514,+ 515,"CancelMessageCampaignInput!"]}@@ -9300,16 +9326,25 @@ export default {319,{"input": [- 515,+ 516,"SendMessageCampaignTestInput!"]}],- "createMessageSuppression": [+ "duplicateMessageList": [321,+ {+ "id": [+ 3,+ "UUID!"+ ]+ }+ ],+ "createMessageSuppression": [+ 322,{"input": [- 516,+ 517,"CreateMessageSuppressionInput!"]}@@ -9324,19 +9359,19 @@ export default {}],"createUnsubscribeTopic": [- 325,+ 326,{"input": [- 517,+ 518,"CreateUnsubscribeTopicInput!"]}],"updateUnsubscribeTopic": [- 325,+ 326,{"input": [- 518,+ 519,"UpdateUnsubscribeTopicInput!"]}@@ -9354,7 +9389,7 @@ export default {308,{"input": [- 519,+ 520,"UpdateMessageChannelInput!"]}@@ -9363,7 +9398,7 @@ export default {316,{"input": [- 521,+ 522,"CreateEmailGroupChannelInput!"]}@@ -9372,7 +9407,7 @@ export default {308,{"input": [- 522,+ 523,"UpdateEmailGroupChannelInput!"]}@@ -9390,7 +9425,7 @@ export default {304,{"input": [- 523,+ 524,"CreateEmailingDomainInput!"]}@@ -9414,34 +9449,34 @@ export default {}],"runAgent": [- 337,+ 338,{"input": [- 524,+ 525,"RunAgentInput!"]}],"createWebhook": [- 334,+ 335,{"input": [- 527,+ 528,"CreateWebhookInput!"]}],"updateWebhook": [- 334,+ 335,{"input": [- 528,+ 529,"UpdateWebhookInput!"]}],"deleteWebhook": [- 334,+ 335,{"id": [3,@@ -9450,37 +9485,37 @@ export default {}],"updateMessageFolder": [- 376,+ 377,{"input": [- 530,+ 531,"UpdateMessageFolderInput!"]}],"updateMessageFolders": [- 376,+ 377,{"input": [- 532,+ 533,"UpdateMessageFoldersInput!"]}],"updateCalendarChannel": [- 371,+ 372,{"input": [- 533,+ 534,"UpdateCalendarChannelInput!"]}],"setAppKeyValue": [- 369,+ 370,{"input": [- 535,+ 536,"SetAppKeyValueInput!"]}@@ -9493,33 +9528,33 @@ export default {"String!"],"scope": [- 370+ 371]}],"enqueueJob": [- 367,+ 368,{"input": [- 536,+ 537,"EnqueueJobInput!"]}],"enqueueJobs": [- 368,+ 369,{"input": [- 537,+ 538,"EnqueueJobsInput!"]}],"createChatThread": [- 355+ 356],"sendChatMessage": [- 360,+ 361,{"threadId": [3,@@ -9540,13 +9575,13 @@ export default {1],"fileAttachments": [- 539,+ 540,"[FileAttachmentInput!]"]}],"retryChatMessage": [- 360,+ 361,{"threadId": [3,@@ -9558,7 +9593,7 @@ export default {}],"answerAgentChatQuestion": [- 360,+ 361,{"threadId": [3,@@ -9569,14 +9604,14 @@ export default {"UUID!"],"answers": [- 540,+ 541,"[AgentChatQuestionAnswerInput!]!"],"modelId": [1],"fileAttachments": [- 539,+ 540,"[FileAttachmentInput!]"]}@@ -9591,7 +9626,7 @@ export default {}],"renameChatThread": [- 355,+ 356,{"id": [3,@@ -9604,7 +9639,7 @@ export default {}],"archiveChatThread": [- 355,+ 356,{"id": [3,@@ -9613,7 +9648,7 @@ export default {}],"unarchiveChatThread": [- 355,+ 356,{"id": [3,@@ -9640,7 +9675,7 @@ export default {}],"startWorkspaceSetupChat": [- 362,+ 363,{"companyContext": [9@@ -9651,25 +9686,25 @@ export default {}],"createSkill": [- 353,+ 354,{"input": [- 541,+ 542,"CreateSkillInput!"]}],"updateSkill": [- 353,+ 354,{"input": [- 542,+ 543,"UpdateSkillInput!"]}],"deleteSkill": [- 353,+ 354,{"id": [3,@@ -9678,7 +9713,7 @@ export default {}],"activateSkill": [- 353,+ 354,{"id": [3,@@ -9687,7 +9722,7 @@ export default {}],"deactivateSkill": [- 353,+ 354,{"id": [3,@@ -9696,7 +9731,7 @@ export default {}],"evaluateAgentTurn": [- 364,+ 365,{"turnId": [3,@@ -9705,7 +9740,7 @@ export default {}],"runEvaluationInput": [- 365,+ 366,{"agentId": [3,@@ -9718,16 +9753,16 @@ export default {}],"updateTimelineActivityType": [- 382,+ 383,{"input": [- 543,+ 544,"UpdateTimelineActivityTypeInput!"]}],"resetTimelineActivityType": [- 382,+ 383,{"id": [3,@@ -9739,7 +9774,7 @@ export default {271,{"input": [- 544,+ 545,"GetAuthorizationUrlForSSOInput!"]}@@ -9905,7 +9940,7 @@ export default {274,{"input": [- 545+ 546]}],@@ -9917,7 +9952,7 @@ export default {"String!"],"file": [- 411,+ 412,"Upload!"]}@@ -10083,7 +10118,7 @@ export default {8,{"input": [- 546,+ 547,"UpdateWorkspaceMemberSettingsInput!"]}@@ -10117,7 +10152,7 @@ export default {228,{"input": [- 547,+ 548,"SetupOIDCSsoInput!"]}@@ -10126,7 +10161,7 @@ export default {228,{"input": [- 548,+ 549,"SetupSAMLSsoInput!"]}@@ -10135,7 +10170,7 @@ export default {224,{"input": [- 549,+ 550,"DeleteSsoInput!"]}@@ -10144,13 +10179,13 @@ export default {225,{"input": [- 550,+ 551,"EditSsoInput!"]}],"createObjectEvent": [- 349,+ 350,{"event": [1,@@ -10170,10 +10205,10 @@ export default {}],"trackAnalytics": [- 349,+ 350,{"type": [- 551,+ 552,"AnalyticsType!"],"name": [@@ -10188,7 +10223,7 @@ export default {}],"duplicateDashboard": [- 347,+ 348,{"id": [3,@@ -10213,25 +10248,25 @@ export default {286],"createCalendarEvent": [- 339,+ 340,{"input": [- 552,+ 553,"CreateCalendarEventInput!"]}],"sendEmail": [- 348,+ 349,{"input": [- 553,+ 554,"SendEmailInput!"]}],"startChannelSync": [- 338,+ 339,{"connectedAccountId": [3,@@ -10240,14 +10275,14 @@ export default {}],"saveImapSmtpCaldavAccount": [- 333,+ 334,{"handle": [1,"String!"],"connectionParameters": [- 555,+ 556,"EmailAccountConnectionParameters!"],"id": [@@ -10259,7 +10294,7 @@ export default {189,{"input": [- 557,+ 558,"UpdateLabPublicFeatureFlagInput!"]}@@ -10327,7 +10362,7 @@ export default {293,{"file": [- 411,+ 412,"Upload!"],"applicationUniversalIdentifier": [@@ -10352,7 +10387,7 @@ export default {"String!"],"files": [- 558,+ 559,"[ApplicationFileUploadRequestInput!]!"]}@@ -10475,7 +10510,7 @@ export default {3],"update": [- 410+ 411],"__typename": [1@@ -10620,7 +10655,7 @@ export default {3],"update": [- 417+ 418],"__typename": [1@@ -10791,19 +10826,19 @@ export default {3],"view": [- 423+ 424],"viewFields": [- 424+ 425],"viewFilters": [- 425+ 426],"viewFilterGroups": [- 426+ 427],"viewSorts": [- 427+ 428],"__typename": [1@@ -10952,7 +10987,7 @@ export default {3],"update": [- 430+ 431],"__typename": [1@@ -10990,7 +11025,7 @@ export default {3],"update": [- 434+ 435],"__typename": [1@@ -11066,7 +11101,7 @@ export default {3],"update": [- 439+ 440],"__typename": [1@@ -11130,10 +11165,10 @@ export default {3],"groups": [- 444+ 445],"fields": [- 445+ 446],"__typename": [1@@ -11153,7 +11188,7 @@ export default {8],"fields": [- 445+ 446],"__typename": [1@@ -11324,7 +11359,7 @@ export default {8],"tabs": [- 457+ 458],"__typename": [1@@ -11347,7 +11382,7 @@ export default {85],"widgets": [- 458+ 459],"__typename": [1@@ -11512,7 +11547,7 @@ export default {},"CreateOneObjectInput": {"object": [- 464+ 465],"__typename": [1@@ -11572,7 +11607,7 @@ export default {},"UpdateOneObjectInput": {"update": [- 467+ 468],"id": [3@@ -11625,7 +11660,7 @@ export default {24],"translations": [- 468+ 469],"__typename": [1@@ -11647,7 +11682,7 @@ export default {},"CreateOneIndexInput": {"index": [- 470+ 471],"__typename": [1@@ -11658,7 +11693,7 @@ export default {3],"fields": [- 471+ 472],"indexType": [250@@ -11743,7 +11778,7 @@ export default {3],"update": [- 476+ 477],"__typename": [1@@ -11906,7 +11941,7 @@ export default {3],"update": [- 481+ 482],"__typename": [1@@ -12033,7 +12068,7 @@ export default {1],"update": [- 486+ 487],"__typename": [1@@ -12087,7 +12122,7 @@ export default {1],"update": [- 489+ 490],"__typename": [1@@ -12117,7 +12152,7 @@ export default {},"CreateOneFieldMetadataInput": {"field": [- 492+ 493],"__typename": [1@@ -12190,7 +12225,7 @@ export default {3],"update": [- 494+ 495],"__typename": [1@@ -12249,7 +12284,7 @@ export default {9],"translations": [- 468+ 469],"__typename": [1@@ -12288,7 +12323,7 @@ export default {3],"update": [- 498+ 499],"__typename": [1@@ -12373,7 +12408,7 @@ export default {},"UpdateRoleInput": {"update": [- 503+ 504],"id": [3@@ -12428,7 +12463,7 @@ export default {3],"objectPermissions": [- 505+ 506],"__typename": [1@@ -12470,7 +12505,7 @@ export default {3],"fieldPermissions": [- 508+ 509],"__typename": [1@@ -12501,10 +12536,10 @@ export default {3],"predicates": [- 510+ 511],"predicateGroups": [- 511+ 512],"__typename": [1@@ -12649,7 +12684,7 @@ export default {1],"visibility": [- 326+ 327],"__typename": [1@@ -12666,7 +12701,7 @@ export default {1],"visibility": [- 326+ 327],"__typename": [1@@ -12677,7 +12712,7 @@ export default {3],"update": [- 520+ 521],"__typename": [1@@ -12750,7 +12785,7 @@ export default {3],"messages": [- 525+ 526],"__typename": [1@@ -12758,7 +12793,7 @@ export default {},"RunAgentMessageInput": {"role": [- 526+ 527],"content": [1@@ -12793,7 +12828,7 @@ export default {3],"update": [- 529+ 530],"__typename": [1@@ -12821,7 +12856,7 @@ export default {3],"update": [- 531+ 532],"__typename": [1@@ -12840,7 +12875,7 @@ export default {3],"update": [- 531+ 532],"__typename": [1@@ -12851,7 +12886,7 @@ export default {3],"update": [- 534+ 535],"__typename": [1@@ -12859,13 +12894,13 @@ export default {},"UpdateCalendarChannelInputUpdates": {"visibility": [- 374+ 375],"isContactAutoCreationEnabled": [8],"contactAutoCreationPolicy": [- 375+ 376],"isSyncEnabled": [8@@ -12882,7 +12917,7 @@ export default {9],"scope": [- 370+ 371],"__typename": [1@@ -12916,7 +12951,7 @@ export default {9],"jobs": [- 538+ 539],"retryLimit": [28@@ -13027,7 +13062,7 @@ export default {8],"translations": [- 468+ 469],"__typename": [1@@ -13193,7 +13228,7 @@ export default {1],"files": [- 554+ 555],"__typename": [1@@ -13215,13 +13250,13 @@ export default {1],"IMAP": [- 556+ 557],"SMTP": [- 556+ 557],"CALDAV": [- 556+ 557],"__typename": [1@@ -13286,13 +13321,13 @@ export default {263,{"input": [- 560,+ 561,"LogicFunctionLogsInput!"]}],"onAgentChatEvent": [- 361,+ 362,{"threadId": [3,@@ -13301,10 +13336,10 @@ export default {}],"eventLogsLive": [- 350,+ 351,{"table": [- 399,+ 400,"EventLogTable!"]}diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.tsindex 44ec79e9aa6..fd1eecb05a5 100644--- a/packages/twenty-front/src/generated-metadata/graphql.ts+++ b/packages/twenty-front/src/generated-metadata/graphql.ts@@ -1666,6 +1666,17 @@ export type DuplicatedDashboard = {updatedAt: Scalars['String']['output'];};+export type DuplicatedMessageList = {+ __typename?: 'DuplicatedMessageList';+ createdAt: Scalars['String']['output'];+ description?: Maybe<Scalars['String']['output']>;+ id: Scalars['UUID']['output'];+ memberCount: Scalars['Float']['output'];+ name?: Maybe<Scalars['String']['output']>;+ position: Scalars['Float']['output'];+ updatedAt: Scalars['String']['output'];+};+export type EditSso = {__typename?: 'EditSso';id: Scalars['UUID']['output'];@@ -1754,6 +1765,7 @@ export enum EngineComponentKey {DESTROY_SINGLE_RECORD = 'DESTROY_SINGLE_RECORD',DISCARD_DRAFT_WORKFLOW = 'DISCARD_DRAFT_WORKFLOW',DUPLICATE_DASHBOARD = 'DUPLICATE_DASHBOARD',+ DUPLICATE_MESSAGE_LIST = 'DUPLICATE_MESSAGE_LIST',DUPLICATE_WORKFLOW = 'DUPLICATE_WORKFLOW',EDIT_DASHBOARD_LAYOUT = 'EDIT_DASHBOARD_LAYOUT',EDIT_RECORD_PAGE_LAYOUT = 'EDIT_RECORD_PAGE_LAYOUT',@@ -2917,6 +2929,7 @@ export type Mutation = {destroyViewGroup: ViewGroup;destroyViewSort: Scalars['Boolean']['output'];duplicateDashboard: DuplicatedDashboard;+ duplicateMessageList: DuplicatedMessageList;editSSOIdentityProvider: EditSso;emailPasswordResetLink: EmailPasswordResetLink;endSubscriptionTrialPeriod: BillingEndTrialPeriod;@@ -3612,6 +3625,11 @@ export type MutationDuplicateDashboardArgs = {};+export type MutationDuplicateMessageListArgs = {+ id: Scalars['UUID']['input'];+};++export type MutationEditSsoIdentityProviderArgs = {input: EditSsoInput;};@@ -7790,6 +7808,13 @@ export type CommandMenuItemFieldsFragment = { __typename?: 'CommandMenuItem', id| { __typename?: 'PathCommandMenuItemPayload', path: string }| null };+export type DuplicateMessageListMutationVariables = Exact<{+ id: Scalars['UUID']['input'];+}>;+++export type DuplicateMessageListMutation = { __typename?: 'Mutation', duplicateMessageList: { __typename?: 'DuplicatedMessageList', id: string, name?: string | null, description?: string | null, position: number, memberCount: number, createdAt: string, updatedAt: string } };+export type ResetCommandMenuItemMutationVariables = Exact<{id: Scalars['UUID']['input'];}>;@@ -9724,6 +9749,7 @@ export const FindApplicationRegistrationByClientIdDocument = {"kind":"Document",export const GetPublicWorkspaceDataByDomainDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPublicWorkspaceDataByDomain"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"origin"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPublicWorkspaceDataByDomain"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"origin"},"value":{"kind":"Variable","name":{"kind":"Name","value":"origin"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceUrlsFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"authProviders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}}]}},{"kind":"Field","name":{"kind":"Name","value":"google"}},{"kind":"Field","name":{"kind":"Name","value":"magicLink"}},{"kind":"Field","name":{"kind":"Name","value":"password"}},{"kind":"Field","name":{"kind":"Name","value":"microsoft"}}]}},{"kind":"Field","name":{"kind":"Name","value":"authBypassProviders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"google"}},{"kind":"Field","name":{"kind":"Name","value":"password"}},{"kind":"Field","name":{"kind":"Name","value":"microsoft"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceUrlsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUrls"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}}]} as unknown as DocumentNode<GetPublicWorkspaceDataByDomainQuery, GetPublicWorkspaceDataByDomainQueryVariables>;export const GetWorkspaceCreationDefaultsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaceCreationDefaults"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getWorkspaceCreationDefaults"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}}]}}]}}]} as unknown as DocumentNode<GetWorkspaceCreationDefaultsQuery, GetWorkspaceCreationDefaultsQueryVariables>;export const ValidatePasswordResetTokenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ValidatePasswordResetToken"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"token"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"validatePasswordResetToken"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"passwordResetToken"},"value":{"kind":"Variable","name":{"kind":"Name","value":"token"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"hasPassword"}}]}}]}}]} as unknown as DocumentNode<ValidatePasswordResetTokenQuery, ValidatePasswordResetTokenQueryVariables>;+export const DuplicateMessageListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DuplicateMessageList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"duplicateMessageList"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"memberCount"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<DuplicateMessageListMutation, DuplicateMessageListMutationVariables>;export const ResetCommandMenuItemDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ResetCommandMenuItem"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"resetCommandMenuItem"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CommandMenuItemFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CommandMenuItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CommandMenuItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"workflowVersionId"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}}]}},{"kind":"Field","name":{"kind":"Name","value":"engineComponentKey"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"shortLabel"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"isPinned"}},{"kind":"Field","name":{"kind":"Name","value":"payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PathCommandMenuItemPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"hotKeys"}},{"kind":"Field","name":{"kind":"Name","value":"conditionalAvailabilityExpression"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityType"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityObjectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"navigationTargetObjectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"pageLayoutId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}}]}}]} as unknown as DocumentNode<ResetCommandMenuItemMutation, ResetCommandMenuItemMutationVariables>;export const UpdateCommandMenuItemDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCommandMenuItem"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCommandMenuItemInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCommandMenuItem"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CommandMenuItemFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CommandMenuItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CommandMenuItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"workflowVersionId"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}}]}},{"kind":"Field","name":{"kind":"Name","value":"engineComponentKey"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"shortLabel"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"isPinned"}},{"kind":"Field","name":{"kind":"Name","value":"payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PathCommandMenuItemPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"hotKeys"}},{"kind":"Field","name":{"kind":"Name","value":"conditionalAvailabilityExpression"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityType"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityObjectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"navigationTargetObjectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"pageLayoutId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}}]}}]} as unknown as DocumentNode<UpdateCommandMenuItemMutation, UpdateCommandMenuItemMutationVariables>;export const FindManyCommandMenuItemsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyCommandMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"commandMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CommandMenuItemFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CommandMenuItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CommandMenuItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"workflowVersionId"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}}]}},{"kind":"Field","name":{"kind":"Name","value":"engineComponentKey"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"shortLabel"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"isPinned"}},{"kind":"Field","name":{"kind":"Name","value":"payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PathCommandMenuItemPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"hotKeys"}},{"kind":"Field","name":{"kind":"Name","value":"conditionalAvailabilityExpression"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityType"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityObjectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"navigationTargetObjectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"pageLayoutId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}}]}}]} as unknown as DocumentNode<FindManyCommandMenuItemsQuery, FindManyCommandMenuItemsQueryVariables>;diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/constants/EngineComponentKeyHeadlessComponentMap.tsx b/packages/twenty-front/src/modules/command-menu-item/engine-command/constants/EngineComponentKeyHeadlessComponentMap.tsxindex 375353b7e9f..8424be78e44 100644--- a/packages/twenty-front/src/modules/command-menu-item/engine-command/constants/EngineComponentKeyHeadlessComponentMap.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/constants/EngineComponentKeyHeadlessComponentMap.tsx@@ -28,6 +28,7 @@ import { NavigateToPreviousRecordSingleRecordCommand } from '@/command-menu-itemimport { RemoveFromFavoritesSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/components/RemoveFromFavoritesSingleRecordCommand';import { CancelDashboardSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/dashboard/components/CancelDashboardSingleRecordCommand';import { DuplicateDashboardSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/dashboard/components/DuplicateDashboardSingleRecordCommand';+import { DuplicateMessageListSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/message-list/components/DuplicateMessageListSingleRecordCommand';import { EditDashboardSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/dashboard/components/EditDashboardSingleRecordCommand';import { SaveDashboardSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/dashboard/components/SaveDashboardSingleRecordCommand';import { ReplyToEmailThreadCommand } from '@/command-menu-item/engine-command/record/single-record/message-thread/components/ReplyToEmailThreadCommand';@@ -73,6 +74,9 @@ export const ENGINE_COMPONENT_KEY_COMPONENT_MAP: Record<[EngineComponentKey.DUPLICATE_DASHBOARD]: (<DuplicateDashboardSingleRecordCommand />),+ [EngineComponentKey.DUPLICATE_MESSAGE_LIST]: (+ <DuplicateMessageListSingleRecordCommand />+ ),[EngineComponentKey.DUPLICATE_WORKFLOW]: (<DuplicateWorkflowSingleRecordCommand />),diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/components/DuplicateMessageListSingleRecordCommand.tsx b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/components/DuplicateMessageListSingleRecordCommand.tsxnew file mode 100644index 00000000000..ebfded215bd--- /dev/null+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/components/DuplicateMessageListSingleRecordCommand.tsx@@ -0,0 +1,46 @@+import { HeadlessEngineCommandWrapperEffect } from '@/command-menu-item/engine-command/components/HeadlessEngineCommandWrapperEffect';+import { useHeadlessCommandContextApi } from '@/command-menu-item/engine-command/hooks/useHeadlessCommandContextApi';+import { useDuplicateMessageList } from '@/command-menu-item/engine-command/record/single-record/message-list/hooks/useDuplicateMessageList';+import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { plural } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';+import { isNonEmptyString } from '@sniptt/guards';+import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';+import { useNavigateApp } from '~/hooks/useNavigateApp';++export const DuplicateMessageListSingleRecordCommand = () => {+ const { selectedRecords } = useHeadlessCommandContextApi();++ const recordId = selectedRecords[0]?.id;+ const { duplicateMessageList } = useDuplicateMessageList();+ const navigate = useNavigateApp();+ const { enqueueSuccessSnackBar } = useSnackBar();+ const { t } = useLingui();++ if (!isDefined(recordId)) {+ throw new Error('Record ID is required to duplicate list');+ }++ const handleExecute = async () => {+ const result = await duplicateMessageList(recordId);++ if (isDefined(result) && isNonEmptyString(result.id)) {+ const memberCountLabel = plural(result.memberCount, {+ one: '# member',+ other: '# members',+ });++ enqueueSuccessSnackBar({+ message: t`List duplicated with ${memberCountLabel}`,+ });++ navigate(AppPath.RecordShowPage, {+ objectNameSingular: CoreObjectNameSingular.MessageList,+ objectRecordId: result.id,+ });+ }+ };++ return <HeadlessEngineCommandWrapperEffect execute={handleExecute} />;+};diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/hooks/useDuplicateMessageList.ts b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/hooks/useDuplicateMessageList.tsnew file mode 100644index 00000000000..b11cc793a19--- /dev/null+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/hooks/useDuplicateMessageList.ts@@ -0,0 +1,57 @@+import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';+import { useAddDuplicatedRecordToCache } from '@/object-record/cache/hooks/useAddDuplicatedRecordToCache';+import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useMutation } from '@apollo/client/react';+import { t } from '@lingui/core/macro';+import { CoreObjectNameSingular, CrudOperationType } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';+import { DuplicateMessageListDocument } from '~/generated-metadata/graphql';++export const useDuplicateMessageList = () => {+ const { addDuplicatedRecordToCache } = useAddDuplicatedRecordToCache({+ objectNameSingular: CoreObjectNameSingular.MessageList,+ });++ const [mutate] = useMutation(DuplicateMessageListDocument);++ const { handleMetadataError } = useMetadataErrorHandler();+ const { enqueueErrorSnackBar } = useSnackBar();++ const duplicateMessageList = async (messageListId: string) => {+ try {+ const result = await mutate({+ variables: { id: messageListId },+ update: (cache, { data }) => {+ const record = data?.duplicateMessageList;++ if (!isDefined(record)) return;++ const { memberCount: _memberCount, ...duplicatedListRecord } = record;++ addDuplicatedRecordToCache({+ cache,+ record: duplicatedListRecord,+ });+ },+ });++ return result?.data?.duplicateMessageList;+ } catch (error) {+ if (CombinedGraphQLErrors.is(error)) {+ handleMetadataError(error, {+ primaryMetadataName: 'objectMetadata',+ operationType: CrudOperationType.CREATE,+ });+ } else {+ enqueueErrorSnackBar({ message: t`Failed to duplicate list` });+ }++ return undefined;+ }+ };++ return {+ duplicateMessageList,+ };+};diff --git a/packages/twenty-front/src/modules/command-menu-item/graphql/mutations/duplicateMessageList.ts b/packages/twenty-front/src/modules/command-menu-item/graphql/mutations/duplicateMessageList.tsnew file mode 100644index 00000000000..519f18bda2d--- /dev/null+++ b/packages/twenty-front/src/modules/command-menu-item/graphql/mutations/duplicateMessageList.ts@@ -0,0 +1,15 @@+import { gql } from '@apollo/client';++export const DUPLICATE_MESSAGE_LIST = gql`+ mutation DuplicateMessageList($id: UUID!) {+ duplicateMessageList(id: $id) {+ id+ name+ description+ position+ memberCount+ createdAt+ updatedAt+ }+ }+`;diff --git a/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts b/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.tsindex a2895890d84..66eec1f8604 100644--- a/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts+++ b/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts@@ -1,13 +1,5 @@-import { triggerCreateRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerCreateRecordsOptimisticEffect';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';-import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';-import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';-import { useCreateOneRecordInCache } from '@/object-record/cache/hooks/useCreateOneRecordInCache';-import { getObjectTypename } from '@/object-record/cache/utils/getObjectTypename';-import { getRecordNodeFromRecord } from '@/object-record/cache/utils/getRecordNodeFromRecord';-import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions';-import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';-import { type ObjectRecord } from '@/object-record/types/ObjectRecord';+import { useAddDuplicatedRecordToCache } from '@/object-record/cache/hooks/useAddDuplicatedRecordToCache';import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';@@ -17,18 +9,10 @@ import { isDefined } from 'twenty-shared/utils';import { DuplicateDashboardDocument } from '~/generated-metadata/graphql';export const useDuplicateDashboard = () => {- const { objectMetadataItem } = useObjectMetadataItem({+ const { addDuplicatedRecordToCache } = useAddDuplicatedRecordToCache({objectNameSingular: CoreObjectNameSingular.Dashboard,});- const { objectMetadataItems } = useObjectMetadataItems();- const { objectPermissionsByObjectMetadataId } = useObjectPermissions();- const { upsertRecordsInStore } = useUpsertRecordsInStore();-- const createOneRecordInCache = useCreateOneRecordInCache({- objectMetadataItem,- });-const [mutate] = useMutation(DuplicateDashboardDocument);const { handleMetadataError } = useMetadataErrorHandler();@@ -43,30 +27,7 @@ export const useDuplicateDashboard = () => {if (!isDefined(record)) return;- const createdRecord: ObjectRecord = {- ...record,- __typename: getObjectTypename(CoreObjectNameSingular.Dashboard),- };-- createOneRecordInCache(createdRecord);-- const recordNode = getRecordNodeFromRecord({- objectMetadataItem,- objectMetadataItems,- record: createdRecord,- computeReferences: false,- });-- if (isDefined(recordNode)) {- triggerCreateRecordsOptimisticEffect({- cache,- objectMetadataItem,- recordsToCreate: [recordNode],- objectMetadataItems,- objectPermissionsByObjectMetadataId,- upsertRecordsInStore,- });- }+ addDuplicatedRecordToCache({ cache, record });},});diff --git a/packages/twenty-front/src/modules/object-record/cache/hooks/useAddDuplicatedRecordToCache.ts b/packages/twenty-front/src/modules/object-record/cache/hooks/useAddDuplicatedRecordToCache.tsnew file mode 100644index 00000000000..adb92d4ea70--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/cache/hooks/useAddDuplicatedRecordToCache.ts@@ -0,0 +1,68 @@+import { triggerCreateRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerCreateRecordsOptimisticEffect';+import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';+import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';+import { useCreateOneRecordInCache } from '@/object-record/cache/hooks/useCreateOneRecordInCache';+import { getObjectTypename } from '@/object-record/cache/utils/getObjectTypename';+import { getRecordNodeFromRecord } from '@/object-record/cache/utils/getRecordNodeFromRecord';+import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions';+import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';+import { type ObjectRecord } from '@/object-record/types/ObjectRecord';+import { type ApolloCache } from '@apollo/client';+import { isDefined } from 'twenty-shared/utils';++// Makes a server created copy show up in lists and the record store without a refetch.+export const useAddDuplicatedRecordToCache = ({+ objectNameSingular,+}: {+ objectNameSingular: string;+}) => {+ const { objectMetadataItem } = useObjectMetadataItem({+ objectNameSingular,+ });++ const { objectMetadataItems } = useObjectMetadataItems();+ const { objectPermissionsByObjectMetadataId } = useObjectPermissions();+ const { upsertRecordsInStore } = useUpsertRecordsInStore();++ const createOneRecordInCache = useCreateOneRecordInCache({+ objectMetadataItem,+ });++ const addDuplicatedRecordToCache = ({+ cache,+ record,+ }: {+ cache: ApolloCache;+ record: Pick<ObjectRecord, 'id'> & Record<string, unknown>;+ }) => {+ const createdRecord: ObjectRecord = {+ ...record,+ __typename: getObjectTypename(objectNameSingular),+ };++ createOneRecordInCache(createdRecord);+ // The optimistic effect only reaches the record store through relations,+ // and a duplicate response carries none.+ upsertRecordsInStore({ partialRecords: [createdRecord] });++ const recordNode = getRecordNodeFromRecord({+ objectMetadataItem,+ objectMetadataItems,+ record: createdRecord,+ computeReferences: false,+ });++ if (isDefined(recordNode)) {+ triggerCreateRecordsOptimisticEffect({+ cache,+ objectMetadataItem,+ recordsToCreate: [recordNode],+ objectMetadataItems,+ objectPermissionsByObjectMetadataId,+ upsertRecordsInStore,+ });+ }+ };++ return { addDuplicatedRecordToCache };+};diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/2-39-upgrade-version-command.module.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/2-39-upgrade-version-command.module.tsindex 99b94295036..13070ecac43 100644--- a/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/2-39-upgrade-version-command.module.ts+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/2-39-upgrade-version-command.module.ts@@ -8,6 +8,7 @@ import { BackfillMessageListJunctionTargetsCommand } from 'src/database/commandsimport { CreateMessageListMemberViewCommand } from 'src/database/commands/upgrade-version-command/2-39/2-39-workspace-command-1788616075386-create-message-list-member-view.command';import { MarkPlatformOwnedStandardObjectsSystemCommand } from 'src/database/commands/upgrade-version-command/2-39/2-39-workspace-command-1788616958245-mark-platform-owned-standard-objects-system.command';import { SyncMessageListRecordPageCommand } from 'src/database/commands/upgrade-version-command/2-39/2-39-workspace-command-1788639798701-sync-message-list-record-page.command';+import { AddDuplicateMessageListCommandMenuItemCommand } from 'src/database/commands/upgrade-version-command/2-39/2-39-workspace-command-1788639976437-add-duplicate-message-list-command-menu-item.command';import { TypeORMModule } from 'src/database/typeorm/typeorm.module';import { ApplicationModule } from 'src/engine/core-modules/application/application.module';import { FeatureFlagModule } from 'src/engine/core-modules/feature-flag/feature-flag.module';@@ -38,6 +39,7 @@ import { WorkspaceSchemaMigrationRunnerActionHandlersModule } from 'src/engine/wCreateMessageListMemberViewCommand,MarkPlatformOwnedStandardObjectsSystemCommand,SyncMessageListRecordPageCommand,+ AddDuplicateMessageListCommandMenuItemCommand,],})export class V2_39_UpgradeVersionCommandModule {}diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/2-39-workspace-command-1788639976437-add-duplicate-message-list-command-menu-item.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/2-39-workspace-command-1788639976437-add-duplicate-message-list-command-menu-item.command.tsnew file mode 100644index 00000000000..c4904a8b3bd--- /dev/null+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/2-39-workspace-command-1788639976437-add-duplicate-message-list-command-menu-item.command.ts@@ -0,0 +1,137 @@+import { Command } from 'nest-commander';+import { STANDARD_OBJECTS } from 'twenty-shared/metadata';+import { isDefined } from 'twenty-shared/utils';++import { ProvisionedWorkspaceCommandRunner } from 'src/database/commands/command-runners/provisioned-workspace.command-runner';+import { WorkspaceIteratorService } from 'src/database/commands/command-runners/workspace-iterator.service';+import { type RunOnWorkspaceArgs } from 'src/database/commands/command-runners/workspace.command-runner';+import { ApplicationService } from 'src/engine/core-modules/application/application.service';+import { RegisteredWorkspaceCommand } from 'src/engine/core-modules/upgrade/decorators/registered-workspace-command.decorator';+import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';+import { STANDARD_COMMAND_MENU_ITEMS } from 'src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant';+import { computeTwentyStandardApplicationAllFlatEntityMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/twenty-standard-application-all-flat-entity-maps.constant';+import { WorkspaceMigrationValidateBuildAndRunService } from 'src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service';++const DUPLICATE_MESSAGE_LIST_UNIVERSAL_IDENTIFIER =+ STANDARD_COMMAND_MENU_ITEMS.duplicateMessageList.universalIdentifier;++@RegisteredWorkspaceCommand('2.39.0', 1788639976437)+@Command({+ name: 'upgrade:2-39:add-duplicate-message-list-command-menu-item',+ description:+ 'Add the pinned Duplicate List command menu item on message list records to existing workspaces',+})+export class AddDuplicateMessageListCommandMenuItemCommand extends ProvisionedWorkspaceCommandRunner {+ constructor(+ protected readonly workspaceIteratorService: WorkspaceIteratorService,+ private readonly applicationService: ApplicationService,+ private readonly workspaceCacheService: WorkspaceCacheService,+ private readonly workspaceMigrationValidateBuildAndRunService: WorkspaceMigrationValidateBuildAndRunService,+ ) {+ super(workspaceIteratorService);+ }++ override async runOnWorkspace({+ workspaceId,+ options,+ }: RunOnWorkspaceArgs): Promise<void> {+ const isDryRun = options.dryRun ?? false;++ const { flatCommandMenuItemMaps, flatObjectMetadataMaps } =+ await this.workspaceCacheService.getOrRecompute(workspaceId, [+ 'flatCommandMenuItemMaps',+ 'flatObjectMetadataMaps',+ ]);++ if (+ !isDefined(+ flatObjectMetadataMaps.byUniversalIdentifier[+ STANDARD_OBJECTS.messageList.universalIdentifier+ ],+ ) ||+ !isDefined(+ flatObjectMetadataMaps.byUniversalIdentifier[+ STANDARD_OBJECTS.messageListMember.universalIdentifier+ ],+ )+ ) {+ this.logger.log(+ `The messageList or messageListMember object is missing for workspace ${workspaceId}, skipping`,+ );++ return;+ }++ if (+ isDefined(+ flatCommandMenuItemMaps.byUniversalIdentifier[+ DUPLICATE_MESSAGE_LIST_UNIVERSAL_IDENTIFIER+ ],+ )+ ) {+ this.logger.log(+ `Duplicate List command menu item already exists for workspace ${workspaceId}, skipping`,+ );++ return;+ }++ const { twentyStandardFlatApplication } =+ await this.applicationService.findWorkspaceTwentyStandardAndCustomApplicationOrThrow(+ { workspaceId },+ );++ const { allFlatEntityMaps: standardAllFlatEntityMaps } =+ computeTwentyStandardApplicationAllFlatEntityMaps({+ now: new Date().toISOString(),+ workspaceId,+ twentyStandardApplicationId: twentyStandardFlatApplication.id,+ });++ const itemToCreate =+ standardAllFlatEntityMaps.flatCommandMenuItemMaps.byUniversalIdentifier[+ DUPLICATE_MESSAGE_LIST_UNIVERSAL_IDENTIFIER+ ];++ if (!isDefined(itemToCreate)) {+ throw new Error(+ 'Duplicate List command menu item is missing from the standard application definition',+ );+ }++ this.logger.log(+ `${isDryRun ? '[DRY RUN] ' : ''}Adding the Duplicate List command menu item for workspace ${workspaceId}`,+ );++ if (isDryRun) {+ return;+ }++ const result =+ await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunWorkspaceMigration(+ {+ isSystemBuild: true,+ workspaceId,+ applicationUniversalIdentifier:+ twentyStandardFlatApplication.universalIdentifier,+ allFlatEntityOperationByMetadataName: {+ commandMenuItem: {+ flatEntityToCreate: [itemToCreate],+ flatEntityToDelete: [],+ flatEntityToUpdate: [],+ },+ },+ },+ );++ if (result.status === 'fail') {+ throw new Error(+ `Failed to add the Duplicate List command menu item for workspace ${workspaceId}: ${JSON.stringify(result, null, 2)}`,+ );+ }++ this.logger.log(+ `Added the Duplicate List command menu item for workspace ${workspaceId}`,+ );+ }+}diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/__tests__/2-39-workspace-command-1788639976437-add-duplicate-message-list-command-menu-item.command.spec.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/__tests__/2-39-workspace-command-1788639976437-add-duplicate-message-list-command-menu-item.command.spec.tsnew file mode 100644index 00000000000..0336a1263ed--- /dev/null+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-39/__tests__/2-39-workspace-command-1788639976437-add-duplicate-message-list-command-menu-item.command.spec.ts@@ -0,0 +1,148 @@+import { STANDARD_OBJECTS } from 'twenty-shared/metadata';++import { type WorkspaceIteratorService } from 'src/database/commands/command-runners/workspace-iterator.service';+import { AddDuplicateMessageListCommandMenuItemCommand } from 'src/database/commands/upgrade-version-command/2-39/2-39-workspace-command-1788639976437-add-duplicate-message-list-command-menu-item.command';+import { type ApplicationService } from 'src/engine/core-modules/application/application.service';+import { type WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';+import { STANDARD_COMMAND_MENU_ITEMS } from 'src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant';+import { computeTwentyStandardApplicationAllFlatEntityMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/twenty-standard-application-all-flat-entity-maps.constant';+import { type WorkspaceMigrationValidateBuildAndRunService } from 'src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service';++jest.mock(+ 'src/engine/workspace-manager/twenty-standard-application/utils/twenty-standard-application-all-flat-entity-maps.constant',+);++const computeTwentyStandardApplicationAllFlatEntityMapsMock = jest.mocked(+ computeTwentyStandardApplicationAllFlatEntityMaps,+);++const WORKSPACE_ID = '20202020-0000-0000-0000-000000000001';+const STANDARD_APPLICATION = {+ id: '20202020-0000-0000-0000-0000000000aa',+ universalIdentifier: '20202020-0000-0000-0000-0000000000bb',+};+const ITEM_UNIVERSAL_IDENTIFIER =+ STANDARD_COMMAND_MENU_ITEMS.duplicateMessageList.universalIdentifier;+const STANDARD_ITEM = { universalIdentifier: ITEM_UNIVERSAL_IDENTIFIER };++const buildMaps = (universalIdentifiers: string[]) => ({+ byUniversalIdentifier: Object.fromEntries(+ universalIdentifiers.map((universalIdentifier) => [+ universalIdentifier,+ { universalIdentifier },+ ]),+ ),+});++describe('AddDuplicateMessageListCommandMenuItemCommand', () => {+ let command: AddDuplicateMessageListCommandMenuItemCommand;+ let getOrRecomputeMock: jest.Mock;+ let validateBuildAndRunWorkspaceMigrationMock: jest.Mock;++ beforeEach(() => {+ jest.clearAllMocks();++ getOrRecomputeMock = jest.fn();+ validateBuildAndRunWorkspaceMigrationMock = jest+ .fn()+ .mockResolvedValue({ status: 'success' });++ computeTwentyStandardApplicationAllFlatEntityMapsMock.mockReturnValue({+ allFlatEntityMaps: {+ flatCommandMenuItemMaps: buildMaps([ITEM_UNIVERSAL_IDENTIFIER]),+ },+ } as unknown as ReturnType<+ typeof computeTwentyStandardApplicationAllFlatEntityMaps+ >);++ command = new AddDuplicateMessageListCommandMenuItemCommand(+ {} as WorkspaceIteratorService,+ {+ findWorkspaceTwentyStandardAndCustomApplicationOrThrow: jest+ .fn()+ .mockResolvedValue({+ twentyStandardFlatApplication: STANDARD_APPLICATION,+ }),+ } as unknown as ApplicationService,+ { getOrRecompute: getOrRecomputeMock } as unknown as WorkspaceCacheService,+ {+ validateBuildAndRunWorkspaceMigration:+ validateBuildAndRunWorkspaceMigrationMock,+ } as unknown as WorkspaceMigrationValidateBuildAndRunService,+ );+ });++ const runOnWorkspace = (dryRun = false) =>+ command.runOnWorkspace({+ workspaceId: WORKSPACE_ID,+ options: { dryRun },+ index: 0,+ total: 1,+ });++ const mockWorkspaceCache = ({+ existingObjects = [+ STANDARD_OBJECTS.messageList.universalIdentifier,+ STANDARD_OBJECTS.messageListMember.universalIdentifier,+ ],+ existingItems = [] as string[],+ } = {}) => {+ getOrRecomputeMock.mockResolvedValue({+ flatObjectMetadataMaps: buildMaps(existingObjects),+ flatCommandMenuItemMaps: buildMaps(existingItems),+ });+ };++ it('adds the command menu item when missing', async () => {+ mockWorkspaceCache();++ await runOnWorkspace();++ expect(validateBuildAndRunWorkspaceMigrationMock).toHaveBeenCalledWith({+ isSystemBuild: true,+ workspaceId: WORKSPACE_ID,+ applicationUniversalIdentifier: STANDARD_APPLICATION.universalIdentifier,+ allFlatEntityOperationByMetadataName: {+ commandMenuItem: {+ flatEntityToCreate: [STANDARD_ITEM],+ flatEntityToDelete: [],+ flatEntityToUpdate: [],+ },+ },+ });+ });++ it('does nothing when the item already exists', async () => {+ mockWorkspaceCache({ existingItems: [ITEM_UNIVERSAL_IDENTIFIER] });++ await runOnWorkspace();++ expect(validateBuildAndRunWorkspaceMigrationMock).not.toHaveBeenCalled();+ });++ it('skips workspaces without the messageList object', async () => {+ mockWorkspaceCache({ existingObjects: [] });++ await runOnWorkspace();++ expect(validateBuildAndRunWorkspaceMigrationMock).not.toHaveBeenCalled();+ });++ it('skips workspaces without the messageListMember object', async () => {+ mockWorkspaceCache({+ existingObjects: [STANDARD_OBJECTS.messageList.universalIdentifier],+ });++ await runOnWorkspace();++ expect(validateBuildAndRunWorkspaceMigrationMock).not.toHaveBeenCalled();+ });++ it('does not write metadata in dry-run mode', async () => {+ mockWorkspaceCache();++ await runOnWorkspace(true);++ expect(validateBuildAndRunWorkspaceMigrationMock).not.toHaveBeenCalled();+ });+});diff --git a/packages/twenty-server/src/engine/metadata-modules/command-menu-item/enums/engine-component-key.enum.ts b/packages/twenty-server/src/engine/metadata-modules/command-menu-item/enums/engine-component-key.enum.tsindex e8096b6784e..6e23ef17679 100644--- a/packages/twenty-server/src/engine/metadata-modules/command-menu-item/enums/engine-component-key.enum.ts+++ b/packages/twenty-server/src/engine/metadata-modules/command-menu-item/enums/engine-component-key.enum.ts@@ -23,6 +23,7 @@ export enum EngineComponentKey {SAVE_DASHBOARD_LAYOUT = 'SAVE_DASHBOARD_LAYOUT',CANCEL_DASHBOARD_LAYOUT = 'CANCEL_DASHBOARD_LAYOUT',DUPLICATE_DASHBOARD = 'DUPLICATE_DASHBOARD',+ DUPLICATE_MESSAGE_LIST = 'DUPLICATE_MESSAGE_LIST',ACTIVATE_WORKFLOW = 'ACTIVATE_WORKFLOW',DEACTIVATE_WORKFLOW = 'DEACTIVATE_WORKFLOW',DISCARD_DRAFT_WORKFLOW = 'DISCARD_DRAFT_WORKFLOW',diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant.tsindex c18d289f4fc..7a7f36da784 100644--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant.ts+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant.ts@@ -1469,4 +1469,24 @@ export const STANDARD_COMMAND_MENU_ITEMS = {engineComponentKey: EngineComponentKey.COMPOSE_EMAIL,hotKeys: null,},+ duplicateMessageList: {+ universalIdentifier: '19b519d4-a871-4fc2-980c-f5d6c92c6962',+ label: i18nLabel(+ msg({ message: `Duplicate List`, context: 'commandMenuItem.label' }),+ ),+ icon: 'IconCopyPlus',+ isPinned: true,+ position: 71,+ shortLabel: i18nLabel(+ msg({ message: `Duplicate`, context: 'commandMenuItem.shortLabel' }),+ ),+ availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,+ conditionalAvailabilityExpression:+ 'featureFlags.IS_EMAIL_GROUP_ENABLED and numberOfSelectedRecords == 1 and noneDefined(selectedRecords, "deletedAt") and objectPermissions.canUpdateObjectRecords',+ availabilityObjectMetadataUniversalIdentifier:+ STANDARD_OBJECTS.messageList.universalIdentifier,+ frontComponentUniversalIdentifier: null,+ engineComponentKey: EngineComponentKey.DUPLICATE_MESSAGE_LIST,+ hotKeys: null,+ },} as const;diff --git a/packages/twenty-server/src/modules/emailing/dtos/duplicated-message-list.dto.ts b/packages/twenty-server/src/modules/emailing/dtos/duplicated-message-list.dto.tsnew file mode 100644index 00000000000..5e498e4e064--- /dev/null+++ b/packages/twenty-server/src/modules/emailing/dtos/duplicated-message-list.dto.ts@@ -0,0 +1,27 @@+import { Field, ObjectType } from '@nestjs/graphql';++import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';++@ObjectType('DuplicatedMessageList')+export class DuplicatedMessageListDTO {+ @Field(() => UUIDScalarType)+ id: string;++ @Field(() => String, { nullable: true })+ name: string | null;++ @Field(() => String, { nullable: true })+ description: string | null;++ @Field(() => Number)+ position: number;++ @Field(() => Number)+ memberCount: number;++ @Field(() => String)+ createdAt: string;++ @Field(() => String)+ updatedAt: string;+}diff --git a/packages/twenty-server/src/modules/emailing/emailing.module.ts b/packages/twenty-server/src/modules/emailing/emailing.module.tsindex 2c0ef21e61f..269f70c5c53 100644--- a/packages/twenty-server/src/modules/emailing/emailing.module.ts+++ b/packages/twenty-server/src/modules/emailing/emailing.module.ts@@ -1,6 +1,7 @@import { Module } from '@nestjs/common';import { TypeOrmModule } from '@nestjs/typeorm';+import { ActorModule } from 'src/engine/core-modules/actor/actor.module';import { BillingModule } from 'src/engine/core-modules/billing/billing.module';import { EmailingDomainModule } from 'src/engine/core-modules/emailing-domain/emailing-domain.module';import { EmailingDomainEntity } from 'src/engine/core-modules/emailing-domain/emailing-domain.entity';@@ -25,6 +26,7 @@ import { EmailingOngoingStaleCronJob } from 'src/modules/emailing/crons/jobs/emaimport { ReconcileCampaignStatsCronCommand } from 'src/modules/emailing/crons/commands/reconcile-campaign-stats.cron.command';import { ReconcileCampaignStatsCronJob } from 'src/modules/emailing/crons/jobs/reconcile-campaign-stats.cron.job';import { EmailingSendResolver } from 'src/modules/emailing/resolvers/emailing-send.resolver';+import { MessageListResolver } from 'src/modules/emailing/resolvers/message-list.resolver';import { MessageSuppressionResolver } from 'src/modules/emailing/resolvers/message-suppression.resolver';import { UnsubscribeTopicResolver } from 'src/modules/emailing/resolvers/unsubscribe-topic.resolver';import { CampaignVariableService } from 'src/modules/emailing/services/campaign-variable.service';@@ -40,12 +42,14 @@ import { MessageCampaignDeliveryService } from 'src/modules/emailing/services/meimport { MessageCampaignLifecycleService } from 'src/modules/emailing/services/message-campaign-lifecycle.service';import { MessageCampaignMaterializationService } from 'src/modules/emailing/services/message-campaign-materialization.service';import { MessageCampaignService } from 'src/modules/emailing/services/message-campaign.service';+import { MessageListDuplicationService } from 'src/modules/emailing/services/message-list-duplication.service';import { MessageSuppressionService } from 'src/modules/emailing/services/message-suppression.service';import { UnsubscribeTopicService } from 'src/modules/emailing/services/unsubscribe-topic.service';import { SaveCampaignTool } from 'src/modules/emailing/tools/save-campaign-tool';@Module({imports: [+ ActorModule,EmailingDomainModule,ThrottlerModule,MessageChannelMetadataModule,@@ -85,6 +89,8 @@ import { SaveCampaignTool } from 'src/modules/emailing/tools/save-campaign-tool'EmailingDomainSenderService,SaveCampaignTool,EmailingSendResolver,+ MessageListDuplicationService,+ MessageListResolver,MessageSuppressionResolver,UnsubscribeTopicResolver,provideWorkspaceScopedRepository(EmailingDomainEntity),diff --git a/packages/twenty-server/src/modules/emailing/exceptions/message-list.exception.ts b/packages/twenty-server/src/modules/emailing/exceptions/message-list.exception.tsnew file mode 100644index 00000000000..7459ebe6b3f--- /dev/null+++ b/packages/twenty-server/src/modules/emailing/exceptions/message-list.exception.ts@@ -0,0 +1,36 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import { assertUnreachable } from 'twenty-shared/utils';++import { CustomException } from 'src/utils/custom-exception';++export enum MessageListExceptionCode {+ MESSAGE_LIST_NOT_FOUND = 'MESSAGE_LIST_NOT_FOUND',+ MESSAGE_LIST_DUPLICATION_FAILED = 'MESSAGE_LIST_DUPLICATION_FAILED',+}++const getMessageListExceptionUserFriendlyMessage = (+ code: MessageListExceptionCode,+) => {+ switch (code) {+ case MessageListExceptionCode.MESSAGE_LIST_NOT_FOUND:+ return msg`List not found.`;+ case MessageListExceptionCode.MESSAGE_LIST_DUPLICATION_FAILED:+ return msg`Failed to duplicate list.`;+ default:+ assertUnreachable(code);+ }+};++export class MessageListException extends CustomException<MessageListExceptionCode> {+ constructor(+ message: string,+ code: MessageListExceptionCode,+ { userFriendlyMessage }: { userFriendlyMessage?: MessageDescriptor } = {},+ ) {+ super(message, code, {+ userFriendlyMessage:+ userFriendlyMessage ?? getMessageListExceptionUserFriendlyMessage(code),+ });+ }+}diff --git a/packages/twenty-server/src/modules/emailing/resolvers/message-list.resolver.ts b/packages/twenty-server/src/modules/emailing/resolvers/message-list.resolver.tsnew file mode 100644index 00000000000..8ae835166cc--- /dev/null+++ b/packages/twenty-server/src/modules/emailing/resolvers/message-list.resolver.ts@@ -0,0 +1,51 @@+import { UseFilters, UseGuards, UsePipes } from '@nestjs/common';+import { Args, Mutation } from '@nestjs/graphql';++import { FeatureFlagKey } from 'twenty-shared/types';++import { MetadataResolver } from 'src/engine/api/graphql/graphql-config/decorators/metadata-resolver.decorator';+import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';+import { getWorkspaceAuthContext } from 'src/engine/core-modules/auth/storage/workspace-auth-context.storage';+import { ResolverValidationPipe } from 'src/engine/core-modules/graphql/pipes/resolver-validation.pipe';+import { AuthUserWorkspaceId } from 'src/engine/decorators/auth/auth-user-workspace-id.decorator';+import { NoPermissionGuard } from 'src/engine/guards/no-permission.guard';+import {+ FeatureFlagGuard,+ RequireFeatureFlag,+} from 'src/engine/guards/feature-flag.guard';+import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';+import { PermissionsGraphqlApiExceptionFilter } from 'src/engine/metadata-modules/permissions/utils/permissions-graphql-api-exception.filter';+import { DuplicatedMessageListDTO } from 'src/modules/emailing/dtos/duplicated-message-list.dto';+import { MessageListDuplicationService } from 'src/modules/emailing/services/message-list-duplication.service';+import { MessageListGraphqlApiExceptionFilter } from 'src/modules/emailing/utils/message-list-graphql-api-exception.filter';++// Object permissions on the list and its memberships are checked by the+// service, so no settings permission is required here.+@MetadataResolver()+@UseFilters(+ MessageListGraphqlApiExceptionFilter,+ PermissionsGraphqlApiExceptionFilter,+)+@UseGuards(WorkspaceAuthGuard, FeatureFlagGuard)+@UsePipes(ResolverValidationPipe)+export class MessageListResolver {+ constructor(+ private readonly messageListDuplicationService: MessageListDuplicationService,+ ) {}++ @Mutation(() => DuplicatedMessageListDTO)+ @UseGuards(NoPermissionGuard)+ @RequireFeatureFlag(FeatureFlagKey.IS_EMAIL_GROUP_ENABLED)+ async duplicateMessageList(+ @Args('id', { type: () => UUIDScalarType }) id: string,+ @AuthUserWorkspaceId() userWorkspaceId: string,+ ): Promise<DuplicatedMessageListDTO> {+ const authContext = getWorkspaceAuthContext();++ return this.messageListDuplicationService.duplicateMessageList({+ messageListId: id,+ userWorkspaceId,+ authContext,+ });+ }+}diff --git a/packages/twenty-server/src/modules/emailing/services/message-list-duplication.service.ts b/packages/twenty-server/src/modules/emailing/services/message-list-duplication.service.tsnew file mode 100644index 00000000000..49324a2f66e--- /dev/null+++ b/packages/twenty-server/src/modules/emailing/services/message-list-duplication.service.ts@@ -0,0 +1,207 @@+import { Injectable } from '@nestjs/common';++import { STANDARD_OBJECTS } from 'twenty-shared/metadata';+import { appendCopySuffix, isDefined } from 'twenty-shared/utils';++import { ActorFromAuthContextService } from 'src/engine/core-modules/actor/services/actor-from-auth-context.service';+import { type WorkspaceAuthContext } from 'src/engine/core-modules/auth/types/workspace-auth-context.type';+import {+ PermissionsException,+ PermissionsExceptionCode,+ PermissionsExceptionMessage,+} from 'src/engine/metadata-modules/permissions/permissions.exception';+import { PermissionsService } from 'src/engine/metadata-modules/permissions/permissions.service';+import { UserRoleService } from 'src/engine/metadata-modules/user-role/user-role.service';+import { type WorkspaceTransactionScope } from 'src/engine/twenty-orm/types/workspace-transaction-scope.type';+import { WorkspaceOrmManager } from 'src/engine/twenty-orm/workspace-orm.manager';+import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';+import { DuplicatedMessageListDTO } from 'src/modules/emailing/dtos/duplicated-message-list.dto';+import {+ MessageListException,+ MessageListExceptionCode,+} from 'src/modules/emailing/exceptions/message-list.exception';+import { type MessageListMemberWorkspaceEntity } from 'src/modules/emailing/standard-objects/message-list-member.workspace-entity';+import { type MessageListWorkspaceEntity } from 'src/modules/emailing/standard-objects/message-list.workspace-entity';++const DUPLICATED_OBJECT_UNIVERSAL_IDENTIFIERS = [+ STANDARD_OBJECTS.messageList.universalIdentifier,+ STANDARD_OBJECTS.messageListMember.universalIdentifier,+];++@Injectable()+export class MessageListDuplicationService {+ constructor(+ private readonly workspaceOrmManager: WorkspaceOrmManager,+ private readonly userRoleService: UserRoleService,+ private readonly permissionsService: PermissionsService,+ private readonly workspaceCacheService: WorkspaceCacheService,+ private readonly actorFromAuthContextService: ActorFromAuthContextService,+ ) {}++ async duplicateMessageList({+ messageListId,+ userWorkspaceId,+ authContext,+ }: {+ messageListId: string;+ userWorkspaceId: string;+ authContext: WorkspaceAuthContext;+ }): Promise<DuplicatedMessageListDTO> {+ const workspaceId = authContext.workspace.id;++ await this.assertCanReadAndUpdateDuplicatedObjects({+ workspaceId,+ userWorkspaceId,+ });++ const roleId = await this.userRoleService.getRoleIdForUserWorkspace({+ workspaceId,+ userWorkspaceId,+ });++ // One transaction so a failed member insert never leaves a list copy+ // without its members.+ return this.workspaceOrmManager.executeInWorkspaceContext(+ () =>+ this.workspaceOrmManager.runInWorkspaceTransaction((transactionScope) =>+ this.duplicateInTransaction({+ messageListId,+ roleId,+ authContext,+ transactionScope,+ }),+ ),+ authContext,+ );+ }++ // messageList and messageListMember are system objects, for which the+ // repositories skip role permission checks, so the role is checked here.+ private async assertCanReadAndUpdateDuplicatedObjects({+ workspaceId,+ userWorkspaceId,+ }: {+ workspaceId: string;+ userWorkspaceId: string;+ }): Promise<void> {+ const [{ objectsPermissions }, { flatObjectMetadataMaps }] =+ await Promise.all([+ this.permissionsService.getUserWorkspacePermissions({+ workspaceId,+ userWorkspaceId,+ }),+ this.workspaceCacheService.getOrRecompute(workspaceId, [+ 'flatObjectMetadataMaps',+ ]),+ ]);++ for (const objectUniversalIdentifier of DUPLICATED_OBJECT_UNIVERSAL_IDENTIFIERS) {+ const objectMetadata =+ flatObjectMetadataMaps.byUniversalIdentifier[objectUniversalIdentifier];+ const objectPermissions = isDefined(objectMetadata)+ ? objectsPermissions[objectMetadata.id]+ : undefined;++ if (+ !objectPermissions?.canReadObjectRecords ||+ !objectPermissions.canUpdateObjectRecords+ ) {+ throw new PermissionsException(+ PermissionsExceptionMessage.PERMISSION_DENIED,+ PermissionsExceptionCode.PERMISSION_DENIED,+ );+ }+ }+ }++ private async duplicateInTransaction({+ messageListId,+ roleId,+ authContext,+ transactionScope,+ }: {+ messageListId: string;+ roleId: string;+ authContext: WorkspaceAuthContext;+ transactionScope: WorkspaceTransactionScope;+ }): Promise<DuplicatedMessageListDTO> {+ const messageListRepository =+ transactionScope.getRepository<MessageListWorkspaceEntity>(+ 'messageList',+ { unionOf: [roleId] },+ );+ const messageListMemberRepository =+ transactionScope.getRepository<MessageListMemberWorkspaceEntity>(+ 'messageListMember',+ { unionOf: [roleId] },+ );++ const originalMessageList = await messageListRepository.findOne({+ where: { id: messageListId },+ });++ if (!isDefined(originalMessageList)) {+ throw new MessageListException(+ `Message list with ID "${messageListId}" not found`,+ MessageListExceptionCode.MESSAGE_LIST_NOT_FOUND,+ );+ }++ const originalMembers = await messageListMemberRepository.find({+ where: { listId: messageListId },+ });++ const [messageListWithActor] =+ await this.actorFromAuthContextService.injectActorFieldsOnCreate({+ records: [+ {+ name: appendCopySuffix(originalMessageList.name ?? ''),+ description: originalMessageList.description,+ position: originalMessageList.position,+ },+ ],+ objectMetadataNameSingular: 'messageList',+ authContext,+ });++ const insertResult =+ await messageListRepository.insert(messageListWithActor);+ const duplicatedMessageListId: string = insertResult.identifiers[0].id;++ if (originalMembers.length > 0) {+ const membersWithActor =+ await this.actorFromAuthContextService.injectActorFieldsOnCreate({+ records: originalMembers.map((member) => ({+ listId: duplicatedMessageListId,+ personId: member.personId,+ position: member.position,+ })),+ objectMetadataNameSingular: 'messageListMember',+ authContext,+ });++ await messageListMemberRepository.insert(membersWithActor);+ }++ const duplicatedMessageList = await messageListRepository.findOne({+ where: { id: duplicatedMessageListId },+ });++ if (!isDefined(duplicatedMessageList)) {+ throw new MessageListException(+ 'Failed to retrieve the duplicated message list',+ MessageListExceptionCode.MESSAGE_LIST_DUPLICATION_FAILED,+ );+ }++ return {+ id: duplicatedMessageList.id,+ name: duplicatedMessageList.name,+ description: duplicatedMessageList.description,+ position: duplicatedMessageList.position,+ memberCount: originalMembers.length,+ createdAt: duplicatedMessageList.createdAt,+ updatedAt: duplicatedMessageList.updatedAt,+ };+ }+}diff --git a/packages/twenty-server/src/modules/emailing/standard-objects/message-list-member.workspace-entity.ts b/packages/twenty-server/src/modules/emailing/standard-objects/message-list-member.workspace-entity.tsindex cb486c1fbd0..4a828c73e41 100644--- a/packages/twenty-server/src/modules/emailing/standard-objects/message-list-member.workspace-entity.ts+++ b/packages/twenty-server/src/modules/emailing/standard-objects/message-list-member.workspace-entity.ts@@ -8,5 +8,6 @@ export class MessageListMemberWorkspaceEntity extends BaseWorkspaceEntity {listId: string;person: EntityRelation<PersonWorkspaceEntity>;personId: string;+ position: number;searchVector: string;}diff --git a/packages/twenty-server/src/modules/emailing/standard-objects/message-list.workspace-entity.ts b/packages/twenty-server/src/modules/emailing/standard-objects/message-list.workspace-entity.tsindex 15a5dd88a56..06408f8581a 100644--- a/packages/twenty-server/src/modules/emailing/standard-objects/message-list.workspace-entity.ts+++ b/packages/twenty-server/src/modules/emailing/standard-objects/message-list.workspace-entity.ts@@ -6,6 +6,7 @@ import { type MessageListMemberWorkspaceEntity } from 'src/modules/emailing/stanexport class MessageListWorkspaceEntity extends BaseWorkspaceEntity {name: string | null;description: string | null;+ position: number;members: EntityRelation<MessageListMemberWorkspaceEntity[]>;campaigns: EntityRelation<MessageCampaignWorkspaceEntity[]>;searchVector: string;diff --git a/packages/twenty-server/src/modules/emailing/utils/message-list-graphql-api-exception-handler.util.ts b/packages/twenty-server/src/modules/emailing/utils/message-list-graphql-api-exception-handler.util.tsnew file mode 100644index 00000000000..098f95b4307--- /dev/null+++ b/packages/twenty-server/src/modules/emailing/utils/message-list-graphql-api-exception-handler.util.ts@@ -0,0 +1,26 @@+import { assertUnreachable } from 'twenty-shared/utils';++import {+ InternalServerError,+ NotFoundError,+} from 'src/engine/core-modules/graphql/utils/graphql-errors.util';+import {+ MessageListException,+ MessageListExceptionCode,+} from 'src/modules/emailing/exceptions/message-list.exception';++export const messageListGraphqlApiExceptionHandler = (error: Error) => {+ if (error instanceof MessageListException) {+ switch (error.code) {+ case MessageListExceptionCode.MESSAGE_LIST_NOT_FOUND:+ throw new NotFoundError(error);+ case MessageListExceptionCode.MESSAGE_LIST_DUPLICATION_FAILED:+ throw new InternalServerError(error);+ default: {+ return assertUnreachable(error.code);+ }+ }+ }++ throw error;+};diff --git a/packages/twenty-server/src/modules/emailing/utils/message-list-graphql-api-exception.filter.ts b/packages/twenty-server/src/modules/emailing/utils/message-list-graphql-api-exception.filter.tsnew file mode 100644index 00000000000..7cdf1b586f8--- /dev/null+++ b/packages/twenty-server/src/modules/emailing/utils/message-list-graphql-api-exception.filter.ts@@ -0,0 +1,12 @@+import { type ArgumentsHost, Catch } from '@nestjs/common';+import { type GqlExceptionFilter } from '@nestjs/graphql';++import { MessageListException } from 'src/modules/emailing/exceptions/message-list.exception';+import { messageListGraphqlApiExceptionHandler } from 'src/modules/emailing/utils/message-list-graphql-api-exception-handler.util';++@Catch(MessageListException)+export class MessageListGraphqlApiExceptionFilter implements GqlExceptionFilter {+ catch(exception: MessageListException, _host: ArgumentsHost) {+ return messageListGraphqlApiExceptionHandler(exception);+ }+}