UNPKG

1.45 kBTypeScriptView Raw
1import { IdValue } from 'apollo-utilities';
2import { Cache } from 'apollo-cache';
3import { ReadStoreContext, DiffQueryAgainstStoreOptions, ReadQueryOptions, StoreObject } from './types';
4import { KeyTrie } from 'optimism';
5export declare type VariableMap = {
6 [name: string]: any;
7};
8export declare type FragmentMatcher = (rootValue: any, typeCondition: string, context: ReadStoreContext) => boolean | 'heuristic';
9export declare type ExecResultMissingField = {
10 object: StoreObject;
11 fieldName: string;
12 tolerable: boolean;
13};
14export declare type ExecResult<R = any> = {
15 result: R;
16 missing?: ExecResultMissingField[];
17};
18export interface StoreReaderConfig {
19 cacheKeyRoot?: KeyTrie<object>;
20 freezeResults?: boolean;
21}
22export declare class StoreReader {
23 private freezeResults;
24 constructor({ cacheKeyRoot, freezeResults, }?: StoreReaderConfig);
25 readQueryFromStore<QueryType>(options: ReadQueryOptions): QueryType | undefined;
26 diffQueryAgainstStore<T>({ store, query, variables, previousResult, returnPartialData, rootId, fragmentMatcherFunction, config, }: DiffQueryAgainstStoreOptions): Cache.DiffResult<T>;
27 private executeStoreQuery;
28 private executeSelectionSet;
29 private executeField;
30 private combineExecResults;
31 private executeSubSelectedArray;
32}
33export declare function assertIdValue(idValue: IdValue): void;
34//# sourceMappingURL=readFromStore.d.ts.map
\No newline at end of file