import { StorageStrategy, QueryMatcher } from './storage-strategy'; export interface D1Database { prepare(query: string): D1PreparedStatement; batch(statements: D1PreparedStatement[]): Promise[]>; exec(query: string): Promise; dump(): Promise; } export interface D1PreparedStatement { bind(...values: unknown[]): D1PreparedStatement; first(colName?: string): Promise; run(): Promise>; all(): Promise>; raw(): Promise; } export interface D1Result { results?: T[]; success: boolean; error?: string; meta: { duration: number; size_after: number; rows_read: number; rows_written: number; }; } export interface D1ExecResult { count?: number; duration?: number; results?: unknown[]; } export interface D1StorageOptions { db: D1Database; modelName: string; } /** * Cloudflare D1 Storage Strategy * * Fast SQL storage for Cloudflare Workers using D1 database. * Much faster than Durable Objects KV for bulk operations! * * Still loads all documents into memory for synchronous access, * but bulk operations use D1's native SQL performance. */ export declare class D1StorageStrategy implements StorageStrategy { private _data; private _db; private _modelName; private _tableName; private _getDocId; private _queryIndexes; private _initialized; lastOperationTime: number; constructor(options: D1StorageOptions); initialize(): Promise; getAll(): Promise; add(doc: T): Promise; addMany(docs: T[]): Promise; update(oldDoc: T, newDoc: T): Promise; remove(doc: T): Promise; removeMany(docs: T[]): Promise; clear(): Promise; createIndex(fields: keyof T | Array, options?: { unique?: boolean; }): Promise; rebuildIndexes(): Promise; updateIndexForDocument(oldDoc: T | null, newDoc: T | null): void; checkUniqueConstraints(doc: Partial, excludeDoc?: T): void; findDocuments(matcher: QueryMatcher, indexHint?: { fields: Array; values: Record; }): T[]; } //# sourceMappingURL=d1-strategy.d.ts.map