···2323export interface GraphDataDTO {
2424 nodes: GraphNodeDTO[];
2525 edges: GraphEdgeDTO[];
2626+ totalNodeCount: number;
2627}
27282829export interface IGraphQueryRepository {
2930 /**
3030- * Get all nodes and edges for the global graph visualization
3131- * Returns the complete graph structure with all relationships
3131+ * Get nodes and edges for graph visualization with pagination support
3232+ * Returns paginated graph data with total count for calculating pagination metadata
3333+ *
3434+ * @param page - Page number (1-indexed, defaults to 1)
3535+ * @param limit - Number of nodes per page (defaults to 300)
3636+ * @param userId - Optional user DID to scope the graph to a specific user's data
3237 */
3333- getGraphData(): Promise<GraphDataDTO>;
3838+ getGraphData(
3939+ page?: number,
4040+ limit?: number,
4141+ userId?: string,
4242+ ): Promise<GraphDataDTO>;
4343+4444+ /**
4545+ * Get a sub-graph centered around a specific URL with depth-based traversal
4646+ * Returns all nodes and edges within N hops of the target URL
4747+ *
4848+ * @param url - Target URL to center the sub-graph around
4949+ * @param depth - Number of edge hops to traverse (1-5, defaults to 1)
5050+ */
5151+ getUrlSubGraph(url: string, depth: number): Promise<GraphDataDTO>;
3452}
···1616 return InMemoryGraphQueryRepository.instance;
1717 }
18181919- async getGraphData(): Promise<GraphDataDTO> {
1919+ async getGraphData(page?: number, limit?: number): Promise<GraphDataDTO> {
2020+ // For in-memory implementation, return empty graph
2121+ // In a real test scenario, you would populate this with test data
2222+ // and apply pagination
2323+ return { nodes: [], edges: [], totalNodeCount: 0 };
2424+ }
2525+2626+ async getUrlSubGraph(url: string, depth: number): Promise<GraphDataDTO> {
2027 // For in-memory implementation, return empty graph
2128 // In a real test scenario, you would populate this with test data
2222- return { nodes: [], edges: [] };
2929+ return { nodes: [], edges: [], totalNodeCount: 0 };
2330 }
2431}
···358358}
359359360360// Graph request types
361361-export interface GetGraphDataParams {
362362- // No parameters needed for global graph in v1
361361+export interface GetGraphDataParams extends PaginationParams {
362362+ // Supports pagination for incremental graph loading
363363+}
364364+365365+export interface GetUserGraphDataParams extends GetGraphDataParams {
366366+ identifier: string; // Can be DID or handle
367367+}
368368+369369+export interface GetUrlGraphDataParams {
370370+ url: string; // Target URL to center the sub-graph around
371371+ depth?: number; // Number of edge hops to traverse (1-5, defaults to 1)
363372}