apollo-cache
Advanced tools
Comparing version 0.2.0-rc.0 to 0.2.0-rc.1
@@ -5,3 +5,3 @@ import { DocumentNode } from 'graphql'; | ||
export declare abstract class ApolloCache<TSerialized> implements DataProxy { | ||
abstract read<T>(query: Cache.ReadOptions): Cache.DiffResult<T>; | ||
abstract read<T>(query: Cache.ReadOptions): T; | ||
abstract write(write: Cache.WriteOptions): void; | ||
@@ -18,6 +18,7 @@ abstract diff<T>(query: Cache.DiffOptions): Cache.DiffResult<T>; | ||
transformDocument(document: DocumentNode): DocumentNode; | ||
readQuery<QueryType>(options: DataProxy.Query, optimistic?: boolean): Cache.DiffResult<QueryType>; | ||
readFragment<FragmentType>(options: DataProxy.Fragment, optimistic?: boolean): Cache.DiffResult<FragmentType> | null; | ||
transformForLink(document: DocumentNode): DocumentNode; | ||
readQuery<QueryType>(options: DataProxy.Query, optimistic?: boolean): QueryType; | ||
readFragment<FragmentType>(options: DataProxy.Fragment, optimistic?: boolean): FragmentType | null; | ||
writeQuery(options: Cache.WriteQueryOptions): void; | ||
writeFragment(options: Cache.WriteFragmentOptions): void; | ||
} |
@@ -10,2 +10,5 @@ "use strict"; | ||
}; | ||
ApolloCache.prototype.transformForLink = function (document) { | ||
return document; | ||
}; | ||
ApolloCache.prototype.readQuery = function (options, optimistic) { | ||
@@ -12,0 +15,0 @@ if (optimistic === void 0) { optimistic = false; } |
@@ -25,6 +25,6 @@ import { DocumentNode } from 'graphql'; | ||
export interface DataProxy { | ||
readQuery<QueryType>(options: DataProxy.Query, optimistic?: boolean): DataProxy.DiffResult<QueryType>; | ||
readFragment<FragmentType>(options: DataProxy.Fragment, optimistic?: boolean): DataProxy.DiffResult<FragmentType> | null; | ||
readQuery<QueryType>(options: DataProxy.Query, optimistic?: boolean): QueryType; | ||
readFragment<FragmentType>(options: DataProxy.Fragment, optimistic?: boolean): FragmentType | null; | ||
writeQuery(options: DataProxy.WriteQueryOptions): void; | ||
writeFragment(options: DataProxy.WriteFragmentOptions): void; | ||
} |
{ | ||
"name": "apollo-cache", | ||
"version": "0.2.0-rc.0", | ||
"version": "0.2.0-rc.1", | ||
"description": "Core abstract of Caching layer for Apollo Client", | ||
@@ -39,3 +39,3 @@ "author": "James Baxley <james@meteor.com>", | ||
"dependencies": { | ||
"apollo-utilities": "^0.2.0-rc.0" | ||
"apollo-utilities": "^0.2.0-rc.1" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
@@ -11,3 +11,3 @@ import { DocumentNode } from 'graphql'; | ||
// core API | ||
public abstract read<T>(query: Cache.ReadOptions): Cache.DiffResult<T>; | ||
public abstract read<T>(query: Cache.ReadOptions): T; | ||
public abstract write(write: Cache.WriteOptions): void; | ||
@@ -52,2 +52,6 @@ public abstract diff<T>(query: Cache.DiffOptions): Cache.DiffResult<T>; | ||
} | ||
// experimental | ||
public transformForLink(document: DocumentNode): DocumentNode { | ||
return document; | ||
} | ||
@@ -63,3 +67,3 @@ // DataProxy API | ||
optimistic: boolean = false, | ||
): Cache.DiffResult<QueryType> { | ||
): QueryType { | ||
return this.read({ | ||
@@ -75,3 +79,3 @@ query: options.query, | ||
optimistic: boolean = false, | ||
): Cache.DiffResult<FragmentType> | null { | ||
): FragmentType | null { | ||
return this.read({ | ||
@@ -78,0 +82,0 @@ query: getFragmentQueryDocument(options.fragment, options.fragmentName), |
@@ -80,3 +80,3 @@ import { DocumentNode } from 'graphql'; // eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved | ||
optimistic?: boolean, | ||
): DataProxy.DiffResult<QueryType>; | ||
): QueryType; | ||
@@ -91,3 +91,3 @@ /** | ||
optimistic?: boolean, | ||
): DataProxy.DiffResult<FragmentType> | null; | ||
): FragmentType | null; | ||
@@ -94,0 +94,0 @@ /** |
Sorry, the diff of this file is not supported yet
19140
459
Updatedapollo-utilities@^0.2.0-rc.1