UNPKG

1.63 kBTypeScriptView Raw
1import type { SelectionSetNode } from "graphql";
2import type { Reference, StoreObject } from "../../utilities/index.js";
3import type { Cache } from "../core/types/Cache.js";
4import type { DiffQueryAgainstStoreOptions, InMemoryCacheConfig, ReadMergeModifyContext } from "./types.js";
5import type { InMemoryCache } from "./inMemoryCache.js";
6import type { MissingTree } from "../core/types/common.js";
7import { ObjectCanon } from "./object-canon.js";
8export type VariableMap = {
9 [name: string]: any;
10};
11export type ExecResult<R = any> = {
12 result: R;
13 missing?: MissingTree;
14};
15export interface StoreReaderConfig {
16 cache: InMemoryCache;
17 addTypename?: boolean;
18 resultCacheMaxSize?: number;
19 canonizeResults?: boolean;
20 canon?: ObjectCanon;
21 fragments?: InMemoryCacheConfig["fragments"];
22}
23export declare class StoreReader {
24 private executeSelectionSet;
25 private executeSubSelectedArray;
26 private config;
27 private knownResults;
28 canon: ObjectCanon;
29 resetCanon(): void;
30 constructor(config: StoreReaderConfig);
31 /**
32 * Given a store and a query, return as much of the result as possible and
33 * identify if any data was missing from the store.
34 */
35 diffQueryAgainstStore<T>({ store, query, rootId, variables, returnPartialData, canonizeResults, }: DiffQueryAgainstStoreOptions): Cache.DiffResult<T>;
36 isFresh(result: Record<string, any>, parent: StoreObject | Reference, selectionSet: SelectionSetNode, context: ReadMergeModifyContext): boolean;
37 private execSelectionSetImpl;
38 private execSubSelectedArrayImpl;
39}
40//# sourceMappingURL=readFromStore.d.ts.map
\No newline at end of file