* Find primary file for a workflow (file with most nodes)
(
nodeIds: string[],
nodeToFile: Map<string, string>
)
| 686 | * Find primary file for a workflow (file with most nodes) |
| 687 | */ |
| 688 | private findPrimaryFile( |
| 689 | nodeIds: string[], |
| 690 | nodeToFile: Map<string, string> |
| 691 | ): string { |
| 692 | const fileCounts = new Map<string, number>(); |
| 693 | |
| 694 | for (const id of nodeIds) { |
| 695 | const file = nodeToFile.get(id); |
| 696 | if (file) { |
| 697 | fileCounts.set(file, (fileCounts.get(file) || 0) + 1); |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | let maxFile = 'unknown'; |
| 702 | let maxCount = 0; |
| 703 | for (const [file, count] of fileCounts) { |
| 704 | if (count > maxCount) { |
| 705 | maxCount = count; |
| 706 | maxFile = file; |
| 707 | } |
| 708 | } |
| 709 | return maxFile; |
| 710 | } |
| 711 | |
| 712 | /** |
| 713 | * Merge new cross-file edges with replace-on-conflict behavior |
no test coverage detected