apollo-client
Advanced tools
Comparing version 2.5.0-rc.0 to 2.5.0-rc.1
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("apollo-utilities"),o=require("apollo-link"),n=e(require("symbol-observable")),i=require("ts-invariant"),s=require("apollo-link-dedup"),a=require("graphql/language/printer"),u=require("graphql/language/visitor");function c(e){return e<7}!function(e){e[e.loading=1]="loading",e[e.setVariables=2]="setVariables",e[e.fetchMore=3]="fetchMore",e[e.refetch=4]="refetch",e[e.poll=6]="poll",e[e.ready=7]="ready",e[e.error=8]="error"}(exports.NetworkStatus||(exports.NetworkStatus={}));var l=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r.prototype[n]=function(){return this},r.prototype["@@observable"]=function(){return this},r}(o.Observable);function h(e){return e.hasOwnProperty("graphQLErrors")}var p=function(e){var t="";return Array.isArray(e.graphQLErrors)&&0!==e.graphQLErrors.length&&e.graphQLErrors.forEach(function(e){var r=e?e.message:"Error message not found.";t+="GraphQL error: "+r+"\n"}),e.networkError&&(t+="Network error: "+e.networkError.message+"\n"),t=t.replace(/\n$/,"")},y=function(e){function r(t){var o=t.graphQLErrors,n=t.networkError,i=t.errorMessage,s=t.extraInfo,a=e.call(this,i)||this;return a.graphQLErrors=o||[],a.networkError=n||null,a.message=i||p(a),a.extraInfo=s,a.__proto__=r.prototype,a}return t.__extends(r,e),r}(Error);!function(e){e[e.normal=1]="normal",e[e.refetch=2]="refetch",e[e.poll=3]="poll"}(exports.FetchType||(exports.FetchType={}));var f=function(e,t){return void 0===t&&(t="none"),e&&(e.graphQLErrors&&e.graphQLErrors.length>0&&"none"===t||e.networkError)},d=function(e){function o(t){var r=t.queryManager,o=t.options,n=t.shouldSubscribe,i=void 0===n||n,s=e.call(this,function(e){return s.onSubscribe(e)})||this;return s.isTornDown=!1,s.options=o,s.variables=o.variables||{},s.queryId=r.generateQueryId(),s.shouldSubscribe=i,s.queryManager=r,s.observers=[],s.subscriptionHandles=[],s}return t.__extends(o,e),o.prototype.result=function(){var e=this;return new Promise(function(t,r){var o,n={next:function(r){t(r),e.observers.some(function(e){return e!==n})||e.queryManager.removeQuery(e.queryId),setTimeout(function(){o.unsubscribe()},0)},error:function(e){r(e)}};o=e.subscribe(n)})},o.prototype.currentResult=function(){var e=this.getCurrentResult();return void 0===e.data&&(e.data={}),e},o.prototype.getCurrentResult=function(){if(this.isTornDown)return{data:this.lastError?void 0:this.lastResult?this.lastResult.data:void 0,error:this.lastError,loading:!1,networkStatus:exports.NetworkStatus.error};var e=this.queryManager.queryStore.get(this.queryId);if(f(e,this.options.errorPolicy))return{data:void 0,loading:!1,networkStatus:e.networkStatus,error:new y({graphQLErrors:e.graphQLErrors,networkError:e.networkError})};e&&e.variables&&(this.options.variables=Object.assign({},this.options.variables,e.variables));var o,n=this.queryManager.getCurrentQueryResult(this),i=n.data,s=n.partial,a=!e||e.networkStatus===exports.NetworkStatus.loading,u="network-only"===this.options.fetchPolicy&&a||s&&"cache-only"!==this.options.fetchPolicy,l={data:i,loading:c(o=e?e.networkStatus:u?exports.NetworkStatus.loading:exports.NetworkStatus.ready),networkStatus:o};return e&&e.graphQLErrors&&"all"===this.options.errorPolicy&&(l.errors=e.graphQLErrors),s||(this.lastResult=t.__assign({},l,{stale:!1}),this.lastResultSnapshot=r.cloneDeep(this.lastResult)),t.__assign({},l,{partial:s})},o.prototype.isDifferentFromLastResult=function(e){var t=this.lastResultSnapshot;return!(t&&e&&t.networkStatus===e.networkStatus&&t.stale===e.stale&&r.isEqual(t.data,e.data))},o.prototype.getLastResult=function(){return this.lastResult},o.prototype.getLastError=function(){return this.lastError},o.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},o.prototype.refetch=function(e){var o=this.options.fetchPolicy;if("cache-only"===o)return Promise.reject(new Error("cache-only fetchPolicy option should not be used together with query refetch."));r.isEqual(this.variables,e)||(this.variables=Object.assign({},this.variables,e)),r.isEqual(this.options.variables,this.variables)||(this.options.variables=Object.assign({},this.options.variables,this.variables));var n="network-only"===o||"no-cache"===o,i=t.__assign({},this.options,{fetchPolicy:n?o:"network-only"});return this.queryManager.fetchQuery(this.queryId,i,exports.FetchType.refetch).then(function(e){return e})},o.prototype.fetchMore=function(e){var r,o=this;return i.invariant(e.updateQuery),Promise.resolve().then(function(){var n=o.queryManager.generateQueryId();return(r=e.query?e:t.__assign({},o.options,e,{variables:Object.assign({},o.variables,e.variables)})).fetchPolicy="network-only",o.queryManager.fetchQuery(n,r,exports.FetchType.normal,o.queryId)}).then(function(t){return o.updateQuery(function(o){return e.updateQuery(o,{fetchMoreResult:t.data,variables:r.variables})}),t})},o.prototype.subscribeToMore=function(e){var t=this,r=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables}).subscribe({next:function(r){e.updateQuery&&t.updateQuery(function(t,o){var n=o.variables;return e.updateQuery(t,{subscriptionData:r,variables:n})})},error:function(t){e.onError?e.onError(t):console.error("Unhandled GraphQL subscription error",t)}});return this.subscriptionHandles.push(r),function(){var e=t.subscriptionHandles.indexOf(r);e>=0&&(t.subscriptionHandles.splice(e,1),r.unsubscribe())}},o.prototype.setOptions=function(e){var t=this.options;this.options=Object.assign({},this.options,e),e.pollInterval?this.startPolling(e.pollInterval):0===e.pollInterval&&this.stopPolling();var r="network-only"!==t.fetchPolicy&&"network-only"===e.fetchPolicy||"cache-only"===t.fetchPolicy&&"cache-only"!==e.fetchPolicy||"standby"===t.fetchPolicy&&"standby"!==e.fetchPolicy||!1;return this.setVariables(this.options.variables,r,e.fetchResults)},o.prototype.setVariables=function(e,o,n){void 0===o&&(o=!1),void 0===n&&(n=!0),this.isTornDown=!1;var i=e||this.variables;return r.isEqual(i,this.variables)&&!o?0!==this.observers.length&&n?this.result():new Promise(function(e){return e()}):(this.variables=i,this.options.variables=i,0===this.observers.length?new Promise(function(e){return e()}):this.queryManager.fetchQuery(this.queryId,t.__assign({},this.options,{variables:this.variables})).then(function(e){return e}))},o.prototype.updateQuery=function(e){var t=this.queryManager.getQueryWithPreviousResult(this.queryId),o=t.previousResult,n=t.variables,i=t.document,s=r.tryFunctionOrLogError(function(){return e(o,{variables:n})});s&&(this.queryManager.dataStore.markUpdateQueryResult(i,n,s),this.queryManager.broadcastQueries())},o.prototype.stopPolling=function(){this.queryManager.stopPollingQuery(this.queryId),this.options.pollInterval=void 0},o.prototype.startPolling=function(e){v(this),this.options.pollInterval=e,this.queryManager.startPollingQuery(this.options,this.queryId)},o.prototype.onSubscribe=function(e){var t=this;return e._subscription&&e._subscription._observer&&!e._subscription._observer.error&&(e._subscription._observer.error=function(e){console.error("Unhandled error",e.message,e.stack)}),this.observers.push(e),e.next&&this.lastResult&&e.next(this.lastResult),e.error&&this.lastError&&e.error(this.lastError),1===this.observers.length&&this.setUpQuery(),function(){t.observers=t.observers.filter(function(t){return t!==e}),0===t.observers.length&&t.tearDownQuery()}},o.prototype.setUpQuery=function(){var e=this;this.shouldSubscribe&&this.queryManager.addObservableQuery(this.queryId,this),this.options.pollInterval&&(v(this),this.queryManager.startPollingQuery(this.options,this.queryId));var t={next:function(t){e.lastResult=t,e.lastResultSnapshot=r.cloneDeep(t),e.observers.forEach(function(e){return e.next&&e.next(t)})},error:function(t){e.lastError=t,e.observers.forEach(function(e){return e.error&&e.error(t)})}};this.queryManager.startQuery(this.queryId,this.options,this.queryManager.queryListenerForObserver(this.queryId,this.options,t))},o.prototype.tearDownQuery=function(){this.isTornDown=!0,this.queryManager.stopPollingQuery(this.queryId),this.subscriptionHandles.forEach(function(e){return e.unsubscribe()}),this.subscriptionHandles=[],this.queryManager.removeObservableQuery(this.queryId),this.queryManager.stopQuery(this.queryId),this.observers=[]},o}(l);function v(e){var t=e.options.fetchPolicy;i.invariant("cache-first"!==t&&"cache-only"!==t)}var b=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initMutation=function(e,t,r){this.store[e]={mutation:t,variables:r||{},loading:!0,error:null}},e.prototype.markMutationError=function(e,t){var r=this.store[e];r&&(r.loading=!1,r.error=t)},e.prototype.markMutationResult=function(e){var t=this.store[e];t&&(t.loading=!1,t.error=null)},e.prototype.reset=function(){this.store={}},e}(),g=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initQuery=function(e){var t=this.store[e.queryId];if(t&&t.document!==e.document&&!r.isEqual(t.document,e.document))throw new i.InvariantError;var o,n=!1,s=null;e.storePreviousVariables&&t&&t.networkStatus!==exports.NetworkStatus.loading&&(r.isEqual(t.variables,e.variables)||(n=!0,s=t.variables)),o=n?exports.NetworkStatus.setVariables:e.isPoll?exports.NetworkStatus.poll:e.isRefetch?exports.NetworkStatus.refetch:exports.NetworkStatus.loading;var a=[];t&&t.graphQLErrors&&(a=t.graphQLErrors),this.store[e.queryId]={document:e.document,variables:e.variables,previousVariables:s,networkError:null,graphQLErrors:a,networkStatus:o,metadata:e.metadata},"string"==typeof e.fetchMoreForQueryId&&this.store[e.fetchMoreForQueryId]&&(this.store[e.fetchMoreForQueryId].networkStatus=exports.NetworkStatus.fetchMore)},e.prototype.markQueryResult=function(e,t,r){this.store&&this.store[e]&&(this.store[e].networkError=null,this.store[e].graphQLErrors=t.errors&&t.errors.length?t.errors:[],this.store[e].previousVariables=null,this.store[e].networkStatus=exports.NetworkStatus.ready,"string"==typeof r&&this.store[r]&&(this.store[r].networkStatus=exports.NetworkStatus.ready))},e.prototype.markQueryError=function(e,t,r){this.store&&this.store[e]&&(this.store[e].networkError=t,this.store[e].networkStatus=exports.NetworkStatus.error,"string"==typeof r&&this.markQueryResultClient(r,!0))},e.prototype.markQueryResultClient=function(e,t){this.store&&this.store[e]&&(this.store[e].networkError=null,this.store[e].previousVariables=null,this.store[e].networkStatus=t?exports.NetworkStatus.ready:exports.NetworkStatus.loading)},e.prototype.stopQuery=function(e){delete this.store[e]},e.prototype.reset=function(e){var r=this;this.store=Object.keys(this.store).filter(function(t){return e.indexOf(t)>-1}).reduce(function(e,o){return e[o]=t.__assign({},r.store[o],{networkStatus:exports.NetworkStatus.loading}),e},{})},e}();function m(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Q=function(){function e(e){var t=e.cache,r=e.client,o=e.resolvers,n=e.typeDefs,i=e.fragmentMatcher;this.resolvers={},this.cache=t,r&&(this.client=r),o&&this.addResolvers(o),n&&this.setTypeDefs(n),i&&this.setFragmentMatcher(i)}return e.prototype.addResolvers=function(e){var t=this;Array.isArray(e)?e.forEach(function(e){t.resolvers=r.mergeDeep(t.resolvers,e)}):this.resolvers=r.mergeDeep(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers},e.prototype.runResolvers=function(e){var o=e.document,n=e.remoteResult,i=e.context,s=e.variables,a=e.onlyRunForcedResolvers,u=void 0!==a&&a;return t.__awaiter(this,void 0,void 0,function(){var e,a;return t.__generator(this,function(c){return o?(e=[],(a=this.buildRootValueFromCache(o,s))&&e.push(a),n.data&&e.push(n.data),[2,this.resolveDocument(o,r.mergeDeepArray(e),i,s,this.fragmentMatcher,u).then(function(e){return t.__assign({},n,{data:e.result})})]):[2,n]})})},e.prototype.setTypeDefs=function(e){this.typeDefs=e},e.prototype.getTypeDefs=function(){return this.typeDefs},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){return r.hasDirectives(["client"],e)?e:null},e.prototype.serverQuery=function(e){return r.removeClientSetsFromDocument(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var r=this.cache,o=[];if(this.typeDefs){var n=this.normalizeTypeDefs(this.typeDefs);o.push({definition:n,directives:"directive @client on FIELD"})}return t.__assign({},e,{cache:r,getCacheKey:function(e){if(r.config)return r.config.dataIdFromObject(e);i.invariant(!1)},schemas:o})},e.prototype.addExportedVariables=function(e,r,o){return void 0===r&&(r={}),void 0===o&&(o={}),t.__awaiter(this,void 0,void 0,function(){return t.__generator(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(o),r).then(function(e){return t.__assign({},r,e.exportedVariables)})]:[2,t.__assign({},r)]})})},e.prototype.shouldForceResolvers=function(e){var t=!1;return u.visit(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some(function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value})))return u.BREAK}}}),t},e.prototype.shouldForceResolver=function(e){return this.shouldForceResolvers(e)},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:r.buildQueryFromSelectionSet(e),variables:t,optimistic:!1}).result},e.prototype.normalizeTypeDefs=function(e){return(Array.isArray(e)?e:[e]).map(function(e){return"string"==typeof e?e:a.print(e)}).map(function(e){return e.trim()}).join("\n")},e.prototype.resolveDocument=function(e,o,n,i,s,a){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===s&&(s=function(){return!0}),void 0===a&&(a=!1),t.__awaiter(this,void 0,void 0,function(){var u,c,l,h,p,y,f,d,v;return t.__generator(this,function(b){return u=r.getMainDefinition(e),c=r.getFragmentDefinitions(e),l=r.createFragmentMap(c),h=u.operation,p=h?m(h):"Query",f=(y=this).cache,d=y.client,v={fragmentMap:l,context:t.__assign({},n,{cache:f,client:d}),variables:i,fragmentMatcher:s,defaultOperationType:p,exportedVariables:{},onlyRunForcedResolvers:a},[2,this.resolveSelectionSet(u.selectionSet,o,v).then(function(e){return{result:e,exportedVariables:v.exportedVariables}})]})})},e.prototype.resolveSelectionSet=function(e,o,n){return t.__awaiter(this,void 0,void 0,function(){var s,a,u,c,l,h=this;return t.__generator(this,function(p){return s=n.fragmentMap,a=n.context,u=n.variables,c=[o],l=function(e){return t.__awaiter(h,void 0,void 0,function(){var l,h;return t.__generator(this,function(t){return r.shouldInclude(e,u)?r.isField(e)?[2,this.resolveField(e,o,n).then(function(t){var o;void 0!==t&&c.push(((o={})[r.resultKeyNameFromField(e)]=t,o))})]:(r.isInlineFragment(e)?l=e:(l=s[e.name.value],i.invariant(l)),l&&l.typeCondition&&(h=l.typeCondition.name.value,n.fragmentMatcher(o,h,a))?[2,this.resolveSelectionSet(l.selectionSet,o,n).then(function(e){c.push(e)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(l)).then(function(){return r.mergeDeepArray(c)})]})})},e.prototype.resolveField=function(e,o,n){return t.__awaiter(this,void 0,void 0,function(){var i,s,a,u,c,l,h,p,y,f=this;return t.__generator(this,function(t){return i=n.variables,s=e.name.value,a=r.resultKeyNameFromField(e),u=s!==a,c=o[a]||o[s],l=Promise.resolve(c),n.onlyRunForcedResolvers&&!this.shouldForceResolver(e)||(h=o.__typename||n.defaultOperationType,(p=this.resolvers[h])&&(y=p[u?s:a])&&(l=Promise.resolve(y(o,r.argumentsObjectFromField(e,i),n.context,{field:e})))),[2,l.then(function(t){return void 0===t&&(t=c),e.directives&&e.directives.forEach(function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach(function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(n.exportedVariables[e.value.value]=t)})}),e.selectionSet?null==t?t:Array.isArray(t)?f.resolveSubSelectedArray(e,t,n):e.selectionSet?f.resolveSelectionSet(e.selectionSet,t,n):void 0:t})]})})},e.prototype.resolveSubSelectedArray=function(e,t,r){var o=this;return Promise.all(t.map(function(t){return null===t?null:Array.isArray(t)?o.resolveSubSelectedArray(e,t,r):e.selectionSet?o.resolveSelectionSet(e.selectionSet,t,r):void 0}))},e}(),w=function(){function e(e){var t=e.link,r=e.queryDeduplication,n=void 0!==r&&r,i=e.store,a=e.onBroadcast,u=void 0===a?function(){}:a,c=e.ssrMode,l=void 0!==c&&c,h=e.clientAwareness,p=void 0===h?{}:h,y=e.localState;this.mutationStore=new b,this.queryStore=new g,this.clientAwareness={},this.idCounter=1,this.queries=new Map,this.fetchQueryRejectFns=new Map,this.queryIdsByName={},this.pollingInfoByQueryId=new Map,this.nextPoll=null,this.link=t,this.deduplicator=o.ApolloLink.from([new s.DedupLink,t]),this.queryDeduplication=n,this.dataStore=i,this.onBroadcast=u,this.clientAwareness=p,this.localState=y||new Q({cache:i.getCache()}),this.ssrMode=l}return e.prototype.stop=function(){var e=this;this.queries.forEach(function(t,r){e.stopQueryNoBroadcast(r)}),this.fetchQueryRejectFns.forEach(function(e){e(new Error("QueryManager stopped while query was in flight"))})},e.prototype.mutate=function(e){var n=e.mutation,s=e.variables,a=e.optimisticResponse,u=e.updateQueries,c=e.refetchQueries,h=void 0===c?[]:c,p=e.awaitRefetchQueries,f=void 0!==p&&p,d=e.update,v=e.errorPolicy,b=void 0===v?"none":v,g=e.fetchPolicy,m=e.context,Q=void 0===m?{}:m;return t.__awaiter(this,void 0,void 0,function(){var e,c,p,v,m,w=this;return t.__generator(this,function(S){switch(S.label){case 0:return i.invariant(n),i.invariant(!g||"no-cache"===g),e=this.generateQueryId(),c=this.dataStore.getCache(),n=c.transformDocument(n),s=r.assign({},r.getDefaultValues(r.getMutationDefinition(n)),s),this.setQuery(e,function(){return{document:n}}),p=function(){var e={};return u&&Object.keys(u).forEach(function(t){return(w.queryIdsByName[t]||[]).forEach(function(r){e[r]={updater:u[t],query:w.queryStore.get(r)}})}),e},r.hasClientExports(n)?[4,this.localState.addExportedVariables(n,s,Q)]:[3,2];case 1:return m=S.sent(),[3,3];case 2:m=s,S.label=3;case 3:return v=m,this.mutationStore.initMutation(e,n,v),this.dataStore.markMutationInit({mutationId:e,document:n,variables:v||{},updateQueries:p(),update:d,optimisticResponse:a}),this.broadcastQueries(),[2,new Promise(function(i,s){var u,c,m=w.buildOperationForLink(n,v,t.__assign({},Q,{optimisticResponse:a})),S=function(){if(c&&w.mutationStore.markMutationError(e,c),w.dataStore.markMutationComplete({mutationId:e,optimisticResponse:a}),w.broadcastQueries(),c)return Promise.reject(c);"function"==typeof h&&(h=h(u));for(var t=[],o=0,n=h;o<n.length;o++){var i=n[o];if("string"!=typeof i){var s={query:i.query,variables:i.variables,fetchPolicy:"network-only"};i.context&&(s.context=i.context),t.push(w.query(s))}else{var l=w.refetchQueryByName(i);l&&t.push(l)}}return Promise.all(f?t:[]).then(function(){return w.setQuery(e,function(){return{document:null}}),"ignore"===b&&u&&r.graphQLResultHasError(u)&&delete u.errors,u})},q=w.localState.clientQuery(m.query),k=w.localState.serverQuery(m.query);k&&(m.query=k);var R=k?o.execute(w.link,m):l.of({data:{}}),_=w,E=!1,x=!1;R.subscribe({next:function(o){return t.__awaiter(w,void 0,void 0,function(){var a,l,h;return t.__generator(this,function(t){switch(t.label){case 0:return x=!0,r.graphQLResultHasError(o)&&"none"===b?(x=!1,c=new y({graphQLErrors:o.errors}),[2]):(_.mutationStore.markMutationResult(e),a=o,l=m.context,h=m.variables,q&&r.hasDirectives(["client"],q)?[4,_.localState.runResolvers({document:q,remoteResult:o,context:l,variables:h}).catch(function(e){return x=!1,s(e),o})]:[3,2]);case 1:a=t.sent(),t.label=2;case 2:return"no-cache"!==g&&_.dataStore.markMutationResult({mutationId:e,result:a,document:n,variables:v||{},updateQueries:p(),update:d}),u=a,x=!1,E&&S().then(i,s),[2]}})})},error:function(t){_.mutationStore.markMutationError(e,t),_.dataStore.markMutationComplete({mutationId:e,optimisticResponse:a}),_.broadcastQueries(),_.setQuery(e,function(){return{document:null}}),s(new y({networkError:t}))},complete:function(){x||S().then(i,s),E=!0}})})]}})})},e.prototype.fetchQuery=function(e,o,n,i){return t.__awaiter(this,void 0,void 0,function(){var s,a,u,c,l,p,f,d,v,b,g,m,Q,w,S,q,k,R,_,E,x,M,P=this;return t.__generator(this,function(I){switch(I.label){case 0:return s=o.variables,a=void 0===s?{}:s,u=o.metadata,c=void 0===u?null:u,l=o.fetchPolicy,p=void 0===l?"cache-first":l,f=o.context,d=void 0===f?{}:f,v=this.dataStore.getCache(),b=v.transformDocument(o.query),r.hasClientExports(b)?[4,this.localState.addExportedVariables(b,a,d)]:[3,2];case 1:return m=I.sent(),[3,3];case 2:m=a,I.label=3;case 3:if(g=m,Q=t.__assign({},o,{variables:g}),S="network-only"===p||"no-cache"===p,n!==exports.FetchType.refetch&&"network-only"!==p&&"no-cache"!==p&&(q=this.dataStore.getCache().diff({query:b,variables:g,returnPartialData:!0,optimistic:!1}),k=q.complete,R=q.result,S=!k||"cache-and-network"===p,w=R),_=S&&"cache-only"!==p&&"standby"!==p,r.hasDirectives(["live"],b)&&(_=!0),E=this.generateRequestId(),x=this.updateQueryWatch(e,b,Q),this.setQuery(e,function(){return{document:b,lastRequestId:E,invalidated:!0,cancel:x}}),this.invalidate(!0,i),this.queryStore.initQuery({queryId:e,document:b,storePreviousVariables:_,variables:g,isPoll:n===exports.FetchType.poll,isRefetch:n===exports.FetchType.refetch,metadata:c,fetchMoreForQueryId:i}),this.broadcastQueries(),(!_||"cache-and-network"===p)&&(this.queryStore.markQueryResultClient(e,!_),this.invalidate(!0,e,i),this.broadcastQueries(this.localState.shouldForceResolvers(b))),_){if(M=this.fetchRequest({requestId:E,queryId:e,document:b,options:Q,fetchMoreForQueryId:i}).catch(function(t){if(h(t))throw t;var r=P.getQuery(e).lastRequestId;throw E>=(r||1)&&(P.queryStore.markQueryError(e,t,i),P.invalidate(!0,e,i),P.broadcastQueries()),new y({networkError:t})}),"cache-and-network"!==p)return[2,M];M.catch(function(){})}return[2,Promise.resolve({data:w})]}})})},e.prototype.queryListenerForObserver=function(e,r,o){var n=this,i=!1;return function(s,a,u){return t.__awaiter(n,void 0,void 0,function(){var n,l,h,p,f,d,v,b,g,m,Q,w,S,q,k,R,_,E,x,M;return t.__generator(this,function(P){switch(P.label){case 0:if(this.invalidate(!1,e),!s)return[2];if(n=this.getQuery(e).observableQuery,"standby"===(l=n?n.options.fetchPolicy:r.fetchPolicy))return[2];if(h=n?n.options.errorPolicy:r.errorPolicy,p=n?n.getLastResult():null,f=n?n.getLastError():null,d=!a&&null!=s.previousVariables||"cache-only"===l||"cache-and-network"===l,v=Boolean(p&&s.networkStatus!==p.networkStatus),b=h&&(f&&f.graphQLErrors)!==s.graphQLErrors&&"none"!==h,!(!c(s.networkStatus)||v&&r.notifyOnNetworkStatusChange||d))return[3,8];if((!h||"none"===h)&&s.graphQLErrors&&s.graphQLErrors.length>0||s.networkError){if(g=new y({graphQLErrors:s.graphQLErrors,networkError:s.networkError}),i=!0,o.error)try{o.error(g)}catch(e){setTimeout(function(){throw e},0)}else setTimeout(function(){throw g},0);return[2]}P.label=1;case 1:if(P.trys.push([1,7,,8]),m=void 0,Q=void 0,a?("no-cache"!==l&&"network-only"!==l&&this.setQuery(e,function(){return{newData:null}}),m=a.result,Q=!a.complete||!1):p&&p.data&&!b?(m=p.data,Q=!1):(w=this.getQuery(e).document,S=this.dataStore.getCache().diff({query:w,variables:s.previousVariables||s.variables,optimistic:!0}),m=S.result,Q=!S.complete),q=void 0,q=Q&&"cache-only"!==l?{data:p&&p.data,loading:c(s.networkStatus),networkStatus:s.networkStatus,stale:!0}:{data:m,loading:c(s.networkStatus),networkStatus:s.networkStatus,stale:!1},"all"===h&&s.graphQLErrors&&s.graphQLErrors.length>0&&(q.errors=s.graphQLErrors),!o.next)return[3,6];if(!i&&n&&!n.isDifferentFromLastResult(q))return[3,6];P.label=2;case 2:return P.trys.push([2,5,,6]),u?(k=r.query,R=r.variables,_=r.context,[4,this.localState.runResolvers({document:k,remoteResult:q,context:_,variables:R,onlyRunForcedResolvers:u})]):[3,4];case 3:E=P.sent(),q=t.__assign({},q,E),P.label=4;case 4:return o.next(q),[3,6];case 5:return x=P.sent(),setTimeout(function(){throw x},0),[3,6];case 6:return i=!1,[3,8];case 7:return M=P.sent(),i=!0,o.error&&o.error(new y({networkError:M})),[2];case 8:return[2]}})})}},e.prototype.watchQuery=function(e,o){void 0===o&&(o=!0),i.invariant("standby"!==e.fetchPolicy);var n=r.getQueryDefinition(e.query);if(n.variableDefinitions&&n.variableDefinitions.length){var s=r.getDefaultValues(n);e.variables=r.assign({},s,e.variables)}void 0===e.notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var a=t.__assign({},e);return new d({queryManager:this,options:a,shouldSubscribe:o})},e.prototype.query=function(e){var t=this;return i.invariant(e.query),i.invariant("Document"===e.query.kind),i.invariant(!e.returnPartialData),i.invariant(!e.pollInterval),new Promise(function(r,o){var n=t.watchQuery(e,!1);t.fetchQueryRejectFns.set("query:"+n.queryId,o),n.result().then(r,o).then(function(){return t.fetchQueryRejectFns.delete("query:"+n.queryId)})})},e.prototype.generateQueryId=function(){var e=this.idCounter.toString();return this.idCounter++,e},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){this.stopPollingQuery(e),this.queryStore.stopQuery(e),this.invalidate(!0,e)},e.prototype.addQueryListener=function(e,t){this.setQuery(e,function(e){var r=e.listeners;return{listeners:(void 0===r?[]:r).concat([t]),invalidated:!1}})},e.prototype.updateQueryWatch=function(e,t,r){var o=this,n=this.getQuery(e).cancel;n&&n();return this.dataStore.getCache().watch({query:t,variables:r.variables,optimistic:!0,previousResult:function(){var t=null,r=o.getQuery(e).observableQuery;if(r){var n=r.getLastResult();n&&(t=n.data)}return t},callback:function(t){o.setQuery(e,function(){return{invalidated:!0,newData:t}})}})},e.prototype.addObservableQuery=function(e,t){this.setQuery(e,function(){return{observableQuery:t}});var o=r.getQueryDefinition(t.options.query);if(o.name&&o.name.value){var n=o.name.value;this.queryIdsByName[n]=this.queryIdsByName[n]||[],this.queryIdsByName[n].push(t.queryId)}},e.prototype.removeObservableQuery=function(e){var t=this.getQuery(e),o=t.observableQuery,n=t.cancel;if(n&&n(),o){var i=r.getQueryDefinition(o.options.query),s=i.name?i.name.value:null;this.setQuery(e,function(){return{observableQuery:null}}),s&&(this.queryIdsByName[s]=this.queryIdsByName[s].filter(function(e){return!(o.queryId===e)}))}},e.prototype.clearStore=function(){this.fetchQueryRejectFns.forEach(function(e){e(new Error("Store reset while query was in flight(not completed in link chain)"))});var e=[];return this.queries.forEach(function(t,r){t.observableQuery&&e.push(r)}),this.queryStore.reset(e),this.mutationStore.reset(),this.dataStore.reset()},e.prototype.resetStore=function(){var e=this;return this.clearStore().then(function(){return e.reFetchObservableQueries()})},e.prototype.reFetchObservableQueries=function(e){var t=this.getObservableQueryPromises(e);return this.broadcastQueries(),Promise.all(t)},e.prototype.startQuery=function(e,t,r){return this.addQueryListener(e,r),this.fetchQuery(e,t).catch(function(){}),e},e.prototype.startGraphQLSubscription=function(e){var n,i=this,s=e.query,a=!(e.fetchPolicy&&"no-cache"===e.fetchPolicy),u=this.dataStore.getCache().transformDocument(s),c=r.assign({},r.getDefaultValues(r.getOperationDefinition(s)),e.variables),h=c,p=[],f=this.localState.clientQuery(u);return new l(function(e){if(p.push(e),1===p.length){var s=0,d=!1,v={next:function(e){return t.__awaiter(i,void 0,void 0,function(){var o;return t.__generator(this,function(t){switch(t.label){case 0:return s+=1,o=e,f&&r.hasDirectives(["client"],f)?[4,this.localState.runResolvers({document:f,remoteResult:e,context:{},variables:h})]:[3,2];case 1:o=t.sent(),t.label=2;case 2:return a&&(this.dataStore.markSubscriptionResult(o,u,h),this.broadcastQueries()),p.forEach(function(e){r.graphQLResultHasError(o)&&e.error?e.error(new y({graphQLErrors:o.errors})):e.next&&e.next(o),s-=1}),0===s&&d&&v.complete(),[2]}})})},error:function(e){p.forEach(function(t){t.error&&t.error(e)})},complete:function(){0===s&&p.forEach(function(e){e.complete&&e.complete()}),d=!0}};t.__awaiter(i,void 0,void 0,function(){var e,i,s,a;return t.__generator(this,function(t){switch(t.label){case 0:return r.hasClientExports(u)?[4,this.localState.addExportedVariables(u,c)]:[3,2];case 1:return i=t.sent(),[3,3];case 2:i=c,t.label=3;case 3:return e=i,(s=this.localState.serverQuery(u))?(a=this.buildOperationForLink(s,e),n=o.execute(this.link,a).subscribe(v)):n=l.of({data:{}}).subscribe(v),[2]}})})}return function(){0===(p=p.filter(function(t){return t!==e})).length&&n&&n.unsubscribe()}})},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){var t=this.getQuery(e).subscriptions;this.fetchQueryRejectFns.delete("query:"+e),this.fetchQueryRejectFns.delete("fetchRequest:"+e),t.forEach(function(e){return e.unsubscribe()}),this.queries.delete(e)},e.prototype.getCurrentQueryResult=function(e,t){void 0===t&&(t=!0);var r=e.options,o=r.variables,n=r.query,i=r.fetchPolicy,s=e.getLastResult(),a=this.getQuery(e.queryId).newData;if(a&&a.complete)return{data:a.result,partial:!1};if("no-cache"===i||"network-only"===i)return{data:void 0,partial:!1};try{return{data:this.dataStore.getCache().read({query:n,variables:o,previousResult:s?s.data:void 0,optimistic:t})||void 0,partial:!1}}catch(e){return{data:void 0,partial:!0}}},e.prototype.getQueryWithPreviousResult=function(e){var t;if("string"==typeof e){var r=this.getQuery(e).observableQuery;i.invariant(r),t=r}else t=e;var o=t.options,n=o.variables,s=o.query;return{previousResult:this.getCurrentQueryResult(t,!1).data,variables:n,document:s}},e.prototype.broadcastQueries=function(e){var t=this;void 0===e&&(e=!1),this.onBroadcast(),this.queries.forEach(function(r,o){r.invalidated&&r.listeners&&r.listeners.filter(function(e){return!!e}).forEach(function(n){n(t.queryStore.get(o),r.newData,e)})})},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableQueryPromises=function(e){var t=this,r=[];return this.queries.forEach(function(o,n){var i=o.observableQuery;if(i){var s=i.options.fetchPolicy;i.resetLastResults(),"cache-only"===s||!e&&"standby"===s||r.push(i.refetch()),t.setQuery(n,function(){return{newData:null}}),t.invalidate(!0,n)}}),r},e.prototype.fetchRequest=function(e){var n,i,s=this,a=e.requestId,u=e.queryId,c=e.document,h=e.options,p=e.fetchMoreForQueryId,f=h.variables,d=h.context,v=h.errorPolicy,b=void 0===v?"none":v,g=h.fetchPolicy;return new Promise(function(e,h){var v,m={},Q=s.localState.clientQuery(c),w=s.localState.serverQuery(c);if(w){var S=s.buildOperationForLink(w,f,t.__assign({},d,{forceFetch:!s.queryDeduplication}));m=S.context,v=o.execute(s.deduplicator,S)}else m=s.prepareContext(d),v=l.of({data:{}});s.fetchQueryRejectFns.set("fetchRequest:"+u,h);var q=!1,k=!0,R={next:function(e){return t.__awaiter(s,void 0,void 0,function(){var o,s;return t.__generator(this,function(t){switch(t.label){case 0:return k=!0,o=e,s=this.getQuery(u).lastRequestId,a>=(s||1)?Q&&r.hasDirectives(["client"],Q)?[4,this.localState.runResolvers({document:Q,remoteResult:e,context:m,variables:f}).catch(function(t){return k=!1,h(t),e})]:[3,2]:[3,3];case 1:o=t.sent(),t.label=2;case 2:if("no-cache"!==g)try{this.dataStore.markQueryResult(o,c,f,p,"ignore"===b||"all"===b)}catch(e){return k=!1,h(e),[2]}else this.setQuery(u,function(){return{newData:{result:o.data,complete:!0}}});this.queryStore.markQueryResult(u,o,p),this.invalidate(!0,u,p),this.broadcastQueries(),t.label=3;case 3:if(o.errors&&"none"===b)return k=!1,h(new y({graphQLErrors:o.errors})),[2];if("all"===b&&(i=o.errors),p||"no-cache"===g)n=o.data;else try{n=this.dataStore.getCache().read({variables:f,query:c,optimistic:!1})}catch(e){}return k=!1,q&&R.complete(),[2]}})})},error:function(e){s.fetchQueryRejectFns.delete("fetchRequest:"+u),s.setQuery(u,function(e){return{subscriptions:e.subscriptions.filter(function(e){return e!==_})}}),h(e)},complete:function(){k||(s.fetchQueryRejectFns.delete("fetchRequest:"+u),s.setQuery(u,function(e){return{subscriptions:e.subscriptions.filter(function(e){return e!==_})}}),e({data:n,errors:i,loading:!1,networkStatus:exports.NetworkStatus.ready,stale:!1})),q=!0}},_=v.subscribe(R);s.setQuery(u,function(e){return{subscriptions:e.subscriptions.concat([_])}})}).catch(function(e){throw s.fetchQueryRejectFns.delete("fetchRequest:"+u),e})},e.prototype.refetchQueryByName=function(e){var t=this,r=this.queryIdsByName[e];if(void 0!==r)return Promise.all(r.map(function(e){return t.getQuery(e).observableQuery}).filter(function(e){return!!e}).map(function(e){return e.refetch()}))},e.prototype.generateRequestId=function(){var e=this.idCounter;return this.idCounter++,e},e.prototype.getQuery=function(e){return this.queries.get(e)||{listeners:[],invalidated:!1,document:null,newData:null,lastRequestId:null,observableQuery:null,subscriptions:[]}},e.prototype.setQuery=function(e,r){var o=this.getQuery(e),n=t.__assign({},o,r(o));this.queries.set(e,n)},e.prototype.invalidate=function(e,t,r){t&&this.setQuery(t,function(){return{invalidated:e}}),r&&this.setQuery(r,function(){return{invalidated:e}})},e.prototype.buildOperationForLink=function(e,t,o){var n=this.dataStore.getCache();return{query:n.transformForLink?n.transformForLink(e):e,variables:t,operationName:r.getOperationName(e)||void 0,context:this.prepareContext(o)}},e.prototype.prepareContext=function(e){void 0===e&&(e={});var r=this.localState.prepareContext(e);return t.__assign({},r,{clientAwareness:this.clientAwareness})},e.prototype.checkInFlight=function(e){var t=this.queryStore.get(e);return t&&t.networkStatus!==exports.NetworkStatus.ready&&t.networkStatus!==exports.NetworkStatus.error},e.prototype.startPollingQuery=function(e,r,o){var n=e.pollInterval;return i.invariant(n),this.ssrMode||(this.pollingInfoByQueryId.set(r,{interval:n,lastPollTimeMs:Date.now()-10,options:t.__assign({},e,{fetchPolicy:"network-only"})}),o&&this.addQueryListener(r,o),this.schedulePoll(n)),r},e.prototype.stopPollingQuery=function(e){this.pollingInfoByQueryId.delete(e)},e.prototype.schedulePoll=function(e){var t=this,r=Date.now();if(this.nextPoll){if(!(e<this.nextPoll.time-r))return;clearTimeout(this.nextPoll.timeout)}this.nextPoll={time:r+e,timeout:setTimeout(function(){t.nextPoll=null;var e=1/0;t.pollingInfoByQueryId.forEach(function(r,o){if(r.interval<e&&(e=r.interval),!t.checkInFlight(o)&&Date.now()-r.lastPollTimeMs>=r.interval){var n=function(){r.lastPollTimeMs=Date.now()};t.fetchQuery(o,r.options,exports.FetchType.poll).then(n,n)}}),isFinite(e)&&t.schedulePoll(e)},e)}},e}(),S=function(){function e(e){this.cache=e}return e.prototype.getCache=function(){return this.cache},e.prototype.markQueryResult=function(e,t,o,n,i){void 0===i&&(i=!1);var s=!r.graphQLResultHasError(e);i&&r.graphQLResultHasError(e)&&e.data&&(s=!0),!n&&s&&this.cache.write({result:e.data,dataId:"ROOT_QUERY",query:t,variables:o})},e.prototype.markSubscriptionResult=function(e,t,o){r.graphQLResultHasError(e)||this.cache.write({result:e.data,dataId:"ROOT_SUBSCRIPTION",query:t,variables:o})},e.prototype.markMutationInit=function(e){var t=this;if(e.optimisticResponse){var r;r="function"==typeof e.optimisticResponse?e.optimisticResponse(e.variables):e.optimisticResponse;this.cache.recordOptimisticTransaction(function(o){var n=t.cache;t.cache=o;try{t.markMutationResult({mutationId:e.mutationId,result:{data:r},document:e.document,variables:e.variables,updateQueries:e.updateQueries,update:e.update})}finally{t.cache=n}},e.mutationId)}},e.prototype.markMutationResult=function(e){var t=this;if(!r.graphQLResultHasError(e.result)){var o=[];o.push({result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),e.updateQueries&&Object.keys(e.updateQueries).filter(function(t){return e.updateQueries[t]}).forEach(function(n){var i=e.updateQueries[n],s=i.query,a=i.updater,u=t.cache.diff({query:s.document,variables:s.variables,returnPartialData:!0,optimistic:!1}),c=u.result;if(u.complete){var l=r.tryFunctionOrLogError(function(){return a(c,{mutationResult:e.result,queryName:r.getOperationName(s.document)||void 0,queryVariables:s.variables})});l&&o.push({result:l,dataId:"ROOT_QUERY",query:s.document,variables:s.variables})}}),this.cache.performTransaction(function(e){o.forEach(function(t){return e.write(t)})});var n=e.update;n&&this.cache.performTransaction(function(t){r.tryFunctionOrLogError(function(){return n(t,e.result)})})}},e.prototype.markMutationComplete=function(e){var t=e.mutationId;e.optimisticResponse&&this.cache.removeOptimistic(t)},e.prototype.markUpdateQueryResult=function(e,t,r){this.cache.write({result:r,dataId:"ROOT_QUERY",variables:t,query:e})},e.prototype.reset=function(){return this.cache.reset()},e}(),q="2.5.0-rc.0",k=!1,R=function(){function e(e){var t=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],this.clientAwareness={};var n=e.cache,s=e.ssrMode,a=void 0!==s&&s,u=e.ssrForceFetchDelay,c=void 0===u?0:u,l=e.connectToDevTools,h=e.queryDeduplication,p=void 0===h||h,y=e.defaultOptions,f=e.resolvers,d=e.typeDefs,v=e.fragmentMatcher,b=e.name,g=e.version,m=e.link;if(!m&&f&&(m=o.ApolloLink.empty()),!m||!n)throw new i.InvariantError;var w=new Map,k=new o.ApolloLink(function(e,t){var o=w.get(e.query);return o||(o=r.removeConnectionDirectiveFromDocument(e.query),w.set(e.query,o),w.set(o,o)),e.query=o,t(e)});this.link=k.concat(m),this.cache=n,this.store=new S(n),this.disableNetworkFetches=a||c>0,this.queryDeduplication=p,this.ssrMode=a,this.defaultOptions=y||{},c&&setTimeout(function(){return t.disableNetworkFetches=!1},c),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this);void 0!==l&&(l&&"undefined"!=typeof window)&&(window.__APOLLO_CLIENT__=this),this.version=q,b&&(this.clientAwareness.name=b),g&&(this.clientAwareness.version=g),this.localState=new Q({cache:n,client:this,resolvers:f,typeDefs:d,fragmentMatcher:v})}return e.prototype.stop=function(){this.queryManager&&this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=t.__assign({},this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=t.__assign({},e,{fetchPolicy:"cache-first"})),this.initQueryManager().watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=t.__assign({},this.defaultOptions.query,e)),i.invariant("cache-and-network"!==e.fetchPolicy),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=t.__assign({},e,{fetchPolicy:"cache-first"})),this.initQueryManager().query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=t.__assign({},this.defaultOptions.mutate,e)),this.initQueryManager().mutate(e)},e.prototype.subscribe=function(e){return this.initQueryManager().startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.initProxy().readQuery(e,t)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.initProxy().readFragment(e,t)},e.prototype.writeQuery=function(e){var t=this.initProxy().writeQuery(e);return this.initQueryManager().broadcastQueries(),t},e.prototype.writeFragment=function(e){var t=this.initProxy().writeFragment(e);return this.initQueryManager().broadcastQueries(),t},e.prototype.writeData=function(e){var t=this.initProxy().writeData(e);return this.initQueryManager().broadcastQueries(),t},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return o.execute(this.link,e)},e.prototype.initQueryManager=function(){var e=this;return this.queryManager||(this.queryManager=new w({link:this.link,store:this.store,queryDeduplication:this.queryDeduplication,ssrMode:this.ssrMode,clientAwareness:this.clientAwareness,localState:this.localState,onBroadcast:function(){e.devToolsHookCb&&e.devToolsHookCb({action:{},state:{queries:e.queryManager?e.queryManager.queryStore.getStore():{},mutations:e.queryManager?e.queryManager.mutationStore.getStore():{}},dataWithOptimisticResults:e.cache.extract(!0)})}})),this.queryManager},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager?e.queryManager.clearStore():Promise.resolve(null)}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(e){return e()}))}).then(function(){return e.queryManager&&e.queryManager.reFetchObservableQueries?e.queryManager.reFetchObservableQueries():Promise.resolve(null)})},e.prototype.clearStore=function(){var e=this,t=this.queryManager;return Promise.resolve().then(function(){return Promise.all(e.clearStoreCallbacks.map(function(e){return e()}))}).then(function(){return t?t.clearStore():Promise.resolve(null)})},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(t){return t!==e})}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(t){return t!==e})}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager?this.queryManager.reFetchObservableQueries(e):Promise.resolve(null)},e.prototype.extract=function(e){return this.initProxy().extract(e)},e.prototype.restore=function(e){return this.initProxy().restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e.prototype.initProxy=function(){return this.proxy||(this.initQueryManager(),this.proxy=this.cache),this.proxy},e}();exports.default=R,exports.ApolloClient=R,exports.ObservableQuery=d,exports.isApolloError=h,exports.ApolloError=y; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("apollo-utilities"),o=require("apollo-link"),n=e(require("symbol-observable")),i=require("ts-invariant"),s=require("apollo-link-dedup"),a=require("graphql/language/printer"),u=require("graphql/language/visitor");function c(e){return e<7}!function(e){e[e.loading=1]="loading",e[e.setVariables=2]="setVariables",e[e.fetchMore=3]="fetchMore",e[e.refetch=4]="refetch",e[e.poll=6]="poll",e[e.ready=7]="ready",e[e.error=8]="error"}(exports.NetworkStatus||(exports.NetworkStatus={}));var l=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r.prototype[n]=function(){return this},r.prototype["@@observable"]=function(){return this},r}(o.Observable);function h(e){return e.hasOwnProperty("graphQLErrors")}var p=function(e){var t="";return Array.isArray(e.graphQLErrors)&&0!==e.graphQLErrors.length&&e.graphQLErrors.forEach(function(e){var r=e?e.message:"Error message not found.";t+="GraphQL error: "+r+"\n"}),e.networkError&&(t+="Network error: "+e.networkError.message+"\n"),t=t.replace(/\n$/,"")},y=function(e){function r(t){var o=t.graphQLErrors,n=t.networkError,i=t.errorMessage,s=t.extraInfo,a=e.call(this,i)||this;return a.graphQLErrors=o||[],a.networkError=n||null,a.message=i||p(a),a.extraInfo=s,a.__proto__=r.prototype,a}return t.__extends(r,e),r}(Error);!function(e){e[e.normal=1]="normal",e[e.refetch=2]="refetch",e[e.poll=3]="poll"}(exports.FetchType||(exports.FetchType={}));var f=function(e,t){return void 0===t&&(t="none"),e&&(e.graphQLErrors&&e.graphQLErrors.length>0&&"none"===t||e.networkError)},d=function(e){function o(t){var r=t.queryManager,o=t.options,n=t.shouldSubscribe,i=void 0===n||n,s=e.call(this,function(e){return s.onSubscribe(e)})||this;return s.isTornDown=!1,s.options=o,s.variables=o.variables||{},s.queryId=r.generateQueryId(),s.shouldSubscribe=i,s.queryManager=r,s.observers=[],s.subscriptionHandles=[],s}return t.__extends(o,e),o.prototype.result=function(){var e=this;return new Promise(function(t,r){var o,n={next:function(r){t(r),e.observers.some(function(e){return e!==n})||e.queryManager.removeQuery(e.queryId),setTimeout(function(){o.unsubscribe()},0)},error:function(e){r(e)}};o=e.subscribe(n)})},o.prototype.currentResult=function(){var e=this.getCurrentResult();return void 0===e.data&&(e.data={}),e},o.prototype.getCurrentResult=function(){if(this.isTornDown)return{data:this.lastError?void 0:this.lastResult?this.lastResult.data:void 0,error:this.lastError,loading:!1,networkStatus:exports.NetworkStatus.error};var e=this.queryManager.queryStore.get(this.queryId);if(f(e,this.options.errorPolicy))return{data:void 0,loading:!1,networkStatus:e.networkStatus,error:new y({graphQLErrors:e.graphQLErrors,networkError:e.networkError})};e&&e.variables&&(this.options.variables=Object.assign({},this.options.variables,e.variables));var o,n=this.queryManager.getCurrentQueryResult(this),i=n.data,s=n.partial,a=!e||e.networkStatus===exports.NetworkStatus.loading,u="network-only"===this.options.fetchPolicy&&a||s&&"cache-only"!==this.options.fetchPolicy,l={data:i,loading:c(o=e?e.networkStatus:u?exports.NetworkStatus.loading:exports.NetworkStatus.ready),networkStatus:o};return e&&e.graphQLErrors&&"all"===this.options.errorPolicy&&(l.errors=e.graphQLErrors),s||(this.lastResult=t.__assign({},l,{stale:!1}),this.lastResultSnapshot=r.cloneDeep(this.lastResult)),t.__assign({},l,{partial:s})},o.prototype.isDifferentFromLastResult=function(e){var t=this.lastResultSnapshot;return!(t&&e&&t.networkStatus===e.networkStatus&&t.stale===e.stale&&r.isEqual(t.data,e.data))},o.prototype.getLastResult=function(){return this.lastResult},o.prototype.getLastError=function(){return this.lastError},o.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},o.prototype.refetch=function(e){var o=this.options.fetchPolicy;if("cache-only"===o)return Promise.reject(new Error("cache-only fetchPolicy option should not be used together with query refetch."));r.isEqual(this.variables,e)||(this.variables=Object.assign({},this.variables,e)),r.isEqual(this.options.variables,this.variables)||(this.options.variables=Object.assign({},this.options.variables,this.variables));var n="network-only"===o||"no-cache"===o,i=t.__assign({},this.options,{fetchPolicy:n?o:"network-only"});return this.queryManager.fetchQuery(this.queryId,i,exports.FetchType.refetch).then(function(e){return e})},o.prototype.fetchMore=function(e){var r,o=this;return i.invariant(e.updateQuery),Promise.resolve().then(function(){var n=o.queryManager.generateQueryId();return(r=e.query?e:t.__assign({},o.options,e,{variables:Object.assign({},o.variables,e.variables)})).fetchPolicy="network-only",o.queryManager.fetchQuery(n,r,exports.FetchType.normal,o.queryId)}).then(function(t){return o.updateQuery(function(o){return e.updateQuery(o,{fetchMoreResult:t.data,variables:r.variables})}),t})},o.prototype.subscribeToMore=function(e){var t=this,r=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables}).subscribe({next:function(r){e.updateQuery&&t.updateQuery(function(t,o){var n=o.variables;return e.updateQuery(t,{subscriptionData:r,variables:n})})},error:function(t){e.onError?e.onError(t):console.error("Unhandled GraphQL subscription error",t)}});return this.subscriptionHandles.push(r),function(){var e=t.subscriptionHandles.indexOf(r);e>=0&&(t.subscriptionHandles.splice(e,1),r.unsubscribe())}},o.prototype.setOptions=function(e){var t=this.options;this.options=Object.assign({},this.options,e),e.pollInterval?this.startPolling(e.pollInterval):0===e.pollInterval&&this.stopPolling();var r="network-only"!==t.fetchPolicy&&"network-only"===e.fetchPolicy||"cache-only"===t.fetchPolicy&&"cache-only"!==e.fetchPolicy||"standby"===t.fetchPolicy&&"standby"!==e.fetchPolicy||!1;return this.setVariables(this.options.variables,r,e.fetchResults)},o.prototype.setVariables=function(e,o,n){void 0===o&&(o=!1),void 0===n&&(n=!0),this.isTornDown=!1;var i=e||this.variables;return r.isEqual(i,this.variables)&&!o?0!==this.observers.length&&n?this.result():new Promise(function(e){return e()}):(this.variables=i,this.options.variables=i,0===this.observers.length?new Promise(function(e){return e()}):this.queryManager.fetchQuery(this.queryId,t.__assign({},this.options,{variables:this.variables})).then(function(e){return e}))},o.prototype.updateQuery=function(e){var t=this.queryManager.getQueryWithPreviousResult(this.queryId),o=t.previousResult,n=t.variables,i=t.document,s=r.tryFunctionOrLogError(function(){return e(o,{variables:n})});s&&(this.queryManager.dataStore.markUpdateQueryResult(i,n,s),this.queryManager.broadcastQueries())},o.prototype.stopPolling=function(){this.queryManager.stopPollingQuery(this.queryId),this.options.pollInterval=void 0},o.prototype.startPolling=function(e){v(this),this.options.pollInterval=e,this.queryManager.startPollingQuery(this.options,this.queryId)},o.prototype.onSubscribe=function(e){var t=this;return e._subscription&&e._subscription._observer&&!e._subscription._observer.error&&(e._subscription._observer.error=function(e){console.error("Unhandled error",e.message,e.stack)}),this.observers.push(e),e.next&&this.lastResult&&e.next(this.lastResult),e.error&&this.lastError&&e.error(this.lastError),1===this.observers.length&&this.setUpQuery(),function(){t.observers=t.observers.filter(function(t){return t!==e}),0===t.observers.length&&t.tearDownQuery()}},o.prototype.setUpQuery=function(){var e=this;this.shouldSubscribe&&this.queryManager.addObservableQuery(this.queryId,this),this.options.pollInterval&&(v(this),this.queryManager.startPollingQuery(this.options,this.queryId));var t={next:function(t){e.lastResult=t,e.lastResultSnapshot=r.cloneDeep(t),e.observers.forEach(function(e){return e.next&&e.next(t)})},error:function(t){e.lastError=t,e.observers.forEach(function(e){return e.error&&e.error(t)})}};this.queryManager.startQuery(this.queryId,this.options,this.queryManager.queryListenerForObserver(this.queryId,this.options,t))},o.prototype.tearDownQuery=function(){this.isTornDown=!0,this.queryManager.stopPollingQuery(this.queryId),this.subscriptionHandles.forEach(function(e){return e.unsubscribe()}),this.subscriptionHandles=[],this.queryManager.removeObservableQuery(this.queryId),this.queryManager.stopQuery(this.queryId),this.observers=[]},o}(l);function v(e){var t=e.options.fetchPolicy;i.invariant("cache-first"!==t&&"cache-only"!==t)}var b=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initMutation=function(e,t,r){this.store[e]={mutation:t,variables:r||{},loading:!0,error:null}},e.prototype.markMutationError=function(e,t){var r=this.store[e];r&&(r.loading=!1,r.error=t)},e.prototype.markMutationResult=function(e){var t=this.store[e];t&&(t.loading=!1,t.error=null)},e.prototype.reset=function(){this.store={}},e}(),g=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initQuery=function(e){var t=this.store[e.queryId];if(t&&t.document!==e.document&&!r.isEqual(t.document,e.document))throw new i.InvariantError;var o,n=!1,s=null;e.storePreviousVariables&&t&&t.networkStatus!==exports.NetworkStatus.loading&&(r.isEqual(t.variables,e.variables)||(n=!0,s=t.variables)),o=n?exports.NetworkStatus.setVariables:e.isPoll?exports.NetworkStatus.poll:e.isRefetch?exports.NetworkStatus.refetch:exports.NetworkStatus.loading;var a=[];t&&t.graphQLErrors&&(a=t.graphQLErrors),this.store[e.queryId]={document:e.document,variables:e.variables,previousVariables:s,networkError:null,graphQLErrors:a,networkStatus:o,metadata:e.metadata},"string"==typeof e.fetchMoreForQueryId&&this.store[e.fetchMoreForQueryId]&&(this.store[e.fetchMoreForQueryId].networkStatus=exports.NetworkStatus.fetchMore)},e.prototype.markQueryResult=function(e,t,r){this.store&&this.store[e]&&(this.store[e].networkError=null,this.store[e].graphQLErrors=t.errors&&t.errors.length?t.errors:[],this.store[e].previousVariables=null,this.store[e].networkStatus=exports.NetworkStatus.ready,"string"==typeof r&&this.store[r]&&(this.store[r].networkStatus=exports.NetworkStatus.ready))},e.prototype.markQueryError=function(e,t,r){this.store&&this.store[e]&&(this.store[e].networkError=t,this.store[e].networkStatus=exports.NetworkStatus.error,"string"==typeof r&&this.markQueryResultClient(r,!0))},e.prototype.markQueryResultClient=function(e,t){this.store&&this.store[e]&&(this.store[e].networkError=null,this.store[e].previousVariables=null,this.store[e].networkStatus=t?exports.NetworkStatus.ready:exports.NetworkStatus.loading)},e.prototype.stopQuery=function(e){delete this.store[e]},e.prototype.reset=function(e){var r=this;this.store=Object.keys(this.store).filter(function(t){return e.indexOf(t)>-1}).reduce(function(e,o){return e[o]=t.__assign({},r.store[o],{networkStatus:exports.NetworkStatus.loading}),e},{})},e}();function m(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Q=function(){function e(e){var t=e.cache,r=e.client,o=e.resolvers,n=e.typeDefs,i=e.fragmentMatcher;this.resolvers={},this.cache=t,r&&(this.client=r),o&&this.addResolvers(o),n&&this.setTypeDefs(n),i&&this.setFragmentMatcher(i)}return e.prototype.addResolvers=function(e){var t=this;Array.isArray(e)?e.forEach(function(e){t.resolvers=r.mergeDeep(t.resolvers,e)}):this.resolvers=r.mergeDeep(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers},e.prototype.runResolvers=function(e){var o=e.document,n=e.remoteResult,i=e.context,s=e.variables,a=e.onlyRunForcedResolvers,u=void 0!==a&&a;return t.__awaiter(this,void 0,void 0,function(){var e,a;return t.__generator(this,function(c){return o?(e=[],(a=this.buildRootValueFromCache(o,s))&&e.push(a),n.data&&e.push(n.data),[2,this.resolveDocument(o,r.mergeDeepArray(e),i,s,this.fragmentMatcher,u).then(function(e){return t.__assign({},n,{data:e.result})})]):[2,n]})})},e.prototype.setTypeDefs=function(e){this.typeDefs=e},e.prototype.getTypeDefs=function(){return this.typeDefs},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){return r.hasDirectives(["client"],e)?e:null},e.prototype.serverQuery=function(e){return r.removeClientSetsFromDocument(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var r=this.cache,o=[];if(this.typeDefs){var n=this.normalizeTypeDefs(this.typeDefs);o.push({definition:n,directives:"directive @client on FIELD"})}return t.__assign({},e,{cache:r,getCacheKey:function(e){if(r.config)return r.config.dataIdFromObject(e);i.invariant(!1)},schemas:o})},e.prototype.addExportedVariables=function(e,r,o){return void 0===r&&(r={}),void 0===o&&(o={}),t.__awaiter(this,void 0,void 0,function(){return t.__generator(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(o),r).then(function(e){return t.__assign({},r,e.exportedVariables)})]:[2,t.__assign({},r)]})})},e.prototype.shouldForceResolvers=function(e){var t=!1;return u.visit(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some(function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value})))return u.BREAK}}}),t},e.prototype.shouldForceResolver=function(e){return this.shouldForceResolvers(e)},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:r.buildQueryFromSelectionSet(e),variables:t,optimistic:!1}).result},e.prototype.normalizeTypeDefs=function(e){return(Array.isArray(e)?e:[e]).map(function(e){return"string"==typeof e?e:a.print(e)}).map(function(e){return e.trim()}).join("\n")},e.prototype.resolveDocument=function(e,o,n,i,s,a){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===s&&(s=function(){return!0}),void 0===a&&(a=!1),t.__awaiter(this,void 0,void 0,function(){var u,c,l,h,p,y,f,d,v;return t.__generator(this,function(b){return u=r.getMainDefinition(e),c=r.getFragmentDefinitions(e),l=r.createFragmentMap(c),h=u.operation,p=h?m(h):"Query",f=(y=this).cache,d=y.client,v={fragmentMap:l,context:t.__assign({},n,{cache:f,client:d}),variables:i,fragmentMatcher:s,defaultOperationType:p,exportedVariables:{},onlyRunForcedResolvers:a},[2,this.resolveSelectionSet(u.selectionSet,o,v).then(function(e){return{result:e,exportedVariables:v.exportedVariables}})]})})},e.prototype.resolveSelectionSet=function(e,o,n){return t.__awaiter(this,void 0,void 0,function(){var s,a,u,c,l,h=this;return t.__generator(this,function(p){return s=n.fragmentMap,a=n.context,u=n.variables,c=[o],l=function(e){return t.__awaiter(h,void 0,void 0,function(){var l,h;return t.__generator(this,function(t){return r.shouldInclude(e,u)?r.isField(e)?[2,this.resolveField(e,o,n).then(function(t){var o;void 0!==t&&c.push(((o={})[r.resultKeyNameFromField(e)]=t,o))})]:(r.isInlineFragment(e)?l=e:(l=s[e.name.value],i.invariant(l)),l&&l.typeCondition&&(h=l.typeCondition.name.value,n.fragmentMatcher(o,h,a))?[2,this.resolveSelectionSet(l.selectionSet,o,n).then(function(e){c.push(e)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(l)).then(function(){return r.mergeDeepArray(c)})]})})},e.prototype.resolveField=function(e,o,n){return t.__awaiter(this,void 0,void 0,function(){var i,s,a,u,c,l,h,p,y,f=this;return t.__generator(this,function(t){return i=n.variables,s=e.name.value,a=r.resultKeyNameFromField(e),u=s!==a,c=o[a]||o[s],l=Promise.resolve(c),n.onlyRunForcedResolvers&&!this.shouldForceResolver(e)||(h=o.__typename||n.defaultOperationType,(p=this.resolvers[h])&&(y=p[u?s:a])&&(l=Promise.resolve(y(o,r.argumentsObjectFromField(e,i),n.context,{field:e})))),[2,l.then(function(t){return void 0===t&&(t=c),e.directives&&e.directives.forEach(function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach(function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(n.exportedVariables[e.value.value]=t)})}),e.selectionSet?null==t?t:Array.isArray(t)?f.resolveSubSelectedArray(e,t,n):e.selectionSet?f.resolveSelectionSet(e.selectionSet,t,n):void 0:t})]})})},e.prototype.resolveSubSelectedArray=function(e,t,r){var o=this;return Promise.all(t.map(function(t){return null===t?null:Array.isArray(t)?o.resolveSubSelectedArray(e,t,r):e.selectionSet?o.resolveSelectionSet(e.selectionSet,t,r):void 0}))},e}(),w=function(){function e(e){var t=e.link,r=e.queryDeduplication,n=void 0!==r&&r,i=e.store,a=e.onBroadcast,u=void 0===a?function(){}:a,c=e.ssrMode,l=void 0!==c&&c,h=e.clientAwareness,p=void 0===h?{}:h,y=e.localState;this.mutationStore=new b,this.queryStore=new g,this.clientAwareness={},this.idCounter=1,this.queries=new Map,this.fetchQueryRejectFns=new Map,this.queryIdsByName={},this.pollingInfoByQueryId=new Map,this.nextPoll=null,this.link=t,this.deduplicator=o.ApolloLink.from([new s.DedupLink,t]),this.queryDeduplication=n,this.dataStore=i,this.onBroadcast=u,this.clientAwareness=p,this.localState=y||new Q({cache:i.getCache()}),this.ssrMode=l}return e.prototype.stop=function(){var e=this;this.queries.forEach(function(t,r){e.stopQueryNoBroadcast(r)}),this.fetchQueryRejectFns.forEach(function(e){e(new Error("QueryManager stopped while query was in flight"))})},e.prototype.mutate=function(e){var n=e.mutation,s=e.variables,a=e.optimisticResponse,u=e.updateQueries,c=e.refetchQueries,h=void 0===c?[]:c,p=e.awaitRefetchQueries,f=void 0!==p&&p,d=e.update,v=e.errorPolicy,b=void 0===v?"none":v,g=e.fetchPolicy,m=e.context,Q=void 0===m?{}:m;return t.__awaiter(this,void 0,void 0,function(){var e,c,p,v,m,w=this;return t.__generator(this,function(S){switch(S.label){case 0:return i.invariant(n),i.invariant(!g||"no-cache"===g),e=this.generateQueryId(),c=this.dataStore.getCache(),n=c.transformDocument(n),s=r.assign({},r.getDefaultValues(r.getMutationDefinition(n)),s),this.setQuery(e,function(){return{document:n}}),p=function(){var e={};return u&&Object.keys(u).forEach(function(t){return(w.queryIdsByName[t]||[]).forEach(function(r){e[r]={updater:u[t],query:w.queryStore.get(r)}})}),e},r.hasClientExports(n)?[4,this.localState.addExportedVariables(n,s,Q)]:[3,2];case 1:return m=S.sent(),[3,3];case 2:m=s,S.label=3;case 3:return v=m,this.mutationStore.initMutation(e,n,v),this.dataStore.markMutationInit({mutationId:e,document:n,variables:v||{},updateQueries:p(),update:d,optimisticResponse:a}),this.broadcastQueries(),[2,new Promise(function(i,s){var u,c,m=w.buildOperationForLink(n,v,t.__assign({},Q,{optimisticResponse:a})),S=function(){if(c&&w.mutationStore.markMutationError(e,c),w.dataStore.markMutationComplete({mutationId:e,optimisticResponse:a}),w.broadcastQueries(),c)return Promise.reject(c);"function"==typeof h&&(h=h(u));for(var t=[],o=0,n=h;o<n.length;o++){var i=n[o];if("string"!=typeof i){var s={query:i.query,variables:i.variables,fetchPolicy:"network-only"};i.context&&(s.context=i.context),t.push(w.query(s))}else{var l=w.refetchQueryByName(i);l&&t.push(l)}}return Promise.all(f?t:[]).then(function(){return w.setQuery(e,function(){return{document:null}}),"ignore"===b&&u&&r.graphQLResultHasError(u)&&delete u.errors,u})},q=w.localState.clientQuery(m.query),k=w.localState.serverQuery(m.query);k&&(m.query=k);var R=k?o.execute(w.link,m):l.of({data:{}}),_=w,E=!1,x=!1;R.subscribe({next:function(o){return t.__awaiter(w,void 0,void 0,function(){var a,l,h;return t.__generator(this,function(t){switch(t.label){case 0:return x=!0,r.graphQLResultHasError(o)&&"none"===b?(x=!1,c=new y({graphQLErrors:o.errors}),[2]):(_.mutationStore.markMutationResult(e),a=o,l=m.context,h=m.variables,q&&r.hasDirectives(["client"],q)?[4,_.localState.runResolvers({document:q,remoteResult:o,context:l,variables:h}).catch(function(e){return x=!1,s(e),o})]:[3,2]);case 1:a=t.sent(),t.label=2;case 2:return"no-cache"!==g&&_.dataStore.markMutationResult({mutationId:e,result:a,document:n,variables:v||{},updateQueries:p(),update:d}),u=a,x=!1,E&&S().then(i,s),[2]}})})},error:function(t){_.mutationStore.markMutationError(e,t),_.dataStore.markMutationComplete({mutationId:e,optimisticResponse:a}),_.broadcastQueries(),_.setQuery(e,function(){return{document:null}}),s(new y({networkError:t}))},complete:function(){x||S().then(i,s),E=!0}})})]}})})},e.prototype.fetchQuery=function(e,o,n,i){return t.__awaiter(this,void 0,void 0,function(){var s,a,u,c,l,p,f,d,v,b,g,m,Q,w,S,q,k,R,_,E,x,M,P=this;return t.__generator(this,function(I){switch(I.label){case 0:return s=o.variables,a=void 0===s?{}:s,u=o.metadata,c=void 0===u?null:u,l=o.fetchPolicy,p=void 0===l?"cache-first":l,f=o.context,d=void 0===f?{}:f,v=this.dataStore.getCache(),b=v.transformDocument(o.query),r.hasClientExports(b)?[4,this.localState.addExportedVariables(b,a,d)]:[3,2];case 1:return m=I.sent(),[3,3];case 2:m=a,I.label=3;case 3:if(g=m,Q=t.__assign({},o,{variables:g}),S="network-only"===p||"no-cache"===p,n!==exports.FetchType.refetch&&"network-only"!==p&&"no-cache"!==p&&(q=this.dataStore.getCache().diff({query:b,variables:g,returnPartialData:!0,optimistic:!1}),k=q.complete,R=q.result,S=!k||"cache-and-network"===p,w=R),_=S&&"cache-only"!==p&&"standby"!==p,r.hasDirectives(["live"],b)&&(_=!0),E=this.generateRequestId(),x=this.updateQueryWatch(e,b,Q),this.setQuery(e,function(){return{document:b,lastRequestId:E,invalidated:!0,cancel:x}}),this.invalidate(!0,i),this.queryStore.initQuery({queryId:e,document:b,storePreviousVariables:_,variables:g,isPoll:n===exports.FetchType.poll,isRefetch:n===exports.FetchType.refetch,metadata:c,fetchMoreForQueryId:i}),this.broadcastQueries(),(!_||"cache-and-network"===p)&&(this.queryStore.markQueryResultClient(e,!_),this.invalidate(!0,e,i),this.broadcastQueries(this.localState.shouldForceResolvers(b))),_){if(M=this.fetchRequest({requestId:E,queryId:e,document:b,options:Q,fetchMoreForQueryId:i}).catch(function(t){if(h(t))throw t;var r=P.getQuery(e).lastRequestId;throw E>=(r||1)&&(P.queryStore.markQueryError(e,t,i),P.invalidate(!0,e,i),P.broadcastQueries()),new y({networkError:t})}),"cache-and-network"!==p)return[2,M];M.catch(function(){})}return[2,Promise.resolve({data:w})]}})})},e.prototype.queryListenerForObserver=function(e,r,o){var n=this,i=!1;return function(s,a,u){return t.__awaiter(n,void 0,void 0,function(){var n,l,h,p,f,d,v,b,g,m,Q,w,S,q,k,R,_,E,x,M;return t.__generator(this,function(P){switch(P.label){case 0:if(this.invalidate(!1,e),!s)return[2];if(n=this.getQuery(e).observableQuery,"standby"===(l=n?n.options.fetchPolicy:r.fetchPolicy))return[2];if(h=n?n.options.errorPolicy:r.errorPolicy,p=n?n.getLastResult():null,f=n?n.getLastError():null,d=!a&&null!=s.previousVariables||"cache-only"===l||"cache-and-network"===l,v=Boolean(p&&s.networkStatus!==p.networkStatus),b=h&&(f&&f.graphQLErrors)!==s.graphQLErrors&&"none"!==h,!(!c(s.networkStatus)||v&&r.notifyOnNetworkStatusChange||d))return[3,8];if((!h||"none"===h)&&s.graphQLErrors&&s.graphQLErrors.length>0||s.networkError){if(g=new y({graphQLErrors:s.graphQLErrors,networkError:s.networkError}),i=!0,o.error)try{o.error(g)}catch(e){setTimeout(function(){throw e},0)}else setTimeout(function(){throw g},0);return[2]}P.label=1;case 1:if(P.trys.push([1,7,,8]),m=void 0,Q=void 0,a?("no-cache"!==l&&"network-only"!==l&&this.setQuery(e,function(){return{newData:null}}),m=a.result,Q=!a.complete||!1):p&&p.data&&!b?(m=p.data,Q=!1):(w=this.getQuery(e).document,S=this.dataStore.getCache().diff({query:w,variables:s.previousVariables||s.variables,optimistic:!0}),m=S.result,Q=!S.complete),q=void 0,q=Q&&"cache-only"!==l?{data:p&&p.data,loading:c(s.networkStatus),networkStatus:s.networkStatus,stale:!0}:{data:m,loading:c(s.networkStatus),networkStatus:s.networkStatus,stale:!1},"all"===h&&s.graphQLErrors&&s.graphQLErrors.length>0&&(q.errors=s.graphQLErrors),!o.next)return[3,6];if(!i&&n&&!n.isDifferentFromLastResult(q))return[3,6];P.label=2;case 2:return P.trys.push([2,5,,6]),u?(k=r.query,R=r.variables,_=r.context,[4,this.localState.runResolvers({document:k,remoteResult:q,context:_,variables:R,onlyRunForcedResolvers:u})]):[3,4];case 3:E=P.sent(),q=t.__assign({},q,E),P.label=4;case 4:return o.next(q),[3,6];case 5:return x=P.sent(),setTimeout(function(){throw x},0),[3,6];case 6:return i=!1,[3,8];case 7:return M=P.sent(),i=!0,o.error&&o.error(new y({networkError:M})),[2];case 8:return[2]}})})}},e.prototype.watchQuery=function(e,o){void 0===o&&(o=!0),i.invariant("standby"!==e.fetchPolicy);var n=r.getQueryDefinition(e.query);if(n.variableDefinitions&&n.variableDefinitions.length){var s=r.getDefaultValues(n);e.variables=r.assign({},s,e.variables)}void 0===e.notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var a=t.__assign({},e);return new d({queryManager:this,options:a,shouldSubscribe:o})},e.prototype.query=function(e){var t=this;return i.invariant(e.query),i.invariant("Document"===e.query.kind),i.invariant(!e.returnPartialData),i.invariant(!e.pollInterval),new Promise(function(r,o){var n=t.watchQuery(e,!1);t.fetchQueryRejectFns.set("query:"+n.queryId,o),n.result().then(r,o).then(function(){return t.fetchQueryRejectFns.delete("query:"+n.queryId)})})},e.prototype.generateQueryId=function(){var e=this.idCounter.toString();return this.idCounter++,e},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){this.stopPollingQuery(e),this.queryStore.stopQuery(e),this.invalidate(!0,e)},e.prototype.addQueryListener=function(e,t){this.setQuery(e,function(e){var r=e.listeners;return{listeners:(void 0===r?[]:r).concat([t]),invalidated:!1}})},e.prototype.updateQueryWatch=function(e,t,r){var o=this,n=this.getQuery(e).cancel;n&&n();return this.dataStore.getCache().watch({query:t,variables:r.variables,optimistic:!0,previousResult:function(){var t=null,r=o.getQuery(e).observableQuery;if(r){var n=r.getLastResult();n&&(t=n.data)}return t},callback:function(t){o.setQuery(e,function(){return{invalidated:!0,newData:t}})}})},e.prototype.addObservableQuery=function(e,t){this.setQuery(e,function(){return{observableQuery:t}});var o=r.getQueryDefinition(t.options.query);if(o.name&&o.name.value){var n=o.name.value;this.queryIdsByName[n]=this.queryIdsByName[n]||[],this.queryIdsByName[n].push(t.queryId)}},e.prototype.removeObservableQuery=function(e){var t=this.getQuery(e),o=t.observableQuery,n=t.cancel;if(n&&n(),o){var i=r.getQueryDefinition(o.options.query),s=i.name?i.name.value:null;this.setQuery(e,function(){return{observableQuery:null}}),s&&(this.queryIdsByName[s]=this.queryIdsByName[s].filter(function(e){return!(o.queryId===e)}))}},e.prototype.clearStore=function(){this.fetchQueryRejectFns.forEach(function(e){e(new Error("Store reset while query was in flight(not completed in link chain)"))});var e=[];return this.queries.forEach(function(t,r){t.observableQuery&&e.push(r)}),this.queryStore.reset(e),this.mutationStore.reset(),this.dataStore.reset()},e.prototype.resetStore=function(){var e=this;return this.clearStore().then(function(){return e.reFetchObservableQueries()})},e.prototype.reFetchObservableQueries=function(e){var t=this.getObservableQueryPromises(e);return this.broadcastQueries(),Promise.all(t)},e.prototype.startQuery=function(e,t,r){return this.addQueryListener(e,r),this.fetchQuery(e,t).catch(function(){}),e},e.prototype.startGraphQLSubscription=function(e){var n,i=this,s=e.query,a=!(e.fetchPolicy&&"no-cache"===e.fetchPolicy),u=this.dataStore.getCache().transformDocument(s),c=r.assign({},r.getDefaultValues(r.getOperationDefinition(s)),e.variables),h=c,p=[],f=this.localState.clientQuery(u);return new l(function(e){if(p.push(e),1===p.length){var s=0,d=!1,v={next:function(e){return t.__awaiter(i,void 0,void 0,function(){var o;return t.__generator(this,function(t){switch(t.label){case 0:return s+=1,o=e,f&&r.hasDirectives(["client"],f)?[4,this.localState.runResolvers({document:f,remoteResult:e,context:{},variables:h})]:[3,2];case 1:o=t.sent(),t.label=2;case 2:return a&&(this.dataStore.markSubscriptionResult(o,u,h),this.broadcastQueries()),p.forEach(function(e){r.graphQLResultHasError(o)&&e.error?e.error(new y({graphQLErrors:o.errors})):e.next&&e.next(o),s-=1}),0===s&&d&&v.complete(),[2]}})})},error:function(e){p.forEach(function(t){t.error&&t.error(e)})},complete:function(){0===s&&p.forEach(function(e){e.complete&&e.complete()}),d=!0}};t.__awaiter(i,void 0,void 0,function(){var e,i,s,a;return t.__generator(this,function(t){switch(t.label){case 0:return r.hasClientExports(u)?[4,this.localState.addExportedVariables(u,c)]:[3,2];case 1:return i=t.sent(),[3,3];case 2:i=c,t.label=3;case 3:return e=i,(s=this.localState.serverQuery(u))?(a=this.buildOperationForLink(s,e),n=o.execute(this.link,a).subscribe(v)):n=l.of({data:{}}).subscribe(v),[2]}})})}return function(){0===(p=p.filter(function(t){return t!==e})).length&&n&&n.unsubscribe()}})},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){var t=this.getQuery(e).subscriptions;this.fetchQueryRejectFns.delete("query:"+e),this.fetchQueryRejectFns.delete("fetchRequest:"+e),t.forEach(function(e){return e.unsubscribe()}),this.queries.delete(e)},e.prototype.getCurrentQueryResult=function(e,t){void 0===t&&(t=!0);var r=e.options,o=r.variables,n=r.query,i=r.fetchPolicy,s=e.getLastResult(),a=this.getQuery(e.queryId).newData;if(a&&a.complete)return{data:a.result,partial:!1};if("no-cache"===i||"network-only"===i)return{data:void 0,partial:!1};try{return{data:this.dataStore.getCache().read({query:n,variables:o,previousResult:s?s.data:void 0,optimistic:t})||void 0,partial:!1}}catch(e){return{data:void 0,partial:!0}}},e.prototype.getQueryWithPreviousResult=function(e){var t;if("string"==typeof e){var r=this.getQuery(e).observableQuery;i.invariant(r),t=r}else t=e;var o=t.options,n=o.variables,s=o.query;return{previousResult:this.getCurrentQueryResult(t,!1).data,variables:n,document:s}},e.prototype.broadcastQueries=function(e){var t=this;void 0===e&&(e=!1),this.onBroadcast(),this.queries.forEach(function(r,o){r.invalidated&&r.listeners&&r.listeners.filter(function(e){return!!e}).forEach(function(n){n(t.queryStore.get(o),r.newData,e)})})},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableQueryPromises=function(e){var t=this,r=[];return this.queries.forEach(function(o,n){var i=o.observableQuery;if(i){var s=i.options.fetchPolicy;i.resetLastResults(),"cache-only"===s||!e&&"standby"===s||r.push(i.refetch()),t.setQuery(n,function(){return{newData:null}}),t.invalidate(!0,n)}}),r},e.prototype.fetchRequest=function(e){var n,i,s=this,a=e.requestId,u=e.queryId,c=e.document,h=e.options,p=e.fetchMoreForQueryId,f=h.variables,d=h.context,v=h.errorPolicy,b=void 0===v?"none":v,g=h.fetchPolicy;return new Promise(function(e,h){var v,m={},Q=s.localState.clientQuery(c),w=s.localState.serverQuery(c);if(w){var S=s.buildOperationForLink(w,f,t.__assign({},d,{forceFetch:!s.queryDeduplication}));m=S.context,v=o.execute(s.deduplicator,S)}else m=s.prepareContext(d),v=l.of({data:{}});s.fetchQueryRejectFns.set("fetchRequest:"+u,h);var q=!1,k=!0,R={next:function(e){return t.__awaiter(s,void 0,void 0,function(){var o,s;return t.__generator(this,function(t){switch(t.label){case 0:return k=!0,o=e,s=this.getQuery(u).lastRequestId,a>=(s||1)?Q&&r.hasDirectives(["client"],Q)?[4,this.localState.runResolvers({document:Q,remoteResult:e,context:m,variables:f}).catch(function(t){return k=!1,h(t),e})]:[3,2]:[3,3];case 1:o=t.sent(),t.label=2;case 2:if("no-cache"!==g)try{this.dataStore.markQueryResult(o,c,f,p,"ignore"===b||"all"===b)}catch(e){return k=!1,h(e),[2]}else this.setQuery(u,function(){return{newData:{result:o.data,complete:!0}}});this.queryStore.markQueryResult(u,o,p),this.invalidate(!0,u,p),this.broadcastQueries(),t.label=3;case 3:if(o.errors&&"none"===b)return k=!1,h(new y({graphQLErrors:o.errors})),[2];if("all"===b&&(i=o.errors),p||"no-cache"===g)n=o.data;else try{n=this.dataStore.getCache().read({variables:f,query:c,optimistic:!1})}catch(e){}return k=!1,q&&R.complete(),[2]}})})},error:function(e){s.fetchQueryRejectFns.delete("fetchRequest:"+u),s.setQuery(u,function(e){return{subscriptions:e.subscriptions.filter(function(e){return e!==_})}}),h(e)},complete:function(){k||(s.fetchQueryRejectFns.delete("fetchRequest:"+u),s.setQuery(u,function(e){return{subscriptions:e.subscriptions.filter(function(e){return e!==_})}}),e({data:n,errors:i,loading:!1,networkStatus:exports.NetworkStatus.ready,stale:!1})),q=!0}},_=v.subscribe(R);s.setQuery(u,function(e){return{subscriptions:e.subscriptions.concat([_])}})}).catch(function(e){throw s.fetchQueryRejectFns.delete("fetchRequest:"+u),e})},e.prototype.refetchQueryByName=function(e){var t=this,r=this.queryIdsByName[e];if(void 0!==r)return Promise.all(r.map(function(e){return t.getQuery(e).observableQuery}).filter(function(e){return!!e}).map(function(e){return e.refetch()}))},e.prototype.generateRequestId=function(){var e=this.idCounter;return this.idCounter++,e},e.prototype.getQuery=function(e){return this.queries.get(e)||{listeners:[],invalidated:!1,document:null,newData:null,lastRequestId:null,observableQuery:null,subscriptions:[]}},e.prototype.setQuery=function(e,r){var o=this.getQuery(e),n=t.__assign({},o,r(o));this.queries.set(e,n)},e.prototype.invalidate=function(e,t,r){t&&this.setQuery(t,function(){return{invalidated:e}}),r&&this.setQuery(r,function(){return{invalidated:e}})},e.prototype.buildOperationForLink=function(e,t,o){var n=this.dataStore.getCache();return{query:n.transformForLink?n.transformForLink(e):e,variables:t,operationName:r.getOperationName(e)||void 0,context:this.prepareContext(o)}},e.prototype.prepareContext=function(e){void 0===e&&(e={});var r=this.localState.prepareContext(e);return t.__assign({},r,{clientAwareness:this.clientAwareness})},e.prototype.checkInFlight=function(e){var t=this.queryStore.get(e);return t&&t.networkStatus!==exports.NetworkStatus.ready&&t.networkStatus!==exports.NetworkStatus.error},e.prototype.startPollingQuery=function(e,r,o){var n=e.pollInterval;return i.invariant(n),this.ssrMode||(this.pollingInfoByQueryId.set(r,{interval:n,lastPollTimeMs:Date.now()-10,options:t.__assign({},e,{fetchPolicy:"network-only"})}),o&&this.addQueryListener(r,o),this.schedulePoll(n)),r},e.prototype.stopPollingQuery=function(e){this.pollingInfoByQueryId.delete(e)},e.prototype.schedulePoll=function(e){var t=this,r=Date.now();if(this.nextPoll){if(!(e<this.nextPoll.time-r))return;clearTimeout(this.nextPoll.timeout)}this.nextPoll={time:r+e,timeout:setTimeout(function(){t.nextPoll=null;var e=1/0;t.pollingInfoByQueryId.forEach(function(r,o){if(r.interval<e&&(e=r.interval),!t.checkInFlight(o)&&Date.now()-r.lastPollTimeMs>=r.interval){var n=function(){r.lastPollTimeMs=Date.now()};t.fetchQuery(o,r.options,exports.FetchType.poll).then(n,n)}}),isFinite(e)&&t.schedulePoll(e)},e)}},e}(),S=function(){function e(e){this.cache=e}return e.prototype.getCache=function(){return this.cache},e.prototype.markQueryResult=function(e,t,o,n,i){void 0===i&&(i=!1);var s=!r.graphQLResultHasError(e);i&&r.graphQLResultHasError(e)&&e.data&&(s=!0),!n&&s&&this.cache.write({result:e.data,dataId:"ROOT_QUERY",query:t,variables:o})},e.prototype.markSubscriptionResult=function(e,t,o){r.graphQLResultHasError(e)||this.cache.write({result:e.data,dataId:"ROOT_SUBSCRIPTION",query:t,variables:o})},e.prototype.markMutationInit=function(e){var t=this;if(e.optimisticResponse){var r;r="function"==typeof e.optimisticResponse?e.optimisticResponse(e.variables):e.optimisticResponse;this.cache.recordOptimisticTransaction(function(o){var n=t.cache;t.cache=o;try{t.markMutationResult({mutationId:e.mutationId,result:{data:r},document:e.document,variables:e.variables,updateQueries:e.updateQueries,update:e.update})}finally{t.cache=n}},e.mutationId)}},e.prototype.markMutationResult=function(e){var t=this;if(!r.graphQLResultHasError(e.result)){var o=[];o.push({result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),e.updateQueries&&Object.keys(e.updateQueries).filter(function(t){return e.updateQueries[t]}).forEach(function(n){var i=e.updateQueries[n],s=i.query,a=i.updater,u=t.cache.diff({query:s.document,variables:s.variables,returnPartialData:!0,optimistic:!1}),c=u.result;if(u.complete){var l=r.tryFunctionOrLogError(function(){return a(c,{mutationResult:e.result,queryName:r.getOperationName(s.document)||void 0,queryVariables:s.variables})});l&&o.push({result:l,dataId:"ROOT_QUERY",query:s.document,variables:s.variables})}}),this.cache.performTransaction(function(e){o.forEach(function(t){return e.write(t)})});var n=e.update;n&&this.cache.performTransaction(function(t){r.tryFunctionOrLogError(function(){return n(t,e.result)})})}},e.prototype.markMutationComplete=function(e){var t=e.mutationId;e.optimisticResponse&&this.cache.removeOptimistic(t)},e.prototype.markUpdateQueryResult=function(e,t,r){this.cache.write({result:r,dataId:"ROOT_QUERY",variables:t,query:e})},e.prototype.reset=function(){return this.cache.reset()},e}(),q="2.5.0-rc.1",k=!1,R=function(){function e(e){var t=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],this.clientAwareness={};var n=e.cache,s=e.ssrMode,a=void 0!==s&&s,u=e.ssrForceFetchDelay,c=void 0===u?0:u,l=e.connectToDevTools,h=e.queryDeduplication,p=void 0===h||h,y=e.defaultOptions,f=e.resolvers,d=e.typeDefs,v=e.fragmentMatcher,b=e.name,g=e.version,m=e.link;if(!m&&f&&(m=o.ApolloLink.empty()),!m||!n)throw new i.InvariantError;var w=new Map,k=new o.ApolloLink(function(e,t){var o=w.get(e.query);return o||(o=r.removeConnectionDirectiveFromDocument(e.query),w.set(e.query,o),w.set(o,o)),e.query=o,t(e)});this.link=k.concat(m),this.cache=n,this.store=new S(n),this.disableNetworkFetches=a||c>0,this.queryDeduplication=p,this.ssrMode=a,this.defaultOptions=y||{},c&&setTimeout(function(){return t.disableNetworkFetches=!1},c),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this);void 0!==l&&(l&&"undefined"!=typeof window)&&(window.__APOLLO_CLIENT__=this),this.version=q,b&&(this.clientAwareness.name=b),g&&(this.clientAwareness.version=g),this.localState=new Q({cache:n,client:this,resolvers:f,typeDefs:d,fragmentMatcher:v})}return e.prototype.stop=function(){this.queryManager&&this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=t.__assign({},this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=t.__assign({},e,{fetchPolicy:"cache-first"})),this.initQueryManager().watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=t.__assign({},this.defaultOptions.query,e)),i.invariant("cache-and-network"!==e.fetchPolicy),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=t.__assign({},e,{fetchPolicy:"cache-first"})),this.initQueryManager().query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=t.__assign({},this.defaultOptions.mutate,e)),this.initQueryManager().mutate(e)},e.prototype.subscribe=function(e){return this.initQueryManager().startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.initProxy().readQuery(e,t)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.initProxy().readFragment(e,t)},e.prototype.writeQuery=function(e){var t=this.initProxy().writeQuery(e);return this.initQueryManager().broadcastQueries(),t},e.prototype.writeFragment=function(e){var t=this.initProxy().writeFragment(e);return this.initQueryManager().broadcastQueries(),t},e.prototype.writeData=function(e){var t=this.initProxy().writeData(e);return this.initQueryManager().broadcastQueries(),t},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return o.execute(this.link,e)},e.prototype.initQueryManager=function(){var e=this;return this.queryManager||(this.queryManager=new w({link:this.link,store:this.store,queryDeduplication:this.queryDeduplication,ssrMode:this.ssrMode,clientAwareness:this.clientAwareness,localState:this.localState,onBroadcast:function(){e.devToolsHookCb&&e.devToolsHookCb({action:{},state:{queries:e.queryManager?e.queryManager.queryStore.getStore():{},mutations:e.queryManager?e.queryManager.mutationStore.getStore():{}},dataWithOptimisticResults:e.cache.extract(!0)})}})),this.queryManager},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager?e.queryManager.clearStore():Promise.resolve(null)}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(e){return e()}))}).then(function(){return e.queryManager&&e.queryManager.reFetchObservableQueries?e.queryManager.reFetchObservableQueries():Promise.resolve(null)})},e.prototype.clearStore=function(){var e=this,t=this.queryManager;return Promise.resolve().then(function(){return Promise.all(e.clearStoreCallbacks.map(function(e){return e()}))}).then(function(){return t?t.clearStore():Promise.resolve(null)})},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(t){return t!==e})}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(t){return t!==e})}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager?this.queryManager.reFetchObservableQueries(e):Promise.resolve(null)},e.prototype.extract=function(e){return this.initProxy().extract(e)},e.prototype.restore=function(e){return this.initProxy().restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e.prototype.initProxy=function(){return this.proxy||(this.initQueryManager(),this.proxy=this.cache),this.proxy},e}();exports.default=R,exports.ApolloClient=R,exports.ObservableQuery=d,exports.isApolloError=h,exports.ApolloError=y; |
{ | ||
"name": "apollo-client", | ||
"version": "2.5.0-rc.0", | ||
"version": "2.5.0-rc.1", | ||
"description": "A simple yet functional GraphQL client.", | ||
@@ -27,6 +27,6 @@ "main": "bundle.umd.js", | ||
"@types/zen-observable": "^0.8.0", | ||
"apollo-cache": "1.2.0-rc.0", | ||
"apollo-cache": "1.2.0-rc.1", | ||
"apollo-link": "^1.0.0", | ||
"apollo-link-dedup": "^1.0.0", | ||
"apollo-utilities": "1.2.0-beta.1", | ||
"apollo-utilities": "1.2.0-rc.1", | ||
"symbol-observable": "^1.0.2", | ||
@@ -33,0 +33,0 @@ "ts-invariant": "^0.2.1", |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.5.0-rc.0"; | ||
export declare const version = "2.5.0-rc.1"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,1 +0,1 @@ | ||
exports.version = "2.5.0-rc.0" | ||
exports.version = "2.5.0-rc.1" |
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 too big to display
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
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
1276035
+ Addedapollo-cache@1.2.0-rc.1(transitive)
+ Addedapollo-utilities@1.2.0-rc.1(transitive)
- Removedapollo-cache@1.2.0-rc.0(transitive)
- Removedapollo-utilities@1.2.0-beta.1(transitive)
Updatedapollo-cache@1.2.0-rc.1
Updatedapollo-utilities@1.2.0-rc.1