refactor(core): Persist node execution order, and forward it to the frontend (#14455)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-09 10:19:58 +02:00
committed by GitHub
parent 707ecb63ae
commit 9ba58ca80b
41 changed files with 235 additions and 113 deletions

View File

@@ -2180,16 +2180,22 @@ export interface ITaskMetadata {
subExecutionsCount?: number;
}
// The data that gets returned when a node runs
export interface ITaskData {
/** The data that gets returned when a node execution starts */
export interface ITaskStartedData {
startTime: number;
/** This index tracks the order in which nodes are executed */
executionIndex: number;
source: Array<ISourceData | null>; // Is an array as nodes have multiple inputs
hints?: NodeExecutionHint[];
}
/** The data that gets returned when a node execution ends */
export interface ITaskData extends ITaskStartedData {
executionTime: number;
executionStatus?: ExecutionStatus;
data?: ITaskDataConnections;
inputOverride?: ITaskDataConnections;
error?: ExecutionError;
hints?: NodeExecutionHint[];
source: Array<ISourceData | null>; // Is an array as nodes have multiple inputs
metadata?: ITaskMetadata;
}
@@ -2336,6 +2342,7 @@ export interface IWorkflowExecuteAdditionalData {
) => Promise<ExecuteWorkflowData>;
executionId?: string;
restartExecutionId?: string;
currentNodeExecutionIndex: number;
httpResponse?: express.Response;
httpRequest?: express.Request;
restApiUrl: string;

View File

@@ -916,7 +916,15 @@ export class WorkflowDataProxy {
);
if (pinData) {
taskData = { data: { main: [pinData] }, startTime: 0, executionTime: 0, source: [] };
taskData = {
data: {
main: [pinData],
},
startTime: 0,
executionTime: 0,
executionIndex: 0,
source: [],
};
}
}

View File

@@ -1512,6 +1512,7 @@ function generateTestWorkflowAndRunData(): { workflow: Partial<IWorkflowBase>; r
hints: [],
startTime: 1727793340927,
executionTime: 0,
executionIndex: 0,
source: [],
executionStatus: 'success',
data: { main: [[{ json: {}, pairedItem: { item: 0 } }]] },
@@ -1522,6 +1523,7 @@ function generateTestWorkflowAndRunData(): { workflow: Partial<IWorkflowBase>; r
hints: [],
startTime: 1727793340928,
executionTime: 0,
executionIndex: 1,
source: [{ previousNode: 'Execute Workflow Trigger' }],
executionStatus: 'success',
data: {
@@ -1555,6 +1557,7 @@ function generateTestWorkflowAndRunData(): { workflow: Partial<IWorkflowBase>; r
hints: [],
startTime: 1727793340928,
executionTime: 1,
executionIndex: 2,
source: [{ previousNode: 'DebugHelper' }],
executionStatus: 'success',
data: {
@@ -1586,6 +1589,7 @@ function generateTestWorkflowAndRunData(): { workflow: Partial<IWorkflowBase>; r
hints: [],
startTime: 1727793340931,
executionTime: 0,
executionIndex: 3,
source: [{ previousNode: 'Execute Workflow Trigger' }],
executionStatus: 'success',
data: { main: [[{ json: {}, pairedItem: { item: 0 } }]] },
@@ -1596,6 +1600,7 @@ function generateTestWorkflowAndRunData(): { workflow: Partial<IWorkflowBase>; r
hints: [],
startTime: 1727793340929,
executionTime: 1,
executionIndex: 4,
source: [{ previousNode: 'Edit Fields' }],
executionStatus: 'success',
data: {
@@ -1630,6 +1635,7 @@ function generateTestWorkflowAndRunData(): { workflow: Partial<IWorkflowBase>; r
hints: [],
startTime: 1727793340931,
executionTime: 0,
executionIndex: 5,
source: [{ previousNode: 'Edit Fields', previousNodeRun: 1 }],
executionStatus: 'success',
data: { main: [[], [], [{ json: {}, pairedItem: { item: 0 } }], []] },
@@ -1640,6 +1646,7 @@ function generateTestWorkflowAndRunData(): { workflow: Partial<IWorkflowBase>; r
hints: [],
startTime: 1727793340930,
executionTime: 0,
executionIndex: 6,
source: [{ previousNode: 'Switch', previousNodeOutput: 2 }],
executionStatus: 'success',
data: {
@@ -1656,6 +1663,7 @@ function generateTestWorkflowAndRunData(): { workflow: Partial<IWorkflowBase>; r
hints: [],
startTime: 1727793340932,
executionTime: 1,
executionIndex: 7,
source: [{ previousNode: 'Switch', previousNodeOutput: 2, previousNodeRun: 1 }],
executionStatus: 'success',
data: { main: [[{ json: {}, pairedItem: { item: 0 } }]] },

View File

@@ -1603,6 +1603,7 @@ describe('Workflow', () => {
],
startTime: 1,
executionTime: 1,
executionIndex: 0,
data: {
main: [
[
@@ -1681,6 +1682,7 @@ describe('Workflow', () => {
{
startTime: 1,
executionTime: 1,
executionIndex: 0,
data: {
main: [
[