-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathQueryable.ts
31 lines (27 loc) · 946 Bytes
/
Queryable.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { JsonObject, JsonValue } from './primitive';
import { RawOperation } from './schema';
import { DocumentNode } from './util';
/**
* Represents a queryable portion of our cache (the cache itself, transactions,
* views, etc).
*/
export interface Queryable {
/**
* Performs any transformations of operation documents.
*
* Cache consumers should call this on any operation document prior to calling
* any other method in the cache.
*/
transformDocument(document: DocumentNode): DocumentNode;
/**
* Reads the selection expressed by a query from the cache.
*
* TODO: Can we drop non-optimistic reads?
* https://github.com/apollographql/apollo-client/issues/1971#issuecomment-319402170
*/
read(query: RawOperation, optimistic?: boolean): { result?: JsonValue, complete: boolean };
/**
* Writes values for a selection to the cache.
*/
write(query: RawOperation, payload: JsonObject): void;
}