( group: WorkflowGroup, idByName: ReadonlyMap<string, string> )
| 98 | * (mothership) or by id (first-party UI). |
| 99 | */ |
| 100 | export function remapGroupColumnRefs( |
| 101 | group: WorkflowGroup, |
| 102 | idByName: ReadonlyMap<string, string> |
| 103 | ): WorkflowGroup { |
| 104 | const remap = (ref: string) => idByName.get(ref) ?? ref |
| 105 | return { |
| 106 | ...group, |
| 107 | outputs: group.outputs.map((o) => ({ ...o, columnName: remap(o.columnName) })), |
| 108 | ...(group.dependencies?.columns |
| 109 | ? { dependencies: { columns: group.dependencies.columns.map(remap) } } |
| 110 | : {}), |
| 111 | ...(group.inputMappings |
| 112 | ? { |
| 113 | inputMappings: group.inputMappings.map((m) => ({ |
| 114 | ...m, |
| 115 | columnName: remap(m.columnName), |
| 116 | })), |
| 117 | } |
| 118 | : {}), |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | /** `name → id` for translating inbound wire data (v1 / mothership / CSV import). */ |
| 123 | export function buildIdByName(schema: TableSchema): Map<string, string> { |
no test coverage detected