1 | import { DocumentNode } from 'graphql';
|
2 | import { FragmentMatcher } from './readFromStore';
|
3 | import { Transaction } from 'apollo-cache';
|
4 | import { IdValue, StoreValue } from 'apollo-utilities';
|
5 | export interface IdGetterObj extends Object {
|
6 | __typename?: string;
|
7 | id?: string;
|
8 | }
|
9 | export declare type IdGetter = (value: IdGetterObj) => string | null | undefined;
|
10 | export interface NormalizedCache {
|
11 | get(dataId: string): StoreObject;
|
12 | set(dataId: string, value: StoreObject): void;
|
13 | delete(dataId: string): void;
|
14 | clear(): void;
|
15 | toObject(): NormalizedCacheObject;
|
16 | replace(newData: NormalizedCacheObject): void;
|
17 | }
|
18 | export interface NormalizedCacheObject {
|
19 | [dataId: string]: StoreObject | undefined;
|
20 | }
|
21 | export interface StoreObject {
|
22 | __typename?: string;
|
23 | [storeFieldKey: string]: StoreValue;
|
24 | }
|
25 | export declare type OptimisticStoreItem = {
|
26 | id: string;
|
27 | data: NormalizedCacheObject;
|
28 | transaction: Transaction<NormalizedCacheObject>;
|
29 | };
|
30 | export declare type ReadQueryOptions = {
|
31 | store: NormalizedCache;
|
32 | query: DocumentNode;
|
33 | fragmentMatcherFunction?: FragmentMatcher;
|
34 | variables?: Object;
|
35 | previousResult?: any;
|
36 | rootId?: string;
|
37 | config?: ApolloReducerConfig;
|
38 | };
|
39 | export declare type DiffQueryAgainstStoreOptions = ReadQueryOptions & {
|
40 | returnPartialData?: boolean;
|
41 | };
|
42 | export declare type ApolloReducerConfig = {
|
43 | dataIdFromObject?: IdGetter;
|
44 | fragmentMatcher?: FragmentMatcherInterface;
|
45 | addTypename?: boolean;
|
46 | cacheRedirects?: CacheResolverMap;
|
47 | };
|
48 | export declare type ReadStoreContext = {
|
49 | readonly store: NormalizedCache;
|
50 | readonly cacheRedirects: CacheResolverMap;
|
51 | readonly dataIdFromObject?: IdGetter;
|
52 | };
|
53 | export interface FragmentMatcherInterface {
|
54 | match(idValue: IdValue, typeCondition: string, context: ReadStoreContext): boolean | 'heuristic';
|
55 | }
|
56 | export declare type PossibleTypesMap = {
|
57 | [key: string]: string[];
|
58 | };
|
59 | export declare type IntrospectionResultData = {
|
60 | __schema: {
|
61 | types: {
|
62 | kind: string;
|
63 | name: string;
|
64 | possibleTypes: {
|
65 | name: string;
|
66 | }[];
|
67 | }[];
|
68 | };
|
69 | };
|
70 | export declare type CacheResolver = (rootValue: any, args: {
|
71 | [argName: string]: any;
|
72 | }, context: any) => any;
|
73 | export declare type CacheResolverMap = {
|
74 | [typeName: string]: {
|
75 | [fieldName: string]: CacheResolver;
|
76 | };
|
77 | };
|
78 | export declare type CustomResolver = CacheResolver;
|
79 | export declare type CustomResolverMap = CacheResolverMap;
|
80 |
|
\ | No newline at end of file |