refactor(core): Reorganize n8n-core and enforce file-name casing (no-changelog) (#12667)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-01-17 15:17:25 +01:00
committed by GitHub
parent e7f00bcb7f
commit 05858c2153
132 changed files with 459 additions and 441 deletions

View File

@@ -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;
}