Skip to content

The open alternative to Salesforce, designed for AI.

Remove the legacy workspace-id workflow GraphQL API (#27856)

Thomas Trompette4f96aabb3484
diff --git a/packages/twenty-front/src/generated/graphql.ts b/packages/twenty-front/src/generated/graphql.ts
index 2ff11b4dbed..4b6bff4a550 100644
--- a/packages/twenty-front/src/generated/graphql.ts
+++ b/packages/twenty-front/src/generated/graphql.ts
@@ -52,8 +52,6 @@ export type ComputeStepOutputSchemaInput = {
coreWorkflowVersionId?: InputMaybe<Scalars['UUID']['input']>;
/** Step JSON format */
step: Scalars['JSON']['input'];
- /** Workflow version ID */
- workflowVersionId?: InputMaybe<Scalars['UUID']['input']>;
};
export type ConnectedAccountHandleDto = {
@@ -227,43 +225,6 @@ export type CreateDraftFromCoreWorkflowVersionInput = {
coreWorkflowVersionIdToCopy: Scalars['UUID']['input'];
};
-export type CreateDraftFromWorkflowVersionInput = {
- /** Workflow ID */
- workflowId: Scalars['UUID']['input'];
- /** Workflow version ID */
- workflowVersionIdToCopy: Scalars['UUID']['input'];
-};
-
-export type CreateWorkflowVersionEdgeInput = {
- /** Workflow version source step ID */
- source: Scalars['String']['input'];
- /** Workflow version source step connection options */
- sourceConnectionOptions?: InputMaybe<Scalars['JSON']['input']>;
- /** Workflow version target step ID */
- target: Scalars['String']['input'];
- /** Workflow version ID */
- workflowVersionId: Scalars['String']['input'];
-};
-
-export type CreateWorkflowVersionStepInput = {
- /** Default settings for the step */
- defaultSettings?: InputMaybe<Scalars['JSON']['input']>;
- /** Step ID */
- id?: InputMaybe<Scalars['String']['input']>;
- /** Next step ID */
- nextStepId?: InputMaybe<Scalars['UUID']['input']>;
- /** Parent step connection options */
- parentStepConnectionOptions?: InputMaybe<Scalars['JSON']['input']>;
- /** Parent step ID */
- parentStepId?: InputMaybe<Scalars['String']['input']>;
- /** Step position */
- position?: InputMaybe<WorkflowStepPositionInput>;
- /** New step type */
- stepType: Scalars['String']['input'];
- /** Workflow version ID */
- workflowVersionId: Scalars['UUID']['input'];
-};
-
export type DateTimeFilter = {
eq?: InputMaybe<Scalars['DateTime']['input']>;
gt?: InputMaybe<Scalars['DateTime']['input']>;
@@ -297,13 +258,6 @@ export type DeleteCoreWorkflowsInput = {
coreWorkflowIds: Array<Scalars['UUID']['input']>;
};
-export type DeleteWorkflowVersionStepInput = {
- /** Step to delete ID */
- stepId: Scalars['String']['input'];
- /** Workflow version ID */
- workflowVersionId: Scalars['UUID']['input'];
-};
-
export type DeletedCoreWorkflowDto = {
__typename?: 'DeletedCoreWorkflowDTO';
id: Scalars['UUID']['output'];
@@ -311,8 +265,7 @@ export type DeletedCoreWorkflowDto = {
};
export type DiscardCoreWorkflowDraftInput = {
- coreWorkflowVersionId?: InputMaybe<Scalars['UUID']['input']>;
- workspaceWorkflowVersionId?: InputMaybe<Scalars['UUID']['input']>;
+ coreWorkflowVersionId: Scalars['UUID']['input'];
};
export type DpaAgreement = {
@@ -382,18 +335,6 @@ export type DuplicateCoreWorkflowVersionStepInput = {
stepId: Scalars['String']['input'];
};
-export type DuplicateWorkflowInput = {
- /** Workflow ID to duplicate */
- workflowIdToDuplicate: Scalars['UUID']['input'];
- /** Workflow version ID to copy */
- workflowVersionIdToCopy: Scalars['UUID']['input'];
-};
-
-export type DuplicateWorkflowVersionStepInput = {
- stepId: Scalars['String']['input'];
- workflowVersionId: Scalars['String']['input'];
-};
-
export enum FilterIs {
NotNull = 'NotNull',
Null = 'Null'
@@ -433,34 +374,24 @@ export enum MessageChannelVisibility {
export type Mutation = {
__typename?: 'Mutation';
activateCoreWorkflowVersion: Scalars['Boolean']['output'];
- activateWorkflowVersion: Scalars['Boolean']['output'];
answerToolCall: AnswerToolCallResult;
computeStepOutputSchema: Scalars['JSON']['output'];
createCoreWorkflow: CoreWorkflowDto;
createCoreWorkflowVersionEdge: WorkflowVersionStepChanges;
createCoreWorkflowVersionStep: WorkflowVersionStepChanges;
createDraftFromCoreWorkflowVersion: CoreWorkflowVersionDto;
- createDraftFromWorkflowVersion: WorkflowVersionDto;
- createWorkflowVersionEdge: WorkflowVersionStepChanges;
- createWorkflowVersionStep: WorkflowVersionStepChanges;
deactivateCoreWorkflowVersion: Scalars['Boolean']['output'];
- deactivateWorkflowVersion: Scalars['Boolean']['output'];
deleteCoreWorkflowVersionEdge: WorkflowVersionStepChanges;
deleteCoreWorkflowVersionStep: WorkflowVersionStepChanges;
deleteCoreWorkflows: Array<DeletedCoreWorkflowDto>;
- deleteWorkflowVersionEdge: WorkflowVersionStepChanges;
- deleteWorkflowVersionStep: WorkflowVersionStepChanges;
discardCoreWorkflowDraft?: Maybe<CoreWorkflowDto>;
dismissMaintenanceModeBanner: Scalars['Boolean']['output'];
dismissReconnectAccountBanner: Scalars['Boolean']['output'];
duplicateCoreWorkflow: CoreWorkflowDto;
duplicateCoreWorkflowVersionStep: WorkflowVersionStepChanges;
- duplicateWorkflow: WorkflowVersionDto;
- duplicateWorkflowVersionStep: WorkflowVersionStepChanges;
generateSignedDpa: GenerateSignedDpaResult;
retryWorkflowRun: WorkflowRun;
runCoreWorkflowVersion: RunWorkflowVersion;
- runWorkflowVersion: RunWorkflowVersion;
stopWorkflowRun: WorkflowRun;
submitFormStep: Scalars['Boolean']['output'];
testHttpRequest: TestHttpRequest;
@@ -470,10 +401,6 @@ export type Mutation = {
updateCoreWorkflowVersionTrigger: WorkflowVersionTrigger;
updateCoreWorkflowVisibility?: Maybe<CoreWorkflowDto>;
updateWorkflowRunStep: WorkflowAction;
- updateWorkflowVersionPositions: Scalars['Boolean']['output'];
- updateWorkflowVersionStep: WorkflowAction;
- updateWorkflowVersionTrigger: WorkflowVersionTrigger;
- validateWorkflowVersion: Scalars['Boolean']['output'];
};
@@ -482,11 +409,6 @@ export type MutationActivateCoreWorkflowVersionArgs = {
};
-export type MutationActivateWorkflowVersionArgs = {
- workflowVersionId: Scalars['UUID']['input'];
-};
-
-
export type MutationAnswerToolCallArgs = {
input: AnswerToolCallInput;
};
@@ -517,31 +439,11 @@ export type MutationCreateDraftFromCoreWorkflowVersionArgs = {
};
-export type MutationCreateDraftFromWorkflowVersionArgs = {
- input: CreateDraftFromWorkflowVersionInput;
-};
-
-
-export type MutationCreateWorkflowVersionEdgeArgs = {
- input: CreateWorkflowVersionEdgeInput;
-};
-
-
-export type MutationCreateWorkflowVersionStepArgs = {
- input: CreateWorkflowVersionStepInput;
-};
-
-
export type MutationDeactivateCoreWorkflowVersionArgs = {
coreWorkflowVersionId: Scalars['UUID']['input'];
};
-export type MutationDeactivateWorkflowVersionArgs = {
- workflowVersionId: Scalars['UUID']['input'];
-};
-
-
export type MutationDeleteCoreWorkflowVersionEdgeArgs = {
input: DeleteCoreWorkflowVersionEdgeInput;
};
@@ -557,16 +459,6 @@ export type MutationDeleteCoreWorkflowsArgs = {
};
-export type MutationDeleteWorkflowVersionEdgeArgs = {
- input: CreateWorkflowVersionEdgeInput;
-};
-
-
-export type MutationDeleteWorkflowVersionStepArgs = {
- input: DeleteWorkflowVersionStepInput;
-};
-
-
export type MutationDiscardCoreWorkflowDraftArgs = {
input: DiscardCoreWorkflowDraftInput;
};
@@ -587,16 +479,6 @@ export type MutationDuplicateCoreWorkflowVersionStepArgs = {
};
-export type MutationDuplicateWorkflowArgs = {
- input: DuplicateWorkflowInput;
-};
-
-
-export type MutationDuplicateWorkflowVersionStepArgs = {
- input: DuplicateWorkflowVersionStepInput;
-};
-
-
export type MutationGenerateSignedDpaArgs = {
input: GenerateSignedDpaInput;
};
@@ -612,11 +494,6 @@ export type MutationRunCoreWorkflowVersionArgs = {
};
-export type MutationRunWorkflowVersionArgs = {
- input: RunWorkflowVersionInput;
-};
-
-
export type MutationStopWorkflowRunArgs = {
workflowRunId: Scalars['UUID']['input'];
};
@@ -661,26 +538,6 @@ export type MutationUpdateWorkflowRunStepArgs = {
input: UpdateWorkflowRunStepInput;
};
-
-export type MutationUpdateWorkflowVersionPositionsArgs = {
- input: UpdateWorkflowVersionPositionsInput;
-};
-
-
-export type MutationUpdateWorkflowVersionStepArgs = {
- input: UpdateWorkflowVersionStepInput;
-};
-
-
-export type MutationUpdateWorkflowVersionTriggerArgs = {
- input: UpdateWorkflowVersionTriggerInput;
-};
-
-
-export type MutationValidateWorkflowVersionArgs = {
- workflowVersionId: Scalars['UUID']['input'];
-};
-
export type ObjectRecordFilterInput = {
and?: InputMaybe<Array<ObjectRecordFilterInput>>;
createdAt?: InputMaybe<DateTimeFilter>;
@@ -720,7 +577,6 @@ export type Query = {
isMaintenanceModeBannerDismissed: Scalars['Boolean']['output'];
search: SearchResultConnection;
workflowStepConnectedAccountHandle?: Maybe<ConnectedAccountHandleDto>;
- workflowVersionContent: WorkflowVersionContent;
};
@@ -841,11 +697,6 @@ export type QueryWorkflowStepConnectedAccountHandleArgs = {
connectedAccountId: Scalars['UUID']['input'];
};
-
-export type QueryWorkflowVersionContentArgs = {
- workflowVersionId: Scalars['UUID']['input'];
-};
-
export type RunCoreWorkflowVersionInput = {
/** Core workflow version ID */
coreWorkflowVersionId: Scalars['UUID']['input'];
@@ -860,15 +711,6 @@ export type RunWorkflowVersion = {
workflowRunId: Scalars['UUID']['output'];
};
-export type RunWorkflowVersionInput = {
- /** Execution result in JSON format */
- payload?: InputMaybe<Scalars['JSON']['input']>;
- /** Workflow run ID */
- workflowRunId?: InputMaybe<Scalars['UUID']['input']>;
- /** Workflow version ID */
- workflowVersionId: Scalars['UUID']['input'];
-};
-
export type SearchRecord = {
__typename?: 'SearchRecord';
imageUrl?: Maybe<Scalars['String']['output']>;
@@ -1060,27 +902,6 @@ export type UpdateWorkflowRunStepInput = {
workflowRunId: Scalars['UUID']['input'];
};
-export type UpdateWorkflowVersionPositionsInput = {
- /** Workflow version updated positions */
- positions: Array<WorkflowStepPositionUpdateInput>;
- /** Workflow version ID */
- workflowVersionId: Scalars['UUID']['input'];
-};
-
-export type UpdateWorkflowVersionStepInput = {
- /** Step to update in JSON format */
- step: Scalars['JSON']['input'];
- /** Workflow version ID */
- workflowVersionId: Scalars['UUID']['input'];
-};
-
-export type UpdateWorkflowVersionTriggerInput = {
- /** Trigger to update in JSON format */
- trigger: Scalars['JSON']['input'];
- /** Workflow version ID */
- workflowVersionId: Scalars['UUID']['input'];
-};
-
export type WorkflowAction = {
__typename?: 'WorkflowAction';
id: Scalars['UUID']['output'];
@@ -1152,25 +973,6 @@ export type WorkflowStepPositionUpdateInput = {
position: WorkflowStepPositionInput;
};
-export type WorkflowVersionContent = {
- __typename?: 'WorkflowVersionContent';
- steps?: Maybe<Scalars['JSON']['output']>;
- trigger?: Maybe<Scalars['JSON']['output']>;
- workflowVersionId: Scalars['UUID']['output'];
-};
-
-export type WorkflowVersionDto = {
- __typename?: 'WorkflowVersionDTO';
- createdAt: Scalars['String']['output'];
- id: Scalars['UUID']['output'];
- name: Scalars['String']['output'];
- status: Scalars['String']['output'];
- steps?: Maybe<Scalars['JSON']['output']>;
- trigger?: Maybe<Scalars['JSON']['output']>;
- updatedAt: Scalars['String']['output'];
- workflowId: Scalars['UUID']['output'];
-};
-
export type WorkflowVersionStepChanges = {
__typename?: 'WorkflowVersionStepChanges';
stepsDiff?: Maybe<Scalars['JSON']['output']>;
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/compute-step-output-schema.input.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/compute-step-output-schema.input.ts
index d8c916c19bb..84f642520b9 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/dtos/compute-step-output-schema.input.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/dtos/compute-step-output-schema.input.ts
@@ -14,12 +14,6 @@ export class ComputeStepOutputSchemaInput {
})
step: WorkflowTrigger | WorkflowAction;
- @Field(() => UUIDScalarType, {
- description: 'Workflow version ID',
- nullable: true,
- })
- workflowVersionId?: string;
-
@Field(() => UUIDScalarType, {
description: 'Core workflow version ID',
nullable: true,
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/create-draft-from-workflow-version.input.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/create-draft-from-workflow-version.input.ts
deleted file mode 100644
index f9c76ac6ce3..00000000000
--- a/packages/twenty-server/src/engine/core-modules/workflow/dtos/create-draft-from-workflow-version.input.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Field, InputType } from '@nestjs/graphql';
-
-import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
-
-@InputType()
-export class CreateDraftFromWorkflowVersionInput {
- @Field(() => UUIDScalarType, {
- description: 'Workflow ID',
- nullable: false,
- })
- workflowId: string;
-
- @Field(() => UUIDScalarType, {
- description: 'Workflow version ID',
- nullable: false,
- })
- workflowVersionIdToCopy: string;
-}
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/discard-core-workflow-draft.input.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/discard-core-workflow-draft.input.ts
index c5ec456d00b..3ade2783b60 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/dtos/discard-core-workflow-draft.input.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/dtos/discard-core-workflow-draft.input.ts
@@ -1,18 +1,12 @@
import { Field, InputType } from '@nestjs/graphql';
-import { IsOptional, IsUUID } from 'class-validator';
+import { IsUUID } from 'class-validator';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
@InputType()
export class DiscardCoreWorkflowDraftInput {
- @Field(() => UUIDScalarType, { nullable: true })
- @IsOptional()
+ @Field(() => UUIDScalarType)
@IsUUID()
- workspaceWorkflowVersionId?: string;
-
- @Field(() => UUIDScalarType, { nullable: true })
- @IsOptional()
- @IsUUID()
- coreWorkflowVersionId?: string;
+ coreWorkflowVersionId: string;
}
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/duplicate-workflow.input.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/duplicate-workflow.input.ts
deleted file mode 100644
index dc6d6a6e224..00000000000
--- a/packages/twenty-server/src/engine/core-modules/workflow/dtos/duplicate-workflow.input.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Field, InputType } from '@nestjs/graphql';
-
-import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
-
-@InputType()
-export class DuplicateWorkflowInput {
- @Field(() => UUIDScalarType, {
- description: 'Workflow ID to duplicate',
- nullable: false,
- })
- workflowIdToDuplicate: string;
-
- @Field(() => UUIDScalarType, {
- description: 'Workflow version ID to copy',
- nullable: false,
- })
- workflowVersionIdToCopy: string;
-}
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/workflow-version-content.dto.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/workflow-version-content.dto.ts
deleted file mode 100644
index 9cd2b32ca97..00000000000
--- a/packages/twenty-server/src/engine/core-modules/workflow/dtos/workflow-version-content.dto.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Field, ObjectType } from '@nestjs/graphql';
-
-import GraphQLJSON from 'graphql-type-json';
-
-import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
-import { WorkflowAction } from 'src/modules/workflow/workflow-executor/workflow-actions/types/workflow-action.type';
-import { WorkflowTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type';
-
-@ObjectType('WorkflowVersionContent')
-export class WorkflowVersionContentDTO {
- @Field(() => UUIDScalarType)
- workflowVersionId: string;
-
- @Field(() => GraphQLJSON, { nullable: true })
- trigger: WorkflowTrigger | null;
-
- @Field(() => GraphQLJSON, { nullable: true })
- steps: WorkflowAction[] | null;
-}
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/dtos/workflow-version.dto.ts b/packages/twenty-server/src/engine/core-modules/workflow/dtos/workflow-version.dto.ts
deleted file mode 100644
index 6fa822248ec..00000000000
--- a/packages/twenty-server/src/engine/core-modules/workflow/dtos/workflow-version.dto.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { Field, ObjectType } from '@nestjs/graphql';
-
-import GraphQLJSON from 'graphql-type-json';
-
-import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
-import { WorkflowVersionStatus } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity';
-import { WorkflowAction } from 'src/modules/workflow/workflow-executor/workflow-actions/types/workflow-action.type';
-import { WorkflowTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type';
-
-@ObjectType('WorkflowVersionDTO')
-export class WorkflowVersionDTO {
- @Field(() => UUIDScalarType)
- id: string;
-
- @Field(() => String)
- name: string;
-
- @Field(() => String)
- createdAt: string;
-
- @Field(() => String)
- updatedAt: string;
-
- @Field(() => UUIDScalarType)
- workflowId: string;
-
- @Field(() => String)
- status: WorkflowVersionStatus;
-
- @Field(() => GraphQLJSON, { nullable: true })
- trigger: WorkflowTrigger | null;
-
- @Field(() => GraphQLJSON, { nullable: true })
- steps: WorkflowAction[] | null;
-}
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-builder.resolver.ts b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-builder.resolver.ts
index 066b89ef906..bd11b1664ce 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-builder.resolver.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-builder.resolver.ts
@@ -21,7 +21,6 @@ import {
WorkflowQueryValidationException,
WorkflowQueryValidationExceptionCode,
} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception';
-import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service';
import { type WorkflowAction } from 'src/modules/workflow/workflow-executor/workflow-actions/types/workflow-action.type';
import { type WorkflowTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type';
import { CoreWorkflowAccessService } from 'src/engine/core-modules/workflow/services/core-workflow-access.service';
@@ -61,7 +60,6 @@ import { AuthGraphqlApiExceptionFilter } from 'src/engine/core-modules/auth/filt
export class WorkflowBuilderResolver {
constructor(
private readonly workflowSchemaWorkspaceService: WorkflowSchemaWorkspaceService,
- private readonly workflowCommonWorkspaceService: WorkflowCommonWorkspaceService,
@InjectWorkspaceScopedRepository(WorkflowVersionEntity)
private readonly coreWorkflowVersionRepository: WorkspaceScopedRepository<WorkflowVersionEntity>,
private readonly coreWorkflowAccessService: CoreWorkflowAccessService,
@@ -73,11 +71,7 @@ export class WorkflowBuilderResolver {
userWorkspaceId: string | undefined,
@AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
@Args('input')
- {
- step,
- workflowVersionId,
- coreWorkflowVersionId,
- }: ComputeStepOutputSchemaInput,
+ { step, coreWorkflowVersionId }: ComputeStepOutputSchemaInput,
): Promise<OutputSchema> {
return this.workflowSchemaWorkspaceService.computeStepOutputSchema({
step,
@@ -85,7 +79,6 @@ export class WorkflowBuilderResolver {
workflowVersionContent: await this.resolveWorkflowVersionContent({
workspaceId,
userWorkspaceId,
- workflowVersionId,
coreWorkflowVersionId,
}),
});
@@ -94,65 +87,45 @@ export class WorkflowBuilderResolver {
private async resolveWorkflowVersionContent({
workspaceId,
userWorkspaceId,
- workflowVersionId,
coreWorkflowVersionId,
}: {
workspaceId: string;
userWorkspaceId: string | undefined;
- workflowVersionId?: string;
coreWorkflowVersionId?: string;
}): Promise<
| { trigger: WorkflowTrigger | null; steps: WorkflowAction[] | null }
| undefined
> {
- if (isDefined(coreWorkflowVersionId)) {
- await this.coreWorkflowAccessService.assertCoreWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- coreWorkflowVersionIds: [coreWorkflowVersionId],
- },
- );
-
- const coreWorkflowVersion =
- await this.coreWorkflowVersionRepository.findOne(workspaceId, {
- where: { id: coreWorkflowVersionId },
- });
-
- if (!isDefined(coreWorkflowVersion)) {
- throw new WorkflowQueryValidationException(
- `Core workflow version '${coreWorkflowVersionId}' not found`,
- WorkflowQueryValidationExceptionCode.FORBIDDEN,
- {
- userFriendlyMessage: msg`Workflow version not found`,
- },
- );
- }
-
- return {
- trigger: coreWorkflowVersion.triggers?.[0] ?? null,
- steps: coreWorkflowVersion.steps,
- };
- }
-
- if (!isDefined(workflowVersionId)) {
+ if (!isDefined(coreWorkflowVersionId)) {
return undefined;
}
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
+ await this.coreWorkflowAccessService.assertCoreWorkflowVersionsAreAccessibleOrThrow(
{
workspaceId,
userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
+ coreWorkflowVersionIds: [coreWorkflowVersionId],
},
);
- const workflowVersion =
- await this.workflowCommonWorkspaceService.getWorkflowVersionOrFail({
- workflowVersionId,
- workspaceId,
+ const coreWorkflowVersion =
+ await this.coreWorkflowVersionRepository.findOne(workspaceId, {
+ where: { id: coreWorkflowVersionId },
});
- return { trigger: workflowVersion.trigger, steps: workflowVersion.steps };
+ if (!isDefined(coreWorkflowVersion)) {
+ throw new WorkflowQueryValidationException(
+ `Core workflow version '${coreWorkflowVersionId}' not found`,
+ WorkflowQueryValidationExceptionCode.FORBIDDEN,
+ {
+ userFriendlyMessage: msg`Workflow version not found`,
+ },
+ );
+ }
+
+ return {
+ trigger: coreWorkflowVersion.triggers?.[0] ?? null,
+ steps: coreWorkflowVersion.steps,
+ };
}
}
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-trigger.resolver.ts b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-trigger.resolver.ts
index e8594f838ef..430b7e635ec 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-trigger.resolver.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-trigger.resolver.ts
@@ -7,29 +7,17 @@ import { CoreResolver } from 'src/engine/api/graphql/graphql-config/decorators/c
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { PreventNestToAutoLogGraphqlErrorsFilter } from 'src/engine/core-modules/graphql/filters/prevent-nest-to-auto-log-graphql-errors.filter';
import { ResolverValidationPipe } from 'src/engine/core-modules/graphql/pipes/resolver-validation.pipe';
-import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
-import { type AuthContextUser } from 'src/engine/core-modules/auth/types/auth-context.type';
import { AuthGraphqlApiExceptionFilter } from 'src/engine/core-modules/auth/filters/auth-graphql-api-exception.filter';
-import { RunWorkflowVersionInput } from 'src/engine/core-modules/workflow/dtos/run-workflow-version.input';
-import { RunWorkflowVersionDTO } from 'src/engine/core-modules/workflow/dtos/run-workflow-version.dto';
import { WorkflowRunDTO } from 'src/engine/core-modules/workflow/dtos/workflow-run.dto';
import { WorkflowQueryValidationGraphqlApiExceptionFilter } from 'src/engine/core-modules/workflow/filters/workflow-query-validation-graphql-api-exception.filter';
import { WorkflowTriggerGraphqlApiExceptionFilter } from 'src/engine/core-modules/workflow/filters/workflow-trigger-graphql-api-exception.filter';
import { WorkflowVersionValidationGraphqlApiExceptionFilter } from 'src/engine/core-modules/workflow/filters/workflow-version-validation-graphql-api-exception.filter';
import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
-import { AuthApplication } from 'src/engine/decorators/auth/auth-application.decorator';
-import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator';
-import { AuthUserWorkspaceId } from 'src/engine/decorators/auth/auth-user-workspace-id.decorator';
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';
import { SettingsPermissionGuard } from 'src/engine/guards/settings-permission.guard';
import { AuthPrincipalGuard } from 'src/engine/guards/auth-principal.guard';
import { PermissionsGraphqlApiExceptionFilter } from 'src/engine/metadata-modules/permissions/utils/permissions-graphql-api-exception.filter';
-import { WorkspaceOrmManager } from 'src/engine/twenty-orm/workspace-orm.manager';
-import { buildSystemAuthContext } from 'src/engine/twenty-orm/utils/build-system-auth-context.util';
-import { buildWorkflowRunTriggerContext } from 'src/modules/workflow/workflow-trigger/utils/build-workflow-run-trigger-context.util';
-import { CoreWorkflowAccessService } from 'src/engine/core-modules/workflow/services/core-workflow-access.service';
-import { WorkflowTriggerWorkspaceService } from 'src/modules/workflow/workflow-trigger/workspace-services/workflow-trigger.workspace-service';
-import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity';
+import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service';
@CoreResolver()
@UseGuards(
@@ -57,137 +45,18 @@ import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/sta
)
export class WorkflowTriggerResolver {
constructor(
- private readonly workspaceOrmManager: WorkspaceOrmManager,
- private readonly workflowTriggerWorkspaceService: WorkflowTriggerWorkspaceService,
- private readonly coreWorkflowAccessService: CoreWorkflowAccessService,
+ private readonly workflowRunnerWorkspaceService: WorkflowRunnerWorkspaceService,
) {}
- @Mutation(() => Boolean)
- async activateWorkflowVersion(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() workspace: WorkspaceEntity,
- @Args('workflowVersionId', { type: () => UUIDScalarType })
- workflowVersionId: string,
- ) {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId: workspace.id,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- return this.workflowTriggerWorkspaceService.activateWorkflowVersion(
- workflowVersionId,
- workspace.id,
- );
- }
-
- @Mutation(() => Boolean)
- async deactivateWorkflowVersion(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() workspace: WorkspaceEntity,
- @Args('workflowVersionId', { type: () => UUIDScalarType })
- workflowVersionId: string,
- ) {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId: workspace.id,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- return this.workflowTriggerWorkspaceService.deactivateWorkflowVersion(
- workflowVersionId,
- workspace.id,
- );
- }
-
- @Mutation(() => RunWorkflowVersionDTO)
- @UseGuards(
- AuthPrincipalGuard({
- userSession: {
- standard: true,
- impersonated: true,
- playground: true,
- workspaceAgnostic: false,
- },
- apiKey: false,
- oauthClient: { withUser: true, withoutUser: false },
- application: { withUser: true, withoutUser: false },
- }),
- )
- async runWorkflowVersion(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthUser() user: AuthContextUser,
- @AuthWorkspace() workspace: WorkspaceEntity,
- @AuthApplication({ allowUndefined: true })
- callerApplication: FlatApplication | undefined,
- @Args('input')
- { workflowVersionId, workflowRunId, payload }: RunWorkflowVersionInput,
- ) {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId: workspace.id,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreStartableByApplicationOrThrow(
- {
- workspaceId: workspace.id,
- callerApplicationId: callerApplication?.id,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- const authContext = buildSystemAuthContext(workspace.id);
-
- const workspaceMember =
- await this.workspaceOrmManager.executeInWorkspaceContext(async () => {
- const workspaceMemberRepository =
- this.workspaceOrmManager.getRepository<WorkspaceMemberWorkspaceEntity>(
- 'workspaceMember',
- { shouldBypassPermissionChecks: true },
- );
-
- return workspaceMemberRepository.findOneOrFail({
- where: {
- userId: user.id,
- },
- });
- }, authContext);
-
- const { payload: triggerPayload, createdBy } =
- buildWorkflowRunTriggerContext({
- workspaceMember,
- payload,
- startingApplicationId: callerApplication?.id,
- });
-
- return this.workflowTriggerWorkspaceService.runWorkflowVersion({
- workflowVersionId,
- workflowRunId: workflowRunId ?? undefined,
- payload: triggerPayload,
- createdBy,
- workspaceId: workspace.id,
- });
- }
-
@Mutation(() => WorkflowRunDTO)
async stopWorkflowRun(
@AuthWorkspace() workspace: WorkspaceEntity,
@Args('workflowRunId', { type: () => UUIDScalarType })
workflowRunId: string,
) {
- return this.workflowTriggerWorkspaceService.stopWorkflowRun(
- workflowRunId,
+ return this.workflowRunnerWorkspaceService.stopWorkflowRun(
workspace.id,
+ workflowRunId,
);
}
@@ -197,9 +66,9 @@ export class WorkflowTriggerResolver {
@Args('workflowRunId', { type: () => UUIDScalarType })
workflowRunId: string,
) {
- return this.workflowTriggerWorkspaceService.retryWorkflowRun(
- workflowRunId,
+ return this.workflowRunnerWorkspaceService.retryWorkflowRun(
workspace.id,
+ workflowRunId,
);
}
}
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version-edge.resolver.ts b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version-edge.resolver.ts
deleted file mode 100644
index 9b86cf35ae1..00000000000
--- a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version-edge.resolver.ts
+++ /dev/null
@@ -1,111 +0,0 @@
-import { UseFilters, UseGuards, UsePipes } from '@nestjs/common';
-import { Args, Mutation } from '@nestjs/graphql';
-
-import { PermissionFlagType } from 'twenty-shared/constants';
-
-import { CoreResolver } from 'src/engine/api/graphql/graphql-config/decorators/core-resolver.decorator';
-import { PreventNestToAutoLogGraphqlErrorsFilter } from 'src/engine/core-modules/graphql/filters/prevent-nest-to-auto-log-graphql-errors.filter';
-import { ResolverValidationPipe } from 'src/engine/core-modules/graphql/pipes/resolver-validation.pipe';
-import { CreateWorkflowVersionEdgeInput } from 'src/engine/core-modules/workflow/dtos/create-workflow-version-edge.input';
-import { WorkflowVersionStepChangesDTO } from 'src/engine/core-modules/workflow/dtos/workflow-version-step-changes.dto';
-import { WorkflowVersionValidationGraphqlApiExceptionFilter } from 'src/engine/core-modules/workflow/filters/workflow-version-validation-graphql-api-exception.filter';
-import { WorkflowVersionEdgeGraphqlApiExceptionFilter } from 'src/engine/core-modules/workflow/filters/workflow-version-edge-graphql-api-exception.filter';
-import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
-import { AuthUserWorkspaceId } from 'src/engine/decorators/auth/auth-user-workspace-id.decorator';
-import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';
-import { SettingsPermissionGuard } from 'src/engine/guards/settings-permission.guard';
-import { AuthPrincipalGuard } from 'src/engine/guards/auth-principal.guard';
-import { PermissionsGraphqlApiExceptionFilter } from 'src/engine/metadata-modules/permissions/utils/permissions-graphql-api-exception.filter';
-import { CoreWorkflowAccessService } from 'src/engine/core-modules/workflow/services/core-workflow-access.service';
-import { WorkflowVersionEdgeWorkspaceService } from 'src/modules/workflow/workflow-builder/workflow-version-edge/workflow-version-edge.workspace-service';
-import { AuthGraphqlApiExceptionFilter } from 'src/engine/core-modules/auth/filters/auth-graphql-api-exception.filter';
-
-@CoreResolver()
-@UsePipes(ResolverValidationPipe)
-@UseGuards(
- AuthPrincipalGuard({
- userSession: {
- standard: true,
- impersonated: true,
- playground: true,
- workspaceAgnostic: false,
- },
- apiKey: false,
- oauthClient: { withUser: true, withoutUser: false },
- application: { withUser: true, withoutUser: false },
- }),
- SettingsPermissionGuard(PermissionFlagType.WORKFLOWS),
-)
-@UseFilters(
- PermissionsGraphqlApiExceptionFilter,
- PreventNestToAutoLogGraphqlErrorsFilter,
- WorkflowVersionEdgeGraphqlApiExceptionFilter,
- WorkflowVersionValidationGraphqlApiExceptionFilter,
- AuthGraphqlApiExceptionFilter,
-)
-export class WorkflowVersionEdgeResolver {
- constructor(
- private readonly workflowVersionEdgeWorkspaceService: WorkflowVersionEdgeWorkspaceService,
- private readonly coreWorkflowAccessService: CoreWorkflowAccessService,
- ) {}
-
- @Mutation(() => WorkflowVersionStepChangesDTO)
- async createWorkflowVersionEdge(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- {
- source,
- target,
- workflowVersionId,
- sourceConnectionOptions,
- }: CreateWorkflowVersionEdgeInput,
- ): Promise<WorkflowVersionStepChangesDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- return this.workflowVersionEdgeWorkspaceService.createWorkflowVersionEdge({
- source,
- target,
- workflowVersionId,
- workspaceId,
- sourceConnectionOptions,
- });
- }
-
- @Mutation(() => WorkflowVersionStepChangesDTO)
- async deleteWorkflowVersionEdge(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- {
- source,
- target,
- workflowVersionId,
- sourceConnectionOptions,
- }: CreateWorkflowVersionEdgeInput,
- ): Promise<WorkflowVersionStepChangesDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- return this.workflowVersionEdgeWorkspaceService.deleteWorkflowVersionEdge({
- source,
- target,
- workflowVersionId,
- workspaceId,
- sourceConnectionOptions,
- });
- }
-}
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version-step.resolver.ts b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version-step.resolver.ts
index 28f7191a6f9..b126f790c39 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version-step.resolver.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version-step.resolver.ts
@@ -10,34 +10,24 @@ import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/
import { PreventNestToAutoLogGraphqlErrorsFilter } from 'src/engine/core-modules/graphql/filters/prevent-nest-to-auto-log-graphql-errors.filter';
import { ResolverValidationPipe } from 'src/engine/core-modules/graphql/pipes/resolver-validation.pipe';
import { HttpTool } from 'src/engine/core-modules/tool/tools/http-tool/http-tool';
-import { CreateWorkflowVersionStepInput } from 'src/engine/core-modules/workflow/dtos/create-workflow-version-step.input';
-import { DeleteWorkflowVersionStepInput } from 'src/engine/core-modules/workflow/dtos/delete-workflow-version-step.input';
-import { DuplicateWorkflowVersionStepInput } from 'src/engine/core-modules/workflow/dtos/duplicate-workflow-version-step.input';
import { TestHttpRequestInput } from 'src/engine/core-modules/workflow/dtos/test-http-request.input';
import { TestHttpRequestDTO } from 'src/engine/core-modules/workflow/dtos/test-http-request.dto';
import { SubmitFormStepInput } from 'src/engine/core-modules/workflow/dtos/submit-form-step.input';
import { UpdateWorkflowRunStepInput } from 'src/engine/core-modules/workflow/dtos/update-workflow-run-step.input';
-import { UpdateWorkflowVersionStepInput } from 'src/engine/core-modules/workflow/dtos/update-workflow-version-step.input';
-import { UpdateWorkflowVersionTriggerInput } from 'src/engine/core-modules/workflow/dtos/update-workflow-version-trigger.input';
import { WorkflowActionDTO } from 'src/engine/core-modules/workflow/dtos/workflow-action.dto';
-import { WorkflowVersionStepChangesDTO } from 'src/engine/core-modules/workflow/dtos/workflow-version-step-changes.dto';
-import { WorkflowVersionTriggerDTO } from 'src/engine/core-modules/workflow/dtos/workflow-version-trigger.dto';
import { WorkflowVersionValidationGraphqlApiExceptionFilter } from 'src/engine/core-modules/workflow/filters/workflow-version-validation-graphql-api-exception.filter';
import { WorkflowVersionStepGraphqlApiExceptionFilter } from 'src/engine/core-modules/workflow/filters/workflow-version-step-graphql-api-exception.filter';
import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
-import { AuthUserWorkspaceId } from 'src/engine/decorators/auth/auth-user-workspace-id.decorator';
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';
import { SettingsPermissionGuard } from 'src/engine/guards/settings-permission.guard';
import { AuthPrincipalGuard } from 'src/engine/guards/auth-principal.guard';
import { ConnectedAccountMetadataService } from 'src/engine/metadata-modules/connected-account/connected-account-metadata.service';
import { ConnectedAccountHandleDTO } from 'src/engine/metadata-modules/connected-account/dtos/connected-account-handle.dto';
import { PermissionsGraphqlApiExceptionFilter } from 'src/engine/metadata-modules/permissions/utils/permissions-graphql-api-exception.filter';
-import { CoreWorkflowAccessService } from 'src/engine/core-modules/workflow/services/core-workflow-access.service';
import {
WorkflowVersionStepException,
WorkflowVersionStepExceptionCode,
} from 'src/modules/workflow/common/exceptions/workflow-version-step.exception';
-import { WorkflowVersionStepWorkspaceService } from 'src/modules/workflow/workflow-builder/workflow-version-step/workflow-version-step.workspace-service';
import { canUpdateWorkflowRunStep } from 'src/modules/workflow/workflow-runner/utils/can-update-workflow-run-step.util';
import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-run/workflow-run.workspace-service';
import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service';
@@ -68,12 +58,10 @@ import { AuthGraphqlApiExceptionFilter } from 'src/engine/core-modules/auth/filt
)
export class WorkflowVersionStepResolver {
constructor(
- private readonly workflowVersionStepWorkspaceService: WorkflowVersionStepWorkspaceService,
private readonly workflowRunWorkspaceService: WorkflowRunWorkspaceService,
private readonly workflowRunnerWorkspaceService: WorkflowRunnerWorkspaceService,
private readonly httpTool: HttpTool,
private readonly connectedAccountMetadataService: ConnectedAccountMetadataService,
- private readonly coreWorkflowAccessService: CoreWorkflowAccessService,
) {}
// Related to https://github.com/twentyhq/private-issues/issues/478
@@ -99,99 +87,6 @@ export class WorkflowVersionStepResolver {
};
}
- @Mutation(() => WorkflowVersionStepChangesDTO)
- async createWorkflowVersionStep(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- input: CreateWorkflowVersionStepInput,
- ): Promise<WorkflowVersionStepChangesDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [input.workflowVersionId],
- },
- );
-
- return this.workflowVersionStepWorkspaceService.createWorkflowVersionStep({
- workspaceId,
- input,
- });
- }
-
- @Mutation(() => WorkflowActionDTO)
- async updateWorkflowVersionStep(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- { step, workflowVersionId }: UpdateWorkflowVersionStepInput,
- ): Promise<WorkflowActionDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- return this.workflowVersionStepWorkspaceService.updateWorkflowVersionStep({
- workspaceId,
- workflowVersionId,
- step,
- });
- }
-
- @Mutation(() => WorkflowVersionTriggerDTO)
- async updateWorkflowVersionTrigger(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- { trigger, workflowVersionId }: UpdateWorkflowVersionTriggerInput,
- ): Promise<WorkflowVersionTriggerDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- return this.workflowVersionStepWorkspaceService.updateWorkflowVersionTrigger(
- {
- workspaceId,
- workflowVersionId,
- trigger,
- },
- );
- }
-
- @Mutation(() => WorkflowVersionStepChangesDTO)
- async deleteWorkflowVersionStep(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- { stepId, workflowVersionId }: DeleteWorkflowVersionStepInput,
- ): Promise<WorkflowVersionStepChangesDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- return this.workflowVersionStepWorkspaceService.deleteWorkflowVersionStep({
- workspaceId,
- workflowVersionId,
- stepIdToDelete: stepId,
- });
- }
-
@Mutation(() => WorkflowActionDTO)
async updateWorkflowRunStep(
@AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
@@ -256,31 +151,6 @@ export class WorkflowVersionStepResolver {
return true;
}
- @Mutation(() => WorkflowVersionStepChangesDTO)
- async duplicateWorkflowVersionStep(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- { stepId, workflowVersionId }: DuplicateWorkflowVersionStepInput,
- ): Promise<WorkflowVersionStepChangesDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- return this.workflowVersionStepWorkspaceService.duplicateWorkflowVersionStep(
- {
- workspaceId,
- workflowVersionId,
- stepId,
- },
- );
- }
-
@Mutation(() => TestHttpRequestDTO)
async testHttpRequest(
@AuthWorkspace() workspace: WorkspaceEntity,
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version.resolver.ts b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version.resolver.ts
deleted file mode 100644
index 8a4a2d55613..00000000000
--- a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-version.resolver.ts
+++ /dev/null
@@ -1,193 +0,0 @@
-import { UseFilters, UseGuards, UsePipes } from '@nestjs/common';
-import { Args, Mutation, Query } from '@nestjs/graphql';
-
-import { PermissionFlagType } from 'twenty-shared/constants';
-
-import { CoreResolver } from 'src/engine/api/graphql/graphql-config/decorators/core-resolver.decorator';
-import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
-import { PreventNestToAutoLogGraphqlErrorsFilter } from 'src/engine/core-modules/graphql/filters/prevent-nest-to-auto-log-graphql-errors.filter';
-import { WorkflowVersionValidationGraphqlApiExceptionFilter } from 'src/engine/core-modules/workflow/filters/workflow-version-validation-graphql-api-exception.filter';
-import { ResolverValidationPipe } from 'src/engine/core-modules/graphql/pipes/resolver-validation.pipe';
-import { CreateDraftFromWorkflowVersionInput } from 'src/engine/core-modules/workflow/dtos/create-draft-from-workflow-version.input';
-import { DuplicateWorkflowInput } from 'src/engine/core-modules/workflow/dtos/duplicate-workflow.input';
-import { UpdateWorkflowVersionPositionsInput } from 'src/engine/core-modules/workflow/dtos/update-workflow-version-positions.input';
-import { WorkflowVersionContentDTO } from 'src/engine/core-modules/workflow/dtos/workflow-version-content.dto';
-import { WorkflowVersionDTO } from 'src/engine/core-modules/workflow/dtos/workflow-version.dto';
-import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
-import { AuthUserWorkspaceId } from 'src/engine/decorators/auth/auth-user-workspace-id.decorator';
-import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';
-import { SettingsPermissionGuard } from 'src/engine/guards/settings-permission.guard';
-import { AuthPrincipalGuard } from 'src/engine/guards/auth-principal.guard';
-import { PermissionsGraphqlApiExceptionFilter } from 'src/engine/metadata-modules/permissions/utils/permissions-graphql-api-exception.filter';
-import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service';
-import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/workflow-builder/workflow-validation/workflow-version-validation.workspace-service';
-import { CoreWorkflowAccessService } from 'src/engine/core-modules/workflow/services/core-workflow-access.service';
-import { WorkflowVersionWorkspaceService } from 'src/modules/workflow/workflow-builder/workflow-version/workflow-version.workspace-service';
-import { AuthGraphqlApiExceptionFilter } from 'src/engine/core-modules/auth/filters/auth-graphql-api-exception.filter';
-
-@CoreResolver()
-@UsePipes(ResolverValidationPipe)
-@UseGuards(
- AuthPrincipalGuard({
- userSession: {
- standard: true,
- impersonated: true,
- playground: true,
- workspaceAgnostic: false,
- },
- apiKey: false,
- oauthClient: { withUser: true, withoutUser: false },
- application: { withUser: true, withoutUser: false },
- }),
- SettingsPermissionGuard(PermissionFlagType.WORKFLOWS),
-)
-@UseFilters(
- PermissionsGraphqlApiExceptionFilter,
- PreventNestToAutoLogGraphqlErrorsFilter,
- WorkflowVersionValidationGraphqlApiExceptionFilter,
- AuthGraphqlApiExceptionFilter,
-)
-export class WorkflowVersionResolver {
- constructor(
- private readonly workflowVersionWorkspaceService: WorkflowVersionWorkspaceService,
- private readonly workflowCommonWorkspaceService: WorkflowCommonWorkspaceService,
- private readonly workflowVersionValidationWorkspaceService: WorkflowVersionValidationWorkspaceService,
- private readonly coreWorkflowAccessService: CoreWorkflowAccessService,
- ) {}
-
- @Query(() => WorkflowVersionContentDTO)
- async workflowVersionContent(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('workflowVersionId', { type: () => UUIDScalarType })
- workflowVersionId: string,
- ): Promise<WorkflowVersionContentDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- const workflowVersion =
- await this.workflowCommonWorkspaceService.getWorkflowVersionOrFail({
- workspaceId,
- workflowVersionId,
- });
-
- return {
- workflowVersionId,
- trigger: workflowVersion.trigger,
- steps: workflowVersion.steps,
- };
- }
-
- @Mutation(() => Boolean)
- async validateWorkflowVersion(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('workflowVersionId', { type: () => UUIDScalarType })
- workflowVersionId: string,
- ): Promise<boolean> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- const workflowVersion =
- await this.workflowCommonWorkspaceService.getWorkflowVersionOrFail({
- workspaceId,
- workflowVersionId,
- });
-
- await this.workflowVersionValidationWorkspaceService.assertWorkflowVersionIsActivableOrThrow(
- {
- workspaceId,
- trigger: workflowVersion.trigger,
- steps: workflowVersion.steps,
- },
- );
-
- return true;
- }
-
- @Mutation(() => WorkflowVersionDTO)
- async createDraftFromWorkflowVersion(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- {
- workflowId,
- workflowVersionIdToCopy,
- }: CreateDraftFromWorkflowVersionInput,
- ): Promise<WorkflowVersionDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionIdToCopy],
- },
- );
-
- return this.workflowVersionWorkspaceService.createDraftFromWorkflowVersion({
- workspaceId,
- workflowId,
- workflowVersionIdToCopy,
- });
- }
-
- @Mutation(() => WorkflowVersionDTO)
- async duplicateWorkflow(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- { workflowIdToDuplicate, workflowVersionIdToCopy }: DuplicateWorkflowInput,
- ): Promise<WorkflowVersionDTO> {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionIdToCopy],
- },
- );
-
- return this.workflowVersionWorkspaceService.duplicateWorkflow({
- workspaceId,
- workflowIdToDuplicate,
- workflowVersionIdToCopy,
- });
- }
-
- @Mutation(() => Boolean)
- async updateWorkflowVersionPositions(
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @Args('input')
- { workflowVersionId, positions }: UpdateWorkflowVersionPositionsInput,
- ) {
- await this.coreWorkflowAccessService.assertWorkspaceWorkflowVersionsAreAccessibleOrThrow(
- {
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds: [workflowVersionId],
- },
- );
-
- await this.workflowVersionWorkspaceService.updateWorkflowVersionPositions({
- workspaceId,
- workflowVersionId,
- positions,
- });
-
- return true;
- }
-}
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-access.service.ts b/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-access.service.ts
index 5f89d5bf47b..ddf4ce2df5e 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-access.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-access.service.ts
@@ -135,37 +135,6 @@ export class CoreWorkflowAccessService {
}
}
- async assertWorkspaceWorkflowVersionsAreStartableByApplicationOrThrow({
- workspaceId,
- callerApplicationId,
- workspaceWorkflowVersionIds,
- }: {
- workspaceId: string;
- callerApplicationId: string | undefined;
- workspaceWorkflowVersionIds: string[];
- }): Promise<void> {
- if (
- !isDefined(callerApplicationId) ||
- workspaceWorkflowVersionIds.length === 0
- ) {
- return;
- }
-
- const coreWorkflowVersions = await this.coreWorkflowVersionRepository.find(
- workspaceId,
- {
- where: { workspaceWorkflowVersionId: In(workspaceWorkflowVersionIds) },
- select: { id: true },
- },
- );
-
- await this.assertCoreWorkflowVersionsAreStartableByApplicationOrThrow({
- workspaceId,
- callerApplicationId,
- coreWorkflowVersionIds: coreWorkflowVersions.map(({ id }) => id),
- });
- }
-
async assertCoreWorkflowsAreAccessibleOrThrow({
workspaceId,
userWorkspaceId,
@@ -233,66 +202,6 @@ export class CoreWorkflowAccessService {
});
}
- // Legacy resolvers use the workspace mirror's ids, so the same rule is reached from that side.
- async assertWorkspaceWorkflowVersionsAreAccessibleOrThrow({
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowVersionIds,
- }: {
- workspaceId: string;
- userWorkspaceId: string | undefined;
- workspaceWorkflowVersionIds: string[];
- }): Promise<void> {
- if (workspaceWorkflowVersionIds.length === 0) {
- return;
- }
-
- const coreWorkflowVersions = await this.coreWorkflowVersionRepository.find(
- workspaceId,
- {
- where: { workspaceWorkflowVersionId: In(workspaceWorkflowVersionIds) },
- select: { id: true, coreWorkflowId: true },
- },
- );
-
- await this.assertCoreWorkflowsAreAccessibleOrThrow({
- workspaceId,
- userWorkspaceId,
- coreWorkflowIds: [
- ...new Set(
- coreWorkflowVersions
- .map(({ coreWorkflowId }) => coreWorkflowId)
- .filter(isDefined),
- ),
- ],
- });
- }
-
- async assertWorkspaceWorkflowsAreAccessibleOrThrow({
- workspaceId,
- userWorkspaceId,
- workspaceWorkflowIds,
- }: {
- workspaceId: string;
- userWorkspaceId: string | undefined;
- workspaceWorkflowIds: string[];
- }): Promise<void> {
- if (workspaceWorkflowIds.length === 0) {
- return;
- }
-
- const coreWorkflows = await this.coreWorkflowRepository.find(workspaceId, {
- where: { workspaceWorkflowId: In(workspaceWorkflowIds) },
- select: { id: true },
- });
-
- await this.assertCoreWorkflowsAreAccessibleOrThrow({
- workspaceId,
- userWorkspaceId,
- coreWorkflowIds: coreWorkflows.map(({ id }) => id),
- });
- }
-
// The command menu lists every member's manual triggers in one read, so the rule comes back as a filter.
async findInaccessibleWorkflowVersionIds({
workspaceId,
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-mutation.workspace-service.ts b/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-mutation.workspace-service.ts
index 83c604f53ac..b10f49ead81 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-mutation.workspace-service.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/services/core-workflow-mutation.workspace-service.ts
@@ -674,37 +674,14 @@ export class CoreWorkflowMutationWorkspaceService {
async discardDraftVersion({
workspaceId,
userWorkspaceId,
- workspaceWorkflowVersionId,
coreWorkflowVersionId,
}: DiscardCoreWorkflowDraftInput & {
workspaceId: string;
userWorkspaceId: string | undefined;
}): Promise<string | null> {
- if (
- isDefined(workspaceWorkflowVersionId) &&
- isDefined(coreWorkflowVersionId)
- ) {
- throw new WorkflowQueryValidationException(
- 'Only one of workspaceWorkflowVersionId or coreWorkflowVersionId may be provided',
- WorkflowQueryValidationExceptionCode.FORBIDDEN,
- {
- userFriendlyMessage: msg`Only one workflow version identifier may be provided`,
- },
- );
- }
-
- const resolvedCoreVersionId = await this.resolveDiscardTargetCoreVersionId(
- workspaceId,
- { workspaceWorkflowVersionId, coreWorkflowVersionId },
- );
-
- if (!isDefined(resolvedCoreVersionId)) {
- return null;
- }
-
const coreVersion = await this.coreWorkflowVersionRepository.findOne(
workspaceId,
- { where: { id: resolvedCoreVersionId } },
+ { where: { id: coreWorkflowVersionId } },
);
if (!isDefined(coreVersion)) {
@@ -831,60 +808,6 @@ export class CoreWorkflowMutationWorkspaceService {
}
}
- private async resolveDiscardTargetCoreVersionId(
- workspaceId: string,
- {
- workspaceWorkflowVersionId,
- coreWorkflowVersionId,
- }: DiscardCoreWorkflowDraftInput,
- ): Promise<string | null> {
- if (isDefined(coreWorkflowVersionId)) {
- return coreWorkflowVersionId;
- }
-
- if (!isDefined(workspaceWorkflowVersionId)) {
- throw new WorkflowQueryValidationException(
- 'Either workspaceWorkflowVersionId or coreWorkflowVersionId must be provided',
- WorkflowQueryValidationExceptionCode.FORBIDDEN,
- {
- userFriendlyMessage: msg`Workflow version is missing from the request`,
- },
- );
- }
-
- return this.workspaceOrmManager.executeInWorkspaceContext(async () => {
- const workflowVersionRepository =
- this.workspaceOrmManager.getRepository<WorkflowVersionWorkspaceEntity>(
- 'workflowVersion',
- { shouldBypassPermissionChecks: true },
- );
-
- const workspaceVersion = await workflowVersionRepository.findOne({
- where: { id: workspaceWorkflowVersionId },
- withDeleted: true,
- });
-
- if (
- !isDefined(workspaceVersion) ||
- isDefined(workspaceVersion.deletedAt)
- ) {
- return null;
- }
-
- if (!isDefined(workspaceVersion.coreWorkflowVersionId)) {
- throw new WorkflowQueryValidationException(
- `Workspace version '${workspaceWorkflowVersionId}' has no core twin`,
- WorkflowQueryValidationExceptionCode.FORBIDDEN,
- {
- userFriendlyMessage: msg`Workflow version is not correctly linked to its mirror`,
- },
- );
- }
-
- return workspaceVersion.coreWorkflowVersionId;
- }, buildSystemAuthContext(workspaceId));
- }
-
async updateWorkflowVisibility({
workspaceId,
userWorkspaceId,
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/workflow-api.module.ts b/packages/twenty-server/src/engine/core-modules/workflow/workflow-api.module.ts
index 0daaf9299db..209ef02afe9 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/workflow-api.module.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/workflow-api.module.ts
@@ -9,9 +9,7 @@ import { CoreWorkflowResolver } from 'src/engine/core-modules/workflow/resolvers
import { CoreWorkflowVersionMutationResolver } from 'src/engine/core-modules/workflow/resolvers/core-workflow-version-mutation.resolver';
import { WorkflowBuilderResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-builder.resolver';
import { WorkflowTriggerResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-trigger.resolver';
-import { WorkflowVersionEdgeResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-version-edge.resolver';
import { WorkflowVersionStepResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-version-step.resolver';
-import { WorkflowVersionResolver } from 'src/engine/core-modules/workflow/resolvers/workflow-version.resolver';
import { CoreWorkflowAccessModule } from 'src/engine/core-modules/workflow/core-workflow-access.module';
import { CoreWorkflowServicesModule } from 'src/engine/core-modules/workflow/core-workflow-services.module';
import { WorkflowCoreModule } from 'src/engine/core-modules/workflow/workflow-core.module';
@@ -23,7 +21,6 @@ import { ConnectedAccountMetadataModule } from 'src/engine/metadata-modules/conn
import { PermissionsModule } from 'src/engine/metadata-modules/permissions/permissions.module';
import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-common.module';
import { WorkflowBuilderModule } from 'src/modules/workflow/workflow-builder/workflow-builder.module';
-import { WorkflowVersionModule } from 'src/modules/workflow/workflow-builder/workflow-version/workflow-version.module';
import { WorkflowRunModule } from 'src/modules/workflow/workflow-runner/workflow-run/workflow-run.module';
import { WorkflowRunnerModule } from 'src/modules/workflow/workflow-runner/workflow-runner.module';
import { WorkflowTriggerModule } from 'src/modules/workflow/workflow-trigger/workflow-trigger.module';
@@ -36,7 +33,6 @@ import { WorkflowTriggerModule } from 'src/modules/workflow/workflow-trigger/wor
WorkflowTriggerModule,
WorkflowBuilderModule,
WorkflowCommonModule,
- WorkflowVersionModule,
WorkflowRunModule,
WorkflowRunnerModule,
PermissionsModule,
@@ -51,8 +47,6 @@ import { WorkflowTriggerModule } from 'src/modules/workflow/workflow-trigger/wor
WorkflowTriggerResolver,
WorkflowBuilderResolver,
WorkflowVersionStepResolver,
- WorkflowVersionEdgeResolver,
- WorkflowVersionResolver,
CoreWorkflowResolver,
CoreWorkflowVersionMutationResolver,
provideWorkspaceScopedRepository(WorkflowVersionEntity),
diff --git a/packages/twenty-server/test/integration/endpoint-permissions/__snapshots__/endpoint-permission-declarations.integration-spec.ts.snap b/packages/twenty-server/test/integration/endpoint-permissions/__snapshots__/endpoint-permission-declarations.integration-spec.ts.snap
index 523441f3ff3..0acc40913ea 100644
--- a/packages/twenty-server/test/integration/endpoint-permissions/__snapshots__/endpoint-permission-declarations.integration-spec.ts.snap
+++ b/packages/twenty-server/test/integration/endpoint-permissions/__snapshots__/endpoint-permission-declarations.integration-spec.ts.snap
@@ -656,26 +656,11 @@ exports[`endpoint permission declarations should match the AuthPrincipalGuard an
"WorkflowBuilderResolver.computeStepOutputSchema {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
"WorkflowTriggerController.runWorkflowByGetRequest {"applicationTarget":null,"authPrincipalGuards":[]}",
"WorkflowTriggerController.runWorkflowByPostRequest {"applicationTarget":null,"authPrincipalGuards":[]}",
- "WorkflowTriggerResolver.activateWorkflowVersion {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":true,"application":true,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowTriggerResolver.deactivateWorkflowVersion {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":true,"application":true,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
"WorkflowTriggerResolver.retryWorkflowRun {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":true,"application":true,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowTriggerResolver.runWorkflowVersion {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":true,"application":true,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}},{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
"WorkflowTriggerResolver.stopWorkflowRun {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":true,"application":true,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionEdgeResolver.createWorkflowVersionEdge {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionEdgeResolver.deleteWorkflowVersionEdge {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionResolver.createDraftFromWorkflowVersion {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionResolver.duplicateWorkflow {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionResolver.updateWorkflowVersionPositions {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionResolver.validateWorkflowVersion {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionResolver.workflowVersionContent {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionStepResolver.createWorkflowVersionStep {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionStepResolver.deleteWorkflowVersionStep {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionStepResolver.duplicateWorkflowVersionStep {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
"WorkflowVersionStepResolver.submitFormStep {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
"WorkflowVersionStepResolver.testHttpRequest {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
"WorkflowVersionStepResolver.updateWorkflowRunStep {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionStepResolver.updateWorkflowVersionStep {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
- "WorkflowVersionStepResolver.updateWorkflowVersionTrigger {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
"WorkflowVersionStepResolver.workflowStepConnectedAccountHandle {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":false,"application":{"withUser":true,"withoutUser":false},"oauthClient":{"withUser":true,"withoutUser":false},"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
"WorkspaceInvitationResolver.deleteWorkspaceInvitation {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":true,"application":true,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}},{"apiKey":true,"application":false,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
"WorkspaceInvitationResolver.findWorkspaceInvitations {"applicationTarget":null,"authPrincipalGuards":[{"apiKey":true,"application":true,"oauthClient":true,"userSession":{"impersonated":true,"playground":true,"standard":true,"workspaceAgnostic":false}}]}",
diff --git a/packages/twenty-server/test/integration/graphql/suites/workflow/utils/workflow-run-test.util.ts b/packages/twenty-server/test/integration/graphql/suites/workflow/utils/workflow-run-test.util.ts
index 70cf65092ab..10c9bceeefa 100644
--- a/packages/twenty-server/test/integration/graphql/suites/workflow/utils/workflow-run-test.util.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/workflow/utils/workflow-run-test.util.ts
@@ -66,43 +66,6 @@ export const getWorkflowRun = async (
return response.body.data.workflowRun;
};
-export const runWorkflowVersion = async ({
- workflowVersionId,
- payload,
- token = APPLE_JANE_ADMIN_ACCESS_TOKEN,
-}: {
- workflowVersionId: string;
- payload?: object;
- token?: string;
-}): Promise<string> => {
- const response = await client
- .post('/graphql')
- .set('Authorization', `Bearer ${token}`)
- .send({
- query: `
- mutation RunWorkflowVersion($input: RunWorkflowVersionInput!) {
- runWorkflowVersion(input: $input) {
- workflowRunId
- }
- }
- `,
- variables: {
- input: {
- workflowVersionId,
- payload,
- },
- },
- });
-
- if (response.body.errors || !response.body.data?.runWorkflowVersion) {
- throw new Error(
- `Failed to run workflow version: ${JSON.stringify(response.body.errors)}`,
- );
- }
-
- return response.body.data.runWorkflowVersion.workflowRunId;
-};
-
export const destroyWorkflowRun = async (
workflowRunId: string,
): Promise<void> => {