1 | import { DocumentNode, ExecutionResult } from 'graphql';
|
2 | import { FetchResult } from 'apollo-link';
|
3 | import { DataProxy } from 'apollo-cache';
|
4 | import { MutationQueryReducersMap } from './types';
|
5 | import { PureQueryOptions, OperationVariables } from './types';
|
6 | export declare type FetchPolicy = 'cache-first' | 'cache-and-network' | 'network-only' | 'cache-only' | 'no-cache' | 'standby';
|
7 | export declare type ErrorPolicy = 'none' | 'ignore' | 'all';
|
8 | export interface QueryBaseOptions<TVariables = OperationVariables> {
|
9 | variables?: TVariables;
|
10 | fetchPolicy?: FetchPolicy;
|
11 | errorPolicy?: ErrorPolicy;
|
12 | fetchResults?: boolean;
|
13 | }
|
14 | export interface QueryOptions<TVariables = OperationVariables> extends QueryBaseOptions<TVariables> {
|
15 | query: DocumentNode;
|
16 | metadata?: any;
|
17 | context?: any;
|
18 | }
|
19 | export interface ModifiableWatchQueryOptions<TVariables = OperationVariables> extends QueryBaseOptions<TVariables> {
|
20 | pollInterval?: number;
|
21 | notifyOnNetworkStatusChange?: boolean;
|
22 | }
|
23 | export interface WatchQueryOptions<TVariables = OperationVariables> extends QueryOptions<TVariables>, ModifiableWatchQueryOptions<TVariables> {
|
24 | }
|
25 | export interface FetchMoreQueryOptions<TVariables, K extends keyof TVariables> {
|
26 | query?: DocumentNode;
|
27 | variables?: Pick<TVariables, K>;
|
28 | }
|
29 | export declare type UpdateQueryFn<TData = any, TVariables = OperationVariables, TSubscriptionData = TData> = (previousQueryResult: TData, options: {
|
30 | subscriptionData: {
|
31 | data: TSubscriptionData;
|
32 | };
|
33 | variables?: TVariables;
|
34 | }) => TData;
|
35 | export declare type SubscribeToMoreOptions<TData = any, TVariables = OperationVariables, TSubscriptionData = TData> = {
|
36 | document: DocumentNode;
|
37 | variables?: TVariables;
|
38 | updateQuery?: UpdateQueryFn<TData, TVariables, TSubscriptionData>;
|
39 | onError?: (error: Error) => void;
|
40 | };
|
41 | export interface SubscriptionOptions<TVariables = OperationVariables> {
|
42 | query: DocumentNode;
|
43 | variables?: TVariables;
|
44 | fetchPolicy?: FetchPolicy;
|
45 | }
|
46 | export declare type RefetchQueryDescription = Array<string | PureQueryOptions>;
|
47 | export interface MutationBaseOptions<T = {
|
48 | [key: string]: any;
|
49 | }, TVariables = OperationVariables> {
|
50 | optimisticResponse?: Object | Function;
|
51 | updateQueries?: MutationQueryReducersMap<T>;
|
52 | refetchQueries?: ((result: ExecutionResult) => RefetchQueryDescription) | RefetchQueryDescription;
|
53 | awaitRefetchQueries?: boolean;
|
54 | update?: MutationUpdaterFn<T>;
|
55 | errorPolicy?: ErrorPolicy;
|
56 | variables?: TVariables;
|
57 | }
|
58 | export interface MutationOptions<T = {
|
59 | [key: string]: any;
|
60 | }, TVariables = OperationVariables> extends MutationBaseOptions<T, TVariables> {
|
61 | mutation: DocumentNode;
|
62 | context?: any;
|
63 | fetchPolicy?: FetchPolicy;
|
64 | }
|
65 | export declare type MutationUpdaterFn<T = {
|
66 | [key: string]: any;
|
67 | }> = (proxy: DataProxy, mutationResult: FetchResult<T>) => void;
|
68 |
|
\ | No newline at end of file |