Skip to content

Commit 86d0637

Browse files
refactor(engine): remove remaining legacy end-node normalization
1 parent 36d5147 commit 86d0637

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

packages/workflow-engine/src/index.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -260,25 +260,17 @@ export class WorkflowEngine {
260260
}
261261

262262
private normalizeGraph(graph: WorkflowGraph): WorkflowGraph {
263-
const removedNodeIds = new Set<string>();
264263
const nodes = Array.isArray(graph.nodes)
265-
? graph.nodes.flatMap((node) => {
266-
const normalizedNode = node.type === 'input' ? { ...node, type: 'approval' } : node;
267-
if (normalizedNode.type === 'end') {
268-
removedNodeIds.add(normalizedNode.id);
269-
return [];
264+
? graph.nodes.map((node) => {
265+
if (node.type === 'input') {
266+
return { ...node, type: 'approval' };
270267
}
271-
return [normalizedNode];
268+
return node;
272269
})
273270
: [];
274271
return {
275272
nodes,
276-
connections: Array.isArray(graph.connections)
277-
? graph.connections.filter(
278-
(connection) =>
279-
!removedNodeIds.has(connection.source) && !removedNodeIds.has(connection.target)
280-
)
281-
: []
273+
connections: Array.isArray(graph.connections) ? graph.connections : []
282274
};
283275
}
284276

0 commit comments

Comments
 (0)