fix(core): Fix pairedItem issue with partial manual executions (#8575)

Co-authored-by: Danny Martini <danny@n8n.io>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Jan Oberhauser
2024-02-23 11:43:08 +01:00
committed by GitHub
parent 0882dc0ce9
commit a29b41ec55
14 changed files with 250 additions and 27 deletions

View File

@@ -23,6 +23,7 @@ import type {
INodeProperties,
IUserSettings,
IHttpRequestMethods,
StartNodeData,
} from 'n8n-workflow';
import type { ActiveWorkflowRunner } from '@/ActiveWorkflowRunner';
@@ -532,7 +533,7 @@ export interface IWorkflowExecutionDataProcess {
pinData?: IPinData;
retryOf?: string;
sessionId?: string;
startNodes?: string[];
startNodes?: StartNodeData[];
workflowData: IWorkflowBase;
userId: string;
}

View File

@@ -227,9 +227,9 @@ export function getExecutionStartNode(data: IWorkflowExecutionDataProcess, workf
let startNode;
if (
data.startNodes?.length === 1 &&
Object.keys(data.pinData ?? {}).includes(data.startNodes[0])
Object.keys(data.pinData ?? {}).includes(data.startNodes[0].name)
) {
startNode = workflow.getNode(data.startNodes[0]) ?? undefined;
startNode = workflow.getNode(data.startNodes[0].name) ?? undefined;
}
return startNode;

View File

@@ -101,7 +101,7 @@ export class Execute extends BaseCommand {
const user = await Container.get(OwnershipService).getInstanceOwner();
const runData: IWorkflowExecutionDataProcess = {
executionMode: 'cli',
startNodes: [startingNode.name],
startNodes: [{ name: startingNode.name, sourceData: null }],
workflowData,
userId: user.id,
};

View File

@@ -620,7 +620,7 @@ export class ExecuteBatch extends BaseCommand {
const runData: IWorkflowExecutionDataProcess = {
executionMode: 'cli',
startNodes: [startingNode.name],
startNodes: [{ name: startingNode.name, sourceData: null }],
workflowData,
userId: ExecuteBatch.instanceOwner.id,
};

View File

@@ -1,6 +1,13 @@
import type { IWorkflowDb } from '@/Interfaces';
import type { AuthenticatedRequest } from '@/requests';
import type { INode, IConnections, IWorkflowSettings, IRunData, IPinData } from 'n8n-workflow';
import type {
INode,
IConnections,
IWorkflowSettings,
IRunData,
IPinData,
StartNodeData,
} from 'n8n-workflow';
export declare namespace WorkflowRequest {
type CreateUpdatePayload = Partial<{
@@ -19,7 +26,7 @@ export declare namespace WorkflowRequest {
workflowData: IWorkflowDb;
runData: IRunData;
pinData: IPinData;
startNodes?: string[];
startNodes?: StartNodeData[];
destinationNode?: string;
};

View File

@@ -101,7 +101,11 @@ export class WorkflowExecutionService {
user: User,
sessionId?: string,
) {
const pinnedTrigger = this.selectPinnedActivatorStarter(workflowData, startNodes, pinData);
const pinnedTrigger = this.selectPinnedActivatorStarter(
workflowData,
startNodes?.map((nodeData) => nodeData.name),
pinData,
);
// If webhooks nodes exist and are active we have to wait for till we receive a call
if (
@@ -143,7 +147,7 @@ export class WorkflowExecutionService {
const hasRunData = (node: INode) => runData !== undefined && !!runData[node.name];
if (pinnedTrigger && !hasRunData(pinnedTrigger)) {
data.startNodes = [pinnedTrigger.name];
data.startNodes = [{ name: pinnedTrigger.name, sourceData: null }];
}
const executionId = await this.workflowRunner.run(data);