axios-annotations 1.1.2 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -579,19 +579,21 @@ npm install axios@0.21.0
579
579
  npm install axios-miniprogram-adapter
580
580
  ```
581
581
 
582
- + 编译报错 `module is not defined`, 在`app.js`头部补充声明:
582
+ + 编译报错 `module is not defined`, 在`app.js`头部补充缺失组件的声明:
583
583
 
584
584
  ```javascript
585
- import RequestMapping from "axios-annotations/decorator/request-mapping";
586
- import GetMapping from "axios-annotations/decorator/get-mapping";
587
- import PostMapping from "axios-annotations/decorator/post-mapping";
588
- import PutMapping from "axios-annotations/decorator/put-mapping";
589
- import DeleteMapping from "axios-annotations/decorator/delete-mapping";
590
- import PatchMapping from "axios-annotations/decorator/patch-mapping";
591
- import RequestParam from "axios-annotations/decorator/request-param";
592
- import RequestBody from "axios-annotations/decorator/request-body";
593
- import RequestHeader from "axios-annotations/decorator/request-header";
594
- import RequestConfig from "axios-annotations/decorator/request-config";
585
+ import "axios-annotations/core/service";
586
+ import "axios-annotations/decorator/request-mapping";
587
+ import "axios-annotations/decorator/get-mapping";
588
+ import "axios-annotations/decorator/post-mapping";
589
+ import "axios-annotations/decorator/put-mapping";
590
+ import "axios-annotations/decorator/delete-mapping";
591
+ import "axios-annotations/decorator/patch-mapping";
592
+ import "axios-annotations/decorator/request-param";
593
+ import "axios-annotations/decorator/request-body";
594
+ import "axios-annotations/decorator/request-header";
595
+ import "axios-annotations/decorator/request-config";
596
+ import "axios-annotations/decorator/request-with";
595
597
  ```
596
598
 
597
599
  + 更新开发工具以支持装饰器语法。
@@ -0,0 +1 @@
1
+ module.exports = require("../lib/decorator/request-with");
@@ -1 +1 @@
1
- "use strict";function normalizePath(r){return r.replace(/\/+/g,"/").replace(/\/$/,"")}function isNullOrEmpty(r){return null==r||""===r}function forward(r,t,e,a,n,o,l,c,u){t="".concat(t)+normalizePath("/".concat(e,"/").concat(a,"/").concat(n));return l&&(t=0<=t.lastIndexOf("?")?"&"+l:"?"+l),r.request(Object.assign({method:o,url:t,data:c},u))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.forward=forward,exports.isNullOrEmpty=isNullOrEmpty,exports.normalizePath=normalizePath;
1
+ "use strict";function normalizePath(r){return r.replace(/\/+/g,"/").replace(/\/$/,"")}function isNullOrEmpty(r){return null==r||""===r}function forward(r,t,e,a,n,o,l,c,u){t="".concat(t)+normalizePath("/".concat(e,"/").concat(a,"/").concat(n));return l&&(0<=t.lastIndexOf("?")?t+="&"+l:t+="?"+l),r.request(Object.assign({method:o,url:t,data:c},u))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.forward=forward,exports.isNullOrEmpty=isNullOrEmpty,exports.normalizePath=normalizePath;
@@ -1 +1 @@
1
- "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _storage=_interopRequireDefault(require("./storage")),_history=_interopRequireDefault(require("./history"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,u=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o,i,a,s,e=e&&e.prototype instanceof h?e:h,e=Object.create(e.prototype),n=new w(n||[]);return e._invoke=(o=t,i=r,a=n,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return x()}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=e.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}n=c(n,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;n=n.arg;return n?n.done?(r[e.resultName]=n.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}(r,a);if(r){if(r===f)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";r=c(o,i,a);if("normal"===r.type){if(s=a.done?"completed":"suspendedYield",r.arg===f)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),e}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var f={};function h(){}function l(){}function p(){}var e={},y=(i(e,n,function(){return this}),Object.getPrototypeOf),y=y&&y(y(b([]))),d=(y&&y!==t&&u.call(y,n)&&(e=y),p.prototype=h.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function g(a,s){var e;this._invoke=function(r,n){function t(){return new s(function(t,e){!function e(t,r,n,o){var i,t=c(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&u.call(r,"__await")?s.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):s.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function b(e){if(e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(u.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:x}}function x(){return{value:void 0,done:!0}}return i(d,"constructor",l.prototype=p),i(p,"constructor",l),l.displayName=i(p,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,i(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t},a.awrap=function(t){return{__await:t}},v(g.prototype),i(g.prototype,r,function(){return this}),a.AsyncIterator=g,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new g(s(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},v(d),i(d,o,"Generator"),i(d,n,function(){return this}),i(d,"toString",function(){return"[object Generator]"}),a.keys=function(r){var t,n=[];for(t in r)n.push(t);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=b,w.prototype={constructor:w,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),s=u.call(o,"finallyLoc");if(a&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,_(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:b(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},a}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(s){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=s.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _createClass(t,e,r){return e&&_defineProperties(t.prototype,e),r&&_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Authorizer=function(){function t(){_classCallCheck(this,t),_defineProperty(this,"_sessionKey","$_SESSION"),_defineProperty(this,"_sessionStorage",new _storage.default),_defineProperty(this,"_sessionHistory",new _history.default)}var e,r,n,o,i;return _createClass(t,[{key:"sessionKey",get:function(){return this._sessionKey},set:function(t){this._sessionKey=t}},{key:"sessionStorage",get:function(){return this._sessionStorage},set:function(t){this._sessionStorage=t}},{key:"sessionHistory",get:function(){return this._sessionHistory},set:function(t){this._sessionHistory=t}},{key:"getSession",value:(i=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sessionStorage.get(this.sessionKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t,this)})),function(){return i.apply(this,arguments)})},{key:"storageSession",value:(o=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sessionStorage.set(this.sessionKey,e);case 2:case"end":return t.stop()}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"refreshSession",value:(n=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",null);case 1:case"end":return t.stop()}},t)})),function(t){return n.apply(this,arguments)})},{key:"withAuthentication",value:function(t,e){var r,n;e&&(r=e.access_token,n=e.accessToken,e=e.token,(r||n||e)&&(t.headers.Authorization="Bearer "+(r||n||e)))}},{key:"checkSession",value:function(t,e){t=t.headers.Authorization||t.headers.authorization,t=t&&t.split(" ")[1]||"";return(e.access_token||e.accessToken||e.token)!==t&&(!this.sessionHistory.size||!this.sessionHistory.check(t))}},{key:"checkResponse",value:function(t){return 401!==(t||{status:0}).status}},{key:"onAuthorizedDenied",value:(r=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:throw e;case 1:case"end":return t.stop()}},t)})),function(t){return r.apply(this,arguments)})},{key:"onSessionInvalidated",value:function(){}},{key:"invalidateSession",value:(e=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sessionStorage.remove(this.sessionKey);case 2:this.onSessionInvalidated();case 3:case"end":return t.stop()}},t,this)})),function(){return e.apply(this,arguments)})}]),t}();exports.default=Authorizer;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _storage=_interopRequireDefault(require("./storage")),_history=_interopRequireDefault(require("./history"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function asyncGeneratorStep(e,t,n,r,s,o,i){try{var a=e[o](i),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,s)}function _asyncToGenerator(a){return function(){var e=this,i=arguments;return new Promise(function(t,n){var r=a.apply(e,i);function s(e){asyncGeneratorStep(r,t,n,s,o,"next",e)}function o(e){asyncGeneratorStep(r,t,n,s,o,"throw",e)}s(void 0)})}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Authorizer=function(){function e(){_classCallCheck(this,e),_defineProperty(this,"_sessionKey","$_SESSION"),_defineProperty(this,"_sessionStorage",new _storage.default),_defineProperty(this,"_sessionHistory",new _history.default)}var t,n,r,s,o;return _createClass(e,[{key:"sessionKey",get:function(){return this._sessionKey},set:function(e){this._sessionKey=e}},{key:"sessionStorage",get:function(){return this._sessionStorage},set:function(e){this._sessionStorage=e}},{key:"sessionHistory",get:function(){return this._sessionHistory},set:function(e){this._sessionHistory=e}},{key:"getSession",value:(o=_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sessionStorage.get(this.sessionKey);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,this)})),function(){return o.apply(this,arguments)})},{key:"storageSession",value:(s=_asyncToGenerator(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sessionStorage.set(this.sessionKey,t);case 2:case"end":return e.stop()}},e,this)})),function(e){return s.apply(this,arguments)})},{key:"refreshSession",value:(r=_asyncToGenerator(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null);case 1:case"end":return e.stop()}},e)})),function(e){return r.apply(this,arguments)})},{key:"withAuthentication",value:function(e,t){var n,r;t&&(n=t.access_token,r=t.accessToken,t=t.token,(n||r||t)&&(e.headers.Authorization="Bearer "+(n||r||t)))}},{key:"checkSession",value:function(e,t){e=e.headers.Authorization||e.headers.authorization,e=e&&e.split(" ")[1]||"";return(t.access_token||t.accessToken||t.token)!==e&&(!this.sessionHistory.size||!this.sessionHistory.check(e))}},{key:"checkResponse",value:function(e){return 401!==(e||{status:0}).status}},{key:"onAuthorizedDenied",value:(n=_asyncToGenerator(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw t;case 1:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)})},{key:"onSessionInvalidated",value:function(){}},{key:"invalidateSession",value:(t=_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sessionStorage.remove(this.sessionKey);case 2:this.onSessionInvalidated();case 3:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})}]),e}();exports.default=Authorizer;
@@ -1 +1 @@
1
- "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=AuthorizationPlugin;var _queue=_interopRequireDefault(require("./queue"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,u=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof h?e:h,e=Object.create(e.prototype),n=new x(n||[]);return e._invoke=(o=t,i=r,a=n,c="suspendedStart",function(t,e){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return _()}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=e.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}n=s(n,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;n=n.arg;return n?n.done?(r[e.resultName]=n.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}(r,a);if(r){if(r===f)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===c)throw c="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c="executing";r=s(o,i,a);if("normal"===r.type){if(c=a.done?"completed":"suspendedYield",r.arg===f)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c="completed",a.method="throw",a.arg=r.arg)}}),e}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var f={};function h(){}function l(){}function p(){}var e={},y=(i(e,n,function(){return this}),Object.getPrototypeOf),y=y&&y(y(b([]))),d=(y&&y!==t&&u.call(y,n)&&(e=y),p.prototype=h.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function g(a,c){var e;this._invoke=function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=s(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&u.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function b(e){if(e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(u.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:_}}function _(){return{value:void 0,done:!0}}return i(d,"constructor",l.prototype=p),i(p,"constructor",l),l.displayName=i(p,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,i(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t},a.awrap=function(t){return{__await:t}},v(g.prototype),i(g.prototype,r,function(){return this}),a.AsyncIterator=g,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new g(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},v(d),i(d,o,"Generator"),i(d,n,function(){return this}),i(d,"toString",function(){return"[object Generator]"}),a.keys=function(r){var t,n=[];for(t in r)n.push(t);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=b,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),c=u.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,w(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:b(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},a}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}function AuthorizationPlugin(c){return function(t){var e,r,o=!1,i=null,a=new _queue.default(c);t.axios.interceptors.response.use(function(t){return i&&(c.sessionHistory.add(i),i=null),t},(e=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var r,n;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.response,c.checkResponse(r)){t.next=66;break}if(o){t.next=61;break}return o=!0,t.next=6,c.getSession();case 6:if(n=t.sent,c.sessionHistory.isDeprecated(n))return t.prev=8,t.next=11,c.onAuthorizedDenied(e);t.next=21;break;case 11:c.sessionHistory.clean(),t.next=17;break;case 14:throw t.prev=14,t.t0=t.catch(8),e;case 17:return t.prev=17,o=!1,a.clear(),t.finish(17);case 21:if(i=n,c.checkSession(e.config,n)){t.next=48;break}return t.prev=23,t.t1=c,t.next=27,c.refreshSession(n);case 27:return t.t2=t.sent,t.next=30,t.t1.storageSession.call(t.t1,t.t2);case 30:t.next=48;break;case 32:return t.prev=32,t.t3=t.catch(23),c.sessionHistory.deprecate(n),t.prev=35,t.next=38,c.onAuthorizedDenied(t.t3);case 38:c.sessionHistory.clean(),t.next=44;break;case 41:throw t.prev=41,t.t4=t.catch(35),e;case 44:return t.prev=44,o=!1,a.clear(),t.finish(44);case 48:for(o=!1;a.size;)a.pop();return t.prev=50,t.next=53,a.resend(e);case 53:return t.abrupt("return",t.sent);case 56:throw t.prev=56,t.t5=t.catch(50),t.t5;case 59:t.next=64;break;case 61:return t.next=63,a.push(e);case 63:return t.abrupt("return",t.sent);case 64:t.next=67;break;case 66:throw e;case 67:case"end":return t.stop()}},t,null,[[8,14,17,21],[23,32],[35,41,44,48],[50,56]])})),function(t){return e.apply(this,arguments)})),t.axios.interceptors.request.use((r=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var r;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c.getSession();case 2:return r=t.sent,c.withAuthentication(e,r),t.abrupt("return",e);case 5:case"end":return t.stop()}},t)})),function(t){return r.apply(this,arguments)}))}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=AuthorizationPlugin;var _queue=_interopRequireDefault(require("./queue"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function asyncGeneratorStep(e,r,t,n,s,a,o){try{var u=e[a](o),i=u.value}catch(e){return void t(e)}u.done?r(i):Promise.resolve(i).then(n,s)}function _asyncToGenerator(u){return function(){var e=this,o=arguments;return new Promise(function(r,t){var n=u.apply(e,o);function s(e){asyncGeneratorStep(n,r,t,s,a,"next",e)}function a(e){asyncGeneratorStep(n,r,t,s,a,"throw",e)}s(void 0)})}}function AuthorizationPlugin(u){return function(e){var r,t,s=!1,a=null,o=new _queue.default(u);e.axios.interceptors.response.use(function(e){return a&&(u.sessionHistory.add(a),a=null),e},(r=_asyncToGenerator(regeneratorRuntime.mark(function e(r){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=r.response,u.checkResponse(t)){e.next=66;break}if(s){e.next=61;break}return s=!0,e.next=6,u.getSession();case 6:if(n=e.sent,u.sessionHistory.isDeprecated(n))return e.prev=8,e.next=11,u.onAuthorizedDenied(r);e.next=21;break;case 11:u.sessionHistory.clean(),e.next=17;break;case 14:throw e.prev=14,e.t0=e.catch(8),r;case 17:return e.prev=17,s=!1,o.clear(),e.finish(17);case 21:if(a=n,u.checkSession(r.config,n)){e.next=48;break}return e.prev=23,e.t1=u,e.next=27,u.refreshSession(n);case 27:return e.t2=e.sent,e.next=30,e.t1.storageSession.call(e.t1,e.t2);case 30:e.next=48;break;case 32:return e.prev=32,e.t3=e.catch(23),u.sessionHistory.deprecate(n),e.prev=35,e.next=38,u.onAuthorizedDenied(e.t3);case 38:u.sessionHistory.clean(),e.next=44;break;case 41:throw e.prev=41,e.t4=e.catch(35),r;case 44:return e.prev=44,s=!1,o.clear(),e.finish(44);case 48:for(s=!1;o.size;)o.pop();return e.prev=50,e.next=53,o.resend(r);case 53:return e.abrupt("return",e.sent);case 56:throw e.prev=56,e.t5=e.catch(50),e.t5;case 59:e.next=64;break;case 61:return e.next=63,o.push(r);case 63:return e.abrupt("return",e.sent);case 64:e.next=67;break;case 66:throw r;case 67:case"end":return e.stop()}},e,null,[[8,14,17,21],[23,32],[35,41,44,48],[50,56]])})),function(e){return r.apply(this,arguments)})),e.axios.interceptors.request.use((t=_asyncToGenerator(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.getSession();case 2:return t=e.sent,u.withAuthentication(r,t),e.abrupt("return",r);case 5:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)}))}}
@@ -1 +1 @@
1
- "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _axios=_interopRequireDefault(require("axios"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,c=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o,i,a,u,e=e&&e.prototype instanceof l?e:l,e=Object.create(e.prototype),n=new _(n||[]);return e._invoke=(o=t,i=r,a=n,u="suspendedStart",function(t,e){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===t)throw e;return x()}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=e.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}n=s(n,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;n=n.arg;return n?n.done?(r[e.resultName]=n.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}(r,a);if(r){if(r===f)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===u)throw u="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);u="executing";r=s(o,i,a);if("normal"===r.type){if(u=a.done?"completed":"suspendedYield",r.arg===f)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(u="completed",a.method="throw",a.arg=r.arg)}}),e}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var f={};function l(){}function h(){}function p(){}var e={},y=(i(e,n,function(){return this}),Object.getPrototypeOf),y=y&&y(y(b([]))),d=(y&&y!==t&&c.call(y,n)&&(e=y),p.prototype=l.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function g(a,u){var e;this._invoke=function(r,n){function t(){return new u(function(t,e){!function e(t,r,n,o){var i,t=s(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&c.call(r,"__await")?u.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):u.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function b(e){if(e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(c.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:x}}function x(){return{value:void 0,done:!0}}return i(d,"constructor",h.prototype=p),i(p,"constructor",h),h.displayName=i(p,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,i(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t},a.awrap=function(t){return{__await:t}},v(g.prototype),i(g.prototype,r,function(){return this}),a.AsyncIterator=g,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new g(u(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},v(d),i(d,o,"Generator"),i(d,n,function(){return this}),i(d,"toString",function(){return"[object Generator]"}),a.keys=function(r){var t,n=[];for(t in r)n.push(t);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=b,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&c.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=c.call(o,"catchLoc"),u=c.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&c.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,w(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:b(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},a}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(u){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=u.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _createClass(t,e,r){return e&&_defineProperties(t.prototype,e),r&&_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function random(t,e){return(Math.random()*(e-t+1)|0)+t}function sleep(r){return new Promise(function(t){var e=setTimeout(function(){clearTimeout(e),e=void 0,t()},r)})}var PendingQueue=function(){function e(t){_classCallCheck(this,e),_defineProperty(this,"_queue",[]),_defineProperty(this,"_authorizer",null),_defineProperty(this,"_axios",_axios.default.create()),this._authorizer=t}var r;return _createClass(e,[{key:"resend",value:(r=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var r,n,o,i=arguments;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r=1<i.length&&void 0!==i[1]?i[1]:3,n=0;case 2:if(!(n<r)){t.next=25;break}if(0<n)return t.next=6,sleep(random(3e3,5e3));t.next=6;break;case 6:return t.next=8,this._authorizer.getSession();case 8:if(o=t.sent,this._authorizer.sessionHistory.isDeprecated(o))throw e;t.next=11;break;case 11:return t.prev=11,this._authorizer.withAuthentication(e.config,o),t.next=15,this._axios.request(e.config);case 15:return t.abrupt("return",t.sent);case 18:if(t.prev=18,t.t0=t.catch(11),r-1<=n)throw t.t0;t.next=22;break;case 22:++n,t.next=2;break;case 25:case"end":return t.stop()}},t,this,[[11,18]])})),function(t){return r.apply(this,arguments)})},{key:"push",value:function(r){var n=this;return new Promise(function(t,e){n._queue.push({error:r,resolve:t,reject:e})})}},{key:"pop",value:function(){var t=this._queue.shift(),e=t.error,r=t.resolve,t=t.reject;this.resend(e).then(r).catch(t)}},{key:"clear",value:function(){this._queue.splice(0).forEach(function(t){var e=t.error;(0,t.reject)(e)})}},{key:"size",get:function(){return this._queue.length}}]),e}();exports.default=PendingQueue;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _axios=_interopRequireDefault(require("axios"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function asyncGeneratorStep(e,r,t,n,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,i)}function _asyncToGenerator(u){return function(){var e=this,a=arguments;return new Promise(function(r,t){var n=u.apply(e,a);function i(e){asyncGeneratorStep(n,r,t,i,o,"next",e)}function o(e){asyncGeneratorStep(n,r,t,i,o,"throw",e)}i(void 0)})}}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function random(e,r){return(Math.random()*(r-e+1)|0)+e}function sleep(t){return new Promise(function(e){var r=setTimeout(function(){clearTimeout(r),r=void 0,e()},t)})}var PendingQueue=function(){function r(e){_classCallCheck(this,r),_defineProperty(this,"_queue",[]),_defineProperty(this,"_authorizer",null),_defineProperty(this,"_axios",_axios.default.create()),this._authorizer=e}var t;return _createClass(r,[{key:"resend",value:(t=_asyncToGenerator(regeneratorRuntime.mark(function e(r){var t,n,i,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=1<o.length&&void 0!==o[1]?o[1]:3,n=0;case 2:if(!(n<t)){e.next=25;break}if(0<n)return e.next=6,sleep(random(3e3,5e3));e.next=6;break;case 6:return e.next=8,this._authorizer.getSession();case 8:if(i=e.sent,this._authorizer.sessionHistory.isDeprecated(i))throw r;e.next=11;break;case 11:return e.prev=11,this._authorizer.withAuthentication(r.config,i),e.next=15,this._axios.request(r.config);case 15:return e.abrupt("return",e.sent);case 18:if(e.prev=18,e.t0=e.catch(11),t-1<=n)throw e.t0;e.next=22;break;case 22:++n,e.next=2;break;case 25:case"end":return e.stop()}},e,this,[[11,18]])})),function(e){return t.apply(this,arguments)})},{key:"push",value:function(t){var n=this;return new Promise(function(e,r){n._queue.push({error:t,resolve:e,reject:r})})}},{key:"pop",value:function(){var e=this._queue.shift(),r=e.error,t=e.resolve,e=e.reject;this.resend(r).then(t).catch(e)}},{key:"clear",value:function(){this._queue.splice(0).forEach(function(e){var r=e.error;(0,e.reject)(r)})}},{key:"size",get:function(){return this._queue.length}}]),r}();exports.default=PendingQueue;
@@ -1 +1 @@
1
- "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,u=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof l?e:l,e=Object.create(e.prototype),n=new S(n||[]);return e._invoke=(o=t,i=r,a=n,c="suspendedStart",function(t,e){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return x()}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=e.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}n=s(n,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;n=n.arg;return n?n.done?(r[e.resultName]=n.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}(r,a);if(r){if(r===f)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===c)throw c="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c="executing";r=s(o,i,a);if("normal"===r.type){if(c=a.done?"completed":"suspendedYield",r.arg===f)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c="completed",a.method="throw",a.arg=r.arg)}}),e}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var f={};function l(){}function h(){}function y(){}var e={},p=(i(e,n,function(){return this}),Object.getPrototypeOf),p=p&&p(p(b([]))),g=(p&&p!==t&&u.call(p,n)&&(e=p),y.prototype=l.prototype=Object.create(e));function d(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function m(a,c){var e;this._invoke=function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=s(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&u.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}}function v(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(v,this),this.reset(!0)}function b(e){if(e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(u.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:x}}function x(){return{value:void 0,done:!0}}return i(g,"constructor",h.prototype=y),i(y,"constructor",h),h.displayName=i(y,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,i(t,o,"GeneratorFunction")),t.prototype=Object.create(g),t},a.awrap=function(t){return{__await:t}},d(m.prototype),i(m.prototype,r,function(){return this}),a.AsyncIterator=m,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new m(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},d(g),i(g,o,"Generator"),i(g,n,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(r){var t,n=[];for(t in r)n.push(t);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=b,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),c=u.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,w(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:b(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},a}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _createClass(t,e,r){return e&&_defineProperties(t.prototype,e),r&&_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var SessionStorage=function(){function t(){_classCallCheck(this,t),_defineProperty(this,"_inMemoryStorage",{})}var e,r,n;return _createClass(t,[{key:"set",value:(n=_asyncToGenerator(_regeneratorRuntime().mark(function t(e,r){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:window&&window.sessionStorage?window.sessionStorage.setItem(e,JSON.stringify(r)):wx&&wx.setStorageSync?wx.setStorageSync(e,r):my&&my.setStorageSync?my.setStorageSync(e,r):tt&&tt.setStorageSync?tt.setStorageSync(e,r):this._inMemoryStorage[e]=r;case 1:case"end":return t.stop()}},t,this)})),function(t,e){return n.apply(this,arguments)})},{key:"get",value:(r=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var r;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(window&&window.sessionStorage)return r=window.sessionStorage.getItem(e),t.abrupt("return",JSON.parse(r));t.next=5;break;case 5:if(wx&&wx.getStorageSync)return t.abrupt("return",wx.getStorageSync(e));t.next=9;break;case 9:if(my&&my.getStorageSync)return t.abrupt("return",my.getStorageSync(e));t.next=13;break;case 13:if(tt&&tt.getStorageSync)return t.abrupt("return",tt.getStorageSync(e));t.next=17;break;case 17:return t.abrupt("return",this._inMemoryStorage[e]);case 18:case"end":return t.stop()}},t,this)})),function(t){return r.apply(this,arguments)})},{key:"remove",value:(e=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:window&&window.sessionStorage?window.sessionStorage.removeItem(e):wx&&wx.removeStorageSync?wx.removeStorageSync(e):my&&my.removeStorageSync?my.removeStorageSync(e):tt&&tt.removeStorageSync?tt.removeStorageSync(e):delete this._inMemoryStorage[e];case 1:case"end":return t.stop()}},t,this)})),function(t){return e.apply(this,arguments)})}]),t}();exports.default=SessionStorage;
1
+ "use strict";function asyncGeneratorStep(e,t,r,n,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(s){return function(){var e=this,i=arguments;return new Promise(function(t,r){var n=s.apply(e,i);function o(e){asyncGeneratorStep(n,t,r,o,a,"next",e)}function a(e){asyncGeneratorStep(n,t,r,o,a,"throw",e)}o(void 0)})}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var SessionStorage=function(){function e(){_classCallCheck(this,e),_defineProperty(this,"_inMemoryStorage",{})}var t,r,n;return _createClass(e,[{key:"set",value:(n=_asyncToGenerator(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:window&&window.sessionStorage?window.sessionStorage.setItem(t,JSON.stringify(r)):wx&&wx.setStorageSync?wx.setStorageSync(t,r):my&&my.setStorageSync?my.setStorageSync(t,r):tt&&tt.setStorageSync?tt.setStorageSync(t,r):this._inMemoryStorage[t]=r;case 1:case"end":return e.stop()}},e,this)})),function(e,t){return n.apply(this,arguments)})},{key:"get",value:(r=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(window&&window.sessionStorage)return r=window.sessionStorage.getItem(t),e.abrupt("return",JSON.parse(r));e.next=5;break;case 5:if(wx&&wx.getStorageSync)return e.abrupt("return",wx.getStorageSync(t));e.next=9;break;case 9:if(my&&my.getStorageSync)return e.abrupt("return",my.getStorageSync(t));e.next=13;break;case 13:if(tt&&tt.getStorageSync)return e.abrupt("return",tt.getStorageSync(t));e.next=17;break;case 17:return e.abrupt("return",this._inMemoryStorage[t]);case 18:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"remove",value:(t=_asyncToGenerator(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:window&&window.sessionStorage?window.sessionStorage.removeItem(t):wx&&wx.removeStorageSync?wx.removeStorageSync(t):my&&my.removeStorageSync?my.removeStorageSync(t):tt&&tt.removeStorageSync?tt.removeStorageSync(t):delete this._inMemoryStorage[t];case 1:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})}]),e}();exports.default=SessionStorage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios-annotations",
3
- "version": "1.1.2",
3
+ "version": "1.1.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@github.com/sitorhy/axios-annotations.git"
@@ -1 +0,0 @@
1
- "use strict";function CachePlugin(){return function(e){var t=e.axios.defaults.adapter;e.axios.defaults.adapter=function(e){return t(e)}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=CachePlugin;