@urql/exchange-auth
Advanced tools
Comparing version 0.1.5 to 0.1.6
# Changelog | ||
## 0.1.6 | ||
### Patch Changes | ||
- ⚠️ Fix willAuthError causing duplicate operations, by [@yankovalera](https://github.com/yankovalera) (See [#1849](https://github.com/FormidableLabs/urql/pull/1849)) | ||
- Updated dependencies (See [#1851](https://github.com/FormidableLabs/urql/pull/1851), [#1850](https://github.com/FormidableLabs/urql/pull/1850), and [#1852](https://github.com/FormidableLabs/urql/pull/1852)) | ||
- @urql/core@2.2.0 | ||
## 0.1.5 | ||
@@ -4,0 +12,0 @@ |
@@ -70,9 +70,8 @@ var t = require("wonka"); | ||
} | ||
return c; | ||
} | ||
var m = t.share(r); | ||
var l = t.filter((function(t) { | ||
var s = t.filter((function(t) { | ||
return "teardown" === t.kind; | ||
}))(m); | ||
var s = t.filter((function(t) { | ||
var l = t.filter((function(t) { | ||
return "teardown" !== t.kind; | ||
@@ -86,2 +85,5 @@ }))(m); | ||
}))(t.merge([ p, t.mergeMap((function(e) { | ||
if (h.has(e.key)) { | ||
return t.empty; | ||
} | ||
if (!c && o && o({ | ||
@@ -91,3 +93,3 @@ operation: e, | ||
})) { | ||
c = refreshAuth(e); | ||
refreshAuth(e); | ||
return t.empty; | ||
@@ -103,4 +105,4 @@ } else if (!c) { | ||
}))(t.fromPromise(c))); | ||
}))(s) ])); | ||
var k = t.share(f(t.merge([ A, l ]))); | ||
}))(l) ])); | ||
var k = t.share(f(t.merge([ A, s ]))); | ||
return t.filter((function(t) { | ||
@@ -114,3 +116,3 @@ var e = t.error; | ||
if (!r.context.authAttempt) { | ||
c = refreshAuth(r); | ||
refreshAuth(r); | ||
return !1; | ||
@@ -117,0 +119,0 @@ } |
@@ -1,2 +0,2 @@ | ||
var t=require("wonka"),r=require("@urql/core");function e(){return(e=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(this,arguments)}function n(t,n){return r.makeOperation(t.kind,t,e({},t.context,{authAttempt:n}))}exports.authExchange=function(e){var u=e.addAuthToOperation,a=e.getAuth,o=e.didAuthError,i=e.willAuthError;return function(e){var c=e.client,f=e.forward,h=new Map,l=t.makeSubject(),p=l.source,m=l.next,s=null;return function(e){function l(e,n,u){var a=c.createRequestOperation("mutation",r.createRequest(e,n),u);return t.toPromise(t.take(1)(t.filter((function(t){return t.operation.key===a.key}))(t.onStart((function(){return m(a)}))(A))))}function k(t){s=t,d=void 0,h.forEach(m),h.clear()}var d=Promise.resolve().then((function(){return a({authState:s,mutate:l})})).then(k);function v(t){return t=n(t,!0),h.set(t.key,t),d||(d=a({authState:s,mutate:l}).then(k).catch((function(){return k(null)}))),d}var y=t.share(e),w=t.filter((function(t){return"teardown"===t.kind}))(y),g=t.filter((function(t){return"teardown"!==t.kind}))(y),S=t.map((function(t){return u({operation:t,authState:s})}))(t.merge([p,t.mergeMap((function(r){if(!d&&i&&i({operation:r,authState:s}))return d=v(r),t.empty;if(!d)return t.fromValue(n(r,!1));var e=t.filter((function(t){return"teardown"===t.kind&&t.key===r.key}))(y);return t.takeUntil(e)(t.map((function(){return n(r,!1)}))(t.fromPromise(d)))}))(g)])),A=t.share(f(t.merge([S,w])));return t.filter((function(t){var r=t.error,e=t.operation;return!(r&&o&&o({error:r,authState:s})&&!e.context.authAttempt&&(d=v(e),1))}))(A)}}}; | ||
var t=require("wonka"),r=require("@urql/core");function e(){return(e=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(this,arguments)}function n(t,n){return r.makeOperation(t.kind,t,e({},t.context,{authAttempt:n}))}exports.authExchange=function(e){var u=e.addAuthToOperation,a=e.getAuth,o=e.didAuthError,i=e.willAuthError;return function(e){var c=e.client,f=e.forward,h=new Map,l=t.makeSubject(),p=l.source,m=l.next,s=null;return function(e){function l(e,n,u){var a=c.createRequestOperation("mutation",r.createRequest(e,n),u);return t.toPromise(t.take(1)(t.filter((function(t){return t.operation.key===a.key}))(t.onStart((function(){return m(a)}))(A))))}function k(t){s=t,d=void 0,h.forEach(m),h.clear()}var d=Promise.resolve().then((function(){return a({authState:s,mutate:l})})).then(k);function v(t){t=n(t,!0),h.set(t.key,t),d||(d=a({authState:s,mutate:l}).then(k).catch((function(){return k(null)})))}var y=t.share(e),w=t.filter((function(t){return"teardown"===t.kind}))(y),g=t.filter((function(t){return"teardown"!==t.kind}))(y),S=t.map((function(t){return u({operation:t,authState:s})}))(t.merge([p,t.mergeMap((function(r){if(h.has(r.key))return t.empty;if(!d&&i&&i({operation:r,authState:s}))return v(r),t.empty;if(!d)return t.fromValue(n(r,!1));var e=t.filter((function(t){return"teardown"===t.kind&&t.key===r.key}))(y);return t.takeUntil(e)(t.map((function(){return n(r,!1)}))(t.fromPromise(d)))}))(g)])),A=t.share(f(t.merge([S,w])));return t.filter((function(t){var r=t.error,e=t.operation;return!(r&&o&&o({error:r,authState:s})&&!e.context.authAttempt&&(v(e),1))}))(A)}}}; | ||
//# sourceMappingURL=urql-exchange-auth.min.js.map |
{ | ||
"name": "@urql/exchange-auth", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "An exchange for managing authentication and token refresh in urql", | ||
@@ -54,3 +54,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@urql/core": ">=2.1.6", | ||
"@urql/core": ">=2.2.0", | ||
"wonka": "^4.0.14" | ||
@@ -57,0 +57,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
50877
278
Updated@urql/core@>=2.2.0