UNPKG

1.81 kBTypeScriptView Raw
1import { SelectionSetNode, FieldNode, DocumentNode } from 'graphql';
2import { FragmentMatcher } from './readFromStore';
3import { FragmentMap } from 'apollo-utilities';
4import { IdGetter, NormalizedCache } from './types';
5export declare class WriteError extends Error {
6 type: string;
7}
8export declare function enhanceErrorWithDocument(error: Error, document: DocumentNode): WriteError;
9export declare type WriteContext = {
10 readonly store: NormalizedCache;
11 readonly processedData?: {
12 [x: string]: FieldNode[];
13 };
14 readonly variables?: any;
15 readonly dataIdFromObject?: IdGetter;
16 readonly fragmentMap?: FragmentMap;
17 readonly fragmentMatcherFunction?: FragmentMatcher;
18};
19export declare class StoreWriter {
20 writeQueryToStore({ query, result, store, variables, dataIdFromObject, fragmentMatcherFunction, }: {
21 query: DocumentNode;
22 result: Object;
23 store?: NormalizedCache;
24 variables?: Object;
25 dataIdFromObject?: IdGetter;
26 fragmentMatcherFunction?: FragmentMatcher;
27 }): NormalizedCache;
28 writeResultToStore({ dataId, result, document, store, variables, dataIdFromObject, fragmentMatcherFunction, }: {
29 dataId: string;
30 result: any;
31 document: DocumentNode;
32 store?: NormalizedCache;
33 variables?: Object;
34 dataIdFromObject?: IdGetter;
35 fragmentMatcherFunction?: FragmentMatcher;
36 }): NormalizedCache;
37 writeSelectionSetToStore({ result, dataId, selectionSet, context, }: {
38 dataId: string;
39 result: any;
40 selectionSet: SelectionSetNode;
41 context: WriteContext;
42 }): NormalizedCache;
43 private writeFieldToStore;
44 private processArrayValue;
45}
46//# sourceMappingURL=writeToStore.d.ts.map
\No newline at end of file