SPB Git
2.1 KB · 31 lines typescript
1/** Shared (server + client) types for the knowledge graph. Keep this file free of server imports. */2export type NodeKind = "page" | "database" | "research" | "row" | "attachment" | "tag";3export type EdgeKind = "link" | "relation" | "ai_suggested" | "attachment" | "tag";4export type EdgeStatus = "accepted" | "suggested";5export const NODE_KINDS: NodeKind[] = ["page", "database", "research", "row", "attachment", "tag"];6export const NODE_KIND_LABELS: Record<NodeKind, string> = { page: "Pages", database: "Databases", research: "Research", row: "Database rows", attachment: "Attachments", tag: "Tags" };78export interface GraphNode {9  id: string; kind: NodeKind; title: string; icon: string | null; section: string | null;10  updatedAt: string | null; databaseId: string | null; degree: number; in: number; out: number;11}12export interface GraphEdge {13  id: string; source: string; target: string; kind: EdgeKind; status: EdgeStatus;14  /** link: "link" | "ai" ; relation: property name ; ai_suggested: model id */15  sub: string | null; confidence: number | null; rationale: string | null;16}17export interface GraphFilters {18  types?: NodeKind[]; section?: string | null; since?: Date | null;19  /** restrict to the N-hop neighbourhood of a page */20  pageId?: string | null; depth?: number;21  hideOrphans?: boolean; suggestions?: boolean;22}23export interface GraphData { nodes: GraphNode[]; edges: GraphEdge[]; center?: string | null; stats: { pages: number; edges: number; suggested: number } }2425export interface Suggestion {26  id: string; fromId: string; toId: string; status: string; confidence: number | null; rationale: string | null; model: string | null;27  createdAt: string; decidedAt: string | null; fromTitle: string; fromIcon: string | null; toTitle: string; toIcon: string | null;28}29export interface BacklinkRow { id: string; title: string; icon: string | null; type: string; section: string; updatedAt: string; incoming: number; outgoing: number; suggested: number }30export interface UnlinkedMention { fromId: string; fromTitle: string; fromIcon: string | null; toId: string; toTitle: string; toIcon: string | null; excerpt: string; key: string }31
Files · main
Menu

Theme