1 | import { DocumentNode, FieldNode } from 'graphql';
|
2 | import { Transaction } from '../core/cache';
|
3 | import { StoreObject, StoreValue, Reference } from '../../utilities';
|
4 | import { FieldValueGetter } from './entityStore';
|
5 | import { TypePolicies, PossibleTypesMap, KeyFieldsFunction, StorageType, FieldMergeFunction } from './policies';
|
6 | import { Modifier, Modifiers, ToReferenceFunction, CanReadFunction } from '../core/types/common';
|
7 | export { StoreObject, StoreValue, Reference };
|
8 | export interface IdGetterObj extends Object {
|
9 | __typename?: string;
|
10 | id?: string;
|
11 | _id?: string;
|
12 | }
|
13 | export declare type IdGetter = (value: IdGetterObj) => string | undefined;
|
14 | export interface NormalizedCache {
|
15 | has(dataId: string): boolean;
|
16 | get(dataId: string, fieldName: string): StoreValue;
|
17 | merge(olderId: string, newerObject: StoreObject): void;
|
18 | merge(olderObject: StoreObject, newerId: string): void;
|
19 | modify(dataId: string, fields: Modifiers | Modifier<any>): boolean;
|
20 | delete(dataId: string, fieldName?: string): boolean;
|
21 | clear(): void;
|
22 | toObject(): NormalizedCacheObject;
|
23 | replace(newData: NormalizedCacheObject): void;
|
24 | retain(rootId: string): number;
|
25 | release(rootId: string): number;
|
26 | getFieldValue: FieldValueGetter;
|
27 | toReference: ToReferenceFunction;
|
28 | canRead: CanReadFunction;
|
29 | getStorage(idOrObj: string | StoreObject, ...storeFieldNames: (string | number)[]): StorageType;
|
30 | }
|
31 | export interface NormalizedCacheObject {
|
32 | __META?: {
|
33 | extraRootIds: string[];
|
34 | };
|
35 | [dataId: string]: StoreObject | undefined;
|
36 | }
|
37 | export declare type OptimisticStoreItem = {
|
38 | id: string;
|
39 | data: NormalizedCacheObject;
|
40 | transaction: Transaction<NormalizedCacheObject>;
|
41 | };
|
42 | export declare type ReadQueryOptions = {
|
43 | store: NormalizedCache;
|
44 | query: DocumentNode;
|
45 | variables?: Object;
|
46 | previousResult?: any;
|
47 | canonizeResults?: boolean;
|
48 | rootId?: string;
|
49 | config?: ApolloReducerConfig;
|
50 | };
|
51 | export declare type DiffQueryAgainstStoreOptions = ReadQueryOptions & {
|
52 | returnPartialData?: boolean;
|
53 | };
|
54 | export declare type ApolloReducerConfig = {
|
55 | dataIdFromObject?: KeyFieldsFunction;
|
56 | addTypename?: boolean;
|
57 | };
|
58 | export interface InMemoryCacheConfig extends ApolloReducerConfig {
|
59 | resultCaching?: boolean;
|
60 | possibleTypes?: PossibleTypesMap;
|
61 | typePolicies?: TypePolicies;
|
62 | resultCacheMaxSize?: number;
|
63 | canonizeResults?: boolean;
|
64 | }
|
65 | export interface MergeInfo {
|
66 | field: FieldNode;
|
67 | typename: string | undefined;
|
68 | merge: FieldMergeFunction;
|
69 | }
|
70 | export interface MergeTree {
|
71 | info?: MergeInfo;
|
72 | map: Map<string | number, MergeTree>;
|
73 | }
|
74 | export interface ReadMergeModifyContext {
|
75 | store: NormalizedCache;
|
76 | variables?: Record<string, any>;
|
77 | varString?: string;
|
78 | }
|
79 |
|
\ | No newline at end of file |