Socket
Socket
Sign inDemoInstall

apollo-cache-inmemory

Package Overview
Dependencies
Maintainers
4
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-cache-inmemory - npm Package Compare versions

Comparing version 1.6.3 to 1.6.5

6

lib/__tests__/cache.js

@@ -38,5 +38,5 @@ "use strict";

var caches = [
new __1.InMemoryCache(tslib_1.__assign({ addTypename: false }, config, { resultCaching: true })),
new __1.InMemoryCache(tslib_1.__assign({ addTypename: false }, config, { resultCaching: false })),
new __1.InMemoryCache(tslib_1.__assign({ addTypename: false }, config, { freezeResults: true })),
new __1.InMemoryCache(tslib_1.__assign(tslib_1.__assign({ addTypename: false }, config), { resultCaching: true })),
new __1.InMemoryCache(tslib_1.__assign(tslib_1.__assign({ addTypename: false }, config), { resultCaching: false })),
new __1.InMemoryCache(tslib_1.__assign(tslib_1.__assign({ addTypename: false }, config), { freezeResults: true })),
];

@@ -43,0 +43,0 @@ caches.forEach(function (cache, i) {

@@ -91,3 +91,3 @@ exports.__esModule = true;

IntrospectionFragmentMatcher.prototype.match = function (idValue, typeCondition, context) {
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(this.isReady, 6) : (0, _tsInvariant.invariant)(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()');
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(this.isReady, 2) : (0, _tsInvariant.invariant)(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()');
var obj = context.store.get(idValue.id);

@@ -103,3 +103,3 @@ var isRootQuery = idValue.id === 'ROOT_QUERY';

process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(__typename, 7) : (0, _tsInvariant.invariant)(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj));
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(__typename, 3) : (0, _tsInvariant.invariant)(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj));

@@ -273,3 +273,3 @@ if (__typename === typeCondition) {

StoreReader.prototype.readQueryFromStore = function (options) {
return this.diffQueryAgainstStore((0, _tslib.__assign)({}, options, {
return this.diffQueryAgainstStore((0, _tslib.__assign)((0, _tslib.__assign)({}, options), {
returnPartialData: false

@@ -419,5 +419,5 @@ })).result;

if (match === 'heuristic' && fragmentExecResult.missing) {
fragmentExecResult = (0, _tslib.__assign)({}, fragmentExecResult, {
fragmentExecResult = (0, _tslib.__assign)((0, _tslib.__assign)({}, fragmentExecResult), {
missing: fragmentExecResult.missing.map(function (info) {
return (0, _tslib.__assign)({}, info, {
return (0, _tslib.__assign)((0, _tslib.__assign)({}, info), {
tolerable: true

@@ -796,3 +796,3 @@ });

fragment = (fragmentMap || {})[selection.name.value];
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragment, 2) : (0, _tsInvariant.invariant)(fragment, "No fragment named " + selection.name.value + ".");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragment, 4) : (0, _tsInvariant.invariant)(fragment, "No fragment named " + selection.name.value + ".");
}

@@ -866,3 +866,3 @@

var semanticId = dataIdFromObject(value);
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 3) : (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.');
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 5) : (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.');

@@ -896,4 +896,4 @@ if (semanticId || typeof semanticId === 'number' && semanticId === 0) {

var typenameChanged = hadTypename && hasTypename && escapedId.typename !== typename;
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, 4) : (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!hadTypename || hasTypename, 5) : (0, _tsInvariant.invariant)(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, 6) : (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!hadTypename || hasTypename, 7) : (0, _tsInvariant.invariant)(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field));

@@ -915,3 +915,3 @@ if (escapedId.generated) {

if (!storeObject || !(0, _apolloUtilities.isEqual)(storeValue, storeObject[storeFieldName])) {
store.set(dataId, (0, _tslib.__assign)({}, storeObject, (_b = {}, _b[storeFieldName] = storeValue, _b)));
store.set(dataId, (0, _tslib.__assign)((0, _tslib.__assign)({}, storeObject), (_b = {}, _b[storeFieldName] = storeValue, _b)));
}

@@ -987,3 +987,3 @@ };

cache.delete(generatedKey);
var newRealValue = (0, _tslib.__assign)({}, generated, real);
var newRealValue = (0, _tslib.__assign)((0, _tslib.__assign)({}, generated), real);

@@ -1053,3 +1053,3 @@ if ((0, _apolloUtilities.isEqual)(newRealValue, real)) {

OptimisticCacheLayer.prototype.toObject = function () {
return (0, _tslib.__assign)({}, this.parent.toObject(), this.data);
return (0, _tslib.__assign)((0, _tslib.__assign)({}, this.parent.toObject()), this.data);
};

@@ -1078,3 +1078,3 @@

_this.silenceBroadcast = false;
_this.config = (0, _tslib.__assign)({}, defaultConfig, config);
_this.config = (0, _tslib.__assign)((0, _tslib.__assign)({}, defaultConfig), config);

@@ -1081,0 +1081,0 @@ if (_this.config.customResolvers) {

@@ -1,1 +0,1 @@

exports.__esModule=!0,exports.assertIdValue=function(e){(0,a.invariant)((0,r.isIdValue)(e),11)},exports.defaultDataIdFromObject=R,exports.defaultNormalizedCacheFactory=function(e){return new m(e)},exports.enhanceErrorWithDocument=v,exports.WriteError=exports.StoreWriter=exports.StoreReader=exports.ObjectCache=exports.IntrospectionFragmentMatcher=exports.InMemoryCache=exports.HeuristicFragmentMatcher=void 0;var e=require("tslib"),t=require("apollo-cache"),r=require("apollo-utilities"),i=require("optimism"),a=require("ts-invariant"),n=!1;function o(){var e=!n;return(0,r.isTest)()||(n=!0),e}var s=function(){function e(){}return e.prototype.ensureReady=function(){return Promise.resolve()},e.prototype.canBypassInit=function(){return!0},e.prototype.match=function(e,t,r){var i=r.store.get(e.id),a="ROOT_QUERY"===e.id;if(!i)return a;var n=i.__typename,s=void 0===n?a&&"Query":n;return s&&s===t||(o(),"heuristic")},e}();exports.HeuristicFragmentMatcher=s;var c=function(){function e(e){e&&e.introspectionQueryResultData?(this.possibleTypesMap=this.parseIntrospectionResult(e.introspectionQueryResultData),this.isReady=!0):this.isReady=!1,this.match=this.match.bind(this)}return e.prototype.match=function(e,t,r){(0,a.invariant)(this.isReady,6);var i=r.store.get(e.id),n="ROOT_QUERY"===e.id;if(!i)return n;var o=i.__typename,s=void 0===o?n&&"Query":o;if((0,a.invariant)(s,7),s===t)return!0;var c=this.possibleTypesMap[t];return!!(s&&c&&c.indexOf(s)>-1)},e.prototype.parseIntrospectionResult=function(e){var t={};return e.__schema.types.forEach(function(e){"UNION"!==e.kind&&"INTERFACE"!==e.kind||(t[e.name]=e.possibleTypes.map(function(e){return e.name}))}),t},e}();exports.IntrospectionFragmentMatcher=c;var u=Object.prototype.hasOwnProperty,l=function(){function e(e){var t=this;void 0===e&&(e=Object.create(null)),this.data=e,this.depend=(0,i.wrap)(function(e){return t.data[e]},{disposable:!0,makeCacheKey:function(e){return e}})}return e.prototype.toObject=function(){return this.data},e.prototype.get=function(e){return this.depend(e),this.data[e]},e.prototype.set=function(e,t){t!==this.data[e]&&(this.data[e]=t,this.depend.dirty(e))},e.prototype.delete=function(e){u.call(this.data,e)&&(delete this.data[e],this.depend.dirty(e))},e.prototype.clear=function(){this.replace(null)},e.prototype.replace=function(e){var t=this;e?(Object.keys(e).forEach(function(r){t.set(r,e[r])}),Object.keys(this.data).forEach(function(r){u.call(e,r)||t.delete(r)})):Object.keys(this.data).forEach(function(e){t.delete(e)})},e}();function d(e){return new l(e)}var p=function(){function t(e){var t=this,a=void 0===e?{}:e,n=a.cacheKeyRoot,o=void 0===n?new i.KeyTrie(r.canUseWeakMap):n,s=a.freezeResults,c=void 0!==s&&s,u=this.executeStoreQuery,d=this.executeSelectionSet,p=this.executeSubSelectedArray;this.freezeResults=c,this.executeStoreQuery=(0,i.wrap)(function(e){return u.call(t,e)},{makeCacheKey:function(e){var t=e.query,r=e.rootValue,i=e.contextValue,a=e.variableValues,n=e.fragmentMatcher;if(i.store instanceof l)return o.lookup(i.store,t,n,JSON.stringify(a),r.id)}}),this.executeSelectionSet=(0,i.wrap)(function(e){return d.call(t,e)},{makeCacheKey:function(e){var t=e.selectionSet,r=e.rootValue,i=e.execContext;if(i.contextValue.store instanceof l)return o.lookup(i.contextValue.store,t,i.fragmentMatcher,JSON.stringify(i.variableValues),r.id)}}),this.executeSubSelectedArray=(0,i.wrap)(function(e){return p.call(t,e)},{makeCacheKey:function(e){var t=e.field,r=e.array,i=e.execContext;if(i.contextValue.store instanceof l)return o.lookup(i.contextValue.store,t,r,JSON.stringify(i.variableValues))}})}return t.prototype.readQueryFromStore=function(t){return this.diffQueryAgainstStore((0,e.__assign)({},t,{returnPartialData:!1})).result},t.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.variables,o=e.previousResult,s=e.returnPartialData,c=void 0===s||s,u=e.rootId,l=void 0===u?"ROOT_QUERY":u,d=e.fragmentMatcherFunction,p=e.config,f=(0,r.getQueryDefinition)(i);n=(0,r.assign)({},(0,r.getDefaultValues)(f),n);var h={store:t,dataIdFromObject:p&&p.dataIdFromObject,cacheRedirects:p&&p.cacheRedirects||{}},m=this.executeStoreQuery({query:i,rootValue:{type:"id",id:l,generated:!0,typename:"Query"},contextValue:h,variableValues:n,fragmentMatcher:d}),y=m.missing&&m.missing.length>0;return y&&!c&&m.missing.forEach(function(e){if(!e.tolerable)throw new a.InvariantError(8)}),o&&(0,r.isEqual)(o,m.result)&&(m.result=o),{result:m.result,complete:!y}},t.prototype.executeStoreQuery=function(e){var t=e.query,i=e.rootValue,a=e.contextValue,n=e.variableValues,o=e.fragmentMatcher,s=void 0===o?h:o,c=(0,r.getMainDefinition)(t),u=(0,r.getFragmentDefinitions)(t),l={query:t,fragmentMap:(0,r.createFragmentMap)(u),contextValue:a,variableValues:n,fragmentMatcher:s};return this.executeSelectionSet({selectionSet:c.selectionSet,rootValue:i,execContext:l})},t.prototype.executeSelectionSet=function(t){var i=this,n=t.selectionSet,o=t.rootValue,s=t.execContext,c=s.fragmentMap,u=s.contextValue,l=s.variableValues,d={result:null},p=[],f=u.store.get(o.id),h=f&&f.__typename||"ROOT_QUERY"===o.id&&"Query"||void 0;function m(e){var t;return e.missing&&(d.missing=d.missing||[],(t=d.missing).push.apply(t,e.missing)),e.result}return n.selections.forEach(function(t){var n;if((0,r.shouldInclude)(t,l))if((0,r.isField)(t)){var d=m(i.executeField(f,h,t,s));void 0!==d&&p.push(((n={})[(0,r.resultKeyNameFromField)(t)]=d,n))}else{var y=void 0;if((0,r.isInlineFragment)(t))y=t;else if(!(y=c[t.name.value]))throw new a.InvariantError(9);var v=y.typeCondition&&y.typeCondition.name.value,g=!v||s.fragmentMatcher(o,v,u);if(g){var S=i.executeSelectionSet({selectionSet:y.selectionSet,rootValue:o,execContext:s});"heuristic"===g&&S.missing&&(S=(0,e.__assign)({},S,{missing:S.missing.map(function(t){return(0,e.__assign)({},t,{tolerable:!0})})})),p.push(m(S))}}}),d.result=(0,r.mergeDeepArray)(p),this.freezeResults,d},t.prototype.executeField=function(e,t,i,a){var n=a.variableValues,o=a.contextValue,s=function(e,t,i,a,n,o){o.resultKey;var s=o.directives,c=i;(a||s)&&(c=(0,r.getStoreKeyName)(c,a,s));var u=void 0;if(e&&void 0===(u=e[c])&&n.cacheRedirects&&"string"==typeof t){var l=n.cacheRedirects[t];if(l){var d=l[i];d&&(u=d(e,a,{getCacheKey:function(e){var t=n.dataIdFromObject(e);return t&&(0,r.toIdValue)({id:t,typename:e.__typename})}}))}}if(void 0===u)return{result:u,missing:[{object:e,fieldName:c,tolerable:!1}]};(0,r.isJsonValue)(u)&&(u=u.json);return{result:u}}(e,t,i.name.value,(0,r.argumentsObjectFromField)(i,n),o,{resultKey:(0,r.resultKeyNameFromField)(i),directives:(0,r.getDirectiveInfoFromField)(i,n)});return Array.isArray(s.result)?this.combineExecResults(s,this.executeSubSelectedArray({field:i,array:s.result,execContext:a})):i.selectionSet?null==s.result?s:this.combineExecResults(s,this.executeSelectionSet({selectionSet:i.selectionSet,rootValue:s.result,execContext:a})):(f(i,s.result),this.freezeResults,s)},t.prototype.combineExecResults=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.forEach(function(t){t.missing&&(e=e||[]).push.apply(e,t.missing)}),{result:t.pop().result,missing:e}},t.prototype.executeSubSelectedArray=function(e){var t,r=this,i=e.field,a=e.array,n=e.execContext;function o(e){return e.missing&&(t=t||[]).push.apply(t,e.missing),e.result}return a=a.map(function(e){return null===e?null:Array.isArray(e)?o(r.executeSubSelectedArray({field:i,array:e,execContext:n})):i.selectionSet?o(r.executeSelectionSet({selectionSet:i.selectionSet,rootValue:e,execContext:n})):(f(i,e),e)}),this.freezeResults,{result:a,missing:t}},t}();function f(e,t){if(!e.selectionSet&&(0,r.isIdValue)(t))throw new a.InvariantError(10)}function h(){return!0}exports.StoreReader=p;var m=function(){function e(e){void 0===e&&(e=Object.create(null)),this.data=e}return e.prototype.toObject=function(){return this.data},e.prototype.get=function(e){return this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e.prototype.delete=function(e){this.data[e]=void 0},e.prototype.clear=function(){this.data=Object.create(null)},e.prototype.replace=function(e){this.data=e||Object.create(null)},e}();exports.ObjectCache=m;var y=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="WriteError",e}return(0,e.__extends)(r,t),r}(Error);function v(e,t){var r=new y("Error writing result to store for query:\n "+JSON.stringify(t));return r.message+="\n"+e.message,r.stack=e.stack,r}exports.WriteError=y;var g=function(){function t(){}return t.prototype.writeQueryToStore=function(e){var t=e.query,r=e.result,i=e.store,a=void 0===i?d():i,n=e.variables,o=e.dataIdFromObject,s=e.fragmentMatcherFunction;return this.writeResultToStore({dataId:"ROOT_QUERY",result:r,document:t,store:a,variables:n,dataIdFromObject:o,fragmentMatcherFunction:s})},t.prototype.writeResultToStore=function(e){var t=e.dataId,i=e.result,a=e.document,n=e.store,o=void 0===n?d():n,s=e.variables,c=e.dataIdFromObject,u=e.fragmentMatcherFunction,l=(0,r.getOperationDefinition)(a);try{return this.writeSelectionSetToStore({result:i,dataId:t,selectionSet:l.selectionSet,context:{store:o,processedData:{},variables:(0,r.assign)({},(0,r.getDefaultValues)(l),s),dataIdFromObject:c,fragmentMap:(0,r.createFragmentMap)((0,r.getFragmentDefinitions)(a)),fragmentMatcherFunction:u}})}catch(e){throw v(e,a)}},t.prototype.writeSelectionSetToStore=function(e){var t=this,i=e.result,n=e.dataId,o=e.selectionSet,s=e.context,c=s.variables,u=s.store,l=s.fragmentMap;return o.selections.forEach(function(e){var o;if((0,r.shouldInclude)(e,c))if((0,r.isField)(e)){var u=(0,r.resultKeyNameFromField)(e),d=i[u];if(void 0!==d)t.writeFieldToStore({dataId:n,value:d,field:e,context:s});else{var p=!1,f=!1;e.directives&&e.directives.length&&(p=e.directives.some(function(e){return e.name&&"defer"===e.name.value}),f=e.directives.some(function(e){return e.name&&"client"===e.name.value})),!p&&!f&&s.fragmentMatcherFunction}}else{var h=void 0;(0,r.isInlineFragment)(e)?h=e:(h=(l||{})[e.name.value],(0,a.invariant)(h,2));var y=!0;if(s.fragmentMatcherFunction&&h.typeCondition){var v=n||"self",g=(0,r.toIdValue)({id:v,typename:void 0}),S={store:new m((o={},o[v]=i,o)),cacheRedirects:{}},b=s.fragmentMatcherFunction(g,h.typeCondition.name.value,S);(0,r.isProduction)(),y=!!b}y&&t.writeSelectionSetToStore({result:i,selectionSet:h.selectionSet,dataId:n,context:s})}}),u},t.prototype.writeFieldToStore=function(t){var i,n,o,s=t.field,c=t.value,u=t.dataId,l=t.context,d=l.variables,p=l.dataIdFromObject,f=l.store,h=(0,r.storeKeyNameFromField)(s,d);if(s.selectionSet&&null!==c)if(Array.isArray(c)){var m=u+"."+h;n=this.processArrayValue(c,m,s.selectionSet,l)}else{var y=u+"."+h,v=!0;if(S(y)||(y="$"+y),p){var g=p(c);(0,a.invariant)(!g||!S(g),3),(g||"number"==typeof g&&0===g)&&(y=g,v=!1)}b(y,s,l.processedData)||this.writeSelectionSetToStore({dataId:y,result:c,selectionSet:s.selectionSet,context:l});var x=c.__typename;n=(0,r.toIdValue)({id:y,typename:x},v);var R=(o=f.get(u))&&o[h];if(R!==n&&(0,r.isIdValue)(R)){var I=void 0!==R.typename,F=void 0!==x,O=I&&F&&R.typename!==x;(0,a.invariant)(!v||R.generated||O,4),(0,a.invariant)(!I||F,5),R.generated&&(O?v||f.delete(R.id):function t(i,a,n){if(i===a)return!1;var o=n.get(i);var s=n.get(a);var c=!1;Object.keys(o).forEach(function(e){var i=o[e],a=s[e];(0,r.isIdValue)(i)&&S(i.id)&&(0,r.isIdValue)(a)&&!(0,r.isEqual)(i,a)&&t(i.id,a.id,n)&&(c=!0)});n.delete(i);var u=(0,e.__assign)({},o,s);if((0,r.isEqual)(u,s))return c;n.set(a,u);return!0}(R.id,n.id,f))}}else n=null!=c&&"object"==typeof c?{type:"json",json:c}:c;(o=f.get(u))&&(0,r.isEqual)(n,o[h])||f.set(u,(0,e.__assign)({},o,((i={})[h]=n,i)))},t.prototype.processArrayValue=function(e,t,i,a){var n=this;return e.map(function(e,o){if(null===e)return null;var s=t+"."+o;if(Array.isArray(e))return n.processArrayValue(e,s,i,a);var c=!0;if(a.dataIdFromObject){var u=a.dataIdFromObject(e);u&&(s=u,c=!1)}return b(s,i,a.processedData)||n.writeSelectionSetToStore({dataId:s,result:e,selectionSet:i,context:a}),(0,r.toIdValue)({id:s,typename:e.__typename},c)})},t}();function S(e){return"$"===e[0]}function b(e,t,r){if(!r)return!1;if(r[e]){if(r[e].indexOf(t)>=0)return!0;r[e].push(t)}else r[e]=[t];return!1}exports.StoreWriter=g;var x={fragmentMatcher:new s,dataIdFromObject:R,addTypename:!0,resultCaching:!0,freezeResults:!1};function R(e){if(e.__typename){if(void 0!==e.id)return e.__typename+":"+e.id;if(void 0!==e._id)return e.__typename+":"+e._id}return null}var I=Object.prototype.hasOwnProperty,F=function(t){function r(e,r,i){var a=t.call(this,Object.create(null))||this;return a.optimisticId=e,a.parent=r,a.transaction=i,a}return(0,e.__extends)(r,t),r.prototype.toObject=function(){return(0,e.__assign)({},this.parent.toObject(),this.data)},r.prototype.get=function(e){return I.call(this.data,e)?this.data[e]:this.parent.get(e)},r}(m),O=function(t){function n(a){void 0===a&&(a={});var n=t.call(this)||this;n.watches=new Set,n.typenameDocumentCache=new Map,n.cacheKeyRoot=new i.KeyTrie(r.canUseWeakMap),n.silenceBroadcast=!1,n.config=(0,e.__assign)({},x,a),n.config.customResolvers&&(n.config.cacheRedirects=n.config.customResolvers),n.config.cacheResolvers&&(n.config.cacheRedirects=n.config.cacheResolvers),n.addTypename=!!n.config.addTypename,n.data=n.config.resultCaching?new l:new m,n.optimisticData=n.data,n.storeWriter=new g,n.storeReader=new p({cacheKeyRoot:n.cacheKeyRoot,freezeResults:a.freezeResults});var o=n,s=o.maybeBroadcastWatch;return n.maybeBroadcastWatch=(0,i.wrap)(function(e){return s.call(n,e)},{makeCacheKey:function(e){if(!e.optimistic&&!e.previousResult)return o.data instanceof l?o.cacheKeyRoot.lookup(e.query,JSON.stringify(e.variables)):void 0}}),n}return(0,e.__extends)(n,t),n.prototype.restore=function(e){return e&&this.data.replace(e),this},n.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).toObject()},n.prototype.read=function(e){if("string"==typeof e.rootId&&void 0===this.data.get(e.rootId))return null;var t=this.config.fragmentMatcher,r=t&&t.match;return this.storeReader.readQueryFromStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,rootId:e.rootId,fragmentMatcherFunction:r,previousResult:e.previousResult,config:this.config})||null},n.prototype.write=function(e){var t=this.config.fragmentMatcher,r=t&&t.match;this.storeWriter.writeResultToStore({dataId:e.dataId,result:e.result,variables:e.variables,document:this.transformDocument(e.query),store:this.data,dataIdFromObject:this.config.dataIdFromObject,fragmentMatcherFunction:r}),this.broadcastWatches()},n.prototype.diff=function(e){var t=this.config.fragmentMatcher,r=t&&t.match;return this.storeReader.diffQueryAgainstStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,returnPartialData:e.returnPartialData,previousResult:e.previousResult,fragmentMatcherFunction:r,config:this.config})},n.prototype.watch=function(e){var t=this;return this.watches.add(e),function(){t.watches.delete(e)}},n.prototype.evict=function(e){throw new a.InvariantError(1)},n.prototype.reset=function(){return this.data.clear(),this.broadcastWatches(),Promise.resolve()},n.prototype.removeOptimistic=function(e){for(var t=[],r=0,i=this.optimisticData;i instanceof F;)i.optimisticId===e?++r:t.push(i),i=i.parent;if(r>0){for(this.optimisticData=i;t.length>0;){var a=t.pop();this.performTransaction(a.transaction,a.optimisticId)}this.broadcastWatches()}},n.prototype.performTransaction=function(e,t){var r=this.data,i=this.silenceBroadcast;this.silenceBroadcast=!0,"string"==typeof t&&(this.data=this.optimisticData=new F(t,this.optimisticData,e));try{e(this)}finally{this.silenceBroadcast=i,this.data=r}this.broadcastWatches()},n.prototype.recordOptimisticTransaction=function(e,t){return this.performTransaction(e,t)},n.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=(0,r.addTypenameToDocument)(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},n.prototype.broadcastWatches=function(){var e=this;this.silenceBroadcast||this.watches.forEach(function(t){return e.maybeBroadcastWatch(t)})},n.prototype.maybeBroadcastWatch=function(e){e.callback(this.diff({query:e.query,variables:e.variables,previousResult:e.previousResult&&e.previousResult(),optimistic:e.optimistic}))},n}(t.ApolloCache);exports.InMemoryCache=O;
exports.__esModule=!0,exports.assertIdValue=function(e){(0,a.invariant)((0,r.isIdValue)(e),11)},exports.defaultDataIdFromObject=R,exports.defaultNormalizedCacheFactory=function(e){return new m(e)},exports.enhanceErrorWithDocument=v,exports.WriteError=exports.StoreWriter=exports.StoreReader=exports.ObjectCache=exports.IntrospectionFragmentMatcher=exports.InMemoryCache=exports.HeuristicFragmentMatcher=void 0;var e=require("tslib"),t=require("apollo-cache"),r=require("apollo-utilities"),i=require("optimism"),a=require("ts-invariant"),n=!1;function o(){var e=!n;return(0,r.isTest)()||(n=!0),e}var s=function(){function e(){}return e.prototype.ensureReady=function(){return Promise.resolve()},e.prototype.canBypassInit=function(){return!0},e.prototype.match=function(e,t,r){var i=r.store.get(e.id),a="ROOT_QUERY"===e.id;if(!i)return a;var n=i.__typename,s=void 0===n?a&&"Query":n;return s&&s===t||(o(),"heuristic")},e}();exports.HeuristicFragmentMatcher=s;var c=function(){function e(e){e&&e.introspectionQueryResultData?(this.possibleTypesMap=this.parseIntrospectionResult(e.introspectionQueryResultData),this.isReady=!0):this.isReady=!1,this.match=this.match.bind(this)}return e.prototype.match=function(e,t,r){(0,a.invariant)(this.isReady,2);var i=r.store.get(e.id),n="ROOT_QUERY"===e.id;if(!i)return n;var o=i.__typename,s=void 0===o?n&&"Query":o;if((0,a.invariant)(s,3),s===t)return!0;var c=this.possibleTypesMap[t];return!!(s&&c&&c.indexOf(s)>-1)},e.prototype.parseIntrospectionResult=function(e){var t={};return e.__schema.types.forEach(function(e){"UNION"!==e.kind&&"INTERFACE"!==e.kind||(t[e.name]=e.possibleTypes.map(function(e){return e.name}))}),t},e}();exports.IntrospectionFragmentMatcher=c;var u=Object.prototype.hasOwnProperty,l=function(){function e(e){var t=this;void 0===e&&(e=Object.create(null)),this.data=e,this.depend=(0,i.wrap)(function(e){return t.data[e]},{disposable:!0,makeCacheKey:function(e){return e}})}return e.prototype.toObject=function(){return this.data},e.prototype.get=function(e){return this.depend(e),this.data[e]},e.prototype.set=function(e,t){t!==this.data[e]&&(this.data[e]=t,this.depend.dirty(e))},e.prototype.delete=function(e){u.call(this.data,e)&&(delete this.data[e],this.depend.dirty(e))},e.prototype.clear=function(){this.replace(null)},e.prototype.replace=function(e){var t=this;e?(Object.keys(e).forEach(function(r){t.set(r,e[r])}),Object.keys(this.data).forEach(function(r){u.call(e,r)||t.delete(r)})):Object.keys(this.data).forEach(function(e){t.delete(e)})},e}();function d(e){return new l(e)}var p=function(){function t(e){var t=this,a=void 0===e?{}:e,n=a.cacheKeyRoot,o=void 0===n?new i.KeyTrie(r.canUseWeakMap):n,s=a.freezeResults,c=void 0!==s&&s,u=this.executeStoreQuery,d=this.executeSelectionSet,p=this.executeSubSelectedArray;this.freezeResults=c,this.executeStoreQuery=(0,i.wrap)(function(e){return u.call(t,e)},{makeCacheKey:function(e){var t=e.query,r=e.rootValue,i=e.contextValue,a=e.variableValues,n=e.fragmentMatcher;if(i.store instanceof l)return o.lookup(i.store,t,n,JSON.stringify(a),r.id)}}),this.executeSelectionSet=(0,i.wrap)(function(e){return d.call(t,e)},{makeCacheKey:function(e){var t=e.selectionSet,r=e.rootValue,i=e.execContext;if(i.contextValue.store instanceof l)return o.lookup(i.contextValue.store,t,i.fragmentMatcher,JSON.stringify(i.variableValues),r.id)}}),this.executeSubSelectedArray=(0,i.wrap)(function(e){return p.call(t,e)},{makeCacheKey:function(e){var t=e.field,r=e.array,i=e.execContext;if(i.contextValue.store instanceof l)return o.lookup(i.contextValue.store,t,r,JSON.stringify(i.variableValues))}})}return t.prototype.readQueryFromStore=function(t){return this.diffQueryAgainstStore((0,e.__assign)((0,e.__assign)({},t),{returnPartialData:!1})).result},t.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.variables,o=e.previousResult,s=e.returnPartialData,c=void 0===s||s,u=e.rootId,l=void 0===u?"ROOT_QUERY":u,d=e.fragmentMatcherFunction,p=e.config,f=(0,r.getQueryDefinition)(i);n=(0,r.assign)({},(0,r.getDefaultValues)(f),n);var h={store:t,dataIdFromObject:p&&p.dataIdFromObject,cacheRedirects:p&&p.cacheRedirects||{}},m=this.executeStoreQuery({query:i,rootValue:{type:"id",id:l,generated:!0,typename:"Query"},contextValue:h,variableValues:n,fragmentMatcher:d}),y=m.missing&&m.missing.length>0;return y&&!c&&m.missing.forEach(function(e){if(!e.tolerable)throw new a.InvariantError(8)}),o&&(0,r.isEqual)(o,m.result)&&(m.result=o),{result:m.result,complete:!y}},t.prototype.executeStoreQuery=function(e){var t=e.query,i=e.rootValue,a=e.contextValue,n=e.variableValues,o=e.fragmentMatcher,s=void 0===o?h:o,c=(0,r.getMainDefinition)(t),u=(0,r.getFragmentDefinitions)(t),l={query:t,fragmentMap:(0,r.createFragmentMap)(u),contextValue:a,variableValues:n,fragmentMatcher:s};return this.executeSelectionSet({selectionSet:c.selectionSet,rootValue:i,execContext:l})},t.prototype.executeSelectionSet=function(t){var i=this,n=t.selectionSet,o=t.rootValue,s=t.execContext,c=s.fragmentMap,u=s.contextValue,l=s.variableValues,d={result:null},p=[],f=u.store.get(o.id),h=f&&f.__typename||"ROOT_QUERY"===o.id&&"Query"||void 0;function m(e){var t;return e.missing&&(d.missing=d.missing||[],(t=d.missing).push.apply(t,e.missing)),e.result}return n.selections.forEach(function(t){var n;if((0,r.shouldInclude)(t,l))if((0,r.isField)(t)){var d=m(i.executeField(f,h,t,s));void 0!==d&&p.push(((n={})[(0,r.resultKeyNameFromField)(t)]=d,n))}else{var y=void 0;if((0,r.isInlineFragment)(t))y=t;else if(!(y=c[t.name.value]))throw new a.InvariantError(9);var v=y.typeCondition&&y.typeCondition.name.value,g=!v||s.fragmentMatcher(o,v,u);if(g){var S=i.executeSelectionSet({selectionSet:y.selectionSet,rootValue:o,execContext:s});"heuristic"===g&&S.missing&&(S=(0,e.__assign)((0,e.__assign)({},S),{missing:S.missing.map(function(t){return(0,e.__assign)((0,e.__assign)({},t),{tolerable:!0})})})),p.push(m(S))}}}),d.result=(0,r.mergeDeepArray)(p),this.freezeResults,d},t.prototype.executeField=function(e,t,i,a){var n=a.variableValues,o=a.contextValue,s=function(e,t,i,a,n,o){o.resultKey;var s=o.directives,c=i;(a||s)&&(c=(0,r.getStoreKeyName)(c,a,s));var u=void 0;if(e&&void 0===(u=e[c])&&n.cacheRedirects&&"string"==typeof t){var l=n.cacheRedirects[t];if(l){var d=l[i];d&&(u=d(e,a,{getCacheKey:function(e){var t=n.dataIdFromObject(e);return t&&(0,r.toIdValue)({id:t,typename:e.__typename})}}))}}if(void 0===u)return{result:u,missing:[{object:e,fieldName:c,tolerable:!1}]};(0,r.isJsonValue)(u)&&(u=u.json);return{result:u}}(e,t,i.name.value,(0,r.argumentsObjectFromField)(i,n),o,{resultKey:(0,r.resultKeyNameFromField)(i),directives:(0,r.getDirectiveInfoFromField)(i,n)});return Array.isArray(s.result)?this.combineExecResults(s,this.executeSubSelectedArray({field:i,array:s.result,execContext:a})):i.selectionSet?null==s.result?s:this.combineExecResults(s,this.executeSelectionSet({selectionSet:i.selectionSet,rootValue:s.result,execContext:a})):(f(i,s.result),this.freezeResults,s)},t.prototype.combineExecResults=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.forEach(function(t){t.missing&&(e=e||[]).push.apply(e,t.missing)}),{result:t.pop().result,missing:e}},t.prototype.executeSubSelectedArray=function(e){var t,r=this,i=e.field,a=e.array,n=e.execContext;function o(e){return e.missing&&(t=t||[]).push.apply(t,e.missing),e.result}return a=a.map(function(e){return null===e?null:Array.isArray(e)?o(r.executeSubSelectedArray({field:i,array:e,execContext:n})):i.selectionSet?o(r.executeSelectionSet({selectionSet:i.selectionSet,rootValue:e,execContext:n})):(f(i,e),e)}),this.freezeResults,{result:a,missing:t}},t}();function f(e,t){if(!e.selectionSet&&(0,r.isIdValue)(t))throw new a.InvariantError(10)}function h(){return!0}exports.StoreReader=p;var m=function(){function e(e){void 0===e&&(e=Object.create(null)),this.data=e}return e.prototype.toObject=function(){return this.data},e.prototype.get=function(e){return this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e.prototype.delete=function(e){this.data[e]=void 0},e.prototype.clear=function(){this.data=Object.create(null)},e.prototype.replace=function(e){this.data=e||Object.create(null)},e}();exports.ObjectCache=m;var y=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="WriteError",e}return(0,e.__extends)(r,t),r}(Error);function v(e,t){var r=new y("Error writing result to store for query:\n "+JSON.stringify(t));return r.message+="\n"+e.message,r.stack=e.stack,r}exports.WriteError=y;var g=function(){function t(){}return t.prototype.writeQueryToStore=function(e){var t=e.query,r=e.result,i=e.store,a=void 0===i?d():i,n=e.variables,o=e.dataIdFromObject,s=e.fragmentMatcherFunction;return this.writeResultToStore({dataId:"ROOT_QUERY",result:r,document:t,store:a,variables:n,dataIdFromObject:o,fragmentMatcherFunction:s})},t.prototype.writeResultToStore=function(e){var t=e.dataId,i=e.result,a=e.document,n=e.store,o=void 0===n?d():n,s=e.variables,c=e.dataIdFromObject,u=e.fragmentMatcherFunction,l=(0,r.getOperationDefinition)(a);try{return this.writeSelectionSetToStore({result:i,dataId:t,selectionSet:l.selectionSet,context:{store:o,processedData:{},variables:(0,r.assign)({},(0,r.getDefaultValues)(l),s),dataIdFromObject:c,fragmentMap:(0,r.createFragmentMap)((0,r.getFragmentDefinitions)(a)),fragmentMatcherFunction:u}})}catch(e){throw v(e,a)}},t.prototype.writeSelectionSetToStore=function(e){var t=this,i=e.result,n=e.dataId,o=e.selectionSet,s=e.context,c=s.variables,u=s.store,l=s.fragmentMap;return o.selections.forEach(function(e){var o;if((0,r.shouldInclude)(e,c))if((0,r.isField)(e)){var u=(0,r.resultKeyNameFromField)(e),d=i[u];if(void 0!==d)t.writeFieldToStore({dataId:n,value:d,field:e,context:s});else{var p=!1,f=!1;e.directives&&e.directives.length&&(p=e.directives.some(function(e){return e.name&&"defer"===e.name.value}),f=e.directives.some(function(e){return e.name&&"client"===e.name.value})),!p&&!f&&s.fragmentMatcherFunction}}else{var h=void 0;(0,r.isInlineFragment)(e)?h=e:(h=(l||{})[e.name.value],(0,a.invariant)(h,4));var y=!0;if(s.fragmentMatcherFunction&&h.typeCondition){var v=n||"self",g=(0,r.toIdValue)({id:v,typename:void 0}),S={store:new m((o={},o[v]=i,o)),cacheRedirects:{}},b=s.fragmentMatcherFunction(g,h.typeCondition.name.value,S);(0,r.isProduction)(),y=!!b}y&&t.writeSelectionSetToStore({result:i,selectionSet:h.selectionSet,dataId:n,context:s})}}),u},t.prototype.writeFieldToStore=function(t){var i,n,o,s=t.field,c=t.value,u=t.dataId,l=t.context,d=l.variables,p=l.dataIdFromObject,f=l.store,h=(0,r.storeKeyNameFromField)(s,d);if(s.selectionSet&&null!==c)if(Array.isArray(c)){var m=u+"."+h;n=this.processArrayValue(c,m,s.selectionSet,l)}else{var y=u+"."+h,v=!0;if(S(y)||(y="$"+y),p){var g=p(c);(0,a.invariant)(!g||!S(g),5),(g||"number"==typeof g&&0===g)&&(y=g,v=!1)}b(y,s,l.processedData)||this.writeSelectionSetToStore({dataId:y,result:c,selectionSet:s.selectionSet,context:l});var x=c.__typename;n=(0,r.toIdValue)({id:y,typename:x},v);var R=(o=f.get(u))&&o[h];if(R!==n&&(0,r.isIdValue)(R)){var _=void 0!==R.typename,I=void 0!==x,F=_&&I&&R.typename!==x;(0,a.invariant)(!v||R.generated||F,6),(0,a.invariant)(!_||I,7),R.generated&&(F?v||f.delete(R.id):function t(i,a,n){if(i===a)return!1;var o=n.get(i);var s=n.get(a);var c=!1;Object.keys(o).forEach(function(e){var i=o[e],a=s[e];(0,r.isIdValue)(i)&&S(i.id)&&(0,r.isIdValue)(a)&&!(0,r.isEqual)(i,a)&&t(i.id,a.id,n)&&(c=!0)});n.delete(i);var u=(0,e.__assign)((0,e.__assign)({},o),s);if((0,r.isEqual)(u,s))return c;n.set(a,u);return!0}(R.id,n.id,f))}}else n=null!=c&&"object"==typeof c?{type:"json",json:c}:c;(o=f.get(u))&&(0,r.isEqual)(n,o[h])||f.set(u,(0,e.__assign)((0,e.__assign)({},o),((i={})[h]=n,i)))},t.prototype.processArrayValue=function(e,t,i,a){var n=this;return e.map(function(e,o){if(null===e)return null;var s=t+"."+o;if(Array.isArray(e))return n.processArrayValue(e,s,i,a);var c=!0;if(a.dataIdFromObject){var u=a.dataIdFromObject(e);u&&(s=u,c=!1)}return b(s,i,a.processedData)||n.writeSelectionSetToStore({dataId:s,result:e,selectionSet:i,context:a}),(0,r.toIdValue)({id:s,typename:e.__typename},c)})},t}();function S(e){return"$"===e[0]}function b(e,t,r){if(!r)return!1;if(r[e]){if(r[e].indexOf(t)>=0)return!0;r[e].push(t)}else r[e]=[t];return!1}exports.StoreWriter=g;var x={fragmentMatcher:new s,dataIdFromObject:R,addTypename:!0,resultCaching:!0,freezeResults:!1};function R(e){if(e.__typename){if(void 0!==e.id)return e.__typename+":"+e.id;if(void 0!==e._id)return e.__typename+":"+e._id}return null}var _=Object.prototype.hasOwnProperty,I=function(t){function r(e,r,i){var a=t.call(this,Object.create(null))||this;return a.optimisticId=e,a.parent=r,a.transaction=i,a}return(0,e.__extends)(r,t),r.prototype.toObject=function(){return(0,e.__assign)((0,e.__assign)({},this.parent.toObject()),this.data)},r.prototype.get=function(e){return _.call(this.data,e)?this.data[e]:this.parent.get(e)},r}(m),F=function(t){function n(a){void 0===a&&(a={});var n=t.call(this)||this;n.watches=new Set,n.typenameDocumentCache=new Map,n.cacheKeyRoot=new i.KeyTrie(r.canUseWeakMap),n.silenceBroadcast=!1,n.config=(0,e.__assign)((0,e.__assign)({},x),a),n.config.customResolvers&&(n.config.cacheRedirects=n.config.customResolvers),n.config.cacheResolvers&&(n.config.cacheRedirects=n.config.cacheResolvers),n.addTypename=!!n.config.addTypename,n.data=n.config.resultCaching?new l:new m,n.optimisticData=n.data,n.storeWriter=new g,n.storeReader=new p({cacheKeyRoot:n.cacheKeyRoot,freezeResults:a.freezeResults});var o=n,s=o.maybeBroadcastWatch;return n.maybeBroadcastWatch=(0,i.wrap)(function(e){return s.call(n,e)},{makeCacheKey:function(e){if(!e.optimistic&&!e.previousResult)return o.data instanceof l?o.cacheKeyRoot.lookup(e.query,JSON.stringify(e.variables)):void 0}}),n}return(0,e.__extends)(n,t),n.prototype.restore=function(e){return e&&this.data.replace(e),this},n.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).toObject()},n.prototype.read=function(e){if("string"==typeof e.rootId&&void 0===this.data.get(e.rootId))return null;var t=this.config.fragmentMatcher,r=t&&t.match;return this.storeReader.readQueryFromStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,rootId:e.rootId,fragmentMatcherFunction:r,previousResult:e.previousResult,config:this.config})||null},n.prototype.write=function(e){var t=this.config.fragmentMatcher,r=t&&t.match;this.storeWriter.writeResultToStore({dataId:e.dataId,result:e.result,variables:e.variables,document:this.transformDocument(e.query),store:this.data,dataIdFromObject:this.config.dataIdFromObject,fragmentMatcherFunction:r}),this.broadcastWatches()},n.prototype.diff=function(e){var t=this.config.fragmentMatcher,r=t&&t.match;return this.storeReader.diffQueryAgainstStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,returnPartialData:e.returnPartialData,previousResult:e.previousResult,fragmentMatcherFunction:r,config:this.config})},n.prototype.watch=function(e){var t=this;return this.watches.add(e),function(){t.watches.delete(e)}},n.prototype.evict=function(e){throw new a.InvariantError(1)},n.prototype.reset=function(){return this.data.clear(),this.broadcastWatches(),Promise.resolve()},n.prototype.removeOptimistic=function(e){for(var t=[],r=0,i=this.optimisticData;i instanceof I;)i.optimisticId===e?++r:t.push(i),i=i.parent;if(r>0){for(this.optimisticData=i;t.length>0;){var a=t.pop();this.performTransaction(a.transaction,a.optimisticId)}this.broadcastWatches()}},n.prototype.performTransaction=function(e,t){var r=this.data,i=this.silenceBroadcast;this.silenceBroadcast=!0,"string"==typeof t&&(this.data=this.optimisticData=new I(t,this.optimisticData,e));try{e(this)}finally{this.silenceBroadcast=i,this.data=r}this.broadcastWatches()},n.prototype.recordOptimisticTransaction=function(e,t){return this.performTransaction(e,t)},n.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=(0,r.addTypenameToDocument)(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},n.prototype.broadcastWatches=function(){var e=this;this.silenceBroadcast||this.watches.forEach(function(t){return e.maybeBroadcastWatch(t)})},n.prototype.maybeBroadcastWatch=function(e){e.callback(this.diff({query:e.query,variables:e.variables,previousResult:e.previousResult&&e.previousResult(),optimistic:e.optimistic}))},n}(t.ApolloCache);exports.InMemoryCache=F;

@@ -66,3 +66,3 @@ import { __assign, __extends } from 'tslib';

IntrospectionFragmentMatcher.prototype.match = function (idValue, typeCondition, context) {
process.env.NODE_ENV === "production" ? invariant(this.isReady, 6) : invariant(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()');
process.env.NODE_ENV === "production" ? invariant(this.isReady, 2) : invariant(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()');
var obj = context.store.get(idValue.id);

@@ -74,3 +74,3 @@ var isRootQuery = idValue.id === 'ROOT_QUERY';

var _a = obj.__typename, __typename = _a === void 0 ? isRootQuery && 'Query' : _a;
process.env.NODE_ENV === "production" ? invariant(__typename, 7) : invariant(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj));
process.env.NODE_ENV === "production" ? invariant(__typename, 3) : invariant(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj));
if (__typename === typeCondition) {

@@ -197,3 +197,3 @@ return true;

StoreReader.prototype.readQueryFromStore = function (options) {
return this.diffQueryAgainstStore(__assign({}, options, { returnPartialData: false })).result;
return this.diffQueryAgainstStore(__assign(__assign({}, options), { returnPartialData: false })).result;
};

@@ -309,4 +309,4 @@ StoreReader.prototype.diffQueryAgainstStore = function (_a) {

if (match === 'heuristic' && fragmentExecResult.missing) {
fragmentExecResult = __assign({}, fragmentExecResult, { missing: fragmentExecResult.missing.map(function (info) {
return __assign({}, info, { tolerable: true });
fragmentExecResult = __assign(__assign({}, fragmentExecResult), { missing: fragmentExecResult.missing.map(function (info) {
return __assign(__assign({}, info), { tolerable: true });
}) });

@@ -590,3 +590,3 @@ }

fragment = (fragmentMap || {})[selection.name.value];
process.env.NODE_ENV === "production" ? invariant(fragment, 2) : invariant(fragment, "No fragment named " + selection.name.value + ".");
process.env.NODE_ENV === "production" ? invariant(fragment, 4) : invariant(fragment, "No fragment named " + selection.name.value + ".");
}

@@ -646,3 +646,3 @@ var matches = true;

var semanticId = dataIdFromObject(value);
process.env.NODE_ENV === "production" ? invariant(!semanticId || !isGeneratedId(semanticId), 3) : invariant(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.');
process.env.NODE_ENV === "production" ? invariant(!semanticId || !isGeneratedId(semanticId), 5) : invariant(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.');
if (semanticId ||

@@ -670,4 +670,4 @@ (typeof semanticId === 'number' && semanticId === 0)) {

var typenameChanged = hadTypename && hasTypename && escapedId.typename !== typename;
process.env.NODE_ENV === "production" ? invariant(!generated || escapedId.generated || typenameChanged, 4) : invariant(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
process.env.NODE_ENV === "production" ? invariant(!hadTypename || hasTypename, 5) : invariant(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
process.env.NODE_ENV === "production" ? invariant(!generated || escapedId.generated || typenameChanged, 6) : invariant(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
process.env.NODE_ENV === "production" ? invariant(!hadTypename || hasTypename, 7) : invariant(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
if (escapedId.generated) {

@@ -687,3 +687,3 @@ if (typenameChanged) {

if (!storeObject || !isEqual(storeValue, storeObject[storeFieldName])) {
store.set(dataId, __assign({}, storeObject, (_b = {}, _b[storeFieldName] = storeValue, _b)));
store.set(dataId, __assign(__assign({}, storeObject), (_b = {}, _b[storeFieldName] = storeValue, _b)));
}

@@ -744,3 +744,3 @@ };

cache.delete(generatedKey);
var newRealValue = __assign({}, generated, real);
var newRealValue = __assign(__assign({}, generated), real);
if (isEqual(newRealValue, real)) {

@@ -799,3 +799,3 @@ return madeChanges;

OptimisticCacheLayer.prototype.toObject = function () {
return __assign({}, this.parent.toObject(), this.data);
return __assign(__assign({}, this.parent.toObject()), this.data);
};

@@ -818,3 +818,3 @@ OptimisticCacheLayer.prototype.get = function (dataId) {

_this.silenceBroadcast = false;
_this.config = __assign({}, defaultConfig, config);
_this.config = __assign(__assign({}, defaultConfig), config);
if (_this.config.customResolvers) {

@@ -821,0 +821,0 @@ process.env.NODE_ENV === "production" || invariant.warn('customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.');

@@ -13,3 +13,3 @@ (function (global, factory) {

}
})(this, function (_exports, _tslib, _apolloCache, _apolloUtilities, _optimism, _tsInvariant) {
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _tslib, _apolloCache, _apolloUtilities, _optimism, _tsInvariant) {

@@ -95,3 +95,3 @@ _exports.__esModule = true;

IntrospectionFragmentMatcher.prototype.match = function (idValue, typeCondition, context) {
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(this.isReady, 6) : (0, _tsInvariant.invariant)(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()');
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(this.isReady, 2) : (0, _tsInvariant.invariant)(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()');
var obj = context.store.get(idValue.id);

@@ -107,3 +107,3 @@ var isRootQuery = idValue.id === 'ROOT_QUERY';

process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(__typename, 7) : (0, _tsInvariant.invariant)(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj));
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(__typename, 3) : (0, _tsInvariant.invariant)(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj));

@@ -277,3 +277,3 @@ if (__typename === typeCondition) {

StoreReader.prototype.readQueryFromStore = function (options) {
return this.diffQueryAgainstStore((0, _tslib.__assign)({}, options, {
return this.diffQueryAgainstStore((0, _tslib.__assign)((0, _tslib.__assign)({}, options), {
returnPartialData: false

@@ -423,5 +423,5 @@ })).result;

if (match === 'heuristic' && fragmentExecResult.missing) {
fragmentExecResult = (0, _tslib.__assign)({}, fragmentExecResult, {
fragmentExecResult = (0, _tslib.__assign)((0, _tslib.__assign)({}, fragmentExecResult), {
missing: fragmentExecResult.missing.map(function (info) {
return (0, _tslib.__assign)({}, info, {
return (0, _tslib.__assign)((0, _tslib.__assign)({}, info), {
tolerable: true

@@ -800,3 +800,3 @@ });

fragment = (fragmentMap || {})[selection.name.value];
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragment, 2) : (0, _tsInvariant.invariant)(fragment, "No fragment named " + selection.name.value + ".");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragment, 4) : (0, _tsInvariant.invariant)(fragment, "No fragment named " + selection.name.value + ".");
}

@@ -870,3 +870,3 @@

var semanticId = dataIdFromObject(value);
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 3) : (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.');
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 5) : (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.');

@@ -900,4 +900,4 @@ if (semanticId || typeof semanticId === 'number' && semanticId === 0) {

var typenameChanged = hadTypename && hasTypename && escapedId.typename !== typename;
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, 4) : (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!hadTypename || hasTypename, 5) : (0, _tsInvariant.invariant)(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, 6) : (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field));
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!hadTypename || hasTypename, 7) : (0, _tsInvariant.invariant)(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field));

@@ -919,3 +919,3 @@ if (escapedId.generated) {

if (!storeObject || !(0, _apolloUtilities.isEqual)(storeValue, storeObject[storeFieldName])) {
store.set(dataId, (0, _tslib.__assign)({}, storeObject, (_b = {}, _b[storeFieldName] = storeValue, _b)));
store.set(dataId, (0, _tslib.__assign)((0, _tslib.__assign)({}, storeObject), (_b = {}, _b[storeFieldName] = storeValue, _b)));
}

@@ -991,3 +991,3 @@ };

cache.delete(generatedKey);
var newRealValue = (0, _tslib.__assign)({}, generated, real);
var newRealValue = (0, _tslib.__assign)((0, _tslib.__assign)({}, generated), real);

@@ -1057,3 +1057,3 @@ if ((0, _apolloUtilities.isEqual)(newRealValue, real)) {

OptimisticCacheLayer.prototype.toObject = function () {
return (0, _tslib.__assign)({}, this.parent.toObject(), this.data);
return (0, _tslib.__assign)((0, _tslib.__assign)({}, this.parent.toObject()), this.data);
};

@@ -1082,3 +1082,3 @@

_this.silenceBroadcast = false;
_this.config = (0, _tslib.__assign)({}, defaultConfig, config);
_this.config = (0, _tslib.__assign)((0, _tslib.__assign)({}, defaultConfig), config);

@@ -1085,0 +1085,0 @@ if (_this.config.customResolvers) {

@@ -45,3 +45,3 @@ "use strict";

OptimisticCacheLayer.prototype.toObject = function () {
return tslib_1.__assign({}, this.parent.toObject(), this.data);
return tslib_1.__assign(tslib_1.__assign({}, this.parent.toObject()), this.data);
};

@@ -65,3 +65,3 @@ OptimisticCacheLayer.prototype.get = function (dataId) {

_this.silenceBroadcast = false;
_this.config = tslib_1.__assign({}, defaultConfig, config);
_this.config = tslib_1.__assign(tslib_1.__assign({}, defaultConfig), config);
if (_this.config.customResolvers) {

@@ -68,0 +68,0 @@ ts_invariant_1.invariant.warn('customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.');

@@ -46,3 +46,3 @@ "use strict";

StoreReader.prototype.readQueryFromStore = function (options) {
return this.diffQueryAgainstStore(tslib_1.__assign({}, options, { returnPartialData: false })).result;
return this.diffQueryAgainstStore(tslib_1.__assign(tslib_1.__assign({}, options), { returnPartialData: false })).result;
};

@@ -158,4 +158,4 @@ StoreReader.prototype.diffQueryAgainstStore = function (_a) {

if (match === 'heuristic' && fragmentExecResult.missing) {
fragmentExecResult = tslib_1.__assign({}, fragmentExecResult, { missing: fragmentExecResult.missing.map(function (info) {
return tslib_1.__assign({}, info, { tolerable: true });
fragmentExecResult = tslib_1.__assign(tslib_1.__assign({}, fragmentExecResult), { missing: fragmentExecResult.missing.map(function (info) {
return tslib_1.__assign(tslib_1.__assign({}, info), { tolerable: true });
}) });

@@ -162,0 +162,0 @@ }

@@ -195,3 +195,3 @@ "use strict";

if (!storeObject || !apollo_utilities_1.isEqual(storeValue, storeObject[storeFieldName])) {
store.set(dataId, tslib_1.__assign({}, storeObject, (_b = {}, _b[storeFieldName] = storeValue, _b)));
store.set(dataId, tslib_1.__assign(tslib_1.__assign({}, storeObject), (_b = {}, _b[storeFieldName] = storeValue, _b)));
}

@@ -253,3 +253,3 @@ };

cache.delete(generatedKey);
var newRealValue = tslib_1.__assign({}, generated, real);
var newRealValue = tslib_1.__assign(tslib_1.__assign({}, generated), real);
if (apollo_utilities_1.isEqual(newRealValue, real)) {

@@ -256,0 +256,0 @@ return madeChanges;

{
"name": "apollo-cache-inmemory",
"version": "1.6.3",
"version": "1.6.5",
"description": "Core abstract of Caching layer for Apollo Client",

@@ -42,7 +42,7 @@ "author": "James Baxley <james@meteor.com>",

"dependencies": {
"apollo-cache": "^1.3.2",
"apollo-utilities": "^1.3.2",
"apollo-cache": "^1.3.4",
"apollo-utilities": "^1.3.3",
"optimism": "^0.10.0",
"ts-invariant": "^0.4.0",
"tslib": "^1.9.3"
"tslib": "^1.10.0"
},

@@ -52,3 +52,3 @@ "peerDependencies": {

},
"gitHead": "d28dea2370e292f18979f25fe15258a59e159b4d"
"gitHead": "68fa57751ce201ba6b72efdbf8fdda1729c991cc"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc