@urql/exchange-retry
Advanced tools
Comparing version 0.1.9 to 0.1.10
# Changelog | ||
## 0.1.10 | ||
### Patch Changes | ||
- ⚠️ Fix the production build overwriting the development build. Specifically in the previous release we mistakenly replaced all development bundles with production bundles. This doesn't have any direct influence on how these packages work, but prevented development warnings from being logged or full errors from being thrown, by [@kitten](https://github.com/kitten) (See [#1097](https://github.com/FormidableLabs/urql/pull/1097)) | ||
- Updated dependencies (See [#1097](https://github.com/FormidableLabs/urql/pull/1097)) | ||
- @urql/core@1.14.1 | ||
## 0.1.9 | ||
@@ -4,0 +12,0 @@ |
@@ -1,2 +0,69 @@ | ||
"use strict";var r=require("wonka"),e=require("@urql/core");function t(){return(t=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 n(r){return r&&r.networkError}exports.retryExchange=function(a){var o=a.initialDelayMs||1e3,u=a.maxDelayMs||15e3,i=a.maxNumberAttempts||2,c=a.randomDelay||!0,y=a.retryIf||n;return function(n){var a=n.forward;return function(n){var f=r.share(n),l=(n=r.makeSubject()).source,s=n.next;return n=r.mergeMap((function(n){var a=n.key,i=n.context,y=(i.retryCount||0)+1;i=i.retryDelay||o;var l=Math.random()+1.5;return c&&i*l<u&&(i*=l),l=r.filter((function(r){return("query"===r.kind||"teardown"===r.kind)&&r.key===a}))(f),r.takeUntil(l)(r.delay(i)(r.fromValue(e.makeOperation(n.kind,n,t({},n.context,{retryDelay:i,retryCount:y})))))}))(l),r.filter((function(r){return!r.error||!y(r.error)||(r.operation.context.retryCount||0)>=i-1||(s(r.operation),!1)}))(r.share(a(r.merge([f,n]))))}}}; | ||
"use strict"; | ||
function _extends() { | ||
return (_extends = Object.assign || function(a) { | ||
var d, e, b; | ||
for (d = 1; d < arguments.length; d++) { | ||
e = arguments[d]; | ||
for (b in e) { | ||
Object.prototype.hasOwnProperty.call(e, b) && (a[b] = e[b]); | ||
} | ||
} | ||
return a; | ||
}).apply(this, arguments); | ||
} | ||
function _ref(a) { | ||
return a && a.networkError; | ||
} | ||
var wonka = require("wonka"), core = require("@urql/core"), retryExchange = function(a) { | ||
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 n = a.forward, h = a.dispatchDebug; | ||
return function(a) { | ||
var p, q, k = wonka.share(a); | ||
p = (a = wonka.makeSubject()).source, q = a.next; | ||
a = wonka.mergeMap((function(a) { | ||
var f, r = a.key, c = a.context, g = (c.retryCount || 0) + 1; | ||
c = c.retryDelay || d; | ||
f = Math.random() + 1.5; | ||
l && c * f < e && (c *= f); | ||
f = wonka.filter((function(a) { | ||
return ("query" === a.kind || "teardown" === a.kind) && 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 | ||
}, | ||
source: "retryExchange" | ||
}); | ||
return wonka.takeUntil(f)(wonka.delay(c)(wonka.fromValue(core.makeOperation(a.kind, a, _extends({}, a.context, { | ||
retryDelay: c, | ||
retryCount: g | ||
}))))); | ||
}))(p); | ||
return wonka.filter((function(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, | ||
source: "retryExchange" | ||
}); | ||
return !0; | ||
}))(wonka.share(n(wonka.merge([ k, a ])))); | ||
}; | ||
}; | ||
}; | ||
exports.retryExchange = retryExchange; | ||
//# sourceMappingURL=urql-exchange-retry.js.map |
{ | ||
"name": "@urql/exchange-retry", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "An exchange for operation retry support in urql", | ||
@@ -59,3 +59,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@urql/core": ">=1.14.0", | ||
"@urql/core": ">=1.14.1", | ||
"wonka": "^4.0.14" | ||
@@ -62,0 +62,0 @@ }, |
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
33209
14
154
4
Updated@urql/core@>=1.14.1