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.8 to 2.3.0

13

CHANGELOG.md
# @urql/exchange-graphcache
## 2.3.0
### Minor Changes
- Support optimistic values for mutations without a selectionset, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#657](https://github.com/FormidableLabs/urql/pull/657))
### Patch Changes
- Refactor to replace dictionary-based (`Object.create(null)`) results with regular objects, by [@kitten](https://github.com/kitten) (See [#651](https://github.com/FormidableLabs/urql/pull/651))
- ⚠️ Fix case where a mutation-rootfield would cause an empty call to the cache.updates[mutationRootField], by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#654](https://github.com/FormidableLabs/urql/pull/654))
- Updated dependencies (See [#658](https://github.com/FormidableLabs/urql/pull/658) and [#650](https://github.com/FormidableLabs/urql/pull/650))
- @urql/core@1.10.5
## 2.2.8

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

115

dist/urql-exchange-graphcache.js

@@ -17,6 +17,4 @@ "use strict";

return a.kind === graphql.Kind.INLINE_FRAGMENT;
}, makeDict = function() {
return Object.create(null);
}, getFieldArguments = function(a, b) {
var c = makeDict(), d = 0;
var c = {}, d = 0;
if (a.arguments && a.arguments.length) {

@@ -38,3 +36,3 @@ for (var e = 0, f = a.arguments.length; e < f; e++) {

}, normalizeVariables = function(a, b) {
var c = makeDict();
var c = {};
if (!b) {

@@ -140,3 +138,5 @@ return c;

var keyOfField = function(a, b) {
var makeDict = function() {
return Object.create(null);
}, keyOfField = function(a, b) {
return b ? a + "(" + core.stringifyVariables(b) + ")" : a;

@@ -418,3 +418,3 @@ }, fieldInfoOfKey = function(a) {

var d = {
data: makeDict(),
data: {},
dependencies: getCurrentDependencies()

@@ -436,3 +436,3 @@ }, e = a.rootFields[c.operation];

e = keyOfField(k, m);
var l = d[getFieldAlias(h)];
var n = getFieldAlias(h), l = d[n];
if ("production" !== process.env.NODE_ENV) {

@@ -442,30 +442,19 @@ if (f || void 0 !== l) {

} else {
m = a.optimistic ? "\nYour optimistic result may be missing a field!" : "";
h = void 0 === h.selectionSet ? "scalar (number, boolean, etc)" : "selection set";
"production" !== process.env.NODE_ENV && warn("Invalid undefined: The field at `" + e + "` is `undefined`, but the GraphQL query expects a " + h + " for this field." + m, 13);
k = a.optimistic ? "\nYour optimistic result may be missing a field!" : "";
m = void 0 === h.selectionSet ? "scalar (number, boolean, etc)" : "selection set";
"production" !== process.env.NODE_ENV && warn("Invalid undefined: The field at `" + e + "` is `undefined`, but the GraphQL query expects a " + m + " for this field." + k, 13);
continue;
}
}
if (h.selectionSet) {
if (a.optimistic && f) {
if (!(l = a.store.optimisticMutations[k])) {
continue;
}
updateContext(a, g, g, e, k);
l = ensureData(l(m || makeDict(), a.store, a));
d[k] = l;
} else {
l = ensureData(l);
if (a.optimistic && f) {
if (!(l = a.store.optimisticMutations[k])) {
continue;
}
if (b && !f) {
var n = joinKeys(b, e);
h = writeField(a, getSelectionSet(h), l, n);
writeLink(b || g, e, h);
} else {
writeField(a, getSelectionSet(h), l);
}
} else {
b && !f && writeRecord(b || g, e, l);
updateContext(a, g, g, e, k);
l = d[n] = ensureData(l(m || {}, a.store, a));
}
f && (updateContext(a, g, g, joinKeys(g, e), k), (e = a.store.updates[g][k]) && e(d, m || makeDict(), a.store, a));
h.selectionSet ? b && !f ? (n = joinKeys(b, e), h = writeField(a, getSelectionSet(h), ensureData(l), n),
writeLink(b || g, e, h)) : writeField(a, getSelectionSet(h), ensureData(l)) : b && !f && writeRecord(b || g, e, l);
f && (updateContext(a, g, g, joinKeys(g, e), k), e = a.store.updates[g][k]) && (d[k] = l,
e(d, m || {}, a.store, a));
}

@@ -636,3 +625,3 @@ }

"production" !== process.env.NODE_ENV && pushDebugNode(e, d);
c = c || makeDict();
c = c || {};
c = e !== a.store.rootFields.query ? readRoot(a, e, f, c) : readSelection(a, e, f, c);

@@ -649,3 +638,3 @@ return {

b = new SelectionIterator(b, b, c, a);
(c = makeDict()).__typename = d.__typename;
(c = {}).__typename = d.__typename;
for (var e; void 0 !== (e = b.next()); ) {

@@ -666,3 +655,3 @@ var f = getFieldAlias(e), g = d[f];

}
return null !== (d = a.store.keyOfEntity(c)) ? void 0 === (a = readSelection(a, d, b, makeDict())) ? null : a : readRoot(a, c.__typename, b, c);
return null !== (d = a.store.keyOfEntity(c)) ? void 0 === (a = readSelection(a, d, b, {})) ? null : a : readRoot(a, c.__typename, b, c);
}, readFragment = function(a, b, c, d) {

@@ -685,3 +674,3 @@ b = getFragments(b);

a = makeContext(a, d || {}, b, f, c);
return readSelection(a, c, getSelectionSet(e), makeDict()) || null;
return readSelection(a, c, getSelectionSet(e), {}) || null;
}, readSelection = function(a, b, c, d, e) {

@@ -694,19 +683,19 @@ var f = a.store, g = b === f.rootFields.query, h = e && f.keyOfEntity(e) || b;

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

@@ -720,4 +709,4 @@ if (void 0 === p) {

}
l && (a.partial = !0);
return g && l && !m ? void 0 : d;
n && (a.partial = !0);
return g && n && !m ? void 0 : d;
}

@@ -728,6 +717,6 @@ }, resolveResolverResult = function(a, b, c, d, e, f, g) {

h = !h.schema || isListNullable(h.schema, b, c);
for (var k = Array(g.length), m = 0, l = g.length; m < l; m++) {
var n = resolveResolverResult(a, b, c, joinKeys(d, "" + m), e, void 0 !== f ? f[m] : void 0, g[m]);
if (void 0 !== n || h) {
k[m] = void 0 !== n ? n : null;
for (var k = Array(g.length), m = 0, n = g.length; m < n; m++) {
var l = resolveResolverResult(a, b, c, joinKeys(d, "" + m), e, void 0 !== f ? f[m] : void 0, g[m]);
if (void 0 !== l || h) {
k[m] = void 0 !== l ? l : null;
} else {

@@ -743,3 +732,3 @@ return;

if (isDataOrKey(g)) {
return b = void 0 === f ? makeDict() : f, "string" == typeof g ? readSelection(a, g, e, b) : readSelection(a, d, e, b, g);
return b = void 0 === f ? {} : f, "string" == typeof g ? readSelection(a, g, e, b) : readSelection(a, d, e, b, g);
}

@@ -752,5 +741,5 @@ "production" !== process.env.NODE_ENV && warn("Invalid resolver value: The field at `" + d + "` is a scalar (number, boolean, etc), but the GraphQL query expects a selection set for this field.", 9);

for (var h = Array(b.length), k = 0, m = b.length; k < m; k++) {
var l = resolveLink(a, b[k], c, d, e, void 0 !== f ? f[k] : void 0);
if (void 0 !== l || g) {
h[k] = void 0 !== l ? l : null;
var n = resolveLink(a, b[k], c, d, e, void 0 !== f ? f[k] : void 0);
if (void 0 !== n || g) {
h[k] = void 0 !== n ? n : null;
} else {

@@ -762,3 +751,3 @@ return;

}
return null === b ? null : readSelection(a, b, e, void 0 === f ? makeDict() : f);
return null === b ? null : readSelection(a, b, e, void 0 === f ? {} : f);
}, isDataOrKey = function(a) {

@@ -841,7 +830,7 @@ return "string" == typeof a || "object" == typeof a && "string" == typeof a.__typename;

})));
var k = new Map, m = new Map, l = makeDict(), n = function(a, b) {
var k = new Map, m = new Map, n = makeDict(), l = function(a, b) {
b && b.forEach((function c(b) {
var c = l[b];
var c = n[b];
if (c) {
l[b] = [];
n[b] = [];
b = 0;

@@ -871,3 +860,3 @@ for (var d = c.length; b < d; b++) {

var c = new Set;
n(c, b);
l(c, b);
q(a, c);

@@ -885,3 +874,3 @@ }

b.forEach((function(b) {
(l[b] || (l[b] = [])).push(a.key);
(n[b] || (n[b] = [])).push(a.key);
m.has(a.key) || m.set(a.key, "network-only" === a.context.requestPolicy ? toRequestPolicy(a, "cache-and-network") : a);

@@ -899,8 +888,8 @@ }));

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)) : reserveLayer(g.data, b.key);
"mutation" === b.operationName ? (l(f, k.get(e)), k.delete(e)) : reserveLayer(g.data, b.key);
if (a.data) {
if (e = write(g, b, a.data, e).dependencies, n(f, e), e = query(g, b, a.data), a.data = e.data,
if (e = write(g, b, a.data, e).dependencies, l(f, e), e = query(g, b, a.data), a.data = e.data,
"query" === b.operationName) {
var h = e.dependencies;
n(f, h);
l(f, h);
}

@@ -907,0 +896,0 @@ } else {

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

"use strict";var e=require("./1cc90026.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;
"use strict";var e=require("./1cc90026.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(e,n){var r={},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},p=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}},y=function(e,n){var r={};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 v(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}var m=function(e){return e.kind===t.Kind.FRAGMENT_DEFINITION};function h(e){return e.kind===t.Kind.OPERATION_DEFINITION}var g=function(e){return v(!!(e=e.definitions.find(h)),"",1),e};function k(e,t){return e[o(t)]=t,e}var x=function(e){return e.definitions.filter(m).reduce(k,{})},b=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},_=function(e,n,r){return!!(e=S(e,n,r))&&t.isNullableType(e.type)},O=function(e,n,r){return!!(e=S(e,n,r))&&(e=t.isNonNullType(e.type)?e.type.ofType:e.type,t.isListType(e)&&t.isNullableType(e.ofType))},q=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){v(e instanceof t.GraphQLInterfaceType||e instanceof t.GraphQLUnionType,"",5)}(n),w(r),e.isPossibleType(n,r))))},S=function(e,t,n){return w(e=e.getType(t)),e.getFields()[n]};function w(e,n){v(e instanceof t.GraphQLObjectType,"",3)}var E=function(){return Object.create(null)},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:E(),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=E()})))},C=function(e,t,n){R(e,t,n),I()},Q=function(){return v(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=E()),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]=E()),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]=E(),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),d(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(b(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?q(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=g(t.query),i={data:n,dependencies:Q()},o=e.rootFields[r.operation];return e=le(e,y(r,t.variables),x(t.query),o,o),ge(e,o,u(r),n),i},he=function(e,t,n){R(e.data,n,!0),n=g(t.query);var r={data:{},dependencies:Q()},i=e.rootFields[n.operation];return v(i===e.rootFields.mutation,"",10),e=le(e,y(n,t.variables),x(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();){i=o(l);var f=d(l,e.variables),p=N(i,f),y=s(l),v=r[y];if(e.optimistic&&a){if(!(v=e.store.optimisticMutations[i]))continue;fe(e,c,c,p,i),v=r[y]=ye(v(f||{},e.store,e))}l.selectionSet?t&&!a?(y=T(t,p),l=ke(e,u(l),ye(v),y),te(t||c,p,l)):ke(e,u(l),ye(v)):t&&!a&&ee(t||c,p,v),a&&(fe(e,c,c,T(c,p),i),p=e.store.updates[c][i])&&(r[i]=v,p(r,f||{},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:E(),gcScheduled:!1,queryRootKey:e,gcBatch:new Set,refCount:E(),refLock:E(),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){v(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=x(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=g(t.query),i=e.rootFields[r.operation],o=u(r);return n=n||{},n=i!==(e=le(e,y(r,t.variables),x(t.query),i,i)).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={}).__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,{}))?null:e:Oe(e,n.__typename,t,n)},Se=function(t,n,r,i){n=x(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),{})||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,p=!1,y=!1;void 0!==(f=n.next());){var v=o(f),m=d(f,e.variables),h=s(f),g=N(v,m),k=T(l,g),x=Z(l,g),b=i?i[v]:void 0,O=a.resolvers[t],q=void 0;if(void 0!==b&&void 0===f.selectionSet)q=b;else if(O&&"function"==typeof O[v]){if(fe(e,t,l,k,v),void 0!==x&&(r[h]=x),q=O[v](r,m||{},a,e),void 0!==f.selectionSet&&(q=Ee(e,t,v,k,u(f),r[h]||{},q)),a.schema&&null===q&&!_(a.schema,t,v))return}else void 0===f.selectionSet?q=x:void 0!==b?q=Ee(e,t,v,k,u(f),r[h],b):void 0!==(m=$(l,g))?q=Ne(e,m,t,v,u(f),r[h]):"object"==typeof x&&null!==x&&(q=x);if(void 0===q&&a.schema&&_(a.schema,t,v))y=!0,r[h]=null;else{if(void 0===q)return;p=!0,r[h]=q}}return y&&(e.partial=!0),c&&y&&!p?void 0:r}},Ee=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=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?{}: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&&O(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?{}: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,d=E(),y=function(e,t){t&&t.forEach((function(t){var n=d[t];if(n){d[t]=[],t=0;for(var r=n.length;t<r;t++)e.add(n[t])}}))},v=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")))}}))},m=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;y(i,r),v(t,i)}}else ne(c.data,t.key);return e._extends({},t,{variables:t.variables?p(g(t.query),t.variables):t.variables,query:n.formatDocument(t.query)})},h=function(e,t){t.forEach((function(t){(d[t]||(d[t]=[])).push(e.key),f.has(e.key)||f.set(e.key,"network-only"===e.context.requestPolicy?Fe(e,"cache-and-network"):e)}))},k=function(e){var t=be(c,e),n=t.data?t.partial?"partial":"hit":"miss";return t.data&&h(e,t.dependencies),{outcome:n,operation:e,data:t.data}},x=function(e){var t=e.operation,n=e.error,r=e.extensions,i=t.key,o=new Set;if("mutation"===t.operationName?(y(o,l.get(i)),l.delete(i)):ne(c.data,t.key),e.data){if(i=ve(c,t,e.data,i).dependencies,y(o,i),i=be(c,t,e.data),e.data=i.data,"query"===t.operationName){var a=i.dependencies;y(o,a)}}else C(c.data,t.key);return v(e.operation,o),a&&h(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(k)(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(x)(s(r.map(m)(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.min.js.map

@@ -9,3 +9,3 @@ {

"dependencies": {
"@urql/core": ">=1.10.4",
"@urql/core": ">=1.10.5",
"@urql/exchange-populate": ">=0.1.3",

@@ -12,0 +12,0 @@ "wonka": "^4.0.9"

{
"name": "@urql/exchange-graphcache",
"version": "2.2.8",
"version": "2.3.0",
"description": "A normalized and configurable cache exchange for urql",

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

"dependencies": {
"@urql/core": ">=1.10.4",
"@urql/core": ">=1.10.5",
"@urql/exchange-populate": ">=0.1.3",

@@ -63,0 +63,0 @@ "wonka": "^4.0.9"

@@ -62,14 +62,4 @@ <h2 align="center">@urql/exchange-graphcache</h2>

## Features and Roadmap
- [x] Normalized resolving and updates
- [x] Schema awareness and deterministic fragment matching
- [x] Partial query results when the cache is schema aware
- [x] Customization using custom resolvers, updates, and keying functions
- [x] Optimistic updates
- [ ] Basic offline and persistence support
- [ ] Advanced fragment and entity invalidation
## Maintenance Status
**Active:** Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.

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