| 203 | const REL_PAIR_SET = new Set(REL_PAIRS); |
| 204 | |
| 205 | function relCSV(rels: TestRel[], nodeTypeMap: Map<string, string>): Uint8Array { |
| 206 | const lines = ['from,to,id,type,properties']; |
| 207 | for (const r of rels) { |
| 208 | const srcType = nodeTypeMap.get(r.source_id); |
| 209 | const tgtType = nodeTypeMap.get(r.target_id); |
| 210 | if (!srcType || !tgtType || !REL_PAIR_SET.has(`${srcType}_${tgtType}`)) |
| 211 | continue; |
| 212 | lines.push( |
| 213 | [r.source_id, r.target_id, r.id, r.type, '{}'].map(csvEscape).join(','), |
| 214 | ); |
| 215 | } |
| 216 | return encoder.encode(lines.join('\n')); |
| 217 | } |
| 218 | |
| 219 | // ── Logging ── |
| 220 | |