axios-annotations 1.3.1 → 1.3.3

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.
@@ -1,4 +1,4 @@
1
- import {AxiosPromise, CancelToken} from "axios";
1
+ import {CancelToken} from "axios";
2
2
 
3
3
  export class AbortControllerAdapter {
4
4
  constructor(CancelToken: CancelToken);
@@ -6,4 +6,4 @@ export class AbortControllerAdapter {
6
6
  abort(reason?: string): void;
7
7
  }
8
8
 
9
- export default function AbortSource(abortController: (AbortController | AbortControllerAdapter) | ((...args: any[]) => (AbortController | AbortControllerAdapter))): (() => AxiosPromise<any>);
9
+ export default function AbortSource(abortController: (AbortController | AbortControllerAdapter) | ((...args: any[]) => (AbortController | AbortControllerAdapter))): ((target: any) => any);
@@ -1,3 +1 @@
1
- import {AxiosPromise} from "axios";
2
-
3
- export default function DeleteMapping(path?: string): (() => AxiosPromise<any>);
1
+ export default function DeleteMapping(path?: string): ((target: any) => any);
@@ -1,3 +1 @@
1
- import {AxiosPromise} from "axios";
2
-
3
- export default function GetMapping(path?: string): (() => AxiosPromise<any>);
1
+ export default function GetMapping(path?: string): ((target: any) => any);
@@ -1,3 +1 @@
1
- import {AxiosPromise} from "axios";
2
-
3
- export default function IgnoreResidualParams(ignore?: boolean): (() => AxiosPromise<any>);
1
+ export default function IgnoreResidualParams(ignore?: boolean): ((target: any) => any);
@@ -1,3 +1 @@
1
- import {AxiosPromise} from "axios";
2
-
3
- export default function PatchMapping(path?: string): (() => AxiosPromise<any>);
1
+ export default function PatchMapping(path?: string): ((target: any) => any);
@@ -1,3 +1 @@
1
- import {AxiosPromise} from "axios";
2
-
3
- export default function PostMapping(path?: string): (() => AxiosPromise<any>);
1
+ export default function PostMapping(path?: string): ((target: any) => any);
@@ -1,3 +1,3 @@
1
1
  import {AxiosPromise} from "axios";
2
2
 
3
- export default function PutMapping(path?: string): (() => AxiosPromise<any>);
3
+ export default function PutMapping(path?: string): ((target: any) => any);
@@ -1,3 +1,3 @@
1
1
  import {AxiosPromise} from "axios";
2
2
 
3
- export default function RequestBody(name?: string): (() => AxiosPromise<any>);
3
+ export default function RequestBody(name?: string): ((target: any) => any);
@@ -1,7 +1,29 @@
1
- import {AxiosPromise, AxiosRequestConfig} from "axios";
2
- import Config from "../core/config";
3
- import Service from "../core/service";
1
+ import {AxiosInstance, AxiosRequestConfig} from "axios";
4
2
 
5
- export default function RequestConfig(config: Config): (() => Service);
3
+ declare class Config {
4
+ constructor(protocol?: string, host?: string, port?: number, prefix?: string, plugins?: ((config: Config) => void)[]);
6
5
 
7
- export default function RequestConfig(config: ((...args: any[]) => Partial<AxiosRequestConfig>) | Partial<AxiosRequestConfig>): (() => AxiosPromise<any>);
6
+ static forName(name: string): Config;
7
+
8
+ host: string;
9
+
10
+ port: number | null | string;
11
+
12
+ protocol: string;
13
+
14
+ prefix: string;
15
+
16
+ origin: string;
17
+
18
+ baseURL: string;
19
+
20
+ axios: AxiosInstance;
21
+
22
+ plugins: ((config: Config) => void)[];
23
+
24
+ register(name: string): Config;
25
+
26
+ unregister(): Config;
27
+ }
28
+
29
+ export default function RequestConfig(config: Config | ((...args: any[]) => Partial<AxiosRequestConfig>) | Partial<AxiosRequestConfig>): ((target: any) => any);
@@ -1,5 +1 @@
1
- import {AxiosPromise} from "axios";
2
-
3
- export default function RequestHeader(header: string, value: string): (() => AxiosPromise<any>);
4
-
5
- export default function RequestHeader(header: string, value: ((...args: any[]) => string)): (() => AxiosPromise<any>);
1
+ export default function RequestHeader(header: string, value: string | ((...args: any[]) => string)): ((target: any) => any);
@@ -1,6 +1 @@
1
- import {AxiosPromise} from "axios";
2
- import Service from "../core/service";
3
-
4
- export default function RequestMapping(path: string, method: string): (() => AxiosPromise<any>);
5
-
6
- export default function RequestMapping(path: string): (() => Service);
1
+ export default function RequestMapping(path: string, method?: string): ((target: any) => any);
@@ -1,3 +1 @@
1
- import {AxiosPromise} from "axios";
2
-
3
- export default function RequestParam(name: string, required?: boolean): (() => AxiosPromise<any>);
1
+ export default function RequestParam(name: string, required?: boolean): ((target: any) => any);
@@ -1,3 +1 @@
1
- import {AxiosPromise} from "axios";
2
-
3
- export default function RequestWith(registration: string): (() => AxiosPromise<any>);
1
+ export default function RequestWith(registration: string): ((target: any) => any);
@@ -1 +1 @@
1
- "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}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 o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}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=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.AbortControllerAdapter=void 0,exports.default=_default;var AbortControllerAdapter=function(){function t(e){_classCallCheck(this,t),_defineProperty(this,"_source",null),this._source=e.source()}return _createClass(t,[{key:"signal",get:function(){return{reason:this._source.token&&this._source.token.reason&&this._source.token.reason.message||"",aborted:!(!this._source.token||!this._source.token.reason)&&"ERR_CANCELED"===this._source.token.reason.code}}},{key:"source",get:function(){return this._source}},{key:"abort",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";e?this._source.cancel(e):this._source.cancel()}}]),t}();function _default(u){return function(e,n,t){var i;t&&(i=t.value,t.value=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=u;return"function"==typeof u&&(o=u.apply(void 0,t)),this.abort(n,o),i.apply(this,arguments)})}}exports.AbortControllerAdapter=AbortControllerAdapter;
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}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 o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}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=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.AbortControllerAdapter=void 0,exports.default=_default;var AbortControllerAdapter=function(){function r(e){var t=this;_classCallCheck(this,r),_defineProperty(this,"_source",null),_defineProperty(this,"_signal",{onabort:void 0,reason:"",aborted:!1}),this._source=e.source(),this._source.token.promise.then(function(){var e;"function"==typeof t._signal.onabort&&t._signal.onabort(new Event("abort")),t._signal.aborted=!0,t._signal.reason=null==(e=t._source.token.reason)?void 0:e.message})}return _createClass(r,[{key:"signal",get:function(){return this._signal}},{key:"source",get:function(){return this._source}},{key:"abort",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";e?this._source.cancel(e):this._source.cancel()}}]),r}();function _default(a){return function(e,n,t){var i;t&&(i=t.value,t.value=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=a;return"function"==typeof a&&(o=a.apply(void 0,t)),this.abort(n,o),i.apply(this,arguments)})}}exports.AbortControllerAdapter=AbortControllerAdapter;
@@ -1 +1 @@
1
- "use strict";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 _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,c=t.hasOwnProperty,s=Object.defineProperty||function(t,e,r){t[e]=r.value},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 h?e:h,e=Object.create(e.prototype),n=new b(n||[]);return s(e,"_invoke",{value:(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 P()}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(void 0===o)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;n=f(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,l;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,l):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,l)}(r,a);if(r){if(r===l)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=f(o,i,a);if("normal"===r.type){if(u=a.done?"completed":"suspendedYield",r.arg===l)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(u="completed",a.method="throw",a.arg=r.arg)}})}),e}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var l={};function h(){}function p(){}function y(){}var e={},v=(i(e,n,function(){return this}),Object.getPrototypeOf),v=v&&v(v(x([]))),d=(v&&v!==t&&c.call(v,n)&&(e=v),y.prototype=h.prototype=Object.create(e));function m(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function g(a,u){var e;s(this,"_invoke",{value:function(r,n){function t(){return new u(function(t,e){!function e(t,r,n,o){var i,t=f(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 _(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 b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function x(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:P}}function P(){return{value:void 0,done:!0}}return s(d,"constructor",{value:p.prototype=y,configurable:!0}),s(y,"constructor",{value:p,configurable:!0}),p.displayName=i(y,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===p||"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(d),t},a.awrap=function(t){return{__await:t}},m(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()})},m(d),i(d,o,"Generator"),i(d,n,function(){return this}),i(d,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);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=x,b.prototype={constructor:b,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,l):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),l},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),l}},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:x(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},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,_toPropertyKey(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=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}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){if(0<n)return t.next=6,sleep(random(3e3,5e3));t.next=6}else t.next=25;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(t){return t&&t.__esModule?t:{default:t}}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,c=t.hasOwnProperty,s=Object.defineProperty||function(t,e,r){t[e]=r.value},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 h?e:h,e=Object.create(e.prototype),n=new b(n||[]);return s(e,"_invoke",{value:(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 P()}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(void 0===o)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;n=f(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,l;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,l):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,l)}(r,a);if(r){if(r===l)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=f(o,i,a);if("normal"===r.type){if(u=a.done?"completed":"suspendedYield",r.arg===l)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(u="completed",a.method="throw",a.arg=r.arg)}})}),e}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var l={};function h(){}function p(){}function y(){}var e={},v=(i(e,n,function(){return this}),Object.getPrototypeOf),v=v&&v(v(x([]))),d=(v&&v!==t&&c.call(v,n)&&(e=v),y.prototype=h.prototype=Object.create(e));function m(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function g(a,u){var e;s(this,"_invoke",{value:function(r,n){function t(){return new u(function(t,e){!function e(t,r,n,o){var i,t=f(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 _(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 b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function x(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:P}}function P(){return{value:void 0,done:!0}}return s(d,"constructor",{value:p.prototype=y,configurable:!0}),s(y,"constructor",{value:p,configurable:!0}),p.displayName=i(y,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===p||"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(d),t},a.awrap=function(t){return{__await:t}},m(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()})},m(d),i(d,o,"Generator"),i(d,n,function(){return this}),i(d,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);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=x,b.prototype={constructor:b,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,l):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),l},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),l}},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:x(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},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,_toPropertyKey(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=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}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){if(0<n)return t.next=6,sleep(random(3e3,5e3));t.next=6}else t.next=25;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)return t.abrupt("break",25);t.next=22;break;case 22:++n,t.next=2;break;case 25:throw e;case 26: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;
@@ -0,0 +1 @@
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios-annotations",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@github.com/sitorhy/axios-annotations.git"
@@ -0,0 +1 @@
1
+ module.exports = require("../../lib/plugins/cache/index");