Build a SymbolMetadata object from a graph node's properties.
(node: GraphNode)
| 36 | |
| 37 | /** Build a SymbolMetadata object from a graph node's properties. */ |
| 38 | function summarizeNode(node: GraphNode): string { |
| 39 | const kind = TYPE_TO_KIND[node.type]; |
| 40 | if (!kind) { |
| 41 | // Fallback for Repository, Package, etc. |
| 42 | return `${node.type} ${node.name}`; |
| 43 | } |
| 44 | |
| 45 | const props = node.properties ?? {}; |
| 46 | return summarizeFromMetadata({ |
| 47 | name: node.name, |
| 48 | kind, |
| 49 | signature: props.signature as string | undefined, |
| 50 | language: props.language as string | undefined, |
| 51 | lineCount: |
| 52 | typeof props.startLine === 'number' && typeof props.endLine === 'number' |
| 53 | ? props.endLine - props.startLine + 1 |
| 54 | : undefined, |
| 55 | receiverType: props.receiver_type as string | undefined, |
| 56 | fileName: |
| 57 | kind === 'file' ? ((props.path as string) ?? node.name) : undefined, |
| 58 | childNames: props.childNames as string[] | undefined, |
| 59 | docs: props.docs as string | undefined, |
| 60 | }); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Wrap an inner event generator, adding summaries to every node that |
no test coverage detected