/** * db4ai - The all-in-one client SDK for db4 * * This package provides a type-safe, ergonomic API for database operations * with support for: * - IceType schema definition with DB() * - Fluent query builder with excellent TypeScript inference * - CRUD operations with convenience methods * - Real-time subscriptions * - ACID transactions * - Connection pooling and query caching * - CapnWeb RPC transport * * @example Schema-first usage (recommended) * ```typescript * import { DB, createClient } from 'db4ai'; * * // Define your schema using IceType * const schema = DB({ * User: { * id: 'cuid!', * email: 'string! #unique', * name: 'string?', * posts: '[Post] -> author', * }, * Post: { * id: 'cuid!', * title: 'string!', * content: 'text', * author: 'User! <- posts', * }, * }); * * // Create a client from the schema * const db = createClient({ schema }); * * // Full type inference - no codegen needed * const user = await db.users.create({ email: 'alice@example.com', name: 'Alice' }); * const posts = await db.posts.find({ where: { 'author.id': user.id } }); * ``` * * @example Direct client usage * ```typescript * import { db4 } from 'db4ai'; * * // Create a typed client directly * const db = db4<{ users: User }>({ * endpoint: 'https://api.db4.dev', * apiKey: 'sk_live_...' * }); * * const user = await db.users.create({ name: 'Alice', email: 'alice@example.com' }); * ``` * * @packageDocumentation */ export { DB, createIceTypeDB } from '@db4/store'; export type { SchemaDefinition, TableDefinition, IceTypeDatabase, IceTypeDBConfig, } from '@db4/store'; export { db4, isZeroLatency, getTimeout, getRetries } from './client.js'; export { createClient } from '@db4/client'; export { createCollection, createOptimizedCollection, CollectionBuilder, type CollectionHooks, } from './collection.js'; export type { DB4Config, RemoteConfig, BindingConfig, ClientOptions, ClientStats, CacheStats, PoolStats, DB4Client, Collection, Document, WithId, WithoutId, PartialDoc, DeepPartial, Filter, FilterCondition, Sort, SortDirection, Projection, FindOptions, FindResult, UpdateManyResult, DeleteManyResult, InsertManyResult, } from './types.js'; export { isRemoteConfig, isBindingConfig } from './types.js'; export { ConnectionPool, createConnectionPool, type PoolConfig, type PooledConnection, type ConnectionState, type PoolStats as ConnectionPoolStats, } from './connection-pool.js'; export { QueryCache, createQueryCache, generateCacheKey, type CacheConfig, type CacheStats as QueryCacheStats, type CacheGetOptions, type CacheSetOptions, } from './cache.js'; export { createQueryBuilder, query, Q, type QueryBuilder, type QueryOperators, type WhereClause, type SelectClause, type IncludeClause, type IncludeOptions, type OrderByClause, type Query, } from './query.js'; export { transaction, createDb, TransactionState, ConflictError, TransactionTimeoutError, type TransactionOptions, type TransactionContext, type TransactionalCollection, type StagedOperation, type OperationType, } from './transaction.js'; export { SubscriptionManager, createSubscriptionManager, createCollectionSubscription, type SubscriptionState, type SubscriptionEventType, type SubscriptionEvent, type QuerySubscriptionCallback, type DocumentSubscriptionCallback, type Unsubscribe, type SubscriptionOptions, type WebSocketState, type ReconnectOptions, } from './subscription.js'; export { CapnWebTransport, createCapnWebTransport, CapnWebSerializer, JsonSerializer, createCapnWebSerializer, createJsonSerializer, RequestCorrelator, createRequestCorrelator, RequestBatcher, createRequestBatcher, StreamManager, createStreamManager, RPCError, type RPCRequest, type RPCResponse, type RPCErrorInfo, type RPCBatchRequest, type RPCBatchResponse, type RPCStreamChunk, type RPCMessage, type TransportOptions, type BatchOptions, type StreamHandler, type BackpressureHandler, type ErrorCode, MESSAGE_TYPE_CODES, CAPNWEB_MAGIC, CAPNWEB_VERSION, HEADER_SIZE, MAX_MESSAGE_SIZE, ERROR_CODES, } from './rpc.js'; //# sourceMappingURL=index.d.ts.map