@urql/exchange-graphcache
Advanced tools
Comparing version 3.1.1 to 3.1.2
# @urql/exchange-graphcache | ||
## 3.1.2 | ||
### Patch Changes | ||
- ⚠️ Fix small pieces of code where polyfill-less ES5 usage was compromised. This was unlikely to have affected anyone in production as `Array.prototype.find` (the only usage of an ES6 method) is commonly used and polyfilled, by [@kitten](https://github.com/kitten) (See [#991](https://github.com/FormidableLabs/urql/pull/991)) | ||
- ⚠️ Fix queries that have erroed with a `NetworkError` (`isOfflineError`) not flowing back completely through the `cacheExchange`. | ||
These queries should also now be reexecuted when the client comes back online, by [@kitten](https://github.com/kitten) (See [#1011](https://github.com/FormidableLabs/urql/pull/1011)) | ||
- Updated dependencies (See [#1011](https://github.com/FormidableLabs/urql/pull/1011)) | ||
- @urql/core@1.13.1 | ||
## 3.1.1 | ||
@@ -4,0 +14,0 @@ |
@@ -18,5 +18,5 @@ { | ||
"dependencies": { | ||
"@urql/core": ">=1.13.0", | ||
"@urql/core": ">=1.13.1", | ||
"wonka": "^4.0.14" | ||
} | ||
} |
@@ -14,7 +14,3 @@ "use strict"; | ||
function _ref(a) { | ||
return a.kind === kinds.Kind.OPERATION_DEFINITION; | ||
} | ||
function _ref2(a, b) { | ||
function _ref(a, b) { | ||
a[getName(b)] = b; | ||
@@ -32,3 +28,3 @@ return a; | ||
function _ref2$1(a, b, c) { | ||
function _ref2(a, b, c) { | ||
var e, d; | ||
@@ -68,3 +64,3 @@ if (0 < (currentData.refCount[a] || 0)) { | ||
function _ref2$2(a) { | ||
function _ref2$1(a) { | ||
return "query" === a.operationName && "network-only" !== a.context.requestPolicy; | ||
@@ -81,9 +77,2 @@ } | ||
function _ref$1(a) { | ||
return { | ||
query: printer.print(a.query), | ||
variables: a.variables | ||
}; | ||
} | ||
var query, read, readRoot, readRootField, readFragment, readSelection, resolveResolverResult, resolveLink, isDataOrKey, addCacheOutcome, toRequestPolicy, cacheExchange, isOptimisticMutation, isOfflineError, offlineExchange, _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"), printer = require("graphql/language/printer"), getName = function(a) { | ||
@@ -145,6 +134,10 @@ return a.name.value; | ||
}, getMainOperation = function(a) { | ||
invariant(!!(a = a.definitions.find(_ref)), "production" !== process.env.NODE_ENV ? "Invalid GraphQL document: All GraphQL documents must contain an OperationDefinitionnode for a query, subscription, or mutation." : "", 1); | ||
return a; | ||
for (var b = 0; b < a.definitions.length; b++) { | ||
if (a.definitions[b].kind === kinds.Kind.OPERATION_DEFINITION) { | ||
return a.definitions[b]; | ||
} | ||
} | ||
invariant(!1, "production" !== process.env.NODE_ENV ? "Invalid GraphQL document: All GraphQL documents must contain an OperationDefinitionnode for a query, subscription, or mutation." : "", 1); | ||
}, getFragments = function(a) { | ||
return a.definitions.filter(isFragmentNode).reduce(_ref2, {}); | ||
return a.definitions.filter(isFragmentNode).reduce(_ref, {}); | ||
}, shouldInclude = function(a, b) { | ||
@@ -318,3 +311,3 @@ var e, d, f, c = a.directives; | ||
}, gc = function() { | ||
currentData.gc.forEach(_ref2$1); | ||
currentData.gc.forEach(_ref2); | ||
}, updateDependencies = function(a, b) { | ||
@@ -505,3 +498,3 @@ "__typename" !== b && (a !== currentData.queryRootKey ? currentDependencies[a] = !0 : void 0 !== b && (currentDependencies[joinKeys(a, b)] = !0)); | ||
}, writeSelection = function(a, b, c, e) { | ||
var h, k, m, q, l, d = b === a.store.rootFields.query, f = !d && !!a.store.rootNames[b], g = f || d ? b : e.__typename; | ||
var h, k, m, n, l, d = b === a.store.rootFields.query, f = !d && !!a.store.rootNames[b], g = f || d ? b : e.__typename; | ||
if (g) { | ||
@@ -513,3 +506,3 @@ f || d || !b || writeRecord(b, "__typename", g); | ||
d = keyOfField(k, m); | ||
l = e[q = getFieldAlias(h)]; | ||
l = e[n = getFieldAlias(h)]; | ||
if ("production" !== process.env.NODE_ENV) { | ||
@@ -530,5 +523,5 @@ if (f || void 0 !== l) { | ||
updateContext(a, g, g, d, k); | ||
l = e[q] = ensureData(l(m || {}, a.store, a)); | ||
l = e[n] = ensureData(l(m || {}, a.store, a)); | ||
} | ||
h.selectionSet ? b && !f ? (q = joinKeys(b, d), h = writeField(a, getSelectionSet(h), ensureData(l), q), | ||
h.selectionSet ? b && !f ? (n = joinKeys(b, d), h = writeField(a, getSelectionSet(h), ensureData(l), n), | ||
writeLink(b || g, d, h)) : writeField(a, getSelectionSet(h), ensureData(l)) : b && !f && writeRecord(b || g, d, l); | ||
@@ -594,6 +587,6 @@ f && (updateContext(a, g, g, joinKeys(g, d), k), d = a.store.updates[g][k]) && (e[k] = l, | ||
if ("production" !== process.env.NODE_ENV) { | ||
var e = Object.keys(a.getTypeMap()); | ||
Object.keys(b).forEach((function c(a) { | ||
"production" !== process.env.NODE_ENV && -1 === e.indexOf(a) && warn("Invalid Object type: The type `" + a + "` is not an object in the defined schema, but the `keys` option is referencing it.", 20); | ||
})); | ||
a = a.getTypeMap(); | ||
for (var c in b) { | ||
"production" !== process.env.NODE_ENV && (a[c] || warn("Invalid Object type: The type `" + c + "` is not an object in the defined schema, but the `keys` option is referencing it.", 20)); | ||
} | ||
} | ||
@@ -616,11 +609,11 @@ }(this.schema, this.keys), function expectValidUpdatesConfig(a, b) { | ||
}(this.schema, this.updates), function expectValidResolversConfig(a, b) { | ||
var c, e, d, f, g, h, k; | ||
var c, e, d, f, g; | ||
if ("production" !== process.env.NODE_ENV) { | ||
c = Object.keys(a.getTypeMap()); | ||
c = a.getTypeMap(); | ||
for (e in b) { | ||
if ("Query" === e) { | ||
if (d = a.getQueryType()) { | ||
d = Object.keys(d.toConfig().fields); | ||
d = d.getFields(); | ||
for (f in b.Query) { | ||
-1 === d.indexOf(f) && warnAboutResolver("Query." + f); | ||
d[f] || warnAboutResolver("Query." + f); | ||
} | ||
@@ -630,9 +623,9 @@ } else { | ||
} | ||
} else if (-1 === c.indexOf(e)) { | ||
} else if (c[e]) { | ||
d = a.getType(e).getFields(); | ||
for (g in b[e]) { | ||
d[g] || warnAboutResolver(e + "." + g); | ||
} | ||
} else { | ||
warnAboutResolver(e); | ||
} else { | ||
d = Object.keys(a.getType(e).getFields()); | ||
for (g = 0, h = Object.keys(b[e]); g < h.length; g += 1) { | ||
-1 === d.indexOf(k = h[g]) && warnAboutResolver(e + "." + k); | ||
} | ||
} | ||
@@ -643,5 +636,5 @@ } | ||
if ("production" !== process.env.NODE_ENV) { | ||
a = a.getMutationType() ? Object.keys(a.getMutationType().toConfig().fields) : []; | ||
a = a.getMutationType() ? a.getMutationType().getFields() : {}; | ||
for (var c in b) { | ||
"production" !== process.env.NODE_ENV && -1 === a.indexOf(c) && warn("Invalid optimistic mutation field: `" + c + "` is not a mutation field in the defined schema, but the `optimistic` option is referencing it.", 24); | ||
"production" !== process.env.NODE_ENV && (a[c] || warn("Invalid optimistic mutation field: `" + c + "` is not a mutation field in the defined schema, but the `optimistic` option is referencing it.", 24)); | ||
} | ||
@@ -763,3 +756,3 @@ } | ||
}, readSelection = function(a, b, c, e, d) { | ||
var k, m, q, l, t, n, x, u, r, v, w, p, f = a.store, g = b === f.rootFields.query, h = d && f.keyOfEntity(d) || b; | ||
var k, m, n, l, r, p, v, t, u, w, x, q, f = a.store, g = b === f.rootFields.query, h = d && f.keyOfEntity(d) || b; | ||
"production" !== process.env.NODE_ENV && !g && a.store.rootNames[h] && warn("Invalid root traversal: A selection was being read on `" + h + "` which is an uncached root type.\nThe `" + a.store.rootFields.mutation + "` and `" + a.store.rootFields.subscription + "` types are special Operation Root Types and cannot be read back from the cache.", 25); | ||
@@ -772,37 +765,37 @@ if ("string" == typeof (b = g ? b : readRecord(h, "__typename") || d && d.__typename)) { | ||
c = makeSelectionIterator(b, h, c, a); | ||
for (m = !1, q = !1; void 0 !== (k = c.next()); ) { | ||
l = getName(k), t = getFieldArguments(k, a.variables), n = getFieldAlias(k), x = keyOfField(l, t), | ||
u = joinKeys(h, x), r = readRecord(h, x), v = d ? d[l] : void 0, w = f.resolvers[b]; | ||
for (m = !1, n = !1; void 0 !== (k = c.next()); ) { | ||
l = getName(k), r = getFieldArguments(k, a.variables), p = getFieldAlias(k), v = keyOfField(l, r), | ||
t = joinKeys(h, v), u = readRecord(h, v), w = d ? d[l] : void 0, x = f.resolvers[b]; | ||
"production" !== process.env.NODE_ENV && f.schema && b && isFieldAvailableOnType(f.schema, b, l); | ||
p = void 0; | ||
if (void 0 !== v && void 0 === k.selectionSet) { | ||
p = v; | ||
} else if ("read" === getCurrentOperation() && w && "function" == typeof w[l]) { | ||
if (updateContext(a, b, h, u, l), void 0 !== r && (e[n] = r), p = w[l](e, t || {}, f, a), | ||
void 0 !== k.selectionSet && (p = resolveResolverResult(a, b, l, u, getSelectionSet(k), e[n] || {}, p)), | ||
f.schema && null === p && !isFieldNullable(f.schema, b, l)) { | ||
q = void 0; | ||
if (void 0 !== w && void 0 === k.selectionSet) { | ||
q = w; | ||
} else if ("read" === getCurrentOperation() && x && "function" == typeof x[l]) { | ||
if (updateContext(a, b, h, t, l), void 0 !== u && (e[p] = u), q = x[l](e, r || {}, f, a), | ||
void 0 !== k.selectionSet && (q = resolveResolverResult(a, b, l, t, getSelectionSet(k), e[p] || {}, q)), | ||
f.schema && null === q && !isFieldNullable(f.schema, b, l)) { | ||
return; | ||
} | ||
} else { | ||
void 0 === k.selectionSet ? p = r : void 0 !== v ? p = resolveResolverResult(a, b, l, u, getSelectionSet(k), e[n], v) : void 0 !== (t = readLink(h, x)) ? p = resolveLink(a, t, b, l, getSelectionSet(k), e[n]) : "object" == typeof r && null !== r && (p = r); | ||
void 0 === k.selectionSet ? q = u : void 0 !== w ? q = resolveResolverResult(a, b, l, t, getSelectionSet(k), e[p], w) : void 0 !== (r = readLink(h, v)) ? q = resolveLink(a, r, b, l, getSelectionSet(k), e[p]) : "object" == typeof u && null !== u && (q = u); | ||
} | ||
if (void 0 === p && f.schema && isFieldNullable(f.schema, b, l)) { | ||
q = !0, e[n] = null; | ||
if (void 0 === q && f.schema && isFieldNullable(f.schema, b, l)) { | ||
n = !0, e[p] = null; | ||
} else { | ||
if (void 0 === p) { | ||
if (void 0 === q) { | ||
return; | ||
} | ||
m = !0; | ||
e[n] = p; | ||
e[p] = q; | ||
} | ||
} | ||
q && (a.partial = !0); | ||
return g && q && !m ? void 0 : e; | ||
n && (a.partial = !0); | ||
return g && n && !m ? void 0 : e; | ||
} | ||
} | ||
}, resolveResolverResult = function(a, b, c, e, d, f, g) { | ||
var h, k, m, q, l; | ||
var h, k, m, n, l; | ||
if (Array.isArray(g)) { | ||
h = !(h = a.store).schema || isListNullable(h.schema, b, c); | ||
for (k = Array(g.length), m = 0, q = g.length; m < q; m++) { | ||
for (k = Array(g.length), m = 0, n = g.length; m < n; m++) { | ||
if (void 0 !== (l = resolveResolverResult(a, b, c, joinKeys(e, "" + m), d, null != f ? f[m] : void 0, g[m])) || h) { | ||
@@ -827,8 +820,8 @@ k[m] = void 0 !== l ? l : null; | ||
}, resolveLink = function(a, b, c, e, d, f) { | ||
var g, h, k, m, q; | ||
var g, h, k, m, n; | ||
if (Array.isArray(b)) { | ||
g = (g = a.store).schema && isListNullable(g.schema, c, e); | ||
for (h = Array(b.length), k = 0, m = b.length; k < m; k++) { | ||
if (void 0 !== (q = resolveLink(a, b[k], c, e, d, null != f ? f[k] : void 0)) || g) { | ||
h[k] = void 0 !== q ? q : null; | ||
if (void 0 !== (n = resolveLink(a, b[k], c, e, d, null != f ? f[k] : void 0)) || g) { | ||
h[k] = void 0 !== n ? n : null; | ||
} else { | ||
@@ -862,3 +855,3 @@ return; | ||
function e(a) { | ||
"production" !== process.env.NODE_ENV && t({ | ||
"production" !== process.env.NODE_ENV && r({ | ||
type: "cacheMiss", | ||
@@ -875,3 +868,3 @@ message: "The result could not be retrieved from the cache", | ||
function f(a) { | ||
var b = a.operation, c = a.outcome, e = a.dependencies, d = { | ||
var b = a.operation, c = a.outcome, d = a.dependencies, e = { | ||
operation: addCacheOutcome(b, c), | ||
@@ -883,5 +876,5 @@ data: a.data, | ||
if ("cache-and-network" === b.context.requestPolicy || "cache-first" === b.context.requestPolicy && "partial" === c) { | ||
d.stale = !0, B(e) ? "cache-and-network" === b.context.requestPolicy && p.add(b.key) : l.reexecuteOperation(toRequestPolicy(b, "network-only")); | ||
e.stale = !0, B(d) ? "cache-and-network" === b.context.requestPolicy && q.add(b.key) : l.reexecuteOperation(toRequestPolicy(b, "network-only")); | ||
} | ||
"production" !== process.env.NODE_ENV && t({ | ||
"production" !== process.env.NODE_ENV && r({ | ||
type: "cacheHit", | ||
@@ -891,7 +884,7 @@ message: "A requested operation was found and returned from the cache.", | ||
data: { | ||
value: d | ||
value: e | ||
}, | ||
source: "cacheExchange" | ||
}); | ||
return d; | ||
return e; | ||
} | ||
@@ -904,18 +897,18 @@ function g(a) { | ||
function h(a) { | ||
return !u.has(a.operation.key); | ||
return !t.has(a.operation.key); | ||
} | ||
function k(a) { | ||
var b, c, d; | ||
if (r.push(a) < u.size) { | ||
if (u.push(a) < t.size) { | ||
return wonka.empty; | ||
} | ||
for (b = 0; b < r.length; b++) { | ||
reserveLayer(n.data, r[b].operation.key); | ||
for (b = 0; b < u.length; b++) { | ||
reserveLayer(p.data, u[b].operation.key); | ||
} | ||
for (c in w) { | ||
delete w[c]; | ||
for (c in x) { | ||
delete x[c]; | ||
} | ||
b = []; | ||
c = new Set; | ||
for (;d = r.shift(); ) { | ||
for (;d = u.shift(); ) { | ||
b.push(C(d, c)); | ||
@@ -927,11 +920,11 @@ } | ||
function m(a) { | ||
return u.has(a.operation.key); | ||
return t.has(a.operation.key); | ||
} | ||
var x, u, r, v, w, p, y, B, z, A, E, D, F, C, q = b.forward, l = b.client, t = b.dispatchDebug, n = new Store(a); | ||
a && a.storage && (x = a.storage.readData().then((function c(b) { | ||
hydrateData(n.data, a.storage, b); | ||
var v, t, u, w, x, q, y, B, z, A, E, D, F, C, n = b.forward, l = b.client, r = b.dispatchDebug, p = new Store(a); | ||
a && a.storage && (v = a.storage.readData().then((function c(b) { | ||
hydrateData(p.data, a.storage, b); | ||
}))); | ||
u = new Map, r = [], v = new Map, w = makeDict(), p = new Set, y = makeDict(), B = function(a) { | ||
t = new Map, u = [], w = new Map, x = makeDict(), q = new Set, y = makeDict(), B = function(a) { | ||
for (var b in a) { | ||
if (w[b]) { | ||
if (x[b]) { | ||
return !0; | ||
@@ -957,6 +950,6 @@ } | ||
if (b !== a.key) { | ||
if (c = v.get(b)) { | ||
v.delete(b); | ||
if (c = w.get(b)) { | ||
w.delete(b); | ||
d = "cache-first"; | ||
p.has(b) && (p.delete(b), d = "cache-and-network"); | ||
q.has(b) && (q.delete(b), d = "cache-and-network"); | ||
l.reexecuteOperation(toRequestPolicy(c, d)); | ||
@@ -969,12 +962,12 @@ } | ||
if ("query" === a.operationName) { | ||
reserveLayer(n.data, a.key); | ||
reserveLayer(p.data, a.key); | ||
} else if ("teardown" === a.operationName) { | ||
v.delete(a.key), noopDataState(n.data, a.key); | ||
w.delete(a.key), noopDataState(p.data, a.key); | ||
} else if ("mutation" === a.operationName && "network-only" !== a.context.requestPolicy) { | ||
b = writeOptimistic(n, a, a.key).dependencies; | ||
b = writeOptimistic(p, a, a.key).dependencies; | ||
if (!isDictEmpty(b)) { | ||
for (c in b) { | ||
w[c] = !0; | ||
x[c] = !0; | ||
} | ||
u.set(a.key, b); | ||
t.set(a.key, b); | ||
c = new Set; | ||
@@ -991,6 +984,6 @@ z(c, b); | ||
for (var c in b) { | ||
(y[c] || (y[c] = [])).push(a.key), v.set(a.key, a); | ||
(y[c] || (y[c] = [])).push(a.key), w.set(a.key, a); | ||
} | ||
}, F = function(a) { | ||
var b = query(n, a), c = b.data ? b.partial ? "partial" : "hit" : "miss"; | ||
var b = query(p, a), c = b.data ? b.partial ? "partial" : "hit" : "miss"; | ||
D(a, b.dependencies); | ||
@@ -1006,10 +999,10 @@ return { | ||
if ("mutation" === c.operationName) { | ||
g = u.get(f); | ||
g = t.get(f); | ||
z(b, g); | ||
u.delete(f); | ||
t.delete(f); | ||
} else { | ||
reserveLayer(n.data, c.key); | ||
reserveLayer(p.data, c.key); | ||
} | ||
if (a.data) { | ||
if (f = write(n, c, a.data, f).dependencies, z(b, f), f = query(n, c, a.data), a.data = f.data, | ||
if (f = write(p, c, a.data, f).dependencies, z(b, f), f = query(p, c, a.data), a.data = f.data, | ||
"query" === c.operationName) { | ||
@@ -1019,3 +1012,3 @@ z(b, h = f.dependencies); | ||
} else { | ||
noopDataState(n.data, c.key); | ||
noopDataState(p.data, c.key); | ||
} | ||
@@ -1033,9 +1026,9 @@ h && D(a.operation, h); | ||
a = wonka.share(a); | ||
b = x ? wonka.mergeMap(wonka.fromArray)(wonka.take(1)(wonka.buffer(wonka.fromPromise(x))(a))) : wonka.empty; | ||
b = v ? wonka.mergeMap(wonka.fromArray)(wonka.take(1)(wonka.buffer(wonka.fromPromise(v))(a))) : wonka.empty; | ||
b = wonka.share(wonka.concat([ b, a ])); | ||
a = wonka.share(wonka.map(F)(wonka.filter(_ref2$2)(b))); | ||
a = wonka.share(wonka.map(F)(wonka.filter(_ref2$1)(b))); | ||
b = wonka.filter(_ref3$1)(b); | ||
c = wonka.map(e)(wonka.filter(d)(a)); | ||
a = wonka.map(f)(wonka.filter(_ref7)(a)); | ||
c = wonka.share(q(wonka.map(E)(wonka.merge([ b, c ])))); | ||
c = wonka.share(n(wonka.map(E)(wonka.merge([ b, c ])))); | ||
b = wonka.map(g)(wonka.filter(h)(c)); | ||
@@ -1061,52 +1054,58 @@ c = wonka.mergeMap(k)(wonka.filter(m)(c)); | ||
return a && a.networkError && !a.response && ("undefined" != typeof navigator && !1 === navigator.onLine || /request failed|failed to fetch|network\s?error/i.test(a.networkError.message)); | ||
}; | ||
offlineExchange = function(a) { | ||
}, offlineExchange = function(a) { | ||
return function(b) { | ||
var c = b.forward, e = b.client, d = b.dispatchDebug; | ||
return function(b) { | ||
function k(a) { | ||
if ("subscription" === a.operation.operationName || !isOfflineError(a.error)) { | ||
return !0; | ||
function d(a) { | ||
return "mutation" === a.operation.operationName && isOfflineError(a.error) && isOptimisticMutation(l, a.operation) ? (r.push(a.operation), | ||
p(), !1) : !0; | ||
} | ||
var m, n, l, r, p, v, t, u, k = a.storage; | ||
if (k && k.onOnline && k.readMetadata && k.writeMetadata) { | ||
m = b.forward, n = b.client; | ||
b = b.dispatchDebug; | ||
l = a.optimistic || {}, r = [], p = function c() { | ||
var a, b, c; | ||
for (a = [], b = 0; b < r.length; b++) { | ||
"mutation" === (c = r[b]).operationName && a.push({ | ||
query: printer.print(c.query), | ||
variables: c.variables | ||
}); | ||
} | ||
if ("mutation" === a.operation.operationName) { | ||
return isOptimisticMutation(u, a.operation) ? (r.push(a.operation), v(), !1) : !0; | ||
k.writeMetadata(a); | ||
}, v = !1; | ||
k.onOnline(t = function e() { | ||
if (!v) { | ||
v = !0; | ||
for (var a; a = r.shift(); ) { | ||
n.reexecuteOperation(a); | ||
} | ||
p(); | ||
v = !1; | ||
} | ||
Promise.resolve().then((function() { | ||
return x(toRequestPolicy(a.operation, "cache-only")); | ||
})); | ||
return !1; | ||
} | ||
var u, r, v, w, p, l = a.storage, t = wonka.makeSubject(), n = t.source, x = t.next; | ||
t = c; | ||
if (l && l.onOnline && l.readMetadata && l.writeMetadata) { | ||
u = a.optimistic || {}, r = [], v = function f() { | ||
l.writeMetadata(r.map(_ref$1)); | ||
}, w = !1; | ||
t = function m(a) { | ||
return wonka.filter(k)(c(a)); | ||
}; | ||
l.onOnline(p = function h() { | ||
for (var a; !w && (a = r.shift()); ) { | ||
w = !0, e.dispatchOperation(e.createRequestOperation("mutation", a)), w = !1; | ||
}); | ||
k.readMetadata().then((function g(a) { | ||
if (a) { | ||
for (var b = 0; b < a.length; b++) { | ||
r.push(n.createRequestOperation("mutation", core.createRequest(a[b].query, a[b].variables))); | ||
} | ||
v(); | ||
}); | ||
l.readMetadata().then((function q(a) { | ||
if (a) { | ||
for (var b = 0; b < a.length; b++) { | ||
r.push(core.createRequest(a[b].query, a[b].variables)); | ||
} | ||
} | ||
p(); | ||
})); | ||
} | ||
b = wonka.share(b); | ||
n = wonka.merge([ n, b ]); | ||
return cacheExchange(a)({ | ||
forward: t, | ||
client: e, | ||
dispatchDebug: d | ||
})(n); | ||
}; | ||
t(); | ||
} | ||
})); | ||
u = cacheExchange(a)({ | ||
client: n, | ||
dispatchDebug: b, | ||
forward: function f(a) { | ||
return wonka.filter(d)(m(a)); | ||
} | ||
}); | ||
return function h(a) { | ||
a = wonka.share(a); | ||
var b = wonka.makeSubject(), c = b.next; | ||
a = wonka.merge([ b.source, a ]); | ||
return wonka.filter((function(a) { | ||
return "query" === a.operation.operationName && isOfflineError(a.error) ? (c(toRequestPolicy(a.operation, "cache-only")), | ||
r.push(a.operation), !1) : !0; | ||
}))(u(a)); | ||
}; | ||
} | ||
return cacheExchange(a)(b); | ||
}; | ||
@@ -1113,0 +1112,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("./1cc90026.min.js"),t=require("graphql/utilities/valueFromASTUntyped"),r=require("graphql/language/kinds"),n=require("graphql/type/definition"),i=require("@urql/core"),o=require("graphql/utilities/buildClientSchema"),a=require("wonka"),u=require("graphql/language/printer"),s=function(e){return e.name.value},f=function(e){return e.typeCondition.name.value},c=function(e){return e.alias?e.alias.value:s(e)},l=function(e){return e.selectionSet?e.selectionSet.selections:[]},d=function(e){return(e=e.typeCondition)?s(e):null},p=function(e){return e.kind===r.Kind.FIELD},v=function(e){return e.kind===r.Kind.INLINE_FRAGMENT},y=function(e,r){var n={},i=0;if(e.arguments&&e.arguments.length)for(var o=0,a=e.arguments.length;o<a;o++){var u=e.arguments[o],f=t.valueFromASTUntyped(u.value,r);null!=f&&(n[s(u)]=f,i++)}return 0<i?n:null},m=function(e,t){if(t&&e.variableDefinitions){for(var r={},n=0,i=e.variableDefinitions.length;n<i;n++){var o=s(e.variableDefinitions[n].variable);r[o]=t[o]}return r}},h=function(e,r){var n={};if(!r)return n;if(e.variableDefinitions)for(var i=0,o=e.variableDefinitions.length;i<o;i++){var a=e.variableDefinitions[i],u=s(a.variable);n[u]=void 0===r[u]&&a.defaultValue?t.valueFromASTUntyped(a.defaultValue,r):r[u]}for(var f in r)f in n||(n[f]=r[f]);return n};function g(e,t,r){if(!e)throw(e=Error((t||"Minfied Error #"+r+"\n")+"\nhttps://bit.ly/2XbVrpR#"+r)).name="Graphcache Error",e}var k=function(e){return e.kind===r.Kind.FRAGMENT_DEFINITION};function b(e){return e.kind===r.Kind.OPERATION_DEFINITION}var q=function(e){return g(!!(e=e.definitions.find(b)),"",1),e};function O(e,t){return e[s(t)]=t,e}var _=function(e){return e.definitions.filter(k).reduce(O,{})},x=function(e,r){var n=e.directives;if(!n)return!0;for(var i=0,o=n.length;i<o;i++){var a=n[i];if(("include"===(e=s(a))||"skip"===e)&&a.arguments&&a.arguments[0]&&"if"===s(a.arguments[0]))return r=t.valueFromASTUntyped(a.arguments[0].value,r),"include"===e?!!r:!r}return!0},w=/^__/,N=function(e,t,r){return!!w.test(r)||!!(e=E(e,t,r))&&n.isNullableType(e.type)},K=function(e,t,r){return!!(e=E(e,t,r))&&(e=n.isNonNullType(e.type)?e.type.ofType:e.type,n.isListType(e)&&n.isNullableType(e.ofType))},S=function(e,t,r){return!(!r||!t)&&(r===t||(t=e.getType(t),r=e.getType(r),t instanceof n.GraphQLObjectType?t===r:(function(e,t){g(e instanceof n.GraphQLInterfaceType||e instanceof n.GraphQLUnionType,"",5)}(t),T(r),e.isPossibleType(t,r))))},E=function(e,t,r){return T(e=e.getType(t)),e.getFields()[r]};function T(e,t){g(e instanceof n.GraphQLObjectType,"",3)}var F=function(e,t){return t?e+"("+i.stringifyVariables(t)+")":e},A=function(e,t){return e+"."+t},L=function(e){var t=e.indexOf("(");return-1<t?{fieldKey:e,fieldName:e.slice(0,t),arguments:JSON.parse(e.slice(t+1,-1))}:{fieldKey:e,fieldName:e,arguments:null}},M=function(e){var t=e.indexOf(".");return{entityKey:e.slice(0,t).replace(/%2e/g,"."),fieldKey:e=e.slice(t+1)}},D=function(){return Object.create(null)},P=null,I=null,R=null,j=null,C=!1,Q=function(){return{optimistic:D(),base:new Map}},G=function(e,t,r,n){P=e,I=t,R=D(),C=!!n,r?n||0<t.optimisticOrder.length?(n||t.commutativeKeys.has(r)?n&&t.commutativeKeys.delete(r):ae(t,r),j=r,ue(t,r)):(j=null,fe(t,r)):j=null},V=function(){var e=I,t=j;if(C=!1,j=null,t&&-1<e.optimisticOrder.indexOf(t))for(t=e.optimisticOrder.length;0<=--t&&e.refLock[e.optimisticOrder[t]]&&e.commutativeKeys.has(e.optimisticOrder[t]);)de(e.optimisticOrder[t]);R=I=P=null,e.defer||(e.defer=!0,Promise.resolve().then((function(){G("write",e,null),$(),ve(),V(),e.defer=!1})))},U=function(e,t,r){G("read",e,t,r),V()},J=function(){return g(null!==R,"",2),R},B=function(e,t,r,n){var i=(e=j?e.optimistic[j]:e.base).get(t);void 0===i&&e.set(t,i=D()),void 0!==n||j?i[r]=n:delete i[r]},z=function(e,t,r){for(var n,i=0,o=I.optimisticOrder.length;i<o;i++){var a=I.optimisticOrder[i],u=e.optimistic[a];if(u&&(!C||I.commutativeKeys.has(a))&&void 0!==(n=u.get(t))&&r in n)return n[r]}return void 0!==(n=e.base.get(t))?n[r]:void 0},X=function(e,t,r,n){var i=void 0!==t[r]?t[r]:0;t=t[r]=i+n|0,void 0!==e&&(0>=t?e.add(r):0>=i&&0<t&&e.delete(r))},H=function(e,t,r,n){if("string"==typeof r)X(e,t,r,n);else if(Array.isArray(r))for(var i=0,o=r.length;i<o;i++){var a=r[i];a&&X(e,t,a,n)}},W=function(e,t,r){if(void 0!==r)for(var n in r)t.has(n)||(e.push(L(n)),t.add(n))},Y=function(e,t,r,n){W(e,t,n.base.get(r));for(var i=0,o=I.optimisticOrder.length;i<o;i++){var a=n.optimistic[I.optimisticOrder[i]];void 0!==a&&W(e,t,a.get(r))}};function Z(e,t,r){if(0<(I.refCount[e]||0))r.delete(e);else{for(var n in I.refLock){if(0<((t=I.refLock[n])[e]||0))return;delete t[e]}if(delete I.refCount[e],r.delete(e),I.records.base.delete(e),n=I.links.base.get(e))for(var i in I.links.base.delete(e),n)H(r,I.refCount,n[i],-1)}}var $=function(){I.gc.forEach(Z)},ee=function(e,t){"__typename"!==t&&(e!==I.queryRootKey?R[e]=!0:void 0!==t&&(R[A(e,t)]=!0))},te=function(e,t){!C&&I.storage&&I.persist.add(function(e,t){return e.replace(/\./g,"%2e")+"."+t}(e,t))},re=function(e,t){return ee(e,t),z(I.records,e,t)},ne=function(e,t){return ee(e,t),z(I.links,e,t)},ie=function(e,t,r){ee(e,t),te(e,t),B(I.records,e,t,r)},oe=function(e,t,r){var n=I;if(j)var i=n.refLock[j]||(n.refLock[j]=D()),o=n.links.optimistic[j];else{i=n.refCount,o=n.links.base;var a=n.gc}o=(o=o&&o.get(e))&&o[t],ee(e,t),te(e,t),B(n.links,e,t,r),H(a,i,o,-1),H(a,i,r,1)},ae=function(e,t){var r=e.optimisticOrder.indexOf(t);-1===r?e.optimisticOrder.unshift(t):e.commutativeKeys.has(t)||(se(e,t),e.optimisticOrder.splice(r,1),e.optimisticOrder.unshift(t)),e.commutativeKeys.add(t)},ue=function(e,t){-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=D(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)},se=function(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])},fe=function(e,t){var r=e.optimisticOrder.indexOf(t);-1<r&&(e.optimisticOrder.splice(r,1),e.commutativeKeys.delete(t)),se(e,t)};function ce(e,t){for(var r in e)oe(t,r,e[r])}function le(e,t){for(var r in e)ie(t,r,e[r])}var de=function(e){var t=R;R=D();var r=I.links.optimistic[e];r&&r.forEach(ce),(r=I.records.optimistic[e])&&r.forEach(le),R=t,fe(I,e)},pe=function(e){var t=I.links,r=I.records,n=[],i=new Set;return ee(e),Y(n,i,e,t),Y(n,i,e,r),n},ve=function(){if(I.storage){C=!0;var e=D();I.persist.forEach((function(t){var r,n=M(t),o=n.entityKey;e[t]=void 0!==(r=ne(o,n=n.fieldKey))?":"+i.stringifyVariables(r):void 0!==(r=re(o,n))?i.stringifyVariables(r):void 0})),C=!1,I.storage.writeData(e),I.persist.clear()}},ye=function(e,t,r,n,i,o){return{store:e,variables:t,fragments:r,parentTypeName:n,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},me=function(e,t,r,n,i){e.parentTypeName=t,e.parentKey=r,e.parentFieldKey=n,e.fieldName=i},he=function(e,t,r,n){return!(!t||t!==d(e)&&l(e).some((function(e){return!!p(e)&&(e=F(s(e),y(e,n)),!function(e,t){return void 0!==re(e,t)||void 0!==ne(e,t)}(r,e))})))},ge=function(e,t,r,n){var i=[0],o=[r];return{next:function(){for(;0!==i.length;){var r=i[i.length-1]++,a=o[o.length-1];if(r>=a.length)i.pop(),o.pop();else if(x(r=a[r],n.variables))if(p(r)){if("__typename"!==s(r))return r}else void 0!==(r=v(r)?r:n.fragments[s(r)])&&(n.store.schema?S(n.store.schema,d(r),e):he(r,e,t,n.variables))&&(i.push(0),o.push(l(r)))}}}},ke=function(e){return void 0===e?null:e},be=function(e,t,r,n){return G("write",e.data,n||null),e=qe(e,t,r),V(),e},qe=function(e,t,r){var n=q(t.query),i={data:r,dependencies:J()},o=e.rootFields[n.operation];return e=ye(e,h(n,t.variables),_(t.query),o,o),_e(e,o,l(n),r),i},Oe=function(e,t,r){G("write",e.data,r,!0),r=q(t.query);var n={data:{},dependencies:J()},i=e.rootFields[r.operation];return g(i===e.rootFields.mutation,"",10),e=ye(e,h(r,t.variables),_(t.query),i,i,!0),_e(e,i,l(r),n.data),V(),n},_e=function(e,t,r,n){var i=t===e.store.rootFields.query,o=!i&&!!e.store.rootNames[t],a=o||i?t:n.__typename;if(a){o||i||!t||ie(t,"__typename",a),r=ge(a,t||a,r,e);for(var u;u=r.next();){i=s(u);var f=y(u,e.variables),d=F(i,f),p=c(u),v=n[p];if(e.optimistic&&o){if(!(v=e.store.optimisticMutations[i]))continue;me(e,a,a,d,i),v=n[p]=ke(v(f||{},e.store,e))}u.selectionSet?t&&!o?(p=A(t,d),u=xe(e,l(u),ke(v),p),oe(t||a,d,u)):xe(e,l(u),ke(v)):t&&!o&&ie(t||a,d,v),o&&(me(e,a,a,A(a,d),i),d=e.store.updates[a][i])&&(n[i]=v,d(n,f||{},e.store,e))}}},xe=function(e,t,r,n){if(Array.isArray(r)){for(var i=Array(r.length),o=0,a=r.length;o<a;o++){var u=r[o],s=n?A(n,""+o):void 0;u=xe(e,t,u,s),i[o]=u}return i}return null===r?null:(n=e.store.keyOfEntity(r)||n,_e(e,n,t,r),n||null)},we=function(e){var t,r;this.keyOfField=F,e||(e={}),this.resolvers=e.resolvers||{},this.optimisticMutations=e.optimistic||{},this.keys=e.keys||{};var n="Query",i="Mutation",a="Subscription";if(e.schema){var u=this.schema=o.buildClientSchema(e.schema),s=u.getQueryType(),f=u.getMutationType();u=u.getSubscriptionType(),n=s?s.name:n,i=f?f.name:i,a=u?u.name:a}this.updates=((t={})[i]=e.updates&&e.updates.Mutation||{},t[a]=e.updates&&e.updates.Subscription||{},t),this.rootFields={query:n,mutation:i,subscription:a},this.rootNames=((r={})[n]="query",r[i]="mutation",r[a]="subscription",r),this.data=function(e){return{defer:!1,gc:new Set,persist:new Set,queryRootKey:e,refCount:D(),refLock:D(),links:Q(),records:Q(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(n)};we.prototype.keyOfEntity=function(e){var t,r=e.__typename,n=e.id,i=e._id;return r?void 0!==this.rootNames[r]?r:(this.keys[r]?t=this.keys[r](e):null!=n?t=""+n:null!=i&&(t=""+i),t?r+":"+t:null):null},we.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var r=re(e,t);return void 0!==r?r:(t=ne(e,t))?t:null},we.prototype.resolve=function(e,t,r){return this.resolveFieldByKey(e,F(t,r))},we.prototype.invalidate=function(e,t,r){g(e="string"==typeof e?e:this.keyOfEntity(e),"",19),function(e,t,r){t=t?[{fieldKey:F(t,r)}]:pe(e),r=0;for(var n=t.length;r<n;r++){var i=t[r].fieldKey;void 0!==ne(e,i)?oe(e,i,void 0):ie(e,i,void 0)}}(e,t,r)},we.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?pe(e):[]},we.prototype.updateQuery=function(e,t){e=i.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&qe(this,e,t)},we.prototype.readQuery=function(e){return Ke(this,i.createRequest(e.query,e.variables)).data},we.prototype.readFragment=function(e,t,r){return Te(this,e,t,r)},we.prototype.writeFragment=function(t,r,n){!function(t,r,n,i){r=_(r);var o=Object.keys(r);if(void 0!==(o=r[o[0]])){var a=f(o);n=e._extends({},{__typename:a},n);var u=t.keyOfEntity(n);u&&(t=ye(t,i||{},r,a,u),_e(t,u,l(o),n))}}(this,t,r,n)};var Ne=function(e,t,r){return G("read",e.data,null),e=Ke(e,t,r),V(),e},Ke=function(e,t,r){var n=q(t.query),i=e.rootFields[n.operation],o=l(n);return r=r||{},r=i!==(e=ye(e,h(n,t.variables),_(t.query),i,i)).store.rootFields.query?Se(e,i,o,r):Fe(e,i,o,r),{dependencies:J(),partial:void 0!==r&&e.partial,data:void 0===r?null:r}},Se=function(e,t,r,n){if("string"!=typeof n.__typename)return n;t=ge(t,t,r,e),(r={}).__typename=n.__typename;for(var i;void 0!==(i=t.next());){var o=c(i),a=n[o];void 0!==i.selectionSet&&null!==a?(a=ke(a),r[o]=Ee(e,l(i),a)):r[o]=a}return r},Ee=function(e,t,r){if(Array.isArray(r)){for(var n=Array(r.length),i=0,o=r.length;i<o;i++)n[i]=Ee(e,t,r[i]);return n}return null===r?null:null!==(n=e.store.keyOfEntity(r))?void 0===(e=Fe(e,n,t,{}))?null:e:Se(e,r.__typename,t,r)},Te=function(t,r,n,i){r=_(r);var o=Object.keys(r);if(void 0===(o=r[o[0]]))return null;var a=f(o);return"string"==typeof n||n.__typename||(n.__typename=a),(n="string"!=typeof n?t.keyOfEntity(e._extends({},{__typename:a},n)):n)?(t=ye(t,i||{},r,a,n),Fe(t,n,l(o),{})||null):null},Fe=function(e,t,r,n,i){var o=e.store,a=t===o.rootFields.query,u=i&&o.keyOfEntity(i)||t;if("string"==typeof(t=a?t:re(u,"__typename")||i&&i.__typename)&&(!i||t===i.__typename)){n.__typename=t,r=ge(t,u,r,e);for(var f,d=!1,p=!1;void 0!==(f=r.next());){var v=s(f),m=y(f,e.variables),h=c(f),k=F(v,m),b=A(u,k),q=re(u,k),O=i?i[v]:void 0,_=o.resolvers[t],x=void 0;if(void 0!==O&&void 0===f.selectionSet)x=O;else if("read"===(g(null!==P,"",2),P)&&_&&"function"==typeof _[v]){if(me(e,t,u,b,v),void 0!==q&&(n[h]=q),x=_[v](n,m||{},o,e),void 0!==f.selectionSet&&(x=Ae(e,t,v,b,l(f),n[h]||{},x)),o.schema&&null===x&&!N(o.schema,t,v))return}else void 0===f.selectionSet?x=q:void 0!==O?x=Ae(e,t,v,b,l(f),n[h],O):void 0!==(m=ne(u,k))?x=Le(e,m,t,v,l(f),n[h]):"object"==typeof q&&null!==q&&(x=q);if(void 0===x&&o.schema&&N(o.schema,t,v))p=!0,n[h]=null;else{if(void 0===x)return;d=!0,n[h]=x}}return p&&(e.partial=!0),a&&p&&!d?void 0:n}},Ae=function(e,t,r,n,i,o,a){if(Array.isArray(a)){var u=e.store;u=!u.schema||K(u.schema,t,r);for(var s=Array(a.length),f=0,c=a.length;f<c;f++){var l=Ae(e,t,r,A(n,""+f),i,null!=o?o[f]:void 0,a[f]);if(void 0===l&&!u)return;s[f]=void 0!==l?l:null}return s}return null==a?a:null===o?null:Me(a)?(t=o||{},"string"==typeof a?Fe(e,a,i,t):Fe(e,n,i,t,a)):void 0},Le=function(e,t,r,n,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&K(a.schema,r,n);for(var u=Array(t.length),s=0,f=t.length;s<f;s++){var c=Le(e,t[s],r,n,i,null!=o?o[s]:void 0);if(void 0===c&&!a)return;u[s]=void 0!==c?c:null}return u}return null===t||null===o?null:Fe(e,t,i,o||{})},Me=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},De=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:r})})})},Pe=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:r})})};function Ie(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Re(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function je(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}var Ce=function(t){return function(r){function n(e){return De(e.operation,"miss")}function o(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy&&!x(e.dependencies)}function u(e){var t=e.operation,r=e.outcome,n=e.dependencies;return e={operation:De(t,r),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===r)&&(e.stale=!0,x(n)?"cache-and-network"===t.context.requestPolicy&&O.add(t.key):v.reexecuteOperation(Pe(t,"network-only"))),e}function s(e){var t=new Set,r=T(e,t);return N(e.operation,t),r}function f(e){return!h.has(e.operation.key)}function c(e){if(g.push(e)<h.size)return a.empty;for(var t=0;t<g.length;t++)ae(y.data,g[t].operation.key);for(var r in b)delete b[r];t=[],r=new Set;for(var n;n=g.shift();)t.push(T(n,r));return N(e.operation,r),a.fromArray(t)}function l(e){return h.has(e.operation.key)}var d,p=r.forward,v=r.client,y=new we(t);t&&t.storage&&(d=t.storage.readData().then((function(e){!function(e,t,r){for(var n in G("read",e,null),r){var i=r[n];if(void 0!==i){var o=M(n),a=o.entityKey;o=o.fieldKey,":"===i[0]?oe(a,o,JSON.parse(i.slice(1))):ie(a,o,JSON.parse(i))}}V(),e.storage=t}(y.data,t.storage,e)})));var h=new Map,g=[],k=new Map,b=D(),O=new Set,_=D(),x=function(e){for(var t in e)if(b[t])return!0;return!1},w=function(e,t){if(t)for(var r in t)if(t=_[r]){_[r]=[];for(var n=0,i=t.length;n<i;n++)e.add(t[n])}},N=function(e,t){t.forEach((function(t){if(t!==e.key){var r=k.get(t);if(r){k.delete(t);var n="cache-first";O.has(t)&&(O.delete(t),n="cache-and-network"),v.reexecuteOperation(Pe(r,n))}}}))},K=function(t){if("query"===t.operationName)ae(y.data,t.key);else if("teardown"===t.operationName)k.delete(t.key),U(y.data,t.key);else if("mutation"===t.operationName&&"network-only"!==t.context.requestPolicy){var r=Oe(y,t,t.key).dependencies;if(!function(e){for(var t in e)return!1;return!0}(r)){for(var n in r)b[n]=!0;h.set(t.key,r),n=new Set,w(n,r),N(t,n)}}return e._extends({},t,{variables:t.variables?m(q(t.query),t.variables):t.variables,query:i.formatDocument(t.query)})},S=function(e,t){for(var r in t)(_[r]||(_[r]=[])).push(e.key),k.set(e.key,e)},E=function(e){var t=Ne(y,e),r=t.data?t.partial?"partial":"hit":"miss";return S(e,t.dependencies),{outcome:r,operation:e,data:t.data,dependencies:t.dependencies}},T=function(e,t){var r=e.operation,n=e.error,i=e.extensions,o=r.key;if("mutation"===r.operationName){var a=h.get(o);w(t,a),h.delete(o)}else ae(y.data,r.key);if(e.data){if(o=be(y,r,e.data,o).dependencies,w(t,o),o=Ne(y,r,e.data),e.data=o.data,"query"===r.operationName){var u=o.dependencies;w(t,u)}}else U(y.data,r.key);return u&&S(e.operation,u),{data:e.data,error:n,extensions:i,operation:r}};return function(e){e=a.share(e);var t=d?a.mergeMap(a.fromArray)(a.take(1)(a.buffer(a.fromPromise(d))(e))):a.empty;t=a.share(a.concat([t,e])),e=a.share(a.map(E)(a.filter(Ie)(t))),t=a.filter(Re)(t);var r=a.map(n)(a.filter(o)(e));return e=a.map(u)(a.filter(je)(e)),r=a.share(p(a.map(K)(a.merge([t,r])))),t=a.map(s)(a.filter(f)(r)),r=a.mergeMap(c)(a.filter(l)(r)),a.merge([t,r,e])}}};function Qe(e){return{query:u.print(e.query),variables:e.variables}}exports.Store=we,exports.cacheExchange=Ce,exports.noopDataState=U,exports.offlineExchange=function(e){return function(t){var r=t.forward,n=t.client,o=t.dispatchDebug;return function(t){function u(e){return!("subscription"!==e.operation.operationName&&function(e){return e&&e.networkError&&!e.response&&("undefined"!=typeof navigator&&!1===navigator.onLine||/request failed|failed to fetch|network\s?error/i.test(e.networkError.message))}(e.error)&&("mutation"===e.operation.operationName?function(e,t){var r,n=t.variables||D(),i=_(t.query);for(t=[].concat(l(q(t.query)));r=t.pop();)if(x(r,n))if(p(r)){if(e[s(r)])return!0}else(r=v(r)?r:i[s(r)])&&t.push.apply(t,l(r));return!1}(m,e.operation)&&(h.push(e.operation),g(),1):(Promise.resolve().then((function(){return y(Pe(e.operation,"cache-only"))})),1)))}var f=e.storage,c=a.makeSubject(),d=c.source,y=c.next;if(c=r,f&&f.onOnline&&f.readMetadata&&f.writeMetadata){var m=e.optimistic||{},h=[],g=function(){f.writeMetadata(h.map(Qe))},k=!1,b=function(){for(var e;!k&&(e=h.shift());)k=!0,n.dispatchOperation(n.createRequestOperation("mutation",e)),k=!1;g()};c=function(e){return a.filter(u)(r(e))},f.onOnline(b),f.readMetadata().then((function(e){if(e)for(var t=0;t<e.length;t++)h.push(i.createRequest(e[t].query,e[t].variables));b()}))}return t=a.share(t),d=a.merge([d,t]),Ce(e)({forward:c,client:n,dispatchDebug:o})(d)}}},exports.query=Ne,exports.reserveLayer=ae,exports.write=be,exports.writeOptimistic=Oe; | ||
"use strict";var e=require("./1cc90026.min.js"),t=require("graphql/utilities/valueFromASTUntyped"),r=require("graphql/language/kinds"),n=require("graphql/type/definition"),i=require("@urql/core"),o=require("graphql/utilities/buildClientSchema"),a=require("wonka"),u=require("graphql/language/printer"),s=function(e){return e.name.value},f=function(e){return e.typeCondition.name.value},l=function(e){return e.alias?e.alias.value:s(e)},c=function(e){return e.selectionSet?e.selectionSet.selections:[]},d=function(e){return(e=e.typeCondition)?s(e):null},p=function(e){return e.kind===r.Kind.FIELD},v=function(e){return e.kind===r.Kind.INLINE_FRAGMENT},y=function(e,r){var n={},i=0;if(e.arguments&&e.arguments.length)for(var o=0,a=e.arguments.length;o<a;o++){var u=e.arguments[o],f=t.valueFromASTUntyped(u.value,r);null!=f&&(n[s(u)]=f,i++)}return 0<i?n:null},m=function(e,t){if(t&&e.variableDefinitions){for(var r={},n=0,i=e.variableDefinitions.length;n<i;n++){var o=s(e.variableDefinitions[n].variable);r[o]=t[o]}return r}},h=function(e,r){var n={};if(!r)return n;if(e.variableDefinitions)for(var i=0,o=e.variableDefinitions.length;i<o;i++){var a=e.variableDefinitions[i],u=s(a.variable);n[u]=void 0===r[u]&&a.defaultValue?t.valueFromASTUntyped(a.defaultValue,r):r[u]}for(var f in r)f in n||(n[f]=r[f]);return n};function g(e,t,r){if(!e)throw(e=Error((t||"Minfied Error #"+r+"\n")+"\nhttps://bit.ly/2XbVrpR#"+r)).name="Graphcache Error",e}var k=function(e){return e.kind===r.Kind.FRAGMENT_DEFINITION},b=function(e){for(var t=0;t<e.definitions.length;t++)if(e.definitions[t].kind===r.Kind.OPERATION_DEFINITION)return e.definitions[t];g(!1,"",1)};function q(e,t){return e[s(t)]=t,e}var O=function(e){return e.definitions.filter(k).reduce(q,{})},_=function(e,r){var n=e.directives;if(!n)return!0;for(var i=0,o=n.length;i<o;i++){var a=n[i];if(("include"===(e=s(a))||"skip"===e)&&a.arguments&&a.arguments[0]&&"if"===s(a.arguments[0]))return r=t.valueFromASTUntyped(a.arguments[0].value,r),"include"===e?!!r:!r}return!0},x=/^__/,w=function(e,t,r){return!!x.test(r)||!!(e=S(e,t,r))&&n.isNullableType(e.type)},N=function(e,t,r){return!!(e=S(e,t,r))&&(e=n.isNonNullType(e.type)?e.type.ofType:e.type,n.isListType(e)&&n.isNullableType(e.ofType))},K=function(e,t,r){return!(!r||!t)&&(r===t||(t=e.getType(t),r=e.getType(r),t instanceof n.GraphQLObjectType?t===r:(function(e,t){g(e instanceof n.GraphQLInterfaceType||e instanceof n.GraphQLUnionType,"",5)}(t),E(r),e.isPossibleType(t,r))))},S=function(e,t,r){return E(e=e.getType(t)),e.getFields()[r]};function E(e,t){g(e instanceof n.GraphQLObjectType,"",3)}var T=function(e,t){return t?e+"("+i.stringifyVariables(t)+")":e},F=function(e,t){return e+"."+t},A=function(e){var t=e.indexOf("(");return-1<t?{fieldKey:e,fieldName:e.slice(0,t),arguments:JSON.parse(e.slice(t+1,-1))}:{fieldKey:e,fieldName:e,arguments:null}},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)},D=null,P=null,I=null,R=null,j=!1,C=function(){return{optimistic:M(),base:new Map}},Q=function(e,t,r,n){D=e,P=t,I=M(),j=!!n,r?n||0<t.optimisticOrder.length?(n||t.commutativeKeys.has(r)?n&&t.commutativeKeys.delete(r):oe(t,r),R=r,ae(t,r)):(R=null,se(t,r)):R=null},G=function(){var e=P,t=R;if(j=!1,R=null,t&&-1<e.optimisticOrder.indexOf(t))for(t=e.optimisticOrder.length;0<=--t&&e.refLock[e.optimisticOrder[t]]&&e.commutativeKeys.has(e.optimisticOrder[t]);)ce(e.optimisticOrder[t]);I=P=D=null,e.defer||(e.defer=!0,Promise.resolve().then((function(){Q("write",e,null),Z(),pe(),G(),e.defer=!1})))},V=function(e,t,r){Q("read",e,t,r),G()},U=function(){return g(null!==I,"",2),I},J=function(e,t,r,n){var i=(e=R?e.optimistic[R]:e.base).get(t);void 0===i&&e.set(t,i=M()),void 0!==n||R?i[r]=n:delete i[r]},B=function(e,t,r){for(var n,i=0,o=P.optimisticOrder.length;i<o;i++){var a=P.optimisticOrder[i],u=e.optimistic[a];if(u&&(!j||P.commutativeKeys.has(a))&&void 0!==(n=u.get(t))&&r in n)return n[r]}return void 0!==(n=e.base.get(t))?n[r]:void 0},z=function(e,t,r,n){var i=void 0!==t[r]?t[r]:0;t=t[r]=i+n|0,void 0!==e&&(0>=t?e.add(r):0>=i&&0<t&&e.delete(r))},X=function(e,t,r,n){if("string"==typeof r)z(e,t,r,n);else if(Array.isArray(r))for(var i=0,o=r.length;i<o;i++){var a=r[i];a&&z(e,t,a,n)}},H=function(e,t,r){if(void 0!==r)for(var n in r)t.has(n)||(e.push(A(n)),t.add(n))},W=function(e,t,r,n){H(e,t,n.base.get(r));for(var i=0,o=P.optimisticOrder.length;i<o;i++){var a=n.optimistic[P.optimisticOrder[i]];void 0!==a&&H(e,t,a.get(r))}};function Y(e,t,r){if(0<(P.refCount[e]||0))r.delete(e);else{for(var n in P.refLock){if(0<((t=P.refLock[n])[e]||0))return;delete t[e]}if(delete P.refCount[e],r.delete(e),P.records.base.delete(e),n=P.links.base.get(e))for(var i in P.links.base.delete(e),n)X(r,P.refCount,n[i],-1)}}var Z=function(){P.gc.forEach(Y)},$=function(e,t){"__typename"!==t&&(e!==P.queryRootKey?I[e]=!0:void 0!==t&&(I[F(e,t)]=!0))},ee=function(e,t){!j&&P.storage&&P.persist.add(function(e,t){return e.replace(/\./g,"%2e")+"."+t}(e,t))},te=function(e,t){return $(e,t),B(P.records,e,t)},re=function(e,t){return $(e,t),B(P.links,e,t)},ne=function(e,t,r){$(e,t),ee(e,t),J(P.records,e,t,r)},ie=function(e,t,r){var n=P;if(R)var i=n.refLock[R]||(n.refLock[R]=M()),o=n.links.optimistic[R];else{i=n.refCount,o=n.links.base;var a=n.gc}o=(o=o&&o.get(e))&&o[t],$(e,t),ee(e,t),J(n.links,e,t,r),X(a,i,o,-1),X(a,i,r,1)},oe=function(e,t){var r=e.optimisticOrder.indexOf(t);-1===r?e.optimisticOrder.unshift(t):e.commutativeKeys.has(t)||(ue(e,t),e.optimisticOrder.splice(r,1),e.optimisticOrder.unshift(t)),e.commutativeKeys.add(t)},ae=function(e,t){-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=M(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)},ue=function(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])},se=function(e,t){var r=e.optimisticOrder.indexOf(t);-1<r&&(e.optimisticOrder.splice(r,1),e.commutativeKeys.delete(t)),ue(e,t)};function fe(e,t){for(var r in e)ie(t,r,e[r])}function le(e,t){for(var r in e)ne(t,r,e[r])}var ce=function(e){var t=I;I=M();var r=P.links.optimistic[e];r&&r.forEach(fe),(r=P.records.optimistic[e])&&r.forEach(le),I=t,se(P,e)},de=function(e){var t=P.links,r=P.records,n=[],i=new Set;return $(e),W(n,i,e,t),W(n,i,e,r),n},pe=function(){if(P.storage){j=!0;var e=M();P.persist.forEach((function(t){var r,n=L(t),o=n.entityKey;e[t]=void 0!==(r=re(o,n=n.fieldKey))?":"+i.stringifyVariables(r):void 0!==(r=te(o,n))?i.stringifyVariables(r):void 0})),j=!1,P.storage.writeData(e),P.persist.clear()}},ve=function(e,t,r,n,i,o){return{store:e,variables:t,fragments:r,parentTypeName:n,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},ye=function(e,t,r,n,i){e.parentTypeName=t,e.parentKey=r,e.parentFieldKey=n,e.fieldName=i},me=function(e,t,r,n){return!(!t||t!==d(e)&&c(e).some((function(e){return!!p(e)&&(e=T(s(e),y(e,n)),!function(e,t){return void 0!==te(e,t)||void 0!==re(e,t)}(r,e))})))},he=function(e,t,r,n){var i=[0],o=[r];return{next:function(){for(;0!==i.length;){var r=i[i.length-1]++,a=o[o.length-1];if(r>=a.length)i.pop(),o.pop();else if(_(r=a[r],n.variables))if(p(r)){if("__typename"!==s(r))return r}else void 0!==(r=v(r)?r:n.fragments[s(r)])&&(n.store.schema?K(n.store.schema,d(r),e):me(r,e,t,n.variables))&&(i.push(0),o.push(c(r)))}}}},ge=function(e){return void 0===e?null:e},ke=function(e,t,r,n){return Q("write",e.data,n||null),e=be(e,t,r),G(),e},be=function(e,t,r){var n=b(t.query),i={data:r,dependencies:U()},o=e.rootFields[n.operation];return e=ve(e,h(n,t.variables),O(t.query),o,o),Oe(e,o,c(n),r),i},qe=function(e,t,r){Q("write",e.data,r,!0),r=b(t.query);var n={data:{},dependencies:U()},i=e.rootFields[r.operation];return g(i===e.rootFields.mutation,"",10),e=ve(e,h(r,t.variables),O(t.query),i,i,!0),Oe(e,i,c(r),n.data),G(),n},Oe=function(e,t,r,n){var i=t===e.store.rootFields.query,o=!i&&!!e.store.rootNames[t],a=o||i?t:n.__typename;if(a){o||i||!t||ne(t,"__typename",a),r=he(a,t||a,r,e);for(var u;u=r.next();){i=s(u);var f=y(u,e.variables),d=T(i,f),p=l(u),v=n[p];if(e.optimistic&&o){if(!(v=e.store.optimisticMutations[i]))continue;ye(e,a,a,d,i),v=n[p]=ge(v(f||{},e.store,e))}u.selectionSet?t&&!o?(p=F(t,d),u=_e(e,c(u),ge(v),p),ie(t||a,d,u)):_e(e,c(u),ge(v)):t&&!o&&ne(t||a,d,v),o&&(ye(e,a,a,F(a,d),i),d=e.store.updates[a][i])&&(n[i]=v,d(n,f||{},e.store,e))}}},_e=function(e,t,r,n){if(Array.isArray(r)){for(var i=Array(r.length),o=0,a=r.length;o<a;o++){var u=r[o],s=n?F(n,""+o):void 0;u=_e(e,t,u,s),i[o]=u}return i}return null===r?null:(n=e.store.keyOfEntity(r)||n,Oe(e,n,t,r),n||null)},xe=function(e){var t,r;this.keyOfField=T,e||(e={}),this.resolvers=e.resolvers||{},this.optimisticMutations=e.optimistic||{},this.keys=e.keys||{};var n="Query",i="Mutation",a="Subscription";if(e.schema){var u=this.schema=o.buildClientSchema(e.schema),s=u.getQueryType(),f=u.getMutationType();u=u.getSubscriptionType(),n=s?s.name:n,i=f?f.name:i,a=u?u.name:a}this.updates=((t={})[i]=e.updates&&e.updates.Mutation||{},t[a]=e.updates&&e.updates.Subscription||{},t),this.rootFields={query:n,mutation:i,subscription:a},this.rootNames=((r={})[n]="query",r[i]="mutation",r[a]="subscription",r),this.data=function(e){return{defer:!1,gc:new Set,persist:new Set,queryRootKey:e,refCount:M(),refLock:M(),links:C(),records:C(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(n)};xe.prototype.keyOfEntity=function(e){var t,r=e.__typename,n=e.id,i=e._id;return r?void 0!==this.rootNames[r]?r:(this.keys[r]?t=this.keys[r](e):null!=n?t=""+n:null!=i&&(t=""+i),t?r+":"+t:null):null},xe.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var r=te(e,t);return void 0!==r?r:(t=re(e,t))?t:null},xe.prototype.resolve=function(e,t,r){return this.resolveFieldByKey(e,T(t,r))},xe.prototype.invalidate=function(e,t,r){g(e="string"==typeof e?e:this.keyOfEntity(e),"",19),function(e,t,r){t=t?[{fieldKey:T(t,r)}]:de(e),r=0;for(var n=t.length;r<n;r++){var i=t[r].fieldKey;void 0!==re(e,i)?ie(e,i,void 0):ne(e,i,void 0)}}(e,t,r)},xe.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?de(e):[]},xe.prototype.updateQuery=function(e,t){e=i.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&be(this,e,t)},xe.prototype.readQuery=function(e){return Ne(this,i.createRequest(e.query,e.variables)).data},xe.prototype.readFragment=function(e,t,r){return Ee(this,e,t,r)},xe.prototype.writeFragment=function(t,r,n){!function(t,r,n,i){r=O(r);var o=Object.keys(r);if(void 0!==(o=r[o[0]])){var a=f(o);n=e._extends({},{__typename:a},n);var u=t.keyOfEntity(n);u&&(t=ve(t,i||{},r,a,u),Oe(t,u,c(o),n))}}(this,t,r,n)};var we=function(e,t,r){return Q("read",e.data,null),e=Ne(e,t,r),G(),e},Ne=function(e,t,r){var n=b(t.query),i=e.rootFields[n.operation],o=c(n);return r=r||{},r=i!==(e=ve(e,h(n,t.variables),O(t.query),i,i)).store.rootFields.query?Ke(e,i,o,r):Te(e,i,o,r),{dependencies:U(),partial:void 0!==r&&e.partial,data:void 0===r?null:r}},Ke=function(e,t,r,n){if("string"!=typeof n.__typename)return n;t=he(t,t,r,e),(r={}).__typename=n.__typename;for(var i;void 0!==(i=t.next());){var o=l(i),a=n[o];void 0!==i.selectionSet&&null!==a?(a=ge(a),r[o]=Se(e,c(i),a)):r[o]=a}return r},Se=function(e,t,r){if(Array.isArray(r)){for(var n=Array(r.length),i=0,o=r.length;i<o;i++)n[i]=Se(e,t,r[i]);return n}return null===r?null:null!==(n=e.store.keyOfEntity(r))?void 0===(e=Te(e,n,t,{}))?null:e:Ke(e,r.__typename,t,r)},Ee=function(t,r,n,i){r=O(r);var o=Object.keys(r);if(void 0===(o=r[o[0]]))return null;var a=f(o);return"string"==typeof n||n.__typename||(n.__typename=a),(n="string"!=typeof n?t.keyOfEntity(e._extends({},{__typename:a},n)):n)?(t=ve(t,i||{},r,a,n),Te(t,n,c(o),{})||null):null},Te=function(e,t,r,n,i){var o=e.store,a=t===o.rootFields.query,u=i&&o.keyOfEntity(i)||t;if("string"==typeof(t=a?t:te(u,"__typename")||i&&i.__typename)&&(!i||t===i.__typename)){n.__typename=t,r=he(t,u,r,e);for(var f,d=!1,p=!1;void 0!==(f=r.next());){var v=s(f),m=y(f,e.variables),h=l(f),k=T(v,m),b=F(u,k),q=te(u,k),O=i?i[v]:void 0,_=o.resolvers[t],x=void 0;if(void 0!==O&&void 0===f.selectionSet)x=O;else if("read"===(g(null!==D,"",2),D)&&_&&"function"==typeof _[v]){if(ye(e,t,u,b,v),void 0!==q&&(n[h]=q),x=_[v](n,m||{},o,e),void 0!==f.selectionSet&&(x=Fe(e,t,v,b,c(f),n[h]||{},x)),o.schema&&null===x&&!w(o.schema,t,v))return}else void 0===f.selectionSet?x=q:void 0!==O?x=Fe(e,t,v,b,c(f),n[h],O):void 0!==(m=re(u,k))?x=Ae(e,m,t,v,c(f),n[h]):"object"==typeof q&&null!==q&&(x=q);if(void 0===x&&o.schema&&w(o.schema,t,v))p=!0,n[h]=null;else{if(void 0===x)return;d=!0,n[h]=x}}return p&&(e.partial=!0),a&&p&&!d?void 0:n}},Fe=function(e,t,r,n,i,o,a){if(Array.isArray(a)){var u=e.store;u=!u.schema||N(u.schema,t,r);for(var s=Array(a.length),f=0,l=a.length;f<l;f++){var c=Fe(e,t,r,F(n,""+f),i,null!=o?o[f]:void 0,a[f]);if(void 0===c&&!u)return;s[f]=void 0!==c?c:null}return s}return null==a?a:null===o?null:Le(a)?(t=o||{},"string"==typeof a?Te(e,a,i,t):Te(e,n,i,t,a)):void 0},Ae=function(e,t,r,n,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&N(a.schema,r,n);for(var u=Array(t.length),s=0,f=t.length;s<f;s++){var l=Ae(e,t[s],r,n,i,null!=o?o[s]:void 0);if(void 0===l&&!a)return;u[s]=void 0!==l?l:null}return u}return null===t||null===o?null:Te(e,t,i,o||{})},Le=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},Me=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:r})})})},De=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:r})})};function Pe(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Ie(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function Re(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}var je=function(t){return function(r){function n(e){return Me(e.operation,"miss")}function o(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy&&!x(e.dependencies)}function u(e){var t=e.operation,r=e.outcome,n=e.dependencies;return e={operation:Me(t,r),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===r)&&(e.stale=!0,x(n)?"cache-and-network"===t.context.requestPolicy&&O.add(t.key):v.reexecuteOperation(De(t,"network-only"))),e}function s(e){var t=new Set,r=T(e,t);return N(e.operation,t),r}function f(e){return!h.has(e.operation.key)}function l(e){if(g.push(e)<h.size)return a.empty;for(var t=0;t<g.length;t++)oe(y.data,g[t].operation.key);for(var r in q)delete q[r];t=[],r=new Set;for(var n;n=g.shift();)t.push(T(n,r));return N(e.operation,r),a.fromArray(t)}function c(e){return h.has(e.operation.key)}var d,p=r.forward,v=r.client,y=new xe(t);t&&t.storage&&(d=t.storage.readData().then((function(e){!function(e,t,r){for(var n in Q("read",e,null),r){var i=r[n];if(void 0!==i){var o=L(n),a=o.entityKey;o=o.fieldKey,":"===i[0]?ie(a,o,JSON.parse(i.slice(1))):ne(a,o,JSON.parse(i))}}G(),e.storage=t}(y.data,t.storage,e)})));var h=new Map,g=[],k=new Map,q=M(),O=new Set,_=M(),x=function(e){for(var t in e)if(q[t])return!0;return!1},w=function(e,t){if(t)for(var r in t)if(t=_[r]){_[r]=[];for(var n=0,i=t.length;n<i;n++)e.add(t[n])}},N=function(e,t){t.forEach((function(t){if(t!==e.key){var r=k.get(t);if(r){k.delete(t);var n="cache-first";O.has(t)&&(O.delete(t),n="cache-and-network"),v.reexecuteOperation(De(r,n))}}}))},K=function(t){if("query"===t.operationName)oe(y.data,t.key);else if("teardown"===t.operationName)k.delete(t.key),V(y.data,t.key);else if("mutation"===t.operationName&&"network-only"!==t.context.requestPolicy){var r=qe(y,t,t.key).dependencies;if(!function(e){for(var t in e)return!1;return!0}(r)){for(var n in r)q[n]=!0;h.set(t.key,r),n=new Set,w(n,r),N(t,n)}}return e._extends({},t,{variables:t.variables?m(b(t.query),t.variables):t.variables,query:i.formatDocument(t.query)})},S=function(e,t){for(var r in t)(_[r]||(_[r]=[])).push(e.key),k.set(e.key,e)},E=function(e){var t=we(y,e),r=t.data?t.partial?"partial":"hit":"miss";return S(e,t.dependencies),{outcome:r,operation:e,data:t.data,dependencies:t.dependencies}},T=function(e,t){var r=e.operation,n=e.error,i=e.extensions,o=r.key;if("mutation"===r.operationName){var a=h.get(o);w(t,a),h.delete(o)}else oe(y.data,r.key);if(e.data){if(o=ke(y,r,e.data,o).dependencies,w(t,o),o=we(y,r,e.data),e.data=o.data,"query"===r.operationName){var u=o.dependencies;w(t,u)}}else V(y.data,r.key);return u&&S(e.operation,u),{data:e.data,error:n,extensions:i,operation:r}};return function(e){e=a.share(e);var t=d?a.mergeMap(a.fromArray)(a.take(1)(a.buffer(a.fromPromise(d))(e))):a.empty;t=a.share(a.concat([t,e])),e=a.share(a.map(E)(a.filter(Pe)(t))),t=a.filter(Ie)(t);var r=a.map(n)(a.filter(o)(e));return e=a.map(u)(a.filter(Re)(e)),r=a.share(p(a.map(K)(a.merge([t,r])))),t=a.map(s)(a.filter(f)(r)),r=a.mergeMap(l)(a.filter(c)(r)),a.merge([t,r,e])}}},Ce=function(e){return e&&e.networkError&&!e.response&&("undefined"!=typeof navigator&&!1===navigator.onLine||/request failed|failed to fetch|network\s?error/i.test(e.networkError.message))};exports.Store=xe,exports.cacheExchange=je,exports.noopDataState=V,exports.offlineExchange=function(e){return function(t){function r(e){return"mutation"!==e.operation.operationName||!Ce(e.error)||!function(e,t){var r,n=t.variables||M(),i=O(t.query);for(t=[].concat(c(b(t.query)));r=t.pop();)if(_(r,n))if(p(r)){if(e[s(r)])return!0}else(r=v(r)?r:i[s(r)])&&t.push.apply(t,c(r));return!1}(l,e.operation)||(d.push(e.operation),y(),!1)}var n=e.storage;if(n&&n.onOnline&&n.readMetadata&&n.writeMetadata){var o=t.forward,f=t.client;t=t.dispatchDebug;var l=e.optimistic||{},d=[],y=function(){for(var e=[],t=0;t<d.length;t++){var r=d[t];"mutation"===r.operationName&&e.push({query:u.print(r.query),variables:r.variables})}n.writeMetadata(e)},m=!1,h=function(){if(!m){m=!0;for(var e;e=d.shift();)f.reexecuteOperation(e);y(),m=!1}};n.onOnline(h),n.readMetadata().then((function(e){if(e){for(var t=0;t<e.length;t++)d.push(f.createRequestOperation("mutation",i.createRequest(e[t].query,e[t].variables)));h()}}));var g=je(e)({client:f,dispatchDebug:t,forward:function(e){return a.filter(r)(o(e))}});return function(e){e=a.share(e);var t=a.makeSubject(),r=t.next;return e=a.merge([t.source,e]),a.filter((function(e){return"query"!==e.operation.operationName||!Ce(e.error)||(r(De(e.operation,"cache-only")),d.push(e.operation),!1)}))(g(e))}}return je(e)(t)}},exports.query=we,exports.reserveLayer=oe,exports.write=ke,exports.writeOptimistic=qe; | ||
//# sourceMappingURL=urql-exchange-graphcache.min.js.map |
@@ -18,5 +18,5 @@ { | ||
"dependencies": { | ||
"@urql/core": ">=1.13.0", | ||
"@urql/core": ">=1.13.1", | ||
"wonka": "^4.0.14" | ||
} | ||
} |
{ | ||
"name": "@urql/exchange-graphcache", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "A normalized and configurable cache exchange for urql", | ||
@@ -68,3 +68,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@urql/core": ">=1.13.0", | ||
"@urql/core": ">=1.13.1", | ||
"wonka": "^4.0.14" | ||
@@ -71,0 +71,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
667342
3441
Updated@urql/core@>=1.13.1