UNPKG

@tanstack/offline-transactions

Version:

Offline-first transaction capabilities for TanStack DB

41 lines (40 loc) • 1.44 kB
import { KeyScheduler } from './KeyScheduler.cjs'; import { OutboxManager } from '../outbox/OutboxManager.cjs'; import { OfflineConfig, OfflineTransaction, TransactionSignaler } from '../types.cjs'; export declare class TransactionExecutor { private scheduler; private outbox; private config; private retryPolicy; private isExecuting; private executionPromise; private offlineExecutor; private retryTimer; private fatalError; constructor(scheduler: KeyScheduler, outbox: OutboxManager, config: OfflineConfig, offlineExecutor: TransactionSignaler); execute(transaction: OfflineTransaction): Promise<void>; executeAll(): Promise<void>; private runExecution; private executeTransaction; private runMutationFn; private handleError; private removeSettledTransaction; assertHealthy(): void; private getTerminalError; loadPendingTransactions(): Promise<void>; /** * Restore optimistic state from loaded transactions. * Creates internal transactions to hold the mutations so the collection's * state manager can show optimistic data while waiting for sync. */ private restoreOptimisticState; clear(): void; pause(): void; getPendingCount(): number; private scheduleNextRetry; private getNextRetryTime; private clearRetryTimer; private canExecute; getRunningCount(): number; resetRetryDelays(): void; }