/** * Graph Query Interfaces * * Types for query operations and filter clauses * Based on Ductape Graph API documentation (nodes.md, overview.md) */ /** * Filter operators for graph queries * As documented in nodes.md * Uses lowercase naming convention to match Mongoose/MongoDB style for less adoption friction * Note: Uppercase versions are still supported for backwards compatibility */ export interface IGraphFilterOperator { /** Greater than */ $gt?: number | Date; /** Greater than or equal */ $gte?: number | Date; /** Less than */ $lt?: number | Date; /** Less than or equal */ $lte?: number | Date; /** Not equal */ $ne?: any; /** In array */ $in?: any[]; /** Not in array */ $nin?: any[]; /** String contains */ $contains?: string; /** String starts with */ $startsWith?: string; /** String ends with */ $endsWith?: string; /** Property exists */ $exists?: boolean; /** Regular expression match */ $regex?: string | RegExp; } /** * Where clause for filtering * As documented in nodes.md * Uses lowercase naming convention to match Mongoose/MongoDB style */ export interface IGraphWhereClause { /** AND conditions */ $and?: IGraphWhereClause[] | IGraphWhereClause; /** OR conditions */ $or?: IGraphWhereClause[] | IGraphWhereClause; /** NOT conditions */ $not?: IGraphWhereClause; /** Property conditions */ [key: string]: any | IGraphFilterOperator | IGraphWhereClause | IGraphWhereClause[] | undefined; } /** * Raw query options * As documented in overview.md */ export interface IRawQueryOptions { /** The query string (Cypher, Gremlin, AQL) */ query: string; /** Query parameters */ params?: Record; /** Connection context override */ env?: string; /** Graph tag override */ graph?: string; } /** * Raw query result */ export interface IRawQueryResult { /** Query results */ records: T[]; /** Summary information */ summary?: { /** Query execution time */ resultAvailableAfter?: number; /** Query consumption time */ resultConsumedAfter?: number; /** Database info */ database?: string; }; } /** * Count nodes options * As documented in overview.md */ export interface ICountNodesOptions { /** Node labels to count */ labels?: string[]; /** Filter conditions */ where?: IGraphWhereClause; } /** * Count nodes result */ export interface ICountNodesResult { /** Count of matching nodes */ count: number; } /** * Count relationships options * As documented in overview.md */ export interface ICountRelationshipsOptions { /** Relationship types to count */ types?: string[]; /** Filter conditions */ where?: IGraphWhereClause; } /** * Count relationships result */ export interface ICountRelationshipsResult { /** Count of matching relationships */ count: number; } /** * Graph statistics * As documented in overview.md */ export interface IGraphStatistics { /** Total number of nodes */ nodeCount: number; /** Total number of relationships */ relationshipCount: number; /** Node count by label */ nodesByLabel?: Record; /** Relationship count by type */ relationshipsByType?: Record; } /** * Full-text search options * As documented in overview.md */ export interface IFullTextSearchOptions { /** Index name */ indexName: string; /** Search query */ query: string; /** Maximum results */ limit?: number; } /** * Full-text search result */ export interface IFullTextSearchResult { /** Matching nodes */ nodes: T[]; /** Search scores */ scores?: number[]; } /** * Vector search options * As documented in overview.md */ export interface IVectorSearchOptions { /** Index name */ indexName: string; /** Search vector */ vector: number[]; /** Number of results (top-k) */ topK?: number; /** Minimum similarity threshold */ minScore?: number; } /** * Vector search result */ export interface IVectorSearchResult { /** Matching nodes */ nodes: T[]; /** Similarity scores */ scores: number[]; }