mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
28 lines
863 B
TypeScript
28 lines
863 B
TypeScript
import type { IWorkflowDb, INodeUi } from '@/Interface';
|
|
|
|
/**
|
|
* Removes execution data from workflow nodes and workflow-level execution data
|
|
* to ensure clean comparisons in diffs. This prevents execution status, run data,
|
|
* pinned data, and other runtime information from appearing in workflow difference
|
|
* comparisons.
|
|
*/
|
|
export function removeWorkflowExecutionData(
|
|
workflow: IWorkflowDb | undefined,
|
|
): IWorkflowDb | undefined {
|
|
if (!workflow) return workflow;
|
|
|
|
// Remove workflow-level execution data and clean up nodes
|
|
const { pinData, ...cleanWorkflow } = workflow;
|
|
|
|
const sanitizedWorkflow: IWorkflowDb = {
|
|
...cleanWorkflow,
|
|
nodes: workflow.nodes.map((node: INodeUi) => {
|
|
// Create a clean copy without execution-related data
|
|
const { issues, pinData, ...cleanNode } = node;
|
|
return cleanNode;
|
|
}),
|
|
};
|
|
|
|
return sanitizedWorkflow;
|
|
}
|