MCPcopy
hub / github.com/opentrace/opentrace / relCSV

Function relCSV

ui/src/test-db.ts:205–217  ·  view source on GitHub ↗
(rels: TestRel[], nodeTypeMap: Map<string, string>)

Source from the content-addressed store, hash-verified

203const REL_PAIR_SET = new Set(REL_PAIRS);
204
205function 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

Callers 1

runTestFunction · 0.85

Calls 2

pushMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected