import type { MutationObserver } from './mutationObserver'; import type { MutationOptions, NotifyEvent } from './types'; import type { QueryClient } from './queryClient'; import type { Action, MutationState } from './mutation'; import { Mutation } from './mutation'; import type { MutationFilters } from './utils'; import { Subscribable } from './subscribable'; interface MutationCacheConfig { onError?: (error: unknown, variables: unknown, context: unknown, mutation: Mutation) => Promise | unknown; onSuccess?: (data: unknown, variables: unknown, context: unknown, mutation: Mutation) => Promise | unknown; onMutate?: (variables: unknown, mutation: Mutation) => Promise | unknown; onSettled?: (data: unknown | undefined, error: unknown | null, variables: unknown, context: unknown, mutation: Mutation) => Promise | unknown; } interface NotifyEventMutationAdded extends NotifyEvent { type: 'added'; mutation: Mutation; } interface NotifyEventMutationRemoved extends NotifyEvent { type: 'removed'; mutation: Mutation; } interface NotifyEventMutationObserverAdded extends NotifyEvent { type: 'observerAdded'; mutation: Mutation; observer: MutationObserver; } interface NotifyEventMutationObserverRemoved extends NotifyEvent { type: 'observerRemoved'; mutation: Mutation; observer: MutationObserver; } interface NotifyEventMutationObserverOptionsUpdated extends NotifyEvent { type: 'observerOptionsUpdated'; mutation?: Mutation; observer: MutationObserver; } interface NotifyEventMutationUpdated extends NotifyEvent { type: 'updated'; mutation: Mutation; action: Action; } declare type MutationCacheNotifyEvent = NotifyEventMutationAdded | NotifyEventMutationRemoved | NotifyEventMutationObserverAdded | NotifyEventMutationObserverRemoved | NotifyEventMutationObserverOptionsUpdated | NotifyEventMutationUpdated; declare type MutationCacheListener = (event: MutationCacheNotifyEvent) => void; export declare class MutationCache extends Subscribable { config: MutationCacheConfig; private mutations; private mutationId; private resuming; constructor(config?: MutationCacheConfig); build(client: QueryClient, options: MutationOptions, state?: MutationState): Mutation; add(mutation: Mutation): void; remove(mutation: Mutation): void; clear(): void; getAll(): Mutation[]; find(filters: MutationFilters): Mutation | undefined; findAll(filters: MutationFilters): Mutation[]; notify(event: MutationCacheNotifyEvent): void; resumePausedMutations(): Promise; } export {}; //# sourceMappingURL=mutationCache.d.ts.map