n8n-core 1.59.0 → 1.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/InstanceSettings.d.ts +3 -0
  2. package/dist/InstanceSettings.js +9 -1
  3. package/dist/InstanceSettings.js.map +1 -1
  4. package/dist/NodeExecuteFunctions.js +5 -7
  5. package/dist/NodeExecuteFunctions.js.map +1 -1
  6. package/dist/PartialExecutionUtils/DirectedGraph.d.ts +42 -0
  7. package/dist/PartialExecutionUtils/DirectedGraph.js +180 -0
  8. package/dist/PartialExecutionUtils/DirectedGraph.js.map +1 -0
  9. package/dist/PartialExecutionUtils/cleanRunData.d.ts +3 -0
  10. package/dist/PartialExecutionUtils/cleanRunData.js +15 -0
  11. package/dist/PartialExecutionUtils/cleanRunData.js.map +1 -0
  12. package/dist/PartialExecutionUtils/findCycles.d.ts +2 -0
  13. package/dist/PartialExecutionUtils/findCycles.js +7 -0
  14. package/dist/PartialExecutionUtils/findCycles.js.map +1 -0
  15. package/dist/PartialExecutionUtils/findStartNodes.d.ts +4 -0
  16. package/dist/PartialExecutionUtils/findStartNodes.js +57 -0
  17. package/dist/PartialExecutionUtils/findStartNodes.js.map +1 -0
  18. package/dist/PartialExecutionUtils/findSubgraph.d.ts +3 -0
  19. package/dist/PartialExecutionUtils/findSubgraph.js +60 -0
  20. package/dist/PartialExecutionUtils/findSubgraph.js.map +1 -0
  21. package/dist/PartialExecutionUtils/findTriggerForPartialExecution.d.ts +2 -0
  22. package/dist/PartialExecutionUtils/findTriggerForPartialExecution.js +56 -0
  23. package/dist/PartialExecutionUtils/findTriggerForPartialExecution.js.map +1 -0
  24. package/dist/PartialExecutionUtils/getIncomingData.d.ts +2 -0
  25. package/dist/PartialExecutionUtils/getIncomingData.js +34 -0
  26. package/dist/PartialExecutionUtils/getIncomingData.js.map +1 -0
  27. package/dist/PartialExecutionUtils/getSourceDataGroups.d.ts +3 -0
  28. package/dist/PartialExecutionUtils/getSourceDataGroups.js +43 -0
  29. package/dist/PartialExecutionUtils/getSourceDataGroups.js.map +1 -0
  30. package/dist/PartialExecutionUtils/index.d.ts +6 -0
  31. package/dist/PartialExecutionUtils/index.js +16 -0
  32. package/dist/PartialExecutionUtils/index.js.map +1 -0
  33. package/dist/PartialExecutionUtils/recreateNodeExecutionStack.d.ts +7 -0
  34. package/dist/PartialExecutionUtils/recreateNodeExecutionStack.js +125 -0
  35. package/dist/PartialExecutionUtils/recreateNodeExecutionStack.js.map +1 -0
  36. package/dist/WorkflowExecute.d.ts +1 -0
  37. package/dist/WorkflowExecute.js +42 -1
  38. package/dist/WorkflowExecute.js.map +1 -1
  39. package/dist/build.tsbuildinfo +1 -1
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/package.json +10 -9
@@ -0,0 +1,42 @@
1
+ import type { INode, WorkflowParameters } from 'n8n-workflow';
2
+ import { NodeConnectionType, Workflow } from 'n8n-workflow';
3
+ export type GraphConnection = {
4
+ from: INode;
5
+ to: INode;
6
+ type: NodeConnectionType;
7
+ outputIndex: number;
8
+ inputIndex: number;
9
+ };
10
+ export declare class DirectedGraph {
11
+ private nodes;
12
+ private connections;
13
+ getNodes(): Map<string, INode>;
14
+ getConnections(filter?: {
15
+ to?: INode;
16
+ }): GraphConnection[];
17
+ addNode(node: INode): this;
18
+ addNodes(...nodes: INode[]): this;
19
+ addConnection(connectionInput: {
20
+ from: INode;
21
+ to: INode;
22
+ type?: NodeConnectionType;
23
+ outputIndex?: number;
24
+ inputIndex?: number;
25
+ }): this;
26
+ addConnections(...connectionInputs: Array<{
27
+ from: INode;
28
+ to: INode;
29
+ type?: NodeConnectionType;
30
+ outputIndex?: number;
31
+ inputIndex?: number;
32
+ }>): this;
33
+ getDirectChildren(node: INode): GraphConnection[];
34
+ private getChildrenRecursive;
35
+ getChildren(node: INode): Set<INode>;
36
+ getDirectParents(node: INode): GraphConnection[];
37
+ getConnection(from: INode, outputIndex: number, type: NodeConnectionType, inputIndex: number, to: INode): GraphConnection | undefined;
38
+ toWorkflow(parameters: Omit<WorkflowParameters, 'nodes' | 'connections'>): Workflow;
39
+ static fromWorkflow(workflow: Workflow): DirectedGraph;
40
+ private toIConnections;
41
+ private makeKey;
42
+ }
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.DirectedGraph = void 0;
27
+ const a = __importStar(require("assert"));
28
+ const n8n_workflow_1 = require("n8n-workflow");
29
+ class DirectedGraph {
30
+ constructor() {
31
+ this.nodes = new Map();
32
+ this.connections = new Map();
33
+ }
34
+ getNodes() {
35
+ return new Map(this.nodes.entries());
36
+ }
37
+ getConnections(filter = {}) {
38
+ const filteredCopy = [];
39
+ for (const connection of this.connections.values()) {
40
+ const toMatches = filter.to ? connection.to === filter.to : true;
41
+ if (toMatches) {
42
+ filteredCopy.push(connection);
43
+ }
44
+ }
45
+ return filteredCopy;
46
+ }
47
+ addNode(node) {
48
+ this.nodes.set(node.name, node);
49
+ return this;
50
+ }
51
+ addNodes(...nodes) {
52
+ for (const node of nodes) {
53
+ this.addNode(node);
54
+ }
55
+ return this;
56
+ }
57
+ addConnection(connectionInput) {
58
+ const { from, to } = connectionInput;
59
+ const fromExists = this.nodes.get(from.name) === from;
60
+ const toExists = this.nodes.get(to.name) === to;
61
+ a.ok(fromExists);
62
+ a.ok(toExists);
63
+ const connection = {
64
+ ...connectionInput,
65
+ type: connectionInput.type ?? "main",
66
+ outputIndex: connectionInput.outputIndex ?? 0,
67
+ inputIndex: connectionInput.inputIndex ?? 0,
68
+ };
69
+ this.connections.set(this.makeKey(connection), connection);
70
+ return this;
71
+ }
72
+ addConnections(...connectionInputs) {
73
+ for (const connectionInput of connectionInputs) {
74
+ this.addConnection(connectionInput);
75
+ }
76
+ return this;
77
+ }
78
+ getDirectChildren(node) {
79
+ const nodeExists = this.nodes.get(node.name) === node;
80
+ a.ok(nodeExists);
81
+ const directChildren = [];
82
+ for (const connection of this.connections.values()) {
83
+ if (connection.from !== node) {
84
+ continue;
85
+ }
86
+ directChildren.push(connection);
87
+ }
88
+ return directChildren;
89
+ }
90
+ getChildrenRecursive(node, children) {
91
+ const directChildren = this.getDirectChildren(node);
92
+ for (const directChild of directChildren) {
93
+ if (children.has(directChild.to)) {
94
+ continue;
95
+ }
96
+ children.add(directChild.to);
97
+ this.getChildrenRecursive(directChild.to, children);
98
+ }
99
+ return children;
100
+ }
101
+ getChildren(node) {
102
+ return this.getChildrenRecursive(node, new Set());
103
+ }
104
+ getDirectParents(node) {
105
+ const nodeExists = this.nodes.get(node.name) === node;
106
+ a.ok(nodeExists);
107
+ const directParents = [];
108
+ for (const connection of this.connections.values()) {
109
+ if (connection.to !== node) {
110
+ continue;
111
+ }
112
+ directParents.push(connection);
113
+ }
114
+ return directParents;
115
+ }
116
+ getConnection(from, outputIndex, type, inputIndex, to) {
117
+ return this.connections.get(this.makeKey({
118
+ from,
119
+ outputIndex,
120
+ type,
121
+ inputIndex,
122
+ to,
123
+ }));
124
+ }
125
+ toWorkflow(parameters) {
126
+ return new n8n_workflow_1.Workflow({
127
+ ...parameters,
128
+ nodes: [...this.nodes.values()],
129
+ connections: this.toIConnections(),
130
+ });
131
+ }
132
+ static fromWorkflow(workflow) {
133
+ const graph = new DirectedGraph();
134
+ graph.addNodes(...Object.values(workflow.nodes));
135
+ for (const [fromNodeName, iConnection] of Object.entries(workflow.connectionsBySourceNode)) {
136
+ const from = workflow.getNode(fromNodeName);
137
+ a.ok(from);
138
+ for (const [outputType, outputs] of Object.entries(iConnection)) {
139
+ for (const [outputIndex, conns] of outputs.entries()) {
140
+ for (const conn of conns) {
141
+ const { node: toNodeName, type: _inputType, index: inputIndex } = conn;
142
+ const to = workflow.getNode(toNodeName);
143
+ a.ok(to);
144
+ graph.addConnection({
145
+ from,
146
+ to,
147
+ type: outputType,
148
+ outputIndex,
149
+ inputIndex,
150
+ });
151
+ }
152
+ }
153
+ }
154
+ }
155
+ return graph;
156
+ }
157
+ toIConnections() {
158
+ const result = {};
159
+ for (const connection of this.connections.values()) {
160
+ const { from, to, type, outputIndex, inputIndex } = connection;
161
+ result[from.name] = result[from.name] ?? {
162
+ [type]: [],
163
+ };
164
+ const resultConnection = result[from.name];
165
+ resultConnection[type][outputIndex] = resultConnection[type][outputIndex] ?? [];
166
+ const group = resultConnection[type][outputIndex];
167
+ group.push({
168
+ node: to.name,
169
+ type,
170
+ index: inputIndex,
171
+ });
172
+ }
173
+ return result;
174
+ }
175
+ makeKey(connection) {
176
+ return `${connection.from.name}-${connection.type}-${connection.outputIndex}-${connection.inputIndex}-${connection.to.name}`;
177
+ }
178
+ }
179
+ exports.DirectedGraph = DirectedGraph;
180
+ //# sourceMappingURL=DirectedGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DirectedGraph.js","sourceRoot":"","sources":["../../src/PartialExecutionUtils/DirectedGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;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O,KAAK,CAAC;IACd,CAAC;IAEO,cAAc;QACrB,MAAM,MAAM,GAAiB,EAAE,CAAC;QAEhC,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC;YACpD,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;YAE/D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;gBACxC,CAAC,IAAI,CAAC,EAAE,EAAE;aACV,CAAC;YACF,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3C,gBAAgB,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YAChF,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC;YAElD,KAAK,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,EAAE,CAAC,IAAI;gBACb,IAAI;gBACJ,KAAK,EAAE,UAAU;aACjB,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAEO,OAAO,CAAC,UAA2B;QAC1C,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,UAAU,IAAI,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;IAC9H,CAAC;CACD;AA7ND,sCA6NC"}
@@ -0,0 +1,3 @@
1
+ import type { INode, IRunData } from 'n8n-workflow';
2
+ import type { DirectedGraph } from './DirectedGraph';
3
+ export declare function cleanRunData(runData: IRunData, graph: DirectedGraph, startNodes: INode[]): IRunData;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cleanRunData = cleanRunData;
4
+ function cleanRunData(runData, graph, startNodes) {
5
+ const newRunData = { ...runData };
6
+ for (const startNode of startNodes) {
7
+ delete newRunData[startNode.name];
8
+ const children = graph.getChildren(startNode);
9
+ for (const child of children) {
10
+ delete newRunData[child.name];
11
+ }
12
+ }
13
+ return newRunData;
14
+ }
15
+ //# sourceMappingURL=cleanRunData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanRunData.js","sourceRoot":"","sources":["../../src/PartialExecutionUtils/cleanRunData.ts"],"names":[],"mappings":";;AAQA,oCAiBC;AAjBD,SAAgB,YAAY,CAC3B,OAAiB,EACjB,KAAoB,EACpB,UAAmB;IAEnB,MAAM,UAAU,GAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAE5C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAE9C,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC9B,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Workflow } from 'n8n-workflow';
2
+ export declare function findCycles(_workflow: Workflow): never[];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findCycles = findCycles;
4
+ function findCycles(_workflow) {
5
+ return [];
6
+ }
7
+ //# sourceMappingURL=findCycles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findCycles.js","sourceRoot":"","sources":["../../src/PartialExecutionUtils/findCycles.ts"],"names":[],"mappings":";;AAEA,gCAGC;AAHD,SAAgB,UAAU,CAAC,SAAmB;IAE7C,OAAO,EAAE,CAAC;AACX,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { INode, IPinData, IRunData } from 'n8n-workflow';
2
+ import type { DirectedGraph } from './DirectedGraph';
3
+ export declare function isDirty(node: INode, runData?: IRunData, pinData?: IPinData): boolean;
4
+ export declare function findStartNodes(graph: DirectedGraph, trigger: INode, destination: INode, runData?: IRunData, pinData?: IPinData): INode[];
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDirty = isDirty;
4
+ exports.findStartNodes = findStartNodes;
5
+ const getIncomingData_1 = require("./getIncomingData");
6
+ function isDirty(node, runData = {}, pinData = {}) {
7
+ const propertiesOrOptionsChanged = false;
8
+ if (propertiesOrOptionsChanged) {
9
+ return true;
10
+ }
11
+ const parentNodeGotDisabled = false;
12
+ if (parentNodeGotDisabled) {
13
+ return true;
14
+ }
15
+ const hasAnError = false;
16
+ if (hasAnError) {
17
+ return true;
18
+ }
19
+ const hasPinnedData = pinData[node.name] !== undefined;
20
+ if (hasPinnedData) {
21
+ return false;
22
+ }
23
+ const hasRunData = runData?.[node.name];
24
+ if (hasRunData) {
25
+ return false;
26
+ }
27
+ return true;
28
+ }
29
+ function findStartNodesRecursive(graph, current, destination, runData, pinData, startNodes, seen) {
30
+ const nodeIsDirty = isDirty(current, runData, pinData);
31
+ if (nodeIsDirty) {
32
+ startNodes.add(current);
33
+ return startNodes;
34
+ }
35
+ if (current === destination) {
36
+ startNodes.add(current);
37
+ return startNodes;
38
+ }
39
+ if (seen.has(current)) {
40
+ return startNodes;
41
+ }
42
+ const outGoingConnections = graph.getDirectChildren(current);
43
+ for (const outGoingConnection of outGoingConnections) {
44
+ const nodeRunData = (0, getIncomingData_1.getIncomingData)(runData, outGoingConnection.from.name, 0, outGoingConnection.type, outGoingConnection.outputIndex);
45
+ const hasNoRunData = nodeRunData === null || nodeRunData === undefined || nodeRunData.length === 0;
46
+ if (hasNoRunData) {
47
+ continue;
48
+ }
49
+ findStartNodesRecursive(graph, outGoingConnection.to, destination, runData, pinData, startNodes, new Set(seen).add(current));
50
+ }
51
+ return startNodes;
52
+ }
53
+ function findStartNodes(graph, trigger, destination, runData = {}, pinData = {}) {
54
+ const startNodes = findStartNodesRecursive(graph, trigger, destination, runData, pinData, new Set(), new Set());
55
+ return [...startNodes];
56
+ }
57
+ //# sourceMappingURL=findStartNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findStartNodes.js","sourceRoot":"","sources":["../../src/PartialExecutionUtils/findStartNodes.ts"],"names":[],"mappings":";;AAWA,0BAmCC;AAsFD,wCAoBC;AAtJD,uDAAoD;AASpD,SAAgB,OAAO,CAAC,IAAW,EAAE,UAAoB,EAAE,EAAE,UAAoB,EAAE;IAElF,MAAM,0BAA0B,GAAG,KAAK,CAAC;IAEzC,IAAI,0BAA0B,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACb,CAAC;IAGD,MAAM,qBAAqB,GAAG,KAAK,CAAC;IAEpC,IAAI,qBAAqB,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACb,CAAC;IAGD,MAAM,UAAU,GAAG,KAAK,CAAC;IAEzB,IAAI,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;IAEvD,IAAI,aAAa,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAExC,IAAI,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED,SAAS,uBAAuB,CAC/B,KAAoB,EACpB,OAAc,EACd,WAAkB,EAClB,OAAiB,EACjB,OAAiB,EACjB,UAAsB,EACtB,IAAgB;IAEhB,MAAM,WA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AAW,EACX,OAAO,EACP,OAAO,EAEP,IAAI,GAAG,EAAE,EAET,IAAI,GAAG,EAAE,CACT,CAAC;IAEF,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { INode } from 'n8n-workflow';
2
+ import { DirectedGraph } from './DirectedGraph';
3
+ export declare function findSubgraph(graph: DirectedGraph, destinationNode: INode, trigger: INode): DirectedGraph;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findSubgraph = findSubgraph;
4
+ const DirectedGraph_1 = require("./DirectedGraph");
5
+ function findSubgraphRecursive(graph, destinationNode, current, trigger, newGraph, currentBranch) {
6
+ if (current === trigger) {
7
+ for (const connection of currentBranch) {
8
+ newGraph.addNodes(connection.from, connection.to);
9
+ newGraph.addConnection(connection);
10
+ }
11
+ return;
12
+ }
13
+ let parentConnections = graph.getDirectParents(current);
14
+ if (parentConnections.length === 0) {
15
+ return;
16
+ }
17
+ const isCycleWithDestinationNode = current === destinationNode && currentBranch.some((c) => c.to === destinationNode);
18
+ if (isCycleWithDestinationNode) {
19
+ return;
20
+ }
21
+ const isCycleWithCurrentNode = currentBranch.some((c) => c.to === current);
22
+ if (isCycleWithCurrentNode) {
23
+ for (const connection of currentBranch) {
24
+ newGraph.addNodes(connection.from, connection.to);
25
+ newGraph.addConnection(connection);
26
+ }
27
+ return;
28
+ }
29
+ if (current.disabled) {
30
+ const incomingConnections = graph.getDirectParents(current);
31
+ const outgoingConnections = graph
32
+ .getDirectChildren(current)
33
+ .filter((connection) => connection.outputIndex === 0);
34
+ parentConnections = [];
35
+ for (const incomingConnection of incomingConnections) {
36
+ for (const outgoingConnection of outgoingConnections) {
37
+ const newConnection = {
38
+ ...incomingConnection,
39
+ to: outgoingConnection.to,
40
+ inputIndex: outgoingConnection.inputIndex,
41
+ };
42
+ parentConnections.push(newConnection);
43
+ currentBranch.pop();
44
+ currentBranch.push(newConnection);
45
+ }
46
+ }
47
+ }
48
+ for (const parentConnection of parentConnections) {
49
+ findSubgraphRecursive(graph, destinationNode, parentConnection.from, trigger, newGraph, [
50
+ ...currentBranch,
51
+ parentConnection,
52
+ ]);
53
+ }
54
+ }
55
+ function findSubgraph(graph, destinationNode, trigger) {
56
+ const newGraph = new DirectedGraph_1.DirectedGraph();
57
+ findSubgraphRecursive(graph, destinationNode, destinationNode, trigger, newGraph, []);
58
+ return newGraph;
59
+ }
60
+ //# sourceMappingURL=findSubgraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findSubgraph.js","sourceRoot":"","sources":["../../src/PartialExecutionUtils/findSubgraph.ts"],"names":[],"mappings":";;AAsGA,oCAUC;AA9GD,mDAAgD;AAEhD,SAAS,qBAAqB,CAC7B,KAAoB,EACpB,eAAsB,EACtB,OAAc,EACd,OAAc,EACd,QAAuB,EACvB,aAAgC;IAGhC,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACzB,KAAK,MAAM,UAAU,IAAI,aAAa,EAAE,CAAC;YACxC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;YAClD,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACpC,CAAC;QAED,OAAO;IACR,CAAC;IAED,IAAI,iBAAiB,GAAG,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAGxD,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO;IACR,CAAC;IAGD,MAAM,0BAA0B,GAC/B,OAAO,KAAK,eAAe,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,eAAe,CAAC,CAAC;IACpF,IAAI,0BAA0B,EAAE,CAAC;QAChC,OAAO;IACR,CAAC;IAGD,MAAM,sBAAsB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC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,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAoBD,SAAgB,YAAY,CAC3B,KAAoB,EACpB,eAAsB,EACtB,OAAc;IAEd,MAAM,QAAQ,GAAG,IAAI,6BAAa,EAAE,CAAC;IAErC,qBAAqB,CAAC,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEtF,OAAO,QAAQ,CAAC;AACjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { INode, Workflow } from 'n8n-workflow';
2
+ export declare function findTriggerForPartialExecution(workflow: Workflow, destinationNodeName: string): INode | undefined;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.findTriggerForPartialExecution = findTriggerForPartialExecution;
27
+ const assert = __importStar(require("assert/strict"));
28
+ function findAllParentTriggers(workflow, destinationNodeName) {
29
+ const parentNodes = workflow
30
+ .getParentNodes(destinationNodeName)
31
+ .map((name) => {
32
+ const node = workflow.getNode(name);
33
+ assert.ok(node);
34
+ return {
35
+ node,
36
+ nodeType: workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion),
37
+ };
38
+ })
39
+ .filter((value) => value !== null)
40
+ .filter(({ nodeType }) => nodeType.description.group.includes('trigger'))
41
+ .map(({ node }) => node);
42
+ return parentNodes;
43
+ }
44
+ function findTriggerForPartialExecution(workflow, destinationNodeName) {
45
+ const parentTriggers = findAllParentTriggers(workflow, destinationNodeName).filter((trigger) => !trigger.disabled);
46
+ const pinnedTriggers = parentTriggers
47
+ .filter((trigger) => workflow.pinData?.[trigger.name])
48
+ .sort((n) => (n.type.endsWith('webhook') ? -1 : 1));
49
+ if (pinnedTriggers.length) {
50
+ return pinnedTriggers[0];
51
+ }
52
+ else {
53
+ return parentTriggers[0];
54
+ }
55
+ }
56
+ //# sourceMappingURL=findTriggerForPartialExecution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findTriggerForPartialExecution.js","sourceRoot":"","sources":["../../src/PartialExecutionUtils/findTriggerForPartialExecution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,wEAqBC;AA/CD,sDAAwC;AAExC,SAAS,qBAAqB,CAAC,QAAkB,EAAE,mBAA2B;IAC7E,MAAM,WAAW,GAAG,QAAQ;SAC1B,cAAc,CAAC,mBAAmB,CAAC;SACnC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACb,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAIpC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAEhB,OAAO;YACN,IAAI;YACJ,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC;SAC7E,CAAC;IACH,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;SACjC,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;SACxE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IAE1B,OAAO,WAAW,CAAC;AACpB,CAAC;AAID,SAAgB,8BAA8B,CAC7C,QAAkB,EAClB,mBAA2B;IAE3B,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC,MAAM,CACjF,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAC9B,CAAC;IACF,MAAM,cAAc,GAAG,cAAc;SAGnC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAIrD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;SAAM,CAAC;QACP,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { INodeExecutionData, IRunData, NodeConnectionType } from 'n8n-workflow';
2
+ export declare function getIncomingData(runData: IRunData, nodeName: string, runIndex: number, connectionType: NodeConnectionType, outputIndex: number): INodeExecutionData[] | null | undefined;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getIncomingData = getIncomingData;
27
+ const a = __importStar(require("assert"));
28
+ function getIncomingData(runData, nodeName, runIndex, connectionType, outputIndex) {
29
+ a.ok(runData[nodeName], `Can't find node with name '${nodeName}' in runData.`);
30
+ a.ok(runData[nodeName][runIndex], `Can't find a run for index '${runIndex}' for node name '${nodeName}'`);
31
+ a.ok(runData[nodeName][runIndex].data, `Can't find data for index '${runIndex}' for node name '${nodeName}'`);
32
+ return runData[nodeName][runIndex].data[connectionType][outputIndex];
33
+ }
34
+ //# sourceMappingURL=getIncomingData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIncomingData.js","sourceRoot":"","sources":["../../src/PartialExecutionUtils/getIncomingData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,0CAkBC;AArBD,0CAA4B;AAG5B,SAAgB,eAAe,CAC9B,OAAiB,EACjB,QAAgB,EAChB,QAAgB,EAChB,cAAkC,EAClC,WAAmB;IAEnB,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,8BAA8B,QAAQ,eAAe,CAAC,CAAC;IAC/E,CAAC,CAAC,EAAE,CACH,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAC3B,+BAA+B,QAAQ,oBAAoB,QAAQ,GAAG,CACtE,CAAC;IACF,CAAC,CAAC,EAAE,CACH,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAChC,8BAA8B,QAAQ,oBAAoB,QAAQ,GAAG,CACrE,CAAC;IAEF,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,WAAW,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type INode, type IPinData, type IRunData } from 'n8n-workflow';
2
+ import type { GraphConnection, DirectedGraph } from './DirectedGraph';
3
+ export declare function getSourceDataGroups(graph: DirectedGraph, node: INode, runData: IRunData, pinnedData: IPinData): GraphConnection[][];
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSourceDataGroups = getSourceDataGroups;
4
+ function sortByInputIndexThenByName(connection1, connection2) {
5
+ if (connection1.inputIndex === connection2.inputIndex) {
6
+ return connection1.from.name.localeCompare(connection2.from.name);
7
+ }
8
+ else {
9
+ return connection1.inputIndex - connection2.inputIndex;
10
+ }
11
+ }
12
+ function getSourceDataGroups(graph, node, runData, pinnedData) {
13
+ const connections = graph.getConnections({ to: node });
14
+ const sortedConnectionsWithData = [];
15
+ for (const connection of connections) {
16
+ const hasData = runData[connection.from.name] || pinnedData[connection.from.name];
17
+ if (hasData) {
18
+ sortedConnectionsWithData.push(connection);
19
+ }
20
+ }
21
+ sortedConnectionsWithData.sort(sortByInputIndexThenByName);
22
+ const groups = [];
23
+ let currentGroup = [];
24
+ let currentInputIndex = -1;
25
+ while (sortedConnectionsWithData.length > 0) {
26
+ const connectionWithDataIndex = sortedConnectionsWithData.findIndex((c) => c.inputIndex > currentInputIndex);
27
+ const connection = sortedConnectionsWithData[connectionWithDataIndex];
28
+ if (connection === undefined) {
29
+ groups.push(currentGroup);
30
+ currentGroup = [];
31
+ currentInputIndex = -1;
32
+ continue;
33
+ }
34
+ currentInputIndex = connection.inputIndex;
35
+ currentGroup.push(connection);
36
+ if (connectionWithDataIndex >= 0) {
37
+ sortedConnectionsWithData.splice(connectionWithDataIndex, 1);
38
+ }
39
+ }
40
+ groups.push(currentGroup);
41
+ return groups;
42
+ }
43
+ //# sourceMappingURL=getSourceDataGroups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSourceDataGroups.js","sourceRoot":"","sources":["../../src/PartialExecutionUtils/getSourceDataGroups.ts"],"names":[],"mappings":";;AAgEA,kDAkDC;AA9GD,SAAS,0BAA0B,CAClC,WAA4B,EAC5B,WAA4B;IAE5B,IAAI,WAAW,CAAC,UAAU,KAAK,WAAW,CAAC,UAAU,EAAE,CAAC;QACvD,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;SAAM,CAAC;QACP,OAAO,WAAW,CAAC,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;IACxD,CAAC;AACF,CAAC;AAmDD,SAAgB,mBAAmB,CAClC,KAAoB,EACpB,IAAW,EACX,OAAiB,EACjB,UAAoB;IAEpB,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvD,MAAM,yBAAyB,GAAG,EAAE,CAAC;IAErC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAElF,IAAI,OAAO,EAAE,CAAC;YACb,yBAAyB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,CAAC;IACF,CAAC;IAED,yBAAyB,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAE3D,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,IAAI,YAAY,GAAsB,EAAE,CAAC;IACzC,IAAI,iBAAiB,GAAG,CAAC,CAAC,CAAC;IAE3B,OAAO,yBAAyB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,uBAAuB,GAAG,yBAAyB,CAAC,SAAS,CAElE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,iBAAiB,CACvC,CAAC;QACF,MAAM,UAAU,GACf,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;QAEpD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC1B,YAAY,GAAG,EAAE,CAAC;YAClB,iBAAiB,GAAG,CAAC,CAAC,CAAC;YACvB,SAAS;QACV,CAAC;QAED,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAAC;QAC1C,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE9B,IAAI,uBAAuB,IAAI,CAAC,EAAE,CAAC;YAClC,yBAAyB,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC;QAC9D,CAAC;IACF,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAE1B,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { DirectedGraph } from './DirectedGraph';
2
+ export { findTriggerForPartialExecution } from './findTriggerForPartialExecution';
3
+ export { findStartNodes } from './findStartNodes';
4
+ export { findSubgraph } from './findSubgraph';
5
+ export { findCycles } from './findCycles';
6
+ export { recreateNodeExecutionStack } from './recreateNodeExecutionStack';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.recreateNodeExecutionStack = exports.findCycles = exports.findSubgraph = exports.findStartNodes = exports.findTriggerForPartialExecution = exports.DirectedGraph = void 0;
4
+ var DirectedGraph_1 = require("./DirectedGraph");
5
+ Object.defineProperty(exports, "DirectedGraph", { enumerable: true, get: function () { return DirectedGraph_1.DirectedGraph; } });
6
+ var findTriggerForPartialExecution_1 = require("./findTriggerForPartialExecution");
7
+ Object.defineProperty(exports, "findTriggerForPartialExecution", { enumerable: true, get: function () { return findTriggerForPartialExecution_1.findTriggerForPartialExecution; } });
8
+ var findStartNodes_1 = require("./findStartNodes");
9
+ Object.defineProperty(exports, "findStartNodes", { enumerable: true, get: function () { return findStartNodes_1.findStartNodes; } });
10
+ var findSubgraph_1 = require("./findSubgraph");
11
+ Object.defineProperty(exports, "findSubgraph", { enumerable: true, get: function () { return findSubgraph_1.findSubgraph; } });
12
+ var findCycles_1 = require("./findCycles");
13
+ Object.defineProperty(exports, "findCycles", { enumerable: true, get: function () { return findCycles_1.findCycles; } });
14
+ var recreateNodeExecutionStack_1 = require("./recreateNodeExecutionStack");
15
+ Object.defineProperty(exports, "recreateNodeExecutionStack", { enumerable: true, get: function () { return recreateNodeExecutionStack_1.recreateNodeExecutionStack; } });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/PartialExecutionUtils/index.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mFAAkF;AAAzE,gJAAA,8BAA8B,OAAA;AACvC,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA"}
@@ -0,0 +1,7 @@
1
+ import { type IExecuteData, type INode, type IPinData, type IRunData, type IWaitingForExecution, type IWaitingForExecutionSource } from 'n8n-workflow';
2
+ import type { DirectedGraph } from './DirectedGraph';
3
+ export declare function recreateNodeExecutionStack(graph: DirectedGraph, startNodes: INode[], destinationNode: INode, runData: IRunData, pinData: IPinData): {
4
+ nodeExecutionStack: IExecuteData[];
5
+ waitingExecution: IWaitingForExecution;
6
+ waitingExecutionSource: IWaitingForExecutionSource;
7
+ };