Remove versions from logicFunction (#17540)
## Summary - Remove `latestVersion` and `publishedVersions` columns from `LogicFunction` entity - Remove version parameter from logic function execution, build, and source code retrieval - Update all related services, DTOs, utilities, and tests - Add database migration to drop the version columns
This commit is contained in:
@@ -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<Scalars['JSON']>;
|
||||
id: Scalars['UUID'];
|
||||
isTool: Scalars['Boolean'];
|
||||
latestVersion?: Maybe<Scalars['String']>;
|
||||
name: Scalars['String'];
|
||||
publishedVersions: Array<Scalars['String']>;
|
||||
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<string>, 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<Array<string>> | 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<string>, 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<string>, 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<Array<string>> | 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<string>, 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<Array<string>> | 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<string>, 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<string>, 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<Array<string>> | 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<string>, 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<string>, 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<string>, 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<string>, 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<string>, 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<string>, 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<string>, 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
|
||||
|
||||
@@ -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<Scalars['JSON']>;
|
||||
id: Scalars['UUID'];
|
||||
isTool: Scalars['Boolean'];
|
||||
latestVersion?: Maybe<Scalars['String']>;
|
||||
name: Scalars['String'];
|
||||
publishedVersions: Array<Scalars['String']>;
|
||||
runtime: Scalars['String'];
|
||||
sourceHandlerPath: Scalars['String'];
|
||||
timeoutSeconds: Scalars['Float'];
|
||||
|
||||
@@ -25,7 +25,6 @@ export const useTestLogicFunction = ({
|
||||
const result = await executeOneLogicFunction({
|
||||
id: logicFunctionId,
|
||||
payload: logicFunctionTestData.input,
|
||||
version: 'draft',
|
||||
});
|
||||
|
||||
setIsTesting(false);
|
||||
|
||||
-2
@@ -7,8 +7,6 @@ export const LOGIC_FUNCTION_FRAGMENT = gql`
|
||||
description
|
||||
runtime
|
||||
timeoutSeconds
|
||||
latestVersion
|
||||
publishedVersions
|
||||
sourceHandlerPath
|
||||
builtHandlerPath
|
||||
handlerName
|
||||
|
||||
+1
-3
@@ -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',
|
||||
|
||||
-3
@@ -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;
|
||||
|
||||
|
||||
-9
@@ -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: {},
|
||||
|
||||
-13
@@ -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: {},
|
||||
|
||||
-1
@@ -127,7 +127,6 @@ describe('getWorkflowVersionDiagram', () => {
|
||||
},
|
||||
input: {
|
||||
logicFunctionId: 'a5434be2-c10b-465c-acec-46492782a997',
|
||||
logicFunctionVersion: '1',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
outputSchema: {},
|
||||
|
||||
-1
@@ -42,7 +42,6 @@ describe('useUpdateStep', () => {
|
||||
settings: {
|
||||
input: {
|
||||
logicFunctionId: 'id',
|
||||
logicFunctionVersion: '1',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
outputSchema: {},
|
||||
|
||||
-3
@@ -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: {},
|
||||
|
||||
-1
@@ -28,7 +28,6 @@ describe('getStepInfoHistoryItem', () => {
|
||||
settings: {
|
||||
input: {
|
||||
logicFunctionId: 'func',
|
||||
logicFunctionVersion: '1.0.0',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
outputSchema: {},
|
||||
|
||||
-4
@@ -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: {},
|
||||
|
||||
-4
@@ -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: {
|
||||
|
||||
-4
@@ -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: {
|
||||
|
||||
-3
@@ -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: {
|
||||
|
||||
-1
@@ -131,7 +131,6 @@ export const WorkflowEditActionCode = ({
|
||||
const { formValues, setFormValues, loading } =
|
||||
useLogicFunctionUpdateFormState({
|
||||
logicFunctionId,
|
||||
logicFunctionVersion: 'draft',
|
||||
});
|
||||
|
||||
const updateOutputSchemaFromTestResult = async (testResult: object) => {
|
||||
|
||||
-2
@@ -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 (
|
||||
|
||||
-3
@@ -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: {},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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: {
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { type MigrationInterface, type QueryRunner } from 'typeorm';
|
||||
|
||||
export class RemoveLogicFunctionVersion1769681396664
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'RemoveLogicFunctionVersion1769681396664';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
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<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."logicFunction" ADD "publishedVersions" jsonb NOT NULL DEFAULT '[]'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."logicFunction" ADD "latestVersion" character varying`,
|
||||
);
|
||||
}
|
||||
}
|
||||
-2
@@ -22,13 +22,11 @@ export interface LogicFunctionExecutorDriver {
|
||||
flatLogicFunction,
|
||||
flatLogicFunctionLayer,
|
||||
payload,
|
||||
version,
|
||||
env,
|
||||
}: {
|
||||
flatLogicFunction: FlatLogicFunction;
|
||||
flatLogicFunctionLayer: FlatLogicFunctionLayer;
|
||||
payload: object;
|
||||
version: string;
|
||||
env?: Record<string, string>;
|
||||
}): Promise<LogicFunctionExecuteResult>;
|
||||
}
|
||||
|
||||
+1
-4
@@ -314,13 +314,11 @@ export class LambdaDriver implements LogicFunctionExecutorDriver {
|
||||
flatLogicFunction,
|
||||
flatLogicFunctionLayer,
|
||||
payload,
|
||||
version,
|
||||
env,
|
||||
}: {
|
||||
flatLogicFunction: FlatLogicFunction;
|
||||
flatLogicFunctionLayer: FlatLogicFunctionLayer;
|
||||
payload: object;
|
||||
version: string;
|
||||
env?: Record<string, string>;
|
||||
}): Promise<LogicFunctionExecuteResult> {
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
-3
@@ -66,13 +66,11 @@ export class LocalDriver implements LogicFunctionExecutorDriver {
|
||||
flatLogicFunction,
|
||||
flatLogicFunctionLayer,
|
||||
payload,
|
||||
version,
|
||||
env,
|
||||
}: {
|
||||
flatLogicFunction: FlatLogicFunction;
|
||||
flatLogicFunctionLayer: FlatLogicFunctionLayer;
|
||||
payload: object;
|
||||
version: string;
|
||||
env?: Record<string, string>;
|
||||
}): Promise<LogicFunctionExecuteResult> {
|
||||
await this.build(flatLogicFunctionLayer);
|
||||
@@ -81,7 +79,6 @@ export class LocalDriver implements LogicFunctionExecutorDriver {
|
||||
|
||||
const builtHandlerFolderPath = getLogicFunctionFolderOrThrow({
|
||||
flatLogicFunction,
|
||||
version,
|
||||
fileFolder: FileFolder.BuiltFunction,
|
||||
});
|
||||
|
||||
|
||||
-3
@@ -26,20 +26,17 @@ export class LogicFunctionExecutorService
|
||||
flatLogicFunction,
|
||||
flatLogicFunctionLayer,
|
||||
payload,
|
||||
version,
|
||||
env,
|
||||
}: {
|
||||
flatLogicFunction: FlatLogicFunction;
|
||||
flatLogicFunctionLayer: FlatLogicFunctionLayer;
|
||||
payload: object;
|
||||
version: string;
|
||||
env?: Record<string, string>;
|
||||
}): Promise<LogicFunctionExecuteResult> {
|
||||
return this.driver.execute({
|
||||
flatLogicFunction,
|
||||
flatLogicFunctionLayer,
|
||||
payload,
|
||||
version,
|
||||
env,
|
||||
});
|
||||
}
|
||||
|
||||
-18
@@ -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<unknown>);
|
||||
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 || '',
|
||||
);
|
||||
};
|
||||
|
||||
-1
@@ -67,7 +67,6 @@ export class LogicFunctionToolProvider implements ToolProvider {
|
||||
id: logicFunction.id,
|
||||
workspaceId: context.workspaceId,
|
||||
payload: actualParams,
|
||||
version: logicFunction.latestVersion ?? 'draft',
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
|
||||
+1
-3
@@ -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: [
|
||||
|
||||
+1
-7
@@ -17,14 +17,12 @@ export class FunctionBuildService {
|
||||
|
||||
async isBuilt({
|
||||
flatLogicFunction,
|
||||
version,
|
||||
}: {
|
||||
flatLogicFunction: FlatLogicFunction;
|
||||
version: string;
|
||||
}): Promise<boolean> {
|
||||
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<void> {
|
||||
const sourceFolderPath = getLogicFunctionFolderOrThrow({
|
||||
flatLogicFunction,
|
||||
version,
|
||||
fileFolder: FileFolder.LogicFunction,
|
||||
});
|
||||
|
||||
const builtFolderPath = getLogicFunctionFolderOrThrow({
|
||||
flatLogicFunction,
|
||||
version,
|
||||
fileFolder: FileFolder.BuiltFunction,
|
||||
});
|
||||
|
||||
|
||||
-7
@@ -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;
|
||||
}
|
||||
|
||||
+1
-8
@@ -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;
|
||||
}
|
||||
|
||||
-9
@@ -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 })
|
||||
|
||||
-1
@@ -27,7 +27,6 @@ export class LogicFunctionTriggerJob {
|
||||
id: logicFunctionPayload.logicFunctionId,
|
||||
workspaceId: logicFunctionPayload.workspaceId,
|
||||
payload: logicFunctionPayload.payload || {},
|
||||
version: 'draft',
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
-6
@@ -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<string[]>;
|
||||
|
||||
@Column({ nullable: false, default: LogicFunctionRuntime.NODE22 })
|
||||
runtime: LogicFunctionRuntime;
|
||||
|
||||
|
||||
-3
@@ -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:
|
||||
|
||||
+1
-3
@@ -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);
|
||||
|
||||
+2
-198
@@ -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<LogicFunctionExecuteResult> {
|
||||
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<FlatLogicFunction> {
|
||||
const { flatLogicFunctionMaps } =
|
||||
@@ -779,13 +585,11 @@ export class LogicFunctionService {
|
||||
from: {
|
||||
folderPath: getLogicFunctionFolderOrThrow({
|
||||
flatLogicFunction: flatLogicFunctionToDuplicate,
|
||||
version,
|
||||
}),
|
||||
},
|
||||
to: {
|
||||
folderPath: getLogicFunctionFolderOrThrow({
|
||||
flatLogicFunction: newFlatLogicFunction,
|
||||
version: 'draft',
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
-2
@@ -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,
|
||||
|
||||
-2
@@ -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,
|
||||
|
||||
-1
@@ -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);
|
||||
|
||||
-1
@@ -150,7 +150,6 @@ export class RouteTriggerService {
|
||||
id: logicFunction.id,
|
||||
workspaceId: logicFunction.workspaceId,
|
||||
payload: event,
|
||||
version: 'draft',
|
||||
});
|
||||
|
||||
if (!isDefined(result)) {
|
||||
|
||||
-2
@@ -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',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -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',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -99,7 +99,6 @@ describe('computeWorkflowVersionStepChanges', () => {
|
||||
settings: {
|
||||
input: {
|
||||
logicFunctionId: '',
|
||||
logicFunctionVersion: '',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
errorHandlingOptions: {
|
||||
|
||||
-16
@@ -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<LogicFunctionService>;
|
||||
|
||||
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([]);
|
||||
});
|
||||
|
||||
-1
@@ -40,7 +40,6 @@ describe('insertStep', () => {
|
||||
settings: {
|
||||
input: {
|
||||
logicFunctionId: 'test',
|
||||
logicFunctionVersion: '1.0.0',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
outputSchema: {},
|
||||
|
||||
-1
@@ -32,7 +32,6 @@ describe('removeStep', () => {
|
||||
settings: {
|
||||
input: {
|
||||
logicFunctionId: 'test',
|
||||
logicFunctionVersion: '1.0.0',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
outputSchema: {},
|
||||
|
||||
+6
-39
@@ -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<WorkflowAction> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -243,7 +243,6 @@ describe('shouldExecuteStep', () => {
|
||||
settings: {
|
||||
input: {
|
||||
logicFunctionId: 'mock-function-id',
|
||||
logicFunctionVersion: 'mock-function-version',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
errorHandlingOptions: {
|
||||
|
||||
-1
@@ -17,7 +17,6 @@ describe('shouldSkipStepExecution', () => {
|
||||
settings: {
|
||||
input: {
|
||||
logicFunctionId: 'mock-function-id',
|
||||
logicFunctionVersion: 'mock-function-version',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
errorHandlingOptions: {
|
||||
|
||||
-1
@@ -49,7 +49,6 @@ export class CodeWorkflowAction implements WorkflowAction {
|
||||
id: workflowActionInput.logicFunctionId,
|
||||
workspaceId,
|
||||
payload: workflowActionInput.logicFunctionInput,
|
||||
version: workflowActionInput.logicFunctionVersion,
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
export type WorkflowCodeActionInput = {
|
||||
logicFunctionId: string;
|
||||
logicFunctionVersion: string;
|
||||
logicFunctionInput: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[key: string]: any;
|
||||
|
||||
-1
@@ -52,7 +52,6 @@ describe('shouldExecuteIteratorStep', () => {
|
||||
settings: {
|
||||
input: {
|
||||
logicFunctionId: 'mock-function-id',
|
||||
logicFunctionVersion: 'mock-function-version',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
errorHandlingOptions: {
|
||||
|
||||
-1
@@ -52,7 +52,6 @@ describe('shouldSkipIteratorStepExecution', () => {
|
||||
settings: {
|
||||
input: {
|
||||
logicFunctionId: 'mock-function-id',
|
||||
logicFunctionVersion: 'mock-function-version',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
errorHandlingOptions: {
|
||||
|
||||
-3
@@ -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) {
|
||||
|
||||
+1
-3
@@ -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',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
+4
-23
@@ -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);
|
||||
|
||||
-4
@@ -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');
|
||||
}
|
||||
|
||||
+1
-1
@@ -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({
|
||||
|
||||
-2
@@ -10,8 +10,6 @@ const DEFAULT_LOGIC_FUNCTION_GQL_FIELDS = `
|
||||
name
|
||||
description
|
||||
runtime
|
||||
latestVersion
|
||||
publishedVersions
|
||||
createdAt
|
||||
updatedAt
|
||||
`;
|
||||
|
||||
+1
-5
@@ -3,7 +3,6 @@ import gql from 'graphql-tag';
|
||||
export type ExecuteLogicFunctionFactoryInput = {
|
||||
id: string;
|
||||
payload: Record<string, unknown>;
|
||||
version?: string;
|
||||
};
|
||||
|
||||
const DEFAULT_EXECUTION_RESULT_GQL_FIELDS = `
|
||||
@@ -29,9 +28,6 @@ export const executeLogicFunctionQueryFactory = ({
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
input: {
|
||||
...input,
|
||||
version: input.version ?? 'latest',
|
||||
},
|
||||
input,
|
||||
},
|
||||
});
|
||||
|
||||
-2
@@ -7,8 +7,6 @@ export type PublishLogicFunctionFactoryInput = {
|
||||
const DEFAULT_LOGIC_FUNCTION_GQL_FIELDS = `
|
||||
id
|
||||
name
|
||||
latestVersion
|
||||
publishedVersions
|
||||
`;
|
||||
|
||||
export const publishLogicFunctionQueryFactory = ({
|
||||
|
||||
-1
@@ -14,7 +14,6 @@ const DEFAULT_LOGIC_FUNCTION_GQL_FIELDS = `
|
||||
id
|
||||
name
|
||||
description
|
||||
latestVersion
|
||||
`;
|
||||
|
||||
export const updateLogicFunctionQueryFactory = ({
|
||||
|
||||
@@ -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()),
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user