| 67 | |
| 68 | /** Collect all events and return aggregated nodes/relationships (convenience for tests). */ |
| 69 | export function collectPipeline( |
| 70 | input: LoadingInput, |
| 71 | ctx: PipelineContext, |
| 72 | store?: Store, |
| 73 | ): { |
| 74 | events: PipelineEvent[]; |
| 75 | nodes: GraphNode[]; |
| 76 | relationships: GraphRelationship[]; |
| 77 | } { |
| 78 | const events: PipelineEvent[] = []; |
| 79 | const nodes: GraphNode[] = []; |
| 80 | const relationships: GraphRelationship[] = []; |
| 81 | |
| 82 | for (const event of runPipeline(input, ctx, store)) { |
| 83 | events.push(event); |
| 84 | if (event.nodes) nodes.push(...event.nodes); |
| 85 | if (event.relationships) relationships.push(...event.relationships); |
| 86 | } |
| 87 | |
| 88 | return { events, nodes, relationships }; |
| 89 | } |