UNPKG

2.33 kBTypeScriptView Raw
1import './fixPolyfills';
2import { DocumentNode } from 'graphql';
3import { ApolloCache } from '../core/cache';
4import { Cache } from '../core/types/Cache';
5import { StoreObject, Reference } from '../../utilities';
6import { InMemoryCacheConfig, NormalizedCacheObject } from './types';
7import { makeVar } from './reactiveVars';
8import { Policies } from './policies';
9declare type BroadcastOptions = Pick<Cache.BatchOptions<InMemoryCache>, "optimistic" | "onWatchUpdated">;
10export declare class InMemoryCache extends ApolloCache<NormalizedCacheObject> {
11 private data;
12 private optimisticData;
13 protected config: InMemoryCacheConfig;
14 private watches;
15 private addTypename;
16 private typenameDocumentCache;
17 private storeReader;
18 private storeWriter;
19 private maybeBroadcastWatch;
20 readonly policies: Policies;
21 readonly makeVar: typeof makeVar;
22 constructor(config?: InMemoryCacheConfig);
23 private init;
24 private resetResultCache;
25 restore(data: NormalizedCacheObject): this;
26 extract(optimistic?: boolean): NormalizedCacheObject;
27 read<T>(options: Cache.ReadOptions): T | null;
28 write(options: Cache.WriteOptions): Reference | undefined;
29 modify(options: Cache.ModifyOptions): boolean;
30 diff<TData, TVariables = any>(options: Cache.DiffOptions<TData, TVariables>): Cache.DiffResult<TData>;
31 watch<TData = any, TVariables = any>(watch: Cache.WatchOptions<TData, TVariables>): () => void;
32 gc(options?: {
33 resetResultCache?: boolean;
34 resetResultIdentities?: boolean;
35 }): string[];
36 retain(rootId: string, optimistic?: boolean): number;
37 release(rootId: string, optimistic?: boolean): number;
38 identify(object: StoreObject | Reference): string | undefined;
39 evict(options: Cache.EvictOptions): boolean;
40 reset(options?: Cache.ResetOptions): Promise<void>;
41 removeOptimistic(idToRemove: string): void;
42 private txCount;
43 batch<TUpdateResult>(options: Cache.BatchOptions<InMemoryCache, TUpdateResult>): TUpdateResult;
44 performTransaction(update: (cache: InMemoryCache) => any, optimisticId?: string | null): any;
45 transformDocument(document: DocumentNode): DocumentNode;
46 protected broadcastWatches(options?: BroadcastOptions): void;
47 private broadcastWatch;
48}
49export {};
50//# sourceMappingURL=inMemoryCache.d.ts.map
\No newline at end of file