Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@urql/exchange-graphcache

Package Overview
Dependencies
Maintainers
35
Versions
298
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@urql/exchange-graphcache - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

16

CHANGELOG.md
# @urql/exchange-graphcache
## 3.0.2
### Patch Changes
- Add special-case for fetching an introspection result in our schema-checking, this avoids an error when urql-devtools fetches the backend graphql schema, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#893](https://github.com/FormidableLabs/urql/pull/893))
- Mute warning when using built-in GraphQL fields, like `__type`, by [@kitten](https://github.com/kitten) (See [#919](https://github.com/FormidableLabs/urql/pull/919))
- ⚠️ Fix return type for resolvers to allow data objects to be returned with `__typename` as expected, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#927](https://github.com/FormidableLabs/urql/pull/927))
- Updated dependencies (See [#911](https://github.com/FormidableLabs/urql/pull/911) and [#908](https://github.com/FormidableLabs/urql/pull/908))
- @urql/core@1.12.3
## 3.0.1

@@ -26,3 +36,3 @@

- Remove the deprecated `populateExchange` export from `@urql/exchange-graphcache`.
If you're using the `populateExchange`, please install the seprate `@urql/exchange-populate` package and import it from there, by [@kitten](https://github.com/kitten) (See [#840](https://github.com/FormidableLabs/urql/pull/840))
If you're using the `populateExchange`, please install the separate `@urql/exchange-populate` package and import it from there, by [@kitten](https://github.com/kitten) (See [#840](https://github.com/FormidableLabs/urql/pull/840))
- The deprecated `cache.invalidateQuery()` method has been removed. Please migrate over to `cache.invalidate()` instead, which operates on individual fields instead of queries, by [@kitten](https://github.com/kitten) (See [#840](https://github.com/FormidableLabs/urql/pull/840))

@@ -299,3 +309,3 @@

- ✨ Implement `populateExchange` (eee [#120](https://github.com/FormidableLabs/urql-exchange-graphcache/pull/120))
- ✨ Implement `populateExchange` (see [#120](https://github.com/FormidableLabs/urql-exchange-graphcache/pull/120))
- Improve type safety of `invariant` and `warning` (see [#121](https://github.com/FormidableLabs/urql-exchange-graphcache/pull/121))

@@ -357,3 +367,3 @@ - Reduce size of `populateExchange` (see [#122](https://github.com/FormidableLabs/urql-exchange-graphcache/pull/122))

- Include the `/extras` build in the published version (see [#97](https://github.com/FormidableLabs/urql-exchange-graphcache/pull/97))
- Invariant and warnings will now have an error code associated with a more elabore explanation (see [#99](https://github.com/FormidableLabs/urql-exchange-graphcache/pull/99))
- Invariant and warnings will now have an error code associated with a more elaborate explanation (see [#99](https://github.com/FormidableLabs/urql-exchange-graphcache/pull/99))
- Invariant errors will now be included in your production bundle (see [#100](https://github.com/FormidableLabs/urql-exchange-graphcache/pull/100))

@@ -360,0 +370,0 @@ - Fixes the relayPagination helper to correctly return partial results (see [#101](https://github.com/FormidableLabs/urql-exchange-graphcache/pull/101))

2

default-storage/package.json

@@ -18,5 +18,5 @@ {

"dependencies": {
"@urql/core": ">=1.12.1",
"@urql/core": ">=1.12.3",
"wonka": "^4.0.14"
}
}

@@ -78,3 +78,6 @@ import { DocumentNode, FragmentDefinitionNode } from 'graphql';

}
export declare type Resolver = (parent: Data, args: Variables, cache: Cache, info: ResolveInfo) => DataField | undefined;
declare type ResolverResult = DataField | (DataFields & {
__typename?: string;
}) | null | undefined;
export declare type Resolver = (parent: Data, args: Variables, cache: Cache, info: ResolveInfo) => ResolverResult;
export interface ResolverConfig {

@@ -120,1 +123,2 @@ [typeName: string]: {

export declare type OperationType = 'read' | 'write';
export {};

@@ -156,3 +156,6 @@ "use strict";

return !0;
}, isFieldNullable = function(a, b, c) {
}, BUILTIN_FIELD_RE = /^__/, isFieldNullable = function(a, b, c) {
if (BUILTIN_FIELD_RE.test(c)) {
return !0;
}
return !!(a = getField(a, b, c)) && definition.isNullableType(a.type);

@@ -166,3 +169,3 @@ }, isListNullable = function(a, b, c) {

}, isFieldAvailableOnType = function(a, b, c) {
return !!getField(a, b, c);
return BUILTIN_FIELD_RE.test(c) ? !0 : !!getField(a, b, c);
}, isInterfaceOfType = function(a, b, c) {

@@ -169,0 +172,0 @@ if (!c || !b) {

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

"use strict";var e=require("./1cc90026.min.js"),t=require("graphql/utilities/valueFromASTUntyped"),r=require("graphql/language/kinds"),n=require("graphql/type/definition"),i=require("@urql/core"),o=require("graphql/utilities/buildClientSchema"),a=require("wonka"),u=require("graphql/language/printer"),s=function(e){return e.name.value},f=function(e){return e.typeCondition.name.value},l=function(e){return e.alias?e.alias.value:s(e)},c=function(e){return e.selectionSet?e.selectionSet.selections:[]},d=function(e){return(e=e.typeCondition)?s(e):null},p=function(e){return e.kind===r.Kind.FIELD},v=function(e){return e.kind===r.Kind.INLINE_FRAGMENT},y=function(e,r){var n={},i=0;if(e.arguments&&e.arguments.length)for(var o=0,a=e.arguments.length;o<a;o++){var u=e.arguments[o],f=t.valueFromASTUntyped(u.value,r);null!=f&&(n[s(u)]=f,i++)}return 0<i?n:null},m=function(e,t){if(t&&e.variableDefinitions){for(var r={},n=0,i=e.variableDefinitions.length;n<i;n++){var o=s(e.variableDefinitions[n].variable);r[o]=t[o]}return r}},h=function(e,r){var n={};if(!r)return n;if(e.variableDefinitions)for(var i=0,o=e.variableDefinitions.length;i<o;i++){var a=e.variableDefinitions[i],u=s(a.variable);n[u]=void 0===r[u]&&a.defaultValue?t.valueFromASTUntyped(a.defaultValue,r):r[u]}for(var f in r)f in n||(n[f]=r[f]);return n};function g(e,t,r){if(!e)throw(e=Error((t||"Minfied Error #"+r+"\n")+"\nhttps://bit.ly/2XbVrpR#"+r)).name="Graphcache Error",e}var k=function(e){return e.kind===r.Kind.FRAGMENT_DEFINITION};function b(e){return e.kind===r.Kind.OPERATION_DEFINITION}var q=function(e){return g(!!(e=e.definitions.find(b)),"",1),e};function O(e,t){return e[s(t)]=t,e}var _=function(e){return e.definitions.filter(k).reduce(O,{})},x=function(e,r){var n=e.directives;if(!n)return!0;for(var i=0,o=n.length;i<o;i++){var a=n[i];if(("include"===(e=s(a))||"skip"===e)&&a.arguments&&a.arguments[0]&&"if"===s(a.arguments[0]))return r=t.valueFromASTUntyped(a.arguments[0].value,r),"include"===e?!!r:!r}return!0},w=function(e,t,r){return!!(e=S(e,t,r))&&n.isNullableType(e.type)},N=function(e,t,r){return!!(e=S(e,t,r))&&(e=n.isNonNullType(e.type)?e.type.ofType:e.type,n.isListType(e)&&n.isNullableType(e.ofType))},K=function(e,t,r){return!(!r||!t)&&(r===t||(t=e.getType(t),r=e.getType(r),t instanceof n.GraphQLObjectType?t===r:(function(e,t){g(e instanceof n.GraphQLInterfaceType||e instanceof n.GraphQLUnionType,"",5)}(t),E(r),e.isPossibleType(t,r))))},S=function(e,t,r){return E(e=e.getType(t)),e.getFields()[r]};function E(e,t){g(e instanceof n.GraphQLObjectType,"",3)}var T=function(e,t){return t?e+"("+i.stringifyVariables(t)+")":e},F=function(e,t){return e+"."+t},A=function(e){var t=e.indexOf("(");return-1<t?{fieldKey:e,fieldName:e.slice(0,t),arguments:JSON.parse(e.slice(t+1,-1))}:{fieldKey:e,fieldName:e,arguments:null}},M=function(e){var t=e.indexOf(".");return{entityKey:e.slice(0,t).replace(/%2e/g,"."),fieldKey:e=e.slice(t+1)}},L=function(){return Object.create(null)},D=null,P=null,I=null,R=null,C=!1,Q=function(){return{optimistic:L(),base:new Map}},j=function(e,t,r,n){D=e,P=t,I=L(),C=!!n,r?n||0<t.optimisticOrder.length?(n||t.commutativeKeys.has(r)?n&&t.commutativeKeys.delete(r):oe(t,r),R=r,ae(t,r)):(R=null,se(t,r)):R=null},G=function(){var e=P,t=R;if(C=!1,R=null,t&&-1<e.optimisticOrder.indexOf(t))for(t=e.optimisticOrder.length;0<=--t&&e.refLock[e.optimisticOrder[t]]&&e.commutativeKeys.has(e.optimisticOrder[t]);)ce(e.optimisticOrder[t]);I=P=D=null,e.defer||(e.defer=!0,Promise.resolve().then((function(){j("write",e,null),Z(),pe(),G(),e.defer=!1})))},V=function(e,t,r){j("read",e,t,r),G()},U=function(){return g(null!==I,"",2),I},J=function(e,t,r,n){var i=(e=R?e.optimistic[R]:e.base).get(t);void 0===i&&e.set(t,i=L()),void 0!==n||R?i[r]=n:delete i[r]},B=function(e,t,r){for(var n,i=0,o=P.optimisticOrder.length;i<o;i++){var a=P.optimisticOrder[i],u=e.optimistic[a];if(u&&(!C||P.commutativeKeys.has(a))&&void 0!==(n=u.get(t))&&r in n)return n[r]}return void 0!==(n=e.base.get(t))?n[r]:void 0},z=function(e,t,r,n){var i=void 0!==t[r]?t[r]:0;t=t[r]=i+n|0,void 0!==e&&(0>=t?e.add(r):0>=i&&0<t&&e.delete(r))},X=function(e,t,r,n){if("string"==typeof r)z(e,t,r,n);else if(Array.isArray(r))for(var i=0,o=r.length;i<o;i++){var a=r[i];a&&z(e,t,a,n)}},H=function(e,t,r){if(void 0!==r)for(var n in r)t.has(n)||(e.push(A(n)),t.add(n))},W=function(e,t,r,n){H(e,t,n.base.get(r));for(var i=0,o=P.optimisticOrder.length;i<o;i++){var a=n.optimistic[P.optimisticOrder[i]];void 0!==a&&H(e,t,a.get(r))}};function Y(e,t,r){if(0<(P.refCount[e]||0))r.delete(e);else{for(var n in P.refLock){if(0<((t=P.refLock[n])[e]||0))return;delete t[e]}if(delete P.refCount[e],r.delete(e),P.records.base.delete(e),n=P.links.base.get(e))for(var i in P.links.base.delete(e),n)X(r,P.refCount,n[i],-1)}}var Z=function(){P.gc.forEach(Y)},$=function(e,t){"__typename"!==t&&(e!==P.queryRootKey?I[e]=!0:void 0!==t&&(I[F(e,t)]=!0))},ee=function(e,t){!C&&P.storage&&P.persist.add(function(e,t){return e.replace(/\./g,"%2e")+"."+t}(e,t))},te=function(e,t){return $(e,t),B(P.records,e,t)},re=function(e,t){return $(e,t),B(P.links,e,t)},ne=function(e,t,r){$(e,t),ee(e,t),J(P.records,e,t,r)},ie=function(e,t,r){var n=P;if(R)var i=n.refLock[R]||(n.refLock[R]=L()),o=n.links.optimistic[R];else{i=n.refCount,o=n.links.base;var a=n.gc}o=(o=o&&o.get(e))&&o[t],$(e,t),ee(e,t),J(n.links,e,t,r),X(a,i,o,-1),X(a,i,r,1)},oe=function(e,t){var r=e.optimisticOrder.indexOf(t);-1===r?e.optimisticOrder.unshift(t):e.commutativeKeys.has(t)||(ue(e,t),e.optimisticOrder.splice(r,1),e.optimisticOrder.unshift(t)),e.commutativeKeys.add(t)},ae=function(e,t){-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=L(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)},ue=function(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])},se=function(e,t){var r=e.optimisticOrder.indexOf(t);-1<r&&(e.optimisticOrder.splice(r,1),e.commutativeKeys.delete(t)),ue(e,t)};function fe(e,t){for(var r in e)ie(t,r,e[r])}function le(e,t){for(var r in e)ne(t,r,e[r])}var ce=function(e){var t=I;I=L();var r=P.links.optimistic[e];r&&r.forEach(fe),(r=P.records.optimistic[e])&&r.forEach(le),I=t,se(P,e)},de=function(e){var t=P.links,r=P.records,n=[],i=new Set;return $(e),W(n,i,e,t),W(n,i,e,r),n},pe=function(){if(P.storage){C=!0;var e=L();P.persist.forEach((function(t){var r,n=M(t),o=n.entityKey;e[t]=void 0!==(r=re(o,n=n.fieldKey))?":"+i.stringifyVariables(r):void 0!==(r=te(o,n))?i.stringifyVariables(r):void 0})),C=!1,P.storage.writeData(e),P.persist.clear()}},ve=function(e,t,r,n,i,o){return{store:e,variables:t,fragments:r,parentTypeName:n,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},ye=function(e,t,r,n,i){e.parentTypeName=t,e.parentKey=r,e.parentFieldKey=n,e.fieldName=i},me=function(e,t,r,n){return!(!t||t!==d(e)&&c(e).some((function(e){return!!p(e)&&(e=T(s(e),y(e,n)),!function(e,t){return void 0!==te(e,t)||void 0!==re(e,t)}(r,e))})))},he=function(e,t,r,n){var i=[0],o=[r];return{next:function(){for(;0!==i.length;){var r=i[i.length-1]++,a=o[o.length-1];if(r>=a.length)i.pop(),o.pop();else if(x(r=a[r],n.variables))if(p(r)){if("__typename"!==s(r))return r}else void 0!==(r=v(r)?r:n.fragments[s(r)])&&(n.store.schema?K(n.store.schema,d(r),e):me(r,e,t,n.variables))&&(i.push(0),o.push(c(r)))}}}},ge=function(e){return void 0===e?null:e},ke=function(e,t,r,n){return j("write",e.data,n||null),e=be(e,t,r),G(),e},be=function(e,t,r){var n=q(t.query),i={data:r,dependencies:U()},o=e.rootFields[n.operation];return e=ve(e,h(n,t.variables),_(t.query),o,o),Oe(e,o,c(n),r),i},qe=function(e,t,r){j("write",e.data,r,!0),r=q(t.query);var n={data:{},dependencies:U()},i=e.rootFields[r.operation];return g(i===e.rootFields.mutation,"",10),e=ve(e,h(r,t.variables),_(t.query),i,i,!0),Oe(e,i,c(r),n.data),G(),n},Oe=function(e,t,r,n){var i=t===e.store.rootFields.query,o=!i&&!!e.store.rootNames[t],a=o||i?t:n.__typename;if(a){o||i||!t||ne(t,"__typename",a),r=he(a,t||a,r,e);for(var u;u=r.next();){i=s(u);var f=y(u,e.variables),d=T(i,f),p=l(u),v=n[p];if(e.optimistic&&o){if(!(v=e.store.optimisticMutations[i]))continue;ye(e,a,a,d,i),v=n[p]=ge(v(f||{},e.store,e))}u.selectionSet?t&&!o?(p=F(t,d),u=_e(e,c(u),ge(v),p),ie(t||a,d,u)):_e(e,c(u),ge(v)):t&&!o&&ne(t||a,d,v),o&&(ye(e,a,a,F(a,d),i),d=e.store.updates[a][i])&&(n[i]=v,d(n,f||{},e.store,e))}}},_e=function(e,t,r,n){if(Array.isArray(r)){for(var i=Array(r.length),o=0,a=r.length;o<a;o++){var u=r[o],s=n?F(n,""+o):void 0;u=_e(e,t,u,s),i[o]=u}return i}return null===r?null:(n=e.store.keyOfEntity(r)||n,Oe(e,n,t,r),n||null)},xe=function(e){var t;this.keyOfField=T,e||(e={}),this.resolvers=e.resolvers||{},this.optimisticMutations=e.optimistic||{},this.keys=e.keys||{},this.updates={Mutation:e.updates&&e.updates.Mutation||{},Subscription:e.updates&&e.updates.Subscription||{}};var r="Query",n="Mutation",i="Subscription";if(e.schema){var a=this.schema=o.buildClientSchema(e.schema);e=a.getQueryType();var u=a.getMutationType();a=a.getSubscriptionType(),e&&(r=e.name),u&&(n=u.name),a&&(i=a.name)}this.rootFields={query:r,mutation:n,subscription:i},this.rootNames=((t={})[r]="query",t[n]="mutation",t[i]="subscription",t),this.data=function(e){return{defer:!1,gc:new Set,persist:new Set,queryRootKey:e,refCount:L(),refLock:L(),links:Q(),records:Q(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(r)};xe.prototype.keyOfEntity=function(e){var t,r=e.__typename,n=e.id,i=e._id;return r?void 0!==this.rootNames[r]?r:(this.keys[r]?t=this.keys[r](e):null!=n?t=""+n:null!=i&&(t=""+i),t?r+":"+t:null):null},xe.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var r=te(e,t);return void 0!==r?r:(t=re(e,t))?t:null},xe.prototype.resolve=function(e,t,r){return this.resolveFieldByKey(e,T(t,r))},xe.prototype.invalidate=function(e,t,r){g(e="string"==typeof e?e:this.keyOfEntity(e),"",19),function(e,t,r){t=t?[{fieldKey:T(t,r)}]:de(e),r=0;for(var n=t.length;r<n;r++){var i=t[r].fieldKey;void 0!==re(e,i)?ie(e,i,void 0):ne(e,i,void 0)}}(e,t,r)},xe.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?de(e):[]},xe.prototype.updateQuery=function(e,t){e=i.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&be(this,e,t)},xe.prototype.readQuery=function(e){return Ne(this,i.createRequest(e.query,e.variables)).data},xe.prototype.readFragment=function(e,t,r){return Ee(this,e,t,r)},xe.prototype.writeFragment=function(t,r,n){!function(t,r,n,i){r=_(r);var o=Object.keys(r);if(void 0!==(o=r[o[0]])){var a=f(o);n=e._extends({},{__typename:a},n);var u=t.keyOfEntity(n);u&&(t=ve(t,i||{},r,a,u),Oe(t,u,c(o),n))}}(this,t,r,n)};var we=function(e,t,r){return j("read",e.data,null),e=Ne(e,t,r),G(),e},Ne=function(e,t,r){var n=q(t.query),i=e.rootFields[n.operation],o=c(n);return r=r||{},r=i!==(e=ve(e,h(n,t.variables),_(t.query),i,i)).store.rootFields.query?Ke(e,i,o,r):Te(e,i,o,r),{dependencies:U(),partial:void 0!==r&&e.partial,data:void 0===r?null:r}},Ke=function(e,t,r,n){if("string"!=typeof n.__typename)return n;t=he(t,t,r,e),(r={}).__typename=n.__typename;for(var i;void 0!==(i=t.next());){var o=l(i),a=n[o];void 0!==i.selectionSet&&null!==a?(a=ge(a),r[o]=Se(e,c(i),a)):r[o]=a}return r},Se=function(e,t,r){if(Array.isArray(r)){for(var n=Array(r.length),i=0,o=r.length;i<o;i++)n[i]=Se(e,t,r[i]);return n}return null===r?null:null!==(n=e.store.keyOfEntity(r))?void 0===(e=Te(e,n,t,{}))?null:e:Ke(e,r.__typename,t,r)},Ee=function(t,r,n,i){r=_(r);var o=Object.keys(r);if(void 0===(o=r[o[0]]))return null;var a=f(o);return"string"==typeof n||n.__typename||(n.__typename=a),(n="string"!=typeof n?t.keyOfEntity(e._extends({},{__typename:a},n)):n)?(t=ve(t,i||{},r,a,n),Te(t,n,c(o),{})||null):null},Te=function(e,t,r,n,i){var o=e.store,a=t===o.rootFields.query,u=i&&o.keyOfEntity(i)||t;if("string"==typeof(t=a?t:te(u,"__typename")||i&&i.__typename)&&(!i||t===i.__typename)){n.__typename=t,r=he(t,u,r,e);for(var f,d=!1,p=!1;void 0!==(f=r.next());){var v=s(f),m=y(f,e.variables),h=l(f),k=T(v,m),b=F(u,k),q=te(u,k),O=i?i[v]:void 0,_=o.resolvers[t],x=void 0;if(void 0!==O&&void 0===f.selectionSet)x=O;else if("read"===(g(null!==D,"",2),D)&&_&&"function"==typeof _[v]){if(ye(e,t,u,b,v),void 0!==q&&(n[h]=q),x=_[v](n,m||{},o,e),void 0!==f.selectionSet&&(x=Fe(e,t,v,b,c(f),n[h]||{},x)),o.schema&&null===x&&!w(o.schema,t,v))return}else void 0===f.selectionSet?x=q:void 0!==O?x=Fe(e,t,v,b,c(f),n[h],O):void 0!==(m=re(u,k))?x=Ae(e,m,t,v,c(f),n[h]):"object"==typeof q&&null!==q&&(x=q);if(void 0===x&&o.schema&&w(o.schema,t,v))p=!0,n[h]=null;else{if(void 0===x)return;d=!0,n[h]=x}}return p&&(e.partial=!0),a&&p&&!d?void 0:n}},Fe=function(e,t,r,n,i,o,a){if(Array.isArray(a)){var u=e.store;u=!u.schema||N(u.schema,t,r);for(var s=Array(a.length),f=0,l=a.length;f<l;f++){var c=Fe(e,t,r,F(n,""+f),i,null!=o?o[f]:void 0,a[f]);if(void 0===c&&!u)return;s[f]=void 0!==c?c:null}return s}return null==a?a:null===o?null:Me(a)?(t=o||{},"string"==typeof a?Te(e,a,i,t):Te(e,n,i,t,a)):void 0},Ae=function(e,t,r,n,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&N(a.schema,r,n);for(var u=Array(t.length),s=0,f=t.length;s<f;s++){var l=Ae(e,t[s],r,n,i,null!=o?o[s]:void 0);if(void 0===l&&!a)return;u[s]=void 0!==l?l:null}return u}return null===t||null===o?null:Te(e,t,i,o||{})},Me=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},Le=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:r})})})},De=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:r})})};function Pe(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Ie(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function Re(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}var Ce=function(t){return function(r){function n(e){return Le(e.operation,"miss")}function o(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy&&!x(e.dependencies)}function u(e){var t=e.operation,r=e.outcome,n=e.dependencies;return e={operation:Le(t,r),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===r)&&(e.stale=!0,x(n)?"cache-and-network"===t.context.requestPolicy&&O.add(t.key):v.reexecuteOperation(De(t,"network-only"))),e}function s(e){var t=new Set,r=T(e,t);return N(e.operation,t),r}function f(e){return!h.has(e.operation.key)}function l(e){if(g.push(e)<h.size)return a.empty;for(var t=0;t<g.length;t++)oe(y.data,g[t].operation.key);for(var r in b)delete b[r];t=[],r=new Set;for(var n;n=g.shift();)t.push(T(n,r));return N(e.operation,r),a.fromArray(t)}function c(e){return h.has(e.operation.key)}var d,p=r.forward,v=r.client,y=new xe(t);t&&t.storage&&(d=t.storage.readData().then((function(e){!function(e,t,r){for(var n in j("read",e,null),r){var i=r[n];if(void 0!==i){var o=M(n),a=o.entityKey;o=o.fieldKey,":"===i[0]?ie(a,o,JSON.parse(i.slice(1))):ne(a,o,JSON.parse(i))}}G(),e.storage=t}(y.data,t.storage,e)})));var h=new Map,g=[],k=new Map,b=L(),O=new Set,_=L(),x=function(e){for(var t in e)if(b[t])return!0;return!1},w=function(e,t){if(t)for(var r in t)if(t=_[r]){_[r]=[];for(var n=0,i=t.length;n<i;n++)e.add(t[n])}},N=function(e,t){t.forEach((function(t){if(t!==e.key){var r=k.get(t);if(r){k.delete(t);var n="cache-first";O.has(t)&&(O.delete(t),n="cache-and-network"),v.reexecuteOperation(De(r,n))}}}))},K=function(t){if("query"===t.operationName)oe(y.data,t.key);else if("teardown"===t.operationName)k.delete(t.key),V(y.data,t.key);else if("mutation"===t.operationName&&"network-only"!==t.context.requestPolicy){var r=qe(y,t,t.key).dependencies;if(!function(e){for(var t in e)return!1;return!0}(r)){for(var n in r)b[n]=!0;h.set(t.key,r),n=new Set,w(n,r),N(t,n)}}return e._extends({},t,{variables:t.variables?m(q(t.query),t.variables):t.variables,query:i.formatDocument(t.query)})},S=function(e,t){for(var r in t)(_[r]||(_[r]=[])).push(e.key),k.set(e.key,e)},E=function(e){var t=we(y,e),r=t.data?t.partial?"partial":"hit":"miss";return S(e,t.dependencies),{outcome:r,operation:e,data:t.data,dependencies:t.dependencies}},T=function(e,t){var r=e.operation,n=e.error,i=e.extensions,o=r.key;if("mutation"===r.operationName){var a=h.get(o);w(t,a),h.delete(o)}else oe(y.data,r.key);if(e.data){if(o=ke(y,r,e.data,o).dependencies,w(t,o),o=we(y,r,e.data),e.data=o.data,"query"===r.operationName){var u=o.dependencies;w(t,u)}}else V(y.data,r.key);return u&&S(e.operation,u),{data:e.data,error:n,extensions:i,operation:r}};return function(e){e=a.share(e);var t=d?a.mergeMap(a.fromArray)(a.take(1)(a.buffer(a.fromPromise(d))(e))):a.empty;t=a.share(a.concat([t,e])),e=a.share(a.map(E)(a.filter(Pe)(t))),t=a.filter(Ie)(t);var r=a.map(n)(a.filter(o)(e));return e=a.map(u)(a.filter(Re)(e)),r=a.share(p(a.map(K)(a.merge([t,r])))),t=a.map(s)(a.filter(f)(r)),r=a.mergeMap(l)(a.filter(c)(r)),a.merge([t,r,e])}}};function Qe(e){return{query:u.print(e.query),variables:e.variables}}exports.Store=xe,exports.cacheExchange=Ce,exports.noopDataState=V,exports.offlineExchange=function(e){return function(t){function r(e){return"subscription"===e.operation.operationName||!function(e){return e&&e.networkError&&!e.response&&("undefined"!=typeof navigator&&!1===navigator.onLine||/request failed|failed to fetch|network\s?error/i.test(e.networkError.message))}(e.error)||"mutation"===e.operation.operationName&&(!function(e,t){var r,n=t.variables||L(),i=_(t.query);for(t=[].concat(c(q(t.query)));r=t.pop();)if(x(r,n))if(p(r)){if(e[s(r)])return!0}else(r=v(r)?r:i[s(r)])&&t.push.apply(t,c(r));return!1}(l,e.operation)||(d.push(e.operation),y(),!1))}var n=t.forward,o=t.client;t=t.dispatchDebug;var u=e.storage,f=n;if(u&&u.onOnline&&u.readMetadata&&u.writeMetadata){var l=e.optimistic||{},d=[],y=function(){u.writeMetadata(d.map(Qe))},m=!1,h=function(){for(var e;!m&&(e=d.shift());)m=!0,o.dispatchOperation(o.createRequestOperation("mutation",e)),m=!1;y()};f=function(e){return a.filter(r)(n(e))},u.onOnline(h),u.readMetadata().then((function(e){if(e)for(var t=0;t<e.length;t++)d.push(i.createRequest(e[t].query,e[t].variables));h()}))}return Ce(e)({forward:f,client:o,dispatchDebug:t})}},exports.query=we,exports.reserveLayer=oe,exports.write=ke,exports.writeOptimistic=qe;
"use strict";var e=require("./1cc90026.min.js"),t=require("graphql/utilities/valueFromASTUntyped"),r=require("graphql/language/kinds"),n=require("graphql/type/definition"),i=require("@urql/core"),o=require("graphql/utilities/buildClientSchema"),a=require("wonka"),u=require("graphql/language/printer"),s=function(e){return e.name.value},f=function(e){return e.typeCondition.name.value},l=function(e){return e.alias?e.alias.value:s(e)},c=function(e){return e.selectionSet?e.selectionSet.selections:[]},d=function(e){return(e=e.typeCondition)?s(e):null},p=function(e){return e.kind===r.Kind.FIELD},v=function(e){return e.kind===r.Kind.INLINE_FRAGMENT},y=function(e,r){var n={},i=0;if(e.arguments&&e.arguments.length)for(var o=0,a=e.arguments.length;o<a;o++){var u=e.arguments[o],f=t.valueFromASTUntyped(u.value,r);null!=f&&(n[s(u)]=f,i++)}return 0<i?n:null},m=function(e,t){if(t&&e.variableDefinitions){for(var r={},n=0,i=e.variableDefinitions.length;n<i;n++){var o=s(e.variableDefinitions[n].variable);r[o]=t[o]}return r}},h=function(e,r){var n={};if(!r)return n;if(e.variableDefinitions)for(var i=0,o=e.variableDefinitions.length;i<o;i++){var a=e.variableDefinitions[i],u=s(a.variable);n[u]=void 0===r[u]&&a.defaultValue?t.valueFromASTUntyped(a.defaultValue,r):r[u]}for(var f in r)f in n||(n[f]=r[f]);return n};function g(e,t,r){if(!e)throw(e=Error((t||"Minfied Error #"+r+"\n")+"\nhttps://bit.ly/2XbVrpR#"+r)).name="Graphcache Error",e}var k=function(e){return e.kind===r.Kind.FRAGMENT_DEFINITION};function b(e){return e.kind===r.Kind.OPERATION_DEFINITION}var q=function(e){return g(!!(e=e.definitions.find(b)),"",1),e};function O(e,t){return e[s(t)]=t,e}var _=function(e){return e.definitions.filter(k).reduce(O,{})},x=function(e,r){var n=e.directives;if(!n)return!0;for(var i=0,o=n.length;i<o;i++){var a=n[i];if(("include"===(e=s(a))||"skip"===e)&&a.arguments&&a.arguments[0]&&"if"===s(a.arguments[0]))return r=t.valueFromASTUntyped(a.arguments[0].value,r),"include"===e?!!r:!r}return!0},w=/^__/,N=function(e,t,r){return!!w.test(r)||!!(e=E(e,t,r))&&n.isNullableType(e.type)},K=function(e,t,r){return!!(e=E(e,t,r))&&(e=n.isNonNullType(e.type)?e.type.ofType:e.type,n.isListType(e)&&n.isNullableType(e.ofType))},S=function(e,t,r){return!(!r||!t)&&(r===t||(t=e.getType(t),r=e.getType(r),t instanceof n.GraphQLObjectType?t===r:(function(e,t){g(e instanceof n.GraphQLInterfaceType||e instanceof n.GraphQLUnionType,"",5)}(t),T(r),e.isPossibleType(t,r))))},E=function(e,t,r){return T(e=e.getType(t)),e.getFields()[r]};function T(e,t){g(e instanceof n.GraphQLObjectType,"",3)}var F=function(e,t){return t?e+"("+i.stringifyVariables(t)+")":e},A=function(e,t){return e+"."+t},M=function(e){var t=e.indexOf("(");return-1<t?{fieldKey:e,fieldName:e.slice(0,t),arguments:JSON.parse(e.slice(t+1,-1))}:{fieldKey:e,fieldName:e,arguments:null}},L=function(e){var t=e.indexOf(".");return{entityKey:e.slice(0,t).replace(/%2e/g,"."),fieldKey:e=e.slice(t+1)}},D=function(){return Object.create(null)},P=null,I=null,R=null,C=null,Q=!1,j=function(){return{optimistic:D(),base:new Map}},G=function(e,t,r,n){P=e,I=t,R=D(),Q=!!n,r?n||0<t.optimisticOrder.length?(n||t.commutativeKeys.has(r)?n&&t.commutativeKeys.delete(r):ae(t,r),C=r,ue(t,r)):(C=null,fe(t,r)):C=null},V=function(){var e=I,t=C;if(Q=!1,C=null,t&&-1<e.optimisticOrder.indexOf(t))for(t=e.optimisticOrder.length;0<=--t&&e.refLock[e.optimisticOrder[t]]&&e.commutativeKeys.has(e.optimisticOrder[t]);)de(e.optimisticOrder[t]);R=I=P=null,e.defer||(e.defer=!0,Promise.resolve().then((function(){G("write",e,null),$(),ve(),V(),e.defer=!1})))},U=function(e,t,r){G("read",e,t,r),V()},J=function(){return g(null!==R,"",2),R},B=function(e,t,r,n){var i=(e=C?e.optimistic[C]:e.base).get(t);void 0===i&&e.set(t,i=D()),void 0!==n||C?i[r]=n:delete i[r]},z=function(e,t,r){for(var n,i=0,o=I.optimisticOrder.length;i<o;i++){var a=I.optimisticOrder[i],u=e.optimistic[a];if(u&&(!Q||I.commutativeKeys.has(a))&&void 0!==(n=u.get(t))&&r in n)return n[r]}return void 0!==(n=e.base.get(t))?n[r]:void 0},X=function(e,t,r,n){var i=void 0!==t[r]?t[r]:0;t=t[r]=i+n|0,void 0!==e&&(0>=t?e.add(r):0>=i&&0<t&&e.delete(r))},H=function(e,t,r,n){if("string"==typeof r)X(e,t,r,n);else if(Array.isArray(r))for(var i=0,o=r.length;i<o;i++){var a=r[i];a&&X(e,t,a,n)}},W=function(e,t,r){if(void 0!==r)for(var n in r)t.has(n)||(e.push(M(n)),t.add(n))},Y=function(e,t,r,n){W(e,t,n.base.get(r));for(var i=0,o=I.optimisticOrder.length;i<o;i++){var a=n.optimistic[I.optimisticOrder[i]];void 0!==a&&W(e,t,a.get(r))}};function Z(e,t,r){if(0<(I.refCount[e]||0))r.delete(e);else{for(var n in I.refLock){if(0<((t=I.refLock[n])[e]||0))return;delete t[e]}if(delete I.refCount[e],r.delete(e),I.records.base.delete(e),n=I.links.base.get(e))for(var i in I.links.base.delete(e),n)H(r,I.refCount,n[i],-1)}}var $=function(){I.gc.forEach(Z)},ee=function(e,t){"__typename"!==t&&(e!==I.queryRootKey?R[e]=!0:void 0!==t&&(R[A(e,t)]=!0))},te=function(e,t){!Q&&I.storage&&I.persist.add(function(e,t){return e.replace(/\./g,"%2e")+"."+t}(e,t))},re=function(e,t){return ee(e,t),z(I.records,e,t)},ne=function(e,t){return ee(e,t),z(I.links,e,t)},ie=function(e,t,r){ee(e,t),te(e,t),B(I.records,e,t,r)},oe=function(e,t,r){var n=I;if(C)var i=n.refLock[C]||(n.refLock[C]=D()),o=n.links.optimistic[C];else{i=n.refCount,o=n.links.base;var a=n.gc}o=(o=o&&o.get(e))&&o[t],ee(e,t),te(e,t),B(n.links,e,t,r),H(a,i,o,-1),H(a,i,r,1)},ae=function(e,t){var r=e.optimisticOrder.indexOf(t);-1===r?e.optimisticOrder.unshift(t):e.commutativeKeys.has(t)||(se(e,t),e.optimisticOrder.splice(r,1),e.optimisticOrder.unshift(t)),e.commutativeKeys.add(t)},ue=function(e,t){-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=D(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)},se=function(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])},fe=function(e,t){var r=e.optimisticOrder.indexOf(t);-1<r&&(e.optimisticOrder.splice(r,1),e.commutativeKeys.delete(t)),se(e,t)};function le(e,t){for(var r in e)oe(t,r,e[r])}function ce(e,t){for(var r in e)ie(t,r,e[r])}var de=function(e){var t=R;R=D();var r=I.links.optimistic[e];r&&r.forEach(le),(r=I.records.optimistic[e])&&r.forEach(ce),R=t,fe(I,e)},pe=function(e){var t=I.links,r=I.records,n=[],i=new Set;return ee(e),Y(n,i,e,t),Y(n,i,e,r),n},ve=function(){if(I.storage){Q=!0;var e=D();I.persist.forEach((function(t){var r,n=L(t),o=n.entityKey;e[t]=void 0!==(r=ne(o,n=n.fieldKey))?":"+i.stringifyVariables(r):void 0!==(r=re(o,n))?i.stringifyVariables(r):void 0})),Q=!1,I.storage.writeData(e),I.persist.clear()}},ye=function(e,t,r,n,i,o){return{store:e,variables:t,fragments:r,parentTypeName:n,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},me=function(e,t,r,n,i){e.parentTypeName=t,e.parentKey=r,e.parentFieldKey=n,e.fieldName=i},he=function(e,t,r,n){return!(!t||t!==d(e)&&c(e).some((function(e){return!!p(e)&&(e=F(s(e),y(e,n)),!function(e,t){return void 0!==re(e,t)||void 0!==ne(e,t)}(r,e))})))},ge=function(e,t,r,n){var i=[0],o=[r];return{next:function(){for(;0!==i.length;){var r=i[i.length-1]++,a=o[o.length-1];if(r>=a.length)i.pop(),o.pop();else if(x(r=a[r],n.variables))if(p(r)){if("__typename"!==s(r))return r}else void 0!==(r=v(r)?r:n.fragments[s(r)])&&(n.store.schema?S(n.store.schema,d(r),e):he(r,e,t,n.variables))&&(i.push(0),o.push(c(r)))}}}},ke=function(e){return void 0===e?null:e},be=function(e,t,r,n){return G("write",e.data,n||null),e=qe(e,t,r),V(),e},qe=function(e,t,r){var n=q(t.query),i={data:r,dependencies:J()},o=e.rootFields[n.operation];return e=ye(e,h(n,t.variables),_(t.query),o,o),_e(e,o,c(n),r),i},Oe=function(e,t,r){G("write",e.data,r,!0),r=q(t.query);var n={data:{},dependencies:J()},i=e.rootFields[r.operation];return g(i===e.rootFields.mutation,"",10),e=ye(e,h(r,t.variables),_(t.query),i,i,!0),_e(e,i,c(r),n.data),V(),n},_e=function(e,t,r,n){var i=t===e.store.rootFields.query,o=!i&&!!e.store.rootNames[t],a=o||i?t:n.__typename;if(a){o||i||!t||ie(t,"__typename",a),r=ge(a,t||a,r,e);for(var u;u=r.next();){i=s(u);var f=y(u,e.variables),d=F(i,f),p=l(u),v=n[p];if(e.optimistic&&o){if(!(v=e.store.optimisticMutations[i]))continue;me(e,a,a,d,i),v=n[p]=ke(v(f||{},e.store,e))}u.selectionSet?t&&!o?(p=A(t,d),u=xe(e,c(u),ke(v),p),oe(t||a,d,u)):xe(e,c(u),ke(v)):t&&!o&&ie(t||a,d,v),o&&(me(e,a,a,A(a,d),i),d=e.store.updates[a][i])&&(n[i]=v,d(n,f||{},e.store,e))}}},xe=function(e,t,r,n){if(Array.isArray(r)){for(var i=Array(r.length),o=0,a=r.length;o<a;o++){var u=r[o],s=n?A(n,""+o):void 0;u=xe(e,t,u,s),i[o]=u}return i}return null===r?null:(n=e.store.keyOfEntity(r)||n,_e(e,n,t,r),n||null)},we=function(e){var t;this.keyOfField=F,e||(e={}),this.resolvers=e.resolvers||{},this.optimisticMutations=e.optimistic||{},this.keys=e.keys||{},this.updates={Mutation:e.updates&&e.updates.Mutation||{},Subscription:e.updates&&e.updates.Subscription||{}};var r="Query",n="Mutation",i="Subscription";if(e.schema){var a=this.schema=o.buildClientSchema(e.schema);e=a.getQueryType();var u=a.getMutationType();a=a.getSubscriptionType(),e&&(r=e.name),u&&(n=u.name),a&&(i=a.name)}this.rootFields={query:r,mutation:n,subscription:i},this.rootNames=((t={})[r]="query",t[n]="mutation",t[i]="subscription",t),this.data=function(e){return{defer:!1,gc:new Set,persist:new Set,queryRootKey:e,refCount:D(),refLock:D(),links:j(),records:j(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(r)};we.prototype.keyOfEntity=function(e){var t,r=e.__typename,n=e.id,i=e._id;return r?void 0!==this.rootNames[r]?r:(this.keys[r]?t=this.keys[r](e):null!=n?t=""+n:null!=i&&(t=""+i),t?r+":"+t:null):null},we.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var r=re(e,t);return void 0!==r?r:(t=ne(e,t))?t:null},we.prototype.resolve=function(e,t,r){return this.resolveFieldByKey(e,F(t,r))},we.prototype.invalidate=function(e,t,r){g(e="string"==typeof e?e:this.keyOfEntity(e),"",19),function(e,t,r){t=t?[{fieldKey:F(t,r)}]:pe(e),r=0;for(var n=t.length;r<n;r++){var i=t[r].fieldKey;void 0!==ne(e,i)?oe(e,i,void 0):ie(e,i,void 0)}}(e,t,r)},we.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?pe(e):[]},we.prototype.updateQuery=function(e,t){e=i.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&qe(this,e,t)},we.prototype.readQuery=function(e){return Ke(this,i.createRequest(e.query,e.variables)).data},we.prototype.readFragment=function(e,t,r){return Te(this,e,t,r)},we.prototype.writeFragment=function(t,r,n){!function(t,r,n,i){r=_(r);var o=Object.keys(r);if(void 0!==(o=r[o[0]])){var a=f(o);n=e._extends({},{__typename:a},n);var u=t.keyOfEntity(n);u&&(t=ye(t,i||{},r,a,u),_e(t,u,c(o),n))}}(this,t,r,n)};var Ne=function(e,t,r){return G("read",e.data,null),e=Ke(e,t,r),V(),e},Ke=function(e,t,r){var n=q(t.query),i=e.rootFields[n.operation],o=c(n);return r=r||{},r=i!==(e=ye(e,h(n,t.variables),_(t.query),i,i)).store.rootFields.query?Se(e,i,o,r):Fe(e,i,o,r),{dependencies:J(),partial:void 0!==r&&e.partial,data:void 0===r?null:r}},Se=function(e,t,r,n){if("string"!=typeof n.__typename)return n;t=ge(t,t,r,e),(r={}).__typename=n.__typename;for(var i;void 0!==(i=t.next());){var o=l(i),a=n[o];void 0!==i.selectionSet&&null!==a?(a=ke(a),r[o]=Ee(e,c(i),a)):r[o]=a}return r},Ee=function(e,t,r){if(Array.isArray(r)){for(var n=Array(r.length),i=0,o=r.length;i<o;i++)n[i]=Ee(e,t,r[i]);return n}return null===r?null:null!==(n=e.store.keyOfEntity(r))?void 0===(e=Fe(e,n,t,{}))?null:e:Se(e,r.__typename,t,r)},Te=function(t,r,n,i){r=_(r);var o=Object.keys(r);if(void 0===(o=r[o[0]]))return null;var a=f(o);return"string"==typeof n||n.__typename||(n.__typename=a),(n="string"!=typeof n?t.keyOfEntity(e._extends({},{__typename:a},n)):n)?(t=ye(t,i||{},r,a,n),Fe(t,n,c(o),{})||null):null},Fe=function(e,t,r,n,i){var o=e.store,a=t===o.rootFields.query,u=i&&o.keyOfEntity(i)||t;if("string"==typeof(t=a?t:re(u,"__typename")||i&&i.__typename)&&(!i||t===i.__typename)){n.__typename=t,r=ge(t,u,r,e);for(var f,d=!1,p=!1;void 0!==(f=r.next());){var v=s(f),m=y(f,e.variables),h=l(f),k=F(v,m),b=A(u,k),q=re(u,k),O=i?i[v]:void 0,_=o.resolvers[t],x=void 0;if(void 0!==O&&void 0===f.selectionSet)x=O;else if("read"===(g(null!==P,"",2),P)&&_&&"function"==typeof _[v]){if(me(e,t,u,b,v),void 0!==q&&(n[h]=q),x=_[v](n,m||{},o,e),void 0!==f.selectionSet&&(x=Ae(e,t,v,b,c(f),n[h]||{},x)),o.schema&&null===x&&!N(o.schema,t,v))return}else void 0===f.selectionSet?x=q:void 0!==O?x=Ae(e,t,v,b,c(f),n[h],O):void 0!==(m=ne(u,k))?x=Me(e,m,t,v,c(f),n[h]):"object"==typeof q&&null!==q&&(x=q);if(void 0===x&&o.schema&&N(o.schema,t,v))p=!0,n[h]=null;else{if(void 0===x)return;d=!0,n[h]=x}}return p&&(e.partial=!0),a&&p&&!d?void 0:n}},Ae=function(e,t,r,n,i,o,a){if(Array.isArray(a)){var u=e.store;u=!u.schema||K(u.schema,t,r);for(var s=Array(a.length),f=0,l=a.length;f<l;f++){var c=Ae(e,t,r,A(n,""+f),i,null!=o?o[f]:void 0,a[f]);if(void 0===c&&!u)return;s[f]=void 0!==c?c:null}return s}return null==a?a:null===o?null:Le(a)?(t=o||{},"string"==typeof a?Fe(e,a,i,t):Fe(e,n,i,t,a)):void 0},Me=function(e,t,r,n,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&K(a.schema,r,n);for(var u=Array(t.length),s=0,f=t.length;s<f;s++){var l=Me(e,t[s],r,n,i,null!=o?o[s]:void 0);if(void 0===l&&!a)return;u[s]=void 0!==l?l:null}return u}return null===t||null===o?null:Fe(e,t,i,o||{})},Le=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},De=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:r})})})},Pe=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:r})})};function Ie(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Re(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function Ce(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}var Qe=function(t){return function(r){function n(e){return De(e.operation,"miss")}function o(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy&&!x(e.dependencies)}function u(e){var t=e.operation,r=e.outcome,n=e.dependencies;return e={operation:De(t,r),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===r)&&(e.stale=!0,x(n)?"cache-and-network"===t.context.requestPolicy&&O.add(t.key):v.reexecuteOperation(Pe(t,"network-only"))),e}function s(e){var t=new Set,r=T(e,t);return N(e.operation,t),r}function f(e){return!h.has(e.operation.key)}function l(e){if(g.push(e)<h.size)return a.empty;for(var t=0;t<g.length;t++)ae(y.data,g[t].operation.key);for(var r in b)delete b[r];t=[],r=new Set;for(var n;n=g.shift();)t.push(T(n,r));return N(e.operation,r),a.fromArray(t)}function c(e){return h.has(e.operation.key)}var d,p=r.forward,v=r.client,y=new we(t);t&&t.storage&&(d=t.storage.readData().then((function(e){!function(e,t,r){for(var n in G("read",e,null),r){var i=r[n];if(void 0!==i){var o=L(n),a=o.entityKey;o=o.fieldKey,":"===i[0]?oe(a,o,JSON.parse(i.slice(1))):ie(a,o,JSON.parse(i))}}V(),e.storage=t}(y.data,t.storage,e)})));var h=new Map,g=[],k=new Map,b=D(),O=new Set,_=D(),x=function(e){for(var t in e)if(b[t])return!0;return!1},w=function(e,t){if(t)for(var r in t)if(t=_[r]){_[r]=[];for(var n=0,i=t.length;n<i;n++)e.add(t[n])}},N=function(e,t){t.forEach((function(t){if(t!==e.key){var r=k.get(t);if(r){k.delete(t);var n="cache-first";O.has(t)&&(O.delete(t),n="cache-and-network"),v.reexecuteOperation(Pe(r,n))}}}))},K=function(t){if("query"===t.operationName)ae(y.data,t.key);else if("teardown"===t.operationName)k.delete(t.key),U(y.data,t.key);else if("mutation"===t.operationName&&"network-only"!==t.context.requestPolicy){var r=Oe(y,t,t.key).dependencies;if(!function(e){for(var t in e)return!1;return!0}(r)){for(var n in r)b[n]=!0;h.set(t.key,r),n=new Set,w(n,r),N(t,n)}}return e._extends({},t,{variables:t.variables?m(q(t.query),t.variables):t.variables,query:i.formatDocument(t.query)})},S=function(e,t){for(var r in t)(_[r]||(_[r]=[])).push(e.key),k.set(e.key,e)},E=function(e){var t=Ne(y,e),r=t.data?t.partial?"partial":"hit":"miss";return S(e,t.dependencies),{outcome:r,operation:e,data:t.data,dependencies:t.dependencies}},T=function(e,t){var r=e.operation,n=e.error,i=e.extensions,o=r.key;if("mutation"===r.operationName){var a=h.get(o);w(t,a),h.delete(o)}else ae(y.data,r.key);if(e.data){if(o=be(y,r,e.data,o).dependencies,w(t,o),o=Ne(y,r,e.data),e.data=o.data,"query"===r.operationName){var u=o.dependencies;w(t,u)}}else U(y.data,r.key);return u&&S(e.operation,u),{data:e.data,error:n,extensions:i,operation:r}};return function(e){e=a.share(e);var t=d?a.mergeMap(a.fromArray)(a.take(1)(a.buffer(a.fromPromise(d))(e))):a.empty;t=a.share(a.concat([t,e])),e=a.share(a.map(E)(a.filter(Ie)(t))),t=a.filter(Re)(t);var r=a.map(n)(a.filter(o)(e));return e=a.map(u)(a.filter(Ce)(e)),r=a.share(p(a.map(K)(a.merge([t,r])))),t=a.map(s)(a.filter(f)(r)),r=a.mergeMap(l)(a.filter(c)(r)),a.merge([t,r,e])}}};function je(e){return{query:u.print(e.query),variables:e.variables}}exports.Store=we,exports.cacheExchange=Qe,exports.noopDataState=U,exports.offlineExchange=function(e){return function(t){function r(e){return"subscription"===e.operation.operationName||!function(e){return e&&e.networkError&&!e.response&&("undefined"!=typeof navigator&&!1===navigator.onLine||/request failed|failed to fetch|network\s?error/i.test(e.networkError.message))}(e.error)||"mutation"===e.operation.operationName&&(!function(e,t){var r,n=t.variables||D(),i=_(t.query);for(t=[].concat(c(q(t.query)));r=t.pop();)if(x(r,n))if(p(r)){if(e[s(r)])return!0}else(r=v(r)?r:i[s(r)])&&t.push.apply(t,c(r));return!1}(l,e.operation)||(d.push(e.operation),y(),!1))}var n=t.forward,o=t.client;t=t.dispatchDebug;var u=e.storage,f=n;if(u&&u.onOnline&&u.readMetadata&&u.writeMetadata){var l=e.optimistic||{},d=[],y=function(){u.writeMetadata(d.map(je))},m=!1,h=function(){for(var e;!m&&(e=d.shift());)m=!0,o.dispatchOperation(o.createRequestOperation("mutation",e)),m=!1;y()};f=function(e){return a.filter(r)(n(e))},u.onOnline(h),u.readMetadata().then((function(e){if(e)for(var t=0;t<e.length;t++)d.push(i.createRequest(e[t].query,e[t].variables));h()}))}return Qe(e)({forward:f,client:o,dispatchDebug:t})}},exports.query=Ne,exports.reserveLayer=ae,exports.write=be,exports.writeOptimistic=Oe;
//# sourceMappingURL=urql-exchange-graphcache.min.js.map

@@ -18,5 +18,5 @@ {

"dependencies": {
"@urql/core": ">=1.12.1",
"@urql/core": ">=1.12.3",
"wonka": "^4.0.14"
}
}
{
"name": "@urql/exchange-graphcache",
"version": "3.0.1",
"version": "3.0.2",
"description": "A normalized and configurable cache exchange for urql",

@@ -68,3 +68,3 @@ "sideEffects": false,

"dependencies": {
"@urql/core": ">=1.12.1",
"@urql/core": ">=1.12.3",
"wonka": "^4.0.14"

@@ -71,0 +71,0 @@ },

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