import ApolloClient, { ApolloQueryResult, ApolloError, FetchPolicy, ErrorPolicy, FetchMoreOptions, UpdateQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions, PureQueryOptions, MutationUpdaterFn } from 'apollo-client'; import { MutationFn } from './Mutation'; export interface Context { [key: string]: any; } export declare type OperationVariables = { [key: string]: any; }; export declare type RefetchQueriesProviderFn = (...args: any[]) => Array; export interface MutationOpts { variables?: TGraphQLVariables; optimisticResponse?: TData; refetchQueries?: Array | RefetchQueriesProviderFn; awaitRefetchQueries?: boolean; errorPolicy?: ErrorPolicy; update?: MutationUpdaterFn; client?: ApolloClient; notifyOnNetworkStatusChange?: boolean; context?: Context; onCompleted?: (data: TData) => void; onError?: (error: ApolloError) => void; fetchPolicy?: FetchPolicy; } export interface QueryOpts { ssr?: boolean; variables?: TGraphQLVariables; fetchPolicy?: FetchPolicy; errorPolicy?: ErrorPolicy; pollInterval?: number; client?: ApolloClient; notifyOnNetworkStatusChange?: boolean; context?: Context; partialRefetch?: boolean; } export interface QueryControls { error?: ApolloError; networkStatus: number; loading: boolean; variables: TGraphQLVariables; fetchMore: (fetchMoreOptions: FetchMoreQueryOptions & FetchMoreOptions) => Promise>; refetch: (variables?: TGraphQLVariables) => Promise>; startPolling: (pollInterval: number) => void; stopPolling: () => void; subscribeToMore: (options: SubscribeToMoreOptions) => () => void; updateQuery: (mapFn: (previousQueryResult: any, options: UpdateQueryOptions) => any) => void; } export interface GraphqlQueryControls extends QueryControls { } export declare type MutationFunc = MutationFn; export declare type DataValue = QueryControls & Partial; export interface DataProps { data: DataValue; } export interface MutateProps { mutate: MutationFn; } export declare type ChildProps = TProps & Partial> & Partial>; export declare type ChildDataProps = TProps & DataProps; export declare type ChildMutateProps = TProps & MutateProps; export declare type NamedProps = TProps & { ownProps: R; }; export interface OptionProps extends Partial>, Partial> { ownProps: TProps; } export interface OperationOption> { options?: QueryOpts | MutationOpts | ((props: TProps) => QueryOpts | MutationOpts); props?: (props: OptionProps, lastProps?: TChildProps | void) => TChildProps; skip?: boolean | ((props: TProps) => boolean); name?: string; withRef?: boolean; shouldResubscribe?: (props: TProps, nextProps: TProps) => boolean; alias?: string; }