import type { IPatchHandle, TMachineState } from "../../../query/types/index.js"; /** * Base class for the Machine state machine. * * Provides all transition methods with runtime guards. * Subtypes extend this and override their valid transitions with narrower return types. * Invalid transitions inherited from MachineBase throw MachineTransitionError/MachineStateError. */ export declare class MachineBase { readonly state: TMachineState; protected constructor(state: TMachineState); /** pending → success */ success(data: TData): MachineBase; /** pending → error, refreshing → refresh-error, success → refresh-error */ fail(error: unknown): MachineBase; /** success → refreshing, refresh-error → refreshing */ refresh(): MachineBase; /** * error → pending, refresh-error → refreshing. Unlike {@link refresh}, the * retried failure stays in `error` and the target is marked `isRetrying`. */ retry(): MachineBase; /** success → success (subsequent stream emission; replays patches on new data) */ next(data: TData): MachineBase; /** refreshing → success (replays patches on new data) */ rebase(data: TData): MachineBase; /** Create an optimistic patch (success, refreshing, refresh-error) */ createPatch(patchFn: (data: TData) => void, onSettle?: () => void): { machine: MachineBase; handle: IPatchHandle; }; /** Process all settled patches up to the first pending one */ finishPatch(): MachineBase; /** Process all settled patches (continues past pending) */ finishAllPatches(): MachineBase; }