Add connection options on edge creation (#14451)
Edge can now be linked to loop handle. Renaming the existing options to connection.
This commit is contained in:
+10
@@ -1,5 +1,9 @@
|
||||
import { Field, InputType } from '@nestjs/graphql';
|
||||
|
||||
import graphqlTypeJson from 'graphql-type-json';
|
||||
|
||||
import { WorkflowStepConnectionOptions } from 'src/modules/workflow/workflow-builder/workflow-version-step/types/WorkflowStepCreationOptions';
|
||||
|
||||
@InputType()
|
||||
export class CreateWorkflowVersionEdgeInput {
|
||||
@Field(() => String, {
|
||||
@@ -19,4 +23,10 @@ export class CreateWorkflowVersionEdgeInput {
|
||||
nullable: false,
|
||||
})
|
||||
target: string;
|
||||
|
||||
@Field(() => graphqlTypeJson, {
|
||||
description: 'Workflow version source step connection options',
|
||||
nullable: true,
|
||||
})
|
||||
sourceConnectionOptions?: WorkflowStepConnectionOptions;
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@ import graphqlTypeJson from 'graphql-type-json';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { WorkflowStepPositionInput } from 'src/engine/core-modules/workflow/dtos/update-workflow-step-position-input.dto';
|
||||
import { WorkflowStepCreationOptions } from 'src/modules/workflow/workflow-builder/workflow-version-step/types/WorkflowStepCreationOptions';
|
||||
import { WorkflowStepConnectionOptions } from 'src/modules/workflow/workflow-builder/workflow-version-step/types/WorkflowStepCreationOptions';
|
||||
import { WorkflowActionType } from 'src/modules/workflow/workflow-executor/workflow-actions/types/workflow-action.type';
|
||||
|
||||
@InputType()
|
||||
@@ -29,10 +29,10 @@ export class CreateWorkflowVersionStepInput {
|
||||
parentStepId?: string;
|
||||
|
||||
@Field(() => graphqlTypeJson, {
|
||||
description: 'Step creation options',
|
||||
description: 'Parent step connection options',
|
||||
nullable: true,
|
||||
})
|
||||
parentStepOptions?: WorkflowStepCreationOptions;
|
||||
parentStepConnectionOptions?: WorkflowStepConnectionOptions;
|
||||
|
||||
@Field(() => UUIDScalarType, {
|
||||
description: 'Next step ID',
|
||||
|
||||
+6
-1
@@ -2,7 +2,10 @@ import { Catch, type ExceptionFilter } from '@nestjs/common';
|
||||
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
|
||||
import { NotFoundError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
|
||||
import {
|
||||
NotFoundError,
|
||||
UserInputError,
|
||||
} from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
|
||||
import {
|
||||
WorkflowVersionEdgeException,
|
||||
WorkflowVersionEdgeExceptionCode,
|
||||
@@ -14,6 +17,8 @@ export const handleWorkflowVersionEdgeException = (
|
||||
switch (exception.code) {
|
||||
case WorkflowVersionEdgeExceptionCode.NOT_FOUND:
|
||||
throw new NotFoundError(exception);
|
||||
case WorkflowVersionEdgeExceptionCode.INVALID_REQUEST:
|
||||
throw new UserInputError(exception);
|
||||
default: {
|
||||
assertUnreachable(exception.code);
|
||||
}
|
||||
|
||||
+7
-1
@@ -36,13 +36,19 @@ export class WorkflowVersionEdgeResolver {
|
||||
async createWorkflowVersionEdge(
|
||||
@AuthWorkspace() { id: workspaceId }: Workspace,
|
||||
@Args('input')
|
||||
{ source, target, workflowVersionId }: CreateWorkflowVersionEdgeInput,
|
||||
{
|
||||
source,
|
||||
target,
|
||||
workflowVersionId,
|
||||
sourceConnectionOptions,
|
||||
}: CreateWorkflowVersionEdgeInput,
|
||||
): Promise<WorkflowVersionStepChangesDTO> {
|
||||
return this.workflowVersionEdgeWorkspaceService.createWorkflowVersionEdge({
|
||||
source,
|
||||
target,
|
||||
workflowVersionId,
|
||||
workspaceId,
|
||||
sourceConnectionOptions,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user