types/graph.types.ts

types/graph.types.ts is a file in Bane's Lab Site. 46 lines of code and 10 definitions.

export type GraphLayer = "api" | "ontology" | "site" | `source:${string}`;

export interface GraphAddress {
    readonly json: string;
    readonly markdown: string | null;
}

export interface GraphNode {
    readonly address: GraphAddress | null;
    readonly citation: string | null;
    readonly fields: Readonly<Record<string, unknown>>;
    readonly href: string | null;
    readonly kind: string;
    readonly layer: GraphLayer;
    readonly number: string | null;
    readonly ref: string;
    readonly title: string;
}

export interface ChunkTarget {
    readonly href: string | null;
    readonly number: string | null;
    readonly title: string;
}

export interface ChunkRelation {
    readonly relation: string;
    readonly targets: readonly ChunkTarget[];
}

export interface ChunkNode {
    readonly kind: string;
    readonly number: string | null;
    readonly relations: readonly ChunkRelation[];
    readonly title: string;
}

export type GraphChunk = Readonly<Record<string, ChunkNode>>;

export interface GraphEdge {
    readonly from: string;
    readonly relation: string;
    readonly to: string;
}

export interface RelationPair {
    readonly forward: string;
    readonly reverse: string;
}

export interface RelationRecord extends RelationPair {
    readonly leaf: boolean;
    readonly rollsUp: boolean;
    readonly tooltip: boolean;
}