import { z } from 'zod'; import { VirtualFilesystem, VirtualFilesystemConfig } from '../filesystem/index.js'; import { ResourceRegistry } from '../federation/ResourceRegistry.js'; import { MCPConnectionPool } from '../federation/ConnectionPool.js'; declare const DuckDBConfigSchema: z.ZodObject<{ memory: z.ZodDefault; threads: z.ZodDefault; allowUnsignedExtensions: z.ZodDefault; s3Config: z.ZodOptional; accessKey: z.ZodOptional; secretKey: z.ZodOptional; region: z.ZodDefault; useSSL: z.ZodDefault; }, z.core.$strip>>; }, z.core.$strip>; export type DuckDBConfig = z.infer; /** * Extended configuration with Virtual Filesystem support */ export interface DuckDBServiceConfig extends DuckDBConfig { virtualFilesystem?: { enabled?: boolean; config?: VirtualFilesystemConfig; resourceRegistry?: ResourceRegistry; connectionPool?: MCPConnectionPool; }; } /** * DuckDB service for executing queries and managing connections */ export declare class DuckDBService { private instance; private connection; private config; private isInitialized; private virtualFs?; private extendedConfig?; private _onagerLoaded; /** * Whether the Onager graph-analytics extension was successfully loaded. * Only true when ENABLE_ONAGER=true and the community binary loaded. * @since v1.6.0 */ get onagerLoaded(): boolean; constructor(config?: Partial); /** * Initialize DuckDB instance and connection */ initialize(): Promise; /** * Initialize Virtual Filesystem for mcp:// URI support */ private initializeVirtualFilesystem; /** * Execute a SQL query with Virtual Filesystem support */ executeQueryWithVFS(sql: string, params?: any[]): Promise; /** * Load DuckPGQ extension for Property Graph queries * * Supports multiple installation sources: * - community: Official DuckDB community repository (default) * - edge: Edge/nightly builds for experimental DuckDB versions * - custom: Custom repository URL specified in DUCKPGQ_CUSTOM_REPO * * Environment variables: * - DUCKPGQ_SOURCE: Installation source (community/edge/custom) * - DUCKPGQ_CUSTOM_REPO: Custom repository URL (when source=custom) * - DUCKPGQ_VERSION: Specific version to install (optional) * - DUCKPGQ_STRICT_MODE: If true, throw error on load failure * * @throws Error if DUCKPGQ_STRICT_MODE=true and load fails */ private loadDuckPGQ; /** * Load the Onager graph-analytics extension (community). * * Onager (https://github.com/CogitatorTech/onager) ships ~65 native graph * table functions — centrality (pagerank, betweenness, katz, closeness…), * community detection (louvain, infomap, label_prop…), shortest paths * (dijkstra, bellman_ford, floyd_warshall), link prediction (adamic_adar, * jaccard…), graph metrics, MST, ego/k-hop subgraphs and more — callable * directly on edge tables without CREATE PROPERTY GRAPH. * * Opt-in via ENABLE_ONAGER=true because the extension is alpha: * - node ids must be BIGINT (cast with `column::BIGINT`) * - some functions bind only via named parameters (e.g. `source = 1`) * - not built for osx_amd64 / windows_amd64_mingw / WASM * * Environment variables: * - ENABLE_ONAGER: 'true' to install+load (default: off) * - ONAGER_STRICT_MODE: 'true' to throw on load failure (default: warn) * * Requires DuckDB >= 1.5.4 (first version with a published Onager binary * compatible with the current release line). * * @since v1.6.0 */ private loadOnager; /** * Configure S3 credentials for DuckDB */ private configureS3; /** * Execute a SQL query and return results */ executeQuery(sql: string, _params?: any[]): Promise; /** * Execute a SQL query and return a single result */ executeScalar(sql: string, params?: any[]): Promise; /** * Get database schema information */ getSchema(): Promise; /** * Get columns for a specific table */ getTableColumns(tableName: string, schema?: string): Promise; /** * Create a table from JSON data */ createTableFromJSON(tableName: string, jsonData: any[]): Promise; /** * Read a Parquet file */ readParquet(path: string, limit?: number): Promise; /** * Read a CSV file */ readCSV(path: string, limit?: number): Promise; /** * Read a JSON file */ readJSON(path: string, limit?: number): Promise; /** * Export query results to a file */ exportToFile(sql: string, outputPath: string, format: 'parquet' | 'csv' | 'json'): Promise; /** * Check if a table exists */ tableExists(tableName: string, schema?: string): Promise; /** * Get row count for a table */ getRowCount(tableName: string, schema?: string): Promise; /** * Close the database connection */ close(): Promise; /** * Check if the service is initialized */ isReady(): boolean; /** * Get Virtual Filesystem instance */ getVirtualFilesystem(): VirtualFilesystem | undefined; /** * Check if Virtual Filesystem is enabled */ hasVirtualFilesystem(): boolean; /** * List available MCP resources */ listMCPResources(): string[]; /** * Search for MCP resources by pattern */ searchMCPResources(pattern: string): string[]; } /** * Get or create a singleton DuckDB service instance */ export declare function getDuckDBService(config?: Partial): Promise; /** * Create a new DuckDB service instance (non-singleton) */ export declare function createDuckDBService(config?: Partial): DuckDBService; export {}; //# sourceMappingURL=service.d.ts.map