UNPKG

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