/** * db4ai Client Factory * * Factory function for creating typed db4ai clients with support for * remote endpoints and Cloudflare Workers service bindings. * * Features: * - Connection pooling and reuse * - Query caching with configurable TTL * - Lazy initialization of resources * - Memory-efficient collection management * * @packageDocumentation */ import type { DB4Config, DB4Client, ClientOptions } from './types.js'; /** * Create a db4ai client instance. * * @typeParam TSchema - Schema type mapping collection names to document types * @param config - Client configuration (remote endpoint or service binding) * @param options - Optional client options for caching, pooling, etc. * @returns Typed client with collection accessors * * @example * Remote endpoint: * ```typescript * const client = db4<{ users: User; posts: Post }>({ * endpoint: 'https://api.db4.dev', * apiKey: 'sk_live_...' * }); * ``` * * @example * Service binding (Workers): * ```typescript * const client = db4<{ users: User }>({ * binding: env.DB4 * }); * ``` * * @example * With performance options: * ```typescript * const client = db4<{ users: User }>({ * endpoint: 'https://api.db4.dev', * apiKey: 'sk_live_...' * }, { * enableCache: true, * cacheConfig: { defaultTtl: 60000 }, * enablePooling: true, * poolConfig: { maxConnections: 20 } * }); * ``` */ export declare function db4>(config: DB4Config, options?: ClientOptions): DB4Client; /** * Check if a client is using zero-latency path (service binding). */ export declare function isZeroLatency(config: DB4Config): boolean; /** * Get timeout value from configuration. */ export declare function getTimeout(config: DB4Config): number; /** * Get retry count from configuration. */ export declare function getRetries(config: DB4Config): number; //# sourceMappingURL=client.d.ts.map