import type { IPatchHandle, TLinkConfig } from "../../../query/types/index.js"; /** * Encapsulates link-based patching and invalidation logic for a {@link Command}. * * Responsible for: * - Applying optimistic patches before the mutation runs. * - Applying update patches after successful mutation. * - Invalidating / refreshing linked resources. * * @template TArgs - The argument type of the owning Command. * @template TData - The data type returned by the owning Command. */ export declare class LinkManager { private readonly _links; constructor(_links: TLinkConfig[]); applyOptimisticPatches(args: TArgs): IPatchHandle[]; applyUpdatePatches(args: TArgs, result: TData): void; invalidateResources(args: TArgs): void; /** * Handle the settled result of a mutation: commit or rollback optimistic * patches, apply update patches, and invalidate linked resources. * * Contract: **this never throws.** It runs inside an unconsumed `.then` * handler in {@link Command.execute}, so any escaping error would become an * unhandled rejection — and the mutation itself has already succeeded, so * there is nowhere to surface it. On a fulfilled result every phase is * therefore isolated and the optimistic handles are always committed exactly * once, even when a user-supplied `update`/`forwardArgs`/`invalidate` throws: * - a dangling optimistic patch would otherwise be left pending forever; * - invalidation is the reconciliation that repairs a bad patch, so it must * still run after a failed `update`. */ settle(args: TArgs, patchHandles: IPatchHandle[], result: PromiseSettledResult): void; /** * Run a settle sub-step, containing any throw so it can neither abort the * surrounding loop nor escape {@link settle}. The failure is reported (not * silently swallowed) because it almost always signals a bug in a * user-supplied link callback. */ private _runIsolated; }