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