@urql/exchange-retry
Advanced tools
Comparing version 0.1.3 to 0.1.4
# Changelog | ||
## 0.1.4 | ||
### Patch Changes | ||
- Add graphql@^15.0.0 to peer dependency range, by [@kitten](https://github.com/kitten) (See [#688](https://github.com/FormidableLabs/urql/pull/688)) | ||
- Updated dependencies (See [#688](https://github.com/FormidableLabs/urql/pull/688) and [#678](https://github.com/FormidableLabs/urql/pull/678)) | ||
- @urql/core@1.10.8 | ||
## 0.1.3 | ||
@@ -4,0 +12,0 @@ |
@@ -0,62 +1,47 @@ | ||
"use strict"; | ||
var wonka = require("wonka"); | ||
function _extends() { | ||
return (_extends = Object.assign || function(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
return (_extends = Object.assign || function(a) { | ||
for (var c = 1; c < arguments.length; c++) { | ||
var b, e = arguments[c]; | ||
for (b in e) { | ||
Object.prototype.hasOwnProperty.call(e, b) && (a[b] = e[b]); | ||
} | ||
} | ||
return target; | ||
return a; | ||
}).apply(this, arguments); | ||
} | ||
function _ref(err) { | ||
return err && err.networkError; | ||
function _ref(a) { | ||
return a && a.networkError; | ||
} | ||
exports.retryExchange = function(ref) { | ||
var MIN_DELAY = ref.initialDelayMs || 1e3; | ||
var MAX_DELAY = ref.maxDelayMs || 15e3; | ||
var MAX_ATTEMPTS = ref.maxNumberAttempts || 2; | ||
var RANDOM_DELAY = ref.randomDelay || !0; | ||
var retryIf = ref.retryIf || _ref; | ||
return function(ref) { | ||
var forward = ref.forward; | ||
return function(ops$) { | ||
var sharedOps$ = wonka.share(ops$); | ||
var ref = wonka.makeSubject(); | ||
var retry$ = ref.source; | ||
var nextRetryOperation = ref.next; | ||
var retryWithBackoff$ = wonka.mergeMap((function(op) { | ||
var key = op.key; | ||
var context = op.context; | ||
var retryCount = context.retryCount || 0; | ||
var delayAmount = context.retryDelay || MIN_DELAY; | ||
var backoffFactor = Math.random() + 1.5; | ||
if (RANDOM_DELAY && delayAmount * backoffFactor < MAX_DELAY) { | ||
delayAmount *= backoffFactor; | ||
} | ||
var teardown$ = wonka.filter((function(op) { | ||
return ("query" === op.operationName || "teardown" === op.operationName) && op.key === key; | ||
}))(sharedOps$); | ||
return wonka.takeUntil(teardown$)(wonka.delay(delayAmount)(wonka.fromValue(_extends({}, op, { | ||
context: _extends({}, op.context, { | ||
retryDelay: delayAmount, | ||
retryCount: retryCount + 1 | ||
exports.retryExchange = function(a) { | ||
var c = a.initialDelayMs || 1e3, e = a.maxDelayMs || 15e3, b = a.maxNumberAttempts || 2, h = a.randomDelay || !0, k = a.retryIf || _ref; | ||
return function(a) { | ||
var l = a.forward; | ||
return function(a) { | ||
var g = wonka.share(a); | ||
var m = (a = wonka.makeSubject()).source, n = a.next; | ||
a = wonka.mergeMap((function(a) { | ||
var b = a.key, d = a.context, p = d.retryCount || 0; | ||
d = d.retryDelay || c; | ||
var f = Math.random() + 1.5; | ||
h && d * f < e && (d *= f); | ||
f = wonka.filter((function(a) { | ||
return ("query" === a.operationName || "teardown" === a.operationName) && a.key === b; | ||
}))(g); | ||
return wonka.takeUntil(f)(wonka.delay(d)(wonka.fromValue(_extends({}, a, { | ||
context: _extends({}, a.context, { | ||
retryDelay: d, | ||
retryCount: p + 1 | ||
}) | ||
})))); | ||
}))(retry$); | ||
return wonka.filter((function(res) { | ||
var maxNumberAttemptsExceeded = (res.operation.context.retryCount || 0) >= MAX_ATTEMPTS - 1; | ||
if (res.error && retryIf(res.error) && !maxNumberAttemptsExceeded) { | ||
nextRetryOperation(res.operation); | ||
return !1; | ||
} else { | ||
return !0; | ||
} | ||
}))(wonka.share(forward(wonka.merge([ sharedOps$, retryWithBackoff$ ])))); | ||
}))(m); | ||
return wonka.filter((function(a) { | ||
var c = (a.operation.context.retryCount || 0) >= b - 1; | ||
return a.error && k(a.error) && !c ? (n(a.operation), !1) : !0; | ||
}))(wonka.share(l(wonka.merge([ g, a ])))); | ||
}; | ||
@@ -63,0 +48,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
var r=require("wonka");function e(){return(e=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r}).apply(this,arguments)}function t(r){return r&&r.networkError}exports.retryExchange=function(n){var a=n.initialDelayMs||1e3,o=n.maxDelayMs||15e3,u=n.maxNumberAttempts||2,i=n.randomDelay||!0,c=n.retryIf||t;return function(t){var n=t.forward;return function(t){var y=r.share(t),f=r.makeSubject(),l=f.source,m=f.next,p=r.mergeMap((function(t){var n=t.key,u=t.context,c=u.retryCount||0,f=u.retryDelay||a,l=Math.random()+1.5;i&&f*l<o&&(f*=l);var m=r.filter((function(r){return("query"===r.operationName||"teardown"===r.operationName)&&r.key===n}))(y);return r.takeUntil(m)(r.delay(f)(r.fromValue(e({},t,{context:e({},t.context,{retryDelay:f,retryCount:c+1})}))))}))(l);return r.filter((function(r){var e=(r.operation.context.retryCount||0)>=u-1;return!(r.error&&c(r.error)&&!e&&(m(r.operation),1))}))(r.share(n(r.merge([y,p]))))}}}; | ||
"use strict";var r=require("wonka");function e(){return(e=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t,n=arguments[e];for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r}).apply(this,arguments)}function t(r){return r&&r.networkError}exports.retryExchange=function(n){var a=n.initialDelayMs||1e3,o=n.maxDelayMs||15e3,u=n.maxNumberAttempts||2,i=n.randomDelay||!0,c=n.retryIf||t;return function(t){var n=t.forward;return function(t){var y=r.share(t),f=(t=r.makeSubject()).source,l=t.next;return t=r.mergeMap((function(t){var n=t.key,u=t.context,c=u.retryCount||0;u=u.retryDelay||a;var f=Math.random()+1.5;return i&&u*f<o&&(u*=f),f=r.filter((function(r){return("query"===r.operationName||"teardown"===r.operationName)&&r.key===n}))(y),r.takeUntil(f)(r.delay(u)(r.fromValue(e({},t,{context:e({},t.context,{retryDelay:u,retryCount:c+1})}))))}))(f),r.filter((function(r){var e=(r.operation.context.retryCount||0)>=u-1;return!(r.error&&c(r.error)&&!e&&(l(r.operation),1))}))(r.share(n(r.merge([y,t]))))}}}; | ||
//# sourceMappingURL=urql-exchange-retry.min.js.map |
{ | ||
"name": "@urql/exchange-retry", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "An exchange for operation retry support in urql", | ||
@@ -54,3 +54,3 @@ "sideEffects": false, | ||
"@types/react": "^16.9.19", | ||
"graphql": "^14.6.0", | ||
"graphql": "^15.0.0", | ||
"react": "^16.13.0", | ||
@@ -60,7 +60,6 @@ "react-dom": "^16.13.0" | ||
"peerDependencies": { | ||
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0", | ||
"react": ">= 16.8.0" | ||
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" | ||
}, | ||
"dependencies": { | ||
"@urql/core": ">=1.10.4", | ||
"@urql/core": ">=1.10.8", | ||
"wonka": "^4.0.9" | ||
@@ -67,0 +66,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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
3
0
29302
114
+ Addedgraphql@15.10.1(transitive)
- Removedgraphql@14.7.0(transitive)
- Removediterall@1.3.0(transitive)
- Removedreact@19.0.0(transitive)
Updated@urql/core@>=1.10.8