diff --git a/packages/twenty-front/project.json b/packages/twenty-front/project.json index ad7245783..549e2c695 100644 --- a/packages/twenty-front/project.json +++ b/packages/twenty-front/project.json @@ -69,7 +69,7 @@ "test": {}, "storybook:build": { "options": { - "env": { "NODE_OPTIONS": "--max_old_space_size=6500" } + "env": { "NODE_OPTIONS": "--max_old_space_size=7000" } }, "configurations": { "docs": { "env": { "STORYBOOK_SCOPE": "ui-docs" } }, diff --git a/packages/twenty-front/src/generated-metadata/gql.ts b/packages/twenty-front/src/generated-metadata/gql.ts index 5d8e10a5e..a405f5298 100644 --- a/packages/twenty-front/src/generated-metadata/gql.ts +++ b/packages/twenty-front/src/generated-metadata/gql.ts @@ -39,7 +39,7 @@ const documents = { "\n mutation ExecuteOneServerlessFunction(\n $input: ExecuteServerlessFunctionInput!\n ) {\n executeOneServerlessFunction(input: $input) {\n data\n duration\n status\n error\n }\n }\n": types.ExecuteOneServerlessFunctionDocument, "\n \n mutation PublishOneServerlessFunction(\n $input: PublishServerlessFunctionInput!\n ) {\n publishServerlessFunction(input: $input) {\n ...ServerlessFunctionFields\n }\n }\n": types.PublishOneServerlessFunctionDocument, "\n \n mutation UpdateOneServerlessFunction($input: UpdateServerlessFunctionInput!) {\n updateOneServerlessFunction(input: $input) {\n ...ServerlessFunctionFields\n }\n }\n": types.UpdateOneServerlessFunctionDocument, - "\n query FindManyAvailablePackages {\n getAvailablePackages\n }\n": types.FindManyAvailablePackagesDocument, + "\n query FindManyAvailablePackages($input: ServerlessFunctionIdInput!) {\n getAvailablePackages(input: $input)\n }\n": types.FindManyAvailablePackagesDocument, "\n \n query GetManyServerlessFunctions {\n findManyServerlessFunctions {\n ...ServerlessFunctionFields\n }\n }\n": types.GetManyServerlessFunctionsDocument, "\n \n query GetOneServerlessFunction($input: ServerlessFunctionIdInput!) {\n findOneServerlessFunction(input: $input) {\n ...ServerlessFunctionFields\n }\n }\n": types.GetOneServerlessFunctionDocument, "\n query FindOneServerlessFunctionSourceCode(\n $input: GetServerlessFunctionSourceCodeInput!\n ) {\n getServerlessFunctionSourceCode(input: $input)\n }\n": types.FindOneServerlessFunctionSourceCodeDocument, @@ -166,7 +166,7 @@ export function graphql(source: "\n \n mutation UpdateOneServerlessFunction($i /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query FindManyAvailablePackages {\n getAvailablePackages\n }\n"): (typeof documents)["\n query FindManyAvailablePackages {\n getAvailablePackages\n }\n"]; +export function graphql(source: "\n query FindManyAvailablePackages($input: ServerlessFunctionIdInput!) {\n getAvailablePackages(input: $input)\n }\n"): (typeof documents)["\n query FindManyAvailablePackages($input: ServerlessFunctionIdInput!) {\n getAvailablePackages(input: $input)\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts index b26b39ddc..68aa7b83f 100644 --- a/packages/twenty-front/src/generated-metadata/graphql.ts +++ b/packages/twenty-front/src/generated-metadata/graphql.ts @@ -263,6 +263,13 @@ export type CreateServerlessFunctionInput = { name: Scalars['String']['input']; }; +export type CreateWorkflowVersionStepInput = { + /** New step type */ + stepType: Scalars['String']['input']; + /** Workflow version ID */ + workflowVersionId: Scalars['String']['input']; +}; + export type CursorPaging = { /** Paginate after opaque cursor */ after?: InputMaybe; @@ -298,6 +305,13 @@ export type DeleteSsoOutput = { identityProviderId: Scalars['String']['output']; }; +export type DeleteWorkflowVersionStepInput = { + /** Step to delete ID */ + stepId: Scalars['String']['input']; + /** Workflow version ID */ + workflowVersionId: Scalars['String']['input']; +}; + /** Schema update on a table */ export enum DistantTableUpdate { ColumnsAdded = 'COLUMNS_ADDED', @@ -553,6 +567,7 @@ export type Mutation = { createOneRemoteServer: RemoteServer; createOneServerlessFunction: ServerlessFunction; createSAMLIdentityProvider: SetupSsoOutput; + createWorkflowVersionStep: WorkflowAction; deactivateWorkflowVersion: Scalars['Boolean']['output']; deleteCurrentWorkspace: Workspace; deleteOneField: Field; @@ -562,6 +577,7 @@ export type Mutation = { deleteOneServerlessFunction: ServerlessFunction; deleteSSOIdentityProvider: DeleteSsoOutput; deleteUser: User; + deleteWorkflowVersionStep: Scalars['Boolean']['output']; deleteWorkspaceInvitation: Scalars['String']['output']; disablePostgresProxy: PostgresCredentials; editSSOIdentityProvider: EditSsoOutput; @@ -592,6 +608,7 @@ export type Mutation = { updateOneRemoteServer: RemoteServer; updateOneServerlessFunction: ServerlessFunction; updatePasswordViaResetToken: InvalidatePassword; + updateWorkflowVersionStep: Scalars['Boolean']['output']; updateWorkspace: Workspace; uploadFile: Scalars['String']['output']; uploadImage: Scalars['String']['output']; @@ -686,6 +703,11 @@ export type MutationCreateSamlIdentityProviderArgs = { }; +export type MutationCreateWorkflowVersionStepArgs = { + input: CreateWorkflowVersionStepInput; +}; + + export type MutationDeactivateWorkflowVersionArgs = { workflowVersionId: Scalars['String']['input']; }; @@ -721,6 +743,11 @@ export type MutationDeleteSsoIdentityProviderArgs = { }; +export type MutationDeleteWorkflowVersionStepArgs = { + input: DeleteWorkflowVersionStepInput; +}; + + export type MutationDeleteWorkspaceInvitationArgs = { appTokenId: Scalars['String']['input']; }; @@ -855,6 +882,11 @@ export type MutationUpdatePasswordViaResetTokenArgs = { }; +export type MutationUpdateWorkflowVersionStepArgs = { + input: UpdateWorkflowVersionStepInput; +}; + + export type MutationUpdateWorkspaceArgs = { data: UpdateWorkspaceInput; }; @@ -1053,6 +1085,11 @@ export type QueryFindWorkspaceFromInviteHashArgs = { }; +export type QueryGetAvailablePackagesArgs = { + input: ServerlessFunctionIdInput; +}; + + export type QueryGetProductPricesArgs = { product: Scalars['String']['input']; }; @@ -1490,6 +1527,13 @@ export type UpdateServerlessFunctionInput = { name: Scalars['String']['input']; }; +export type UpdateWorkflowVersionStepInput = { + /** Step to update in JSON format */ + step: Scalars['JSON']['input']; + /** Workflow version ID */ + workflowVersionId: Scalars['String']['input']; +}; + export type UpdateWorkspaceInput = { allowImpersonation?: InputMaybe; displayName?: InputMaybe; @@ -1576,6 +1620,11 @@ export type Verify = { user: User; }; +export type WorkflowAction = { + __typename?: 'WorkflowAction'; + id: Scalars['UUID']['output']; +}; + export type WorkflowRun = { __typename?: 'WorkflowRun'; workflowRunId: Scalars['UUID']['output']; @@ -1585,6 +1634,7 @@ export type Workspace = { __typename?: 'Workspace'; activationStatus: WorkspaceActivationStatus; allowImpersonation: Scalars['Boolean']['output']; + billingEntitlements?: Maybe>; billingSubscriptions?: Maybe>; createdAt: Scalars['DateTime']['output']; currentBillingSubscription?: Maybe; @@ -1605,6 +1655,12 @@ export type Workspace = { }; +export type WorkspaceBillingEntitlementsArgs = { + filter?: BillingEntitlementFilter; + sorting?: Array; +}; + + export type WorkspaceBillingSubscriptionsArgs = { filter?: BillingSubscriptionFilter; sorting?: Array; @@ -1676,6 +1732,30 @@ export type WorkspaceNameAndId = { id: Scalars['String']['output']; }; +export type BillingEntitlement = { + __typename?: 'billingEntitlement'; + id: Scalars['UUID']['output']; + key: Scalars['String']['output']; + value: Scalars['Boolean']['output']; + workspaceId: Scalars['String']['output']; +}; + +export type BillingEntitlementFilter = { + and?: InputMaybe>; + id?: InputMaybe; + or?: InputMaybe>; +}; + +export type BillingEntitlementSort = { + direction: SortDirection; + field: BillingEntitlementSortFields; + nulls?: InputMaybe; +}; + +export enum BillingEntitlementSortFields { + Id = 'id' +} + export type Field = { __typename?: 'field'; createdAt: Scalars['DateTime']['output']; @@ -2028,7 +2108,9 @@ export type UpdateOneServerlessFunctionMutationVariables = Exact<{ export type UpdateOneServerlessFunctionMutation = { __typename?: 'Mutation', updateOneServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, latestVersionInputSchema?: any | null, publishedVersions: Array, createdAt: any, updatedAt: any } }; -export type FindManyAvailablePackagesQueryVariables = Exact<{ [key: string]: never; }>; +export type FindManyAvailablePackagesQueryVariables = Exact<{ + input: ServerlessFunctionIdInput; +}>; export type FindManyAvailablePackagesQuery = { __typename?: 'Query', getAvailablePackages: any }; @@ -2078,7 +2160,7 @@ export const DeleteOneServerlessFunctionDocument = {"kind":"Document","definitio export const ExecuteOneServerlessFunctionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ExecuteOneServerlessFunction"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ExecuteServerlessFunctionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"executeOneServerlessFunction"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"}},{"kind":"Field","name":{"kind":"Name","value":"duration"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"error"}}]}}]}}]} as unknown as DocumentNode; export const PublishOneServerlessFunctionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"PublishOneServerlessFunction"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"PublishServerlessFunctionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"publishServerlessFunction"},"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":"ServerlessFunctionFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServerlessFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ServerlessFunction"}},"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":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"syncStatus"}},{"kind":"Field","name":{"kind":"Name","value":"latestVersion"}},{"kind":"Field","name":{"kind":"Name","value":"latestVersionInputSchema"}},{"kind":"Field","name":{"kind":"Name","value":"publishedVersions"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const UpdateOneServerlessFunctionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateOneServerlessFunction"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateServerlessFunctionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateOneServerlessFunction"},"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":"ServerlessFunctionFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServerlessFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ServerlessFunction"}},"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":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"syncStatus"}},{"kind":"Field","name":{"kind":"Name","value":"latestVersion"}},{"kind":"Field","name":{"kind":"Name","value":"latestVersionInputSchema"}},{"kind":"Field","name":{"kind":"Name","value":"publishedVersions"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; -export const FindManyAvailablePackagesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyAvailablePackages"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAvailablePackages"}}]}}]} as unknown as DocumentNode; +export const FindManyAvailablePackagesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyAvailablePackages"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ServerlessFunctionIdInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAvailablePackages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}]}]}}]} as unknown as DocumentNode; export const GetManyServerlessFunctionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetManyServerlessFunctions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findManyServerlessFunctions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ServerlessFunctionFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServerlessFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ServerlessFunction"}},"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":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"syncStatus"}},{"kind":"Field","name":{"kind":"Name","value":"latestVersion"}},{"kind":"Field","name":{"kind":"Name","value":"latestVersionInputSchema"}},{"kind":"Field","name":{"kind":"Name","value":"publishedVersions"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const GetOneServerlessFunctionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOneServerlessFunction"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ServerlessFunctionIdInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneServerlessFunction"},"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":"ServerlessFunctionFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServerlessFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ServerlessFunction"}},"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":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"syncStatus"}},{"kind":"Field","name":{"kind":"Name","value":"latestVersion"}},{"kind":"Field","name":{"kind":"Name","value":"latestVersionInputSchema"}},{"kind":"Field","name":{"kind":"Name","value":"publishedVersions"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const FindOneServerlessFunctionSourceCodeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneServerlessFunctionSourceCode"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"GetServerlessFunctionSourceCodeInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getServerlessFunctionSourceCode"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}]}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/packages/twenty-front/src/generated/graphql.tsx b/packages/twenty-front/src/generated/graphql.tsx index f3a092a0f..ccc11dcbc 100644 --- a/packages/twenty-front/src/generated/graphql.tsx +++ b/packages/twenty-front/src/generated/graphql.tsx @@ -175,6 +175,13 @@ export type CreateServerlessFunctionInput = { name: Scalars['String']; }; +export type CreateWorkflowVersionStepInput = { + /** New step type */ + stepType: Scalars['String']; + /** Workflow version ID */ + workflowVersionId: Scalars['String']; +}; + export type CursorPaging = { /** Paginate after opaque cursor */ after?: InputMaybe; @@ -200,6 +207,13 @@ export type DeleteSsoOutput = { identityProviderId: Scalars['String']; }; +export type DeleteWorkflowVersionStepInput = { + /** Step to delete ID */ + stepId: Scalars['String']; + /** Workflow version ID */ + workflowVersionId: Scalars['String']; +}; + /** Schema update on a table */ export enum DistantTableUpdate { ColumnsAdded = 'COLUMNS_ADDED', @@ -445,12 +459,14 @@ export type Mutation = { createOneObject: Object; createOneServerlessFunction: ServerlessFunction; createSAMLIdentityProvider: SetupSsoOutput; + createWorkflowVersionStep: WorkflowAction; deactivateWorkflowVersion: Scalars['Boolean']; deleteCurrentWorkspace: Workspace; deleteOneObject: Object; deleteOneServerlessFunction: ServerlessFunction; deleteSSOIdentityProvider: DeleteSsoOutput; deleteUser: User; + deleteWorkflowVersionStep: WorkflowAction; deleteWorkspaceInvitation: Scalars['String']; disablePostgresProxy: PostgresCredentials; editSSOIdentityProvider: EditSsoOutput; @@ -476,6 +492,7 @@ export type Mutation = { updateOneObject: Object; updateOneServerlessFunction: ServerlessFunction; updatePasswordViaResetToken: InvalidatePassword; + updateWorkflowVersionStep: WorkflowAction; updateWorkspace: Workspace; updateWorkspaceFeatureFlag: Scalars['Boolean']; uploadFile: Scalars['String']; @@ -547,6 +564,11 @@ export type MutationCreateSamlIdentityProviderArgs = { }; +export type MutationCreateWorkflowVersionStepArgs = { + input: CreateWorkflowVersionStepInput; +}; + + export type MutationDeactivateWorkflowVersionArgs = { workflowVersionId: Scalars['String']; }; @@ -567,6 +589,11 @@ export type MutationDeleteSsoIdentityProviderArgs = { }; +export type MutationDeleteWorkflowVersionStepArgs = { + input: DeleteWorkflowVersionStepInput; +}; + + export type MutationDeleteWorkspaceInvitationArgs = { appTokenId: Scalars['String']; }; @@ -676,6 +703,11 @@ export type MutationUpdatePasswordViaResetTokenArgs = { }; +export type MutationUpdateWorkflowVersionStepArgs = { + input: UpdateWorkflowVersionStepInput; +}; + + export type MutationUpdateWorkspaceArgs = { data: UpdateWorkspaceInput; }; @@ -853,6 +885,11 @@ export type QueryFindWorkspaceFromInviteHashArgs = { }; +export type QueryGetAvailablePackagesArgs = { + input: ServerlessFunctionIdInput; +}; + + export type QueryGetProductPricesArgs = { product: Scalars['String']; }; @@ -1214,6 +1251,13 @@ export type UpdateServerlessFunctionInput = { name: Scalars['String']; }; +export type UpdateWorkflowVersionStepInput = { + /** Step to update in JSON format */ + step: Scalars['JSON']; + /** Workflow version ID */ + workflowVersionId: Scalars['String']; +}; + export type UpdateWorkspaceInput = { allowImpersonation?: InputMaybe; displayName?: InputMaybe; @@ -1304,6 +1348,15 @@ export type Verify = { user: User; }; +export type WorkflowAction = { + __typename?: 'WorkflowAction'; + id: Scalars['UUID']; + name: Scalars['String']; + settings: Scalars['JSON']; + type: Scalars['String']; + valid: Scalars['Boolean']; +}; + export type WorkflowRun = { __typename?: 'WorkflowRun'; workflowRunId: Scalars['UUID']; @@ -1938,6 +1991,13 @@ export type ComputeStepOutputSchemaMutationVariables = Exact<{ export type ComputeStepOutputSchemaMutation = { __typename?: 'Mutation', computeStepOutputSchema: any }; +export type CreateWorkflowVersionStepMutationVariables = Exact<{ + input: CreateWorkflowVersionStepInput; +}>; + + +export type CreateWorkflowVersionStepMutation = { __typename?: 'Mutation', createWorkflowVersionStep: { __typename?: 'WorkflowAction', id: any, name: string, type: string, settings: any, valid: boolean } }; + export type DeactivateWorkflowVersionMutationVariables = Exact<{ workflowVersionId: Scalars['String']; }>; @@ -1945,6 +2005,13 @@ export type DeactivateWorkflowVersionMutationVariables = Exact<{ export type DeactivateWorkflowVersionMutation = { __typename?: 'Mutation', deactivateWorkflowVersion: boolean }; +export type DeleteWorkflowVersionStepMutationVariables = Exact<{ + input: DeleteWorkflowVersionStepInput; +}>; + + +export type DeleteWorkflowVersionStepMutation = { __typename?: 'Mutation', deleteWorkflowVersionStep: { __typename?: 'WorkflowAction', id: any, name: string, type: string, settings: any, valid: boolean } }; + export type RunWorkflowVersionMutationVariables = Exact<{ input: RunWorkflowVersionInput; }>; @@ -1952,6 +2019,13 @@ export type RunWorkflowVersionMutationVariables = Exact<{ export type RunWorkflowVersionMutation = { __typename?: 'Mutation', runWorkflowVersion: { __typename?: 'WorkflowRun', workflowRunId: any } }; +export type UpdateWorkflowVersionStepMutationVariables = Exact<{ + input: UpdateWorkflowVersionStepInput; +}>; + + +export type UpdateWorkflowVersionStepMutation = { __typename?: 'Mutation', updateWorkflowVersionStep: { __typename?: 'WorkflowAction', id: any, name: string, type: string, settings: any, valid: boolean } }; + export type DeleteWorkspaceInvitationMutationVariables = Exact<{ appTokenId: Scalars['String']; }>; @@ -3695,6 +3769,43 @@ export function useComputeStepOutputSchemaMutation(baseOptions?: Apollo.Mutation export type ComputeStepOutputSchemaMutationHookResult = ReturnType; export type ComputeStepOutputSchemaMutationResult = Apollo.MutationResult; export type ComputeStepOutputSchemaMutationOptions = Apollo.BaseMutationOptions; +export const CreateWorkflowVersionStepDocument = gql` + mutation CreateWorkflowVersionStep($input: CreateWorkflowVersionStepInput!) { + createWorkflowVersionStep(input: $input) { + id + name + type + settings + valid + } +} + `; +export type CreateWorkflowVersionStepMutationFn = Apollo.MutationFunction; + +/** + * __useCreateWorkflowVersionStepMutation__ + * + * To run a mutation, you first call `useCreateWorkflowVersionStepMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useCreateWorkflowVersionStepMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [createWorkflowVersionStepMutation, { data, loading, error }] = useCreateWorkflowVersionStepMutation({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useCreateWorkflowVersionStepMutation(baseOptions?: Apollo.MutationHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useMutation(CreateWorkflowVersionStepDocument, options); + } +export type CreateWorkflowVersionStepMutationHookResult = ReturnType; +export type CreateWorkflowVersionStepMutationResult = Apollo.MutationResult; +export type CreateWorkflowVersionStepMutationOptions = Apollo.BaseMutationOptions; export const DeactivateWorkflowVersionDocument = gql` mutation DeactivateWorkflowVersion($workflowVersionId: String!) { deactivateWorkflowVersion(workflowVersionId: $workflowVersionId) @@ -3726,6 +3837,43 @@ export function useDeactivateWorkflowVersionMutation(baseOptions?: Apollo.Mutati export type DeactivateWorkflowVersionMutationHookResult = ReturnType; export type DeactivateWorkflowVersionMutationResult = Apollo.MutationResult; export type DeactivateWorkflowVersionMutationOptions = Apollo.BaseMutationOptions; +export const DeleteWorkflowVersionStepDocument = gql` + mutation DeleteWorkflowVersionStep($input: DeleteWorkflowVersionStepInput!) { + deleteWorkflowVersionStep(input: $input) { + id + name + type + settings + valid + } +} + `; +export type DeleteWorkflowVersionStepMutationFn = Apollo.MutationFunction; + +/** + * __useDeleteWorkflowVersionStepMutation__ + * + * To run a mutation, you first call `useDeleteWorkflowVersionStepMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useDeleteWorkflowVersionStepMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [deleteWorkflowVersionStepMutation, { data, loading, error }] = useDeleteWorkflowVersionStepMutation({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useDeleteWorkflowVersionStepMutation(baseOptions?: Apollo.MutationHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useMutation(DeleteWorkflowVersionStepDocument, options); + } +export type DeleteWorkflowVersionStepMutationHookResult = ReturnType; +export type DeleteWorkflowVersionStepMutationResult = Apollo.MutationResult; +export type DeleteWorkflowVersionStepMutationOptions = Apollo.BaseMutationOptions; export const RunWorkflowVersionDocument = gql` mutation RunWorkflowVersion($input: RunWorkflowVersionInput!) { runWorkflowVersion(input: $input) { @@ -3759,6 +3907,43 @@ export function useRunWorkflowVersionMutation(baseOptions?: Apollo.MutationHookO export type RunWorkflowVersionMutationHookResult = ReturnType; export type RunWorkflowVersionMutationResult = Apollo.MutationResult; export type RunWorkflowVersionMutationOptions = Apollo.BaseMutationOptions; +export const UpdateWorkflowVersionStepDocument = gql` + mutation UpdateWorkflowVersionStep($input: UpdateWorkflowVersionStepInput!) { + updateWorkflowVersionStep(input: $input) { + id + name + type + settings + valid + } +} + `; +export type UpdateWorkflowVersionStepMutationFn = Apollo.MutationFunction; + +/** + * __useUpdateWorkflowVersionStepMutation__ + * + * To run a mutation, you first call `useUpdateWorkflowVersionStepMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useUpdateWorkflowVersionStepMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [updateWorkflowVersionStepMutation, { data, loading, error }] = useUpdateWorkflowVersionStepMutation({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useUpdateWorkflowVersionStepMutation(baseOptions?: Apollo.MutationHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useMutation(UpdateWorkflowVersionStepDocument, options); + } +export type UpdateWorkflowVersionStepMutationHookResult = ReturnType; +export type UpdateWorkflowVersionStepMutationResult = Apollo.MutationResult; +export type UpdateWorkflowVersionStepMutationOptions = Apollo.BaseMutationOptions; export const DeleteWorkspaceInvitationDocument = gql` mutation DeleteWorkspaceInvitation($appTokenId: String!) { deleteWorkspaceInvitation(appTokenId: $appTokenId) diff --git a/packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx b/packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx new file mode 100644 index 000000000..e1e755d09 --- /dev/null +++ b/packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx @@ -0,0 +1,31 @@ +import styled from '@emotion/styled'; +import { BACKGROUND_LIGHT, GRAY_SCALE } from 'twenty-ui'; +import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader'; +import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; + +const StyledRightDrawerContainer = styled.div` + display: flex; + flex-direction: column; + width: 100%; + padding: ${({ theme }) => theme.spacing(4)}; +`; + +const StyledSkeletonLoader = () => { + return ( + + + + ); +}; + +export const RightDrawerSkeletonLoader = () => { + return ( + + + + ); +}; diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/workflow-run-record-actions/hooks/useWorkflowRunRecordActions.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/workflow-run-record-actions/hooks/useWorkflowRunRecordActions.tsx index 677e9b392..dbb7f7cc8 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/workflow-run-record-actions/hooks/useWorkflowRunRecordActions.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/workflow-run-record-actions/hooks/useWorkflowRunRecordActions.tsx @@ -57,11 +57,12 @@ export const useWorkflowRunRecordActions = ({ index, activeWorkflowVersion, ] of activeWorkflowVersions.entries()) { + const name = capitalize(activeWorkflowVersion.workflow.name); addActionMenuEntry({ type: ActionMenuEntryType.WorkflowRun, key: `workflow-run-${activeWorkflowVersion.id}`, scope: ActionMenuEntryScope.RecordSelection, - label: capitalize(activeWorkflowVersion.workflow.name), + label: name, position: index, Icon: IconSettingsAutomation, onClick: async () => { @@ -76,7 +77,7 @@ export const useWorkflowRunRecordActions = ({ enqueueSnackBar('', { variant: SnackBarVariant.Success, - title: `${capitalize(activeWorkflowVersion.workflow.name)} starting...`, + title: `${name} starting...`, icon: ( { index, activeWorkflowVersion, ] of activeWorkflowVersions.entries()) { + const name = capitalize(activeWorkflowVersion.workflow.name); addActionMenuEntry({ type: ActionMenuEntryType.WorkflowRun, key: `workflow-run-${activeWorkflowVersion.id}`, scope: ActionMenuEntryScope.Global, - label: capitalize(activeWorkflowVersion.workflow.name), + label: name, position: index, Icon: IconSettingsAutomation, onClick: async () => { @@ -51,7 +52,7 @@ export const useWorkflowRunActions = () => { enqueueSnackBar('', { variant: SnackBarVariant.Success, - title: `${capitalize(activeWorkflowVersion.workflow.name)} starting...`, + title: `${name} starting...`, icon: ( = { @@ -20,6 +22,8 @@ type FindOneRecordParams = { export const useLazyFindOneRecord = ({ objectNameSingular, recordGqlFields, + withSoftDeleted = false, + fetchPolicy = 'cache-first', }: UseLazyFindOneRecordParams) => { const { objectMetadataItem } = useObjectMetadataItem({ objectNameSingular, @@ -30,22 +34,28 @@ export const useLazyFindOneRecord = ({ recordGqlFields: recordGqlFields ?? generateDepthOneRecordGqlFields({ objectMetadataItem }), + withSoftDeleted, }); const [findOneRecord, { loading, error, data, called }] = useLazyQuery(findOneRecordQuery); return { - findOneRecord: ({ objectRecordId, onCompleted }: FindOneRecordParams) => - findOneRecord({ + findOneRecord: async ({ + objectRecordId, + onCompleted, + }: FindOneRecordParams) => { + await findOneRecord({ variables: { objectRecordId }, + fetchPolicy, onCompleted: (data) => { const record = getRecordFromRecordNode({ recordNode: data[objectNameSingular], }); onCompleted?.(record); }, - }), + }); + }, called, error, loading, diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditor.tsx b/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditor.tsx index 543c4772e..48a69acc0 100644 --- a/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditor.tsx +++ b/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditor.tsx @@ -1,4 +1,3 @@ -import { SettingsServerlessFunctionCodeEditorContainer } from '@/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditorContainer'; import { useGetAvailablePackages } from '@/settings/serverless-functions/hooks/useGetAvailablePackages'; import { EditorProps, Monaco } from '@monaco-editor/react'; import dotenv from 'dotenv'; @@ -6,6 +5,7 @@ import { editor, MarkerSeverity } from 'monaco-editor'; import { AutoTypings } from 'monaco-editor-auto-typings'; import { CodeEditor } from 'twenty-ui'; import { isDefined } from '~/utils/isDefined'; +import { useParams } from 'react-router-dom'; export type File = { language: string; @@ -31,7 +31,10 @@ export const SettingsServerlessFunctionCodeEditor = ({ height = 450, options = undefined, }: SettingsServerlessFunctionCodeEditorProps) => { - const { availablePackages } = useGetAvailablePackages(); + const { serverlessFunctionId = '' } = useParams(); + const { availablePackages } = useGetAvailablePackages({ + id: serverlessFunctionId, + }); const currentFile = files.find((file) => file.path === currentFilePath); const environmentVariablesFile = files.find((file) => file.path === '.env'); @@ -116,17 +119,16 @@ export const SettingsServerlessFunctionCodeEditor = ({ return ( isDefined(currentFile) && isDefined(availablePackages) && ( - - - + ) ); }; diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditorContainer.tsx b/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditorContainer.tsx deleted file mode 100644 index 4ad8afaee..000000000 --- a/packages/twenty-front/src/modules/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditorContainer.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import styled from '@emotion/styled'; - -const StyledEditorContainer = styled.div` - border: 1px solid ${({ theme }) => theme.border.color.medium}; - border-top: none; - border-radius: 0 0 ${({ theme }) => theme.border.radius.sm} - ${({ theme }) => theme.border.radius.sm}; -`; - -export const SettingsServerlessFunctionCodeEditorContainer = - StyledEditorContainer; diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionTestTab.tsx b/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionTestTab.tsx index 863483c3f..1ad7e74d9 100644 --- a/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionTestTab.tsx +++ b/packages/twenty-front/src/modules/settings/serverless-functions/components/tabs/SettingsServerlessFunctionTestTab.tsx @@ -8,7 +8,6 @@ import { } from 'twenty-ui'; import { LightCopyIconButton } from '@/object-record/record-field/components/LightCopyIconButton'; -import { SettingsServerlessFunctionCodeEditorContainer } from '@/settings/serverless-functions/components/SettingsServerlessFunctionCodeEditorContainer'; import { SettingsServerlessFunctionsOutputMetadataInfo } from '@/settings/serverless-functions/components/SettingsServerlessFunctionsOutputMetadataInfo'; import { settingsServerlessFunctionCodeEditorOutputParamsState } from '@/settings/serverless-functions/states/settingsServerlessFunctionCodeEditorOutputParamsState'; import { settingsServerlessFunctionInputState } from '@/settings/serverless-functions/states/settingsServerlessFunctionInputState'; @@ -82,30 +81,26 @@ export const SettingsServerlessFunctionTestTab = ({ />, ]} /> - - - +
]} rightNodes={[]} /> - - - +
diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/graphql/queries/findManyAvailablePackages.ts b/packages/twenty-front/src/modules/settings/serverless-functions/graphql/queries/findManyAvailablePackages.ts index 3d2532673..a3819375a 100644 --- a/packages/twenty-front/src/modules/settings/serverless-functions/graphql/queries/findManyAvailablePackages.ts +++ b/packages/twenty-front/src/modules/settings/serverless-functions/graphql/queries/findManyAvailablePackages.ts @@ -1,7 +1,7 @@ import { gql } from '@apollo/client'; export const FIND_MANY_AVAILABLE_PACKAGES = gql` - query FindManyAvailablePackages { - getAvailablePackages + query FindManyAvailablePackages($input: ServerlessFunctionIdInput!) { + getAvailablePackages(input: $input) } `; diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/hooks/useGetAvailablePackages.ts b/packages/twenty-front/src/modules/settings/serverless-functions/hooks/useGetAvailablePackages.ts index a2a8f1f36..cd4659a30 100644 --- a/packages/twenty-front/src/modules/settings/serverless-functions/hooks/useGetAvailablePackages.ts +++ b/packages/twenty-front/src/modules/settings/serverless-functions/hooks/useGetAvailablePackages.ts @@ -4,15 +4,19 @@ import { FIND_MANY_AVAILABLE_PACKAGES } from '@/settings/serverless-functions/gr import { FindManyAvailablePackagesQuery, FindManyAvailablePackagesQueryVariables, + ServerlessFunctionIdInput, } from '~/generated-metadata/graphql'; -export const useGetAvailablePackages = () => { +export const useGetAvailablePackages = (input: ServerlessFunctionIdInput) => { const apolloMetadataClient = useApolloMetadataClient(); const { data } = useQuery< FindManyAvailablePackagesQuery, FindManyAvailablePackagesQueryVariables >(FIND_MANY_AVAILABLE_PACKAGES, { client: apolloMetadataClient ?? undefined, + variables: { + input, + }, }); return { availablePackages: data?.getAvailablePackages || null, diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFieldRecords.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFieldRecords.ts index fce290183..f08c49e54 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFieldRecords.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFieldRecords.ts @@ -10,7 +10,6 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordFromCache'; import { useCreateOneRecordMutation } from '@/object-record/hooks/useCreateOneRecordMutation'; import { useUpdateOneRecordMutation } from '@/object-record/hooks/useUpdateOneRecordMutation'; -import { ObjectRecord } from '@/object-record/types/ObjectRecord'; import { GraphQLView } from '@/views/types/GraphQLView'; import { ViewField } from '@/views/types/ViewField'; @@ -94,7 +93,7 @@ export const usePersistViewFieldRecords = () => { update: (cache, { data }) => { const record = data?.['updateViewField']; if (!record) return; - const cachedRecord = getRecordFromCache(record.id); + const cachedRecord = getRecordFromCache(record.id); if (!cachedRecord) return; diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterGroupRecords.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterGroupRecords.ts index dad022492..0987942da 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterGroupRecords.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterGroupRecords.ts @@ -11,7 +11,6 @@ import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordF import { useCreateOneRecordMutation } from '@/object-record/hooks/useCreateOneRecordMutation'; import { useDestroyOneRecordMutation } from '@/object-record/hooks/useDestroyOneRecordMutation'; import { useUpdateOneRecordMutation } from '@/object-record/hooks/useUpdateOneRecordMutation'; -import { ObjectRecord } from '@/object-record/types/ObjectRecord'; import { GraphQLView } from '@/views/types/GraphQLView'; import { ViewFilterGroup } from '@/views/types/ViewFilterGroup'; import { isDefined } from 'twenty-ui'; @@ -142,7 +141,9 @@ export const usePersistViewFilterGroupRecords = () => { update: (cache, { data }) => { const record = data?.updateViewFilterGroup; if (!record) return; - const cachedRecord = getRecordFromCache(record.id); + const cachedRecord = getRecordFromCache( + record.id, + ); if (!cachedRecord) return; diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterRecords.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterRecords.ts index b9067aefe..5e86f4940 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterRecords.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterRecords.ts @@ -11,7 +11,6 @@ import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordF import { useCreateOneRecordMutation } from '@/object-record/hooks/useCreateOneRecordMutation'; import { useDestroyOneRecordMutation } from '@/object-record/hooks/useDestroyOneRecordMutation'; import { useUpdateOneRecordMutation } from '@/object-record/hooks/useUpdateOneRecordMutation'; -import { ObjectRecord } from '@/object-record/types/ObjectRecord'; import { GraphQLView } from '@/views/types/GraphQLView'; import { ViewFilter } from '@/views/types/ViewFilter'; @@ -100,7 +99,7 @@ export const usePersistViewFilterRecords = () => { update: (cache, { data }) => { const record = data?.['updateViewFilter']; if (!record) return; - const cachedRecord = getRecordFromCache(record.id); + const cachedRecord = getRecordFromCache(record.id); if (!cachedRecord) return; diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewSortRecords.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewSortRecords.ts index 1dae1bf39..26a8987f2 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewSortRecords.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewSortRecords.ts @@ -11,7 +11,6 @@ import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordF import { useCreateOneRecordMutation } from '@/object-record/hooks/useCreateOneRecordMutation'; import { useDestroyOneRecordMutation } from '@/object-record/hooks/useDestroyOneRecordMutation'; import { useUpdateOneRecordMutation } from '@/object-record/hooks/useUpdateOneRecordMutation'; -import { ObjectRecord } from '@/object-record/types/ObjectRecord'; import { GraphQLView } from '@/views/types/GraphQLView'; import { ViewSort } from '@/views/types/ViewSort'; @@ -93,7 +92,7 @@ export const usePersistViewSortRecords = () => { update: (cache, { data }) => { const record = data?.['updateViewSort']; if (!record) return; - const cachedRecord = getRecordFromCache(record.id); + const cachedRecord = getRecordFromCache(record.id); if (!cachedRecord) return; diff --git a/packages/twenty-front/src/modules/workflow/components/RightDrawerWorkflowEditStepContent.tsx b/packages/twenty-front/src/modules/workflow/components/RightDrawerWorkflowEditStepContent.tsx index 8154fbd74..4a21b88fe 100644 --- a/packages/twenty-front/src/modules/workflow/components/RightDrawerWorkflowEditStepContent.tsx +++ b/packages/twenty-front/src/modules/workflow/components/RightDrawerWorkflowEditStepContent.tsx @@ -1,5 +1,5 @@ import { WorkflowStepDetail } from '@/workflow/components/WorkflowStepDetail'; -import { useUpdateWorkflowVersionStep } from '@/workflow/hooks/useUpdateWorkflowVersionStep'; +import { useUpdateStep } from '@/workflow/hooks/useUpdateStep'; import { useUpdateWorkflowVersionTrigger } from '@/workflow/hooks/useUpdateWorkflowVersionTrigger'; import { workflowSelectedNodeState } from '@/workflow/states/workflowSelectedNodeState'; import { WorkflowWithCurrentVersion } from '@/workflow/types/Workflow'; @@ -19,9 +19,8 @@ export const RightDrawerWorkflowEditStepContent = ({ } const { updateTrigger } = useUpdateWorkflowVersionTrigger({ workflow }); - const { updateStep } = useUpdateWorkflowVersionStep({ + const { updateStep } = useUpdateStep({ workflow, - stepId: workflowSelectedNode, }); return ( diff --git a/packages/twenty-front/src/modules/workflow/components/WorkflowDiagramStepNodeEditable.tsx b/packages/twenty-front/src/modules/workflow/components/WorkflowDiagramStepNodeEditable.tsx index 9df7f0bbc..e479e9d3b 100644 --- a/packages/twenty-front/src/modules/workflow/components/WorkflowDiagramStepNodeEditable.tsx +++ b/packages/twenty-front/src/modules/workflow/components/WorkflowDiagramStepNodeEditable.tsx @@ -1,5 +1,5 @@ import { WorkflowDiagramStepNodeBase } from '@/workflow/components/WorkflowDiagramStepNodeBase'; -import { useDeleteOneStep } from '@/workflow/hooks/useDeleteOneStep'; +import { useDeleteStep } from '@/workflow/hooks/useDeleteStep'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { workflowIdState } from '@/workflow/states/workflowIdState'; import { WorkflowDiagramStepNodeData } from '@/workflow/types/WorkflowDiagram'; @@ -21,9 +21,8 @@ export const WorkflowDiagramStepNodeEditable = ({ const workflowWithCurrentVersion = useWorkflowWithCurrentVersion(workflowId); assertWorkflowWithCurrentVersionIsDefined(workflowWithCurrentVersion); - const { deleteOneStep } = useDeleteOneStep({ + const { deleteStep } = useDeleteStep({ workflow: workflowWithCurrentVersion, - stepId: id, }); return ( @@ -35,7 +34,7 @@ export const WorkflowDiagramStepNodeEditable = ({ size="medium" Icon={IconTrash} onClick={() => { - return deleteOneStep(); + deleteStep(id); }} /> ) : undefined diff --git a/packages/twenty-front/src/modules/workflow/components/WorkflowEditActionFormServerlessFunctionInner.tsx b/packages/twenty-front/src/modules/workflow/components/WorkflowEditActionFormServerlessFunctionInner.tsx deleted file mode 100644 index 5e45a9555..000000000 --- a/packages/twenty-front/src/modules/workflow/components/WorkflowEditActionFormServerlessFunctionInner.tsx +++ /dev/null @@ -1,256 +0,0 @@ -import { FormTextFieldInput } from '@/object-record/record-field/form-types/components/FormTextFieldInput'; -import { useGetManyServerlessFunctions } from '@/settings/serverless-functions/hooks/useGetManyServerlessFunctions'; -import { Select, SelectOption } from '@/ui/input/components/Select'; -import { WorkflowEditGenericFormBase } from '@/workflow/components/WorkflowEditGenericFormBase'; -import { WorkflowVariablePicker } from '@/workflow/components/WorkflowVariablePicker'; -import { FunctionInput } from '@/workflow/types/FunctionInput'; -import { WorkflowCodeAction } from '@/workflow/types/Workflow'; -import { getDefaultFunctionInputFromInputSchema } from '@/workflow/utils/getDefaultFunctionInputFromInputSchema'; -import { mergeDefaultFunctionInputAndFunctionInput } from '@/workflow/utils/mergeDefaultFunctionInputAndFunctionInput'; -import { setNestedValue } from '@/workflow/utils/setNestedValue'; -import { useTheme } from '@emotion/react'; -import styled from '@emotion/styled'; -import { Fragment, ReactNode, useState } from 'react'; -import { HorizontalSeparator, IconCode, isDefined } from 'twenty-ui'; -import { useDebouncedCallback } from 'use-debounce'; - -const StyledContainer = styled.div` - display: inline-flex; - flex-direction: column; -`; - -const StyledLabel = styled.div` - color: ${({ theme }) => theme.font.color.light}; - font-size: ${({ theme }) => theme.font.size.md}; - font-weight: ${({ theme }) => theme.font.weight.semiBold}; - margin-top: ${({ theme }) => theme.spacing(2)}; - margin-bottom: ${({ theme }) => theme.spacing(2)}; -`; - -const StyledInputContainer = styled.div` - background: ${({ theme }) => theme.background.secondary}; - border: 1px solid ${({ theme }) => theme.border.color.medium}; - border-radius: ${({ theme }) => theme.border.radius.md}; - display: flex; - flex-direction: column; - gap: ${({ theme }) => theme.spacing(2)}; - padding: ${({ theme }) => theme.spacing(2)}; - position: relative; -`; - -type WorkflowEditActionFormServerlessFunctionInnerProps = { - action: WorkflowCodeAction; - actionOptions: - | { - readonly: true; - } - | { - readonly?: false; - onActionUpdate: (action: WorkflowCodeAction) => void; - }; -}; - -type ServerlessFunctionInputFormData = { - [field: string]: string | ServerlessFunctionInputFormData; -}; - -export const WorkflowEditActionFormServerlessFunctionInner = ({ - action, - actionOptions, -}: WorkflowEditActionFormServerlessFunctionInnerProps) => { - const theme = useTheme(); - - const { serverlessFunctions } = useGetManyServerlessFunctions(); - - const getFunctionInput = (serverlessFunctionId: string) => { - if (!serverlessFunctionId) { - return {}; - } - - const serverlessFunction = serverlessFunctions.find( - (f) => f.id === serverlessFunctionId, - ); - const inputSchema = serverlessFunction?.latestVersionInputSchema; - const defaultFunctionInput = - getDefaultFunctionInputFromInputSchema(inputSchema); - - return defaultFunctionInput; - }; - - const [selectedFunctionId, setSelectedFunctionId] = useState( - action.settings.input.serverlessFunctionId, - ); - - const [functionInput, setFunctionInput] = - useState( - mergeDefaultFunctionInputAndFunctionInput({ - defaultFunctionInput: getFunctionInput(selectedFunctionId), - functionInput: action.settings.input.serverlessFunctionInput, - }), - ); - - const updateFunctionInput = useDebouncedCallback( - async (newFunctionInput: object) => { - if (actionOptions.readonly === true) { - return; - } - - actionOptions.onActionUpdate({ - ...action, - settings: { - ...action.settings, - input: { - ...action.settings.input, - serverlessFunctionInput: newFunctionInput, - }, - }, - }); - }, - 1_000, - ); - - const handleInputChange = (value: any, path: string[]) => { - const updatedFunctionInput = setNestedValue(functionInput, path, value); - - setFunctionInput(updatedFunctionInput); - - updateFunctionInput(updatedFunctionInput); - }; - - const availableFunctions: Array> = [ - ...serverlessFunctions - .filter((serverlessFunction) => - isDefined(serverlessFunction.latestVersion), - ) - .map((serverlessFunction) => ({ - label: serverlessFunction.name, - value: serverlessFunction.id, - latestVersionInputSchema: serverlessFunction.latestVersionInputSchema, - })), - ]; - - const handleFunctionChange = (newServerlessFunctionId: string) => { - if (actionOptions.readonly === true) { - return; - } - - updateFunctionInput.cancel(); - - setSelectedFunctionId(newServerlessFunctionId); - - const serverlessFunction = serverlessFunctions.find( - (f) => f.id === newServerlessFunctionId, - ); - - const newFunctionInput = getFunctionInput(newServerlessFunctionId); - - const newProps = { - ...action, - settings: { - ...action.settings, - input: { - serverlessFunctionId: newServerlessFunctionId, - serverlessFunctionVersion: - serverlessFunction?.latestVersion || 'latest', - serverlessFunctionInput: newFunctionInput, - }, - }, - }; - - setFunctionInput(newFunctionInput); - - actionOptions.onActionUpdate(newProps); - }; - - const renderFields = ( - functionInput: FunctionInput, - path: string[] = [], - isRoot = true, - ): ReactNode[] => { - const displaySeparator = (functionInput: FunctionInput) => { - const keys = Object.keys(functionInput); - if (keys.length > 1) { - return true; - } - if (keys.length === 1) { - const subKeys = Object.keys(functionInput[keys[0]]); - return subKeys.length > 0; - } - return false; - }; - - return Object.entries(functionInput).map(([inputKey, inputValue]) => { - const currentPath = [...path, inputKey]; - const pathKey = currentPath.join('.'); - - if (inputValue !== null && typeof inputValue === 'object') { - if (isRoot) { - return ( - - {displaySeparator(functionInput) && ( - - )} - {renderFields(inputValue, currentPath, false)} - - ); - } - return ( - - {inputKey} - - {renderFields(inputValue, currentPath, false)} - - - ); - } else { - return ( - { - handleInputChange(value, currentPath); - }} - VariablePicker={WorkflowVariablePicker} - /> - ); - } - }); - }; - - const headerTitle = isDefined(action.name) - ? action.name - : 'Code - Serverless Function'; - - return ( - { - if (actionOptions.readonly === true) { - return; - } - - actionOptions?.onActionUpdate({ - ...action, - name: newName, - }); - }} - HeaderIcon={} - headerTitle={headerTitle} - headerType="Code" - > - } - headerTitle={headerTitle} + Icon={IconHandMove} + iconColor={theme.font.color.tertiary} + initialTitle={headerTitle} headerType="Trigger · Manual" > - } - headerTitle={headerTitle} + Icon={IconAddressBook} + iconColor={theme.font.color.tertiary} + initialTitle={headerTitle} headerType="Action" >