import { type HookError, type HookFailureResult } from './types'; /** * Outcome of a {@link UseMutationResult.mutate} call. Successful runs include the resolved value; * failures carry a normalized {@link HookError}. */ export type MutationOutcome = { readonly success: true; readonly data: T; } | HookFailureResult; /** * Shared state contract surfaced by {@link useMutation}. Mirrors {@link VoidAsyncState} so that * mutation-driven hooks can spread it into their public result without translation. */ export interface UseMutationState { readonly error: HookError | null; readonly isLoading: boolean; readonly isPending: boolean; } /** * Options accepted on a per-call basis to customise error reporting. */ export interface MutateCallOptions { readonly operation?: string; readonly hint?: string; } export interface UseMutationResult extends UseMutationState { /** * Runs an imperative async procedure and tracks loading + error state. Auth-cancel * errors are silently absorbed (no error surfaced) but still produce a failure outcome * so callers can short-circuit their own UI flow. */ readonly mutate: (fn: (signal: AbortSignal) => Promise, options?: MutateCallOptions) => Promise>; /** Clears the current error without otherwise touching state. */ readonly clearError: () => void; } /** * Generic state-machine + abort wiring shared by every mutation-style hook (`useSecureOperation`, * `useKeyRotation`, plus the `saveSecret`/`removeSecret`/`clearAll` helpers in * `useSecureStorage`). Centralises the auth-cancel / mount-guard / abort logic so each consumer * can stay a thin wrapper. * * @internal */ declare const useMutation: (defaultOperation: string, defaultHint: string) => UseMutationResult; export default useMutation; //# sourceMappingURL=useMutation.d.ts.map