@gudhub/core 1.1.49 → 1.1.50
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/package.json
CHANGED
package/umd/library.min.js
CHANGED
|
@@ -98,7 +98,7 @@ var t="function"==typeof Map&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t
|
|
|
98
98
|
},{"./utils":"Qri1"}],"hIRQ":[function(require,module,exports) {
|
|
99
99
|
"use strict";var r=require("./stringify"),e=require("./parse"),s=require("./formats");module.exports={formats:s,parse:e,stringify:r};
|
|
100
100
|
},{"./stringify":"mwZo","./parse":"snX5","./formats":"XaX2"}],"hDvy":[function(require,module,exports) {
|
|
101
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GudHubHttpsService=void 0;var t=n(require("axios")),e=require("./utils.js"),r=n(require("qs"));function n(t){return t&&t.__esModule?t:{default:t}}function o(t){return(o="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 i(){i=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(_){f=function(t,e,r){return t[e]=r}}function l(t,e,r,o){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),u=new S(o||[]);return n(a,"_invoke",{value:E(t,r,u)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(_){return{type:"throw",arg:_}}}t.wrap=l;var p={};function v(){}function y(){}function d(){}var m={};f(m,u,function(){return this});var g=Object.getPrototypeOf,w=g&&g(g(T([])));w&&w!==e&&r.call(w,u)&&(m=w);var b=d.prototype=v.prototype=Object.create(m);function x(t){["next","throw","return"].forEach(function(e){f(t,e,function(t){return this._invoke(e,t)})})}function P(t,e){var i;n(this,"_invoke",{value:function(n,a){function u(){return new e(function(i,u){!function n(i,a,u,s){var c=h(t[i],t,a);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==o(l)&&r.call(l,"__await")?e.resolve(l.__await).then(function(t){n("next",t,u,s)},function(t){n("throw",t,u,s)}):e.resolve(l).then(function(t){f.value=t,u(f)},function(t){return n("throw",t,u,s)})}s(c.arg)}(n,a,i,u)})}return i=i?i.then(u,u):u()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=L(a,r);if(u){if(u===p)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function L(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,L(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function k(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 O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function T(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return y.prototype=d,n(b,"constructor",{value:d,configurable:!0}),n(d,"constructor",{value:y,configurable:!0}),y.displayName=f(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,f(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},x(P.prototype),f(P.prototype,s,function(){return this}),t.AsyncIterator=P,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new P(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},x(b),f(b,c,"Generator"),f(b,u,function(){return this}),f(b,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=T,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.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(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},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),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function a(t,e,r,n,o,i,a){try{var u=t[i](a),s=u.value}catch(c){return void r(c)}u.done?e(s):Promise.resolve(s).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,s,"next",t)}function s(t){a(i,n,o,u,s,"throw",t)}u(void 0)})}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(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,l(n.key),n)}}function f(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){var e=h(t,"string");return"symbol"===o(e)?e:String(e)}function h(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var p=function(){function n(t){s(this,n),this.root=t,this.requestPromises=[]}return f(n,[{key:"init",value:function(t){this.getToken=t}},{key:"get",value:function(){var r=u(i().mark(function r(n){var o,a,u,s=this;return i().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getToken();case 2:if(o=r.sent,a=this.getHashCode(n),!this.requestPromises[a]){r.next=6;break}return r.abrupt("return",this.requestPromises[a].promise);case 6:return u=new Promise(function(r,i){var a;n.externalResource?a=n.url:(a=s.root+n.url,a="".concat(a).concat(/\?/.test(a)?"&":"?","token=").concat(o).concat((0,e.convertObjToUrlParams)(n.params))),t.default.get(a).then(function(t){r(t.data)}).catch(function(t){console.log("ERROR -> GUDHUB HTTP SERVICE -> GET :",t.message),console.log("Request message: ",n),t.response&&t.response.data&&console.log("Error response data: ",t.response.data),i(t)})}),this.pushPromise(u,a),r.abrupt("return",u);case 9:case"end":return r.stop()}},r,this)}));return function(t){return r.apply(this,arguments)}}()},{key:"post",value:function(){var e=u(i().mark(function e(n){var o,a,u=this;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.getHashCode(n),e.next=3,this.getToken();case 3:if(n.form.token=e.sent,!this.requestPromises[o]){e.next=6;break}return e.abrupt("return",this.requestPromises[o].promise);case 6:return a=new Promise(function(e,o){t.default.post(u.root+n.url,r.default.stringify(n.form),{headers:n.headers||{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(t){e(t.data)}).catch(function(t){console.log("ERROR -> GUDHUB HTTP SERVICE -> POST :",t.message),console.log("Request message: ",n),o(t)})}),this.pushPromise(a,o),e.abrupt("return",a);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"axiosRequest",value:function(e){var n=this.getHashCode(e);if(this.requestPromises[n])return this.requestPromises[n].promise;var o=e.method?e.method.toLowerCase():"get",a=e.url,s=e.headers||{};e.form&&(s["Content-Type"]="application/x-www-form-urlencoded");var c=new Promise(function(){var n=u(i().mark(function n(u,c){var f,l;return i().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,t.default[o](a,"post"===o?r.default.stringify(e.form)||e.body:{headers:s},"post"===o?{headers:s}:{});case 3:f=n.sent,l=f.data,u(l),n.next=13;break;case 8:n.prev=8,n.t0=n.catch(0),console.log("ERROR -> GUDHUB HTTP SERVICE -> SIMPLE POST :",n.t0.message),console.log("Request message: ",e),c(n.t0);case 13:case"end":return n.stop()}},n,null,[[0,8]])}));return function(t,e){return n.apply(this,arguments)}}());return this.pushPromise(c,n),c}},{key:"pushPromise",value:function(t,e){var r=this;this.requestPromises[e]={promise:t,hesh:e,callback:t.then(function(){r.destroyPromise(e)})}}},{key:"destroyPromise",value:function(t){this.requestPromises=this.requestPromises.filter(function(e){return e.hesh!==t})}},{key:"getHashCode",value:function(t){var e=0,n=r.default.stringify(t);if(0==n.length)return e;for(var o=0;o<n.length;o++){e=(e<<5)-e+n.charCodeAt(o),e&=e}return"h"+e}}]),n}();exports.GudHubHttpsService=p;
|
|
101
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GudHubHttpsService=void 0;var t=n(require("axios")),e=require("./utils.js"),r=n(require("qs"));function n(t){return t&&t.__esModule?t:{default:t}}function o(t){return(o="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 i(){i=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(_){f=function(t,e,r){return t[e]=r}}function l(t,e,r,o){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),u=new S(o||[]);return n(a,"_invoke",{value:E(t,r,u)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(_){return{type:"throw",arg:_}}}t.wrap=l;var p={};function v(){}function y(){}function d(){}var m={};f(m,u,function(){return this});var g=Object.getPrototypeOf,w=g&&g(g(T([])));w&&w!==e&&r.call(w,u)&&(m=w);var b=d.prototype=v.prototype=Object.create(m);function x(t){["next","throw","return"].forEach(function(e){f(t,e,function(t){return this._invoke(e,t)})})}function P(t,e){var i;n(this,"_invoke",{value:function(n,a){function u(){return new e(function(i,u){!function n(i,a,u,s){var c=h(t[i],t,a);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==o(l)&&r.call(l,"__await")?e.resolve(l.__await).then(function(t){n("next",t,u,s)},function(t){n("throw",t,u,s)}):e.resolve(l).then(function(t){f.value=t,u(f)},function(t){return n("throw",t,u,s)})}s(c.arg)}(n,a,i,u)})}return i=i?i.then(u,u):u()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=L(a,r);if(u){if(u===p)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function L(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,L(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function k(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 O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function T(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return y.prototype=d,n(b,"constructor",{value:d,configurable:!0}),n(d,"constructor",{value:y,configurable:!0}),y.displayName=f(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,f(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},x(P.prototype),f(P.prototype,s,function(){return this}),t.AsyncIterator=P,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new P(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},x(b),f(b,c,"Generator"),f(b,u,function(){return this}),f(b,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=T,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.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(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},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),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function a(t,e,r,n,o,i,a){try{var u=t[i](a),s=u.value}catch(c){return void r(c)}u.done?e(s):Promise.resolve(s).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,s,"next",t)}function s(t){a(i,n,o,u,s,"throw",t)}u(void 0)})}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(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,l(n.key),n)}}function f(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){var e=h(t,"string");return"symbol"===o(e)?e:String(e)}function h(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var p=function(){function n(t){s(this,n),this.root=t,this.requestPromises=[]}return f(n,[{key:"init",value:function(t){this.getToken=t}},{key:"get",value:function(){var r=u(i().mark(function r(n){var o,a,u,s=this;return i().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getToken();case 2:if(o=r.sent,a=this.getHashCode(n),!this.requestPromises[a]){r.next=6;break}return r.abrupt("return",this.requestPromises[a].promise);case 6:return u=new Promise(function(r,i){var a;n.externalResource?a=n.url:(a=s.root+n.url,a="".concat(a).concat(/\?/.test(a)?"&":"?","token=").concat(o).concat((0,e.convertObjToUrlParams)(n.params))),t.default.get(a).then(function(t){r(t.data)}).catch(function(t){console.log("ERROR -> GUDHUB HTTP SERVICE -> GET :",t.message),console.log("Request message: ",n),t.response&&t.response.data&&console.log("Error response data: ",t.response.data),i(t)})}),this.pushPromise(u,a),r.abrupt("return",u);case 9:case"end":return r.stop()}},r,this)}));return function(t){return r.apply(this,arguments)}}()},{key:"post",value:function(){var e=u(i().mark(function e(n){var o,a,u=this;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.getHashCode(n),e.next=3,this.getToken();case 3:if(n.form.token=e.sent,!this.requestPromises[o]){e.next=6;break}return e.abrupt("return",this.requestPromises[o].promise);case 6:return a=new Promise(function(e,o){t.default.post(u.root+n.url,r.default.stringify(n.form),{headers:n.headers||{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(t){e(t.data)}).catch(function(t){console.log("ERROR -> GUDHUB HTTP SERVICE -> POST :",t.message),console.log("Request message: ",n),o(t)})}),this.pushPromise(a,o),e.abrupt("return",a);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"axiosRequest",value:function(e){var n=this.getHashCode(e);if(this.requestPromises[n])return this.requestPromises[n].promise;var o=e.method?e.method.toLowerCase():"get",a=e.url,s=e.headers||{};e.form&&(s["Content-Type"]="application/x-www-form-urlencoded");var c=new Promise(function(){var n=u(i().mark(function n(u,c){var f,l;return i().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,t.default[o](a,"post"===o?r.default.stringify(e.form)||e.body:{headers:s},"post"===o?{headers:s}:{});case 3:f=n.sent,l=f.data,u(l),n.next=13;break;case 8:n.prev=8,n.t0=n.catch(0),console.log("ERROR -> GUDHUB HTTP SERVICE -> SIMPLE POST :",n.t0.message),console.log("Request message: ",e),c(n.t0);case 13:case"end":return n.stop()}},n,null,[[0,8]])}));return function(t,e){return n.apply(this,arguments)}}());return this.pushPromise(c,n),c}},{key:"pushPromise",value:function(t,e){var r=this;this.requestPromises[e]={promise:t,hesh:e,callback:t.then(function(){r.destroyPromise(e)}).catch(function(t){r.destroyPromise(e)})}}},{key:"destroyPromise",value:function(t){this.requestPromises=this.requestPromises.filter(function(e){return e.hesh!==t})}},{key:"getHashCode",value:function(t){var e=0,n=r.default.stringify(t);if(0==n.length)return e;for(var o=0;o<n.length;o++){e=(e<<5)-e+n.charCodeAt(o),e&=e}return"h"+e}}]),n}();exports.GudHubHttpsService=p;
|
|
102
102
|
},{"axios":"O4Aa","./utils.js":"EgeI","qs":"hIRQ"}],"Lc8J":[function(require,module,exports) {
|
|
103
103
|
"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o})(e)}function e(o){var e="";for(var t in o)o.hasOwnProperty(t)&&o[t]&&(e+="."+o[t]);return e?e.substring(1):"any"}function t(e,t,n){return null==e||"string"!=typeof e?(console.log("Listener type is \"undefined\" or not have actual 'type' for subscribe"),!1):null==t||"object"!==o(t)?(console.log("Listener destination is \"undefined\" or not have actual 'type' for subscribe"),!1):"function"==typeof n||(console.log("Listener is not a function for subscribe!"),!1)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkParams=t,exports.createId=e;
|
|
104
104
|
},{}],"E3xI":[function(require,module,exports) {
|