@urql/exchange-retry
Advanced tools
Comparing version 0.1.4 to 0.1.5
# Changelog | ||
## 0.1.5 | ||
### Patch Changes | ||
- Add debugging events to exchanges that add more detailed information on what is happening | ||
internally, which will be displayed by devtools like the urql [Chrome / Firefox extension](https://github.com/FormidableLabs/urql-devtools), by [@andyrichardson](https://github.com/andyrichardson) (See [#608](https://github.com/FormidableLabs/urql/pull/608)) | ||
- Updated dependencies (See [#608](https://github.com/FormidableLabs/urql/pull/608), [#718](https://github.com/FormidableLabs/urql/pull/718), and [#722](https://github.com/FormidableLabs/urql/pull/722)) | ||
- @urql/core@1.11.0 | ||
## 0.1.4 | ||
@@ -4,0 +13,0 @@ |
@@ -7,4 +7,4 @@ "use strict"; | ||
return (_extends = Object.assign || function(a) { | ||
for (var c = 1; c < arguments.length; c++) { | ||
var b, e = arguments[c]; | ||
for (var d = 1; d < arguments.length; d++) { | ||
var b, e = arguments[d]; | ||
for (b in e) { | ||
@@ -23,27 +23,45 @@ Object.prototype.hasOwnProperty.call(e, b) && (a[b] = e[b]); | ||
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; | ||
var d = a.initialDelayMs || 1e3, e = a.maxDelayMs || 15e3, b = a.maxNumberAttempts || 2, l = a.randomDelay || !0, m = a.retryIf || _ref; | ||
return function(a) { | ||
var l = a.forward; | ||
var n = a.forward, h = a.dispatchDebug; | ||
return function(a) { | ||
var g = wonka.share(a); | ||
var m = (a = wonka.makeSubject()).source, n = a.next; | ||
var k = wonka.share(a); | ||
var p = (a = wonka.makeSubject()).source, q = a.next; | ||
a = wonka.mergeMap((function(a) { | ||
var b = a.key, d = a.context, p = d.retryCount || 0; | ||
d = d.retryDelay || c; | ||
var r = a.key, c = a.context, g = (c.retryCount || 0) + 1; | ||
c = c.retryDelay || d; | ||
var f = Math.random() + 1.5; | ||
h && d * f < e && (d *= f); | ||
l && c * f < e && (c *= 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, { | ||
return ("query" === a.operationName || "teardown" === a.operationName) && a.key === r; | ||
}))(k); | ||
"production" !== process.env.NODE_ENV && h({ | ||
type: "retryAttempt", | ||
message: "The operation has failed and a retry has been triggered (" + g + " / " + b + ")", | ||
operation: a, | ||
data: { | ||
retryCount: g | ||
} | ||
}); | ||
return wonka.takeUntil(f)(wonka.delay(c)(wonka.fromValue(_extends({}, a, { | ||
context: _extends({}, a.context, { | ||
retryDelay: d, | ||
retryCount: p + 1 | ||
retryDelay: c, | ||
retryCount: g | ||
}) | ||
})))); | ||
}))(m); | ||
}))(p); | ||
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 ])))); | ||
if (!a.error || !m(a.error)) { | ||
return !0; | ||
} | ||
if (!((a.operation.context.retryCount || 0) >= b - 1)) { | ||
return q(a.operation), !1; | ||
} | ||
"production" !== process.env.NODE_ENV && h({ | ||
type: "retryExhausted", | ||
message: "Maximum number of retries has been reached. No further retries will be performed.", | ||
operation: a.operation | ||
}); | ||
return !0; | ||
}))(wonka.share(n(wonka.merge([ k, a ])))); | ||
}; | ||
@@ -50,0 +68,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"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]))))}}}; | ||
"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 o=n.initialDelayMs||1e3,a=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)+1;u=u.retryDelay||o;var f=Math.random()+1.5;return i&&u*f<a&&(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})}))))}))(f),r.filter((function(r){return!r.error||!c(r.error)||(r.operation.context.retryCount||0)>=u-1||(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.4", | ||
"version": "0.1.5", | ||
"description": "An exchange for operation retry support in urql", | ||
@@ -62,3 +62,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@urql/core": ">=1.10.8", | ||
"@urql/core": ">=1.11.0", | ||
"wonka": "^4.0.9" | ||
@@ -65,0 +65,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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
33464
149
4
Updated@urql/core@>=1.11.0