CodeGraph/docs
Section 7.2

Code Entities & Node Types

Complete TypeScript interface specifications for all four node types in the CodeGraph entity schema.

Source: server/src/graph/models/GraphNode.ts

The `GraphNode` Discriminated Union

server/src/graph/models/GraphNode.ts
1
2
3
4
5
6
7
export type GraphNodeKind = "file" | "symbol" | "dependency" | "module"; export type GraphNode = | FileNode | SymbolNode | DependencyNode | ModuleNode;

Individual Node Interfaces

Node Interfaces
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
export interface FileNode { id: string; // "file:/abs/path/to/file.ts" kind: "file"; filePath: string; } export interface SymbolNode { id: string; // "symbol:/abs/path/to/file.ts:12:4:login" kind: "symbol"; name: string; symbolKind: SymbolKind; fileId: string; // Owning FileNode ID location: SymbolLocation; // { startLine, startColumn, endLine, endColumn } methodKind?: MethodKind; // "get" | "set" | "method" | "private" parentSymbolId?: string; // Enclosing container symbol ID } export interface DependencyNode { id: string; // "dependency:express" kind: "dependency"; name: string; version: string; packageJsonPath: string; } export interface ModuleNode { id: string; // "module:fs" kind: "module"; name: string; }