import { type Patch } from "immer"; import type { TPatchEntry, TPatchState } from "../../../query/types/index.js"; export type TPatchResult = { ok: true; data: TData; patchState: TPatchState | null; } | { ok: false; }; export declare function createPatches(base: T, recipe: (draft: T) => void): [T, Patch[], Patch[]]; export declare function applyForwardPatches(base: T, patches: Patch[]): T; export declare function rebasePatches(base: T, forwardPatches: Patch[]): [T, Patch[], Patch[]]; /** * Replay a list of patch entries onto new base data. * Pure data operation — no machine-state knowledge. */ export declare function replayPatchEntries(baseData: TData, patches: TPatchEntry[]): TPatchResult; /** * Process a patch state: fold settled independent patches, then replay remaining. * Stops at the first pending patch — patches after it are left as-is. * Pure data operation — no machine-state knowledge. */ export declare function processPatchState(patchState: TPatchState): TPatchResult; /** * Process ALL settled patches in a patch state, continuing past pending ones. * Committed patches are rebased and folded into originalData; * aborted patches are dropped; pending patches are kept and rebased. * Pure data operation — no machine-state knowledge. */ export declare function processAllSettledPatches(patchState: TPatchState): TPatchResult;