(row: Record<string, string>, prefix: string, layout: Map<number, GraphNode>)
| 77 | |
| 78 | const languageColors: Record<string, string> = { ts: '#6ea6be', tsx: '#6ea6be', js: '#c3b775', jsx: '#c3b775', c: '#92a8b4', h: '#92a8b4', cpp: '#b28da6', py: '#8daf88', go: '#77b2b4', rs: '#bd947c', java: '#bd9281', cs: '#a392bb', rb: '#b78288', swift: '#bf9b85', kt: '#af97ba' }; |
| 79 | function readNode(row: Record<string, string>, prefix: string, layout: Map<number, GraphNode>): GraphNode { |
| 80 | const identity = id(row[`${prefix}id`]), known = layout.get(identity); |
| 81 | const name = row[`${prefix}name`] || String(identity), label = row[`${prefix}label`] || known?.label || '', qualifiedName = row[`${prefix}qn`] || undefined; |
| 82 | // A Branch node answers with the file "{}": no file (round 4, N1). |
| 83 | const path = nodeFilePath({ name, label, qualified_name: qualifiedName, file_path: row[`${prefix}file`] || undefined }); |
| 84 | return { ...known, id: identity, name, label, |
| 85 | qualified_name: qualifiedName, file_path: path, |
| 86 | start_line: number(row[`${prefix}start_line`]), end_line: number(row[`${prefix}end_line`]), |
| 87 | x: known?.x ?? 0, y: known?.y ?? 0, z: known?.z ?? 0, |
| 88 | size: known?.size ?? 2.8, color: known?.color ?? languageColors[path?.split('.').pop() ?? ''] ?? '#97a6ad' }; |
| 89 | } |
| 90 | const anyNames = (alias: string, names: readonly string[]) => `(${names.map(value => `${alias}.qualified_name = "${escapeLiteral(value)}"`).join(' OR ')})`; |
| 91 | |
| 92 | /** Deterministic concentric hop rings. Names within a folder stay adjacent; |
no test coverage detected