1 | import { Middleware, Action } from 'redux';
|
2 | import { FragmentMatcher } from 'graphql-anywhere';
|
3 | import { NormalizedCache } from './data/storeUtils';
|
4 | import { OptimisticStore, getDataWithOptimisticResults } from './optimistic-data/store';
|
5 | export { getDataWithOptimisticResults };
|
6 | import { ApolloAction } from './actions';
|
7 | import { IdGetter } from './core/types';
|
8 | import { CustomResolverMap } from './data/readFromStore';
|
9 | export interface ReducerError {
|
10 | error: Error;
|
11 | queryId?: string;
|
12 | mutationId?: string;
|
13 | subscriptionId?: number;
|
14 | }
|
15 | export interface Store {
|
16 | data: NormalizedCache;
|
17 | optimistic: OptimisticStore;
|
18 | reducerError: ReducerError | null;
|
19 | }
|
20 | export interface ApolloStore {
|
21 | dispatch: (action: ApolloAction) => void;
|
22 | getState: () => any;
|
23 | }
|
24 | export declare type ApolloReducer = (store: NormalizedCache, action: ApolloAction) => NormalizedCache;
|
25 | export declare function createApolloReducer(config: ApolloReducerConfig): (state: Store, action: ApolloAction | Action) => Store;
|
26 | export declare function createApolloStore({reduxRootKey, initialState, config, reportCrashes, logger}?: {
|
27 | reduxRootKey?: string;
|
28 | initialState?: any;
|
29 | config?: ApolloReducerConfig;
|
30 | reportCrashes?: boolean;
|
31 | logger?: Middleware;
|
32 | }): ApolloStore;
|
33 | export declare type ApolloReducerConfig = {
|
34 | dataIdFromObject?: IdGetter;
|
35 | customResolvers?: CustomResolverMap;
|
36 | fragmentMatcher?: FragmentMatcher;
|
37 | addTypename?: boolean;
|
38 | };
|