diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts index 227847d1992..cb63ebf82c6 100644 --- a/packages/twenty-front/src/generated-metadata/graphql.ts +++ b/packages/twenty-front/src/generated-metadata/graphql.ts @@ -1385,8 +1385,6 @@ export type ExecuteLogicFunctionInput = { id: Scalars['UUID']; /** Payload in JSON format */ payload: Scalars['JSON']; - /** Version of the logic function to execute */ - version?: Scalars['String']; }; export type FeatureFlag = { @@ -1636,8 +1634,6 @@ export type GetAuthorizationUrlForSsoOutput = { export type GetLogicFunctionSourceCodeInput = { /** The id of the function. */ id: Scalars['ID']; - /** The version of the function */ - version?: Scalars['String']; }; /** Order by options for graph widgets */ @@ -1919,9 +1915,7 @@ export type LogicFunction = { httpRouteTriggerSettings?: Maybe; id: Scalars['UUID']; isTool: Scalars['Boolean']; - latestVersion?: Maybe; name: Scalars['String']; - publishedVersions: Array; runtime: Scalars['String']; sourceHandlerPath: Scalars['String']; timeoutSeconds: Scalars['Float']; @@ -5558,7 +5552,7 @@ export type UpdateOneApplicationVariableMutationVariables = Exact<{ export type UpdateOneApplicationVariableMutation = { __typename?: 'Mutation', updateOneApplicationVariable: boolean }; -export type ApplicationFieldsFragment = { __typename?: 'Application', id: string, name: string, description: string, version: string, universalIdentifier: string, canBeUninstalled: boolean, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, isSecret: boolean }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, modelConfiguration?: any | null, evaluationInputs: Array, applicationId?: string | null, createdAt: string, updatedAt: string }>, objects: Array<{ __typename?: 'Object', id: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, isCustom: boolean, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIReadOnly: boolean, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, duplicateCriteria?: Array> | null, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isCustom?: boolean | null, isActive?: boolean | null, isSystem?: boolean | null, isUIReadOnly?: boolean | null, isNullable?: boolean | null, isUnique?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, latestVersion?: string | null, publishedVersions: Array, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string }> }; +export type ApplicationFieldsFragment = { __typename?: 'Application', id: string, name: string, description: string, version: string, universalIdentifier: string, canBeUninstalled: boolean, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, isSecret: boolean }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, modelConfiguration?: any | null, evaluationInputs: Array, applicationId?: string | null, createdAt: string, updatedAt: string }>, objects: Array<{ __typename?: 'Object', id: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, isCustom: boolean, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIReadOnly: boolean, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, duplicateCriteria?: Array> | null, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isCustom?: boolean | null, isActive?: boolean | null, isSystem?: boolean | null, isUIReadOnly?: boolean | null, isNullable?: boolean | null, isUnique?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string }> }; export type FindManyApplicationsQueryVariables = Exact<{ [key: string]: never; }>; @@ -5570,7 +5564,7 @@ export type FindOneApplicationQueryVariables = Exact<{ }>; -export type FindOneApplicationQuery = { __typename?: 'Query', findOneApplication: { __typename?: 'Application', id: string, name: string, description: string, version: string, universalIdentifier: string, canBeUninstalled: boolean, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, isSecret: boolean }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, modelConfiguration?: any | null, evaluationInputs: Array, applicationId?: string | null, createdAt: string, updatedAt: string }>, objects: Array<{ __typename?: 'Object', id: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, isCustom: boolean, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIReadOnly: boolean, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, duplicateCriteria?: Array> | null, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isCustom?: boolean | null, isActive?: boolean | null, isSystem?: boolean | null, isUIReadOnly?: boolean | null, isNullable?: boolean | null, isUnique?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, latestVersion?: string | null, publishedVersions: Array, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string }> } }; +export type FindOneApplicationQuery = { __typename?: 'Query', findOneApplication: { __typename?: 'Application', id: string, name: string, description: string, version: string, universalIdentifier: string, canBeUninstalled: boolean, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, isSecret: boolean }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, modelConfiguration?: any | null, evaluationInputs: Array, applicationId?: string | null, createdAt: string, updatedAt: string }>, objects: Array<{ __typename?: 'Object', id: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, isCustom: boolean, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIReadOnly: boolean, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, duplicateCriteria?: Array> | null, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isCustom?: boolean | null, isActive?: boolean | null, isSystem?: boolean | null, isUIReadOnly?: boolean | null, isNullable?: boolean | null, isUnique?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string }> } }; export type UploadFileMutationVariables = Exact<{ file: Scalars['Upload']; @@ -6270,21 +6264,21 @@ export type UpdateLabPublicFeatureFlagMutationVariables = Exact<{ export type UpdateLabPublicFeatureFlagMutation = { __typename?: 'Mutation', updateLabPublicFeatureFlag: { __typename?: 'FeatureFlagDTO', key: FeatureFlagKey, value: boolean } }; -export type LogicFunctionFieldsFragment = { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, latestVersion?: string | null, publishedVersions: Array, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string }; +export type LogicFunctionFieldsFragment = { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string }; export type CreateOneLogicFunctionItemMutationVariables = Exact<{ input: CreateLogicFunctionInput; }>; -export type CreateOneLogicFunctionItemMutation = { __typename?: 'Mutation', createOneLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, latestVersion?: string | null, publishedVersions: Array, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; +export type CreateOneLogicFunctionItemMutation = { __typename?: 'Mutation', createOneLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; export type DeleteOneLogicFunctionMutationVariables = Exact<{ input: LogicFunctionIdInput; }>; -export type DeleteOneLogicFunctionMutation = { __typename?: 'Mutation', deleteOneLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, latestVersion?: string | null, publishedVersions: Array, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; +export type DeleteOneLogicFunctionMutation = { __typename?: 'Mutation', deleteOneLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; export type ExecuteOneLogicFunctionMutationVariables = Exact<{ input: ExecuteLogicFunctionInput; @@ -6298,14 +6292,14 @@ export type PublishOneLogicFunctionMutationVariables = Exact<{ }>; -export type PublishOneLogicFunctionMutation = { __typename?: 'Mutation', publishLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, latestVersion?: string | null, publishedVersions: Array, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; +export type PublishOneLogicFunctionMutation = { __typename?: 'Mutation', publishLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; export type UpdateOneLogicFunctionMutationVariables = Exact<{ input: UpdateLogicFunctionInput; }>; -export type UpdateOneLogicFunctionMutation = { __typename?: 'Mutation', updateOneLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, latestVersion?: string | null, publishedVersions: Array, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; +export type UpdateOneLogicFunctionMutation = { __typename?: 'Mutation', updateOneLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; export type FindManyAvailablePackagesQueryVariables = Exact<{ input: LogicFunctionIdInput; @@ -6317,14 +6311,14 @@ export type FindManyAvailablePackagesQuery = { __typename?: 'Query', getAvailabl export type GetManyLogicFunctionsQueryVariables = Exact<{ [key: string]: never; }>; -export type GetManyLogicFunctionsQuery = { __typename?: 'Query', findManyLogicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, latestVersion?: string | null, publishedVersions: Array, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string }> }; +export type GetManyLogicFunctionsQuery = { __typename?: 'Query', findManyLogicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string }> }; export type GetOneLogicFunctionQueryVariables = Exact<{ input: LogicFunctionIdInput; }>; -export type GetOneLogicFunctionQuery = { __typename?: 'Query', findOneLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, latestVersion?: string | null, publishedVersions: Array, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; +export type GetOneLogicFunctionQuery = { __typename?: 'Query', findOneLogicFunction: { __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, sourceHandlerPath: string, builtHandlerPath: string, handlerName: string, toolInputSchema?: any | null, isTool: boolean, applicationId?: string | null, createdAt: string, updatedAt: string } }; export type FindOneLogicFunctionSourceCodeQueryVariables = Exact<{ input: GetLogicFunctionSourceCodeInput; @@ -7138,8 +7132,6 @@ export const LogicFunctionFieldsFragmentDoc = gql` description runtime timeoutSeconds - latestVersion - publishedVersions sourceHandlerPath builtHandlerPath handlerName diff --git a/packages/twenty-front/src/generated/graphql.ts b/packages/twenty-front/src/generated/graphql.ts index 437ad782642..9dc93cd3aee 100644 --- a/packages/twenty-front/src/generated/graphql.ts +++ b/packages/twenty-front/src/generated/graphql.ts @@ -1352,8 +1352,6 @@ export type ExecuteLogicFunctionInput = { id: Scalars['UUID']; /** Payload in JSON format */ payload: Scalars['JSON']; - /** Version of the logic function to execute */ - version?: Scalars['String']; }; export type FeatureFlag = { @@ -1603,8 +1601,6 @@ export type GetAuthorizationUrlForSsoOutput = { export type GetLogicFunctionSourceCodeInput = { /** The id of the function. */ id: Scalars['ID']; - /** The version of the function */ - version?: Scalars['String']; }; /** Order by options for graph widgets */ @@ -1886,9 +1882,7 @@ export type LogicFunction = { httpRouteTriggerSettings?: Maybe; id: Scalars['UUID']; isTool: Scalars['Boolean']; - latestVersion?: Maybe; name: Scalars['String']; - publishedVersions: Array; runtime: Scalars['String']; sourceHandlerPath: Scalars['String']; timeoutSeconds: Scalars['Float']; diff --git a/packages/twenty-front/src/modules/logic-functions/hooks/useTestLogicFunction.ts b/packages/twenty-front/src/modules/logic-functions/hooks/useTestLogicFunction.ts index a4bc0f75ffc..bd74e7ba0da 100644 --- a/packages/twenty-front/src/modules/logic-functions/hooks/useTestLogicFunction.ts +++ b/packages/twenty-front/src/modules/logic-functions/hooks/useTestLogicFunction.ts @@ -25,7 +25,6 @@ export const useTestLogicFunction = ({ const result = await executeOneLogicFunction({ id: logicFunctionId, payload: logicFunctionTestData.input, - version: 'draft', }); setIsTesting(false); diff --git a/packages/twenty-front/src/modules/settings/logic-functions/graphql/fragments/logicFunctionFragment.ts b/packages/twenty-front/src/modules/settings/logic-functions/graphql/fragments/logicFunctionFragment.ts index a0a680b2ba3..7cd81e97f8c 100644 --- a/packages/twenty-front/src/modules/settings/logic-functions/graphql/fragments/logicFunctionFragment.ts +++ b/packages/twenty-front/src/modules/settings/logic-functions/graphql/fragments/logicFunctionFragment.ts @@ -7,8 +7,6 @@ export const LOGIC_FUNCTION_FRAGMENT = gql` description runtime timeoutSeconds - latestVersion - publishedVersions sourceHandlerPath builtHandlerPath handlerName diff --git a/packages/twenty-front/src/modules/settings/logic-functions/hooks/useGetOneLogicFunctionSourceCode.ts b/packages/twenty-front/src/modules/settings/logic-functions/hooks/useGetOneLogicFunctionSourceCode.ts index 4f7681fe9fc..6a3729c0137 100644 --- a/packages/twenty-front/src/modules/settings/logic-functions/hooks/useGetOneLogicFunctionSourceCode.ts +++ b/packages/twenty-front/src/modules/settings/logic-functions/hooks/useGetOneLogicFunctionSourceCode.ts @@ -8,11 +8,9 @@ import { export const useGetOneLogicFunctionSourceCode = ({ id, - version, onCompleted, }: { id: string; - version: string; onCompleted?: (data: FindOneLogicFunctionSourceCodeQuery) => void; }) => { const apolloMetadataClient = useApolloCoreClient(); @@ -22,7 +20,7 @@ export const useGetOneLogicFunctionSourceCode = ({ >(FIND_ONE_LOGIC_FUNCTION_SOURCE_CODE, { client: apolloMetadataClient ?? undefined, variables: { - input: { id, version }, + input: { id }, }, onCompleted, fetchPolicy: 'network-only', diff --git a/packages/twenty-front/src/modules/settings/logic-functions/hooks/useLogicFunctionUpdateFormState.ts b/packages/twenty-front/src/modules/settings/logic-functions/hooks/useLogicFunctionUpdateFormState.ts index b197705eaf8..e2e532cd215 100644 --- a/packages/twenty-front/src/modules/settings/logic-functions/hooks/useLogicFunctionUpdateFormState.ts +++ b/packages/twenty-front/src/modules/settings/logic-functions/hooks/useLogicFunctionUpdateFormState.ts @@ -28,10 +28,8 @@ type SetLogicFunctionFormValues = Dispatch< export const useLogicFunctionUpdateFormState = ({ logicFunctionId, - logicFunctionVersion = 'draft', }: { logicFunctionId: string; - logicFunctionVersion?: string; }): { formValues: LogicFunctionFormValues; logicFunction: LogicFunction | null; @@ -67,7 +65,6 @@ export const useLogicFunctionUpdateFormState = ({ const { loading: logicFunctionSourceCodeLoading } = useGetOneLogicFunctionSourceCode({ id: logicFunctionId, - version: logicFunctionVersion, onCompleted: async (data: FindOneLogicFunctionSourceCodeQuery) => { const code = data?.getLogicFunctionSourceCode; diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/generateWorkflowDiagram.test.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/generateWorkflowDiagram.test.ts index 13fbc3c2ccb..fffc2eb3cf2 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/generateWorkflowDiagram.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/generateWorkflowDiagram.test.ts @@ -55,7 +55,6 @@ describe('generateWorkflowDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -74,7 +73,6 @@ describe('generateWorkflowDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -134,7 +132,6 @@ describe('generateWorkflowDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -153,7 +150,6 @@ describe('generateWorkflowDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -201,7 +197,6 @@ describe('generateWorkflowDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -220,7 +215,6 @@ describe('generateWorkflowDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -268,7 +262,6 @@ describe('generateWorkflowDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -287,7 +280,6 @@ describe('generateWorkflowDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -306,7 +298,6 @@ describe('generateWorkflowDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/generateWorkflowRunDiagram.test.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/generateWorkflowRunDiagram.test.ts index 28eb284e5fa..a69e6ee4e87 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/generateWorkflowRunDiagram.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/generateWorkflowRunDiagram.test.ts @@ -36,7 +36,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -55,7 +54,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -74,7 +72,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -273,7 +270,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -292,7 +288,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -311,7 +306,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -512,7 +506,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -531,7 +524,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -550,7 +542,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -751,7 +742,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -770,7 +760,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -789,7 +778,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, @@ -808,7 +796,6 @@ describe('generateWorkflowRunDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/getWorkflowVersionDiagram.test.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/getWorkflowVersionDiagram.test.ts index 48109a2d82b..f653e645819 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/getWorkflowVersionDiagram.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/__tests__/getWorkflowVersionDiagram.test.ts @@ -127,7 +127,6 @@ describe('getWorkflowVersionDiagram', () => { }, input: { logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useUpdateStep.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useUpdateStep.test.ts index 3267855f52e..3ba4a2a8a83 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useUpdateStep.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useUpdateStep.test.ts @@ -42,7 +42,6 @@ describe('useUpdateStep', () => { settings: { input: { logicFunctionId: 'id', - logicFunctionVersion: '1', logicFunctionInput: {}, }, outputSchema: {}, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getIsDescendantOfIterator.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getIsDescendantOfIterator.test.ts index 4904729466a..721e9f1e02b 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getIsDescendantOfIterator.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getIsDescendantOfIterator.test.ts @@ -29,7 +29,6 @@ describe('getIsDescendantOfIterator', () => { settings: { input: { logicFunctionId: 'func2', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, @@ -49,7 +48,6 @@ describe('getIsDescendantOfIterator', () => { settings: { input: { logicFunctionId: 'func3', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, @@ -90,7 +88,6 @@ describe('getIsDescendantOfIterator', () => { settings: { input: { logicFunctionId: 'func4', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getStepInfoHistoryItem.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getStepInfoHistoryItem.test.ts index 0f24c1459f6..12d437eed17 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getStepInfoHistoryItem.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getStepInfoHistoryItem.test.ts @@ -28,7 +28,6 @@ describe('getStepInfoHistoryItem', () => { settings: { input: { logicFunctionId: 'func', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowPreviousSteps.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowPreviousSteps.test.ts index df121c8449f..88a70c37003 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowPreviousSteps.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowPreviousSteps.test.ts @@ -13,7 +13,6 @@ describe('getWorkflowPreviousSteps', () => { settings: { input: { logicFunctionId: 'func1', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, @@ -32,7 +31,6 @@ describe('getWorkflowPreviousSteps', () => { settings: { input: { logicFunctionId: 'func2', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, @@ -51,7 +49,6 @@ describe('getWorkflowPreviousSteps', () => { settings: { input: { logicFunctionId: 'func3', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, @@ -70,7 +67,6 @@ describe('getWorkflowPreviousSteps', () => { settings: { input: { logicFunctionId: 'func4', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowRunStepContext.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowRunStepContext.test.ts index 0cb63167489..ca91acf9bc8 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowRunStepContext.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowRunStepContext.test.ts @@ -19,7 +19,6 @@ const mockFlow = { input: { logicFunctionId: '', logicFunctionInput: {}, - logicFunctionVersion: '', }, outputSchema: {}, errorHandlingOptions: { @@ -38,7 +37,6 @@ const mockFlow = { input: { logicFunctionId: '', logicFunctionInput: {}, - logicFunctionVersion: '', }, outputSchema: {}, errorHandlingOptions: { @@ -141,7 +139,6 @@ describe('getWorkflowRunStepContext', () => { input: { logicFunctionId: '', logicFunctionInput: {}, - logicFunctionVersion: '', }, outputSchema: {}, errorHandlingOptions: { @@ -178,7 +175,6 @@ describe('getWorkflowRunStepContext', () => { input: { logicFunctionId: '', logicFunctionInput: {}, - logicFunctionVersion: '', }, outputSchema: {}, errorHandlingOptions: { diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowRunStepExecutionStatus.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowRunStepExecutionStatus.test.ts index fbf7b745ab3..203b22de61a 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowRunStepExecutionStatus.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowRunStepExecutionStatus.test.ts @@ -31,7 +31,6 @@ describe('getWorkflowRunStepExecutionStatus', () => { a: null, b: null, }, - logicFunctionVersion: 'draft', }, outputSchema: { link: { @@ -96,7 +95,6 @@ describe('getWorkflowRunStepExecutionStatus', () => { a: null, b: null, }, - logicFunctionVersion: 'draft', }, outputSchema: { link: { @@ -162,7 +160,6 @@ describe('getWorkflowRunStepExecutionStatus', () => { a: null, b: null, }, - logicFunctionVersion: 'draft', }, outputSchema: { link: { @@ -195,7 +192,6 @@ describe('getWorkflowRunStepExecutionStatus', () => { a: null, b: null, }, - logicFunctionVersion: 'draft', }, outputSchema: { link: { diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowVariablesUsedInStep.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowVariablesUsedInStep.test.ts index 1b45a5d6c33..fcb9cd70ebb 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowVariablesUsedInStep.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/__tests__/getWorkflowVariablesUsedInStep.test.ts @@ -14,7 +14,6 @@ describe('getWorkflowVariablesUsedInStep', () => { logicFunctionInput: { a: '{{5f7b9b44-bb07-41ba-aef8-ec0eaa5eea2c.a.b.c.d}}', }, - logicFunctionVersion: 'draft', }, outputSchema: {}, errorHandlingOptions: { @@ -106,7 +105,6 @@ Set { logicFunctionInput: { a: '{{5f7b9b44-bb07-41ba-aef8-ec0eaa5eea2c.a}} {{5f7b9b44-bb07-41ba-aef8-ec0eaa5eea2c.b}} {{5f7b9b44-bb07-41ba-aef8-ec0eaa5eea2c.c}} {{5f7b9b44-bb07-41ba-aef8-ec0eaa5eea2c.d}}', }, - logicFunctionVersion: 'draft', }, outputSchema: {}, errorHandlingOptions: { @@ -146,7 +144,6 @@ Set { logicFunctionInput: { a: '{{5f7b9b44-bb07-41ba-aef8-ec0eaa5eea2c.a}} {{5f7b9b44-bb07-41ba-aef8-ec0eaa5eea2c.a}} {{5f7b9b44-bb07-41ba-aef8-ec0eaa5eea2c.a}} {{5f7b9b44-bb07-41ba-aef8-ec0eaa5eea2c.a}}', }, - logicFunctionVersion: 'draft', }, outputSchema: {}, errorHandlingOptions: { diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx index 488491af35e..1c1bc6822d3 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx @@ -131,7 +131,6 @@ export const WorkflowEditActionCode = ({ const { formValues, setFormValues, loading } = useLogicFunctionUpdateFormState({ logicFunctionId, - logicFunctionVersion: 'draft', }); const updateOutputSchemaFromTestResult = async (testResult: object) => { diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowReadonlyActionCode.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowReadonlyActionCode.tsx index 7ad1dc2fbe3..ec7f369b0ab 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowReadonlyActionCode.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowReadonlyActionCode.tsx @@ -26,7 +26,6 @@ export const WorkflowReadonlyActionCode = ({ action, }: WorkflowReadonlyActionCodeProps) => { const logicFunctionId = action.settings.input.logicFunctionId; - const logicFunctionVersion = action.settings.input.logicFunctionVersion; const { availablePackages } = useGetAvailablePackages({ id: logicFunctionId, @@ -34,7 +33,6 @@ export const WorkflowReadonlyActionCode = ({ const { formValues, loading } = useLogicFunctionUpdateFormState({ logicFunctionId, - logicFunctionVersion, }); const handleEditorDidMount = async ( diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/__stories__/WorkflowEditActionCode.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/__stories__/WorkflowEditActionCode.stories.tsx index 21c108d4a81..8bde6b3aa0f 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/__stories__/WorkflowEditActionCode.stories.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/__stories__/WorkflowEditActionCode.stories.tsx @@ -20,7 +20,6 @@ const DEFAULT_ACTION: WorkflowCodeAction = { settings: { input: { logicFunctionId: '', - logicFunctionVersion: 'draft', logicFunctionInput: {}, }, outputSchema: {}, @@ -43,7 +42,6 @@ const CONFIGURED_ACTION: WorkflowCodeAction = { settings: { input: { logicFunctionId: 'test-function-id', - logicFunctionVersion: 'draft', logicFunctionInput: { name: 'John Doe', email: 'john@example.com', @@ -208,7 +206,6 @@ export const EmptyFunction: Story = { ...DEFAULT_ACTION.settings, input: { logicFunctionId: '', - logicFunctionVersion: 'draft', logicFunctionInput: {}, }, }, diff --git a/packages/twenty-front/src/testing/mock-data/workflow-run.ts b/packages/twenty-front/src/testing/mock-data/workflow-run.ts index 5a0199e28e8..68fda9f5eac 100644 --- a/packages/twenty-front/src/testing/mock-data/workflow-run.ts +++ b/packages/twenty-front/src/testing/mock-data/workflow-run.ts @@ -25,7 +25,6 @@ export const oneSucceededWorkflowRunQueryResult = { logicFunctionInput: { userId: '{{trigger.userId}}', }, - logicFunctionVersion: '1', }, outputSchema: { link: { @@ -55,7 +54,6 @@ export const oneSucceededWorkflowRunQueryResult = { input: { logicFunctionId: '605efcda-6689-43b3-b24c-2eb76948f523', logicFunctionInput: {}, - logicFunctionVersion: '2', }, outputSchema: { link: { @@ -4494,7 +4492,6 @@ export const oneSucceededWorkflowRunQueryResult = { logicFunctionInput: { userId: '{{trigger.userId}}', }, - logicFunctionVersion: '1', }, outputSchema: { link: { @@ -4524,7 +4521,6 @@ export const oneSucceededWorkflowRunQueryResult = { input: { logicFunctionId: '605efcda-6689-43b3-b24c-2eb76948f523', logicFunctionInput: {}, - logicFunctionVersion: '2', }, outputSchema: { link: { diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1769681396664-removeLogicFunctionVersion.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1769681396664-removeLogicFunctionVersion.ts new file mode 100644 index 00000000000..26443d3f9dc --- /dev/null +++ b/packages/twenty-server/src/database/typeorm/core/migrations/common/1769681396664-removeLogicFunctionVersion.ts @@ -0,0 +1,25 @@ +import { type MigrationInterface, type QueryRunner } from 'typeorm'; + +export class RemoveLogicFunctionVersion1769681396664 + implements MigrationInterface +{ + name = 'RemoveLogicFunctionVersion1769681396664'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "core"."logicFunction" DROP COLUMN "latestVersion"`, + ); + await queryRunner.query( + `ALTER TABLE "core"."logicFunction" DROP COLUMN "publishedVersions"`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "core"."logicFunction" ADD "publishedVersions" jsonb NOT NULL DEFAULT '[]'`, + ); + await queryRunner.query( + `ALTER TABLE "core"."logicFunction" ADD "latestVersion" character varying`, + ); + } +} diff --git a/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/interfaces/logic-function-executor-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/interfaces/logic-function-executor-driver.interface.ts index a1a26ebc12f..ecce70fca88 100644 --- a/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/interfaces/logic-function-executor-driver.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/interfaces/logic-function-executor-driver.interface.ts @@ -22,13 +22,11 @@ export interface LogicFunctionExecutorDriver { flatLogicFunction, flatLogicFunctionLayer, payload, - version, env, }: { flatLogicFunction: FlatLogicFunction; flatLogicFunctionLayer: FlatLogicFunctionLayer; payload: object; - version: string; env?: Record; }): Promise; } diff --git a/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/lambda.driver.ts b/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/lambda.driver.ts index 705a800deb8..c5e809881df 100644 --- a/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/lambda.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/lambda.driver.ts @@ -314,13 +314,11 @@ export class LambdaDriver implements LogicFunctionExecutorDriver { flatLogicFunction, flatLogicFunctionLayer, payload, - version, env, }: { flatLogicFunction: FlatLogicFunction; flatLogicFunctionLayer: FlatLogicFunctionLayer; payload: object; - version: string; env?: Record; }): Promise { await this.build(flatLogicFunction, flatLogicFunctionLayer); @@ -331,7 +329,6 @@ export class LambdaDriver implements LogicFunctionExecutorDriver { const builtHandlerFolderPath = getLogicFunctionFolderOrThrow({ flatLogicFunction, - version, fileFolder: FileFolder.BuiltFunction, }); @@ -389,7 +386,7 @@ export class LambdaDriver implements LogicFunctionExecutorDriver { } catch (error) { if (error instanceof ResourceNotFoundException) { throw new LogicFunctionException( - `Function Version '${version}' does not exist`, + `Function '${flatLogicFunction.id}' does not exist`, LogicFunctionExceptionCode.LOGIC_FUNCTION_NOT_FOUND, ); } diff --git a/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/local.driver.ts b/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/local.driver.ts index 9e78a5f0b46..f93ab0551e8 100644 --- a/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/local.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/logic-function-executor/drivers/local.driver.ts @@ -66,13 +66,11 @@ export class LocalDriver implements LogicFunctionExecutorDriver { flatLogicFunction, flatLogicFunctionLayer, payload, - version, env, }: { flatLogicFunction: FlatLogicFunction; flatLogicFunctionLayer: FlatLogicFunctionLayer; payload: object; - version: string; env?: Record; }): Promise { await this.build(flatLogicFunctionLayer); @@ -81,7 +79,6 @@ export class LocalDriver implements LogicFunctionExecutorDriver { const builtHandlerFolderPath = getLogicFunctionFolderOrThrow({ flatLogicFunction, - version, fileFolder: FileFolder.BuiltFunction, }); diff --git a/packages/twenty-server/src/engine/core-modules/logic-function-executor/logic-function-executor.service.ts b/packages/twenty-server/src/engine/core-modules/logic-function-executor/logic-function-executor.service.ts index 84cb4de0b81..3732061df4e 100644 --- a/packages/twenty-server/src/engine/core-modules/logic-function-executor/logic-function-executor.service.ts +++ b/packages/twenty-server/src/engine/core-modules/logic-function-executor/logic-function-executor.service.ts @@ -26,20 +26,17 @@ export class LogicFunctionExecutorService flatLogicFunction, flatLogicFunctionLayer, payload, - version, env, }: { flatLogicFunction: FlatLogicFunction; flatLogicFunctionLayer: FlatLogicFunctionLayer; payload: object; - version: string; env?: Record; }): Promise { return this.driver.execute({ flatLogicFunction, flatLogicFunctionLayer, payload, - version, env, }); } diff --git a/packages/twenty-server/src/engine/core-modules/logic-function-executor/utils/get-logic-function-folder-or-throw.utils.ts b/packages/twenty-server/src/engine/core-modules/logic-function-executor/utils/get-logic-function-folder-or-throw.utils.ts index 70cc5445268..f4ceb341a41 100644 --- a/packages/twenty-server/src/engine/core-modules/logic-function-executor/utils/get-logic-function-folder-or-throw.utils.ts +++ b/packages/twenty-server/src/engine/core-modules/logic-function-executor/utils/get-logic-function-folder-or-throw.utils.ts @@ -1,40 +1,22 @@ import { join } from 'path'; -import { isDefined } from 'twenty-shared/utils'; import { FileFolder } from 'twenty-shared/types'; -import { - LogicFunctionException, - LogicFunctionExceptionCode, -} from 'src/engine/metadata-modules/logic-function/logic-function.exception'; import { type FlatLogicFunction } from 'src/engine/metadata-modules/logic-function/types/flat-logic-function.type'; export const getLogicFunctionFolderOrThrow = ({ flatLogicFunction, - version, fileFolder = FileFolder.LogicFunction, }: { flatLogicFunction: FlatLogicFunction; - version?: 'draft' | 'latest' | (string & NonNullable); fileFolder?: | FileFolder.LogicFunction | FileFolder.LogicFunctionToDelete | FileFolder.BuiltFunction; }) => { - if (version === 'latest' && !isDefined(flatLogicFunction.latestVersion)) { - throw new LogicFunctionException( - "Can't get 'latest' version when logicFunction 'latestVersion' is undefined", - LogicFunctionExceptionCode.LOGIC_FUNCTION_VERSION_NOT_FOUND, - ); - } - - const computedVersion = - version === 'latest' ? flatLogicFunction.latestVersion : version; - return join( 'workspace-' + flatLogicFunction.workspaceId, fileFolder, flatLogicFunction.id, - computedVersion || '', ); }; diff --git a/packages/twenty-server/src/engine/core-modules/tool-provider/providers/logic-function-tool.provider.ts b/packages/twenty-server/src/engine/core-modules/tool-provider/providers/logic-function-tool.provider.ts index 23075623c8c..39b4fc3cde5 100644 --- a/packages/twenty-server/src/engine/core-modules/tool-provider/providers/logic-function-tool.provider.ts +++ b/packages/twenty-server/src/engine/core-modules/tool-provider/providers/logic-function-tool.provider.ts @@ -67,7 +67,6 @@ export class LogicFunctionToolProvider implements ToolProvider { id: logicFunction.id, workspaceId: context.workspaceId, payload: actualParams, - version: logicFunction.latestVersion ?? 'draft', }); if (result.error) { diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-entity/constant/all-flat-entity-properties-to-compare-and-stringify.constant.ts b/packages/twenty-server/src/engine/metadata-modules/flat-entity/constant/all-flat-entity-properties-to-compare-and-stringify.constant.ts index c1075eca777..97c1b3529c6 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-entity/constant/all-flat-entity-properties-to-compare-and-stringify.constant.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-entity/constant/all-flat-entity-properties-to-compare-and-stringify.constant.ts @@ -79,10 +79,8 @@ export const ALL_FLAT_ENTITY_PROPERTIES_TO_COMPARE_AND_STRINGIFY = { (property) => property !== 'code', ), 'deletedAt', - 'latestVersion', - 'publishedVersions', ], - propertiesToStringify: ['toolInputSchema', 'publishedVersions'], + propertiesToStringify: ['toolInputSchema'], }, viewFilter: { propertiesToCompare: [ diff --git a/packages/twenty-server/src/engine/metadata-modules/function-build/function-build.service.ts b/packages/twenty-server/src/engine/metadata-modules/function-build/function-build.service.ts index 8f7e02784d6..23abe82d838 100644 --- a/packages/twenty-server/src/engine/metadata-modules/function-build/function-build.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/function-build/function-build.service.ts @@ -17,14 +17,12 @@ export class FunctionBuildService { async isBuilt({ flatLogicFunction, - version, }: { flatLogicFunction: FlatLogicFunction; - version: string; }): Promise { const folderPath = getLogicFunctionFolderOrThrow({ flatLogicFunction, - version, + fileFolder: FileFolder.BuiltFunction, }); return await this.fileStorageService.checkFileExists({ @@ -35,20 +33,16 @@ export class FunctionBuildService { async buildAndUpload({ flatLogicFunction, - version, }: { flatLogicFunction: FlatLogicFunction; - version: string; }): Promise { const sourceFolderPath = getLogicFunctionFolderOrThrow({ flatLogicFunction, - version, fileFolder: FileFolder.LogicFunction, }); const builtFolderPath = getLogicFunctionFolderOrThrow({ flatLogicFunction, - version, fileFolder: FileFolder.BuiltFunction, }); diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/execute-logic-function.input.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/execute-logic-function.input.ts index f8bd1bb7f83..f25c0007650 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/execute-logic-function.input.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/execute-logic-function.input.ts @@ -19,11 +19,4 @@ export class ExecuteLogicFunctionInput { }) @IsObject() payload: JSON; - - @Field(() => String, { - nullable: false, - description: 'Version of the logic function to execute', - defaultValue: 'latest', - }) - version: string; } diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/get-logic-function-source-code.input.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/get-logic-function-source-code.input.ts index d3caa72009d..f008c01ecea 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/get-logic-function-source-code.input.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/get-logic-function-source-code.input.ts @@ -1,4 +1,4 @@ -import { Field, ID, InputType } from '@nestjs/graphql'; +import { ID, InputType } from '@nestjs/graphql'; import { IDField } from '@ptc-org/nestjs-query-graphql'; @@ -6,11 +6,4 @@ import { IDField } from '@ptc-org/nestjs-query-graphql'; export class GetLogicFunctionSourceCodeInput { @IDField(() => ID, { description: 'The id of the function.' }) id!: string; - - @Field(() => String, { - nullable: false, - description: 'The version of the function', - defaultValue: 'draft', - }) - version: string; } diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/logic-function.dto.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/logic-function.dto.ts index 31863e6c0de..d3a8d65f81d 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/logic-function.dto.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/dtos/logic-function.dto.ts @@ -6,7 +6,6 @@ import { QueryOptions, } from '@ptc-org/nestjs-query-graphql'; import { - IsArray, IsBoolean, IsDateString, IsNotEmpty, @@ -59,10 +58,6 @@ export class LogicFunctionDTO { @Field() timeoutSeconds: number; - @IsString() - @Field({ nullable: true }) - latestVersion?: string; - @IsString() @Field() sourceHandlerPath: string; @@ -75,10 +70,6 @@ export class LogicFunctionDTO { @Field() handlerName: string; - @IsArray() - @Field(() => [String], { nullable: false }) - publishedVersions: string[]; - @IsObject() @IsOptional() @Field(() => graphqlTypeJson, { nullable: true }) diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/jobs/logic-function-trigger.job.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/jobs/logic-function-trigger.job.ts index 72f51401955..5efc6d24bd8 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/jobs/logic-function-trigger.job.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/jobs/logic-function-trigger.job.ts @@ -27,7 +27,6 @@ export class LogicFunctionTriggerJob { id: logicFunctionPayload.logicFunctionId, workspaceId: logicFunctionPayload.workspaceId, payload: logicFunctionPayload.payload || {}, - version: 'draft', }), ), ); diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.entity.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.entity.ts index 22d27b457e9..735f34733cf 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.entity.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.entity.ts @@ -69,12 +69,6 @@ export class LogicFunctionEntity @Column({ nullable: true, type: 'varchar' }) description: string | null; - @Column({ nullable: true, type: 'varchar' }) - latestVersion: string | null; - - @Column({ nullable: false, type: 'jsonb', default: [] }) - publishedVersions: JsonbProperty; - @Column({ nullable: false, default: LogicFunctionRuntime.NODE22 }) runtime: LogicFunctionRuntime; diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.exception.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.exception.ts index 37d4d325c7e..4bbdeac38f7 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.exception.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.exception.ts @@ -6,7 +6,6 @@ import { CustomException } from 'src/utils/custom-exception'; export enum LogicFunctionExceptionCode { LOGIC_FUNCTION_NOT_FOUND = 'LOGIC_FUNCTION_NOT_FOUND', - LOGIC_FUNCTION_VERSION_NOT_FOUND = 'LOGIC_FUNCTION_VERSION_NOT_FOUND', LOGIC_FUNCTION_ALREADY_EXIST = 'LOGIC_FUNCTION_ALREADY_EXIST', LOGIC_FUNCTION_NOT_READY = 'LOGIC_FUNCTION_NOT_READY', LOGIC_FUNCTION_BUILDING = 'LOGIC_FUNCTION_BUILDING', @@ -23,8 +22,6 @@ const getLogicFunctionExceptionUserFriendlyMessage = ( switch (code) { case LogicFunctionExceptionCode.LOGIC_FUNCTION_NOT_FOUND: return msg`Function not found.`; - case LogicFunctionExceptionCode.LOGIC_FUNCTION_VERSION_NOT_FOUND: - return msg`Function version not found.`; case LogicFunctionExceptionCode.LOGIC_FUNCTION_ALREADY_EXIST: return msg`A function with this name already exists.`; case LogicFunctionExceptionCode.LOGIC_FUNCTION_NOT_READY: diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.resolver.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.resolver.ts index 9cd1a41ce0c..86f2368dfb4 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.resolver.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.resolver.ts @@ -120,7 +120,6 @@ export class LogicFunctionResolver { return await this.logicFunctionService.getLogicFunctionSourceCode( workspaceId, input.id, - input.version, ); } catch (error) { return logicFunctionGraphQLApiExceptionHandler(error); @@ -199,13 +198,12 @@ export class LogicFunctionResolver { @AuthWorkspace() { id: workspaceId }: WorkspaceEntity, ) { try { - const { id, payload, version } = input; + const { id, payload } = input; return await this.logicFunctionService.executeOneLogicFunction({ id, workspaceId, payload, - version, }); } catch (error) { return logicFunctionGraphQLApiExceptionHandler(error); diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.service.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.service.ts index 22fca41026f..db9ef95b7d1 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/logic-function.service.ts @@ -1,14 +1,12 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import deepEqual from 'deep-equal'; import { DEFAULT_API_KEY_NAME, DEFAULT_API_URL_NAME, } from 'twenty-shared/application'; import { isDefined } from 'twenty-shared/utils'; import { Repository } from 'typeorm'; -import { FileFolder } from 'twenty-shared/types'; import { FileStorageExceptionCode } from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception'; import { type LogicFunctionExecuteResult } from 'src/engine/core-modules/logic-function-executor/drivers/interfaces/logic-function-executor-driver.interface'; @@ -26,7 +24,6 @@ import { ThrottlerService } from 'src/engine/core-modules/throttler/throttler.se import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service'; import { WorkspaceManyOrAllFlatEntityMapsCacheService } from 'src/engine/metadata-modules/flat-entity/services/workspace-many-or-all-flat-entity-maps-cache.service'; import { findFlatEntityByIdInFlatEntityMapsOrThrow } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps-or-throw.util'; -import { findFlatEntityByIdInFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps.util'; import { LogicFunctionLayerService } from 'src/engine/metadata-modules/logic-function-layer/logic-function-layer.service'; import { CreateLogicFunctionInput } from 'src/engine/metadata-modules/logic-function/dtos/create-logic-function.input'; import { type UpdateLogicFunctionInput } from 'src/engine/metadata-modules/logic-function/dtos/update-logic-function.input'; @@ -44,10 +41,6 @@ import { SubscriptionService } from 'src/engine/subscriptions/subscription.servi import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service'; import { WorkspaceMigrationBuilderException } from 'src/engine/workspace-manager/workspace-migration/exceptions/workspace-migration-builder-exception'; import { WorkspaceMigrationValidateBuildAndRunService } from 'src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service'; -import { - WorkflowVersionStepException, - WorkflowVersionStepExceptionCode, -} from 'src/modules/workflow/common/exceptions/workflow-version-step.exception'; import { cleanServerUrl } from 'src/utils/clean-server-url'; import { FunctionBuildService } from 'src/engine/metadata-modules/function-build/function-build.service'; @@ -74,35 +67,7 @@ export class LogicFunctionService { private readonly secretEncryptionService: SecretEncryptionService, ) {} - async hasLogicFunctionPublishedVersion( - logicFunctionId: string, - workspaceId: string, - ) { - const { flatLogicFunctionMaps } = - await this.flatEntityMapsCacheService.getOrRecomputeManyOrAllFlatEntityMaps( - { - workspaceId, - flatMapsKeys: ['flatLogicFunctionMaps'], - }, - ); - - const flatLogicFunction = findFlatEntityByIdInFlatEntityMaps({ - flatEntityId: logicFunctionId, - flatEntityMaps: flatLogicFunctionMaps, - }); - - return ( - isDefined(flatLogicFunction) && - !isDefined(flatLogicFunction.deletedAt) && - isDefined(flatLogicFunction.latestVersion) - ); - } - - async getLogicFunctionSourceCode( - workspaceId: string, - id: string, - version: string, - ) { + async getLogicFunctionSourceCode(workspaceId: string, id: string) { const { flatLogicFunctionMaps } = await this.flatEntityMapsCacheService.getOrRecomputeManyOrAllFlatEntityMaps( { @@ -119,7 +84,6 @@ export class LogicFunctionService { try { const folderPath = getLogicFunctionFolderOrThrow({ flatLogicFunction, - version, }); return await this.fileStorageService.readFolder(folderPath); @@ -135,12 +99,10 @@ export class LogicFunctionService { id, workspaceId, payload, - version = 'latest', }: { id: string; workspaceId: string; payload: object; - version?: string; }): Promise { await this.throttleExecution(workspaceId); @@ -208,12 +170,10 @@ export class LogicFunctionService { if ( !(await this.functionBuildService.isBuilt({ flatLogicFunction, - version, })) ) { await this.functionBuildService.buildAndUpload({ flatLogicFunction, - version, }); } @@ -223,7 +183,6 @@ export class LogicFunctionService { flatLogicFunction, flatLogicFunctionLayer, payload, - version, env: envVariables, }), timeoutMs: flatLogicFunction.timeoutSeconds * 1000, @@ -290,116 +249,7 @@ export class LogicFunctionService { flatLogicFunctionMaps, }); - if (isDefined(existingFlatLogicFunction.latestVersion)) { - const latestCode = await this.getLogicFunctionSourceCode( - workspaceId, - id, - 'latest', - ); - const draftCode = await this.getLogicFunctionSourceCode( - workspaceId, - id, - 'draft', - ); - - if (deepEqual(latestCode, draftCode)) { - return existingFlatLogicFunction; - } - } - - const newVersion = existingFlatLogicFunction.latestVersion - ? `${parseInt(existingFlatLogicFunction.latestVersion, 10) + 1}` - : '1'; - - const draftSourceFolderPath = getLogicFunctionFolderOrThrow({ - flatLogicFunction: existingFlatLogicFunction, - version: 'draft', - fileFolder: FileFolder.LogicFunction, - }); - - const newSourceFolderPath = getLogicFunctionFolderOrThrow({ - flatLogicFunction: existingFlatLogicFunction, - version: newVersion, - fileFolder: FileFolder.LogicFunction, - }); - - await this.fileStorageService.copy({ - from: { folderPath: draftSourceFolderPath }, - to: { folderPath: newSourceFolderPath }, - }); - - const draftBuiltFolderPath = getLogicFunctionFolderOrThrow({ - flatLogicFunction: existingFlatLogicFunction, - version: 'draft', - fileFolder: FileFolder.BuiltFunction, - }); - - const newBuiltFolderPath = getLogicFunctionFolderOrThrow({ - flatLogicFunction: existingFlatLogicFunction, - version: newVersion, - fileFolder: FileFolder.BuiltFunction, - }); - - await this.fileStorageService.copy({ - from: { folderPath: draftBuiltFolderPath }, - to: { folderPath: newBuiltFolderPath }, - }); - - const newPublishedVersions = [ - ...existingFlatLogicFunction.publishedVersions, - newVersion, - ]; - - const updatedFlatLogicFunction: FlatLogicFunction = { - ...existingFlatLogicFunction, - latestVersion: newVersion, - publishedVersions: newPublishedVersions, - }; - - const validateAndBuildResult = - await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunWorkspaceMigration( - { - allFlatEntityOperationByMetadataName: { - logicFunction: { - flatEntityToCreate: [], - flatEntityToDelete: [], - flatEntityToUpdate: [updatedFlatLogicFunction], - }, - }, - workspaceId, - isSystemBuild: false, - }, - ); - - if (isDefined(validateAndBuildResult)) { - throw new WorkspaceMigrationBuilderException( - validateAndBuildResult, - 'Multiple validation errors occurred while publishing logic function', - ); - } - - const { flatLogicFunctionMaps: recomputedFlatLogicFunctionMaps } = - await this.flatEntityMapsCacheService.getOrRecomputeManyOrAllFlatEntityMaps( - { - workspaceId, - flatMapsKeys: ['flatLogicFunctionMaps'], - }, - ); - - const publishedFlatLogicFunction = - findFlatEntityByIdInFlatEntityMapsOrThrow({ - flatEntityId: id, - flatEntityMaps: recomputedFlatLogicFunctionMaps, - }); - - if (!isDefined(publishedFlatLogicFunction.latestVersion)) { - throw new WorkflowVersionStepException( - `Fail to publish logicFunction ${publishedFlatLogicFunction.id}.Received latest version ${publishedFlatLogicFunction.latestVersion}`, - WorkflowVersionStepExceptionCode.CODE_STEP_FAILURE, - ); - } - - return publishedFlatLogicFunction; + return existingFlatLogicFunction; } async deleteOneLogicFunction({ @@ -700,55 +550,11 @@ export class LogicFunctionService { }); } - async createDraftFromPublishedVersion({ - id, - version, - workspaceId, - }: { - id: string; - version: string; - workspaceId: string; - }) { - if (version === 'draft') { - return; - } - - const { flatLogicFunctionMaps } = - await this.flatEntityMapsCacheService.getOrRecomputeManyOrAllFlatEntityMaps( - { - workspaceId, - flatMapsKeys: ['flatLogicFunctionMaps'], - }, - ); - - const flatLogicFunction = findFlatLogicFunctionOrThrow({ - id, - flatLogicFunctionMaps, - }); - - await this.fileStorageService.copy({ - from: { - folderPath: getLogicFunctionFolderOrThrow({ - flatLogicFunction, - version, - }), - }, - to: { - folderPath: getLogicFunctionFolderOrThrow({ - flatLogicFunction, - version: 'draft', - }), - }, - }); - } - async duplicateLogicFunction({ id, - version, workspaceId, }: { id: string; - version: string; workspaceId: string; }): Promise { const { flatLogicFunctionMaps } = @@ -779,13 +585,11 @@ export class LogicFunctionService { from: { folderPath: getLogicFunctionFolderOrThrow({ flatLogicFunction: flatLogicFunctionToDuplicate, - version, }), }, to: { folderPath: getLogicFunctionFolderOrThrow({ flatLogicFunction: newFlatLogicFunction, - version: 'draft', }), }, }); diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/from-create-logic-function-input-to-flat-logic-function.util.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/from-create-logic-function-input-to-flat-logic-function.util.ts index fc0553367c2..d39d850025b 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/from-create-logic-function-input-to-flat-logic-function.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/from-create-logic-function-input-to-flat-logic-function.util.ts @@ -48,8 +48,6 @@ export const fromCreateLogicFunctionInputToFlatLogicFunction = ({ createdAt: currentDate.toISOString(), updatedAt: currentDate.toISOString(), deletedAt: null, - latestVersion: null, - publishedVersions: [], applicationId: workspaceCustomApplicationId, runtime: LogicFunctionRuntime.NODE22, timeoutSeconds: rawCreateLogicFunctionInput.timeoutSeconds ?? 300, diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/from-flat-logic-function-to-logic-function-dto.util.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/from-flat-logic-function-to-logic-function-dto.util.ts index 7edadc8a26c..8ac19d94fcc 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/from-flat-logic-function-to-logic-function-dto.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/from-flat-logic-function-to-logic-function-dto.util.ts @@ -12,11 +12,9 @@ export const fromFlatLogicFunctionToLogicFunctionDto = ({ description: flatLogicFunction.description ?? undefined, runtime: flatLogicFunction.runtime, timeoutSeconds: flatLogicFunction.timeoutSeconds, - latestVersion: flatLogicFunction.latestVersion ?? undefined, sourceHandlerPath: flatLogicFunction.sourceHandlerPath, builtHandlerPath: flatLogicFunction.builtHandlerPath, handlerName: flatLogicFunction.handlerName, - publishedVersions: flatLogicFunction.publishedVersions, toolInputSchema: flatLogicFunction.toolInputSchema ?? undefined, isTool: flatLogicFunction.isTool, applicationId: flatLogicFunction.applicationId ?? undefined, diff --git a/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/logic-function-graphql-api-exception-handler.utils.ts b/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/logic-function-graphql-api-exception-handler.utils.ts index 85c0f5f77c3..1d98641ba10 100644 --- a/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/logic-function-graphql-api-exception-handler.utils.ts +++ b/packages/twenty-server/src/engine/metadata-modules/logic-function/utils/logic-function-graphql-api-exception-handler.utils.ts @@ -16,7 +16,6 @@ export const logicFunctionGraphQLApiExceptionHandler = (error: any) => { if (error instanceof LogicFunctionException) { switch (error.code) { case LogicFunctionExceptionCode.LOGIC_FUNCTION_NOT_FOUND: - case LogicFunctionExceptionCode.LOGIC_FUNCTION_VERSION_NOT_FOUND: throw new NotFoundError(error); case LogicFunctionExceptionCode.LOGIC_FUNCTION_ALREADY_EXIST: throw new ConflictError(error); diff --git a/packages/twenty-server/src/engine/metadata-modules/route-trigger/route-trigger.service.ts b/packages/twenty-server/src/engine/metadata-modules/route-trigger/route-trigger.service.ts index 802b3fe3284..8efe1ba8406 100644 --- a/packages/twenty-server/src/engine/metadata-modules/route-trigger/route-trigger.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/route-trigger/route-trigger.service.ts @@ -150,7 +150,6 @@ export class RouteTriggerService { id: logicFunction.id, workspaceId: logicFunction.workspaceId, payload: event, - version: 'draft', }); if (!isDefined(result)) { diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/action-handlers/logic-function/services/create-logic-function-action-handler.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/action-handlers/logic-function/services/create-logic-function-action-handler.service.ts index 3ec1d66ef94..460223fd727 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/action-handlers/logic-function/services/create-logic-function-action-handler.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/action-handlers/logic-function/services/create-logic-function-action-handler.service.ts @@ -49,7 +49,6 @@ export class CreateLogicFunctionActionHandlerService extends WorkspaceMigrationR private async buildAndSaveLogicFunction(logicFunction: FlatLogicFunction) { const draftFileFolder = getLogicFunctionFolderOrThrow({ flatLogicFunction: logicFunction, - version: 'draft', }); if (isDefined(logicFunction?.code)) { @@ -69,7 +68,6 @@ export class CreateLogicFunctionActionHandlerService extends WorkspaceMigrationR } await this.functionBuildService.buildAndUpload({ flatLogicFunction: logicFunction, - version: 'draft', }); } diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/action-handlers/logic-function/services/update-logic-function-action-handler.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/action-handlers/logic-function/services/update-logic-function-action-handler.service.ts index 5a395402c7b..7d0a1849ca9 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/action-handlers/logic-function/services/update-logic-function-action-handler.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/action-handlers/logic-function/services/update-logic-function-action-handler.service.ts @@ -82,14 +82,12 @@ export class UpdateLogicFunctionActionHandlerService extends WorkspaceMigrationR }) { const fileFolder = getLogicFunctionFolderOrThrow({ flatLogicFunction, - version: 'draft', }); await this.fileStorageService.writeFolder(code, fileFolder); await this.functionBuildService.buildAndUpload({ flatLogicFunction, - version: 'draft', }); } } diff --git a/packages/twenty-server/src/modules/workflow/workflow-builder/utils/__tests__/compute-workflow-version-step-changes.util.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-builder/utils/__tests__/compute-workflow-version-step-changes.util.spec.ts index 317fa1ebd30..e5f339395cc 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-builder/utils/__tests__/compute-workflow-version-step-changes.util.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-builder/utils/__tests__/compute-workflow-version-step-changes.util.spec.ts @@ -99,7 +99,6 @@ describe('computeWorkflowVersionStepChanges', () => { settings: { input: { logicFunctionId: '', - logicFunctionVersion: '', logicFunctionInput: {}, }, errorHandlingOptions: { diff --git a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/__tests__/workflow-version-step-operations.workspace-service.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/__tests__/workflow-version-step-operations.workspace-service.spec.ts index 97957a9754b..363e1628697 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/__tests__/workflow-version-step-operations.workspace-service.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/__tests__/workflow-version-step-operations.workspace-service.spec.ts @@ -37,10 +37,8 @@ describe('WorkflowVersionStepOperationsWorkspaceService', () => { beforeEach(async () => { logicFunctionService = { createOneLogicFunction: jest.fn(), - hasLogicFunctionPublishedVersion: jest.fn(), deleteOneLogicFunction: jest.fn(), duplicateLogicFunction: jest.fn(), - createDraftFromPublishedVersion: jest.fn(), } as unknown as jest.Mocked; agentRepository = { @@ -142,7 +140,6 @@ describe('WorkflowVersionStepOperationsWorkspaceService', () => { settings: { input: { logicFunctionId: 'function-id', - logicFunctionVersion: 'v1', }, outputSchema: {}, errorHandlingOptions: { @@ -152,10 +149,6 @@ describe('WorkflowVersionStepOperationsWorkspaceService', () => { }, } as unknown as WorkflowAction; - logicFunctionService.hasLogicFunctionPublishedVersion.mockResolvedValue( - false, - ); - await service.runWorkflowVersionStepDeletionSideEffects({ step, workspaceId: mockWorkspaceId, @@ -252,8 +245,6 @@ describe('WorkflowVersionStepOperationsWorkspaceService', () => { id: 'new-function-id', name: 'Test Function', description: 'Test Description', - latestVersion: 'v1', - publishedVersions: [], workspaceId: mockWorkspaceId, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), @@ -289,13 +280,11 @@ describe('WorkflowVersionStepOperationsWorkspaceService', () => { settings: { input: { logicFunctionId: string; - logicFunctionVersion: string; }; }; }; expect(codeResult.settings.input.logicFunctionId).toBe('new-function-id'); - expect(codeResult.settings.input.logicFunctionVersion).toBe('draft'); }); it('should create form step', async () => { @@ -320,7 +309,6 @@ describe('WorkflowVersionStepOperationsWorkspaceService', () => { settings: { input: { logicFunctionId: 'function-id', - logicFunctionVersion: 'v1', }, }, nextStepIds: ['next-step'], @@ -330,8 +318,6 @@ describe('WorkflowVersionStepOperationsWorkspaceService', () => { id: 'new-function-id', name: 'Test Function', description: 'Test Description', - latestVersion: 'v1', - publishedVersions: [], workspaceId: mockWorkspaceId, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), @@ -370,13 +356,11 @@ describe('WorkflowVersionStepOperationsWorkspaceService', () => { settings: { input: { logicFunctionId: string; - logicFunctionVersion: string; }; }; }; expect(codeResult.settings.input.logicFunctionId).toBe('new-function-id'); - expect(codeResult.settings.input.logicFunctionVersion).toBe('draft'); expect(duplicateStep.nextStepIds).toEqual([]); }); diff --git a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/utils/__tests__/insert-step.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/utils/__tests__/insert-step.spec.ts index 694d983d4d8..42245470087 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/utils/__tests__/insert-step.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/utils/__tests__/insert-step.spec.ts @@ -40,7 +40,6 @@ describe('insertStep', () => { settings: { input: { logicFunctionId: 'test', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, diff --git a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/utils/__tests__/remove-step.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/utils/__tests__/remove-step.spec.ts index e2657253c0f..7bce655a552 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/utils/__tests__/remove-step.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/utils/__tests__/remove-step.spec.ts @@ -32,7 +32,6 @@ describe('removeStep', () => { settings: { input: { logicFunctionId: 'test', - logicFunctionVersion: '1.0.0', logicFunctionInput: {}, }, outputSchema: {}, diff --git a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/workflow-version-step-operations.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/workflow-version-step-operations.workspace-service.ts index 32c7eb1ef7b..224ba9879ef 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/workflow-version-step-operations.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-version-step/workflow-version-step-operations.workspace-service.ts @@ -86,18 +86,11 @@ export class WorkflowVersionStepOperationsWorkspaceService { }) { switch (step.type) { case WorkflowActionType.CODE: { - if ( - !(await this.logicFunctionService.hasLogicFunctionPublishedVersion( - step.settings.input.logicFunctionId, - workspaceId, - )) - ) { - await this.logicFunctionService.deleteOneLogicFunction({ - id: step.settings.input.logicFunctionId, - workspaceId, - softDelete: false, - }); - } + await this.logicFunctionService.deleteOneLogicFunction({ + id: step.settings.input.logicFunctionId, + workspaceId, + softDelete: false, + }); break; } case WorkflowActionType.AI_AGENT: { @@ -193,7 +186,6 @@ export class WorkflowVersionStepOperationsWorkspaceService { }, input: { logicFunctionId: newLogicFunction.id, - logicFunctionVersion: 'draft', logicFunctionInput: SEED_PROJECT_INPUT_SCHEMA, }, }, @@ -663,7 +655,6 @@ export class WorkflowVersionStepOperationsWorkspaceService { const newLogicFunction = await this.logicFunctionService.duplicateLogicFunction({ id: step.settings.input.logicFunctionId, - version: step.settings.input.logicFunctionVersion, workspaceId, }); @@ -677,7 +668,6 @@ export class WorkflowVersionStepOperationsWorkspaceService { input: { ...step.settings.input, logicFunctionId: newLogicFunction.id, - logicFunctionVersion: 'draft', }, }, }; @@ -928,33 +918,10 @@ export class WorkflowVersionStepOperationsWorkspaceService { async createDraftStep({ step, - workspaceId, }: { step: WorkflowAction; workspaceId: string; }): Promise { - switch (step.type) { - case WorkflowActionType.CODE: { - await this.logicFunctionService.createDraftFromPublishedVersion({ - id: step.settings.input.logicFunctionId, - version: step.settings.input.logicFunctionVersion, - workspaceId, - }); - - return { - ...step, - settings: { - ...step.settings, - input: { - ...step.settings.input, - logicFunctionVersion: 'draft', - }, - }, - }; - } - default: { - return step; - } - } + return step; } } diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/should-execute-step.util.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/should-execute-step.util.spec.ts index c658d0740f5..417bcc146a4 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/should-execute-step.util.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/should-execute-step.util.spec.ts @@ -243,7 +243,6 @@ describe('shouldExecuteStep', () => { settings: { input: { logicFunctionId: 'mock-function-id', - logicFunctionVersion: 'mock-function-version', logicFunctionInput: {}, }, errorHandlingOptions: { diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/should-skip-step-execution.util.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/should-skip-step-execution.util.spec.ts index c10fc660ba1..607e600b03c 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/should-skip-step-execution.util.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/should-skip-step-execution.util.spec.ts @@ -17,7 +17,6 @@ describe('shouldSkipStepExecution', () => { settings: { input: { logicFunctionId: 'mock-function-id', - logicFunctionVersion: 'mock-function-version', logicFunctionInput: {}, }, errorHandlingOptions: { diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/code/code.workflow-action.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/code/code.workflow-action.ts index 6c9bbaf269a..97f20a0523d 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/code/code.workflow-action.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/code/code.workflow-action.ts @@ -49,7 +49,6 @@ export class CodeWorkflowAction implements WorkflowAction { id: workflowActionInput.logicFunctionId, workspaceId, payload: workflowActionInput.logicFunctionInput, - version: workflowActionInput.logicFunctionVersion, }); if (result.error) { diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/code/types/workflow-code-action-input.type.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/code/types/workflow-code-action-input.type.ts index 5718029ad79..513b4cf7acd 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/code/types/workflow-code-action-input.type.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/code/types/workflow-code-action-input.type.ts @@ -1,6 +1,5 @@ export type WorkflowCodeActionInput = { logicFunctionId: string; - logicFunctionVersion: string; logicFunctionInput: { // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/iterator/utils/__tests__/should-execute-iterator-step.util.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/iterator/utils/__tests__/should-execute-iterator-step.util.spec.ts index 1f7de567386..a27399d6c12 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/iterator/utils/__tests__/should-execute-iterator-step.util.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/iterator/utils/__tests__/should-execute-iterator-step.util.spec.ts @@ -52,7 +52,6 @@ describe('shouldExecuteIteratorStep', () => { settings: { input: { logicFunctionId: 'mock-function-id', - logicFunctionVersion: 'mock-function-version', logicFunctionInput: {}, }, errorHandlingOptions: { diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/iterator/utils/__tests__/should-skip-iterator-step-execution.util.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/iterator/utils/__tests__/should-skip-iterator-step-execution.util.spec.ts index 7723a19bc80..a4b2542f750 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/iterator/utils/__tests__/should-skip-iterator-step-execution.util.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/iterator/utils/__tests__/should-skip-iterator-step-execution.util.spec.ts @@ -52,7 +52,6 @@ describe('shouldSkipIteratorStepExecution', () => { settings: { input: { logicFunctionId: 'mock-function-id', - logicFunctionVersion: 'mock-function-version', logicFunctionInput: {}, }, errorHandlingOptions: { diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/logic-function/logic-function.workflow-action.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/logic-function/logic-function.workflow-action.ts index fdf4aaa8775..882d077a9d6 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/logic-function/logic-function.workflow-action.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/logic-function/logic-function.workflow-action.ts @@ -67,13 +67,10 @@ export class LogicFunctionWorkflowAction implements WorkflowAction { ); } - const version = logicFunction.latestVersion ?? 'draft'; - const result = await this.logicFunctionService.executeOneLogicFunction({ id: workflowActionInput.logicFunctionId, workspaceId, payload: workflowActionInput.logicFunctionInput, - version, }); if (result.error) { diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/__tests__/workflow-statuses-update.job.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/__tests__/workflow-statuses-update.job.spec.ts index 4d1e6a3f6ed..589178b6aa5 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/__tests__/workflow-statuses-update.job.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/__tests__/workflow-statuses-update.job.spec.ts @@ -81,7 +81,7 @@ describe('WorkflowStatusesUpdate', () => { provide: getRepositoryToken(LogicFunctionEntity), useValue: { findOneOrFail: jest.fn().mockResolvedValue({ - latestVersion: 'v2', + id: 'mock-logic-function-id', }), }, }, @@ -229,7 +229,6 @@ describe('WorkflowStatusesUpdate', () => { const mockLogicFunction = { id: 'logic-function-1', - latestVersion: 'v2', }; mockWorkflowRepository.findOneOrFail.mockResolvedValue(mockWorkflow); @@ -262,7 +261,6 @@ describe('WorkflowStatusesUpdate', () => { settings: { input: { logicFunctionId: 'logic-function-1', - logicFunctionVersion: 'v2', }, }, }, diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts index 49925b2f9f4..dde368ba5c7 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts @@ -11,10 +11,6 @@ import { LogicFunctionService } from 'src/engine/metadata-modules/logic-function import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager'; import { type WorkspaceRepository } from 'src/engine/twenty-orm/repository/workspace.repository'; import { buildSystemAuthContext } from 'src/engine/twenty-orm/utils/build-system-auth-context.util'; -import { - WorkflowVersionStepException, - WorkflowVersionStepExceptionCode, -} from 'src/modules/workflow/common/exceptions/workflow-version-step.exception'; import { WorkflowVersionStatus, type WorkflowVersionWorkspaceEntity, @@ -179,25 +175,10 @@ export class WorkflowStatusesUpdateJob { const newStep = { ...step }; if (step.type === WorkflowActionType.CODE) { - const logicFunction = - await this.logicFunctionService.publishOneLogicFunctionOrFail( - step.settings.input.logicFunctionId, - workspaceId, - ); - - const newStepSettings = { ...step.settings }; - - if (!isDefined(logicFunction.latestVersion)) { - throw new WorkflowVersionStepException( - `Fail to publish logic function ${logicFunction.id}. Latest version is null`, - WorkflowVersionStepExceptionCode.CODE_STEP_FAILURE, - ); - } - - newStepSettings.input.logicFunctionVersion = - logicFunction.latestVersion; - - newStep.settings = newStepSettings; + await this.logicFunctionService.publishOneLogicFunctionOrFail( + step.settings.input.logicFunctionId, + workspaceId, + ); } newSteps.push(newStep); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/logic-functions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/logic-functions.integration-spec.ts index 7282942f15d..4a694e191f3 100644 --- a/packages/twenty-server/test/integration/graphql/suites/object-generated/logic-functions.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/logic-functions.integration-spec.ts @@ -12,8 +12,6 @@ describe('logicFunctionsResolver (e2e)', () => { name description runtime - latestVersion - publishedVersions createdAt updatedAt } @@ -43,8 +41,6 @@ describe('logicFunctionsResolver (e2e)', () => { expect(logicFunction).toHaveProperty('name'); expect(logicFunction).toHaveProperty('description'); expect(logicFunction).toHaveProperty('runtime'); - expect(logicFunction).toHaveProperty('latestVersion'); - expect(logicFunction).toHaveProperty('publishedVersions'); expect(logicFunction).toHaveProperty('createdAt'); expect(logicFunction).toHaveProperty('updatedAt'); } diff --git a/packages/twenty-server/test/integration/metadata/suites/logic-function/logic-function-execution.integration-spec.ts b/packages/twenty-server/test/integration/metadata/suites/logic-function/logic-function-execution.integration-spec.ts index a599b122d7c..ee5ee69313c 100644 --- a/packages/twenty-server/test/integration/metadata/suites/logic-function/logic-function-execution.integration-spec.ts +++ b/packages/twenty-server/test/integration/metadata/suites/logic-function/logic-function-execution.integration-spec.ts @@ -66,7 +66,7 @@ describe('Logic Function Execution', () => { expectToFail: false, }); - expect(publishData?.publishLogicFunction?.latestVersion).toBeDefined(); + expect(publishData?.publishLogicFunction?.id).toBeDefined(); // Execute with the default template's expected params: { a: string, b: number } const { data: executeData } = await executeLogicFunction({ diff --git a/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/create-one-logic-function-query-factory.util.ts b/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/create-one-logic-function-query-factory.util.ts index fba888d6fbb..ce9eb180629 100644 --- a/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/create-one-logic-function-query-factory.util.ts +++ b/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/create-one-logic-function-query-factory.util.ts @@ -10,8 +10,6 @@ const DEFAULT_LOGIC_FUNCTION_GQL_FIELDS = ` name description runtime - latestVersion - publishedVersions createdAt updatedAt `; diff --git a/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/execute-logic-function-query-factory.util.ts b/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/execute-logic-function-query-factory.util.ts index 7682c5a3d8d..daa81bfb33a 100644 --- a/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/execute-logic-function-query-factory.util.ts +++ b/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/execute-logic-function-query-factory.util.ts @@ -3,7 +3,6 @@ import gql from 'graphql-tag'; export type ExecuteLogicFunctionFactoryInput = { id: string; payload: Record; - version?: string; }; const DEFAULT_EXECUTION_RESULT_GQL_FIELDS = ` @@ -29,9 +28,6 @@ export const executeLogicFunctionQueryFactory = ({ } `, variables: { - input: { - ...input, - version: input.version ?? 'latest', - }, + input, }, }); diff --git a/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/publish-logic-function-query-factory.util.ts b/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/publish-logic-function-query-factory.util.ts index 9a1db4e2194..8dc7e33b72a 100644 --- a/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/publish-logic-function-query-factory.util.ts +++ b/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/publish-logic-function-query-factory.util.ts @@ -7,8 +7,6 @@ export type PublishLogicFunctionFactoryInput = { const DEFAULT_LOGIC_FUNCTION_GQL_FIELDS = ` id name - latestVersion - publishedVersions `; export const publishLogicFunctionQueryFactory = ({ diff --git a/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/update-logic-function-query-factory.util.ts b/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/update-logic-function-query-factory.util.ts index 2a151113081..41f821f6ef7 100644 --- a/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/update-logic-function-query-factory.util.ts +++ b/packages/twenty-server/test/integration/metadata/suites/logic-function/utils/update-logic-function-query-factory.util.ts @@ -14,7 +14,6 @@ const DEFAULT_LOGIC_FUNCTION_GQL_FIELDS = ` id name description - latestVersion `; export const updateLogicFunctionQueryFactory = ({ diff --git a/packages/twenty-shared/src/workflow/schemas/code-action-settings-schema.ts b/packages/twenty-shared/src/workflow/schemas/code-action-settings-schema.ts index 69f65f06464..e6b9b728b35 100644 --- a/packages/twenty-shared/src/workflow/schemas/code-action-settings-schema.ts +++ b/packages/twenty-shared/src/workflow/schemas/code-action-settings-schema.ts @@ -5,7 +5,6 @@ export const workflowCodeActionSettingsSchema = baseWorkflowActionSettingsSchema.extend({ input: z.object({ logicFunctionId: z.string(), - logicFunctionVersion: z.string(), logicFunctionInput: z.record(z.string(), z.any()), }), });