UNPKG

1.54 kBTypeScriptView Raw
1import { SelectionSetNode, FieldNode } from 'graphql';
2import { FragmentMap, FragmentMapFunction, StoreObject, Reference } from '../../utilities';
3import { NormalizedCache, ReadMergeModifyContext, MergeTree } from './types';
4import { StoreReader } from './readFromStore';
5import { InMemoryCache } from './inMemoryCache';
6import { Cache } from '../../core';
7export interface WriteContext extends ReadMergeModifyContext {
8 readonly written: {
9 [dataId: string]: SelectionSetNode[];
10 };
11 readonly fragmentMap: FragmentMap;
12 lookupFragment: FragmentMapFunction;
13 merge<T>(existing: T, incoming: T): T;
14 overwrite: boolean;
15 incomingById: Map<string, {
16 storeObject: StoreObject;
17 mergeTree?: MergeTree;
18 fieldNodeSet: Set<FieldNode>;
19 }>;
20 clientOnly: boolean;
21 deferred: boolean;
22 flavors: Map<string, FlavorableWriteContext>;
23}
24type FlavorableWriteContext = Pick<WriteContext, "clientOnly" | "deferred" | "flavors">;
25export declare class StoreWriter {
26 readonly cache: InMemoryCache;
27 private reader?;
28 private fragments?;
29 constructor(cache: InMemoryCache, reader?: StoreReader | undefined, fragments?: import("./fragmentRegistry").FragmentRegistryAPI | undefined);
30 writeToStore(store: NormalizedCache, { query, result, dataId, variables, overwrite, }: Cache.WriteOptions): Reference | undefined;
31 private processSelectionSet;
32 private processFieldValue;
33 private flattenFields;
34 private applyMerges;
35}
36export {};
37//# sourceMappingURL=writeToStore.d.ts.map
\No newline at end of file