UNPKG

10.4 kBJavaScriptView Raw
1!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t(1);n.default=r.default},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))(function(o,u){function i(e){try{l(r.next(e))}catch(e){u(e)}}function a(e){try{l(r.throw(e))}catch(e){u(e)}}function l(e){e.done?o(e.value):new t(function(n){n(e.value)}).then(i,a)}l((r=r.apply(e,n||[])).next())})},o=this&&this.__generator||function(e,n){var t,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(e,i)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}};Object.defineProperty(n,"__esModule",{value:!0});var u=t(2),i=t(3),a=t(5),l=Object.values(u.PreHandlerLifeCycleHooks),c=Object.values(u.PostHandlerLifeCycleHooks),s=function(e){return new Error(e)};n.default=function(e){var n={onRequest:[],onAuth:[],onPreHandler:[],onPostHandler:[],onPreResponse:[],onError:[]},t=function(n,u,s){return r(this,void 0,void 0,function(){var f,h,p,d,b,y,v,w,_=this;return o(this,function(P){switch(P.label){case 0:for(p in t.event=n,t.context=u,t.error=null,t.response=null,f=function(e){return r(_,void 0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return t.error=e,[4,a.default(t.plugins.onError,t,s)];case 1:return n.sent(),[2]}})})},h=[],l)h.push(p);d=0,P.label=1;case 1:return d<h.length?(w=h[d],[4,a.default(t.plugins[l[w]],t,f)]):[3,4];case 2:P.sent(),P.label=3;case 3:return d++,[3,1];case 4:return[4,i.default(e,t,f)];case 5:for(y in P.sent(),b=[],c)b.push(y);v=0,P.label=6;case 6:return v<b.length?(w=b[v],[4,a.default(t.plugins[c[w]],t,f)]):[3,9];case 7:P.sent(),P.label=8;case 8:return v++,[3,6];case 9:return[2,s(t.error,t.response)]}})})};return t.plugins=n,t.register=function(e){if(!e||!e.length)throw s("no plugins have been supplied to the register");return e.forEach(function(e){Object.keys(e.plugin).forEach(function(t){if(!Object.values(u.PluginLifeCycleHooks).includes(t))throw s(t+" is not a valid hook. see PluginLifeCycleHooks");var r,o=e.plugin[t],i=e.config,a=(r=o,function(e){return void 0===e&&(e={}),function(n,t){return r(n,e,t)}})(i);n[t].push(a)})}),t},t}},function(e,n,t){"use strict";var r,o,u;Object.defineProperty(n,"__esModule",{value:!0}),function(e){e.ON_REQUEST="onRequest",e.ON_AUTH="onAuth",e.ON_PRE_HANDLER="onPreHandler"}(r||(r={})),n.PreHandlerLifeCycleHooks=r,function(e){e.ON_POST_HANDLER="onPostHandler",e.ON_PRE_RESPONSE="onPreResponse"}(o||(o={})),n.PostHandlerLifeCycleHooks=o,function(e){e.ON_REQUEST="onRequest",e.ON_AUTH="onAuth",e.ON_PRE_HANDLER="onPreHandler",e.ON_POST_HANDLER="onPostHandler",e.ON_PRE_RESPONSE="onPreResponse",e.ON_ERROR="onError"}(u||(u={})),n.PluginLifeCycleHooks=u},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))(function(o,u){function i(e){try{l(r.next(e))}catch(e){u(e)}}function a(e){try{l(r.throw(e))}catch(e){u(e)}}function l(e){e.done?o(e.value):new t(function(n){n(e.value)}).then(i,a)}l((r=r.apply(e,n||[])).next())})},o=this&&this.__generator||function(e,n){var t,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(e,i)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}},u=this;Object.defineProperty(n,"__esModule",{value:!0});var i=t(4);n.default=function(e,n,t){return r(u,void 0,void 0,function(){var r,u,a,l,c,s,f,h;return o(this,function(o){switch(o.label){case 0:r=function(e){n.response=e},u=function(){var e,n=new Promise(function(n){e=function(e,t){if(e)throw e;n(t)}});return{handlerCallback:e,handlerPromise:n}},o.label=1;case 1:return o.trys.push([1,7,,9]),a=u(),l=a.handlerCallback,c=a.handlerPromise,s=e(n.event,n.context,l),i.default(s)?[4,s]:[3,3];case 2:return f=o.sent(),[2,r(f)];case 3:return void 0!==s?[3,5]:[4,c];case 4:return f=o.sent(),[2,r(f)];case 5:return[2,r(s)];case 6:return[3,9];case 7:return h=o.sent(),[4,t(h)];case 8:return o.sent(),[3,9];case 9:return[2]}})})}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.default=function(e){return e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch}},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))(function(o,u){function i(e){try{l(r.next(e))}catch(e){u(e)}}function a(e){try{l(r.throw(e))}catch(e){u(e)}}function l(e){e.done?o(e.value):new t(function(n){n(e.value)}).then(i,a)}l((r=r.apply(e,n||[])).next())})},o=this&&this.__generator||function(e,n){var t,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(e,i)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}},u=this;Object.defineProperty(n,"__esModule",{value:!0});var i=t(6);n.default=function(e,n,t){return r(u,void 0,void 0,function(){var r,u,a,l;return o(this,function(o){switch(o.label){case 0:for(u in r=[],e)r.push(u);a=0,o.label=1;case 1:return a<r.length?(l=r[a],[4,i.default(e[l],n,t)]):[3,4];case 2:o.sent(),o.label=3;case 3:return a++,[3,1];case 4:return[2]}})})}},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))(function(o,u){function i(e){try{l(r.next(e))}catch(e){u(e)}}function a(e){try{l(r.throw(e))}catch(e){u(e)}}function l(e){e.done?o(e.value):new t(function(n){n(e.value)}).then(i,a)}l((r=r.apply(e,n||[])).next())})},o=this&&this.__generator||function(e,n){var t,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(e,i)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}},u=this;Object.defineProperty(n,"__esModule",{value:!0});n.default=function(e,n,t){return r(u,void 0,void 0,function(){var r;return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,4]),[4,e(n,t)];case 1:return o.sent(),[3,4];case 2:return r=o.sent(),[4,t(r)];case 3:return o.sent(),[3,4];case 4:return[2]}})})}}]);
2//# sourceMappingURL=main.js.map
\No newline at end of file