mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Reorganize n8n-core and enforce file-name casing (no-changelog) (#12667)
This commit is contained in:
committed by
GitHub
parent
e7f00bcb7f
commit
05858c2153
@@ -0,0 +1,35 @@
|
||||
import type { INode, IRunData } from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './directed-graph';
|
||||
|
||||
/**
|
||||
* Returns new run data that does not contain data for any node that is a child
|
||||
* of any start node.
|
||||
* This does not mutate the `runData` being passed in.
|
||||
*/
|
||||
export function cleanRunData(
|
||||
runData: IRunData,
|
||||
graph: DirectedGraph,
|
||||
startNodes: Set<INode>,
|
||||
): IRunData {
|
||||
const newRunData: IRunData = { ...runData };
|
||||
|
||||
for (const startNode of startNodes) {
|
||||
delete newRunData[startNode.name];
|
||||
const children = graph.getChildren(startNode);
|
||||
|
||||
for (const child of children) {
|
||||
delete newRunData[child.name];
|
||||
}
|
||||
}
|
||||
|
||||
// Remove run data for all nodes that are not part of the subgraph
|
||||
for (const nodeName of Object.keys(newRunData)) {
|
||||
if (!graph.hasNode(nodeName)) {
|
||||
// remove run data for node that is not part of the graph
|
||||
delete newRunData[nodeName];
|
||||
}
|
||||
}
|
||||
|
||||
return newRunData;
|
||||
}
|
||||
Reference in New Issue
Block a user