@ololoepepe/api-wrapper
Advanced tools
Comparing version 0.0.19 to 0.0.20
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.apiWrapper=e():t.apiWrapper=e()}(self,(function(){return(()=>{var t={757:(t,e,r)=>{t.exports=r(666)},187:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}v(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,o,{once:!0})}))},i.EventEmitter=i,i.prototype._events=undefined,i.prototype._eventsCount=0,i.prototype._maxListeners=undefined;var a=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function s(t){return t._maxListeners===undefined?i.defaultMaxListeners:t._maxListeners}function u(t,e,r,n){var o,i,a,u;if(c(r),(i=t._events)===undefined?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==undefined&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),a=i[e]),a===undefined)a=i[e]=r,++t._eventsCount;else if("function"==typeof a?a=i[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=s(t))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,u=l,console&&console.warn&&console.warn(u)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:undefined,target:t,type:e,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function f(t,e,r){var n=t._events;if(n===undefined)return[];var o=n[e];return o===undefined?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):d(o,o.length)}function h(t){var e=this._events;if(e!==undefined){var r=e[t];if("function"==typeof r)return 1;if(r!==undefined)return r.length}return 0}function d(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),i.init=function(){this._events!==undefined&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||undefined},i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,i=this._events;if(i!==undefined)o=o&&i.error===undefined;else if(!o)return!1;if(o){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var c=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw c.context=a,c}var s=i[t];if(s===undefined)return!1;if("function"==typeof s)n(s,this,e);else{var u=s.length,l=d(s,u);for(r=0;r<u;++r)n(l[r],this,e)}return!0},i.prototype.addListener=function(t,e){return u(this,t,e,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(t,e){return u(this,t,e,!0)},i.prototype.once=function(t,e){return c(e),this.on(t,p(this,t,e)),this},i.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,p(this,t,e)),this},i.prototype.removeListener=function(t,e){var r,n,o,i,a;if(c(e),(n=this._events)===undefined)return this;if((r=n[t])===undefined)return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),n.removeListener!==undefined&&this.emit("removeListener",t,a||e)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(t){var e,r,n;if((r=this._events)===undefined)return this;if(r.removeListener===undefined)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):r[t]!==undefined&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(e!==undefined)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},i.prototype.listeners=function(t){return f(this,t,!0)},i.prototype.rawListeners=function(t){return f(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):h.call(t,e)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(j){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n=p;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=D(a,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var s=l(t,e,r);if("normal"===s.type){if(n=r.done?d:f,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=d,r.method="throw",r.arg=s.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(j){return{type:"throw",arg:j}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",h="executing",d="completed",v={};function y(){}function m(){}function g(){}var b={};s(b,i,(function(){return this}));var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,i)&&(b=_);var A=g.prototype=y.prototype=Object.create(b);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,a,c){var s=l(t[o],t,i);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(p).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function D(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator["return"]&&(r.method="return",r.arg=e,D(t,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:P}}function P(){return{value:e,done:!0}}return m.prototype=g,s(A,"constructor",g),s(g,"constructor",m),m.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},t.awrap=function(t){return{__await:t}},x(E.prototype),s(E.prototype,a,(function(){return this})),t.AsyncIterator=E,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new E(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(A),s(A,c,"Generator"),s(A,i,(function(){return this})),s(A,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=L,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},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 r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.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,v):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),v},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),T(r),v}},"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;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}(t.exports);try{regeneratorRuntime=e}catch(r){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}},e={};function r(n){var o=e[n];if(o!==undefined)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function t(e,r){return t=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t(e,r)}function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function o(r,n,i){return o=e()?Reflect.construct:function(e,r,n){var o=[null];o.push.apply(o,r);var i=new(Function.bind.apply(e,o));return n&&t(i,n.prototype),i},o.apply(null,arguments)}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,s,"next",t)}function s(t){c(i,n,o,a,s,"throw",t)}a(undefined)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function p(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}r.r(n),r.d(n,{ApiAuthenticator:()=>T,ApiError:()=>k,ApiRealtimeTransport:()=>O,ApiTransport:()=>L,ApiWrapper:()=>G});var f=r(757),h=r.n(f);function d(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&t(e,r)}function v(t){return v="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},v(t)}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}function b(e){var r="function"==typeof Map?new Map:undefined;return b=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,i)}function i(){return o(e,arguments,g(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),t(i,e)},b(e)}function w(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g(t);if(e){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}var _="api_wrapper/authentication_failed",A="api_wrapper/method_not_implemented",x="api_wrapper/parameter_not_provided",E="api_wrapper/realtime_transport",D="api_wrapper/unexpected",k=function(t){d(r,t);var e=w(r);function r(){var t,n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:D,o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:n,i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return u(this,r),(t=e.call(this,o)).code=n,t.data=i,t}return p(r,null,[{key:"createAuthenticationFailedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[_,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Authentication failed"),{className:e,methodName:r,originalError:t,place:n}]}},{key:"createMethodNotImplementedErrorArgs",value:function(t,e){return[A,"[".concat(t,".").concat(e,"] Method not implemented: ").concat(e),{className:t,methodName:e}]}},{key:"createParameterNotProvidedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[x,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Parameter not provided: ").concat(t),{className:e,methodName:r,parameterName:t,place:n}]}},{key:"createRealtimeTransportErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[E,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Realtime transport error: ").concat(t.message),{className:e,methodName:r,originalError:t,place:n}]}}]),r}(b(Error)),T=function(){function t(){u(this,t)}var e,r,n;return p(t,[{key:"authenticate",value:(n=s(h().mark((function i(t,e){return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw console.log("[ApiAuthenticator.authenticate]","wrapper:",t),console.log("[ApiAuthenticator.authenticate]","previousAuthenticationData:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","authenticate")));case 3:case"end":return r.stop()}}),i)}))),function(t,e){return n.apply(this,arguments)})},{key:"loadAuthenticationData",value:(r=s(h().mark((function c(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","loadAuthenticationData")));case 1:case"end":return t.stop()}}),c)}))),function(){return r.apply(this,arguments)})},{key:"saveAuthenticationData",value:(e=s(h().mark((function l(t){return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw console.log("[ApiAuthenticator.saveAuthenticationData]","authenticationData:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","saveAuthenticationData")));case 2:case"end":return e.stop()}}),l)}))),function(t){return e.apply(this,arguments)})}]),t}(),O=function(){function t(){u(this,t)}return p(t,[{key:"connect",value:function(t){var e=t.onConnect,r=t.onDisconnect,n=t.wrapper;throw console.log("[ApiRealtimeTransport.connect]","onConnect:",e),console.log("[ApiRealtimeTransport.connect]","onDisconnect:",r),console.log("[ApiRealtimeTransport.connect]","wrapper:",n),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","connect")))}},{key:"disconnect",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","disconnect")))}},{key:"subscribe",value:function(t){var e=t.callbacks,r=t.isPrivate,n=t.onSubscribe,i=t.onUnsubscribe,c=t.subscriptionData;throw console.log("[ApiRealtimeTransport.subscribe]","callbacks:",e),console.log("[ApiRealtimeTransport.subscribe]","isPrivate:",r),console.log("[ApiRealtimeTransport.subscribe]","onSubscribe:",n),console.log("[ApiRealtimeTransport.subscribe]","onUnsubscribe:",i),console.log("[ApiRealtimeTransport.subscribe]","subscriptionData:",c),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","subscribe")))}},{key:"unsubscribe",value:function(t){var e=t.subscriptionData;throw console.log("[ApiRealtimeTransport.unsubscribe]","subscriptionData:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","unsubscribe")))}}]),t}(),L=function(){function t(){u(this,t)}var e;return p(t,[{key:"callMethod",value:(e=s(h().mark((function r(t){var e,n,i,c;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw e=t.authenticationData,n=t.methodData,i=t.requestData,c=t.wrapper,console.log("[ApiTransport.callMethod]","authenticationData:",e),console.log("[ApiTransport.callMethod]","methodData:",n),console.log("[ApiTransport.callMethod]","requestData:",i),console.log("[ApiTransport.callMethod]","wrapper:",c),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","callMethod")));case 6:case"end":return r.stop()}}),r)}))),function(t){return e.apply(this,arguments)})},{key:"getCreateMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getCreateMethodData")))}},{key:"getDeleteMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getDeleteMethodData")))}},{key:"getReadMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getReadMethodData")))}},{key:"getUpdateMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getUpdateMethodData")))}},{key:"isAuthenticationFailedError",value:function(t){throw console.log("[ApiTransport.isAuthenticationFailedError]","error:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","isAuthenticationFailedError")))}},{key:"isSessionExpiredError",value:function(t){throw console.log("[ApiTransport.isSessionExpiredError]","error:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","isSessionExpiredError")))}}]),t}(),P=r(187),j=r.n(P);function R(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function M(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return S(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r["return"]||r["return"]()}finally{if(c)throw i}}}}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function N(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?N(Object(r),!0).forEach((function(e){R(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var I={Connected:"connected",Connecting:"connecting",Disconnected:"disconnected",Disconnecting:"disconnecting"},F={delay:1e3,delayFactor:2,maxDelay:32e3},W=function(){function t(e){var r=e.onError,n=e.realtimeTransport,o=e.reconnectConfig,i=void 0===o?{}:o,a=e.wrapper;u(this,t),this._connectionState=I.Disconnected,this._onError=r,this._realtimeTransport=n,this._reconnectConfig=C(C({},F),i),this._reconnectDelay=this._reconnectConfig.delay,this._subscriptions=new Set,this._wrapper=a}return p(t,[{key:"getRealtimeTransport",value:function(){return this._realtimeTransport}},{key:"getWrapper",value:function(){return this._wrapper}},{key:"subscribe",value:function(t){var e=this,r=t.callbacks,n=t.isPrivate,o=void 0!==n&&n,i=t.subscriptionData,a=this.getRealtimeTransport(),c={callbacks:r,isPrivate:o,subscriptionData:i,isSubscribed:!1};switch(this._subscriptions.add(c),this._connectionState){case I.Disconnected:this._connect();break;case I.Connected:this._subscribe(c)}return function(){if(c.isSubscribed&&a.unsubscribe({subscriptionData:i}),e._subscriptions["delete"](c),e._subscriptions.size<1){if([I.Disconnected,I.Disconnecting].includes(e._connectionState))return;e._disconnect()}}}},{key:"_connect",value:function(){var t=this;this._connectionState=I.Connecting,this.getRealtimeTransport().connect({onConnect:function(){return t._handleConnect()},onDisconnect:function(e){return t._handleDisconnect(e)},wrapper:this.getWrapper()})}},{key:"_disconnect",value:function(){this._connectionState=I.Disconnecting,this.getRealtimeTransport().disconnect()}},{key:"_handleConnect",value:function(){this._reconnectDelay=this._reconnectConfig.delay,this._connectionState=I.Connected;var t,e=M(this._subscriptions);try{for(e.s();!(t=e.n()).done;){var r=t.value;r.isSubscribed||this._subscribe(r)}}catch(n){e.e(n)}finally{e.f()}}},{key:"_handleDisconnect",value:function(t){var e=this,r=this._connectionState===I.Disconnecting;this._connectionState=I.Disconnected,t?this._onError(t):this._subscriptions.size<1||(r?this._connect():(this._reconnectDelay<this._reconnectConfig.maxDelay&&(this._reconnectDelay*=this._reconnectConfig.delayFactor),setTimeout((function(){return e._connect()}),this._reconnectDelay)))}},{key:"_subscribe",value:function(t){var e=t.callbacks,r=t.isPrivate,n=t.subscriptionData;this.getRealtimeTransport().subscribe({callbacks:e,isPrivate:r,subscriptionData:n,onSubscribe:function(){t.isSubscribed=!0},onUnsubscribe:function(){t.isSubscribed=!1}})}}]),t}();function q(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g(t);if(e){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}var U=new Map,G=function(t){d(g,t);var e,r,n,i,c,l,f,v,m=q(g);function g(t){var e,r=t.authenticator,n=t.realtimeTransport,i=t.reconnectConfig,c=void 0===i?{}:i,s=t.transport;if(u(this,g),!r)throw o(k,a(k.createParameterNotProvidedErrorArgs("authenticator","ApiWrapper","constructor")));if(!n)throw o(k,a(k.createParameterNotProvidedErrorArgs("realtimeTransport","ApiWrapper","constructor")));if(!s)throw o(k,a(k.createParameterNotProvidedErrorArgs("transport","ApiWrapper","constructor")));return(e=m.call(this))._authenticator=r,e._realtimeTransportWrapper=new W({realtimeTransport:n,reconnectConfig:c,onError:e._handleRealtimeTransportWrapperError,wrapper:y(e)}),e._transport=s,e}return p(g,[{key:"authenticate",value:(v=s(h().mark((function b(){var t,e,r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=this.getAuthenticator(),n.prev=1,n.next=4,this._getAuthenticationPromise();case 4:return e=n.sent,n.next=7,t.saveAuthenticationData(e);case 7:return n.abrupt("return",e);case 10:if(n.prev=10,n.t0=n["catch"](1),!this.getTransport().isAuthenticationFailedError(n.t0)){n.next=16;break}throw r=o(k,a(k.createAuthenticationFailedErrorArgs(n.t0,"ApiWrapper","authenticate"))),this.emit("error",r),r;case 16:throw this.emit("error",n.t0),n.t0;case 18:case"end":return n.stop()}}),b,this,[[1,10]])}))),function(){return v.apply(this,arguments)})},{key:"callMethod",value:(f=s(h().mark((function w(t){var e,r,n=arguments;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return e=n.length>1&&n[1]!==undefined?n[1]:null,r=n.length>2&&n[2]!==undefined&&n[2],o.next=4,this._callMethod({isPrivate:r,methodData:t,requestData:e});case 4:return o.abrupt("return",o.sent);case 5:case"end":return o.stop()}}),w,this)}))),function(t){return f.apply(this,arguments)})},{key:"create",value:(l=s(h().mark((function _(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getCreateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),_,this)}))),function(){return l.apply(this,arguments)})},{key:"delete",value:(c=s(h().mark((function A(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getDeleteMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),A,this)}))),function(){return c.apply(this,arguments)})},{key:"getAuthenticationData",value:(i=s(h().mark((function x(){var t,e;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=this.getAuthenticator(),r.next=3,t.loadAuthenticationData();case 3:if(e=r.sent){r.next=8;break}return r.next=7,this.authenticate();case 7:e=r.sent;case 8:return r.abrupt("return",e);case 9:case"end":return r.stop()}}),x,this)}))),function(){return i.apply(this,arguments)})},{key:"getAuthenticator",value:function(){return this._authenticator}},{key:"getRealtimeTransportWrapper",value:function(){return this._realtimeTransportWrapper}},{key:"getTransport",value:function(){return this._transport}},{key:"read",value:(n=s(h().mark((function E(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getReadMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),E,this)}))),function(){return n.apply(this,arguments)})},{key:"subscribe",value:function(t,e){var r=arguments.length>2&&arguments[2]!==undefined&&arguments[2];return this.getRealtimeTransportWrapper().subscribe({callbacks:e,isPrivate:r,subscriptionData:t})}},{key:"update",value:(r=s(h().mark((function D(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getUpdateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),D,this)}))),function(){return r.apply(this,arguments)})},{key:"_callMethod",value:(e=s(h().mark((function T(){var t,e,r,n,o,i,a,c,s,u,l=arguments;return h().wrap((function(p){for(;;)switch(p.prev=p.next){case 0:if(t=l.length>0&&l[0]!==undefined?l[0]:{},e=t.isPrivate,r=void 0!==e&&e,n=t.isRetry,o=void 0!==n&&n,i=t.methodData,a=t.requestData,c=void 0===a?null:a,s=this.getTransport(),!r){p.next=8;break}return p.next=5,this.getAuthenticationData();case 5:p.t0=p.sent,p.next=9;break;case 8:p.t0=null;case 9:return u=p.t0,p.prev=10,p.next=13,s.callMethod({authenticationData:u,methodData:i,requestData:c,wrapper:this});case 13:return p.abrupt("return",p.sent);case 16:if(p.prev=16,p.t1=p["catch"](10),o||!s.isSessionExpiredError(p.t1)){p.next=24;break}return p.next=21,this.authenticate();case 21:return p.next=23,this._callMethod({isPrivate:r,methodData:i,requestData:c,isRetry:!0});case 23:return p.abrupt("return",p.sent);case 24:throw this.emit("error",p.t1),p.t1;case 26:case"end":return p.stop()}}),T,this,[[10,16]])}))),function(){return e.apply(this,arguments)})},{key:"_getAuthenticationPromise",value:function(){var t=this,e=this.getAuthenticator(),r=U.get(e);return r||(r=s(h().mark((function n(){var r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e.loadAuthenticationData();case 2:return r=n.sent,n.next=5,e.authenticate(t,r);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))(),U.set(e,r),s(h().mark((function o(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:t.next=7;break;case 5:t.prev=5,t.t0=t["catch"](0);case 7:return t.prev=7,U["delete"](e),t.finish(7);case 10:case"end":return t.stop()}}),o,null,[[0,5,7,10]])})))(),r)}},{key:"_handleRealtimeTransportWrapperError",value:function(t){this.emit("error",o(k,a(k.createRealtimeTransportErrorArgs(t,"ApiWrapper","_handleRealtimeTransportWrapperEvent"))))}}]),g}(j())})(),n})()})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.apiWrapper=e():t.apiWrapper=e()}(self,(()=>(()=>{var t={757:(t,e,r)=>{t.exports=r(666)},187:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}v(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,o,{once:!0})}))},i.EventEmitter=i,i.prototype._events=undefined,i.prototype._eventsCount=0,i.prototype._maxListeners=undefined;var a=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function s(t){return t._maxListeners===undefined?i.defaultMaxListeners:t._maxListeners}function u(t,e,r,n){var o,i,a,u;if(c(r),(i=t._events)===undefined?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==undefined&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),a=i[e]),a===undefined)a=i[e]=r,++t._eventsCount;else if("function"==typeof a?a=i[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=s(t))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,u=l,console&&console.warn&&console.warn(u)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:undefined,target:t,type:e,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function f(t,e,r){var n=t._events;if(n===undefined)return[];var o=n[e];return o===undefined?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):d(o,o.length)}function h(t){var e=this._events;if(e!==undefined){var r=e[t];if("function"==typeof r)return 1;if(r!==undefined)return r.length}return 0}function d(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),i.init=function(){this._events!==undefined&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||undefined},i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,i=this._events;if(i!==undefined)o=o&&i.error===undefined;else if(!o)return!1;if(o){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var c=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw c.context=a,c}var s=i[t];if(s===undefined)return!1;if("function"==typeof s)n(s,this,e);else{var u=s.length,l=d(s,u);for(r=0;r<u;++r)n(l[r],this,e)}return!0},i.prototype.addListener=function(t,e){return u(this,t,e,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(t,e){return u(this,t,e,!0)},i.prototype.once=function(t,e){return c(e),this.on(t,p(this,t,e)),this},i.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,p(this,t,e)),this},i.prototype.removeListener=function(t,e){var r,n,o,i,a;if(c(e),(n=this._events)===undefined)return this;if((r=n[t])===undefined)return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),n.removeListener!==undefined&&this.emit("removeListener",t,a||e)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(t){var e,r,n;if((r=this._events)===undefined)return this;if(r.removeListener===undefined)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):r[t]!==undefined&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(e!==undefined)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},i.prototype.listeners=function(t){return f(this,t,!0)},i.prototype.rawListeners=function(t){return f(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):h.call(t,e)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(j){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n=p;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=D(a,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var s=l(t,e,r);if("normal"===s.type){if(n=r.done?d:f,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=d,r.method="throw",r.arg=s.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(j){return{type:"throw",arg:j}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",h="executing",d="completed",v={};function y(){}function m(){}function g(){}var b={};s(b,i,(function(){return this}));var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,i)&&(b=_);var A=g.prototype=y.prototype=Object.create(b);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,a,c){var s=l(t[o],t,i);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(p).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function D(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator["return"]&&(r.method="return",r.arg=e,D(t,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:P}}function P(){return{value:e,done:!0}}return m.prototype=g,s(A,"constructor",g),s(g,"constructor",m),m.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},t.awrap=function(t){return{__await:t}},x(E.prototype),s(E.prototype,a,(function(){return this})),t.AsyncIterator=E,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new E(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(A),s(A,c,"Generator"),s(A,i,(function(){return this})),s(A,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=L,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},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 r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.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,v):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),v},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),T(r),v}},"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;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}(t.exports);try{regeneratorRuntime=e}catch(r){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}},e={};function r(n){var o=e[n];if(o!==undefined)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function t(e,r){return t=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t(e,r)}function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function o(r,n,i){return o=e()?Reflect.construct:function(e,r,n){var o=[null];o.push.apply(o,r);var i=new(Function.bind.apply(e,o));return n&&t(i,n.prototype),i},o.apply(null,arguments)}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,s,"next",t)}function s(t){c(i,n,o,a,s,"throw",t)}a(undefined)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function p(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}r.r(n),r.d(n,{ApiAuthenticator:()=>T,ApiError:()=>k,ApiRealtimeTransport:()=>O,ApiTransport:()=>L,ApiWrapper:()=>G});var f=r(757),h=r.n(f);function d(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&t(e,r)}function v(t){return v="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},v(t)}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}function b(e){var r="function"==typeof Map?new Map:undefined;return b=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,i)}function i(){return o(e,arguments,g(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),t(i,e)},b(e)}function w(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g(t);if(e){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}var _="api_wrapper/authentication_failed",A="api_wrapper/method_not_implemented",x="api_wrapper/parameter_not_provided",E="api_wrapper/realtime_transport",D="api_wrapper/unexpected",k=function(t){d(r,t);var e=w(r);function r(){var t,n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:D,o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:n,i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return u(this,r),(t=e.call(this,o)).code=n,t.data=i,t}return p(r,null,[{key:"createAuthenticationFailedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[_,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Authentication failed"),{className:e,methodName:r,originalError:t,place:n}]}},{key:"createMethodNotImplementedErrorArgs",value:function(t,e){return[A,"[".concat(t,".").concat(e,"] Method not implemented: ").concat(e),{className:t,methodName:e}]}},{key:"createParameterNotProvidedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[x,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Parameter not provided: ").concat(t),{className:e,methodName:r,parameterName:t,place:n}]}},{key:"createRealtimeTransportErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[E,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Realtime transport error: ").concat(t.message),{className:e,methodName:r,originalError:t,place:n}]}}]),r}(b(Error)),T=function(){function t(){u(this,t)}var e,r,n;return p(t,[{key:"authenticate",value:(n=s(h().mark((function i(t,e){return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw console.log("[ApiAuthenticator.authenticate]","wrapper:",t),console.log("[ApiAuthenticator.authenticate]","previousAuthenticationData:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","authenticate")));case 3:case"end":return r.stop()}}),i)}))),function(t,e){return n.apply(this,arguments)})},{key:"loadAuthenticationData",value:(r=s(h().mark((function c(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","loadAuthenticationData")));case 1:case"end":return t.stop()}}),c)}))),function(){return r.apply(this,arguments)})},{key:"saveAuthenticationData",value:(e=s(h().mark((function l(t){return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw console.log("[ApiAuthenticator.saveAuthenticationData]","authenticationData:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiAuthenticator","saveAuthenticationData")));case 2:case"end":return e.stop()}}),l)}))),function(t){return e.apply(this,arguments)})}]),t}(),O=function(){function t(){u(this,t)}return p(t,[{key:"connect",value:function(t){var e=t.onConnect,r=t.onDisconnect,n=t.wrapper;throw console.log("[ApiRealtimeTransport.connect]","onConnect:",e),console.log("[ApiRealtimeTransport.connect]","onDisconnect:",r),console.log("[ApiRealtimeTransport.connect]","wrapper:",n),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","connect")))}},{key:"disconnect",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","disconnect")))}},{key:"subscribe",value:function(t){var e=t.callbacks,r=t.isPrivate,n=t.onSubscribe,i=t.onUnsubscribe,c=t.subscriptionData;throw console.log("[ApiRealtimeTransport.subscribe]","callbacks:",e),console.log("[ApiRealtimeTransport.subscribe]","isPrivate:",r),console.log("[ApiRealtimeTransport.subscribe]","onSubscribe:",n),console.log("[ApiRealtimeTransport.subscribe]","onUnsubscribe:",i),console.log("[ApiRealtimeTransport.subscribe]","subscriptionData:",c),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","subscribe")))}},{key:"unsubscribe",value:function(t){var e=t.subscriptionData;throw console.log("[ApiRealtimeTransport.unsubscribe]","subscriptionData:",e),o(k,a(k.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","unsubscribe")))}}]),t}(),L=function(){function t(){u(this,t)}var e;return p(t,[{key:"callMethod",value:(e=s(h().mark((function r(t){var e,n,i,c;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw e=t.authenticationData,n=t.methodData,i=t.requestData,c=t.wrapper,console.log("[ApiTransport.callMethod]","authenticationData:",e),console.log("[ApiTransport.callMethod]","methodData:",n),console.log("[ApiTransport.callMethod]","requestData:",i),console.log("[ApiTransport.callMethod]","wrapper:",c),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","callMethod")));case 6:case"end":return r.stop()}}),r)}))),function(t){return e.apply(this,arguments)})},{key:"getCreateMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getCreateMethodData")))}},{key:"getDeleteMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getDeleteMethodData")))}},{key:"getReadMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getReadMethodData")))}},{key:"getUpdateMethodData",value:function(){throw o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","getUpdateMethodData")))}},{key:"isAuthenticationFailedError",value:function(t){throw console.log("[ApiTransport.isAuthenticationFailedError]","error:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","isAuthenticationFailedError")))}},{key:"isSessionExpiredError",value:function(t){throw console.log("[ApiTransport.isSessionExpiredError]","error:",t),o(k,a(k.createMethodNotImplementedErrorArgs("ApiTransport","isSessionExpiredError")))}}]),t}(),P=r(187),j=r.n(P);function R(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function M(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return S(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r["return"]||r["return"]()}finally{if(c)throw i}}}}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function N(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?N(Object(r),!0).forEach((function(e){R(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var I={Connected:"connected",Connecting:"connecting",Disconnected:"disconnected",Disconnecting:"disconnecting"},F={delay:1e3,delayFactor:2,maxDelay:32e3},W=function(){function t(e){var r=e.onError,n=e.realtimeTransport,o=e.reconnectConfig,i=void 0===o?{}:o,a=e.wrapper;u(this,t),this._connectionState=I.Disconnected,this._onError=r,this._realtimeTransport=n,this._reconnectConfig=C(C({},F),i),this._reconnectDelay=this._reconnectConfig.delay,this._subscriptions=new Set,this._wrapper=a}return p(t,[{key:"getRealtimeTransport",value:function(){return this._realtimeTransport}},{key:"getWrapper",value:function(){return this._wrapper}},{key:"subscribe",value:function(t){var e=this,r=t.callbacks,n=t.isPrivate,o=void 0!==n&&n,i=t.subscriptionData,a=this.getRealtimeTransport(),c={callbacks:r,isPrivate:o,subscriptionData:i,isSubscribed:!1};switch(this._subscriptions.add(c),this._connectionState){case I.Disconnected:this._connect();break;case I.Connected:this._subscribe(c)}return function(){if(c.isSubscribed&&a.unsubscribe({subscriptionData:i}),e._subscriptions["delete"](c),e._subscriptions.size<1){if([I.Disconnected,I.Disconnecting].includes(e._connectionState))return;e._disconnect()}}}},{key:"_connect",value:function(){var t=this;this._connectionState=I.Connecting,this.getRealtimeTransport().connect({onConnect:function(){return t._handleConnect()},onDisconnect:function(e){return t._handleDisconnect(e)},wrapper:this.getWrapper()})}},{key:"_disconnect",value:function(){this._connectionState=I.Disconnecting,this.getRealtimeTransport().disconnect()}},{key:"_handleConnect",value:function(){this._reconnectDelay=this._reconnectConfig.delay,this._connectionState=I.Connected;var t,e=M(this._subscriptions);try{for(e.s();!(t=e.n()).done;){var r=t.value;r.isSubscribed||this._subscribe(r)}}catch(n){e.e(n)}finally{e.f()}}},{key:"_handleDisconnect",value:function(t){var e=this,r=this._connectionState===I.Disconnecting;this._connectionState=I.Disconnected,t?this._onError(t):this._subscriptions.size<1||(r?this._connect():(this._reconnectDelay<this._reconnectConfig.maxDelay&&(this._reconnectDelay*=this._reconnectConfig.delayFactor),setTimeout((function(){return e._connect()}),this._reconnectDelay)))}},{key:"_subscribe",value:function(t){var e=t.callbacks,r=t.isPrivate,n=t.subscriptionData;this.getRealtimeTransport().subscribe({callbacks:e,isPrivate:r,subscriptionData:n,onSubscribe:function(){t.isSubscribed=!0},onUnsubscribe:function(){t.isSubscribed=!1}})}}]),t}();function q(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g(t);if(e){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}var U=new Map,G=function(t){d(g,t);var e,r,n,i,c,l,f,v,m=q(g);function g(t){var e,r=t.authenticator,n=t.realtimeTransport,i=t.reconnectConfig,c=void 0===i?{}:i,s=t.transport;if(u(this,g),!r)throw o(k,a(k.createParameterNotProvidedErrorArgs("authenticator","ApiWrapper","constructor")));if(!n)throw o(k,a(k.createParameterNotProvidedErrorArgs("realtimeTransport","ApiWrapper","constructor")));if(!s)throw o(k,a(k.createParameterNotProvidedErrorArgs("transport","ApiWrapper","constructor")));return(e=m.call(this))._authenticator=r,e._realtimeTransportWrapper=new W({realtimeTransport:n,reconnectConfig:c,onError:e._handleRealtimeTransportWrapperError,wrapper:y(e)}),e._transport=s,e}return p(g,[{key:"authenticate",value:(v=s(h().mark((function b(){var t,e,r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=this.getAuthenticator(),n.prev=1,n.next=4,this._getAuthenticationPromise();case 4:return e=n.sent,n.next=7,t.saveAuthenticationData(e);case 7:return n.abrupt("return",e);case 10:if(n.prev=10,n.t0=n["catch"](1),!this.getTransport().isAuthenticationFailedError(n.t0)){n.next=16;break}throw r=o(k,a(k.createAuthenticationFailedErrorArgs(n.t0,"ApiWrapper","authenticate"))),this.emit("error",r),r;case 16:throw this.emit("error",n.t0),n.t0;case 18:case"end":return n.stop()}}),b,this,[[1,10]])}))),function(){return v.apply(this,arguments)})},{key:"callMethod",value:(f=s(h().mark((function w(t){var e,r,n=arguments;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return e=n.length>1&&n[1]!==undefined?n[1]:null,r=n.length>2&&n[2]!==undefined&&n[2],o.next=4,this._callMethod({isPrivate:r,methodData:t,requestData:e});case 4:return o.abrupt("return",o.sent);case 5:case"end":return o.stop()}}),w,this)}))),function(t){return f.apply(this,arguments)})},{key:"create",value:(l=s(h().mark((function _(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getCreateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),_,this)}))),function(){return l.apply(this,arguments)})},{key:"delete",value:(c=s(h().mark((function A(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getDeleteMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),A,this)}))),function(){return c.apply(this,arguments)})},{key:"getAuthenticationData",value:(i=s(h().mark((function x(){var t,e;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=this.getAuthenticator(),r.next=3,t.loadAuthenticationData();case 3:if(e=r.sent){r.next=8;break}return r.next=7,this.authenticate();case 7:e=r.sent;case 8:return r.abrupt("return",e);case 9:case"end":return r.stop()}}),x,this)}))),function(){return i.apply(this,arguments)})},{key:"getAuthenticator",value:function(){return this._authenticator}},{key:"getRealtimeTransportWrapper",value:function(){return this._realtimeTransportWrapper}},{key:"getTransport",value:function(){return this._transport}},{key:"read",value:(n=s(h().mark((function E(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getReadMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),E,this)}))),function(){return n.apply(this,arguments)})},{key:"subscribe",value:function(t,e){var r=arguments.length>2&&arguments[2]!==undefined&&arguments[2];return this.getRealtimeTransportWrapper().subscribe({callbacks:e,isPrivate:r,subscriptionData:t})}},{key:"update",value:(r=s(h().mark((function D(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getUpdateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),D,this)}))),function(){return r.apply(this,arguments)})},{key:"_callMethod",value:(e=s(h().mark((function T(){var t,e,r,n,o,i,a,c,s,u,l=arguments;return h().wrap((function(p){for(;;)switch(p.prev=p.next){case 0:if(t=l.length>0&&l[0]!==undefined?l[0]:{},e=t.isPrivate,r=void 0!==e&&e,n=t.isRetry,o=void 0!==n&&n,i=t.methodData,a=t.requestData,c=void 0===a?null:a,s=this.getTransport(),!r){p.next=8;break}return p.next=5,this.getAuthenticationData();case 5:p.t0=p.sent,p.next=9;break;case 8:p.t0=null;case 9:return u=p.t0,p.prev=10,p.next=13,s.callMethod({authenticationData:u,methodData:i,requestData:c,wrapper:this});case 13:return p.abrupt("return",p.sent);case 16:if(p.prev=16,p.t1=p["catch"](10),o||!s.isSessionExpiredError(p.t1)){p.next=24;break}return p.next=21,this.authenticate();case 21:return p.next=23,this._callMethod({isPrivate:r,methodData:i,requestData:c,isRetry:!0});case 23:return p.abrupt("return",p.sent);case 24:throw this.emit("error",p.t1),p.t1;case 26:case"end":return p.stop()}}),T,this,[[10,16]])}))),function(){return e.apply(this,arguments)})},{key:"_getAuthenticationPromise",value:function(){var t=this,e=this.getAuthenticator(),r=U.get(e);return r||(r=s(h().mark((function n(){var r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e.loadAuthenticationData();case 2:return r=n.sent,n.next=5,e.authenticate(t,r);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))(),U.set(e,r),s(h().mark((function o(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:t.next=7;break;case 5:t.prev=5,t.t0=t["catch"](0);case 7:return t.prev=7,U["delete"](e),t.finish(7);case 10:case"end":return t.stop()}}),o,null,[[0,5,7,10]])})))(),r)}},{key:"_handleRealtimeTransportWrapperError",value:function(t){this.emit("error",o(k,a(k.createRealtimeTransportErrorArgs(t,"ApiWrapper","_handleRealtimeTransportWrapperEvent"))))}}]),g}(j())})(),n})())); | ||
//# sourceMappingURL=index.browser.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.apiWrapper=e():t.apiWrapper=e()}(global,(function(){return(()=>{var t={228:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports["default"]=t.exports},646:(t,e,r)=>{var n=r(228);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},506:t=>{t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports["default"]=t.exports},926:t=>{function e(t,e,r,n,o,a,i){try{var c=t[a](i),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function c(t){e(i,o,a,c,s,"next",t)}function s(t){e(i,o,a,c,s,"throw",t)}c(undefined)}))}},t.exports.__esModule=!0,t.exports["default"]=t.exports},575:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports["default"]=t.exports},100:(t,e,r)=>{var n=r(489),o=r(67);function a(e,r,i){return o()?(t.exports=a=Reflect.construct,t.exports.__esModule=!0,t.exports["default"]=t.exports):(t.exports=a=function(t,e,r){var o=[null];o.push.apply(o,e);var a=new(Function.bind.apply(t,o));return r&&n(a,r.prototype),a},t.exports.__esModule=!0,t.exports["default"]=t.exports),a.apply(null,arguments)}t.exports=a,t.exports.__esModule=!0,t.exports["default"]=t.exports},913:t=>{function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports["default"]=t.exports},713:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports["default"]=t.exports},754:t=>{function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},205:(t,e,r)=>{var n=r(489);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)},t.exports.__esModule=!0,t.exports["default"]=t.exports},430:t=>{t.exports=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},t.exports.__esModule=!0,t.exports["default"]=t.exports},67:t=>{t.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports["default"]=t.exports},860:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},206:t=>{t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports["default"]=t.exports},585:(t,e,r)=>{var n=r(8)["default"],o=r(506);t.exports=function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},489:t=>{function e(r,n){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r,n)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},319:(t,e,r)=>{var n=r(646),o=r(860),a=r(379),i=r(206);t.exports=function(t){return n(t)||o(t)||a(t)||i()},t.exports.__esModule=!0,t.exports["default"]=t.exports},8:t=>{function e(r){return t.exports=e="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.exports.__esModule=!0,t.exports["default"]=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},379:(t,e,r)=>{var n=r(228);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports["default"]=t.exports},957:(t,e,r)=>{var n=r(754),o=r(489),a=r(430),i=r(100);function c(e){var r="function"==typeof Map?new Map:undefined;return t.exports=c=function(t){if(null===t||!a(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return i(t,arguments,n(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)},t.exports.__esModule=!0,t.exports["default"]=t.exports,c(e)}t.exports=c,t.exports.__esModule=!0,t.exports["default"]=t.exports},757:(t,e,r)=>{t.exports=r(666)},666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(S){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,a=Object.create(o.prototype),i=new T(n||[]);return a._invoke=function(t,e,r){var n=l;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw a;return P()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=k(i,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var s=p(t,e,r);if("normal"===s.type){if(n=r.done?d:f,s.arg===y)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=d,r.method="throw",r.arg=s.arg)}}}(t,r,i),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(S){return{type:"throw",arg:S}}}t.wrap=u;var l="suspendedStart",f="suspendedYield",h="executing",d="completed",y={};function v(){}function m(){}function g(){}var b={};s(b,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(O([])));_&&_!==r&&n.call(_,a)&&(b=_);var w=g.prototype=v.prototype=Object.create(b);function A(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function D(t,e){function r(o,a,i,c){var s=p(t[o],t,a);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(l).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(s.arg)}var o;this._invoke=function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}}function k(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator["return"]&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=p(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}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 M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function O(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:P}}function P(){return{value:e,done:!0}}return m.prototype=g,s(w,"constructor",g),s(g,"constructor",m),m.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},A(D.prototype),s(D.prototype,i,(function(){return this})),t.AsyncIterator=D,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new D(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},A(w),s(w,c,"Generator"),s(w,a,(function(){return this})),s(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},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 r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):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),y},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),M(r),y}},"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;M(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:O(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(r){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}},e={};function r(n){var o=e[n];if(o!==undefined)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{ApiAuthenticator:()=>T,ApiError:()=>M,ApiRealtimeTransport:()=>O,ApiTransport:()=>P,ApiWrapper:()=>$});var t=r(100),e=r.n(t),o=r(319),a=r.n(o),i=r(926),c=r.n(i),s=r(575),u=r.n(s),p=r(913),l=r.n(p),f=r(757),h=r.n(f),d=r(205),y=r.n(d),v=r(585),m=r.n(v),g=r(754),b=r.n(g),x=r(957);function _(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b()(t);if(e){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var w="api_wrapper/authentication_failed",A="api_wrapper/method_not_implemented",D="api_wrapper/parameter_not_provided",k="api_wrapper/realtime_transport",E="api_wrapper/unexpected",M=function(t){y()(r,t);var e=_(r);function r(){var t,n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:E,o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:n,a=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return u()(this,r),(t=e.call(this,o)).code=n,t.data=a,t}return l()(r,null,[{key:"createAuthenticationFailedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[w,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Authentication failed"),{className:e,methodName:r,originalError:t,place:n}]}},{key:"createMethodNotImplementedErrorArgs",value:function(t,e){return[A,"[".concat(t,".").concat(e,"] Method not implemented: ").concat(e),{className:t,methodName:e}]}},{key:"createParameterNotProvidedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[D,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Parameter not provided: ").concat(t),{className:e,methodName:r,parameterName:t,place:n}]}},{key:"createRealtimeTransportErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[k,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Realtime transport error: ").concat(t.message),{className:e,methodName:r,originalError:t,place:n}]}}]),r}(r.n(x)()(Error)),T=function(){function t(){u()(this,t)}var r,n,o;return l()(t,[{key:"authenticate",value:(o=c()(h().mark((function i(t,r){return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:throw console.log("[ApiAuthenticator.authenticate]","wrapper:",t),console.log("[ApiAuthenticator.authenticate]","previousAuthenticationData:",r),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiAuthenticator","authenticate")));case 3:case"end":return n.stop()}}),i)}))),function(t,e){return o.apply(this,arguments)})},{key:"loadAuthenticationData",value:(n=c()(h().mark((function s(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiAuthenticator","loadAuthenticationData")));case 1:case"end":return t.stop()}}),s)}))),function(){return n.apply(this,arguments)})},{key:"saveAuthenticationData",value:(r=c()(h().mark((function p(t){return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw console.log("[ApiAuthenticator.saveAuthenticationData]","authenticationData:",t),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiAuthenticator","saveAuthenticationData")));case 2:case"end":return r.stop()}}),p)}))),function(t){return r.apply(this,arguments)})}]),t}(),O=function(){function t(){u()(this,t)}return l()(t,[{key:"connect",value:function(t){var r=t.onConnect,n=t.onDisconnect,o=t.wrapper;throw console.log("[ApiRealtimeTransport.connect]","onConnect:",r),console.log("[ApiRealtimeTransport.connect]","onDisconnect:",n),console.log("[ApiRealtimeTransport.connect]","wrapper:",o),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","connect")))}},{key:"disconnect",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","disconnect")))}},{key:"subscribe",value:function(t){var r=t.callbacks,n=t.isPrivate,o=t.onSubscribe,i=t.onUnsubscribe,c=t.subscriptionData;throw console.log("[ApiRealtimeTransport.subscribe]","callbacks:",r),console.log("[ApiRealtimeTransport.subscribe]","isPrivate:",n),console.log("[ApiRealtimeTransport.subscribe]","onSubscribe:",o),console.log("[ApiRealtimeTransport.subscribe]","onUnsubscribe:",i),console.log("[ApiRealtimeTransport.subscribe]","subscriptionData:",c),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","subscribe")))}},{key:"unsubscribe",value:function(t){var r=t.subscriptionData;throw console.log("[ApiRealtimeTransport.unsubscribe]","subscriptionData:",r),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","unsubscribe")))}}]),t}(),P=function(){function t(){u()(this,t)}var r;return l()(t,[{key:"callMethod",value:(r=c()(h().mark((function n(t){var r,o,i,c;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:throw r=t.authenticationData,o=t.methodData,i=t.requestData,c=t.wrapper,console.log("[ApiTransport.callMethod]","authenticationData:",r),console.log("[ApiTransport.callMethod]","methodData:",o),console.log("[ApiTransport.callMethod]","requestData:",i),console.log("[ApiTransport.callMethod]","wrapper:",c),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","callMethod")));case 6:case"end":return n.stop()}}),n)}))),function(t){return r.apply(this,arguments)})},{key:"getCreateMethodData",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","getCreateMethodData")))}},{key:"getDeleteMethodData",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","getDeleteMethodData")))}},{key:"getReadMethodData",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","getReadMethodData")))}},{key:"getUpdateMethodData",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","getUpdateMethodData")))}},{key:"isAuthenticationFailedError",value:function(t){throw console.log("[ApiTransport.isAuthenticationFailedError]","error:",t),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","isAuthenticationFailedError")))}},{key:"isSessionExpiredError",value:function(t){throw console.log("[ApiTransport.isSessionExpiredError]","error:",t),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","isSessionExpiredError")))}}]),t}(),S=r(506),R=r.n(S);const j=require("events");var N=r.n(j),L=r(713),C=r.n(L);function I(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return W(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){c=!0,a=t},f:function(){try{i||null==r["return"]||r["return"]()}finally{if(c)throw a}}}}function W(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function q(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?F(Object(r),!0).forEach((function(e){C()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var G={Connected:"connected",Connecting:"connecting",Disconnected:"disconnected",Disconnecting:"disconnecting"},U={delay:1e3,delayFactor:2,maxDelay:32e3},B=function(){function t(e){var r=e.onError,n=e.realtimeTransport,o=e.reconnectConfig,a=void 0===o?{}:o,i=e.wrapper;u()(this,t),this._connectionState=G.Disconnected,this._onError=r,this._realtimeTransport=n,this._reconnectConfig=q(q({},U),a),this._reconnectDelay=this._reconnectConfig.delay,this._subscriptions=new Set,this._wrapper=i}return l()(t,[{key:"getRealtimeTransport",value:function(){return this._realtimeTransport}},{key:"getWrapper",value:function(){return this._wrapper}},{key:"subscribe",value:function(t){var e=this,r=t.callbacks,n=t.isPrivate,o=void 0!==n&&n,a=t.subscriptionData,i=this.getRealtimeTransport(),c={callbacks:r,isPrivate:o,subscriptionData:a,isSubscribed:!1};switch(this._subscriptions.add(c),this._connectionState){case G.Disconnected:this._connect();break;case G.Connected:this._subscribe(c)}return function(){if(c.isSubscribed&&i.unsubscribe({subscriptionData:a}),e._subscriptions["delete"](c),e._subscriptions.size<1){if([G.Disconnected,G.Disconnecting].includes(e._connectionState))return;e._disconnect()}}}},{key:"_connect",value:function(){var t=this;this._connectionState=G.Connecting,this.getRealtimeTransport().connect({onConnect:function(){return t._handleConnect()},onDisconnect:function(e){return t._handleDisconnect(e)},wrapper:this.getWrapper()})}},{key:"_disconnect",value:function(){this._connectionState=G.Disconnecting,this.getRealtimeTransport().disconnect()}},{key:"_handleConnect",value:function(){this._reconnectDelay=this._reconnectConfig.delay,this._connectionState=G.Connected;var t,e=I(this._subscriptions);try{for(e.s();!(t=e.n()).done;){var r=t.value;r.isSubscribed||this._subscribe(r)}}catch(n){e.e(n)}finally{e.f()}}},{key:"_handleDisconnect",value:function(t){var e=this,r=this._connectionState===G.Disconnecting;this._connectionState=G.Disconnected,t?this._onError(t):this._subscriptions.size<1||(r?this._connect():(this._reconnectDelay<this._reconnectConfig.maxDelay&&(this._reconnectDelay*=this._reconnectConfig.delayFactor),setTimeout((function(){return e._connect()}),this._reconnectDelay)))}},{key:"_subscribe",value:function(t){var e=t.callbacks,r=t.isPrivate,n=t.subscriptionData;this.getRealtimeTransport().subscribe({callbacks:e,isPrivate:r,subscriptionData:n,onSubscribe:function(){t.isSubscribed=!0},onUnsubscribe:function(){t.isSubscribed=!1}})}}]),t}();function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b()(t);if(e){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var Y=new Map,$=function(t){y()(m,t);var r,n,o,i,s,p,f,d,v=z(m);function m(t){var r,n=t.authenticator,o=t.realtimeTransport,i=t.reconnectConfig,c=void 0===i?{}:i,s=t.transport;if(u()(this,m),!n)throw e()(M,a()(M.createParameterNotProvidedErrorArgs("authenticator","ApiWrapper","constructor")));if(!o)throw e()(M,a()(M.createParameterNotProvidedErrorArgs("realtimeTransport","ApiWrapper","constructor")));if(!s)throw e()(M,a()(M.createParameterNotProvidedErrorArgs("transport","ApiWrapper","constructor")));return(r=v.call(this))._authenticator=n,r._realtimeTransportWrapper=new B({realtimeTransport:o,reconnectConfig:c,onError:r._handleRealtimeTransportWrapperError,wrapper:R()(r)}),r._transport=s,r}return l()(m,[{key:"authenticate",value:(d=c()(h().mark((function g(){var t,r,n;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t=this.getAuthenticator(),o.prev=1,o.next=4,this._getAuthenticationPromise();case 4:return r=o.sent,o.next=7,t.saveAuthenticationData(r);case 7:return o.abrupt("return",r);case 10:if(o.prev=10,o.t0=o["catch"](1),!this.getTransport().isAuthenticationFailedError(o.t0)){o.next=16;break}throw n=e()(M,a()(M.createAuthenticationFailedErrorArgs(o.t0,"ApiWrapper","authenticate"))),this.emit("error",n),n;case 16:throw this.emit("error",o.t0),o.t0;case 18:case"end":return o.stop()}}),g,this,[[1,10]])}))),function(){return d.apply(this,arguments)})},{key:"callMethod",value:(f=c()(h().mark((function b(t){var e,r,n=arguments;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return e=n.length>1&&n[1]!==undefined?n[1]:null,r=n.length>2&&n[2]!==undefined&&n[2],o.next=4,this._callMethod({isPrivate:r,methodData:t,requestData:e});case 4:return o.abrupt("return",o.sent);case 5:case"end":return o.stop()}}),b,this)}))),function(t){return f.apply(this,arguments)})},{key:"create",value:(p=c()(h().mark((function x(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getCreateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),x,this)}))),function(){return p.apply(this,arguments)})},{key:"delete",value:(s=c()(h().mark((function _(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getDeleteMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),_,this)}))),function(){return s.apply(this,arguments)})},{key:"getAuthenticationData",value:(i=c()(h().mark((function w(){var t,e;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=this.getAuthenticator(),r.next=3,t.loadAuthenticationData();case 3:if(e=r.sent){r.next=8;break}return r.next=7,this.authenticate();case 7:e=r.sent;case 8:return r.abrupt("return",e);case 9:case"end":return r.stop()}}),w,this)}))),function(){return i.apply(this,arguments)})},{key:"getAuthenticator",value:function(){return this._authenticator}},{key:"getRealtimeTransportWrapper",value:function(){return this._realtimeTransportWrapper}},{key:"getTransport",value:function(){return this._transport}},{key:"read",value:(o=c()(h().mark((function A(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getReadMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),A,this)}))),function(){return o.apply(this,arguments)})},{key:"subscribe",value:function(t,e){var r=arguments.length>2&&arguments[2]!==undefined&&arguments[2];return this.getRealtimeTransportWrapper().subscribe({callbacks:e,isPrivate:r,subscriptionData:t})}},{key:"update",value:(n=c()(h().mark((function D(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getUpdateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),D,this)}))),function(){return n.apply(this,arguments)})},{key:"_callMethod",value:(r=c()(h().mark((function k(){var t,e,r,n,o,a,i,c,s,u,p=arguments;return h().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(t=p.length>0&&p[0]!==undefined?p[0]:{},e=t.isPrivate,r=void 0!==e&&e,n=t.isRetry,o=void 0!==n&&n,a=t.methodData,i=t.requestData,c=void 0===i?null:i,s=this.getTransport(),!r){l.next=8;break}return l.next=5,this.getAuthenticationData();case 5:l.t0=l.sent,l.next=9;break;case 8:l.t0=null;case 9:return u=l.t0,l.prev=10,l.next=13,s.callMethod({authenticationData:u,methodData:a,requestData:c,wrapper:this});case 13:return l.abrupt("return",l.sent);case 16:if(l.prev=16,l.t1=l["catch"](10),o||!s.isSessionExpiredError(l.t1)){l.next=24;break}return l.next=21,this.authenticate();case 21:return l.next=23,this._callMethod({isPrivate:r,methodData:a,requestData:c,isRetry:!0});case 23:return l.abrupt("return",l.sent);case 24:throw this.emit("error",l.t1),l.t1;case 26:case"end":return l.stop()}}),k,this,[[10,16]])}))),function(){return r.apply(this,arguments)})},{key:"_getAuthenticationPromise",value:function(){var t=this,e=this.getAuthenticator(),r=Y.get(e);return r||(r=c()(h().mark((function n(){var r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e.loadAuthenticationData();case 2:return r=n.sent,n.next=5,e.authenticate(t,r);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))(),Y.set(e,r),c()(h().mark((function o(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:t.next=7;break;case 5:t.prev=5,t.t0=t["catch"](0);case 7:return t.prev=7,Y["delete"](e),t.finish(7);case 10:case"end":return t.stop()}}),o,null,[[0,5,7,10]])})))(),r)}},{key:"_handleRealtimeTransportWrapperError",value:function(t){this.emit("error",e()(M,a()(M.createRealtimeTransportErrorArgs(t,"ApiWrapper","_handleRealtimeTransportWrapperEvent"))))}}]),m}(N())})(),n})()})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.apiWrapper=e():t.apiWrapper=e()}(global,(()=>(()=>{var t={228:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports["default"]=t.exports},646:(t,e,r)=>{var n=r(228);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},506:t=>{t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports["default"]=t.exports},926:t=>{function e(t,e,r,n,o,a,i){try{var c=t[a](i),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function c(t){e(i,o,a,c,s,"next",t)}function s(t){e(i,o,a,c,s,"throw",t)}c(undefined)}))}},t.exports.__esModule=!0,t.exports["default"]=t.exports},575:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports["default"]=t.exports},100:(t,e,r)=>{var n=r(489),o=r(67);function a(e,r,i){return o()?(t.exports=a=Reflect.construct,t.exports.__esModule=!0,t.exports["default"]=t.exports):(t.exports=a=function(t,e,r){var o=[null];o.push.apply(o,e);var a=new(Function.bind.apply(t,o));return r&&n(a,r.prototype),a},t.exports.__esModule=!0,t.exports["default"]=t.exports),a.apply(null,arguments)}t.exports=a,t.exports.__esModule=!0,t.exports["default"]=t.exports},913:t=>{function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports["default"]=t.exports},713:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports["default"]=t.exports},754:t=>{function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},205:(t,e,r)=>{var n=r(489);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)},t.exports.__esModule=!0,t.exports["default"]=t.exports},430:t=>{t.exports=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},t.exports.__esModule=!0,t.exports["default"]=t.exports},67:t=>{t.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports["default"]=t.exports},860:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},206:t=>{t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports["default"]=t.exports},585:(t,e,r)=>{var n=r(8)["default"],o=r(506);t.exports=function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)},t.exports.__esModule=!0,t.exports["default"]=t.exports},489:t=>{function e(r,n){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports["default"]=t.exports,e(r,n)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},319:(t,e,r)=>{var n=r(646),o=r(860),a=r(379),i=r(206);t.exports=function(t){return n(t)||o(t)||a(t)||i()},t.exports.__esModule=!0,t.exports["default"]=t.exports},8:t=>{function e(r){return t.exports=e="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.exports.__esModule=!0,t.exports["default"]=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports["default"]=t.exports},379:(t,e,r)=>{var n=r(228);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports["default"]=t.exports},957:(t,e,r)=>{var n=r(754),o=r(489),a=r(430),i=r(100);function c(e){var r="function"==typeof Map?new Map:undefined;return t.exports=c=function(t){if(null===t||!a(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return i(t,arguments,n(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)},t.exports.__esModule=!0,t.exports["default"]=t.exports,c(e)}t.exports=c,t.exports.__esModule=!0,t.exports["default"]=t.exports},757:(t,e,r)=>{t.exports=r(666)},666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(S){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,a=Object.create(o.prototype),i=new T(n||[]);return a._invoke=function(t,e,r){var n=l;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw a;return P()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=k(i,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var s=p(t,e,r);if("normal"===s.type){if(n=r.done?d:f,s.arg===y)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=d,r.method="throw",r.arg=s.arg)}}}(t,r,i),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(S){return{type:"throw",arg:S}}}t.wrap=u;var l="suspendedStart",f="suspendedYield",h="executing",d="completed",y={};function v(){}function m(){}function g(){}var b={};s(b,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(O([])));_&&_!==r&&n.call(_,a)&&(b=_);var w=g.prototype=v.prototype=Object.create(b);function A(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function D(t,e){function r(o,a,i,c){var s=p(t[o],t,a);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(l).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(s.arg)}var o;this._invoke=function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}}function k(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator["return"]&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=p(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}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 M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function O(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:P}}function P(){return{value:e,done:!0}}return m.prototype=g,s(w,"constructor",g),s(g,"constructor",m),m.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},A(D.prototype),s(D.prototype,i,(function(){return this})),t.AsyncIterator=D,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new D(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},A(w),s(w,c,"Generator"),s(w,a,(function(){return this})),s(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},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 r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):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),y},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),M(r),y}},"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;M(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:O(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(r){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}},e={};function r(n){var o=e[n];if(o!==undefined)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{ApiAuthenticator:()=>T,ApiError:()=>M,ApiRealtimeTransport:()=>O,ApiTransport:()=>P,ApiWrapper:()=>$});var t=r(100),e=r.n(t),o=r(319),a=r.n(o),i=r(926),c=r.n(i),s=r(575),u=r.n(s),p=r(913),l=r.n(p),f=r(757),h=r.n(f),d=r(205),y=r.n(d),v=r(585),m=r.n(v),g=r(754),b=r.n(g),x=r(957);function _(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b()(t);if(e){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var w="api_wrapper/authentication_failed",A="api_wrapper/method_not_implemented",D="api_wrapper/parameter_not_provided",k="api_wrapper/realtime_transport",E="api_wrapper/unexpected",M=function(t){y()(r,t);var e=_(r);function r(){var t,n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:E,o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:n,a=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return u()(this,r),(t=e.call(this,o)).code=n,t.data=a,t}return l()(r,null,[{key:"createAuthenticationFailedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[w,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Authentication failed"),{className:e,methodName:r,originalError:t,place:n}]}},{key:"createMethodNotImplementedErrorArgs",value:function(t,e){return[A,"[".concat(t,".").concat(e,"] Method not implemented: ").concat(e),{className:t,methodName:e}]}},{key:"createParameterNotProvidedErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[D,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Parameter not provided: ").concat(t),{className:e,methodName:r,parameterName:t,place:n}]}},{key:"createRealtimeTransportErrorArgs",value:function(t,e,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;return[k,"[".concat(e,".").concat(r).concat(n?"::".concat(n):"","] Realtime transport error: ").concat(t.message),{className:e,methodName:r,originalError:t,place:n}]}}]),r}(r.n(x)()(Error)),T=function(){function t(){u()(this,t)}var r,n,o;return l()(t,[{key:"authenticate",value:(o=c()(h().mark((function i(t,r){return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:throw console.log("[ApiAuthenticator.authenticate]","wrapper:",t),console.log("[ApiAuthenticator.authenticate]","previousAuthenticationData:",r),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiAuthenticator","authenticate")));case 3:case"end":return n.stop()}}),i)}))),function(t,e){return o.apply(this,arguments)})},{key:"loadAuthenticationData",value:(n=c()(h().mark((function s(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiAuthenticator","loadAuthenticationData")));case 1:case"end":return t.stop()}}),s)}))),function(){return n.apply(this,arguments)})},{key:"saveAuthenticationData",value:(r=c()(h().mark((function p(t){return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw console.log("[ApiAuthenticator.saveAuthenticationData]","authenticationData:",t),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiAuthenticator","saveAuthenticationData")));case 2:case"end":return r.stop()}}),p)}))),function(t){return r.apply(this,arguments)})}]),t}(),O=function(){function t(){u()(this,t)}return l()(t,[{key:"connect",value:function(t){var r=t.onConnect,n=t.onDisconnect,o=t.wrapper;throw console.log("[ApiRealtimeTransport.connect]","onConnect:",r),console.log("[ApiRealtimeTransport.connect]","onDisconnect:",n),console.log("[ApiRealtimeTransport.connect]","wrapper:",o),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","connect")))}},{key:"disconnect",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","disconnect")))}},{key:"subscribe",value:function(t){var r=t.callbacks,n=t.isPrivate,o=t.onSubscribe,i=t.onUnsubscribe,c=t.subscriptionData;throw console.log("[ApiRealtimeTransport.subscribe]","callbacks:",r),console.log("[ApiRealtimeTransport.subscribe]","isPrivate:",n),console.log("[ApiRealtimeTransport.subscribe]","onSubscribe:",o),console.log("[ApiRealtimeTransport.subscribe]","onUnsubscribe:",i),console.log("[ApiRealtimeTransport.subscribe]","subscriptionData:",c),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","subscribe")))}},{key:"unsubscribe",value:function(t){var r=t.subscriptionData;throw console.log("[ApiRealtimeTransport.unsubscribe]","subscriptionData:",r),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiRealtimeTransport","unsubscribe")))}}]),t}(),P=function(){function t(){u()(this,t)}var r;return l()(t,[{key:"callMethod",value:(r=c()(h().mark((function n(t){var r,o,i,c;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:throw r=t.authenticationData,o=t.methodData,i=t.requestData,c=t.wrapper,console.log("[ApiTransport.callMethod]","authenticationData:",r),console.log("[ApiTransport.callMethod]","methodData:",o),console.log("[ApiTransport.callMethod]","requestData:",i),console.log("[ApiTransport.callMethod]","wrapper:",c),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","callMethod")));case 6:case"end":return n.stop()}}),n)}))),function(t){return r.apply(this,arguments)})},{key:"getCreateMethodData",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","getCreateMethodData")))}},{key:"getDeleteMethodData",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","getDeleteMethodData")))}},{key:"getReadMethodData",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","getReadMethodData")))}},{key:"getUpdateMethodData",value:function(){throw e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","getUpdateMethodData")))}},{key:"isAuthenticationFailedError",value:function(t){throw console.log("[ApiTransport.isAuthenticationFailedError]","error:",t),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","isAuthenticationFailedError")))}},{key:"isSessionExpiredError",value:function(t){throw console.log("[ApiTransport.isSessionExpiredError]","error:",t),e()(M,a()(M.createMethodNotImplementedErrorArgs("ApiTransport","isSessionExpiredError")))}}]),t}(),S=r(506),R=r.n(S);const j=require("events");var N=r.n(j),L=r(713),C=r.n(L);function I(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return W(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){c=!0,a=t},f:function(){try{i||null==r["return"]||r["return"]()}finally{if(c)throw a}}}}function W(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function q(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?F(Object(r),!0).forEach((function(e){C()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var G={Connected:"connected",Connecting:"connecting",Disconnected:"disconnected",Disconnecting:"disconnecting"},U={delay:1e3,delayFactor:2,maxDelay:32e3},B=function(){function t(e){var r=e.onError,n=e.realtimeTransport,o=e.reconnectConfig,a=void 0===o?{}:o,i=e.wrapper;u()(this,t),this._connectionState=G.Disconnected,this._onError=r,this._realtimeTransport=n,this._reconnectConfig=q(q({},U),a),this._reconnectDelay=this._reconnectConfig.delay,this._subscriptions=new Set,this._wrapper=i}return l()(t,[{key:"getRealtimeTransport",value:function(){return this._realtimeTransport}},{key:"getWrapper",value:function(){return this._wrapper}},{key:"subscribe",value:function(t){var e=this,r=t.callbacks,n=t.isPrivate,o=void 0!==n&&n,a=t.subscriptionData,i=this.getRealtimeTransport(),c={callbacks:r,isPrivate:o,subscriptionData:a,isSubscribed:!1};switch(this._subscriptions.add(c),this._connectionState){case G.Disconnected:this._connect();break;case G.Connected:this._subscribe(c)}return function(){if(c.isSubscribed&&i.unsubscribe({subscriptionData:a}),e._subscriptions["delete"](c),e._subscriptions.size<1){if([G.Disconnected,G.Disconnecting].includes(e._connectionState))return;e._disconnect()}}}},{key:"_connect",value:function(){var t=this;this._connectionState=G.Connecting,this.getRealtimeTransport().connect({onConnect:function(){return t._handleConnect()},onDisconnect:function(e){return t._handleDisconnect(e)},wrapper:this.getWrapper()})}},{key:"_disconnect",value:function(){this._connectionState=G.Disconnecting,this.getRealtimeTransport().disconnect()}},{key:"_handleConnect",value:function(){this._reconnectDelay=this._reconnectConfig.delay,this._connectionState=G.Connected;var t,e=I(this._subscriptions);try{for(e.s();!(t=e.n()).done;){var r=t.value;r.isSubscribed||this._subscribe(r)}}catch(n){e.e(n)}finally{e.f()}}},{key:"_handleDisconnect",value:function(t){var e=this,r=this._connectionState===G.Disconnecting;this._connectionState=G.Disconnected,t?this._onError(t):this._subscriptions.size<1||(r?this._connect():(this._reconnectDelay<this._reconnectConfig.maxDelay&&(this._reconnectDelay*=this._reconnectConfig.delayFactor),setTimeout((function(){return e._connect()}),this._reconnectDelay)))}},{key:"_subscribe",value:function(t){var e=t.callbacks,r=t.isPrivate,n=t.subscriptionData;this.getRealtimeTransport().subscribe({callbacks:e,isPrivate:r,subscriptionData:n,onSubscribe:function(){t.isSubscribed=!0},onUnsubscribe:function(){t.isSubscribed=!1}})}}]),t}();function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b()(t);if(e){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var Y=new Map,$=function(t){y()(m,t);var r,n,o,i,s,p,f,d,v=z(m);function m(t){var r,n=t.authenticator,o=t.realtimeTransport,i=t.reconnectConfig,c=void 0===i?{}:i,s=t.transport;if(u()(this,m),!n)throw e()(M,a()(M.createParameterNotProvidedErrorArgs("authenticator","ApiWrapper","constructor")));if(!o)throw e()(M,a()(M.createParameterNotProvidedErrorArgs("realtimeTransport","ApiWrapper","constructor")));if(!s)throw e()(M,a()(M.createParameterNotProvidedErrorArgs("transport","ApiWrapper","constructor")));return(r=v.call(this))._authenticator=n,r._realtimeTransportWrapper=new B({realtimeTransport:o,reconnectConfig:c,onError:r._handleRealtimeTransportWrapperError,wrapper:R()(r)}),r._transport=s,r}return l()(m,[{key:"authenticate",value:(d=c()(h().mark((function g(){var t,r,n;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t=this.getAuthenticator(),o.prev=1,o.next=4,this._getAuthenticationPromise();case 4:return r=o.sent,o.next=7,t.saveAuthenticationData(r);case 7:return o.abrupt("return",r);case 10:if(o.prev=10,o.t0=o["catch"](1),!this.getTransport().isAuthenticationFailedError(o.t0)){o.next=16;break}throw n=e()(M,a()(M.createAuthenticationFailedErrorArgs(o.t0,"ApiWrapper","authenticate"))),this.emit("error",n),n;case 16:throw this.emit("error",o.t0),o.t0;case 18:case"end":return o.stop()}}),g,this,[[1,10]])}))),function(){return d.apply(this,arguments)})},{key:"callMethod",value:(f=c()(h().mark((function b(t){var e,r,n=arguments;return h().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return e=n.length>1&&n[1]!==undefined?n[1]:null,r=n.length>2&&n[2]!==undefined&&n[2],o.next=4,this._callMethod({isPrivate:r,methodData:t,requestData:e});case 4:return o.abrupt("return",o.sent);case 5:case"end":return o.stop()}}),b,this)}))),function(t){return f.apply(this,arguments)})},{key:"create",value:(p=c()(h().mark((function x(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getCreateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),x,this)}))),function(){return p.apply(this,arguments)})},{key:"delete",value:(s=c()(h().mark((function _(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getDeleteMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),_,this)}))),function(){return s.apply(this,arguments)})},{key:"getAuthenticationData",value:(i=c()(h().mark((function w(){var t,e;return h().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=this.getAuthenticator(),r.next=3,t.loadAuthenticationData();case 3:if(e=r.sent){r.next=8;break}return r.next=7,this.authenticate();case 7:e=r.sent;case 8:return r.abrupt("return",e);case 9:case"end":return r.stop()}}),w,this)}))),function(){return i.apply(this,arguments)})},{key:"getAuthenticator",value:function(){return this._authenticator}},{key:"getRealtimeTransportWrapper",value:function(){return this._realtimeTransportWrapper}},{key:"getTransport",value:function(){return this._transport}},{key:"read",value:(o=c()(h().mark((function A(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getReadMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),A,this)}))),function(){return o.apply(this,arguments)})},{key:"subscribe",value:function(t,e){var r=arguments.length>2&&arguments[2]!==undefined&&arguments[2];return this.getRealtimeTransportWrapper().subscribe({callbacks:e,isPrivate:r,subscriptionData:t})}},{key:"update",value:(n=c()(h().mark((function D(){var t,e,r=arguments;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=r.length>0&&r[0]!==undefined?r[0]:null,e=r.length>1&&r[1]!==undefined&&r[1],n.next=4,this._callMethod({isPrivate:e,requestData:t,methodData:this.getTransport().getUpdateMethodData()});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),D,this)}))),function(){return n.apply(this,arguments)})},{key:"_callMethod",value:(r=c()(h().mark((function k(){var t,e,r,n,o,a,i,c,s,u,p=arguments;return h().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(t=p.length>0&&p[0]!==undefined?p[0]:{},e=t.isPrivate,r=void 0!==e&&e,n=t.isRetry,o=void 0!==n&&n,a=t.methodData,i=t.requestData,c=void 0===i?null:i,s=this.getTransport(),!r){l.next=8;break}return l.next=5,this.getAuthenticationData();case 5:l.t0=l.sent,l.next=9;break;case 8:l.t0=null;case 9:return u=l.t0,l.prev=10,l.next=13,s.callMethod({authenticationData:u,methodData:a,requestData:c,wrapper:this});case 13:return l.abrupt("return",l.sent);case 16:if(l.prev=16,l.t1=l["catch"](10),o||!s.isSessionExpiredError(l.t1)){l.next=24;break}return l.next=21,this.authenticate();case 21:return l.next=23,this._callMethod({isPrivate:r,methodData:a,requestData:c,isRetry:!0});case 23:return l.abrupt("return",l.sent);case 24:throw this.emit("error",l.t1),l.t1;case 26:case"end":return l.stop()}}),k,this,[[10,16]])}))),function(){return r.apply(this,arguments)})},{key:"_getAuthenticationPromise",value:function(){var t=this,e=this.getAuthenticator(),r=Y.get(e);return r||(r=c()(h().mark((function n(){var r;return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e.loadAuthenticationData();case 2:return r=n.sent,n.next=5,e.authenticate(t,r);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))(),Y.set(e,r),c()(h().mark((function o(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:t.next=7;break;case 5:t.prev=5,t.t0=t["catch"](0);case 7:return t.prev=7,Y["delete"](e),t.finish(7);case 10:case"end":return t.stop()}}),o,null,[[0,5,7,10]])})))(),r)}},{key:"_handleRealtimeTransportWrapperError",value:function(t){this.emit("error",e()(M,a()(M.createRealtimeTransportErrorArgs(t,"ApiWrapper","_handleRealtimeTransportWrapperEvent"))))}}]),m}(N())})(),n})())); | ||
//# sourceMappingURL=index.node.js.map |
{ | ||
"name": "@ololoepepe/api-wrapper", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"description": "A wrapper around your API calls", | ||
@@ -27,20 +27,20 @@ "main": "dist/index.node.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.16.12", | ||
"@babel/eslint-parser": "^7.16.5", | ||
"@babel/register": "^7.16.9", | ||
"@babel/runtime": "^7.16.7", | ||
"@ololoepepe/babel-preset-default": "^0.1.26", | ||
"babel-loader": "^8.2.3", | ||
"copy-webpack-plugin": "^10.2.1", | ||
"core-js": "^3.20.3", | ||
"eslint": "^8.7.0", | ||
"eslint-config-xo": "^0.39.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"mocha": "^9.2.0", | ||
"@babel/core": "^7.17.8", | ||
"@babel/eslint-parser": "^7.17.0", | ||
"@babel/register": "^7.17.7", | ||
"@babel/runtime": "^7.17.8", | ||
"@ololoepepe/babel-preset-default": "^0.1.27", | ||
"babel-loader": "^8.2.4", | ||
"copy-webpack-plugin": "^10.2.4", | ||
"core-js": "^3.21.1", | ||
"eslint": "^8.12.0", | ||
"eslint-config-xo": "^0.40.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"mocha": "^9.2.2", | ||
"regenerator-runtime": "^0.13.9", | ||
"terser-webpack-plugin": "^5.3.0", | ||
"terser-webpack-plugin": "^5.3.1", | ||
"test-console": "^2.0.0", | ||
"webpack": "^5.67.0", | ||
"webpack": "^5.71.0", | ||
"webpack-cli": "^4.9.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
251135