Socket
Socket
Sign inDemoInstall

@urql/exchange-graphcache

Package Overview
Dependencies
Maintainers
31
Versions
294
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 2.2.6 to 2.2.7

dist/747c3396.esm.min.mjs

13

CHANGELOG.md
# @urql/exchange-graphcache
## 2.2.7
### Patch Changes
- ⚠️ Fix critical ordering bug in commutative queries and mutations. Subscriptions and queries would ad-hoc be receiving an empty optimistic layer accidentally. This leads to subscription results potentially being cleared, queries from being erased on a second write, and layers from sticking around on every second write or indefinitely. This affects versions `> 2.2.2` so please upgrade!, by [@kitten](https://github.com/kitten) (See [#638](https://github.com/FormidableLabs/urql/pull/638))
- ⚠️ Fix multipart conversion, in the `extract-files` dependency (used by multipart-fetch) there is an explicit check for the constructor property of an object. This made the files unretrievable, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#639](https://github.com/FormidableLabs/urql/pull/639))
- ⚠️ Fix Node.js Module support for v13 (experimental-modules) and v14. If your bundler doesn't support
`.mjs` files and fails to resolve the new version, please double check your configuration for
Webpack, or similar tools, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#637](https://github.com/FormidableLabs/urql/pull/637))
- Updated dependencies (See [#637](https://github.com/FormidableLabs/urql/pull/637))
- @urql/exchange-populate@0.1.2
- @urql/core@1.10.3
## 2.2.6

@@ -4,0 +17,0 @@

2

dist/types/ast/variables.d.ts

@@ -6,4 +6,4 @@ import { FieldNode, OperationDefinitionNode } from 'graphql';

/** Returns a filtered form of variables with values missing that the query doesn't require */
export declare const filterVariables: (node: OperationDefinitionNode, input: void | object) => any;
export declare const filterVariables: (node: OperationDefinitionNode, input: void | object) => {} | undefined;
/** Returns a normalized form of variables with defaulted values */
export declare const normalizeVariables: (node: OperationDefinitionNode, input: void | object) => Variables;

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

if (b && a.variableDefinitions) {
for (var c = makeDict(), d = 0, e = a.variableDefinitions.length; d < e; d++) {
for (var c = {}, d = 0, e = a.variableDefinitions.length; d < e; d++) {
var f = getName(a.variableDefinitions[d].variable);

@@ -297,3 +297,4 @@ c[f] = b[f];

}, reserveLayer = function(a, b) {
a.commutativeKeys.has(b) || (a.optimisticOrder.unshift(b), a.commutativeKeys.add(b));
-1 === a.optimisticOrder.indexOf(b) && a.optimisticOrder.unshift(b);
a.commutativeKeys.add(b);
}, createLayer = function(a, b) {

@@ -686,10 +687,10 @@ -1 === a.optimisticOrder.indexOf(b) && a.optimisticOrder.unshift(b);

for (var k, m = !1, l = !1; void 0 !== (k = c.next()); ) {
var n = getName(k), q = getFieldArguments(k, a.variables), r = getFieldAlias(k), w = keyOfField(n, q), u = joinKeys(h, w), t = readRecord(h, w), v = e ? e[n] : void 0, x = f.resolvers[b];
var n = getName(k), q = getFieldArguments(k, a.variables), r = getFieldAlias(k), u = keyOfField(n, q), v = joinKeys(h, u), t = readRecord(h, u), w = e ? e[n] : void 0, x = f.resolvers[b];
"production" !== process.env.NODE_ENV && f.schema && b && isFieldAvailableOnType(f.schema, b, n);
var p = void 0;
if (void 0 !== v && void 0 === k.selectionSet) {
p = v;
if (void 0 !== w && void 0 === k.selectionSet) {
p = w;
} else if (x && "function" == typeof x[n]) {
if (updateContext(a, b, h, u, n), void 0 !== t && (d[r] = t), p = x[n](d, q || makeDict(), f, a),
void 0 !== k.selectionSet && (p = resolveResolverResult(a, b, n, u, getSelectionSet(k), d[r] || makeDict(), p)),
if (updateContext(a, b, h, v, n), void 0 !== t && (d[r] = t), p = x[n](d, q || makeDict(), f, a),
void 0 !== k.selectionSet && (p = resolveResolverResult(a, b, n, v, getSelectionSet(k), d[r] || makeDict(), p)),
f.schema && null === p && !isFieldNullable(f.schema, b, n)) {

@@ -699,3 +700,3 @@ return;

} else {
void 0 === k.selectionSet ? p = t : void 0 !== v ? p = resolveResolverResult(a, b, n, u, getSelectionSet(k), d[r], v) : void 0 !== (q = readLink(h, w)) ? p = resolveLink(a, q, b, n, getSelectionSet(k), d[r]) : "object" == typeof t && null !== t && (p = t);
void 0 === k.selectionSet ? p = t : void 0 !== w ? p = resolveResolverResult(a, b, n, v, getSelectionSet(k), d[r], w) : void 0 !== (q = readLink(h, u)) ? p = resolveLink(a, q, b, n, getSelectionSet(k), d[r]) : "object" == typeof t && null !== t && (p = t);
}

@@ -770,24 +771,18 @@ if (void 0 === p && f.schema && isFieldNullable(f.schema, b, n)) {

function _ref3$1(a) {
return _rollupPluginBabelHelpers._extends({}, a, {
query: core.formatDocument(a.query)
});
return "query" === a.operationName && "network-only" !== a.context.requestPolicy;
}
function _ref4$1(a) {
return "query" === a.operationName && "network-only" !== a.context.requestPolicy;
return "query" !== a.operationName || "network-only" === a.context.requestPolicy;
}
function _ref5(a) {
return "query" !== a.operationName || "network-only" === a.context.requestPolicy;
return addCacheOutcome(a.operation, "miss");
}
function _ref6(a) {
return addCacheOutcome(a.operation, "miss");
}
function _ref7(a) {
return "miss" === a.outcome && "cache-only" !== a.operation.context.requestPolicy;
}
function _ref9(a) {
function _ref8(a) {
return "miss" !== a.outcome || "cache-only" === a.operation.context.requestPolicy;

@@ -854,3 +849,19 @@ }

}, r = function(a) {
"query" === a.operationName ? reserveLayer(g.data, a.key) : "teardown" === a.operationName && noopDataState(g.data, a.key);
if ("query" === a.operationName) {
reserveLayer(g.data, a.key);
} else if ("teardown" === a.operationName) {
noopDataState(g.data, a.key);
} else if ("mutation" === a.operationName) {
if ("network-only" !== a.context.requestPolicy) {
var b = writeOptimistic(g, a, a.key).dependencies;
if (0 !== b.size) {
k.set(a.key, b);
var c = new Set;
n(c, b);
q(a, c);
}
} else {
reserveLayer(g.data, a.key);
}
}
return _rollupPluginBabelHelpers._extends({}, a, {

@@ -860,10 +871,2 @@ variables: a.variables ? filterVariables(getMainOperation(a.query), a.variables) : a.variables,

});
}, w = function(a) {
var b = a.key;
if ("mutation" === a.operationName && "network-only" !== a.context.requestPolicy) {
var c = writeOptimistic(g, a, b).dependencies;
0 !== c.size && (k.set(b, c), b = new Set, n(b, c), q(a, b));
} else {
noopDataState(g.data, b, !0);
}
}, u = function(a, b) {

@@ -874,3 +877,3 @@ b.forEach((function(b) {

}));
}, t = function(a) {
}, v = function(a) {
var b = query(g, a), c = b.data ? b.partial ? "partial" : "hit" : "miss";

@@ -883,5 +886,5 @@ b.data && u(a, b.dependencies);

};
}, v = function(a) {
}, t = function(a) {
var b = a.operation, c = a.error, d = a.extensions, e = b.key, f = new Set;
"mutation" === b.operationName ? (n(f, k.get(e)), k.delete(e)) : "subscription" === b.operationName && reserveLayer(g.data, b.key);
"mutation" === b.operationName ? (n(f, k.get(e)), k.delete(e)) : reserveLayer(g.data, b.key);
if (a.data) {

@@ -908,8 +911,8 @@ if (e = write(g, b, a.data, e).dependencies, n(f, e), e = query(g, b, a.data), a.data = e.data,

var b = h ? wonka.mergeMap(wonka.fromArray)(wonka.take(1)(wonka.buffer(wonka.fromPromise(h))(a))) : wonka.empty;
b = wonka.share(wonka.tap(w)(wonka.map(_ref3$1)(wonka.concat([ b, a ]))));
a = wonka.share(wonka.map(t)(wonka.filter(_ref4$1)(b)));
b = wonka.filter(_ref5)(b);
var c = wonka.map(_ref6)(wonka.filter(_ref7)(a));
a = wonka.map(d)(wonka.filter(_ref9)(a));
b = wonka.map(v)(e(wonka.map(r)(wonka.merge([ b, c ]))));
b = wonka.share(wonka.concat([ b, a ]));
a = wonka.share(wonka.map(v)(wonka.filter(_ref3$1)(b)));
b = wonka.filter(_ref4$1)(b);
var c = wonka.map(_ref5)(wonka.filter(_ref6)(a));
a = wonka.map(d)(wonka.filter(_ref8)(a));
b = wonka.map(t)(e(wonka.map(r)(wonka.merge([ b, c ]))));
return wonka.merge([ b, a ]);

@@ -916,0 +919,0 @@ };

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

"use strict";var e=require("./5329e1b9.cjs.min.js"),t=require("graphql"),n=require("@urql/core"),r=require("wonka"),i=require("@urql/exchange-populate"),o=function(e){return e.name.value},a=function(e){return e.typeCondition.name.value},s=function(e){return e.alias?e.alias.value:o(e)},u=function(e){return e.selectionSet?e.selectionSet.selections:[]},c=function(e){return(e=e.typeCondition)?o(e):null},l=function(e){return e.kind===t.Kind.FIELD},f=function(e){return e.kind===t.Kind.INLINE_FRAGMENT},d=function(){return Object.create(null)},p=function(e,n){var r=d(),i=0;if(e.arguments&&e.arguments.length)for(var a=0,s=e.arguments.length;a<s;a++){var u=e.arguments[a],c=t.valueFromASTUntyped(u.value,n);null!=c&&(r[o(u)]=c,i++)}return 0<i?r:null},y=function(e,t){if(t&&e.variableDefinitions){for(var n=d(),r=0,i=e.variableDefinitions.length;r<i;r++){var a=o(e.variableDefinitions[r].variable);n[a]=t[a]}return n}},v=function(e,n){var r=d();if(!n)return r;if(e.variableDefinitions)for(var i=0,a=e.variableDefinitions.length;i<a;i++){var s=e.variableDefinitions[i],u=o(s.variable);r[u]=void 0===n[u]&&s.defaultValue?t.valueFromASTUntyped(s.defaultValue,n):n[u]}for(var c in n)c in r||(r[c]=n[c]);return r};function m(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}var h=function(e){return e.kind===t.Kind.FRAGMENT_DEFINITION};function g(e){return e.kind===t.Kind.OPERATION_DEFINITION}var k=function(e){return m(!!(e=e.definitions.find(g)),"",1),e};function x(e,t){return e[o(t)]=t,e}var b=function(e){return e.definitions.filter(h).reduce(x,{})},_=function(e,n){var r=e.directives;if(!r)return!0;for(var i=0,a=r.length;i<a;i++){var s=r[i];if(("include"===(e=o(s))||"skip"===e)&&s.arguments&&s.arguments[0]&&"if"===o(s.arguments[0]))return n=t.valueFromASTUntyped(s.arguments[0].value,n),"include"===e?!!n:!n}return!0},q=function(e,n,r){return!!(e=w(e,n,r))&&t.isNullableType(e.type)},O=function(e,n,r){return!!(e=w(e,n,r))&&(e=t.isNonNullType(e.type)?e.type.ofType:e.type,t.isListType(e)&&t.isNullableType(e.ofType))},S=function(e,n,r){return!(!r||!n)&&(r===n||(n=e.getType(n),r=e.getType(r),n instanceof t.GraphQLObjectType?n===r:(function(e,n){m(e instanceof t.GraphQLInterfaceType||e instanceof t.GraphQLUnionType,"",5)}(n),N(r),e.isPossibleType(n,r))))},w=function(e,t,n){return N(e=e.getType(t)),e.getFields()[n]};function N(e,n){m(e instanceof t.GraphQLObjectType,"",3)}var E=function(e,t){return t?e+"("+n.stringifyVariables(t)+")":e},K=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}},T=function(e,t){return e+"."+t},F=function(e,t){return e+"|"+t},A="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},L=null,B=null,M=null,P=null,D=function(){return{optimistic:d(),base:new Map}},R=function(e,t,n){L=e,M=B,B=new Set,t?n||1<e.optimisticOrder.length&&-1<e.optimisticOrder.indexOf(t)?(n||e.commutativeKeys.has(t)||(ie(e,t),e.commutativeKeys.add(t)),P=t,re(e,t)):(P=null,oe(e,t)):P=null},I=function(){var e=L,t=P;if(P=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]);)ue(e.optimisticOrder[t]);B=L=null,!e.gcScheduled&&0<e.gcBatch.size&&(e.gcScheduled=!0,A((function(){X(e)}))),e.storage&&!e.persistenceScheduled&&(e.persistenceScheduled=!0,A((function(){e.storage.write(e.persistenceBatch),e.persistenceScheduled=!1,e.persistenceBatch=d()})))},C=function(e,t,n){R(e,t,n),I()},Q=function(){return m(null!==B,"",2),B},j=function(){return M=B,B=new Set},G=function(){B=M,M=null},U=function(e,t,n,r){var i=(e=P?e.optimistic[P]:e.base).get(t);void 0===i&&e.set(t,i=d()),void 0!==r||P?i[n]=r:delete i[n]},W=function(e,t,n){for(var r,i=0,o=L.optimisticOrder.length;i<o;i++){var a=e.optimistic[L.optimisticOrder[i]];if(a&&void 0!==(r=a.get(t))&&n in r)return r[n]}return void 0!==(r=e.base.get(t))?r[n]:void 0},V=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))},z=function(e,t,n,r){if("string"==typeof n)V(e,t,n,r);else if(Array.isArray(n))for(var i=0,o=n.length;i<o;i++){var a=n[i];a&&V(e,t,a,r)}},J=function(e,t,n){if(void 0!==n)for(var r in n)t.has(r)||(e.push(K(r)),t.add(r))},H=function(e,t,n,r){J(e,t,r.base.get(n));for(var i=0,o=L.optimisticOrder.length;i<o;i++){var a=r.optimistic[L.optimisticOrder[i]];void 0!==a&&J(e,t,a.get(n))}},X=function(e){e.gcScheduled=!1,e.gcBatch.forEach((function(t){if(0>=(e.refCount[t]||0)){for(var n in e.refLock){var r=e.refLock[n];if(0<(r[t]||0))return;delete r[t]}if(delete e.refCount[t],e.gcBatch.delete(t),void 0!==(n=e.records.base.get(t))&&(e.records.base.delete(t),e.storage))for(var i in n)n=F("r",T(t,i)),e.persistenceBatch[n]=void 0;if(void 0!==(i=e.links.base.get(t)))for(var o in e.links.base.delete(t),i)e.storage&&(n=F("l",T(t,o)),e.persistenceBatch[n]=void 0),z(e.gcBatch,e.refCount,i[o],-1)}else e.gcBatch.delete(t)}))},Y=function(e,t){"__typename"!==t&&(e!==L.queryRootKey?B.add(e):void 0!==t&&B.add(T(e,t)))},Z=function(e,t){return Y(e,t),W(L.records,e,t)},$=function(e,t){return Y(e,t),W(L.links,e,t)},ee=function(e,t,n){Y(e,t),U(L.records,e,t,n),L.storage&&!P&&(e=F("r",T(e,t)),L.persistenceBatch[e]=n)},te=function(e,t,n){var r=L;if(P)var i=r.refLock[P]||(r.refLock[P]=d()),o=r.links.optimistic[P];else{r.storage&&(i=F("l",T(e,t)),r.persistenceBatch[i]=n),i=r.refCount,o=r.links.base;var a=r.gcBatch}o=(o=o&&o.get(e))&&o[t],Y(e,t),U(r.links,e,t,n),z(a,i,o,-1),z(a,i,n,1)},ne=function(e,t){e.commutativeKeys.has(t)||(e.optimisticOrder.unshift(t),e.commutativeKeys.add(t))},re=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)},ie=function(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])},oe=function(e,t){var n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),ie(e,t)};function ae(e,t){for(var n in e)te(t,n,e[n])}function se(e,t){for(var n in e)ee(t,n,e[n])}var ue=function(e){j();var t=L.links.optimistic[e];t&&t.forEach(ae),(t=L.records.optimistic[e])&&t.forEach(se),G(),oe(L,e)},ce=function(e){var t=L.links,n=L.records,r=[],i=new Set;return Y(e),H(r,i,e,t),H(r,i,e,n),r},le=function(e,t,n,r,i,o){return{store:e,variables:t,fragments:n,parentTypeName:r,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},fe=function(e,t,n,r,i){e.parentTypeName=t,e.parentKey=n,e.parentFieldKey=r,e.fieldName=i},de=function(e,t,n,r){return!(!t||t!==c(e)&&u(e).some((function(e){return!!l(e)&&(e=E(o(e),p(e,r)),!function(e,t){return void 0!==Z(e,t)||void 0!==$(e,t)}(n,e))})))},pe=function(e,t,n,r){this.typename=e,this.entityKey=t,this.context=r,this.indexStack=[0],this.selectionStack=[n]};pe.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(_(e=t[e],this.context.variables))if(l(e)){if("__typename"!==o(e))return e}else void 0!==(e=f(e)?e:this.context.fragments[o(e)])&&(this.context.store.schema?S(this.context.store.schema,c(e),this.typename):de(e,this.typename,this.entityKey,this.context.variables))&&(this.indexStack.push(0),this.selectionStack.push(u(e)))}};var ye=function(e){return void 0===e?null:e},ve=function(e,t,n,r){return R(e.data,r||null),e=me(e,t,n),I(),e},me=function(e,t,n){var r=k(t.query),i={data:n,dependencies:Q()},o=e.rootFields[r.operation];return e=le(e,v(r,t.variables),b(t.query),o,o),ge(e,o,u(r),n),i},he=function(e,t,n){R(e.data,n,!0),n=k(t.query);var r={data:d(),dependencies:Q()},i=e.rootFields[n.operation];return m(i===e.rootFields.mutation,"",10),e=le(e,v(n,t.variables),b(t.query),i,i,!0),ge(e,i,u(n),r.data),I(),r},ge=function(e,t,n,r){var i=t===e.store.rootFields.query,a=!i&&!!e.store.rootNames[t],c=a||i?t:r.__typename;if(c){a||i||!t||ee(t,"__typename",c),n=new pe(c,t||c,n,e);for(var l;l=n.next();){var f=o(l);i=p(l,e.variables);var y=E(f,i),v=r[s(l)];if(l.selectionSet){if(e.optimistic&&a){if(!(v=e.store.optimisticMutations[f]))continue;fe(e,c,c,y,f),v=ye(v(i||d(),e.store,e)),r[f]=v}else v=ye(v);if(t&&!a){var m=T(t,y);l=ke(e,u(l),v,m),te(t||c,y,l)}else ke(e,u(l),v)}else t&&!a&&ee(t||c,y,v);a&&(fe(e,c,c,T(c,y),f),(f=e.store.updates[c][f])&&f(r,i||d(),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 s=n[o],u=r?T(r,""+o):void 0;s=ke(e,t,s,u),i[o]=s}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"),ge(e,r=i||r,t,n),r||null)},xe=function(e){var n;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 r="Query",i="Mutation",o="Subscription";if(e.schema){var a=this.schema=t.buildClientSchema(e.schema);e=a.getQueryType();var s=a.getMutationType();a=a.getSubscriptionType(),e&&(r=e.name),s&&(i=s.name),a&&(o=a.name)}this.rootFields={query:r,mutation:i,subscription:o},this.rootNames=((n={})[r]="query",n[i]="mutation",n[o]="subscription",n),this.data=function(e){return{persistenceScheduled:!1,persistenceBatch:d(),gcScheduled:!1,queryRootKey:e,gcBatch:new Set,refCount:d(),refLock:d(),links:D(),records:D(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(r)};xe.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},xe.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=Z(e,t);return void 0!==n?n:(t=$(e,t))?t:null},xe.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,E(t,n))},xe.prototype.invalidateQuery=function(e,t){!function(e,t){var n=j();_e(e,t),n.forEach((function(t){t.startsWith(e.data.queryRootKey+".")?(t=t.slice((e.data.queryRootKey+".").length),te(e.data.queryRootKey,t),ee(e.data.queryRootKey,t)):e.invalidate(t)})),G(),X(e.data)}(this,n.createRequest(e,t))},xe.prototype.invalidate=function(e,t,n){m(e="string"==typeof e?e:this.keyOfEntity(e),"",19),function(e,t,n){t=t?[{fieldKey:E(t,n)}]:ce(e),n=0;for(var r=t.length;n<r;n++){var i=t[n].fieldKey;$(e,i)?te(e,i,void 0):ee(e,i,void 0)}}(e,t,n)},xe.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?ce(e):[]},xe.prototype.updateQuery=function(e,t){e=n.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&me(this,e,t)},xe.prototype.readQuery=function(e){return _e(this,n.createRequest(e.query,e.variables)).data},xe.prototype.readFragment=function(e,t,n){return Se(this,e,t,n)},xe.prototype.writeFragment=function(t,n,r){!function(t,n,r,i){n=b(n);var o=Object.keys(n);if(void 0!==(o=n[o[0]])){var s=a(o);r=e._extends({},{__typename:s},r);var c=t.keyOfEntity(r);c&&(t=le(t,i||{},n,s,c),ge(t,c,u(o),r))}}(this,t,n,r)};var be=function(e,t,n){return R(e.data,null),e=_e(e,t,n),I(),e},_e=function(e,t,n){var r=k(t.query),i=e.rootFields[r.operation],o=u(r);return e=le(e,v(r,t.variables),b(t.query),i,i),n=n||d(),n=i!==e.store.rootFields.query?qe(e,i,o,n):we(e,i,o,n),{dependencies:Q(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}},qe=function(e,t,n,r){if("string"!=typeof r.__typename)return r;t=new pe(t,t,n,e),(n=d()).__typename=r.__typename;for(var i;void 0!==(i=t.next());){var o=s(i),a=r[o];void 0!==i.selectionSet&&null!==a?(a=ye(a),n[o]=Oe(e,u(i),a)):n[o]=a}return n},Oe=function(e,t,n){if(Array.isArray(n)){for(var r=Array(n.length),i=0,o=n.length;i<o;i++)r[i]=Oe(e,t,n[i]);return r}return null===n?null:null!==(r=e.store.keyOfEntity(n))?void 0===(e=we(e,r,t,d()))?null:e:qe(e,n.__typename,t,n)},Se=function(t,n,r,i){n=b(n);var o=Object.keys(n);if(void 0===(o=n[o[0]]))return null;var s=a(o);return"string"==typeof r||r.__typename||(r.__typename=s),(r="string"!=typeof r?t.keyOfEntity(e._extends({},{__typename:s},r)):r)?(t=le(t,i||{},n,s,r),we(t,r,u(o),d())||null):null},we=function(e,t,n,r,i){var a=e.store,c=t===a.rootFields.query,l=i&&a.keyOfEntity(i)||t;if(!("string"!=typeof(t=c?t:Z(l,"__typename")||i&&i.__typename)||i&&t!==i.__typename)){r.__typename=t,n=new pe(t,l,n,e);for(var f,y=!1,v=!1;void 0!==(f=n.next());){var m=o(f),h=p(f,e.variables),g=s(f),k=E(m,h),x=T(l,k),b=Z(l,k),_=i?i[m]:void 0,O=a.resolvers[t],S=void 0;if(void 0!==_&&void 0===f.selectionSet)S=_;else if(O&&"function"==typeof O[m]){if(fe(e,t,l,x,m),void 0!==b&&(r[g]=b),S=O[m](r,h||d(),a,e),void 0!==f.selectionSet&&(S=Ne(e,t,m,x,u(f),r[g]||d(),S)),a.schema&&null===S&&!q(a.schema,t,m))return}else void 0===f.selectionSet?S=b:void 0!==_?S=Ne(e,t,m,x,u(f),r[g],_):void 0!==(h=$(l,k))?S=Ee(e,h,t,m,u(f),r[g]):"object"==typeof b&&null!==b&&(S=b);if(void 0===S&&a.schema&&q(a.schema,t,m))v=!0,r[g]=null;else{if(void 0===S)return;y=!0,r[g]=S}}return v&&(e.partial=!0),c&&v&&!y?void 0:r}},Ne=function(e,t,n,r,i,o,a){if(Array.isArray(a)){var s=e.store;s=!s.schema||O(s.schema,t,n);for(var u=Array(a.length),c=0,l=a.length;c<l;c++){var f=Ne(e,t,n,T(r,""+c),i,void 0!==o?o[c]:void 0,a[c]);if(void 0===f&&!s)return;u[c]=void 0!==f?f:null}return u}return null==a?a:Ke(a)?(t=void 0===o?d():o,"string"==typeof a?we(e,a,i,t):we(e,r,i,t,a)):void 0},Ee=function(e,t,n,r,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&O(a.schema,n,r);for(var s=Array(t.length),u=0,c=t.length;u<c;u++){var l=Ee(e,t[u],n,r,i,void 0!==o?o[u]:void 0);if(void 0===l&&!a)return;s[u]=void 0!==l?l:null}return s}return null===t?null:we(e,t,i,void 0===o?d():o)},Ke=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},Te=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:n})})})},Fe=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:n})})};function Ae(t){return e._extends({},t,{query:n.formatDocument(t.query)})}function Le(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Be(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function Me(e){return Te(e.operation,"miss")}function Pe(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy}function De(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}exports.populateExchange=i.populateExchange,exports.Store=xe,exports.cacheExchange=function(t){return function(i){function o(e){var t=e.operation,n=e.outcome;return e={operation:Te(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,u.reexecuteOperation(Fe(t,"network-only"))),e}var a,s=i.forward,u=i.client,c=new xe(t);t&&t.storage&&(a=t.storage.read().then((function(e){!function(e,t,n){for(var r in R(e,null),n){var i=r.indexOf("."),o=r.slice(2,i);switch(i=r.slice(i+1),r.charCodeAt(0)){case 108:te(o,i,n[r]);break;case 114:ee(o,i,n[r])}}I(),e.storage=t}(c.data,t.storage,e)})));var l=new Map,f=new Map,p=d(),v=function(e,t){t&&t.forEach((function(t){var n=p[t];if(n){p[t]=[],t=0;for(var r=n.length;t<r;t++)e.add(n[t])}}))},m=function(e,t){t.forEach((function(t){if(t!==e.key){var n=f.get(t);n&&(f.delete(t),u.reexecuteOperation(Fe(n,"cache-first")))}}))},h=function(t){return"query"===t.operationName?ne(c.data,t.key):"teardown"===t.operationName&&C(c.data,t.key),e._extends({},t,{variables:t.variables?y(k(t.query),t.variables):t.variables,query:n.formatDocument(t.query)})},g=function(e){var t=e.key;if("mutation"===e.operationName&&"network-only"!==e.context.requestPolicy){var n=he(c,e,t).dependencies;0!==n.size&&(l.set(t,n),t=new Set,v(t,n),m(e,t))}else C(c.data,t,!0)},x=function(e,t){t.forEach((function(t){(p[t]||(p[t]=[])).push(e.key),f.has(e.key)||f.set(e.key,"network-only"===e.context.requestPolicy?Fe(e,"cache-and-network"):e)}))},b=function(e){var t=be(c,e),n=t.data?t.partial?"partial":"hit":"miss";return t.data&&x(e,t.dependencies),{outcome:n,operation:e,data:t.data}},_=function(e){var t=e.operation,n=e.error,r=e.extensions,i=t.key,o=new Set;if("mutation"===t.operationName?(v(o,l.get(i)),l.delete(i)):"subscription"===t.operationName&&ne(c.data,t.key),e.data){if(i=ve(c,t,e.data,i).dependencies,v(o,i),i=be(c,t,e.data),e.data=i.data,"query"===t.operationName){var a=i.dependencies;v(o,a)}}else C(c.data,t.key);return m(e.operation,o),a&&x(e.operation,a),{data:e.data,error:n,extensions:r,operation:t}};return function(e){e=r.share(e);var t=a?r.mergeMap(r.fromArray)(r.take(1)(r.buffer(r.fromPromise(a))(e))):r.empty;t=r.share(r.tap(g)(r.map(Ae)(r.concat([t,e])))),e=r.share(r.map(b)(r.filter(Le)(t))),t=r.filter(Be)(t);var n=r.map(Me)(r.filter(Pe)(e));return e=r.map(o)(r.filter(De)(e)),t=r.map(_)(s(r.map(h)(r.merge([t,n])))),r.merge([t,e])}}},exports.noopDataState=C,exports.query=be,exports.reserveLayer=ne,exports.write=ve,exports.writeOptimistic=he;
"use strict";var e=require("./5329e1b9.cjs.min.js"),t=require("graphql"),n=require("@urql/core"),r=require("wonka"),i=require("@urql/exchange-populate"),o=function(e){return e.name.value},a=function(e){return e.typeCondition.name.value},s=function(e){return e.alias?e.alias.value:o(e)},u=function(e){return e.selectionSet?e.selectionSet.selections:[]},c=function(e){return(e=e.typeCondition)?o(e):null},l=function(e){return e.kind===t.Kind.FIELD},f=function(e){return e.kind===t.Kind.INLINE_FRAGMENT},d=function(){return Object.create(null)},p=function(e,n){var r=d(),i=0;if(e.arguments&&e.arguments.length)for(var a=0,s=e.arguments.length;a<s;a++){var u=e.arguments[a],c=t.valueFromASTUntyped(u.value,n);null!=c&&(r[o(u)]=c,i++)}return 0<i?r:null},y=function(e,t){if(t&&e.variableDefinitions){for(var n={},r=0,i=e.variableDefinitions.length;r<i;r++){var a=o(e.variableDefinitions[r].variable);n[a]=t[a]}return n}},v=function(e,n){var r=d();if(!n)return r;if(e.variableDefinitions)for(var i=0,a=e.variableDefinitions.length;i<a;i++){var s=e.variableDefinitions[i],u=o(s.variable);r[u]=void 0===n[u]&&s.defaultValue?t.valueFromASTUntyped(s.defaultValue,n):n[u]}for(var c in n)c in r||(r[c]=n[c]);return r};function m(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}var h=function(e){return e.kind===t.Kind.FRAGMENT_DEFINITION};function g(e){return e.kind===t.Kind.OPERATION_DEFINITION}var k=function(e){return m(!!(e=e.definitions.find(g)),"",1),e};function x(e,t){return e[o(t)]=t,e}var b=function(e){return e.definitions.filter(h).reduce(x,{})},_=function(e,n){var r=e.directives;if(!r)return!0;for(var i=0,a=r.length;i<a;i++){var s=r[i];if(("include"===(e=o(s))||"skip"===e)&&s.arguments&&s.arguments[0]&&"if"===o(s.arguments[0]))return n=t.valueFromASTUntyped(s.arguments[0].value,n),"include"===e?!!n:!n}return!0},O=function(e,n,r){return!!(e=w(e,n,r))&&t.isNullableType(e.type)},q=function(e,n,r){return!!(e=w(e,n,r))&&(e=t.isNonNullType(e.type)?e.type.ofType:e.type,t.isListType(e)&&t.isNullableType(e.ofType))},S=function(e,n,r){return!(!r||!n)&&(r===n||(n=e.getType(n),r=e.getType(r),n instanceof t.GraphQLObjectType?n===r:(function(e,n){m(e instanceof t.GraphQLInterfaceType||e instanceof t.GraphQLUnionType,"",5)}(n),E(r),e.isPossibleType(n,r))))},w=function(e,t,n){return E(e=e.getType(t)),e.getFields()[n]};function E(e,n){m(e instanceof t.GraphQLObjectType,"",3)}var N=function(e,t){return t?e+"("+n.stringifyVariables(t)+")":e},K=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}},T=function(e,t){return e+"."+t},F=function(e,t){return e+"|"+t},A="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},L=null,B=null,M=null,P=null,D=function(){return{optimistic:d(),base:new Map}},R=function(e,t,n){L=e,M=B,B=new Set,t?n||1<e.optimisticOrder.length&&-1<e.optimisticOrder.indexOf(t)?(n||e.commutativeKeys.has(t)||(ie(e,t),e.commutativeKeys.add(t)),P=t,re(e,t)):(P=null,oe(e,t)):P=null},I=function(){var e=L,t=P;if(P=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]);)ue(e.optimisticOrder[t]);B=L=null,!e.gcScheduled&&0<e.gcBatch.size&&(e.gcScheduled=!0,A((function(){X(e)}))),e.storage&&!e.persistenceScheduled&&(e.persistenceScheduled=!0,A((function(){e.storage.write(e.persistenceBatch),e.persistenceScheduled=!1,e.persistenceBatch=d()})))},C=function(e,t,n){R(e,t,n),I()},Q=function(){return m(null!==B,"",2),B},j=function(){return M=B,B=new Set},G=function(){B=M,M=null},U=function(e,t,n,r){var i=(e=P?e.optimistic[P]:e.base).get(t);void 0===i&&e.set(t,i=d()),void 0!==r||P?i[n]=r:delete i[n]},W=function(e,t,n){for(var r,i=0,o=L.optimisticOrder.length;i<o;i++){var a=e.optimistic[L.optimisticOrder[i]];if(a&&void 0!==(r=a.get(t))&&n in r)return r[n]}return void 0!==(r=e.base.get(t))?r[n]:void 0},V=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))},z=function(e,t,n,r){if("string"==typeof n)V(e,t,n,r);else if(Array.isArray(n))for(var i=0,o=n.length;i<o;i++){var a=n[i];a&&V(e,t,a,r)}},J=function(e,t,n){if(void 0!==n)for(var r in n)t.has(r)||(e.push(K(r)),t.add(r))},H=function(e,t,n,r){J(e,t,r.base.get(n));for(var i=0,o=L.optimisticOrder.length;i<o;i++){var a=r.optimistic[L.optimisticOrder[i]];void 0!==a&&J(e,t,a.get(n))}},X=function(e){e.gcScheduled=!1,e.gcBatch.forEach((function(t){if(0>=(e.refCount[t]||0)){for(var n in e.refLock){var r=e.refLock[n];if(0<(r[t]||0))return;delete r[t]}if(delete e.refCount[t],e.gcBatch.delete(t),void 0!==(n=e.records.base.get(t))&&(e.records.base.delete(t),e.storage))for(var i in n)n=F("r",T(t,i)),e.persistenceBatch[n]=void 0;if(void 0!==(i=e.links.base.get(t)))for(var o in e.links.base.delete(t),i)e.storage&&(n=F("l",T(t,o)),e.persistenceBatch[n]=void 0),z(e.gcBatch,e.refCount,i[o],-1)}else e.gcBatch.delete(t)}))},Y=function(e,t){"__typename"!==t&&(e!==L.queryRootKey?B.add(e):void 0!==t&&B.add(T(e,t)))},Z=function(e,t){return Y(e,t),W(L.records,e,t)},$=function(e,t){return Y(e,t),W(L.links,e,t)},ee=function(e,t,n){Y(e,t),U(L.records,e,t,n),L.storage&&!P&&(e=F("r",T(e,t)),L.persistenceBatch[e]=n)},te=function(e,t,n){var r=L;if(P)var i=r.refLock[P]||(r.refLock[P]=d()),o=r.links.optimistic[P];else{r.storage&&(i=F("l",T(e,t)),r.persistenceBatch[i]=n),i=r.refCount,o=r.links.base;var a=r.gcBatch}o=(o=o&&o.get(e))&&o[t],Y(e,t),U(r.links,e,t,n),z(a,i,o,-1),z(a,i,n,1)},ne=function(e,t){-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.commutativeKeys.add(t)},re=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)},ie=function(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])},oe=function(e,t){var n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),ie(e,t)};function ae(e,t){for(var n in e)te(t,n,e[n])}function se(e,t){for(var n in e)ee(t,n,e[n])}var ue=function(e){j();var t=L.links.optimistic[e];t&&t.forEach(ae),(t=L.records.optimistic[e])&&t.forEach(se),G(),oe(L,e)},ce=function(e){var t=L.links,n=L.records,r=[],i=new Set;return Y(e),H(r,i,e,t),H(r,i,e,n),r},le=function(e,t,n,r,i,o){return{store:e,variables:t,fragments:n,parentTypeName:r,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},fe=function(e,t,n,r,i){e.parentTypeName=t,e.parentKey=n,e.parentFieldKey=r,e.fieldName=i},de=function(e,t,n,r){return!(!t||t!==c(e)&&u(e).some((function(e){return!!l(e)&&(e=N(o(e),p(e,r)),!function(e,t){return void 0!==Z(e,t)||void 0!==$(e,t)}(n,e))})))},pe=function(e,t,n,r){this.typename=e,this.entityKey=t,this.context=r,this.indexStack=[0],this.selectionStack=[n]};pe.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(_(e=t[e],this.context.variables))if(l(e)){if("__typename"!==o(e))return e}else void 0!==(e=f(e)?e:this.context.fragments[o(e)])&&(this.context.store.schema?S(this.context.store.schema,c(e),this.typename):de(e,this.typename,this.entityKey,this.context.variables))&&(this.indexStack.push(0),this.selectionStack.push(u(e)))}};var ye=function(e){return void 0===e?null:e},ve=function(e,t,n,r){return R(e.data,r||null),e=me(e,t,n),I(),e},me=function(e,t,n){var r=k(t.query),i={data:n,dependencies:Q()},o=e.rootFields[r.operation];return e=le(e,v(r,t.variables),b(t.query),o,o),ge(e,o,u(r),n),i},he=function(e,t,n){R(e.data,n,!0),n=k(t.query);var r={data:d(),dependencies:Q()},i=e.rootFields[n.operation];return m(i===e.rootFields.mutation,"",10),e=le(e,v(n,t.variables),b(t.query),i,i,!0),ge(e,i,u(n),r.data),I(),r},ge=function(e,t,n,r){var i=t===e.store.rootFields.query,a=!i&&!!e.store.rootNames[t],c=a||i?t:r.__typename;if(c){a||i||!t||ee(t,"__typename",c),n=new pe(c,t||c,n,e);for(var l;l=n.next();){var f=o(l);i=p(l,e.variables);var y=N(f,i),v=r[s(l)];if(l.selectionSet){if(e.optimistic&&a){if(!(v=e.store.optimisticMutations[f]))continue;fe(e,c,c,y,f),v=ye(v(i||d(),e.store,e)),r[f]=v}else v=ye(v);if(t&&!a){var m=T(t,y);l=ke(e,u(l),v,m),te(t||c,y,l)}else ke(e,u(l),v)}else t&&!a&&ee(t||c,y,v);a&&(fe(e,c,c,T(c,y),f),(f=e.store.updates[c][f])&&f(r,i||d(),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 s=n[o],u=r?T(r,""+o):void 0;s=ke(e,t,s,u),i[o]=s}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"),ge(e,r=i||r,t,n),r||null)},xe=function(e){var n;this.keyOfField=N,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",i="Mutation",o="Subscription";if(e.schema){var a=this.schema=t.buildClientSchema(e.schema);e=a.getQueryType();var s=a.getMutationType();a=a.getSubscriptionType(),e&&(r=e.name),s&&(i=s.name),a&&(o=a.name)}this.rootFields={query:r,mutation:i,subscription:o},this.rootNames=((n={})[r]="query",n[i]="mutation",n[o]="subscription",n),this.data=function(e){return{persistenceScheduled:!1,persistenceBatch:d(),gcScheduled:!1,queryRootKey:e,gcBatch:new Set,refCount:d(),refLock:d(),links:D(),records:D(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(r)};xe.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},xe.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=Z(e,t);return void 0!==n?n:(t=$(e,t))?t:null},xe.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,N(t,n))},xe.prototype.invalidateQuery=function(e,t){!function(e,t){var n=j();_e(e,t),n.forEach((function(t){t.startsWith(e.data.queryRootKey+".")?(t=t.slice((e.data.queryRootKey+".").length),te(e.data.queryRootKey,t),ee(e.data.queryRootKey,t)):e.invalidate(t)})),G(),X(e.data)}(this,n.createRequest(e,t))},xe.prototype.invalidate=function(e,t,n){m(e="string"==typeof e?e:this.keyOfEntity(e),"",19),function(e,t,n){t=t?[{fieldKey:N(t,n)}]:ce(e),n=0;for(var r=t.length;n<r;n++){var i=t[n].fieldKey;$(e,i)?te(e,i,void 0):ee(e,i,void 0)}}(e,t,n)},xe.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?ce(e):[]},xe.prototype.updateQuery=function(e,t){e=n.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&me(this,e,t)},xe.prototype.readQuery=function(e){return _e(this,n.createRequest(e.query,e.variables)).data},xe.prototype.readFragment=function(e,t,n){return Se(this,e,t,n)},xe.prototype.writeFragment=function(t,n,r){!function(t,n,r,i){n=b(n);var o=Object.keys(n);if(void 0!==(o=n[o[0]])){var s=a(o);r=e._extends({},{__typename:s},r);var c=t.keyOfEntity(r);c&&(t=le(t,i||{},n,s,c),ge(t,c,u(o),r))}}(this,t,n,r)};var be=function(e,t,n){return R(e.data,null),e=_e(e,t,n),I(),e},_e=function(e,t,n){var r=k(t.query),i=e.rootFields[r.operation],o=u(r);return e=le(e,v(r,t.variables),b(t.query),i,i),n=n||d(),n=i!==e.store.rootFields.query?Oe(e,i,o,n):we(e,i,o,n),{dependencies:Q(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}},Oe=function(e,t,n,r){if("string"!=typeof r.__typename)return r;t=new pe(t,t,n,e),(n=d()).__typename=r.__typename;for(var i;void 0!==(i=t.next());){var o=s(i),a=r[o];void 0!==i.selectionSet&&null!==a?(a=ye(a),n[o]=qe(e,u(i),a)):n[o]=a}return n},qe=function(e,t,n){if(Array.isArray(n)){for(var r=Array(n.length),i=0,o=n.length;i<o;i++)r[i]=qe(e,t,n[i]);return r}return null===n?null:null!==(r=e.store.keyOfEntity(n))?void 0===(e=we(e,r,t,d()))?null:e:Oe(e,n.__typename,t,n)},Se=function(t,n,r,i){n=b(n);var o=Object.keys(n);if(void 0===(o=n[o[0]]))return null;var s=a(o);return"string"==typeof r||r.__typename||(r.__typename=s),(r="string"!=typeof r?t.keyOfEntity(e._extends({},{__typename:s},r)):r)?(t=le(t,i||{},n,s,r),we(t,r,u(o),d())||null):null},we=function(e,t,n,r,i){var a=e.store,c=t===a.rootFields.query,l=i&&a.keyOfEntity(i)||t;if(!("string"!=typeof(t=c?t:Z(l,"__typename")||i&&i.__typename)||i&&t!==i.__typename)){r.__typename=t,n=new pe(t,l,n,e);for(var f,y=!1,v=!1;void 0!==(f=n.next());){var m=o(f),h=p(f,e.variables),g=s(f),k=N(m,h),x=T(l,k),b=Z(l,k),_=i?i[m]:void 0,q=a.resolvers[t],S=void 0;if(void 0!==_&&void 0===f.selectionSet)S=_;else if(q&&"function"==typeof q[m]){if(fe(e,t,l,x,m),void 0!==b&&(r[g]=b),S=q[m](r,h||d(),a,e),void 0!==f.selectionSet&&(S=Ee(e,t,m,x,u(f),r[g]||d(),S)),a.schema&&null===S&&!O(a.schema,t,m))return}else void 0===f.selectionSet?S=b:void 0!==_?S=Ee(e,t,m,x,u(f),r[g],_):void 0!==(h=$(l,k))?S=Ne(e,h,t,m,u(f),r[g]):"object"==typeof b&&null!==b&&(S=b);if(void 0===S&&a.schema&&O(a.schema,t,m))v=!0,r[g]=null;else{if(void 0===S)return;y=!0,r[g]=S}}return v&&(e.partial=!0),c&&v&&!y?void 0:r}},Ee=function(e,t,n,r,i,o,a){if(Array.isArray(a)){var s=e.store;s=!s.schema||q(s.schema,t,n);for(var u=Array(a.length),c=0,l=a.length;c<l;c++){var f=Ee(e,t,n,T(r,""+c),i,void 0!==o?o[c]:void 0,a[c]);if(void 0===f&&!s)return;u[c]=void 0!==f?f:null}return u}return null==a?a:Ke(a)?(t=void 0===o?d():o,"string"==typeof a?we(e,a,i,t):we(e,r,i,t,a)):void 0},Ne=function(e,t,n,r,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&q(a.schema,n,r);for(var s=Array(t.length),u=0,c=t.length;u<c;u++){var l=Ne(e,t[u],n,r,i,void 0!==o?o[u]:void 0);if(void 0===l&&!a)return;s[u]=void 0!==l?l:null}return s}return null===t?null:we(e,t,i,void 0===o?d():o)},Ke=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},Te=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:n})})})},Fe=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:n})})};function Ae(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Le(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function Be(e){return Te(e.operation,"miss")}function Me(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy}function Pe(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}exports.populateExchange=i.populateExchange,exports.Store=xe,exports.cacheExchange=function(t){return function(i){function o(e){var t=e.operation,n=e.outcome;return e={operation:Te(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,u.reexecuteOperation(Fe(t,"network-only"))),e}var a,s=i.forward,u=i.client,c=new xe(t);t&&t.storage&&(a=t.storage.read().then((function(e){!function(e,t,n){for(var r in R(e,null),n){var i=r.indexOf("."),o=r.slice(2,i);switch(i=r.slice(i+1),r.charCodeAt(0)){case 108:te(o,i,n[r]);break;case 114:ee(o,i,n[r])}}I(),e.storage=t}(c.data,t.storage,e)})));var l=new Map,f=new Map,p=d(),v=function(e,t){t&&t.forEach((function(t){var n=p[t];if(n){p[t]=[],t=0;for(var r=n.length;t<r;t++)e.add(n[t])}}))},m=function(e,t){t.forEach((function(t){if(t!==e.key){var n=f.get(t);n&&(f.delete(t),u.reexecuteOperation(Fe(n,"cache-first")))}}))},h=function(t){if("query"===t.operationName)ne(c.data,t.key);else if("teardown"===t.operationName)C(c.data,t.key);else if("mutation"===t.operationName)if("network-only"!==t.context.requestPolicy){var r=he(c,t,t.key).dependencies;if(0!==r.size){l.set(t.key,r);var i=new Set;v(i,r),m(t,i)}}else ne(c.data,t.key);return e._extends({},t,{variables:t.variables?y(k(t.query),t.variables):t.variables,query:n.formatDocument(t.query)})},g=function(e,t){t.forEach((function(t){(p[t]||(p[t]=[])).push(e.key),f.has(e.key)||f.set(e.key,"network-only"===e.context.requestPolicy?Fe(e,"cache-and-network"):e)}))},x=function(e){var t=be(c,e),n=t.data?t.partial?"partial":"hit":"miss";return t.data&&g(e,t.dependencies),{outcome:n,operation:e,data:t.data}},b=function(e){var t=e.operation,n=e.error,r=e.extensions,i=t.key,o=new Set;if("mutation"===t.operationName?(v(o,l.get(i)),l.delete(i)):ne(c.data,t.key),e.data){if(i=ve(c,t,e.data,i).dependencies,v(o,i),i=be(c,t,e.data),e.data=i.data,"query"===t.operationName){var a=i.dependencies;v(o,a)}}else C(c.data,t.key);return m(e.operation,o),a&&g(e.operation,a),{data:e.data,error:n,extensions:r,operation:t}};return function(e){e=r.share(e);var t=a?r.mergeMap(r.fromArray)(r.take(1)(r.buffer(r.fromPromise(a))(e))):r.empty;t=r.share(r.concat([t,e])),e=r.share(r.map(x)(r.filter(Ae)(t))),t=r.filter(Le)(t);var n=r.map(Be)(r.filter(Me)(e));return e=r.map(o)(r.filter(Pe)(e)),t=r.map(b)(s(r.map(h)(r.merge([t,n])))),r.merge([t,e])}}},exports.noopDataState=C,exports.query=be,exports.reserveLayer=ne,exports.write=ve,exports.writeOptimistic=he;
//# sourceMappingURL=urql-exchange-graphcache.cjs.min.js.map

@@ -5,10 +5,10 @@ {

"main": "../dist/urql-exchange-graphcache-extras.cjs.js",
"module": "../dist/urql-exchange-graphcache-extras.esm.js",
"module": "../dist/urql-exchange-graphcache-extras.esm.mjs",
"types": "../dist/types/extras/index.d.ts",
"source": "../src/extras/index.ts",
"dependencies": {
"@urql/core": ">=1.10.2",
"@urql/exchange-populate": ">=0.1.1",
"wonka": "^3.2.1 || ^4.0.0"
"@urql/core": ">=1.10.3",
"@urql/exchange-populate": ">=0.1.2",
"wonka": "^4.0.8"
}
}
{
"name": "@urql/exchange-graphcache",
"version": "2.2.6",
"version": "2.2.7",
"description": "A normalized and configurable cache exchange for urql",

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

"main": "dist/urql-exchange-graphcache.cjs.js",
"module": "dist/urql-exchange-graphcache.esm.js",
"module": "dist/urql-exchange-graphcache.esm.mjs",
"types": "dist/types/index.d.ts",

@@ -29,12 +29,12 @@ "source": "src/index.ts",

".": {
"import": "dist/urql-exchange-graphcache.esm.js",
"require": "dist/urql-exchange-graphcache.cjs.js",
"types": "dist/types/index.d.ts",
"source": "src/index.ts"
"import": "./dist/urql-exchange-graphcache.esm.mjs",
"require": "./dist/urql-exchange-graphcache.cjs.js",
"types": "./dist/types/index.d.ts",
"source": "./src/index.ts"
},
"./extras": {
"import": "dist/urql-exchange-graphcache-extras.esm.js",
"require": "dist/urql-exchange-graphcache-extras.cjs.js",
"types": "dist/types/extras/index.d.ts",
"source": "src/extras/index.ts"
"import": "./dist/urql-exchange-graphcache-extras.esm.mjs",
"require": "./dist/urql-exchange-graphcache-extras.cjs.js",
"types": "./dist/types/extras/index.d.ts",
"source": "./src/extras/index.ts"
}

@@ -62,5 +62,5 @@ },

"dependencies": {
"wonka": "^3.2.1 || ^4.0.0",
"@urql/core": ">=1.10.2",
"@urql/exchange-populate": ">=0.1.1"
"wonka": "^4.0.8",
"@urql/core": ">=1.10.3",
"@urql/exchange-populate": ">=0.1.2"
},

@@ -67,0 +67,0 @@ "peerDependencies": {

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