/** * ToonDB gRPC Client - Thin SDK Wrapper * * This module provides a thin gRPC client wrapper for the ToonDB server. * All business logic runs on the server (Thick Server / Thin Client architecture). * * The client is approximately ~250 lines of code, delegating all operations to the server. */ export interface SearchResult { id: number; distance: number; } export interface Document { id: string; content: string; embedding: number[]; metadata: Record; } export interface GraphNode { id: string; nodeType: string; properties: Record; } export interface GraphEdge { fromId: string; edgeType: string; toId: string; properties: Record; } export interface ToonDBClientOptions { address?: string; secure?: boolean; protoPath?: string; } /** * Thin gRPC client for ToonDB. * * All operations are delegated to the ToonDB gRPC server. * This client provides a TypeScript interface over the gRPC protocol. * * Usage: * ```typescript * const client = new ToonDBClient({ address: 'localhost:50051' }); * * // Create collection * await client.createCollection('docs', { dimension: 384 }); * * // Add documents * await client.addDocuments('docs', [ * { id: '1', content: 'Hello', embedding: [...] } * ]); * * // Search * const results = await client.search('docs', queryVector, 5); * ``` */ export declare class ToonDBClient { private address; private credentials; private stubs; private protoPath; private packageDefinition; private proto; constructor(options?: ToonDBClientOptions); private getStub; private promisify; /** * Close all gRPC connections. */ close(): void; createIndex(name: string, dimension: number, options?: { metric?: string; m?: number; efConstruction?: number; }): Promise; insertVectors(indexName: string, ids: number[], vectors: number[][]): Promise; search(indexName: string, query: number[], k?: number, ef?: number): Promise; createCollection(name: string, options: { dimension: number; namespace?: string; metric?: string; }): Promise; addDocuments(collectionName: string, documents: Array<{ id?: string; content?: string; embedding?: number[]; metadata?: Record; }>, namespace?: string): Promise; searchCollection(collectionName: string, query: number[], k?: number, options?: { namespace?: string; filter?: Record; }): Promise; addNode(nodeId: string, nodeType: string, properties?: Record, namespace?: string): Promise; addEdge(fromId: string, edgeType: string, toId: string, properties?: Record, namespace?: string): Promise; traverse(startNode: string, options?: { maxDepth?: number; order?: 'bfs' | 'dfs'; namespace?: string; }): Promise<{ nodes: GraphNode[]; edges: GraphEdge[]; }>; cacheGet(cacheName: string, queryEmbedding: number[], threshold?: number): Promise; cachePut(cacheName: string, key: string, value: string, keyEmbedding: number[], ttlSeconds?: number): Promise; startTrace(name: string): Promise<{ traceId: string; rootSpanId: string; }>; startSpan(traceId: string, parentSpanId: string, name: string): Promise; endSpan(traceId: string, spanId: string, status?: 'ok' | 'error' | 'unset'): Promise; get(key: Buffer, namespace?: string): Promise; put(key: Buffer, value: Buffer, namespace?: string, ttlSeconds?: number): Promise; delete(key: Buffer, namespace?: string): Promise; } /** * Connect to ToonDB gRPC server. */ export declare function connect(address?: string, options?: Omit): ToonDBClient; export declare const GrpcClient: typeof ToonDBClient; //# sourceMappingURL=grpc-client.d.ts.map