import { NetworkInterface } from './networkInterface'; import { ApolloStore, Store } from './store'; import { QueryStoreValue } from './queries/store'; import { QueryTransformer } from './queries/queryTransform'; import { NormalizedCache } from './data/store'; import { Document, FragmentDefinition, SelectionSet } from 'graphql'; import { MutationBehavior, MutationQueryReducersMap } from './data/mutationResults'; import { QueryScheduler } from './scheduler'; import { ApolloQueryResult } from './index'; import { Observer, Subscription } from './util/Observable'; import { WatchQueryOptions, SubscriptionOptions, GraphQLSubscriptionOptions } from './watchQueryOptions'; import { ObservableQuery } from './ObservableQuery'; export declare type QueryListener = (queryStoreValue: QueryStoreValue) => void; export declare class QueryManager { pollingTimers: { [queryId: string]: NodeJS.Timer | any; }; scheduler: QueryScheduler; store: ApolloStore; private networkInterface; private reduxRootKey; private queryTransformer; private queryListeners; private queryResults; private idCounter; private batcher; private batchInterval; private fetchQueryPromises; private observableQueries; private queryIdsByName; constructor({networkInterface, store, reduxRootKey, queryTransformer, shouldBatch, batchInterval}: { networkInterface: NetworkInterface; store: ApolloStore; reduxRootKey: string; queryTransformer?: QueryTransformer; shouldBatch?: Boolean; batchInterval?: number; }); broadcastNewStore(store: any): void; mutate({mutation, variables, resultBehaviors, fragments, optimisticResponse, updateQueries, refetchQueries}: { mutation: Document; variables?: Object; resultBehaviors?: MutationBehavior[]; fragments?: FragmentDefinition[]; optimisticResponse?: Object; updateQueries?: MutationQueryReducersMap; refetchQueries?: string[]; }): Promise; queryListenerForObserver(queryId: string, options: WatchQueryOptions, observer: Observer): QueryListener; watchQuery(options: WatchQueryOptions, shouldSubscribe?: boolean, graphQLSubscriptionOptions?: GraphQLSubscriptionOptions): ObservableQuery; query(options: WatchQueryOptions): Promise; fetchQuery(queryId: string, options: WatchQueryOptions): Promise; generateQueryId(): string; stopQueryInStore(queryId: string): void; getApolloState(): Store; getDataWithOptimisticResults(): NormalizedCache; addQueryListener(queryId: string, listener: QueryListener): void; removeQueryListener(queryId: string): void; addFetchQueryPromise(requestId: number, promise: Promise, resolve: (result: ApolloQueryResult) => void, reject: (error: Error) => void): void; removeFetchQueryPromise(requestId: number): void; addObservableQuery(queryId: string, observableQuery: ObservableQuery): void; addQuerySubscription(queryId: string, querySubscription: Subscription): void; removeObservableQuery(queryId: string): void; resetStore(): void; startQuery(queryId: string, options: WatchQueryOptions, listener: QueryListener): string; startSubscription(options: SubscriptionOptions): number; stopQuery(queryId: string): void; getQueryWithPreviousResult(queryId: string, isOptimistic?: boolean): { previousResult: Object; queryVariables: { [key: string]: any; }; querySelectionSet: SelectionSet; queryFragments: FragmentDefinition[]; }; private collectResultBehaviorsFromUpdateQueries(updateQueries, mutationResult, isOptimistic?); private transformQueryDocument(options); private handleDiffQuery({queryDef, rootId, variables, fragmentMap, noFetch}); private fetchRequest({requestId, queryId, query, querySS, options, fragmentMap, networkInterface}); private fetchQueryOverInterface(queryId, options, networkInterface); private refetchQueryByName(queryName); private isDifferentResult(queryId, result); private broadcastQueries(); private generateRequestId(); }