@tanstack/offline-transactions
Version:
Offline-first transaction capabilities for TanStack DB
36 lines (35 loc) • 1.3 kB
text/typescript
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;
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;
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;
getPendingCount(): number;
private scheduleNextRetry;
private getEarliestRetryTime;
private clearRetryTimer;
private isOnline;
getRunningCount(): number;
resetRetryDelays(): void;
}