import type { ApolloClient, ApolloError, ApolloQueryResult, FetchMoreQueryOptions, MaybeMasked, ObservableQuery, OperationVariables, SubscribeToMoreOptions, TypedDocumentNode, Unmasked, UpdateQueryMapFn, WatchQueryOptions } from '@apollo/client/core/index.js'; import type { DocumentNode } from 'graphql'; import type { Ref } from 'vue-demi'; import type { ReactiveFunction } from './util/ReactiveFunction'; export interface UseQueryOptions extends Omit, 'query' | 'variables'> { clientId?: string; enabled?: boolean | Ref; throttle?: number; debounce?: number; prefetch?: boolean; keepPreviousResult?: boolean; } export type DocumentParameter = DocumentNode | Ref | ReactiveFunction | TypedDocumentNode | Ref | null | undefined> | ReactiveFunction | null | undefined>; export type VariablesParameter = TVariables | Ref | ReactiveFunction; export type OptionsParameter = UseQueryOptions | Ref> | ReactiveFunction>; export interface OnResultContext { client: ApolloClient; } export interface OnErrorContext { client: ApolloClient; } export interface UseQueryReturn { result: Ref; loading: Ref; networkStatus: Ref; error: Ref; start: () => void; stop: () => void; restart: () => void; forceDisabled: Ref; document: Ref; variables: Ref; options: UseQueryOptions | Ref>; query: Ref | null | undefined>; refetch: (variables?: TVariables) => Promise> | undefined; fetchMore: (options: FetchMoreQueryOptions & { updateQuery?: (previousQueryResult: Unmasked, options: { fetchMoreResult: Unmasked; variables: TFetchVars; }) => Unmasked; }) => Promise>> | undefined; updateQuery: (mapFn: UpdateQueryMapFn) => void; subscribeToMore: (options: SubscribeToMoreOptions | Ref> | ReactiveFunction>) => void; onResult: (fn: (param: ApolloQueryResult, context: OnResultContext) => void) => { off: () => void; }; onError: (fn: (param: ApolloError, context: OnErrorContext) => void) => { off: () => void; }; } /** * Use a query that does not require variables or options. */ export declare function useQuery(document: DocumentParameter): UseQueryReturn>; /** * Use a query that has optional variables but not options */ export declare function useQuery(document: DocumentParameter): UseQueryReturn; /** * Use a query that has required variables but not options */ export declare function useQuery(document: DocumentParameter, variables: VariablesParameter): UseQueryReturn; /** * Use a query that requires options but not variables. */ export declare function useQuery(document: DocumentParameter, variables: undefined | null, options: OptionsParameter>): UseQueryReturn>; /** * Use a query that requires variables and options. */ export declare function useQuery(document: DocumentParameter, variables: VariablesParameter, options: OptionsParameter): UseQueryReturn; export declare function useQueryImpl(document: DocumentParameter, variables?: VariablesParameter, options?: OptionsParameter, lazy?: boolean): UseQueryReturn;