apollo-cache-inmemory
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -305,5 +305,5 @@ (function (global, factory) { | ||
makeCacheKey: function (_a) { | ||
var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues; | ||
var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, fragmentMatcher = _a.fragmentMatcher; | ||
if (contextValue.store instanceof DepTrackingCache) { | ||
return reader.cacheKeyRoot.lookup(reader.keyMaker.forQuery(query).lookupQuery(query), contextValue.store, JSON.stringify(variableValues)); | ||
return reader.cacheKeyRoot.lookup(reader.keyMaker.forQuery(query).lookupQuery(query), contextValue.store, fragmentMatcher, JSON.stringify(variableValues), rootValue.id); | ||
} | ||
@@ -318,3 +318,3 @@ } | ||
if (execContext.contextValue.store instanceof DepTrackingCache) { | ||
return reader.cacheKeyRoot.lookup(reader.keyMaker.forQuery(execContext.query).lookupSelectionSet(selectionSet), execContext.contextValue.store, JSON.stringify(execContext.variableValues), rootValue.id); | ||
return reader.cacheKeyRoot.lookup(reader.keyMaker.forQuery(execContext.query).lookupSelectionSet(selectionSet), execContext.contextValue.store, execContext.fragmentMatcher, JSON.stringify(execContext.variableValues), rootValue.id); | ||
} | ||
@@ -368,3 +368,3 @@ } | ||
StoreReader.prototype.executeStoreQuery = function (_a) { | ||
var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, _b = _a.fragmentMatcher, fragmentMatcher = _b === void 0 ? function () { return true; } : _b; | ||
var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, _b = _a.fragmentMatcher, fragmentMatcher = _b === void 0 ? defaultFragmentMatcher : _b; | ||
var mainDefinition = apolloUtilities.getMainDefinition(query); | ||
@@ -531,2 +531,5 @@ var fragments = apolloUtilities.getFragmentDefinitions(query); | ||
}()); | ||
function defaultFragmentMatcher() { | ||
return true; | ||
} | ||
function assertIdValue(idValue) { | ||
@@ -533,0 +536,0 @@ if (!apolloUtilities.isIdValue(idValue)) { |
@@ -28,5 +28,5 @@ var __assign = (this && this.__assign) || function () { | ||
makeCacheKey: function (_a) { | ||
var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues; | ||
var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, fragmentMatcher = _a.fragmentMatcher; | ||
if (contextValue.store instanceof DepTrackingCache) { | ||
return reader.cacheKeyRoot.lookup(reader.keyMaker.forQuery(query).lookupQuery(query), contextValue.store, JSON.stringify(variableValues)); | ||
return reader.cacheKeyRoot.lookup(reader.keyMaker.forQuery(query).lookupQuery(query), contextValue.store, fragmentMatcher, JSON.stringify(variableValues), rootValue.id); | ||
} | ||
@@ -41,3 +41,3 @@ } | ||
if (execContext.contextValue.store instanceof DepTrackingCache) { | ||
return reader.cacheKeyRoot.lookup(reader.keyMaker.forQuery(execContext.query).lookupSelectionSet(selectionSet), execContext.contextValue.store, JSON.stringify(execContext.variableValues), rootValue.id); | ||
return reader.cacheKeyRoot.lookup(reader.keyMaker.forQuery(execContext.query).lookupSelectionSet(selectionSet), execContext.contextValue.store, execContext.fragmentMatcher, JSON.stringify(execContext.variableValues), rootValue.id); | ||
} | ||
@@ -91,3 +91,3 @@ } | ||
StoreReader.prototype.executeStoreQuery = function (_a) { | ||
var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, _b = _a.fragmentMatcher, fragmentMatcher = _b === void 0 ? function () { return true; } : _b; | ||
var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, _b = _a.fragmentMatcher, fragmentMatcher = _b === void 0 ? defaultFragmentMatcher : _b; | ||
var mainDefinition = getMainDefinition(query); | ||
@@ -255,2 +255,5 @@ var fragments = getFragmentDefinitions(query); | ||
export { StoreReader }; | ||
function defaultFragmentMatcher() { | ||
return true; | ||
} | ||
export function assertIdValue(idValue) { | ||
@@ -257,0 +260,0 @@ if (!isIdValue(idValue)) { |
{ | ||
"name": "apollo-cache-inmemory", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Core abstract of Caching layer for Apollo Client", | ||
@@ -43,4 +43,4 @@ "author": "James Baxley <james@meteor.com>", | ||
"dependencies": { | ||
"apollo-cache": "^1.1.17", | ||
"apollo-utilities": "^1.0.21", | ||
"apollo-cache": "file:../apollo-cache", | ||
"apollo-utilities": "file:../apollo-utilities", | ||
"optimism": "^0.6.6" | ||
@@ -47,0 +47,0 @@ }, |
@@ -130,2 +130,3 @@ import { | ||
variableValues, | ||
fragmentMatcher, | ||
}: ExecStoreQueryOptions) { | ||
@@ -139,3 +140,5 @@ // The result of executeStoreQuery can be safely cached only if the | ||
contextValue.store, | ||
fragmentMatcher, | ||
JSON.stringify(variableValues), | ||
rootValue.id, | ||
); | ||
@@ -158,6 +161,4 @@ } | ||
execContext.contextValue.store, | ||
execContext.fragmentMatcher, | ||
JSON.stringify(execContext.variableValues), | ||
// Unlike executeStoreQuery, executeSelectionSet can be called | ||
// recursively on nested objects, so it's important to include the | ||
// ID of the current parent object in the cache key. | ||
rootValue.id, | ||
@@ -289,3 +290,3 @@ ); | ||
// Default matcher always matches all fragments | ||
fragmentMatcher = () => true, | ||
fragmentMatcher = defaultFragmentMatcher, | ||
}: ExecStoreQueryOptions): ExecResult { | ||
@@ -523,2 +524,6 @@ const mainDefinition = getMainDefinition(query); | ||
function defaultFragmentMatcher() { | ||
return true; | ||
} | ||
export function assertIdValue(idValue: IdValue) { | ||
@@ -525,0 +530,0 @@ if (!isIdValue(idValue)) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
509694
10373
- Removed@wry/equality@0.1.11(transitive)
- Removedapollo-cache@1.3.5(transitive)
- Removedapollo-utilities@1.3.4(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedgraphql@15.9.0(transitive)
- Removedts-invariant@0.4.4(transitive)
- Removedtslib@1.14.1(transitive)