| 190 | } |
| 191 | |
| 192 | export function toWireEdge(edge: Edge): WireEdge { |
| 193 | const meta = (edge.metadata ?? {}) as Record<string, unknown>; |
| 194 | const wire: WireEdge = { kind: edge.kind }; |
| 195 | if (typeof edge.line === 'number') wire.line = edge.line; |
| 196 | if (typeof edge.column === 'number') wire.col = edge.column; |
| 197 | if (typeof meta.confidence === 'number') wire.confidence = meta.confidence; |
| 198 | if (typeof meta.resolvedBy === 'string') wire.resolvedBy = meta.resolvedBy; |
| 199 | if (edge.provenance) wire.provenance = edge.provenance; |
| 200 | if (typeof meta.synthesizedBy === 'string') wire.synthesizedBy = meta.synthesizedBy; |
| 201 | if (typeof meta.via === 'string') wire.via = meta.via; |
| 202 | if (typeof meta.registeredAt === 'string') wire.registeredAt = meta.registeredAt; |
| 203 | if (meta.valueRef === true) wire.valueRef = true; |
| 204 | return wire; |
| 205 | } |
| 206 | |
| 207 | // ============================================================================= |
| 208 | // Relations — edges grouped by the symbol at the other end |