@urql/exchange-graphcache
Advanced tools
Comparing version 3.1.11 to 3.2.0
# @urql/exchange-graphcache | ||
## 3.2.0 | ||
### Minor Changes | ||
- Add a `mergeMode: 'before' | 'after'` option to the `simplePagination` helper to define whether pages are merged before or after preceding ones when pagination, similar to `relayPagination`'s option, by [@hoangvvo](https://github.com/hoangvvo) (See [#1174](https://github.com/FormidableLabs/urql/pull/1174)) | ||
### Patch Changes | ||
- Updated dependencies (See [#1168](https://github.com/FormidableLabs/urql/pull/1168)) | ||
- @urql/core@1.15.2 | ||
## 3.1.11 | ||
@@ -4,0 +15,0 @@ |
@@ -18,5 +18,5 @@ { | ||
"dependencies": { | ||
"@urql/core": ">=1.15.0", | ||
"@urql/core": ">=1.15.2", | ||
"wonka": "^4.0.14" | ||
} | ||
} |
import { Resolver } from '../types'; | ||
export declare type MergeMode = 'before' | 'after'; | ||
export interface PaginationParams { | ||
offsetArgument?: string; | ||
limitArgument?: string; | ||
mergeMode?: MergeMode; | ||
} | ||
export declare const simplePagination: ({ offsetArgument, limitArgument, }?: PaginationParams) => Resolver; | ||
export declare const simplePagination: ({ offsetArgument, limitArgument, mergeMode, }?: PaginationParams) => Resolver; |
@@ -11,27 +11,27 @@ "use strict"; | ||
return "string" == typeof a ? a : null; | ||
}, concatEdges = function(a, g, e) { | ||
var c, b, d, r, m; | ||
for (c = new Set, b = 0, d = g.length; b < d; b++) { | ||
"string" == typeof (r = a.resolve(g[b], "node")) && c.add(r); | ||
}, concatEdges = function(a, f, e) { | ||
var b, c, d, l, p; | ||
for (b = new Set, c = 0, d = f.length; c < d; c++) { | ||
"string" == typeof (l = a.resolve(f[c], "node")) && b.add(l); | ||
} | ||
g = g.slice(); | ||
b = 0; | ||
for (d = e.length; b < d; b++) { | ||
"string" != typeof (m = a.resolve(r = e[b], "node")) || c.has(m) || (c.add(m), g.push(r)); | ||
f = f.slice(); | ||
c = 0; | ||
for (d = e.length; c < d; c++) { | ||
"string" != typeof (p = a.resolve(l = e[c], "node")) || b.has(p) || (b.add(p), f.push(l)); | ||
} | ||
return g; | ||
}, concatNodes = function(a, g) { | ||
var e, c, b, d; | ||
for (e = new Set, c = 0, b = a.length; c < b; c++) { | ||
"string" == typeof (d = a[c]) && e.add(d); | ||
return f; | ||
}, concatNodes = function(a, f) { | ||
var e, b, c, d; | ||
for (e = new Set, b = 0, c = a.length; b < c; b++) { | ||
"string" == typeof (d = a[b]) && e.add(d); | ||
} | ||
a = a.slice(); | ||
c = 0; | ||
for (b = g.length; c < b; c++) { | ||
"string" != typeof (d = g[c]) || e.has(d) || (e.add(d), a.push(d)); | ||
b = 0; | ||
for (c = f.length; b < c; b++) { | ||
"string" != typeof (d = f[b]) || e.has(d) || (e.add(d), a.push(d)); | ||
} | ||
return a; | ||
}, compareArgs = function(a, g) { | ||
var e, c, b, d; | ||
for (e in g) { | ||
}, compareArgs = function(a, f) { | ||
var e, b, c, d; | ||
for (e in f) { | ||
if ("first" !== e && "last" !== e && "after" !== e && "before" !== e) { | ||
@@ -41,3 +41,3 @@ if (!(e in a)) { | ||
} | ||
if (typeof (c = a[e]) != typeof (b = g[e]) || "object" != typeof c ? c !== b : core.stringifyVariables(c) !== core.stringifyVariables(b)) { | ||
if (typeof (b = a[e]) != typeof (c = f[e]) || "object" != typeof b ? b !== c : core.stringifyVariables(b) !== core.stringifyVariables(c)) { | ||
return !1; | ||
@@ -48,3 +48,3 @@ } | ||
for (d in a) { | ||
if ("first" !== d && "last" !== d && "after" !== d && "before" !== d && !(d in g)) { | ||
if ("first" !== d && "last" !== d && "after" !== d && "before" !== d && !(d in f)) { | ||
return !1; | ||
@@ -54,10 +54,10 @@ } | ||
return !0; | ||
}, getPage = function(a, g, e) { | ||
var b, d, r, m, c = ensureKey(a.resolveFieldByKey(g, e)); | ||
if (!c) { | ||
}, getPage = function(a, f, e) { | ||
var c, d, l, p, b = ensureKey(a.resolveFieldByKey(f, e)); | ||
if (!b) { | ||
return null; | ||
} | ||
e = a.resolve(c, "__typename"); | ||
g = a.resolve(c, "edges") || []; | ||
b = a.resolve(c, "nodes") || []; | ||
e = a.resolve(b, "__typename"); | ||
f = a.resolve(b, "edges") || []; | ||
c = a.resolve(b, "nodes") || []; | ||
if ("string" != typeof e) { | ||
@@ -68,19 +68,19 @@ return null; | ||
__typename: e, | ||
edges: g, | ||
nodes: b, | ||
edges: f, | ||
nodes: c, | ||
pageInfo: defaultPageInfo | ||
}; | ||
if ("string" == typeof (d = a.resolve(c, "pageInfo"))) { | ||
c = ensureKey(a.resolve(d, "__typename")); | ||
b = ensureKey(a.resolve(d, "endCursor")); | ||
r = ensureKey(a.resolve(d, "startCursor")), m = a.resolve(d, "hasNextPage"); | ||
if ("string" == typeof (d = a.resolve(b, "pageInfo"))) { | ||
b = ensureKey(a.resolve(d, "__typename")); | ||
c = ensureKey(a.resolve(d, "endCursor")); | ||
l = ensureKey(a.resolve(d, "startCursor")), p = a.resolve(d, "hasNextPage"); | ||
d = a.resolve(d, "hasPreviousPage"); | ||
null === (c = e.pageInfo = { | ||
__typename: "string" == typeof c ? c : "PageInfo", | ||
hasNextPage: "boolean" == typeof m ? m : !!b, | ||
hasPreviousPage: "boolean" == typeof d ? d : !!r, | ||
endCursor: b, | ||
startCursor: r | ||
}).endCursor && (b = g[g.length - 1]) && (b = a.resolve(b, "cursor"), c.endCursor = ensureKey(b)); | ||
null === c.startCursor && (g = g[0]) && (a = a.resolve(g, "cursor"), c.startCursor = ensureKey(a)); | ||
null === (b = e.pageInfo = { | ||
__typename: "string" == typeof b ? b : "PageInfo", | ||
hasNextPage: "boolean" == typeof p ? p : !!c, | ||
hasPreviousPage: "boolean" == typeof d ? d : !!l, | ||
endCursor: c, | ||
startCursor: l | ||
}).endCursor && (c = f[f.length - 1]) && (c = a.resolve(c, "cursor"), b.endCursor = ensureKey(c)); | ||
null === b.startCursor && (f = f[0]) && (a = a.resolve(f, "cursor"), b.startCursor = ensureKey(a)); | ||
} | ||
@@ -92,35 +92,35 @@ return e; | ||
void 0 === a && (a = {}); | ||
var g = a.mergeMode || "inwards"; | ||
return function(a, c, b, d) { | ||
var e, m, v, t, u, q, n, k, l, p, h, f, w, x; | ||
var f = a.mergeMode || "inwards"; | ||
return function(a, b, c, d) { | ||
var e, p, t, x, m, r, q, n, k, u, h, g, v, w; | ||
e = d.fieldName; | ||
if (0 !== (v = (m = b.inspectFields(a = d.parentKey).filter((function(a) { | ||
if (0 !== (t = (p = c.inspectFields(a = d.parentKey).filter((function(a) { | ||
return a.fieldName === e; | ||
}))).length)) { | ||
for (t = null, u = [], q = [], n = [], k = [], l = _rollupPluginBabelHelpers._extends({}, defaultPageInfo), | ||
p = 0; p < v; p++) { | ||
f = (h = m[p]).fieldKey; | ||
if (null !== (h = h.arguments) && compareArgs(c, h) && null !== (f = getPage(b, a, f))) { | ||
if ("inwards" === g && "number" == typeof h.last && "number" == typeof h.first) { | ||
l = f.edges.slice(0, h.first + 1); | ||
w = f.edges.slice(-h.last), x = f.nodes.slice(0, h.first + 1); | ||
h = f.nodes.slice(-h.last); | ||
u = concatEdges(b, u, l); | ||
q = concatEdges(b, w, q); | ||
n = concatNodes(n, x); | ||
k = concatNodes(h, k); | ||
l = f.pageInfo; | ||
for (x = null, m = [], r = [], q = [], n = [], k = _rollupPluginBabelHelpers._extends({}, defaultPageInfo), | ||
u = 0; u < t; u++) { | ||
g = (h = p[u]).fieldKey; | ||
if (null !== (h = h.arguments) && compareArgs(b, h) && null !== (g = getPage(c, a, g))) { | ||
if ("inwards" === f && "number" == typeof h.last && "number" == typeof h.first) { | ||
k = g.edges.slice(0, h.first + 1); | ||
v = g.edges.slice(-h.last), w = g.nodes.slice(0, h.first + 1); | ||
h = g.nodes.slice(-h.last); | ||
m = concatEdges(c, m, k); | ||
r = concatEdges(c, v, r); | ||
q = concatNodes(q, w); | ||
n = concatNodes(h, n); | ||
k = g.pageInfo; | ||
} else { | ||
h.after ? (u = concatEdges(b, u, f.edges), n = concatNodes(n, f.nodes), l.endCursor = f.pageInfo.endCursor, | ||
l.hasNextPage = f.pageInfo.hasNextPage) : h.before ? (q = concatEdges(b, f.edges, q), | ||
k = concatNodes(f.nodes, k), l.startCursor = f.pageInfo.startCursor, l.hasPreviousPage = f.pageInfo.hasPreviousPage) : ("number" == typeof h.last ? (q = concatEdges(b, q, f.edges), | ||
k = concatNodes(k, f.nodes)) : (u = concatEdges(b, u, f.edges), n = concatNodes(n, f.nodes)), | ||
l = f.pageInfo); | ||
h.after ? (m = concatEdges(c, m, g.edges), q = concatNodes(q, g.nodes), k.endCursor = g.pageInfo.endCursor, | ||
k.hasNextPage = g.pageInfo.hasNextPage) : h.before ? (r = concatEdges(c, g.edges, r), | ||
n = concatNodes(g.nodes, n), k.startCursor = g.pageInfo.startCursor, k.hasPreviousPage = g.pageInfo.hasPreviousPage) : ("number" == typeof h.last ? (r = concatEdges(c, r, g.edges), | ||
n = concatNodes(n, g.nodes)) : (m = concatEdges(c, m, g.edges), q = concatNodes(q, g.nodes)), | ||
k = g.pageInfo); | ||
} | ||
f.pageInfo.__typename !== l.__typename && (l.__typename = f.pageInfo.__typename); | ||
t !== f.__typename && (t = f.__typename); | ||
g.pageInfo.__typename !== k.__typename && (k.__typename = g.pageInfo.__typename); | ||
x !== g.__typename && (x = g.__typename); | ||
} | ||
} | ||
if ("string" == typeof t) { | ||
if (!ensureKey(b.resolve(a, e, c))) { | ||
if ("string" == typeof x) { | ||
if (!ensureKey(c.resolve(a, e, b))) { | ||
if (d.store.schema) { | ||
@@ -133,11 +133,11 @@ d.partial = !0; | ||
return { | ||
__typename: t, | ||
edges: "inwards" === g ? concatEdges(b, u, q) : concatEdges(b, q, u), | ||
nodes: "inwards" === g ? concatNodes(n, k) : concatNodes(k, n), | ||
__typename: x, | ||
edges: "inwards" === f ? concatEdges(c, m, r) : concatEdges(c, r, m), | ||
nodes: "inwards" === f ? concatNodes(q, n) : concatNodes(n, q), | ||
pageInfo: { | ||
__typename: l.__typename, | ||
endCursor: l.endCursor, | ||
startCursor: l.startCursor, | ||
hasNextPage: l.hasNextPage, | ||
hasPreviousPage: l.hasPreviousPage | ||
__typename: k.__typename, | ||
endCursor: k.endCursor, | ||
startCursor: k.startCursor, | ||
hasNextPage: k.hasNextPage, | ||
hasPreviousPage: k.hasPreviousPage | ||
} | ||
@@ -151,14 +151,15 @@ }; | ||
exports.simplePagination = function(a) { | ||
var g, e, c; | ||
var f, e, b, c; | ||
void 0 === a && (a = {}); | ||
void 0 === (g = a.offsetArgument) && (g = "skip"); | ||
void 0 === (f = a.offsetArgument) && (f = "skip"); | ||
void 0 === (e = a.limitArgument) && (e = "limit"); | ||
c = function(a, d) { | ||
var b, c, v, t; | ||
for (b in d) { | ||
if (b !== g && b !== e) { | ||
void 0 === (b = a.mergeMode) && (b = "after"); | ||
c = function(a, c) { | ||
var b, d, l, m; | ||
for (b in c) { | ||
if (b !== f && b !== e) { | ||
if (!(b in a)) { | ||
return !1; | ||
} | ||
if (typeof (c = a[b]) != typeof (v = d[b]) || "object" != typeof c ? c !== v : core.stringifyVariables(c) !== core.stringifyVariables(v)) { | ||
if (typeof (d = a[b]) != typeof (l = c[b]) || "object" != typeof d ? d !== l : core.stringifyVariables(d) !== core.stringifyVariables(l)) { | ||
return !1; | ||
@@ -168,4 +169,4 @@ } | ||
} | ||
for (t in a) { | ||
if (t !== g && t !== e && !(t in d)) { | ||
for (m in a) { | ||
if (m !== f && m !== e && !(m in c)) { | ||
return !1; | ||
@@ -176,31 +177,24 @@ } | ||
}; | ||
return function(a, d, e, m) { | ||
var b, t, u, q, n, k, l, p, h, f, r; | ||
b = m.fieldName; | ||
if (0 !== (u = (t = e.inspectFields(a = m.parentKey).filter((function(a) { | ||
return a.fieldName === b; | ||
return function(a, e, p, t) { | ||
var d, m, l, q, n, k, u, h, g, v, w, y; | ||
d = t.fieldName; | ||
if (0 !== (l = (m = p.inspectFields(a = t.parentKey).filter((function(a) { | ||
return a.fieldName === d; | ||
}))).length)) { | ||
for (q = new Set, n = [], k = null, l = 0; l < u; l++) { | ||
h = (p = t[l]).fieldKey; | ||
if (null !== (p = p.arguments) && c(d, p) && (h = e.resolveFieldByKey(a, h), p = p[g], | ||
null !== h && 0 !== h.length && "number" == typeof p)) { | ||
if (!k || p > k) { | ||
for (k = 0; k < h.length; k++) { | ||
q.has(f = h[k]) || (n.push(f), q.add(f)); | ||
} | ||
} else { | ||
k = []; | ||
for (f = 0; f < h.length; f++) { | ||
q.has(r = h[f]) || (k.push(r), q.add(r)); | ||
} | ||
n = k.concat(n); | ||
for (q = new Set, n = [], k = null, u = 0; u < l; u++) { | ||
g = (h = m[u]).fieldKey; | ||
if (null !== (h = h.arguments) && c(e, h) && (g = p.resolveFieldByKey(a, g), h = h[f], | ||
null !== g && 0 !== g.length && "number" == typeof h)) { | ||
for (v = [], w = 0; w < g.length; w++) { | ||
q.has(y = g[w]) || (v.push(y), q.add(y)); | ||
} | ||
k = p; | ||
n = (!k || h > k) == ("after" === b) ? n.concat(v) : v.concat(n); | ||
k = h; | ||
} | ||
} | ||
if (e.resolve(a, b, d)) { | ||
if (p.resolve(a, d, e)) { | ||
return n; | ||
} | ||
if (m.store.schema) { | ||
return m.partial = !0, n; | ||
if (t.store.schema) { | ||
return t.partial = !0, n; | ||
} | ||
@@ -207,0 +201,0 @@ } |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("./1cc90026.min.js"),r=require("@urql/core"),n={__typename:"PageInfo",endCursor:null,startCursor:null,hasNextPage:!1,hasPreviousPage:!1},t=function(e){return"string"==typeof e?e:null},s=function(e,r,n){for(var t=new Set,s=0,a=r.length;s<a;s++){var o=e.resolve(r[s],"node");"string"==typeof o&&t.add(o)}for(r=r.slice(),s=0,a=n.length;s<a;s++){var i=e.resolve(o=n[s],"node");"string"!=typeof i||t.has(i)||(t.add(i),r.push(o))}return r},a=function(e,r){for(var n=new Set,t=0,s=e.length;t<s;t++){var a=e[t];"string"==typeof a&&n.add(a)}for(e=e.slice(),t=0,s=r.length;t<s;t++)"string"!=typeof(a=r[t])||n.has(a)||(n.add(a),e.push(a));return e},o=function(e,n){for(var t in n)if("first"!==t&&"last"!==t&&"after"!==t&&"before"!==t){if(!(t in e))return!1;var s=e[t],a=n[t];if(typeof s!=typeof a||"object"!=typeof s?s!==a:r.stringifyVariables(s)!==r.stringifyVariables(a))return!1}for(var o in e)if("first"!==o&&"last"!==o&&"after"!==o&&"before"!==o&&!(o in n))return!1;return!0},i=function(e,r,s){var a=t(e.resolveFieldByKey(r,s));if(!a)return null;s=e.resolve(a,"__typename"),r=e.resolve(a,"edges")||[];var o=e.resolve(a,"nodes")||[];if("string"!=typeof s)return null;s={__typename:s,edges:r,nodes:o,pageInfo:n};var i=e.resolve(a,"pageInfo");if("string"==typeof i){a=t(e.resolve(i,"__typename")),o=t(e.resolve(i,"endCursor"));var f=t(e.resolve(i,"startCursor")),l=e.resolve(i,"hasNextPage");i=e.resolve(i,"hasPreviousPage"),null===(a=s.pageInfo={__typename:"string"==typeof a?a:"PageInfo",hasNextPage:"boolean"==typeof l?l:!!o,hasPreviousPage:"boolean"==typeof i?i:!!f,endCursor:o,startCursor:f}).endCursor&&(o=r[r.length-1])&&(o=e.resolve(o,"cursor"),a.endCursor=t(o)),null===a.startCursor&&(r=r[0])&&(e=e.resolve(r,"cursor"),a.startCursor=t(e))}return s};exports.relayPagination=function(r){void 0===r&&(r={});var f=r.mergeMode||"inwards";return function(r,l,u,g){var d=g.fieldName,p=u.inspectFields(r=g.parentKey).filter((function(e){return e.fieldName===d})),v=p.length;if(0!==v){for(var y=null,h=[],m=[],c=[],_=[],P=e._extends({},n),C=0;C<v;C++){var b=p[C],I=b.fieldKey;if(null!==(b=b.arguments)&&o(l,b)&&null!==(I=i(u,r,I))){if("inwards"===f&&"number"==typeof b.last&&"number"==typeof b.first){P=I.edges.slice(0,b.first+1);var N=I.edges.slice(-b.last),x=I.nodes.slice(0,b.first+1);b=I.nodes.slice(-b.last),h=s(u,h,P),m=s(u,N,m),c=a(c,x),_=a(b,_),P=I.pageInfo}else b.after?(h=s(u,h,I.edges),c=a(c,I.nodes),P.endCursor=I.pageInfo.endCursor,P.hasNextPage=I.pageInfo.hasNextPage):b.before?(m=s(u,I.edges,m),_=a(I.nodes,_),P.startCursor=I.pageInfo.startCursor,P.hasPreviousPage=I.pageInfo.hasPreviousPage):("number"==typeof b.last?(m=s(u,m,I.edges),_=a(_,I.nodes)):(h=s(u,h,I.edges),c=a(c,I.nodes)),P=I.pageInfo);I.pageInfo.__typename!==P.__typename&&(P.__typename=I.pageInfo.__typename),y!==I.__typename&&(y=I.__typename)}}if("string"==typeof y){if(!t(u.resolve(r,d,l))){if(!g.store.schema)return;g.partial=!0}return{__typename:y,edges:"inwards"===f?s(u,h,m):s(u,m,h),nodes:"inwards"===f?a(c,_):a(_,c),pageInfo:{__typename:P.__typename,endCursor:P.endCursor,startCursor:P.startCursor,hasNextPage:P.hasNextPage,hasPreviousPage:P.hasPreviousPage}}}}}},exports.simplePagination=function(e){void 0===e&&(e={});var n=e.offsetArgument;void 0===n&&(n="skip");var t=e.limitArgument;void 0===t&&(t="limit");var s=function(e,s){for(var a in s)if(a!==n&&a!==t){if(!(a in e))return!1;var o=e[a],i=s[a];if(typeof o!=typeof i||"object"!=typeof o?o!==i:r.stringifyVariables(o)!==r.stringifyVariables(i))return!1}for(var f in e)if(f!==n&&f!==t&&!(f in s))return!1;return!0};return function(e,r,t,a){var o=a.fieldName,i=t.inspectFields(e=a.parentKey).filter((function(e){return e.fieldName===o})),f=i.length;if(0!==f){for(var l=new Set,u=[],g=null,d=0;d<f;d++){var p=i[d],v=p.fieldKey;if(null!==(p=p.arguments)&&s(r,p)&&(v=t.resolveFieldByKey(e,v),p=p[n],null!==v&&0!==v.length&&"number"==typeof p)){if(!g||p>g)for(g=0;g<v.length;g++){var y=v[g];l.has(y)||(u.push(y),l.add(y))}else{for(g=[],y=0;y<v.length;y++){var h=v[y];l.has(h)||(g.push(h),l.add(h))}u=g.concat(u)}g=p}}if(t.resolve(e,o,r))return u;if(a.store.schema)return a.partial=!0,u}}}; | ||
"use strict";var e=require("./1cc90026.min.js"),r=require("@urql/core"),n={__typename:"PageInfo",endCursor:null,startCursor:null,hasNextPage:!1,hasPreviousPage:!1},t=function(e){return"string"==typeof e?e:null},a=function(e,r,n){for(var t=new Set,a=0,s=r.length;a<s;a++){var o=e.resolve(r[a],"node");"string"==typeof o&&t.add(o)}for(r=r.slice(),a=0,s=n.length;a<s;a++){var i=e.resolve(o=n[a],"node");"string"!=typeof i||t.has(i)||(t.add(i),r.push(o))}return r},s=function(e,r){for(var n=new Set,t=0,a=e.length;t<a;t++){var s=e[t];"string"==typeof s&&n.add(s)}for(e=e.slice(),t=0,a=r.length;t<a;t++)"string"!=typeof(s=r[t])||n.has(s)||(n.add(s),e.push(s));return e},o=function(e,n){for(var t in n)if("first"!==t&&"last"!==t&&"after"!==t&&"before"!==t){if(!(t in e))return!1;var a=e[t],s=n[t];if(typeof a!=typeof s||"object"!=typeof a?a!==s:r.stringifyVariables(a)!==r.stringifyVariables(s))return!1}for(var o in e)if("first"!==o&&"last"!==o&&"after"!==o&&"before"!==o&&!(o in n))return!1;return!0},i=function(e,r,a){var s=t(e.resolveFieldByKey(r,a));if(!s)return null;a=e.resolve(s,"__typename"),r=e.resolve(s,"edges")||[];var o=e.resolve(s,"nodes")||[];if("string"!=typeof a)return null;a={__typename:a,edges:r,nodes:o,pageInfo:n};var i=e.resolve(s,"pageInfo");if("string"==typeof i){s=t(e.resolve(i,"__typename")),o=t(e.resolve(i,"endCursor"));var f=t(e.resolve(i,"startCursor")),l=e.resolve(i,"hasNextPage");i=e.resolve(i,"hasPreviousPage"),null===(s=a.pageInfo={__typename:"string"==typeof s?s:"PageInfo",hasNextPage:"boolean"==typeof l?l:!!o,hasPreviousPage:"boolean"==typeof i?i:!!f,endCursor:o,startCursor:f}).endCursor&&(o=r[r.length-1])&&(o=e.resolve(o,"cursor"),s.endCursor=t(o)),null===s.startCursor&&(r=r[0])&&(e=e.resolve(r,"cursor"),s.startCursor=t(e))}return a};exports.relayPagination=function(r){void 0===r&&(r={});var f=r.mergeMode||"inwards";return function(r,l,u,g){var d=g.fieldName,p=u.inspectFields(r=g.parentKey).filter((function(e){return e.fieldName===d})),v=p.length;if(0!==v){for(var y=null,c=[],m=[],h=[],_=[],P=e._extends({},n),C=0;C<v;C++){var b=p[C],I=b.fieldKey;if(null!==(b=b.arguments)&&o(l,b)&&null!==(I=i(u,r,I))){if("inwards"===f&&"number"==typeof b.last&&"number"==typeof b.first){P=I.edges.slice(0,b.first+1);var N=I.edges.slice(-b.last),x=I.nodes.slice(0,b.first+1);b=I.nodes.slice(-b.last),c=a(u,c,P),m=a(u,N,m),h=s(h,x),_=s(b,_),P=I.pageInfo}else b.after?(c=a(u,c,I.edges),h=s(h,I.nodes),P.endCursor=I.pageInfo.endCursor,P.hasNextPage=I.pageInfo.hasNextPage):b.before?(m=a(u,I.edges,m),_=s(I.nodes,_),P.startCursor=I.pageInfo.startCursor,P.hasPreviousPage=I.pageInfo.hasPreviousPage):("number"==typeof b.last?(m=a(u,m,I.edges),_=s(_,I.nodes)):(c=a(u,c,I.edges),h=s(h,I.nodes)),P=I.pageInfo);I.pageInfo.__typename!==P.__typename&&(P.__typename=I.pageInfo.__typename),y!==I.__typename&&(y=I.__typename)}}if("string"==typeof y){if(!t(u.resolve(r,d,l))){if(!g.store.schema)return;g.partial=!0}return{__typename:y,edges:"inwards"===f?a(u,c,m):a(u,m,c),nodes:"inwards"===f?s(h,_):s(_,h),pageInfo:{__typename:P.__typename,endCursor:P.endCursor,startCursor:P.startCursor,hasNextPage:P.hasNextPage,hasPreviousPage:P.hasPreviousPage}}}}}},exports.simplePagination=function(e){void 0===e&&(e={});var n=e.offsetArgument;void 0===n&&(n="skip");var t=e.limitArgument;void 0===t&&(t="limit");var a=e.mergeMode;void 0===a&&(a="after");var s=function(e,a){for(var s in a)if(s!==n&&s!==t){if(!(s in e))return!1;var o=e[s],i=a[s];if(typeof o!=typeof i||"object"!=typeof o?o!==i:r.stringifyVariables(o)!==r.stringifyVariables(i))return!1}for(var f in e)if(f!==n&&f!==t&&!(f in a))return!1;return!0};return function(e,r,t,o){var i=o.fieldName,f=t.inspectFields(e=o.parentKey).filter((function(e){return e.fieldName===i})),l=f.length;if(0!==l){for(var u=new Set,g=[],d=null,p=0;p<l;p++){var v=f[p],y=v.fieldKey;if(null!==(v=v.arguments)&&s(r,v)&&(y=t.resolveFieldByKey(e,y),v=v[n],null!==y&&0!==y.length&&"number"==typeof v)){for(var c=[],m=0;m<y.length;m++){var h=y[m];u.has(h)||(c.push(h),u.add(h))}g=(!d||v>d)==("after"===a)?g.concat(c):c.concat(g),d=v}}if(t.resolve(e,i,r))return g;if(o.store.schema)return o.partial=!0,g}}}; | ||
//# sourceMappingURL=urql-exchange-graphcache-extras.min.js.map |
@@ -18,5 +18,5 @@ { | ||
"dependencies": { | ||
"@urql/core": ">=1.15.0", | ||
"@urql/core": ">=1.15.2", | ||
"wonka": "^4.0.14" | ||
} | ||
} |
{ | ||
"name": "@urql/exchange-graphcache", | ||
"version": "3.1.11", | ||
"version": "3.2.0", | ||
"description": "A normalized and configurable cache exchange for urql", | ||
@@ -68,3 +68,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@urql/core": ">=1.15.0", | ||
"@urql/core": ">=1.15.2", | ||
"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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
676141
3439
1
Updated@urql/core@>=1.15.2