import type { ZveltioClient } from './client.js'; export type CRDTConflictResolution = 'lww' | 'custom'; export interface SyncManagerConfig { /** Sync interval in ms (default: 5000) */ syncInterval?: number; /** Max retry attempts per operation (default: 5) */ maxRetries?: number; /** Exponential backoff base in ms (default: 1000) */ backoffBase?: number; /** Callback for conflicts (default: server-wins) */ onConflict?: (local: any, server: any) => any; /** CRDT conflict resolution strategy: 'lww' (field-level LWW merge) or 'custom' (onConflict cb). Default: 'lww' */ conflictResolution?: CRDTConflictResolution; } export declare class SyncManager { private store; private client; private realtime; private config; private syncTimer; private isOnline; private isSyncing; private listeners; constructor(client: ZveltioClient, config?: SyncManagerConfig); start(realtimeUrl?: string): Promise; /** * Returns a local-first collection proxy: * - list/get reads LOCAL (instant) * - create/update/delete writes LOCAL + queues sync * - subscribe receives realtime updates */ collection(name: string): { /** List records — reads LOCAL instantly */ list: () => Promise<{ _syncStatus: "synced" | "pending" | "conflict"; id: string; }[]>; /** Get one record — reads LOCAL instantly */ get: (id: string) => Promise<{ _syncStatus: "synced" | "pending" | "conflict"; id: string; } | null>; /** Create — writes LOCAL + queues sync */ create: (data: Record) => Promise<{ _syncStatus: "synced" | "pending" | "conflict"; id: string; }>; /** Update — writes LOCAL + queues sync */ update: (id: string, data: Record) => Promise<{ _syncStatus: "synced" | "pending" | "conflict"; id: string; }>; /** Delete — soft delete LOCAL + queues sync */ delete: (id: string) => Promise; /** Subscribe la changes (realtime + local writes) */ subscribe: (callback: (records: any[]) => void) => () => void; /** Get pending conflicts for UI resolution */ getConflicts: () => Promise; /** Resolve a conflict manually */ resolveConflict: (id: string, resolvedData: Record) => Promise; }; /** Force sync now (non-blocking) */ syncNow(): Promise; private notifyListeners; /** Status: pending operations count, conflicts count */ getStatus(): Promise<{ pending: number; conflicts: number; isOnline: boolean; }>; stop(): Promise; } //# sourceMappingURL=sync-manager.d.ts.map