import type { ApolloClient, ApolloError, FetchResult, MutationOptions, OperationVariables, TypedDocumentNode } from '@apollo/client/core/index.js'; import type { DocumentNode } from 'graphql'; import type { Ref } from 'vue-demi'; import type { ReactiveFunction } from './util/ReactiveFunction'; /** * `useMutation` options for mutations that don't require `variables`. */ export interface UseMutationOptions extends Omit, 'mutation'> { clientId?: string; throws?: 'auto' | 'always' | 'never'; } type DocumentParameter = DocumentNode | Ref | ReactiveFunction | TypedDocumentNode | Ref> | ReactiveFunction>; type OptionsParameter = UseMutationOptions | Ref> | ReactiveFunction>; export type MutateOverrideOptions = Pick, 'update' | 'optimisticResponse' | 'context' | 'updateQueries' | 'refetchQueries' | 'awaitRefetchQueries' | 'errorPolicy' | 'fetchPolicy' | 'clientId'>; export type MutateResult = Promise, Record> | null>; export type MutateFunction = (variables?: TVariables | null, overrideOptions?: MutateOverrideOptions) => MutateResult; export interface OnDoneContext { client: ApolloClient; } export interface OnErrorContext { client: ApolloClient; } export interface UseMutationReturn { mutate: MutateFunction; loading: Ref; error: Ref; called: Ref; onDone: (fn: (param: FetchResult, Record>, context: OnDoneContext) => void) => { off: () => void; }; onError: (fn: (param: ApolloError, context: OnErrorContext) => void) => { off: () => void; }; } export declare function useMutation(document: DocumentParameter, options?: OptionsParameter): UseMutationReturn; export {};