axios-annotations 1.3.2 → 1.3.4
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/lib/core/common.js +1 -1
- package/lib/core/config.js +1 -1
- package/lib/core/parser.js +1 -1
- package/lib/core/service.js +1 -1
- package/lib/decorator/abort-source.js +1 -1
- package/lib/decorator/delete-mapping.js +1 -1
- package/lib/decorator/get-mapping.js +1 -1
- package/lib/decorator/ignore-residual-params.js +1 -1
- package/lib/decorator/patch-mapping.js +1 -1
- package/lib/decorator/post-mapping.js +1 -1
- package/lib/decorator/put-mapping.js +1 -1
- package/lib/decorator/request-body.js +1 -1
- package/lib/decorator/request-config.js +1 -1
- package/lib/decorator/request-header.js +1 -1
- package/lib/decorator/request-mapping.js +1 -1
- package/lib/decorator/request-param.js +1 -1
- package/lib/decorator/request-with.js +1 -1
- package/lib/plugins/auth/authorizer.js +1 -1
- package/lib/plugins/auth/history.js +1 -1
- package/lib/plugins/auth/index.js +1 -1
- package/lib/plugins/auth/queue.js +1 -1
- package/lib/plugins/auth/storage.js +1 -1
- package/lib/plugins/cache/index.js +1 -1
- package/package.json +1 -1
package/lib/core/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
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;
|
package/lib/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.config=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 _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,_toPropertyKey(i.key),i)}}function _createClass(t,e,o){return e&&_defineProperties(t.prototype,e),o&&_defineProperties(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}var _global_configs=[],Config=exports.default=_createClass(function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:null;_classCallCheck(this,t),_defineProperty(this,"_host","localhost"),_defineProperty(this,"_port",8080),_defineProperty(this,"_protocol","http"),_defineProperty(this,"_prefix",""),_defineProperty(this,"_axios",_axios.default.create()),_defineProperty(this,"_plugins",[]),this.init(e,o,i,n,r)},[{key:"init",value:function(t,e,o,i,n){this.port=o,t&&(this.protocol=t),e&&(this.host=e),i&&(this.prefix=i),Array.isArray(n)&&(this.plugins=n)}},{key:"host",get:function(){return this._host},set:function(t){this._host=t}},{key:"port",get:function(){return this._port},set:function(t){this._port=t}},{key:"protocol",get:function(){return this._protocol},set:function(t){this._protocol=t}},{key:"prefix",get:function(){return this._prefix},set:function(t){this._prefix=t}},{key:"origin",get:function(){return"".concat(this.protocol,"://").concat(this.host).concat(this.port?":"+this.port:"")}},{key:"baseURL",get:function(){return"".concat(this.origin).concat(this.prefix)}},{key:"axios",get:function(){return this._axios},set:function(t){this._axios=t}},{key:"plugins",get:function(){return this._plugins},set:function(t){this._plugins=t}},{key:"register",value:function(t){var e=this,o=_global_configs.find(function(t){return t.config===e});return o?o.name=t:_global_configs.push({name:t,config:this}),this}},{key:"unregister",value:function(){var e=this,t=_global_configs.findIndex(function(t){return t.config===e});return 0<=t&&_global_configs.splice(t,1),this}}],[{key:"forName",value:function(e){var t=_global_configs.find(function(t){return t.name===e});return t?t.config:null}}]),config=exports.config=new Config;
|
package/lib/core/parser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _common=require("./common");function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,e){var n;if(r)return"string"==typeof r?_arrayLikeToArray(r,e):"Map"===(n="Object"===(n={}.toString.call(r).slice(8,-1))&&r.constructor?r.constructor.name:n)||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(r,e):void 0}function _arrayLikeToArray(r,e){(null==e||e>r.length)&&(e=r.length);for(var n=0,t=Array(e);n<e;n++)t[n]=r[n];return t}function _iterableToArrayLimit(r,e){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var t,a,o,i,u=[],c=!0,l=!1;try{if(o=(n=n.call(r)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(t=o.call(n)).done)&&(u.push(t.value),u.length!==e);c=!0);}catch(r){l=!0,a=r}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw a}}return u}}function _arrayWithHoles(r){if(Array.isArray(r))return r}var URLSearchParamsParser={encode:function(r){return"undefined"==typeof URLSearchParams?Object.entries(r).reduce(function(e,r){var r=_slicedToArray(r,2),n=r[0],r=r[1],r=void 0===r?void 0:r;return Array.isArray(r)?r.forEach(function(r){e.push("".concat(n,"=").concat(encodeURIComponent(null===r?"null":void 0===r?"":r)))}):e.push("".concat(n,"=").concat(encodeURIComponent(null===r?"null":void 0===r?"":r))),e},[]).join("&"):r.toString()},decode:function(r){return"undefined"==typeof URLSearchParams?Object.assign({},r):new URLSearchParams(r)},has:function(r,e){return"undefined"==typeof URLSearchParams?e in r:r.has(e)},delete:function(r,e){"undefined"==typeof URLSearchParams?r&&delete r[e]:r.delete(e)},get:function(r,e){return"undefined"==typeof URLSearchParams?r?r[e]:void 0:r.get(e)},append:function(r,e,n){var t;"undefined"==typeof URLSearchParams?r&&(t=r[e],(0,_common.isNullOrEmpty)(t)?r[e]=n:r[e]=[].concat(t).concat(n)):r.append(e,n)}},_default=exports.default=URLSearchParamsParser;
|
package/lib/core/service.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ConfigMapping=void 0;var _common=require("./common"),_parser=_interopRequireDefault(require("./parser")),_config=_interopRequireWildcard(require("./config"));function _getRequireWildcardCache(e){var t,r;return"function"!=typeof WeakMap?null:(t=new WeakMap,r=new WeakMap,(_getRequireWildcardCache=function(e){return e?r:t})(e))}function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=_typeof(e)&&"function"!=typeof e)return{default:e};t=_getRequireWildcardCache(t);if(t&&t.has(e))return t.get(e);var r,n,i={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((n=o?Object.getOwnPropertyDescriptor(e,r):null)&&(n.get||n.set)?Object.defineProperty(i,r,n):i[r]=e[r]);return i.default=e,t&&t.set(e,i),i}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}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 _createForOfIteratorHelper(e,t){var r,n,i,o,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return i=!(n=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return n=e.done,e},e:function(e){i=!0,r=e},f:function(){try{n||null==a.return||a.return()}finally{if(i)throw r}}};if(Array.isArray(e)||(a=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),o=0,{s:t=function(){},n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}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,_toPropertyKey(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=_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:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!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.")}var ConfigMapping=exports.ConfigMapping={requestHeaders:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],r={};if(e)for(var n in e){var i=e[n];r[n]="function"==typeof i?i.apply(void 0,t):i}return r},axiosConfig:function(e,t){var r={};return(e||[]).forEach(function(e){"function"==typeof e?Object.assign(r,e.apply(void 0,t)):Object.assign(r,e)}),r},querystring:function(e,t,r){if(!r)return"";var n;if(t){var i,o,a=_parser.default.decode(r);for(i in r){var s=r[i],f=t[i];f?f.body?_parser.default.delete(a,i):f.required?(0,_common.isNullOrEmpty)(s)&&!_parser.default.has(a,i)&&_parser.default.append(a,i,""):(0,_common.isNullOrEmpty)(s)&&_parser.default.has(a,i)&&_parser.default.delete(a,i):e&&!0===e.ignoreResidualParams&&_parser.default.delete(a,i)}for(o in t){var u=t[o];u&&!u.body&&u.required&&!_parser.default.has(a,o)&&_parser.default.append(a,o,"")}return _parser.default.encode(a)}return e&&!0===e.ignoreResidualParams?"":(n=_parser.default.decode(r),_parser.default.encode(n))},body:function(e,t){if(e)for(var r in e)if(!0===e[r].body)return(0,_common.isNullOrEmpty)(t)?void 0:t[r];return null}},Service=exports.default=_createClass(function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;if(_classCallCheck(this,e),_defineProperty(this,"_path",""),_defineProperty(this,"_config",_config.config),_defineProperty(this,"_headers",{}),_defineProperty(this,"_params",{}),_defineProperty(this,"_configs",{}),_defineProperty(this,"_for",{}),_defineProperty(this,"_features",{}),!this._path&&t&&(this._path=t),"function"==typeof Object.getPrototypeOf?(Object.getPrototypeOf(this)._path&&(this._path=Object.getPrototypeOf(this)._path),Object.getPrototypeOf(this)._config&&(this._config=Object.getPrototypeOf(this)._config)):(this.__proto__._path&&(this._path=this.__proto__._path),this.__proto__._config&&(this._config=this.__proto__._config)),this.config&&this.config.plugins&&this.config.plugins.length){var r,n=_createForOfIteratorHelper(this.config.plugins);try{for(n.s();!(r=n.n()).done;)(0,r.value)(this.config)}catch(e){n.e(e)}finally{n.f()}}},[{key:"config",get:function(){return this._config},set:function(e){this._config=e}},{key:"path",get:function(){return this._path},set:function(e){this._path=e}},{key:"params",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{required:!1};if(!this._params||!this._params[e]||!Object.hasOwnProperty.call(this._params[e],t)){var r=Object.assign({required:!1,body:!1},r),n=this._params||{},i=this._params&&this._params[e]||{},o=i[t]||{};if(!0===r.body)for(var a in i)i[a].body=!1;this._params=Object.assign(n,_defineProperty({},e,Object.assign(i,_defineProperty({},t,Object.assign(o,r)))))}}},{key:"headers",value:function(e,t,r){var n=this._headers||{};Object.assign(n,_defineProperty({},e,Object.assign(n[e]||{},_defineProperty({},t,r))))}},{key:"for",value:function(e,t){if(1===arguments.length)return this._for[e];Object.assign(this._for,_defineProperty({},e,t))}},{key:"abort",value:function(e,t){t=Object.assign(this.features(e)||{},{abortController:t});this.features(e,t)}},{key:"features",value:function(e,t){if(1===arguments.length)return this._features[e];Object.assign(this._features,_defineProperty({},e,t))}},{key:"configs",value:function(e,t){var r=this._configs||{};Object.assign(r,_defineProperty({},e,(r[e]||[]).concat(t)))}},{key:"pathVariable",value:function(e,t){var r=e||"",e=r.match(/{\w+}/g);return Array.isArray(e)&&e.forEach(function(e){e=e.substring(1,e.length-1);r=r.replaceAll("{".concat(e,"}"),t[e])}),r}},{key:"createRequestConfig",value:function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:[],i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:[],o=ConfigMapping.querystring(this._features[e],this._params[e],r),r=ConfigMapping.body(this._params[e],r),n=ConfigMapping.requestHeaders(this._headers[e],n),a=ConfigMapping.axiosConfig(this._configs[e],i),t="".concat(t).concat(o?(0<=t.lastIndexOf("?")?"&":"?")+o:"");return this._features&&this._features[e]&&this._features[e].abortController&&(i="function"==typeof(e=this._features[e].abortController)?e.apply(void 0,i):e)&&(i.source?a.cancelToken=i.source.token:a.signal=i.signal),Object.assign(a,{headers:Object.assign(n,a.headers||null)}),{path:t,body:r,config:a,query:o}}},{key:"request",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},t=0<=t.indexOf("http")?t:this.config.baseURL+(0,_common.normalizePath)("/".concat(this.path||"","/").concat(t));return this.config.axios.request(Object.assign({method:e,url:t,data:r},n))}},{key:"requestWith",value:function(a){var s=this,f=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",u={},c=[],l={},p={},d=this.config,n={with:function(e){e=_config.default.forName(e);return e&&(d=e),n},param:function(e){return Object.assign(u,_defineProperty({},e,Object.assign(u[e]||{},{required:1<arguments.length&&void 0!==arguments[1]&&arguments[1],body:!1}))),n},abort:function(e){return Object.assign(p,{abortController:e}),n},ignoreResidualParams:function(){return Object.assign(p,{ignoreResidualParams:!0===(!(0<arguments.length&&void 0!==arguments[0])||arguments[0])}),n},header:function(e,t){return Object.assign(l,_defineProperty({},e,t)),n},body:function(e){var t,r=u[e]||{};for(t in u)u[t].body=!1;return Object.assign(u,_defineProperty({},e,Object.assign(r,{required:!1,body:!0}))),n},config:function(e){return c.push(e),n},send:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=ConfigMapping.querystring(p,u,e),r=ConfigMapping.body(u,e),n=ConfigMapping.requestHeaders(l,[e]),i=ConfigMapping.axiosConfig(c,[e]),o=p.abortController;return Object.assign(i,{headers:Object.assign(n,i.headers||null)}),o&&(n="function"==typeof o?o.apply(void 0,[e]):o)&&(n.source?i.cancelToken=n.source.token:i.signal=n.signal),d?(0,_common.forward)(d.axios,d.origin,d.prefix,s.path,f,a,t,r,i):(o="".concat(s.pathVariable(f||"",e)).concat(t?(0<=f.lastIndexOf("?")?"&":"?")+t:""),s.request(a,o,r,i))}};return n}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
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:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!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=exports.AbortControllerAdapter=_createClass(function e(t){var r=this;_classCallCheck(this,e),_defineProperty(this,"_source",null),_defineProperty(this,"_signal",{onabort:void 0,reason:"",aborted:!1}),this._source=t.source(),this._source.token.promise.then(function(){var e;"function"==typeof r._signal.onabort&&r._signal.onabort(new Event("abort")),r._signal.aborted=!0,r._signal.reason=null==(e=r._source.token.reason)?void 0:e.message})},[{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()}}]);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)})}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=DeleteMapping;var _requestMapping=_interopRequireDefault(require("./request-mapping"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function DeleteMapping(){return(0,_requestMapping.default)(0<arguments.length&&void 0!==arguments[0]?arguments[0]:"","DELETE")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=GetMapping;var _requestMapping=_interopRequireDefault(require("./request-mapping"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function GetMapping(){return(0,_requestMapping.default)(0<arguments.length&&void 0!==arguments[0]?arguments[0]:"","GET")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function IgnoreResidualParams(){var s=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];return function(e,a,r){var t;r&&(t=r.value,r.value=function(){var e=Object.assign(this.features(a)||{},{ignoreResidualParams:!0===s});return this.features(a,e),t.apply(this,arguments)})}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=IgnoreResidualParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=PatchMapping;var _requestMapping=_interopRequireDefault(require("./request-mapping"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function PatchMapping(){return(0,_requestMapping.default)(0<arguments.length&&void 0!==arguments[0]?arguments[0]:"","PATCH")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=PostMapping;var _requestMapping=_interopRequireDefault(require("./request-mapping"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function PostMapping(){return(0,_requestMapping.default)(0<arguments.length&&void 0!==arguments[0]?arguments[0]:"","POST")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=PutMapping;var _requestMapping=_interopRequireDefault(require("./request-mapping"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function PutMapping(){return(0,_requestMapping.default)(0<arguments.length&&void 0!==arguments[0]?arguments[0]:"","PUT")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function RequestBody(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"body";return function(e,t,r){var u,o;r&&(u=r.value,o={required:!1,body:!0},r.value=function(){return this.params(t,n,o),u.apply(this,arguments)})}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=RequestBody;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function RequestConfig(u){return function(e,t,n){var o;n?(o=n.value,n.value=function(){return this.configs(t,u),o.apply(this,arguments)}):e.prototype._config=u}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=RequestConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function RequestHeader(a,n){return function(e,t,r){var u;r&&(u=r.value,r.value=function(){return this.headers(t,a,n),u.apply(this,arguments)})}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=RequestHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=RequestMapping;var _config=_interopRequireDefault(require("../core/config")),_common=require("../core/common");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function RequestMapping(s){var l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return function(e,h,r){var p;r?(l=l||"GET",p=r.value,r.value=function(){for(var a=this,e=arguments.length,u=new Array(e),r=0;r<e;r++)u[r]=arguments[r];var t=p.apply(this,u)||{};if("function"!=typeof this.for)throw new Error('Make sure your service inherited "core/Service".');var o,i,n,f=this.for(h),c=f?_config.default.forName(f):null;return t&&t.then&&"function"==typeof t.then?new Promise(function(i,n){t.then(function(e){var e=a.createRequestConfig(h,a.pathVariable(s||"",e),e,u,u),r=e.path,t=e.body,o=e.config;(c?(0,_common.forward)(c.axios,c.origin,c.prefix,a.path,s,l,e.query,t,o):a.request(l,r,t,o)).then(i).catch(n)})}):(o=(f=this.createRequestConfig(h,this.pathVariable(s||"",t),t,u,u)).path,i=f.body,n=f.config,c?(0,_common.forward)(c.axios,c.origin,c.prefix,this.path,s,l,f.query,i,n):this.request(l,o,i,n))}):e.prototype._path=s}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function RequestParam(n){var i=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return function(e,r,t){var a,u;t&&(a=t.value,u=Object.assign({required:!1,body:!1},{required:!0===i}),t.value=function(){return this.params(r,n,u),a.apply(this,arguments)})}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=RequestParam;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function RequestWith(n){return function(e,t,u){var r;u&&(r=u.value,u.value=function(){return this.for(t,n),r.apply(this,arguments)})}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=RequestWith;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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 _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,c=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 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 b(n||[]);return c(e,"_invoke",{value:(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 k()}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"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";r=f(o,i,a);if("normal"===r.type){if(s=a.done?"completed":"suspendedYield",r.arg===l)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="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=s;var l={};function h(){}function y(){}function p(){}var e={},v=(i(e,n,function(){return this}),Object.getPrototypeOf),v=v&&v(v(x([]))),d=(v&&v!==t&&u.call(v,n)&&(e=v),p.prototype=h.prototype=Object.create(e));function g(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function m(a,s){var e;c(this,"_invoke",{value:function(r,n){function t(){return new s(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)&&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 _(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(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:k}}function k(){return{value:void 0,done:!0}}return c(d,"constructor",{value:y.prototype=p,configurable:!0}),c(p,"constructor",{value:y,configurable:!0}),y.displayName=i(p,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===y||"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}},g(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(s(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},g(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)&&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,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 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,_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.")}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
|
+
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 _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 u,a={},t=Object.prototype,c=t.hasOwnProperty,f=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(u){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 g?e:g,e=Object.create(e.prototype),n=new P(n||[]);return f(e,"_invoke",{value:(o=t,i=r,a=n,s=h,function(t,e){if(s===p)throw Error("Generator is already running");if(s===v){if("throw"===t)throw e;return{value:u,done:!0}}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(o===u)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=u,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;n=l(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,d;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}(r,a);if(r){if(r===d)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(s===h)throw s=v,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s=p;r=l(o,i,a);if("normal"===r.type){if(s=a.done?v:y,r.arg===d)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s=v,a.method="throw",a.arg=r.arg)}})}),e}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h="suspendedStart",y="suspendedYield",p="executing",v="completed",d={};function g(){}function m(){}function _(){}var e={},w=(i(e,n,function(){return this}),Object.getPrototypeOf),w=w&&w(w(E([]))),b=(w&&w!==t&&c.call(w,n)&&(e=w),_.prototype=g.prototype=Object.create(e));function k(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function x(a,s){var e;f(this,"_invoke",{value:function(r,n){function t(){return new s(function(t,e){!function e(t,r,n,o){var i,t=l(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&c.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 S(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 L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function E(e){if(e||""===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=u,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return f(b,"constructor",{value:m.prototype=_,configurable:!0}),f(_,"constructor",{value:m,configurable:!0}),m.displayName=i(_,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,i(t,o,"GeneratorFunction")),t.prototype=Object.create(b),t},a.awrap=function(t){return{__await:t}},k(x.prototype),i(x.prototype,r,function(){return this}),a.AsyncIterator=x,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new x(s(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},k(b),i(b,o,"Generator"),i(b,n,function(){return this}),i(b,"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=E,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&c.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},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=u),!!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"),s=c.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 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,d):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),d},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),L(r),d}},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,L(o)),n}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),d}},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,_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:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!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.")}var Authorizer=exports.default=(()=>{return _createClass(function t(){_classCallCheck(this,t),_defineProperty(this,"_sessionKey","$_SESSION"),_defineProperty(this,"_sessionStorage",new _storage.default),_defineProperty(this,"_sessionHistory",new _history.default)},[{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:(o=_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 o.apply(this,arguments)})},{key:"storageSession",value:(n=_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 n.apply(this,arguments)})},{key:"refreshSession",value:(r=_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 r.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:(e=_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 e.apply(this,arguments)})},{key:"onSessionInvalidated",value:function(){}},{key:"invalidateSession",value:(t=_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 t.apply(this,arguments)})}]);var t,e,r,n,o})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _common=require("../../core/common");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:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!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.")}var SessionHistory=exports.default=_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"_history",new Array(10)),_defineProperty(this,"_position",0),_defineProperty(this,"_size",0)},[{key:"size",get:function(){return this._size}},{key:"add",value:function(t){var e;Object.keys(t).every(function(e){return(0,_common.isNullOrEmpty)(t[e])})||(e=t.access_token,this._history[this._position]=Object.assign({},t,{access_token:e||t.accessToken||t.token,refresh_token:t.refresh_token||t.refreshToken,invalid:!1}),this._position++,this._position%=this._history.length,this._size=this._history.reduce(function(e,t){return t?e+1:e},0))}},{key:"check",value:function(t){return this._history.some(function(e){return!!e&&(e.access_token||e.accessToken||e.token)===t})}},{key:"deprecate",value:function(e){var r=0,o=e.refresh_token,i=e.refreshToken,e=this._history.find(function(e,t){return r=t,!!e&&(e.refresh_token||e.refreshToken)===(o||i)});e&&(e.invalid=!0,e=this._history[0],this._history[0]=this._history[r],this._history[r]=e)}},{key:"clean",value:function(){for(var e=0;e<this._history.length;++e){var t=this._history[e];t&&t.invalid&&(this._history[e]=null)}this._size=this._history.reduce(function(e,t){return t?e+1:e},0)}},{key:"isDeprecated",value:function(o){return this._history.some(function(e){if(e){var t=o.refresh_token,r=o.refreshToken;if(t||r)return(e.refresh_token||e.refreshToken)===(t||r)&&e.invalid}return!1})}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
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 u,a={},t=Object.prototype,s=t.hasOwnProperty,f=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(u){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 g?e:g,e=Object.create(e.prototype),n=new S(n||[]);return f(e,"_invoke",{value:(o=t,i=r,a=n,c=l,function(t,e){if(c===y)throw Error("Generator is already running");if(c===v){if("throw"===t)throw e;return{value:u,done:!0}}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(o===u)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=u,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;n=h(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,d;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}(r,a);if(r){if(r===d)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===l)throw c=v,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=y;r=h(o,i,a);if("normal"===r.type){if(c=a.done?v:p,r.arg===d)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=v,a.method="throw",a.arg=r.arg)}})}),e}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var l="suspendedStart",p="suspendedYield",y="executing",v="completed",d={};function g(){}function m(){}function w(){}var e={},x=(i(e,n,function(){return this}),Object.getPrototypeOf),x=x&&x(x(O([]))),b=(x&&x!==t&&s.call(x,n)&&(e=x),w.prototype=g.prototype=Object.create(e));function _(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function L(a,c){var e;f(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=h(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&s.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 E(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function O(e){if(e||""===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(s.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return f(b,"constructor",{value:m.prototype=w,configurable:!0}),f(w,"constructor",{value:m,configurable:!0}),m.displayName=i(w,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,i(t,o,"GeneratorFunction")),t.prototype=Object.create(b),t},a.awrap=function(t){return{__await:t}},_(L.prototype),i(L.prototype,r,function(){return this}),a.AsyncIterator=L,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new L(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(b),i(b,o,"Generator"),i(b,n,function(){return this}),i(b,"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=O,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},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=u),!!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=s.call(o,"catchLoc"),c=s.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 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&&s.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,d):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),d},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),k(r),d}},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,k(o)),n}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),d}},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 +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
|
+
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 c,a={},t=Object.prototype,s=t.hasOwnProperty,f=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(c){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 m?e:m,e=Object.create(e.prototype),n=new j(n||[]);return f(e,"_invoke",{value:(o=t,i=r,a=n,u=h,function(t,e){if(u===y)throw Error("Generator is already running");if(u===v){if("throw"===t)throw e;return{value:c,done:!0}}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(o===c)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=c,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;n=l(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,d;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=c),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}(r,a);if(r){if(r===d)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(u===h)throw u=v,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);u=y;r=l(o,i,a);if("normal"===r.type){if(u=a.done?v:p,r.arg===d)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(u=v,a.method="throw",a.arg=r.arg)}})}),e}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var h="suspendedStart",p="suspendedYield",y="executing",v="completed",d={};function m(){}function g(){}function _(){}var e={},w=(i(e,n,function(){return this}),Object.getPrototypeOf),w=w&&w(w(k([]))),b=(w&&w!==t&&s.call(w,n)&&(e=w),_.prototype=m.prototype=Object.create(e));function x(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function P(a,u){var e;f(this,"_invoke",{value:function(r,n){function t(){return new u(function(t,e){!function e(t,r,n,o){var i,t=l(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&s.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 L(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 E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function k(e){if(e||""===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(s.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=c,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return f(b,"constructor",{value:g.prototype=_,configurable:!0}),f(_,"constructor",{value:g,configurable:!0}),g.displayName=i(_,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,i(t,o,"GeneratorFunction")),t.prototype=Object.create(b),t},a.awrap=function(t){return{__await:t}},x(P.prototype),i(P.prototype,r,function(){return this}),a.AsyncIterator=P,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new P(u(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},x(b),i(b,o,"Generator"),i(b,n,function(){return this}),i(b,"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=k,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},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=c),!!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=s.call(o,"catchLoc"),u=s.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 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&&s.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,d):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),d},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),E(r),d}},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,E(o)),n}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=c),d}},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:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!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=exports.default=(()=>{return _createClass(function t(e){_classCallCheck(this,t),_defineProperty(this,"_queue",[]),_defineProperty(this,"_authorizer",null),_defineProperty(this,"_axios",_axios.default.create()),this._authorizer=e},[{key:"resend",value:(e=_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:throw e;case 26:case"end":return t.stop()}},t,this,[[11,18]])})),function(t){return e.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}}]);var e})();
|
|
@@ -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,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 c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof y?e:y,e=Object.create(e.prototype),n=new b(n||[]);return s(e,"_invoke",{value:(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=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"===c)throw c="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c="executing";r=f(o,i,a);if("normal"===r.type){if(c=a.done?"completed":"suspendedYield",r.arg===l)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c="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=c;var l={};function y(){}function h(){}function p(){}var e={},g=(i(e,n,function(){return this}),Object.getPrototypeOf),g=g&&g(g(_([]))),v=(g&&g!==t&&u.call(g,n)&&(e=g),p.prototype=y.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;s(this,"_invoke",{value:function(r,n){function t(){return new c(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)&&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 w(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 S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function _(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 s(v,"constructor",{value:h.prototype=p,configurable:!0}),s(p,"constructor",{value:h,configurable:!0}),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(v),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(v),i(v,o,"Generator"),i(v,n,function(){return this}),i(v,"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=_,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(S),!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,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),S(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,S(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(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 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,_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.")}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
|
+
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 u,a={},t=Object.prototype,s=t.hasOwnProperty,f=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(u){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 v?e:v,e=Object.create(e.prototype),n=new P(n||[]);return f(e,"_invoke",{value:(o=t,i=r,a=n,c=y,function(t,e){if(c===p)throw Error("Generator is already running");if(c===g){if("throw"===t)throw e;return{value:u,done:!0}}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(o===u)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=u,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;n=l(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,m;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,m):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}(r,a);if(r){if(r===m)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===y)throw c=g,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=p;r=l(o,i,a);if("normal"===r.type){if(c=a.done?g:h,r.arg===m)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=g,a.method="throw",a.arg=r.arg)}})}),e}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var y="suspendedStart",h="suspendedYield",p="executing",g="completed",m={};function v(){}function d(){}function w(){}var e={},S=(i(e,n,function(){return this}),Object.getPrototypeOf),S=S&&S(S(k([]))),b=(S&&S!==t&&s.call(S,n)&&(e=S),w.prototype=v.prototype=Object.create(e));function _(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function x(a,c){var e;f(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=l(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&s.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 L(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 E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function k(e){if(e||""===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(s.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return f(b,"constructor",{value:d.prototype=w,configurable:!0}),f(w,"constructor",{value:d,configurable:!0}),d.displayName=i(w,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,i(t,o,"GeneratorFunction")),t.prototype=Object.create(b),t},a.awrap=function(t){return{__await:t}},_(x.prototype),i(x.prototype,r,function(){return this}),a.AsyncIterator=x,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new x(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(b),i(b,o,"Generator"),i(b,n,function(){return this}),i(b,"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=k,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},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=u),!!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=s.call(o,"catchLoc"),c=s.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 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&&s.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,m):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),m},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),E(r),m}},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,E(o)),n}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),m}},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,_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:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!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.")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var SessionStorage=exports.default=(()=>{return _createClass(function t(){_classCallCheck(this,t),_defineProperty(this,"_inMemoryStorage",{})},[{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)})}]);var e,r,n})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
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;
|