@urql/exchange-graphcache
Advanced tools
Comparing version 2.4.1 to 2.4.2
# @urql/exchange-graphcache | ||
## 2.4.2 | ||
### Patch Changes | ||
- Add `source` debug name to all `dispatchDebug` calls during build time to identify events by which exchange dispatched them, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#780](https://github.com/FormidableLabs/urql/pull/780)) | ||
- ⚠️ Fix Introspection Queries (or internal types in general) triggering lots of warnings for unkeyed entities, by [@kitten](https://github.com/kitten) (See [#779](https://github.com/FormidableLabs/urql/pull/779)) | ||
- Updated dependencies (See [#780](https://github.com/FormidableLabs/urql/pull/780)) | ||
- @urql/core@1.11.7 | ||
## 2.4.1 | ||
@@ -4,0 +13,0 @@ |
@@ -74,3 +74,3 @@ "use strict"; | ||
var ensureData, write, startWrite, writeOptimistic, writeFragment, writeSelection, writeField, invalidateEntity, invalidate, Store, query, read, readRoot, readRootField, readFragment, readSelection, resolveResolverResult, resolveLink, isDataOrKey, addCacheOutcome, toRequestPolicy, cacheExchange, _rollupPluginBabelHelpers = require("./7832a774.js"), valueFromASTUntyped = require("graphql/utilities/valueFromASTUntyped"), kinds = require("graphql/language/kinds"), definition = require("graphql/type/definition"), core = require("@urql/core"), buildClientSchema = require("graphql/utilities/buildClientSchema"), wonka = require("wonka"), exchangePopulate = require("@urql/exchange-populate"), getName = function(a) { | ||
var ensureData, write, startWrite, writeOptimistic, writeFragment, writeSelection, KEYLESS_TYPE_RE, writeField, invalidateEntity, invalidate, Store, query, read, readRoot, readRootField, readFragment, readSelection, resolveResolverResult, resolveLink, isDataOrKey, addCacheOutcome, toRequestPolicy, cacheExchange, _rollupPluginBabelHelpers = require("./7832a774.js"), valueFromASTUntyped = require("graphql/utilities/valueFromASTUntyped"), kinds = require("graphql/language/kinds"), definition = require("graphql/type/definition"), core = require("@urql/core"), buildClientSchema = require("graphql/utilities/buildClientSchema"), wonka = require("wonka"), exchangePopulate = require("@urql/exchange-populate"), getName = function(a) { | ||
return a.name.value; | ||
@@ -525,3 +525,3 @@ }, getFragmentTypeName = function(a) { | ||
} | ||
}, writeField = function(a, b, c, d) { | ||
}, KEYLESS_TYPE_RE = /^__|PageInfo|(Connection|Edge)$/, writeField = function(a, b, c, d) { | ||
var e, f, g, h, k; | ||
@@ -541,3 +541,3 @@ if (Array.isArray(c)) { | ||
f = c.__typename; | ||
!d || void 0 !== a.store.keys[c.__typename] || null !== e || "string" != typeof f || f.endsWith("Connection") || f.endsWith("Edge") || "PageInfo" === f || "production" !== process.env.NODE_ENV && warn("Invalid key: The GraphQL query at the field at `" + d + "` has a selection set, but no key could be generated for the data at this field.\nYou have to request `id` or `_id` fields for all selection sets or create a custom `keys` config for `" + f + "`.\nEntities without keys will be embedded directly on the parent entity. If this is intentional, create a `keys` config for `" + f + "` that always returns null.", 15); | ||
d && void 0 === a.store.keys[c.__typename] && null === e && "string" == typeof f && !KEYLESS_TYPE_RE.test(f) && "production" !== process.env.NODE_ENV && warn("Invalid key: The GraphQL query at the field at `" + d + "` has a selection set, but no key could be generated for the data at this field.\nYou have to request `id` or `_id` fields for all selection sets or create a custom `keys` config for `" + f + "`.\nEntities without keys will be embedded directly on the parent entity. If this is intentional, create a `keys` config for `" + f + "` that always returns null.", 15); | ||
writeSelection(a, d = e || d, b, c); | ||
@@ -806,3 +806,4 @@ return d || null; | ||
message: "The result could not be retrieved from the cache", | ||
operation: a.operation | ||
operation: a.operation, | ||
source: "cacheExchange" | ||
}); | ||
@@ -830,3 +831,4 @@ return addCacheOutcome(a.operation, "miss"); | ||
value: e | ||
} | ||
}, | ||
source: "cacheExchange" | ||
}); | ||
@@ -833,0 +835,0 @@ return e; |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("./1cc90026.min.js"),t=require("graphql/utilities/valueFromASTUntyped"),n=require("graphql/language/kinds"),r=require("graphql/type/definition"),i=require("@urql/core"),o=require("graphql/utilities/buildClientSchema"),a=require("wonka"),u=require("@urql/exchange-populate"),s=function(e){return e.name.value},c=function(e){return e.typeCondition.name.value},l=function(e){return e.alias?e.alias.value:s(e)},f=function(e){return e.selectionSet?e.selectionSet.selections:[]},d=function(e){return(e=e.typeCondition)?s(e):null},p=function(e){return e.kind===n.Kind.FIELD},y=function(e){return e.kind===n.Kind.INLINE_FRAGMENT},v=function(e,n){var r={},i=0;if(e.arguments&&e.arguments.length)for(var o=0,a=e.arguments.length;o<a;o++){var u=e.arguments[o],c=t.valueFromASTUntyped(u.value,n);null!=c&&(r[s(u)]=c,i++)}return 0<i?r:null},m=function(e,t){if(t&&e.variableDefinitions){for(var n={},r=0,i=e.variableDefinitions.length;r<i;r++){var o=s(e.variableDefinitions[r].variable);n[o]=t[o]}return n}},h=function(e,n){var r={};if(!n)return r;if(e.variableDefinitions)for(var i=0,o=e.variableDefinitions.length;i<o;i++){var a=e.variableDefinitions[i],u=s(a.variable);r[u]=void 0===n[u]&&a.defaultValue?t.valueFromASTUntyped(a.defaultValue,n):n[u]}for(var c in n)c in r||(r[c]=n[c]);return r};function g(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}var k=function(e){return e.kind===n.Kind.FRAGMENT_DEFINITION};function x(e){return e.kind===n.Kind.OPERATION_DEFINITION}var b=function(e){return g(!!(e=e.definitions.find(x)),"",1),e};function q(e,t){return e[s(t)]=t,e}var _=function(e){return e.definitions.filter(k).reduce(q,{})},O=function(e,n){var r=e.directives;if(!r)return!0;for(var i=0,o=r.length;i<o;i++){var a=r[i];if(("include"===(e=s(a))||"skip"===e)&&a.arguments&&a.arguments[0]&&"if"===s(a.arguments[0]))return n=t.valueFromASTUntyped(a.arguments[0].value,n),"include"===e?!!n:!n}return!0},S=function(e,t,n){return!!(e=N(e,t,n))&&r.isNullableType(e.type)},K=function(e,t,n){return!!(e=N(e,t,n))&&(e=r.isNonNullType(e.type)?e.type.ofType:e.type,r.isListType(e)&&r.isNullableType(e.ofType))},w=function(e,t,n){return!(!n||!t)&&(n===t||(t=e.getType(t),n=e.getType(n),t instanceof r.GraphQLObjectType?t===n:(function(e,t){g(e instanceof r.GraphQLInterfaceType||e instanceof r.GraphQLUnionType,"",5)}(t),T(n),e.isPossibleType(t,n))))},N=function(e,t,n){return T(e=e.getType(t)),e.getFields()[n]};function T(e,t){g(e instanceof r.GraphQLObjectType,"",3)}var E=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}},L=function(e){var t=e.indexOf(".");return{entityKey:e.slice(0,t).replace(/%2e/g,"."),fieldKey:e=e.slice(t+1)}},M=function(){return Object.create(null)},P="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},D=null,R=null,I=null,C=null,Q=!1,j=function(){return{optimistic:M(),base:new Map}},G=function(e,t,n){D=e,I=R,R=M(),Q=!1,t?n||0<e.optimisticOrder.length?(n||e.commutativeKeys.has(t)?n&&e.commutativeKeys.delete(t):se(e,t),C=t,ce(e,t)):(C=null,fe(e,t)):C=null},U=function(){var e=D,t=C;if(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]);)ye(e.optimisticOrder[t]);e.defer||(e.defer=!0,P((function(){G(e,null),te(),me(),U(),e.defer=!1}))),R=D=null},V=function(e,t,n){G(e,t,n),U()},W=function(){return g(null!==R,"",2),R},J=function(){return I=R,R=M()},B=function(){R=I,I=null},z=function(e,t,n,r){var i=(e=C?e.optimistic[C]:e.base).get(t);void 0===i&&e.set(t,i=M()),void 0!==r||C?i[n]=r:delete i[n]},H=function(e,t,n){for(var r,i=0,o=D.optimisticOrder.length;i<o;i++){var a=D.optimisticOrder[i],u=e.optimistic[a];if(u&&(!Q||D.commutativeKeys.has(a))&&void 0!==(r=u.get(t))&&n in r)return r[n]}return void 0!==(r=e.base.get(t))?r[n]:void 0},X=function(e,t,n,r){var i=void 0!==t[n]?t[n]:0;t=t[n]=i+r|0,void 0!==e&&(0>=t?e.add(n):0>=i&&0<t&&e.delete(n))},Y=function(e,t,n,r){if("string"==typeof n)X(e,t,n,r);else if(Array.isArray(n))for(var i=0,o=n.length;i<o;i++){var a=n[i];a&&X(e,t,a,r)}},Z=function(e,t,n){if(void 0!==n)for(var r in n)t.has(r)||(e.push(A(r)),t.add(r))},$=function(e,t,n,r){Z(e,t,r.base.get(n));for(var i=0,o=D.optimisticOrder.length;i<o;i++){var a=r.optimistic[D.optimisticOrder[i]];void 0!==a&&Z(e,t,a.get(n))}};function ee(e,t,n){if(0<(D.refCount[e]||0))n.delete(e);else{for(var r in D.refLock){if(0<((t=D.refLock[r])[e]||0))return;delete t[e]}if(delete D.refCount[e],n.delete(e),D.records.base.delete(e),r=D.links.base.get(e))for(var i in D.links.base.delete(e),r)Y(n,D.refCount,r[i],-1)}}var te=function(){D.gc.forEach(ee)},ne=function(e,t){"__typename"!==t&&(e!==D.queryRootKey?R[e]=!0:void 0!==t&&(R[F(e,t)]=!0))},re=function(e,t){D.storage&&D.persist.add(function(e,t){return e.replace(/\./g,"%2e")+"."+t}(e,t))},ie=function(e,t){return ne(e,t),H(D.records,e,t)},oe=function(e,t){return ne(e,t),H(D.links,e,t)},ae=function(e,t,n){ne(e,t),re(e,t),z(D.records,e,t,n)},ue=function(e,t,n){var r=D;if(C)var i=r.refLock[C]||(r.refLock[C]=M()),o=r.links.optimistic[C];else{i=r.refCount,o=r.links.base;var a=r.gc}o=(o=o&&o.get(e))&&o[t],ne(e,t),re(e,t),z(r.links,e,t,n),Y(a,i,o,-1),Y(a,i,n,1)},se=function(e,t){var n=e.optimisticOrder.indexOf(t);-1===n?e.optimisticOrder.unshift(t):e.commutativeKeys.has(t)||(le(e,t),e.optimisticOrder.splice(n,1),e.optimisticOrder.unshift(t)),e.commutativeKeys.add(t)},ce=function(e,t){-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=M(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)},le=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 n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),le(e,t)};function de(e,t){for(var n in e)ue(t,n,e[n])}function pe(e,t){for(var n in e)ae(t,n,e[n])}var ye=function(e){J();var t=D.links.optimistic[e];t&&t.forEach(de),(t=D.records.optimistic[e])&&t.forEach(pe),B(),fe(D,e)},ve=function(e){var t=D.links,n=D.records,r=[],i=new Set;return ne(e),$(r,i,e,t),$(r,i,e,n),r},me=function(){if(D.storage){var e=M();Q=!0,D.persist.forEach((function(t){var n,r=L(t),o=r.entityKey;e[t]=void 0!==(n=oe(o,r=r.fieldKey))?":"+i.stringifyVariables(n):void 0!==(n=ie(o,r))?i.stringifyVariables(n):void 0})),Q=!1,D.storage.write(e),D.persist.clear()}},he=function(e,t,n,r,i,o){return{store:e,variables:t,fragments:n,parentTypeName:r,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},ge=function(e,t,n,r,i){e.parentTypeName=t,e.parentKey=n,e.parentFieldKey=r,e.fieldName=i},ke=function(e,t,n,r){return!(!t||t!==d(e)&&f(e).some((function(e){return!!p(e)&&(e=E(s(e),v(e,r)),!function(e,t){return void 0!==ie(e,t)||void 0!==oe(e,t)}(n,e))})))},xe=function(e,t,n,r){this.typename=e,this.entityKey=t,this.context=r,this.indexStack=[0],this.selectionStack=[n]};xe.prototype.next=function(){for(;0!==this.indexStack.length;){var e=this.indexStack[this.indexStack.length-1]++,t=this.selectionStack[this.selectionStack.length-1];if(e>=t.length)this.indexStack.pop(),this.selectionStack.pop();else if(O(e=t[e],this.context.variables))if(p(e)){if("__typename"!==s(e))return e}else void 0!==(e=y(e)?e:this.context.fragments[s(e)])&&(this.context.store.schema?w(this.context.store.schema,d(e),this.typename):ke(e,this.typename,this.entityKey,this.context.variables))&&(this.indexStack.push(0),this.selectionStack.push(f(e)))}};var be=function(e){return void 0===e?null:e},qe=function(e,t,n,r){return G(e.data,r||null),e=_e(e,t,n),U(),e},_e=function(e,t,n){var r=b(t.query),i={data:n,dependencies:W()},o=e.rootFields[r.operation];return e=he(e,h(r,t.variables),_(t.query),o,o),Se(e,o,f(r),n),i},Oe=function(e,t,n){G(e.data,n,!0),n=b(t.query);var r={data:{},dependencies:W()},i=e.rootFields[n.operation];return g(i===e.rootFields.mutation,"",10),e=he(e,h(n,t.variables),_(t.query),i,i,!0),Se(e,i,f(n),r.data),U(),r},Se=function(e,t,n,r){var i=t===e.store.rootFields.query,o=!i&&!!e.store.rootNames[t],a=o||i?t:r.__typename;if(a){o||i||!t||ae(t,"__typename",a),n=new xe(a,t||a,n,e);for(var u;u=n.next();){i=s(u);var c=v(u,e.variables),d=E(i,c),p=l(u),y=r[p];if(e.optimistic&&o){if(!(y=e.store.optimisticMutations[i]))continue;ge(e,a,a,d,i),y=r[p]=be(y(c||{},e.store,e))}u.selectionSet?t&&!o?(p=F(t,d),u=Ke(e,f(u),be(y),p),ue(t||a,d,u)):Ke(e,f(u),be(y)):t&&!o&&ae(t||a,d,y),o&&(ge(e,a,a,F(a,d),i),d=e.store.updates[a][i])&&(r[i]=y,d(r,c||{},e.store,e))}}},Ke=function(e,t,n,r){if(Array.isArray(n)){for(var i=Array(n.length),o=0,a=n.length;o<a;o++){var u=n[o],s=r?F(r,""+o):void 0;u=Ke(e,t,u,s),i[o]=u}return i}return null===n?null:(i=e.store.keyOfEntity(n),o=n.__typename,!r||void 0!==e.store.keys[n.__typename]||null!==i||"string"!=typeof o||o.endsWith("Connection")||o.endsWith("Edge"),Se(e,r=i||r,t,n),r||null)},we=function(e,t,n){t=t?[{fieldKey:E(t,n)}]:ve(e),n=0;for(var r=t.length;n<r;n++){var i=t[n].fieldKey;void 0!==oe(e,i)?ue(e,i,void 0):ae(e,i,void 0)}},Ne=function(e){var t;this.keyOfField=E,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 n="Query",r="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&&(n=e.name),u&&(r=u.name),a&&(i=a.name)}this.rootFields={query:n,mutation:r,subscription:i},this.rootNames=((t={})[n]="query",t[r]="mutation",t[i]="subscription",t),this.data=function(e){return{defer:!1,gc:new Set,persist:new Set,queryRootKey:e,refCount:M(),refLock:M(),links:j(),records:j(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(n)};Ne.prototype.keyOfEntity=function(e){var t,n=e.__typename,r=e.id,i=e._id;return n?void 0!==this.rootNames[n]?n:(this.keys[n]?t=this.keys[n](e):null!=r?t=""+r:null!=i&&(t=""+i),t?n+":"+t:null):null},Ne.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=ie(e,t);return void 0!==n?n:(t=oe(e,t))?t:null},Ne.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,E(t,n))},Ne.prototype.invalidateQuery=function(e,t){!function(e,t){var n=J();for(var r in Ee(e,t),B(),n)r.startsWith(e.data.queryRootKey+".")?(t=r.slice((e.data.queryRootKey+".").length),ue(e.data.queryRootKey,t),ae(e.data.queryRootKey,t)):we(r);te()}(this,i.createRequest(e,t))},Ne.prototype.invalidate=function(e,t,n){g(e="string"==typeof e?e:this.keyOfEntity(e),"",19),we(e,t,n)},Ne.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?ve(e):[]},Ne.prototype.updateQuery=function(e,t){e=i.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&_e(this,e,t)},Ne.prototype.readQuery=function(e){return Ee(this,i.createRequest(e.query,e.variables)).data},Ne.prototype.readFragment=function(e,t,n){return Le(this,e,t,n)},Ne.prototype.writeFragment=function(t,n,r){!function(t,n,r,i){n=_(n);var o=Object.keys(n);if(void 0!==(o=n[o[0]])){var a=c(o);r=e._extends({},{__typename:a},r);var u=t.keyOfEntity(r);u&&(t=he(t,i||{},n,a,u),Se(t,u,f(o),r))}}(this,t,n,r)};var Te=function(e,t,n){return G(e.data,null),e=Ee(e,t,n),U(),e},Ee=function(e,t,n){var r=b(t.query),i=e.rootFields[r.operation],o=f(r);return n=n||{},n=i!==(e=he(e,h(r,t.variables),_(t.query),i,i)).store.rootFields.query?Fe(e,i,o,n):Me(e,i,o,n),{dependencies:W(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}},Fe=function(e,t,n,r){if("string"!=typeof r.__typename)return r;t=new xe(t,t,n,e),(n={}).__typename=r.__typename;for(var i;void 0!==(i=t.next());){var o=l(i),a=r[o];void 0!==i.selectionSet&&null!==a?(a=be(a),n[o]=Ae(e,f(i),a)):n[o]=a}return n},Ae=function(e,t,n){if(Array.isArray(n)){for(var r=Array(n.length),i=0,o=n.length;i<o;i++)r[i]=Ae(e,t,n[i]);return r}return null===n?null:null!==(r=e.store.keyOfEntity(n))?void 0===(e=Me(e,r,t,{}))?null:e:Fe(e,n.__typename,t,n)},Le=function(t,n,r,i){n=_(n);var o=Object.keys(n);if(void 0===(o=n[o[0]]))return null;var a=c(o);return"string"==typeof r||r.__typename||(r.__typename=a),(r="string"!=typeof r?t.keyOfEntity(e._extends({},{__typename:a},r)):r)?(t=he(t,i||{},n,a,r),Me(t,r,f(o),{})||null):null},Me=function(e,t,n,r,i){var o=e.store,a=t===o.rootFields.query,u=i&&o.keyOfEntity(i)||t;if("string"==typeof(t=a?t:ie(u,"__typename")||i&&i.__typename)&&(!i||t===i.__typename)){r.__typename=t,n=new xe(t,u,n,e);for(var c,d=!1,p=!1;void 0!==(c=n.next());){var y=s(c),m=v(c,e.variables),h=l(c),g=E(y,m),k=F(u,g),x=ie(u,g),b=i?i[y]:void 0,q=o.resolvers[t],_=void 0;if(void 0!==b&&void 0===c.selectionSet)_=b;else if(q&&"function"==typeof q[y]){if(ge(e,t,u,k,y),void 0!==x&&(r[h]=x),_=q[y](r,m||{},o,e),void 0!==c.selectionSet&&(_=Pe(e,t,y,k,f(c),r[h]||{},_)),o.schema&&null===_&&!S(o.schema,t,y))return}else void 0===c.selectionSet?_=x:void 0!==b?_=Pe(e,t,y,k,f(c),r[h],b):void 0!==(m=oe(u,g))?_=De(e,m,t,y,f(c),r[h]):"object"==typeof x&&null!==x&&(_=x);if(void 0===_&&o.schema&&S(o.schema,t,y))p=!0,r[h]=null;else{if(void 0===_)return;d=!0,r[h]=_}}return p&&(e.partial=!0),a&&p&&!d?void 0:r}},Pe=function(e,t,n,r,i,o,a){if(Array.isArray(a)){var u=e.store;u=!u.schema||K(u.schema,t,n);for(var s=Array(a.length),c=0,l=a.length;c<l;c++){var f=Pe(e,t,n,F(r,""+c),i,null!=o?o[c]:void 0,a[c]);if(void 0===f&&!u)return;s[c]=void 0!==f?f:null}return s}return null==a?a:null===o?null:Re(a)?(t=o||{},"string"==typeof a?Me(e,a,i,t):Me(e,r,i,t,a)):void 0},De=function(e,t,n,r,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&K(a.schema,n,r);for(var u=Array(t.length),s=0,c=t.length;s<c;s++){var l=De(e,t[s],n,r,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:Me(e,t,i,o||{})},Re=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},Ie=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:n})})})},Ce=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:n})})};function Qe(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function je(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function Ge(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}exports.populateExchange=u.populateExchange,exports.Store=Ne,exports.cacheExchange=function(t){return function(n){function r(e){return Ie(e.operation,"miss")}function o(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy&&!O(e.dependencies)}function u(e){var t=e.operation,n=e.outcome,r=e.dependencies;return e={operation:Ie(t,n),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===n)&&(e.stale=!0,O(r)?"cache-and-network"===t.context.requestPolicy&&q.add(t.key):y.reexecuteOperation(Ce(t,"network-only"))),e}function s(e){var t=new Set,n=E(e,t);return K(e.operation,t),n}function c(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++)se(v.data,g[t].operation.key);for(var n in x)delete x[n];t=[],n=new Set;for(var r;r=g.shift();)t.push(E(r,n));return K(e.operation,n),a.fromArray(t)}function f(e){return h.has(e.operation.key)}var d,p=n.forward,y=n.client,v=new Ne(t);t&&t.storage&&(d=t.storage.read().then((function(e){!function(e,t,n){for(var r in G(e,null),n){var i=n[r];if(void 0!==i){var o=L(r),a=o.entityKey;o=o.fieldKey,":"===i[0]?ue(a,o,JSON.parse(i.slice(1))):ae(a,o,JSON.parse(i))}}U(),e.storage=t}(v.data,t.storage,e)})));var h=new Map,g=[],k=new Map,x=M(),q=new Set,_=M(),O=function(e){for(var t in e)if(x[t])return!0;return!1},S=function(e,t){if(t)for(var n in t)if(t=_[n]){_[n]=[];for(var r=0,i=t.length;r<i;r++)e.add(t[r])}},K=function(e,t){t.forEach((function(t){if(t!==e.key){var n=k.get(t);if(n){k.delete(t);var r="cache-first";q.has(t)&&(q.delete(t),r="cache-and-network"),y.reexecuteOperation(Ce(n,r))}}}))},w=function(t){if("query"===t.operationName)se(v.data,t.key);else if("teardown"===t.operationName)k.delete(t.key),V(v.data,t.key);else if("mutation"===t.operationName&&"network-only"!==t.context.requestPolicy){var n=Oe(v,t,t.key).dependencies;if(!function(e){for(var t in e)return!1;return!0}(n)){for(var r in n)x[r]=!0;h.set(t.key,n),r=new Set,S(r,n),K(t,r)}}return e._extends({},t,{variables:t.variables?m(b(t.query),t.variables):t.variables,query:i.formatDocument(t.query)})},N=function(e,t){for(var n in t)(_[n]||(_[n]=[])).push(e.key),k.set(e.key,e)},T=function(e){var t=Te(v,e),n=t.data?t.partial?"partial":"hit":"miss";return N(e,t.dependencies),{outcome:n,operation:e,data:t.data,dependencies:t.dependencies}},E=function(e,t){var n=e.operation,r=e.error,i=e.extensions,o=n.key;if("mutation"===n.operationName){var a=h.get(o);S(t,a),h.delete(o)}else se(v.data,n.key);if(e.data){if(o=qe(v,n,e.data,o).dependencies,S(t,o),o=Te(v,n,e.data),e.data=o.data,"query"===n.operationName){var u=o.dependencies;S(t,u)}}else V(v.data,n.key);return u&&N(e.operation,u),{data:e.data,error:r,extensions:i,operation:n}};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(T)(a.filter(Qe)(t))),t=a.filter(je)(t);var n=a.map(r)(a.filter(o)(e));return e=a.map(u)(a.filter(Ge)(e)),n=a.share(p(a.map(w)(a.merge([t,n])))),t=a.map(s)(a.filter(c)(n)),n=a.mergeMap(l)(a.filter(f)(n)),a.merge([t,n,e])}}},exports.noopDataState=V,exports.query=Te,exports.reserveLayer=se,exports.write=qe,exports.writeOptimistic=Oe; | ||
"use strict";var e=require("./1cc90026.min.js"),t=require("graphql/utilities/valueFromASTUntyped"),n=require("graphql/language/kinds"),r=require("graphql/type/definition"),i=require("@urql/core"),o=require("graphql/utilities/buildClientSchema"),a=require("wonka"),u=require("@urql/exchange-populate"),s=function(e){return e.name.value},c=function(e){return e.typeCondition.name.value},l=function(e){return e.alias?e.alias.value:s(e)},f=function(e){return e.selectionSet?e.selectionSet.selections:[]},d=function(e){return(e=e.typeCondition)?s(e):null},p=function(e){return e.kind===n.Kind.FIELD},y=function(e){return e.kind===n.Kind.INLINE_FRAGMENT},v=function(e,n){var r={},i=0;if(e.arguments&&e.arguments.length)for(var o=0,a=e.arguments.length;o<a;o++){var u=e.arguments[o],c=t.valueFromASTUntyped(u.value,n);null!=c&&(r[s(u)]=c,i++)}return 0<i?r:null},m=function(e,t){if(t&&e.variableDefinitions){for(var n={},r=0,i=e.variableDefinitions.length;r<i;r++){var o=s(e.variableDefinitions[r].variable);n[o]=t[o]}return n}},h=function(e,n){var r={};if(!n)return r;if(e.variableDefinitions)for(var i=0,o=e.variableDefinitions.length;i<o;i++){var a=e.variableDefinitions[i],u=s(a.variable);r[u]=void 0===n[u]&&a.defaultValue?t.valueFromASTUntyped(a.defaultValue,n):n[u]}for(var c in n)c in r||(r[c]=n[c]);return r};function g(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}var k=function(e){return e.kind===n.Kind.FRAGMENT_DEFINITION};function x(e){return e.kind===n.Kind.OPERATION_DEFINITION}var b=function(e){return g(!!(e=e.definitions.find(x)),"",1),e};function _(e,t){return e[s(t)]=t,e}var q=function(e){return e.definitions.filter(k).reduce(_,{})},O=function(e,n){var r=e.directives;if(!r)return!0;for(var i=0,o=r.length;i<o;i++){var a=r[i];if(("include"===(e=s(a))||"skip"===e)&&a.arguments&&a.arguments[0]&&"if"===s(a.arguments[0]))return n=t.valueFromASTUntyped(a.arguments[0].value,n),"include"===e?!!n:!n}return!0},S=function(e,t,n){return!!(e=N(e,t,n))&&r.isNullableType(e.type)},K=function(e,t,n){return!!(e=N(e,t,n))&&(e=r.isNonNullType(e.type)?e.type.ofType:e.type,r.isListType(e)&&r.isNullableType(e.ofType))},w=function(e,t,n){return!(!n||!t)&&(n===t||(t=e.getType(t),n=e.getType(n),t instanceof r.GraphQLObjectType?t===n:(function(e,t){g(e instanceof r.GraphQLInterfaceType||e instanceof r.GraphQLUnionType,"",5)}(t),T(n),e.isPossibleType(t,n))))},N=function(e,t,n){return T(e=e.getType(t)),e.getFields()[n]};function T(e,t){g(e instanceof r.GraphQLObjectType,"",3)}var E=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}},L=function(e){var t=e.indexOf(".");return{entityKey:e.slice(0,t).replace(/%2e/g,"."),fieldKey:e=e.slice(t+1)}},M=function(){return Object.create(null)},P="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},D=null,I=null,R=null,C=null,Q=!1,j=function(){return{optimistic:M(),base:new Map}},G=function(e,t,n){D=e,R=I,I=M(),Q=!1,t?n||0<e.optimisticOrder.length?(n||e.commutativeKeys.has(t)?n&&e.commutativeKeys.delete(t):se(e,t),C=t,ce(e,t)):(C=null,fe(e,t)):C=null},U=function(){var e=D,t=C;if(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]);)ye(e.optimisticOrder[t]);e.defer||(e.defer=!0,P((function(){G(e,null),te(),me(),U(),e.defer=!1}))),I=D=null},V=function(e,t,n){G(e,t,n),U()},J=function(){return g(null!==I,"",2),I},B=function(){return R=I,I=M()},W=function(){I=R,R=null},z=function(e,t,n,r){var i=(e=C?e.optimistic[C]:e.base).get(t);void 0===i&&e.set(t,i=M()),void 0!==r||C?i[n]=r:delete i[n]},$=function(e,t,n){for(var r,i=0,o=D.optimisticOrder.length;i<o;i++){var a=D.optimisticOrder[i],u=e.optimistic[a];if(u&&(!Q||D.commutativeKeys.has(a))&&void 0!==(r=u.get(t))&&n in r)return r[n]}return void 0!==(r=e.base.get(t))?r[n]:void 0},H=function(e,t,n,r){var i=void 0!==t[n]?t[n]:0;t=t[n]=i+r|0,void 0!==e&&(0>=t?e.add(n):0>=i&&0<t&&e.delete(n))},X=function(e,t,n,r){if("string"==typeof n)H(e,t,n,r);else if(Array.isArray(n))for(var i=0,o=n.length;i<o;i++){var a=n[i];a&&H(e,t,a,r)}},Y=function(e,t,n){if(void 0!==n)for(var r in n)t.has(r)||(e.push(A(r)),t.add(r))},Z=function(e,t,n,r){Y(e,t,r.base.get(n));for(var i=0,o=D.optimisticOrder.length;i<o;i++){var a=r.optimistic[D.optimisticOrder[i]];void 0!==a&&Y(e,t,a.get(n))}};function ee(e,t,n){if(0<(D.refCount[e]||0))n.delete(e);else{for(var r in D.refLock){if(0<((t=D.refLock[r])[e]||0))return;delete t[e]}if(delete D.refCount[e],n.delete(e),D.records.base.delete(e),r=D.links.base.get(e))for(var i in D.links.base.delete(e),r)X(n,D.refCount,r[i],-1)}}var te=function(){D.gc.forEach(ee)},ne=function(e,t){"__typename"!==t&&(e!==D.queryRootKey?I[e]=!0:void 0!==t&&(I[F(e,t)]=!0))},re=function(e,t){D.storage&&D.persist.add(function(e,t){return e.replace(/\./g,"%2e")+"."+t}(e,t))},ie=function(e,t){return ne(e,t),$(D.records,e,t)},oe=function(e,t){return ne(e,t),$(D.links,e,t)},ae=function(e,t,n){ne(e,t),re(e,t),z(D.records,e,t,n)},ue=function(e,t,n){var r=D;if(C)var i=r.refLock[C]||(r.refLock[C]=M()),o=r.links.optimistic[C];else{i=r.refCount,o=r.links.base;var a=r.gc}o=(o=o&&o.get(e))&&o[t],ne(e,t),re(e,t),z(r.links,e,t,n),X(a,i,o,-1),X(a,i,n,1)},se=function(e,t){var n=e.optimisticOrder.indexOf(t);-1===n?e.optimisticOrder.unshift(t):e.commutativeKeys.has(t)||(le(e,t),e.optimisticOrder.splice(n,1),e.optimisticOrder.unshift(t)),e.commutativeKeys.add(t)},ce=function(e,t){-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=M(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)},le=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 n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),le(e,t)};function de(e,t){for(var n in e)ue(t,n,e[n])}function pe(e,t){for(var n in e)ae(t,n,e[n])}var ye=function(e){B();var t=D.links.optimistic[e];t&&t.forEach(de),(t=D.records.optimistic[e])&&t.forEach(pe),W(),fe(D,e)},ve=function(e){var t=D.links,n=D.records,r=[],i=new Set;return ne(e),Z(r,i,e,t),Z(r,i,e,n),r},me=function(){if(D.storage){var e=M();Q=!0,D.persist.forEach((function(t){var n,r=L(t),o=r.entityKey;e[t]=void 0!==(n=oe(o,r=r.fieldKey))?":"+i.stringifyVariables(n):void 0!==(n=ie(o,r))?i.stringifyVariables(n):void 0})),Q=!1,D.storage.write(e),D.persist.clear()}},he=function(e,t,n,r,i,o){return{store:e,variables:t,fragments:n,parentTypeName:r,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},ge=function(e,t,n,r,i){e.parentTypeName=t,e.parentKey=n,e.parentFieldKey=r,e.fieldName=i},ke=function(e,t,n,r){return!(!t||t!==d(e)&&f(e).some((function(e){return!!p(e)&&(e=E(s(e),v(e,r)),!function(e,t){return void 0!==ie(e,t)||void 0!==oe(e,t)}(n,e))})))},xe=function(e,t,n,r){this.typename=e,this.entityKey=t,this.context=r,this.indexStack=[0],this.selectionStack=[n]};xe.prototype.next=function(){for(;0!==this.indexStack.length;){var e=this.indexStack[this.indexStack.length-1]++,t=this.selectionStack[this.selectionStack.length-1];if(e>=t.length)this.indexStack.pop(),this.selectionStack.pop();else if(O(e=t[e],this.context.variables))if(p(e)){if("__typename"!==s(e))return e}else void 0!==(e=y(e)?e:this.context.fragments[s(e)])&&(this.context.store.schema?w(this.context.store.schema,d(e),this.typename):ke(e,this.typename,this.entityKey,this.context.variables))&&(this.indexStack.push(0),this.selectionStack.push(f(e)))}};var be=function(e){return void 0===e?null:e},_e=function(e,t,n,r){return G(e.data,r||null),e=qe(e,t,n),U(),e},qe=function(e,t,n){var r=b(t.query),i={data:n,dependencies:J()},o=e.rootFields[r.operation];return e=he(e,h(r,t.variables),q(t.query),o,o),Se(e,o,f(r),n),i},Oe=function(e,t,n){G(e.data,n,!0),n=b(t.query);var r={data:{},dependencies:J()},i=e.rootFields[n.operation];return g(i===e.rootFields.mutation,"",10),e=he(e,h(n,t.variables),q(t.query),i,i,!0),Se(e,i,f(n),r.data),U(),r},Se=function(e,t,n,r){var i=t===e.store.rootFields.query,o=!i&&!!e.store.rootNames[t],a=o||i?t:r.__typename;if(a){o||i||!t||ae(t,"__typename",a),n=new xe(a,t||a,n,e);for(var u;u=n.next();){i=s(u);var c=v(u,e.variables),d=E(i,c),p=l(u),y=r[p];if(e.optimistic&&o){if(!(y=e.store.optimisticMutations[i]))continue;ge(e,a,a,d,i),y=r[p]=be(y(c||{},e.store,e))}u.selectionSet?t&&!o?(p=F(t,d),u=we(e,f(u),be(y),p),ue(t||a,d,u)):we(e,f(u),be(y)):t&&!o&&ae(t||a,d,y),o&&(ge(e,a,a,F(a,d),i),d=e.store.updates[a][i])&&(r[i]=y,d(r,c||{},e.store,e))}}},Ke=/^__|PageInfo|(Connection|Edge)$/,we=function(e,t,n,r){if(Array.isArray(n)){for(var i=Array(n.length),o=0,a=n.length;o<a;o++){var u=n[o],s=r?F(r,""+o):void 0;u=we(e,t,u,s),i[o]=u}return i}return null===n?null:(i=e.store.keyOfEntity(n),o=n.__typename,r&&void 0===e.store.keys[n.__typename]&&null===i&&"string"==typeof o&&Ke.test(o),Se(e,r=i||r,t,n),r||null)},Ne=function(e,t,n){t=t?[{fieldKey:E(t,n)}]:ve(e),n=0;for(var r=t.length;n<r;n++){var i=t[n].fieldKey;void 0!==oe(e,i)?ue(e,i,void 0):ae(e,i,void 0)}},Te=function(e){var t;this.keyOfField=E,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 n="Query",r="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&&(n=e.name),u&&(r=u.name),a&&(i=a.name)}this.rootFields={query:n,mutation:r,subscription:i},this.rootNames=((t={})[n]="query",t[r]="mutation",t[i]="subscription",t),this.data=function(e){return{defer:!1,gc:new Set,persist:new Set,queryRootKey:e,refCount:M(),refLock:M(),links:j(),records:j(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(n)};Te.prototype.keyOfEntity=function(e){var t,n=e.__typename,r=e.id,i=e._id;return n?void 0!==this.rootNames[n]?n:(this.keys[n]?t=this.keys[n](e):null!=r?t=""+r:null!=i&&(t=""+i),t?n+":"+t:null):null},Te.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=ie(e,t);return void 0!==n?n:(t=oe(e,t))?t:null},Te.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,E(t,n))},Te.prototype.invalidateQuery=function(e,t){!function(e,t){var n=B();for(var r in Fe(e,t),W(),n)r.startsWith(e.data.queryRootKey+".")?(t=r.slice((e.data.queryRootKey+".").length),ue(e.data.queryRootKey,t),ae(e.data.queryRootKey,t)):Ne(r);te()}(this,i.createRequest(e,t))},Te.prototype.invalidate=function(e,t,n){g(e="string"==typeof e?e:this.keyOfEntity(e),"",19),Ne(e,t,n)},Te.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?ve(e):[]},Te.prototype.updateQuery=function(e,t){e=i.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&qe(this,e,t)},Te.prototype.readQuery=function(e){return Fe(this,i.createRequest(e.query,e.variables)).data},Te.prototype.readFragment=function(e,t,n){return Me(this,e,t,n)},Te.prototype.writeFragment=function(t,n,r){!function(t,n,r,i){n=q(n);var o=Object.keys(n);if(void 0!==(o=n[o[0]])){var a=c(o);r=e._extends({},{__typename:a},r);var u=t.keyOfEntity(r);u&&(t=he(t,i||{},n,a,u),Se(t,u,f(o),r))}}(this,t,n,r)};var Ee=function(e,t,n){return G(e.data,null),e=Fe(e,t,n),U(),e},Fe=function(e,t,n){var r=b(t.query),i=e.rootFields[r.operation],o=f(r);return n=n||{},n=i!==(e=he(e,h(r,t.variables),q(t.query),i,i)).store.rootFields.query?Ae(e,i,o,n):Pe(e,i,o,n),{dependencies:J(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}},Ae=function(e,t,n,r){if("string"!=typeof r.__typename)return r;t=new xe(t,t,n,e),(n={}).__typename=r.__typename;for(var i;void 0!==(i=t.next());){var o=l(i),a=r[o];void 0!==i.selectionSet&&null!==a?(a=be(a),n[o]=Le(e,f(i),a)):n[o]=a}return n},Le=function(e,t,n){if(Array.isArray(n)){for(var r=Array(n.length),i=0,o=n.length;i<o;i++)r[i]=Le(e,t,n[i]);return r}return null===n?null:null!==(r=e.store.keyOfEntity(n))?void 0===(e=Pe(e,r,t,{}))?null:e:Ae(e,n.__typename,t,n)},Me=function(t,n,r,i){n=q(n);var o=Object.keys(n);if(void 0===(o=n[o[0]]))return null;var a=c(o);return"string"==typeof r||r.__typename||(r.__typename=a),(r="string"!=typeof r?t.keyOfEntity(e._extends({},{__typename:a},r)):r)?(t=he(t,i||{},n,a,r),Pe(t,r,f(o),{})||null):null},Pe=function(e,t,n,r,i){var o=e.store,a=t===o.rootFields.query,u=i&&o.keyOfEntity(i)||t;if("string"==typeof(t=a?t:ie(u,"__typename")||i&&i.__typename)&&(!i||t===i.__typename)){r.__typename=t,n=new xe(t,u,n,e);for(var c,d=!1,p=!1;void 0!==(c=n.next());){var y=s(c),m=v(c,e.variables),h=l(c),g=E(y,m),k=F(u,g),x=ie(u,g),b=i?i[y]:void 0,_=o.resolvers[t],q=void 0;if(void 0!==b&&void 0===c.selectionSet)q=b;else if(_&&"function"==typeof _[y]){if(ge(e,t,u,k,y),void 0!==x&&(r[h]=x),q=_[y](r,m||{},o,e),void 0!==c.selectionSet&&(q=De(e,t,y,k,f(c),r[h]||{},q)),o.schema&&null===q&&!S(o.schema,t,y))return}else void 0===c.selectionSet?q=x:void 0!==b?q=De(e,t,y,k,f(c),r[h],b):void 0!==(m=oe(u,g))?q=Ie(e,m,t,y,f(c),r[h]):"object"==typeof x&&null!==x&&(q=x);if(void 0===q&&o.schema&&S(o.schema,t,y))p=!0,r[h]=null;else{if(void 0===q)return;d=!0,r[h]=q}}return p&&(e.partial=!0),a&&p&&!d?void 0:r}},De=function(e,t,n,r,i,o,a){if(Array.isArray(a)){var u=e.store;u=!u.schema||K(u.schema,t,n);for(var s=Array(a.length),c=0,l=a.length;c<l;c++){var f=De(e,t,n,F(r,""+c),i,null!=o?o[c]:void 0,a[c]);if(void 0===f&&!u)return;s[c]=void 0!==f?f:null}return s}return null==a?a:null===o?null:Re(a)?(t=o||{},"string"==typeof a?Pe(e,a,i,t):Pe(e,r,i,t,a)):void 0},Ie=function(e,t,n,r,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&K(a.schema,n,r);for(var u=Array(t.length),s=0,c=t.length;s<c;s++){var l=Ie(e,t[s],n,r,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:Pe(e,t,i,o||{})},Re=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},Ce=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:n})})})},Qe=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:n})})};function je(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Ge(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function Ue(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}exports.populateExchange=u.populateExchange,exports.Store=Te,exports.cacheExchange=function(t){return function(n){function r(e){return Ce(e.operation,"miss")}function o(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy&&!O(e.dependencies)}function u(e){var t=e.operation,n=e.outcome,r=e.dependencies;return e={operation:Ce(t,n),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===n)&&(e.stale=!0,O(r)?"cache-and-network"===t.context.requestPolicy&&_.add(t.key):y.reexecuteOperation(Qe(t,"network-only"))),e}function s(e){var t=new Set,n=E(e,t);return K(e.operation,t),n}function c(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++)se(v.data,g[t].operation.key);for(var n in x)delete x[n];t=[],n=new Set;for(var r;r=g.shift();)t.push(E(r,n));return K(e.operation,n),a.fromArray(t)}function f(e){return h.has(e.operation.key)}var d,p=n.forward,y=n.client,v=new Te(t);t&&t.storage&&(d=t.storage.read().then((function(e){!function(e,t,n){for(var r in G(e,null),n){var i=n[r];if(void 0!==i){var o=L(r),a=o.entityKey;o=o.fieldKey,":"===i[0]?ue(a,o,JSON.parse(i.slice(1))):ae(a,o,JSON.parse(i))}}U(),e.storage=t}(v.data,t.storage,e)})));var h=new Map,g=[],k=new Map,x=M(),_=new Set,q=M(),O=function(e){for(var t in e)if(x[t])return!0;return!1},S=function(e,t){if(t)for(var n in t)if(t=q[n]){q[n]=[];for(var r=0,i=t.length;r<i;r++)e.add(t[r])}},K=function(e,t){t.forEach((function(t){if(t!==e.key){var n=k.get(t);if(n){k.delete(t);var r="cache-first";_.has(t)&&(_.delete(t),r="cache-and-network"),y.reexecuteOperation(Qe(n,r))}}}))},w=function(t){if("query"===t.operationName)se(v.data,t.key);else if("teardown"===t.operationName)k.delete(t.key),V(v.data,t.key);else if("mutation"===t.operationName&&"network-only"!==t.context.requestPolicy){var n=Oe(v,t,t.key).dependencies;if(!function(e){for(var t in e)return!1;return!0}(n)){for(var r in n)x[r]=!0;h.set(t.key,n),r=new Set,S(r,n),K(t,r)}}return e._extends({},t,{variables:t.variables?m(b(t.query),t.variables):t.variables,query:i.formatDocument(t.query)})},N=function(e,t){for(var n in t)(q[n]||(q[n]=[])).push(e.key),k.set(e.key,e)},T=function(e){var t=Ee(v,e),n=t.data?t.partial?"partial":"hit":"miss";return N(e,t.dependencies),{outcome:n,operation:e,data:t.data,dependencies:t.dependencies}},E=function(e,t){var n=e.operation,r=e.error,i=e.extensions,o=n.key;if("mutation"===n.operationName){var a=h.get(o);S(t,a),h.delete(o)}else se(v.data,n.key);if(e.data){if(o=_e(v,n,e.data,o).dependencies,S(t,o),o=Ee(v,n,e.data),e.data=o.data,"query"===n.operationName){var u=o.dependencies;S(t,u)}}else V(v.data,n.key);return u&&N(e.operation,u),{data:e.data,error:r,extensions:i,operation:n}};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(T)(a.filter(je)(t))),t=a.filter(Ge)(t);var n=a.map(r)(a.filter(o)(e));return e=a.map(u)(a.filter(Ue)(e)),n=a.share(p(a.map(w)(a.merge([t,n])))),t=a.map(s)(a.filter(c)(n)),n=a.mergeMap(l)(a.filter(f)(n)),a.merge([t,n,e])}}},exports.noopDataState=V,exports.query=Ee,exports.reserveLayer=se,exports.write=_e,exports.writeOptimistic=Oe; | ||
//# sourceMappingURL=urql-exchange-graphcache.min.js.map |
@@ -18,3 +18,3 @@ { | ||
"dependencies": { | ||
"@urql/core": ">=1.11.6", | ||
"@urql/core": ">=1.11.7", | ||
"@urql/exchange-populate": ">=0.1.7", | ||
@@ -21,0 +21,0 @@ "wonka": "^4.0.10" |
{ | ||
"name": "@urql/exchange-graphcache", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "A normalized and configurable cache exchange for urql", | ||
@@ -61,3 +61,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@urql/core": ">=1.11.6", | ||
"@urql/core": ">=1.11.7", | ||
"@urql/exchange-populate": ">=0.1.7", | ||
@@ -64,0 +64,0 @@ "wonka": "^4.0.10" |
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
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
564471
2847
Updated@urql/core@>=1.11.7