Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

futoin-invoker

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

futoin-invoker - npm Package Compare versions

Comparing version 2.4.7 to 2.4.8

3

CHANGELOG.txt

@@ -0,1 +1,4 @@

=== 2.4.8 (2021-08-14) ===
FIXED: support binary message support in JSON coder
=== 2.4.7 (2021-08-14) ===

@@ -2,0 +5,0 @@ CHANGED: dependency maintenance

2

dist/futoin-invoker-lite.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("futoin-asyncsteps"),require("futoin-asyncevent")):"function"==typeof define&&define.amd?define(["futoin-asyncsteps","futoin-asyncevent"],t):"object"==typeof exports?exports["futoin-invoker"]=t(require("futoin-asyncsteps"),require("futoin-asyncevent")):e.FutoInInvoker=t(e.$as,e.$asyncevent)}(self,(function(__WEBPACK_EXTERNAL_MODULE__4495__,__WEBPACK_EXTERNAL_MODULE__8754__){return(()=>{var __webpack_modules__={7724:e=>{"use strict";function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._raw_info=t}var r,n;return r=e,(n=[{key:"name",value:function(){return this._raw_info.iface}},{key:"version",value:function(){return this._raw_info.version}},{key:"inherits",value:function(){return this._raw_info.inherits}},{key:"funcs",value:function(){return this._raw_info.funcs}},{key:"constraints",value:function(){return this._raw_info.constraints}}])&&t(r.prototype,n),e}();e.exports=r},6845:e=>{"use strict";function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r={},n=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,o,i;return n=e,i=[{key:"detect",value:function(e){if("string"==typeof e&&"{"==e[0])return r.JSON;for(var t in r){var n=r[t];if(n.detect(e))return n}return r.JSON}},{key:"registerCoder",value:function(e,t){r[e]=t}},{key:"get",value:function(e){var t=r.hasOwnProperty(e)&&r[e];if(!t)throw new Error("Missing coder: ".concat(e));return t}}],(o=[{key:"isBinary",value:function(){return!1}},{key:"name",value:function(){return"Unknown"}}])&&t(n.prototype,o),i&&t(n,i),e}();e.exports=n},8312:(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}module=__webpack_require__.nmd(module);var $asyncevent=__webpack_require__(8754),$as=__webpack_require__(4495),common=__webpack_require__(4337),_common$FutoInError=common.FutoInError,InvokerError=_common$FutoInError.InvokerError,CommError=_common$FutoInError.CommError,InterfaceInfo=__webpack_require__(7724),Options=common.Options,SAFE_PAYLOAD_LIMIT=Options.SAFE_PAYLOAD_LIMIT,assertAS=Options.prodMode?function(){}:$as.assertAS,NativeIface=function(){function NativeIface(_ccmimpl,_info){var _this=this;_classCallCheck(this,NativeIface),$asyncevent(this,["connect","disconnect","close","commError"]);var ccmimpl=_ccmimpl,info=_info;this._ccmimpl=ccmimpl,this._raw_info=info,this._iface_info=null,this._comms={};var limitZone=info.limitZone,options=info.options,endpoint=info.endpoint,endpoint_scheme=info.endpoint_scheme,coder=info.coder,funcs=info.funcs,signMessage=info.signMessage,callTimeoutMS=options.callTimeoutMS,custom_create_ctx,custom_perform;switch(endpoint_scheme){case"#internal#":custom_create_ctx=function(e,t,r){return{ccmimpl,name:e,info,upload_data:t,download_stream:r,options,endpoint,expect_response:!0,max_rsp_size:0,max_req_size:0}},custom_perform=function(e,t,r){signMessage(e,t,r),endpoint.onInternalRequest(e,info,r,t.upload_data,t.download_stream)};break;case"http":case"https":custom_perform=function(e,t,r){ccmimpl.perfomHTTP(e,t,r)};break;case"ws":case"wss":custom_perform=function(e,t,r){var n,o=t.download_stream||funcs&&(n=funcs[t.name])&&n.rawresult;o||t.upload_data?(t.endpoint=endpoint.replace("ws","http"),t.rawresult=o,ccmimpl.perfomHTTP(e,t,r)):ccmimpl.perfomWebSocket(e,t,r)};break;case"browser":custom_perform=function(e,t,r){forbid_rawdata(e,t),ccmimpl.perfomBrowser(e,t,r)};break;case"unix":custom_perform=function(e,t,r){forbid_rawdata(e,t),ccmimpl.perfomUNIX(e,t,r)};break;case"callback":custom_perform=function(e,t,r){forbid_rawdata(e,t),endpoint(e,t,r)};break;default:custom_perform=function(e){e.error(InvokerError,"Unknown endpoint scheme: ".concat(endpoint_scheme))}}var create_ctx=custom_create_ctx||function(e,t,r){return{ccmimpl,name:e,info,upload_data:t,download_stream:r,rawresult:!1,rsp_content_type:null,native_iface:_this,options,endpoint,msg_coder:coder,expect_response:!0,signMessage,max_rsp_size:SAFE_PAYLOAD_LIMIT,max_req_size:SAFE_PAYLOAD_LIMIT}},perform=custom_perform,handle_timeout=function(e,t){"number"!=typeof t&&(t=callTimeoutMS),t>0&&e.setTimeout(t)},forbid_rawdata=function(e,t){t.upload_data?e.error(InvokerError,"Upload data is allowed only for HTTP/WS endpoints"):t.download_stream&&e.error(InvokerError,"Download stream is allowed only for HTTP/WS endpoints")},limiters=ccmimpl.limiters,sync_limit=function(){if("unlimited"===limitZone){var e=function(e,t,r,n,o){e.add((function(e){handle_timeout(e,o),t(e,r,n)}))};return"#internal#"===endpoint_scheme?function(t,r,n,o,i){i?e(t,r,n,o,i):r(t,n,o)}:e}return function(e,t,r,n,o){e.sync(limiters[limitZone],(function(e){handle_timeout(e,o),t(e,r,n)}))}}(),handle_response=function(e,t,r,n){if(t.download_stream)e.success(!0);else if(n){if(r instanceof Uint8Array||"string"==typeof r)try{r=t.msg_coder.decode(r)}catch(t){e.error(CommError,"Decode: "+t.message)}ccmimpl.onMessageResponse(e,t,r)}else ccmimpl.onDataResponse(e,t,r)},call=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;assertAS(e),r=r||{};var a=create_ctx(t,n,o);Object.seal(a);var c=ccmimpl.createMessage(e,a,r);sync_limit(e,perform,a,c,i),a.expect_response&&e.add((function(e,t,r){return handle_response(e,a,t,r)}))};Object.defineProperty(this,"call",{value:call,configurable:!1,enumerable:!1,writeable:!1});var member_call_generate_eval=function member_call_generate_eval(name,finfo){for(var src=[],params=finfo.params,plist=Object.keys(params),pmap=[],_i=0,_plist=plist;_i<_plist.length;_i++){var p=_plist[_i];void 0===params[p].default&&pmap.push("".concat(p,":").concat(p))}var args=["as"].concat(plist);src.push("(function (".concat(args.join(","),") {")),src.push("'use strict';"),src.push("var params = {".concat(pmap.join(","),"};"));for(var _i2=0,_plist2=plist;_i2<_plist2.length;_i2++){var _p=_plist2[_i2];void 0!==params[_p].default&&src.push("if (".concat(_p," !== undefined) params.").concat(_p," = ").concat(_p,";"))}return src.push('return call(as, "'.concat(name,'", params);')),src.push("})"),eval(src.join(""))};for(var fn in funcs){var finfo=funcs[fn];finfo.rawupload||fn in this||Object.defineProperty(this,fn,{value:member_call_generate_eval(fn,finfo),configurable:!1,enumerable:!1,writeable:!1})}}return _createClass(NativeIface,[{key:"ifaceInfo",value:function(){return this._iface_info||(this._iface_info=new InterfaceInfo(this._raw_info))}},{key:"bindDerivedKey",value:function(e){throw new Error(InvokerError,"Not Implemented")}},{key:"_close",value:function(){var e=this._comms;for(var t in e)e[t].close();this.emit("close")}}],[{key:"spec",value:function(e){var t;if(this._specs&&(t=this._specs[e]),!t&&this._specs_module_prefix){var r=this._specs_module_prefix+e.replace(".","_");t=module.require(r)}return t}}]),NativeIface}();NativeIface._specs=null,NativeIface._specs_module_prefix=null,module.exports=NativeIface},4485:(e,t,r)=>{"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=r(4337),c=a.FutoInError,s=c.InvokerError,u=c.SecurityError,f=r(8312),l=r(2205),p=r(2266),_=r(8754),m=r(4495).Limiter,v=a.Options,d=/^secure\+/,h=/^(https|wss|unix):\/\//,y=function(e,t){return new f(e,t)},b=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;o(this,e),_(this,["register","unregister","close"]),this._iface_info={},this._iface_instance={},this._impl=r||new p(t),this.limitZone("default",{concurrent:8,max_queue:32,rate:10,period_ms:1e3,burst:null})}var t,r;return t=e,(r=[{key:"register",value:function(e,t,r,o,i){var c=this,f=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},l=null===t;!l&&t in this._iface_info&&e.error(s,"Already registered");var p=r.match(a._ifacever_pattern);null===p&&e.error(s,"Invalid ifacever"),f=n({},this._impl.options,f);var _,m=p[a._ifacever_pattern_name],v=p[a._ifacever_pattern_ver],b=p[a._ifacever_pattern_mjr],g=p[a._ifacever_pattern_mnr],w=f.secureChannel||!1,k=null,x=!1,j=!1,O="default";if(l)_="callback",x=!0;else if("string"==typeof o)switch(d.test(o)?(w=!0,o=o.replace(d,"")):h.test(o)&&(w=!0),k=y,_=o.split(":")[0]){case"http":case"https":break;case"ws":case"wss":case"unix":x=!0;break;case"browser":f.targetOrigin&&(w=!0),x=!0;break;default:e.error(s,"Unknown endpoint schema")}else"onInternalRequest"in o?(w=!0,k=y,_="#internal#",x=!0,j=!0,i=i||"-internal",O="unlimited"):(w=!0,k=o,o=null,_=null,x=!0,j=!0);(O=f.limitZone||O)in this._impl.limiters||e.error(s,"Unknown limit zone ".concat(O));var C={iface:m,version:v,mjrver:b,mnrver:g,endpoint:o,endpoint_scheme:_,creds:i||null,creds_master:"master"===i,creds_mac:i&&null!==i.match(/^-[hs]mac:/),secure_channel:w,impl:k,regname:t,inherits:null,funcs:null,constraints:null,options:f,_invoker_use:!0,_user_info:null,_server_executor_context:null,_callback_context:null,limitZone:O,aliases:[]};C.creds_mac&&(i.match(/^-hmac:/)?(f.hmacKey||e.error(s,"Missing options.hmacKey"),f.macKey=f.hmacKey,f.macAlgo=f.hmacAlgo):f.macKey||e.error(s,"Missing options.macKey")),C.creds_master&&!f.masterAuth&&e.error(s,"Missing options.masterAuth"),t&&(this._iface_info[t]=C),e.add((function(e){c._impl.onRegister(e,C),e.add((function(e){C.simple_req||("AllowAnonymous"in C.constraints||C.creds||e.error(u,"Requires authenticated user"),"SecureChannel"in C.constraints&&!w&&e.error(u,"SecureChannel is required"),!("MessageSignature"in C.constraints)||C.creds_master||C.creds_mac||j||e.error(u,"MessageSignature is required"),"BiDirectChannel"in C.constraints&&!x&&e.error(s,"BiDirectChannel is required")),l&&e.success(C,y(c._impl,C)),Object.seal(C),c.emit("register",t,r,C)}))}),(function(e,r){t&&delete c._iface_info[t]}))}},{key:"iface",value:function(e){return this._iface_instance[e]||this._initIface(e)}},{key:"_initIface",value:function(e){var t=this._iface_info[e];if(!t)throw new Error(s);var r=t.regname,n=this._iface_instance,o=n[r];if(!o){var i=t.options.nativeImpl;o=i?new i(this._impl,t):t.impl(this._impl,t),Object.seal(o),n[r]=o}return r!==e&&(n[e]=o),o}},{key:"unRegister",value:function(e){var t=this._iface_info,r=this._iface_instance,n=t[e];if(!n)throw new Error(s);if(n.regname===e){var o=n.aliases,i=r[e];i&&i._close();for(var a=0;a<o.length;++a){var c=o[a];delete t[c],delete r[c]}}else n.aliases.splice(n.aliases.indexOf(e),0);delete t[e],delete r[e],this.emit("unregister",e,n)}},{key:"defense",value:function(){return this.iface(this.SVC_DEFENSE)}},{key:"log",value:function(){return this.iface(this.SVC_LOG)}},{key:"cache",value:function(e){return this.iface(this.SVC_CACHE_+(e||"default"))}},{key:"assertIface",value:function(e,t){var r=this._iface_info[e];if(!r)throw new Error(s);var n=t.match(a._ifacever_pattern);if(null===n)throw new Error(s);var o=n[a._ifacever_pattern_name],i=n[a._ifacever_pattern_mjr],c=n[a._ifacever_pattern_mnr];if(!(r.iface===o&&r.mjrver===i&&r.mnrver>=c)){var u=r.inherits;if(u)for(var f=u.length-1;f>=0;--f){var l=u[f].match(a._ifacever_pattern);if(l[a._ifacever_pattern_name]===o&&l[a._ifacever_pattern_mjr]===i&&l[a._ifacever_pattern_mnr]>=c)return}throw new Error(s)}}},{key:"alias",value:function(e,t){var r=this._iface_info,n=r[e];if(!n||r[t])throw new Error(s);r[t]=n,n.aliases.push(t),this.emit("register",t,"".concat(n.iface,":").concat(n.version),n)}},{key:"close",value:function(){var e=this._iface_instance,t=this._iface_info;for(var r in t){var n=t[r],o=e[r];o&&r===n.regname&&o._close()}this._iface_instance={},this._iface_info={};var i=this._impl,a=i.comms;for(var c in a)a[c].close();i.comms={},this.emit("close")}},{key:"limitZone",value:function(e,t){"unlimited"!==e&&(this._impl.limiters[e]=new m(t))}}])&&i(t.prototype,r),e}();l(b.prototype,v),l(b,v),e.exports=b},7941:(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=r(6845),f="JSON",l=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(_,e);var t,r,n,u,l,p=(u=_,l=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(e){return!1}}(),function(){var e,t=s(u);if(l){var r=s(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return c(this,e)});function _(){return o(this,_),p.apply(this,arguments)}return t=_,n=[{key:"register",value:function(){this.registerCoder(f,new this)}}],(r=[{key:"isBinary",value:function(){return!1}},{key:"name",value:function(){return f}},{key:"contentType",value:function(){return"application/futoin+json"}},{key:"detect",value:function(e){return"string"==typeof e?"{"===e.charAt(0):123===e[0]}},{key:"encode",value:function(e){return JSON.stringify(e)}},{key:"decode",value:function(e){return JSON.parse(e)}}])&&i(t.prototype,r),n&&i(t,n),_}(u);e.exports=l},2266:(e,t,r)=>{"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e=r.nmd(e);var i=r(4337),a=i.FutoInError,c=a.InvokerError,s=a.CommError,u=r(6845),f=i._isNode,l=r(1747),p=f?e.require("./node/comms"):r(5362),_={callTimeoutMS:3e4,prodMode:"object"===("undefined"==typeof process?"undefined":o(process))&&!0,commConfigCallback:null,messageSniffer:function(){},disconnectSniffer:function(){},executor:null,targetOrigin:null,retryCount:1,defaultCoder:"JSON",binaryCoder:"MPCK",secureChannel:!1,commConcurrency:16};Object.freeze(_);var m=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l(t=t||{},_),this.options=t,this.comms={},this.limiters={unlimited:{sync:function(e,t,r){e.add(t,r)}}},this._globalHTTPSecureAgent=null,this._globalHTTPAgent=null,Object.seal(this)}var t,r;return t=e,(r=[{key:"onRegister",value:function(e,t){(t.creds_master||t.creds_mac)&&e.error(c,"Master/HMAC is supported only in AdvancedCCM"),t.funcs={},t.inherits=[],t.constraints={},t.simple_req=!0,t.coder=u.get(t.options.coder||this.options.defaultCoder),t.signMessage=function(){}}},{key:"createMessage",value:function(e,t,r){var n=t.info,o={f:"".concat(n.iface,":").concat(n.version,":").concat(t.name),p:r,forcersp:!0},i=n.creds;return i&&(o.sec=i),o}},{key:"onMessageResponse",value:function(e,t,r){var n=r.e;n?e.error(n,r.edesc):e.success(r.r)}},{key:"onDataResponse",value:function(e,t,r){e.success(r)}},{key:"getComms",value:function(e,t,r,n){var o,i,a=t.options,s=this.options;a.executor!==s.executor||a.messageSniffer!==s.messageSniffer||a.disconnectSniffer!==s.disconnectSniffer||a.commConfigCallback!==s.commConfigCallback?(o=t.native_iface._comms,i=t.info.endpoint_scheme):(o=this.comms,i=t.endpoint+"##"+(t.credentials||"")+"##"+(n||""));var u=o[i];return u||(r||e.error(c,"Not implemented "+t.info.endpoint_scheme+" scheme"),u=new r,o[i]=u),u}},{key:"performCommon",value:function(e,t,r,n){var o,i,a=t.options.retryCount;e.repeat(a+1,(function(e,c){e.add((function(e){n.perform(e,t,r),e.add((function(e,t,r){o=t,i=r,e.break()}))}),(function(e,n){n===s&&(t.native_iface.emit("commError",e.state.error_info,r),c<a&&e.continue())}))})),e.add((function(e){e.success(o,i)}))}},{key:"perfomHTTP",value:function(e,t,r){var n=this.getComms(e,t,p.HTTPComms);this.performCommon(e,t,r,n)}},{key:"perfomWebSocket",value:function(e,t,r){var n=this.getComms(e,t,p.WSComms);this.performCommon(e,t,r,n)}},{key:"perfomUNIX",value:function(e,t,r){e.error(c,"Not implemented unix:// scheme")}},{key:"perfomBrowser",value:function(e,t,r){this.getComms(e,t,p.BrowserComms,t.options.targetOrigin).perform(e,t,r)}}])&&n(t.prototype,r),e}();e.exports=m},5362:(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),e}var c=r(8754),s=r(4337).FutoInError,u=s.InvokerError,f=s.CommError,l=WebSocket,p=r(6845),_=function(){function e(){o(this,e)}return a(e,[{key:"close",value:function(){}},{key:"perform",value:function(e,t,r){var n=this;e.add((function(e){return n._perform(e,t,r)}))}},{key:"_perform",value:function(e,t,r){t.signMessage(e,t,r);var n,o,i=t.options.messageSniffer,a=new XMLHttpRequest,c=t.msg_coder,s=t.endpoint,l=t.upload_data;if(l||""===l){n="application/octet-stream","/"!==s.charAt(s.length-1)&&(s+="/"),s+=r.f.replace(/:/g,"/")+"/";var _=r.sec;_&&(_===t.options.credentials?o="Basic "+window.btoa(_):s+=encodeURIComponent(_)+"/");var m=[];for(var v in r.p){var d=r.p[v];"string"!=typeof d&&(d=JSON.stringify(d)),m.push(encodeURIComponent(v)+"="+encodeURIComponent(d))}s+="?"+m.join("&"),i(t.info,r,!1)}else n=c.contentType(),(l=c.encode(r)).length>t.max_req_size&&e.error(u,"Request message too long: ".concat(l.length," > ").concat(t.max_req_size)),i(t.info,l,!1);t.expect_response&&(t.download_stream&&(a.responseType=t.download_stream),a.onreadystatechange=function(){if(this.readyState===this.DONE){var r=t.download_stream?this.response:this.responseText;if(200===this.status&&r){var n=this.getResponseHeader("content-type")||"",o=n===c.contentType();if(!o&&n.match(/^application\/futoin\+/)){var a=p.detect(r);try{r=a.decode(r),o=!0}catch(e){}}i(t.info,o?r:"%DATA%",!0),e.success(r,o)}else try{e.error(f,"Low error")}catch(e){}}},e.setCancel((function(){return a.abort()}))),a.open("POST",s,!0),a.setRequestHeader("Content-Type",n),o&&a.setRequestHeader("Authorization",o),a.send(l)}}]),e}();t.HTTPComms=_;var m=function(){function e(){o(this,e),this.rid=1,this.reqas={},this.evt={},this.ws=null,c(this.evt,["open"]),this._waiting_open=!1,this.sniffer=null,Object.seal(this)}return a(e,[{key:"init",value:function(e,t){var r=this,n=t.options,o=new l(t.endpoint);this.ws=o,this._waiting_open=!0;var i=this.reqas,a=n.executor||null,c=t.info,s=n.messageSniffer;this.sniffer=s;var u=function(e){for(var a in n.disconnectSniffer(c),o.close(),r.ws=null,r.rid=1,r.reqas={},i)try{i[a].error(f,e.wasClean?"Cleanup":"Error")}catch(e){}r._waiting_open=!1,t.native_iface.emit("disconnect")};o.onclose=u,o.onerror=u,o.onopen=function(e){r._waiting_open=!1,r.evt.emit("open"),t.native_iface.emit("connect")},o.onmessage=function(e){var t=e.data;s(c,t,!0);var r=p.detect(t);try{t=r.decode(t)}catch(e){return void console.log("WS Decode error",e.message,e)}var n=t.rid;if(n){var u=i[n];u?(u.success(t,!0),delete i[n]):"S"===n.charAt(0)&&a&&a.onEndpointRequest(c,t,(function(e){return function(e,t){var r=a.packPayload(e,t);s(c,r,!1),o.send(r)}(r,e)}))}}}},{key:"close",value:function(){this.ws&&(this.ws.close(),this.ws=null)}},{key:"perform",value:function(e,t,r){var n=this;this.ws||this.init(e,t),this._waiting_open&&e.add((function(e){if(n._waiting_open){var t=function(){return e.success()};n.evt.once("open",t),e.setCancel((function(){return n.evt.off("open",t)}))}})),e.add((function(e){return n._perform(e,t,r)}))}},{key:"_perform",value:function(e,t,r){this.ws||e.error(f,"Disconnect while in progress");var n=this.reqas,o="C"+this.rid++;r.rid=o,t.signMessage(e,t,r),t.expect_response&&(n[o]=e,e.setCancel((function(){delete n[o]})));var i=t.msg_coder.encode(r);this.sniffer(t.info,i,!1),this.ws.send(i)}}]),e}();t.WSComms=l?m:_;var v=function(){function e(){o(this,e),this.rid=1,this.reqas={},this.opts=null,this.target=null,this.sniffer=null,Object.seal(this)}return a(e,[{key:"init",value:function(e,t){var r=t.options;this.opts=r;var o,i=t.endpoint.split("://",2)[1];"parent"===i?i=window.parent:i in window&&"postMessage"in window[i]?i=window[i]:(o=document.getElementById(i))?i=o.contentWindow:e.error(f,"Unknown target: "+i),i===window&&e.error(f,"Target matches current window"),this.target=i;var a=this.reqas,c=r.executor||null,s=t.info,u=r.targetOrigin,l=r.messageSniffer;this.sniffer=l;var p=function(e){l(u,e,!1),i.postMessage(e,u||"*")};window.addEventListener("message",(function(e){if(l(s,e.data,!0),!e.source||e.source===i){if(u&&e.origin!==u)return console.log("Error: peer origin mismatch "),console.log("Error >origin: "+e.origin),void console.log("Error >required: "+u);var t=e.data;if("object"===n(t)){var r=t.rid;if(r){if("f"in t){if(!("f"in t)||"S"!==r.charAt(0)||!c)return;c.onEndpointRequest(s,t,p)}else{var o=a[r];o&&(o.success(t,!0),delete a[r])}e.stopPropagation&&e.stopPropagation()}}else console.log("Not object response: "+t)}}),!1),t.native_iface.emit("connect")}},{key:"close",value:function(){this.target&&(this.target=null)}},{key:"perform",value:function(e,t,r){var n=this;(t.upload_data||t.download_stream)&&e.error(f,"Raw Data is not supported by Web Messaging yet"),this.target||this.init(e,t),e.add((function(e){var o=n.reqas,i="C"+n.rid++;r.rid=i,t.signMessage(e,t,r),t.expect_response&&(o[i]=e,e.setCancel((function(){delete o[i]}))),n.sniffer(t.info,r,!1),n.target.postMessage(r,n.opts.targetOrigin||"*")}))}}]),e}();t.BrowserComms=v},7138:(e,t,r)=>{"use strict";!function(t){var n=t.FutoIn||t.futoin||{};if(void 0===n.Invoker){r(7941).register();var o=r(4485);t.SimpleCCM=o,n.SimpleCCM=o,t.FutoIn=n,t.futoin=n,n.Invoker={SimpleCCM:o}}e.exports=n.Invoker}(window)},4337:(e,t,r)=>{"use strict";var n=r(4495);t.AsyncSteps=n,t.FutoInError=n.FutoInError,t.Options={SAFE_PAYLOAD_LIMIT:65536,SVC_RESOLVER:"#resolver",SVC_AUTH:"#auth",SVC_DEFENSE:"#defense",SVC_ACL:"#acl",SVC_LOG:"#log",SVC_CACHE_:"#cache."},t._ifacever_pattern=/^(([a-z][a-z0-9]*)(\.[a-z][a-z0-9]*)*):(([0-9]+)\.([0-9]+))$/,t._ifacever_pattern_name=1,t._ifacever_pattern_ver=4,t._ifacever_pattern_mjr=5,t._ifacever_pattern_mnr=6,t._isNode="undefined"==typeof window&&r(5643)},5643:e=>{e.exports=!1},2705:(e,t,r)=>{var n=r(5639).Symbol;e.exports=n},6874:e=>{e.exports=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}},4636:(e,t,r)=>{var n=r(2545),o=r(5694),i=r(1469),a=r(4144),c=r(5776),s=r(6719),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r=i(e),f=!r&&o(e),l=!r&&!f&&a(e),p=!r&&!f&&!l&&s(e),_=r||f||l||p,m=_?n(e.length,String):[],v=m.length;for(var d in e)!t&&!u.call(e,d)||_&&("length"==d||l&&("offset"==d||"parent"==d)||p&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||c(d,v))||m.push(d);return m}},4865:(e,t,r)=>{var n=r(9465),o=r(7813),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,r){var a=e[t];i.call(e,t)&&o(a,r)&&(void 0!==r||t in e)||n(e,t,r)}},9465:(e,t,r)=>{var n=r(8777);e.exports=function(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}},4239:(e,t,r)=>{var n=r(2705),o=r(9607),i=r(2333),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},9454:(e,t,r)=>{var n=r(4239),o=r(7005);e.exports=function(e){return o(e)&&"[object Arguments]"==n(e)}},8458:(e,t,r)=>{var n=r(3560),o=r(5346),i=r(3218),a=r(346),c=/^\[object .+?Constructor\]$/,s=Function.prototype,u=Object.prototype,f=s.toString,l=u.hasOwnProperty,p=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(n(e)?p:c).test(a(e))}},8749:(e,t,r)=>{var n=r(4239),o=r(1780),i=r(7005),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!a[n(e)]}},313:(e,t,r)=>{var n=r(3218),o=r(5726),i=r(3498),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=o(e),r=[];for(var c in e)("constructor"!=c||!t&&a.call(e,c))&&r.push(c);return r}},5976:(e,t,r)=>{var n=r(6557),o=r(5357),i=r(61);e.exports=function(e,t){return i(o(e,t,n),e+"")}},6560:(e,t,r)=>{var n=r(5703),o=r(8777),i=r(6557),a=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i;e.exports=a},2545:e=>{e.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},7518:e=>{e.exports=function(e){return function(t){return e(t)}}},8363:(e,t,r)=>{var n=r(4865),o=r(9465);e.exports=function(e,t,r,i){var a=!r;r||(r={});for(var c=-1,s=t.length;++c<s;){var u=t[c],f=i?i(r[u],e[u],u,r,e):void 0;void 0===f&&(f=e[u]),a?o(r,u,f):n(r,u,f)}return r}},4429:(e,t,r)=>{var n=r(5639)["__core-js_shared__"];e.exports=n},1463:(e,t,r)=>{var n=r(5976),o=r(6612);e.exports=function(e){return n((function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,c=i>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,c&&o(r[0],r[1],c)&&(a=i<3?void 0:a,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,a)}return t}))}},8777:(e,t,r)=>{var n=r(852),o=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},1957:e=>{var t="object"==typeof global&&global&&global.Object===Object&&global;e.exports=t},852:(e,t,r)=>{var n=r(8458),o=r(7801);e.exports=function(e,t){var r=o(e,t);return n(r)?r:void 0}},9607:(e,t,r)=>{var n=r(2705),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,c=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,c),r=e[c];try{e[c]=void 0;var n=!0}catch(e){}var o=a.call(e);return n&&(t?e[c]=r:delete e[c]),o}},7801:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},5776:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}},6612:(e,t,r)=>{var n=r(7813),o=r(8612),i=r(5776),a=r(3218);e.exports=function(e,t,r){if(!a(r))return!1;var c=typeof t;return!!("number"==c?o(r)&&i(t,r.length):"string"==c&&t in r)&&n(r[t],e)}},5346:(e,t,r)=>{var n,o=r(4429),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!i&&i in e}},5726:e=>{var t=Object.prototype;e.exports=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}},3498:e=>{e.exports=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}},1167:(e,t,r)=>{e=r.nmd(e);var n=r(1957),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o&&n.process,c=function(){try{return i&&i.require&&i.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=c},2333:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},5357:(e,t,r)=>{var n=r(6874),o=Math.max;e.exports=function(e,t,r){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,c=o(i.length-t,0),s=Array(c);++a<c;)s[a]=i[t+a];a=-1;for(var u=Array(t+1);++a<t;)u[a]=i[a];return u[t]=r(s),n(e,this,u)}}},5639:(e,t,r)=>{var n=r(1957),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},61:(e,t,r)=>{var n=r(6560),o=r(1275)(n);e.exports=o},1275:e=>{var t=Date.now;e.exports=function(e){var r=0,n=0;return function(){var o=t(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}},346:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},3045:(e,t,r)=>{var n=r(8363),o=r(1463),i=r(1704),a=o((function(e,t){n(t,i(t),e)}));e.exports=a},5703:e=>{e.exports=function(e){return function(){return e}}},1747:(e,t,r)=>{var n=r(5976),o=r(7813),i=r(6612),a=r(1704),c=Object.prototype,s=c.hasOwnProperty,u=n((function(e,t){e=Object(e);var r=-1,n=t.length,u=n>2?t[2]:void 0;for(u&&i(t[0],t[1],u)&&(n=1);++r<n;)for(var f=t[r],l=a(f),p=-1,_=l.length;++p<_;){var m=l[p],v=e[m];(void 0===v||o(v,c[m])&&!s.call(e,m))&&(e[m]=f[m])}return e}));e.exports=u},7813:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},2205:(e,t,r)=>{e.exports=r(3045)},6557:e=>{e.exports=function(e){return e}},5694:(e,t,r)=>{var n=r(9454),o=r(7005),i=Object.prototype,a=i.hasOwnProperty,c=i.propertyIsEnumerable,s=n(function(){return arguments}())?n:function(e){return o(e)&&a.call(e,"callee")&&!c.call(e,"callee")};e.exports=s},1469:e=>{var t=Array.isArray;e.exports=t},8612:(e,t,r)=>{var n=r(3560),o=r(1780);e.exports=function(e){return null!=e&&o(e.length)&&!n(e)}},4144:(e,t,r)=>{e=r.nmd(e);var n=r(5639),o=r(5062),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,c=a&&a.exports===i?n.Buffer:void 0,s=(c?c.isBuffer:void 0)||o;e.exports=s},3560:(e,t,r)=>{var n=r(4239),o=r(3218);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1780:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},3218:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},7005:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},6719:(e,t,r)=>{var n=r(8749),o=r(7518),i=r(1167),a=i&&i.isTypedArray,c=a?o(a):n;e.exports=c},1704:(e,t,r)=>{var n=r(4636),o=r(313),i=r(8612);e.exports=function(e){return i(e)?n(e,!0):o(e)}},5062:e=>{e.exports=function(){return!1}},4495:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__4495__},8754:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__8754__}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.loaded=!0,r.exports}__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__=__webpack_require__(7138);return __webpack_exports__})()}));
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("futoin-asyncsteps"),require("futoin-asyncevent")):"function"==typeof define&&define.amd?define(["futoin-asyncsteps","futoin-asyncevent"],r):"object"==typeof exports?exports["futoin-invoker"]=r(require("futoin-asyncsteps"),require("futoin-asyncevent")):e.FutoInInvoker=r(e.$as,e.$asyncevent)}(self,(function(__WEBPACK_EXTERNAL_MODULE__4495__,__WEBPACK_EXTERNAL_MODULE__8754__){return(()=>{var __webpack_modules__={7724:e=>{"use strict";function r(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var t=function(){function e(r){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this._raw_info=r}var t,n;return t=e,(n=[{key:"name",value:function(){return this._raw_info.iface}},{key:"version",value:function(){return this._raw_info.version}},{key:"inherits",value:function(){return this._raw_info.inherits}},{key:"funcs",value:function(){return this._raw_info.funcs}},{key:"constraints",value:function(){return this._raw_info.constraints}}])&&r(t.prototype,n),e}();e.exports=t},6845:e=>{"use strict";function r(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var t={},n=function(){function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,o,i;return n=e,i=[{key:"detect",value:function(e){for(var r in t){var n=t[r];if(n.detect(e))return n}return t.JSON}},{key:"registerCoder",value:function(e,r){t[e]=r}},{key:"get",value:function(e){var r=t.hasOwnProperty(e)&&t[e];if(!r)throw new Error("Missing coder: ".concat(e));return r}}],(o=[{key:"isBinary",value:function(){return!1}},{key:"name",value:function(){return"Unknown"}}])&&r(n.prototype,o),i&&r(n,i),e}();e.exports=n},8312:(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),e}module=__webpack_require__.nmd(module);var $asyncevent=__webpack_require__(8754),$as=__webpack_require__(4495),common=__webpack_require__(4337),_common$FutoInError=common.FutoInError,InvokerError=_common$FutoInError.InvokerError,CommError=_common$FutoInError.CommError,InterfaceInfo=__webpack_require__(7724),Options=common.Options,SAFE_PAYLOAD_LIMIT=Options.SAFE_PAYLOAD_LIMIT,assertAS=Options.prodMode?function(){}:$as.assertAS,NativeIface=function(){function NativeIface(_ccmimpl,_info){var _this=this;_classCallCheck(this,NativeIface),$asyncevent(this,["connect","disconnect","close","commError"]);var ccmimpl=_ccmimpl,info=_info;this._ccmimpl=ccmimpl,this._raw_info=info,this._iface_info=null,this._comms={};var limitZone=info.limitZone,options=info.options,endpoint=info.endpoint,endpoint_scheme=info.endpoint_scheme,coder=info.coder,funcs=info.funcs,signMessage=info.signMessage,callTimeoutMS=options.callTimeoutMS,custom_create_ctx,custom_perform;switch(endpoint_scheme){case"#internal#":custom_create_ctx=function(e,r,t){return{ccmimpl,name:e,info,upload_data:r,download_stream:t,options,endpoint,expect_response:!0,max_rsp_size:0,max_req_size:0}},custom_perform=function(e,r,t){signMessage(e,r,t),endpoint.onInternalRequest(e,info,t,r.upload_data,r.download_stream)};break;case"http":case"https":custom_perform=function(e,r,t){ccmimpl.perfomHTTP(e,r,t)};break;case"ws":case"wss":custom_perform=function(e,r,t){var n,o=r.download_stream||funcs&&(n=funcs[r.name])&&n.rawresult;o||r.upload_data?(r.endpoint=endpoint.replace("ws","http"),r.rawresult=o,ccmimpl.perfomHTTP(e,r,t)):ccmimpl.perfomWebSocket(e,r,t)};break;case"browser":custom_perform=function(e,r,t){forbid_rawdata(e,r),ccmimpl.perfomBrowser(e,r,t)};break;case"unix":custom_perform=function(e,r,t){forbid_rawdata(e,r),ccmimpl.perfomUNIX(e,r,t)};break;case"callback":custom_perform=function(e,r,t){forbid_rawdata(e,r),endpoint(e,r,t)};break;default:custom_perform=function(e){e.error(InvokerError,"Unknown endpoint scheme: ".concat(endpoint_scheme))}}var create_ctx=custom_create_ctx||function(e,r,t){return{ccmimpl,name:e,info,upload_data:r,download_stream:t,rawresult:!1,rsp_content_type:null,native_iface:_this,options,endpoint,msg_coder:coder,expect_response:!0,signMessage,max_rsp_size:SAFE_PAYLOAD_LIMIT,max_req_size:SAFE_PAYLOAD_LIMIT}},perform=custom_perform,handle_timeout=function(e,r){"number"!=typeof r&&(r=callTimeoutMS),r>0&&e.setTimeout(r)},forbid_rawdata=function(e,r){r.upload_data?e.error(InvokerError,"Upload data is allowed only for HTTP/WS endpoints"):r.download_stream&&e.error(InvokerError,"Download stream is allowed only for HTTP/WS endpoints")},limiters=ccmimpl.limiters,sync_limit=function(){if("unlimited"===limitZone){var e=function(e,r,t,n,o){e.add((function(e){handle_timeout(e,o),r(e,t,n)}))};return"#internal#"===endpoint_scheme?function(r,t,n,o,i){i?e(r,t,n,o,i):t(r,n,o)}:e}return function(e,r,t,n,o){e.sync(limiters[limitZone],(function(e){handle_timeout(e,o),r(e,t,n)}))}}(),handle_response=function(e,r,t,n){if(r.download_stream)e.success(!0);else if(n){if(t instanceof Uint8Array||"string"==typeof t)try{t=r.msg_coder.decode(t)}catch(r){e.error(CommError,"Decode: "+r.message)}ccmimpl.onMessageResponse(e,r,t)}else ccmimpl.onDataResponse(e,r,t)},call=function(e,r,t){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;assertAS(e),t=t||{};var a=create_ctx(r,n,o);Object.seal(a);var c=ccmimpl.createMessage(e,a,t);sync_limit(e,perform,a,c,i),a.expect_response&&e.add((function(e,r,t){return handle_response(e,a,r,t)}))};Object.defineProperty(this,"call",{value:call,configurable:!1,enumerable:!1,writeable:!1});var member_call_generate_eval=function member_call_generate_eval(name,finfo){for(var src=[],params=finfo.params,plist=Object.keys(params),pmap=[],_i=0,_plist=plist;_i<_plist.length;_i++){var p=_plist[_i];void 0===params[p].default&&pmap.push("".concat(p,":").concat(p))}var args=["as"].concat(plist);src.push("(function (".concat(args.join(","),") {")),src.push("'use strict';"),src.push("var params = {".concat(pmap.join(","),"};"));for(var _i2=0,_plist2=plist;_i2<_plist2.length;_i2++){var _p=_plist2[_i2];void 0!==params[_p].default&&src.push("if (".concat(_p," !== undefined) params.").concat(_p," = ").concat(_p,";"))}return src.push('return call(as, "'.concat(name,'", params);')),src.push("})"),eval(src.join(""))};for(var fn in funcs){var finfo=funcs[fn];finfo.rawupload||fn in this||Object.defineProperty(this,fn,{value:member_call_generate_eval(fn,finfo),configurable:!1,enumerable:!1,writeable:!1})}}return _createClass(NativeIface,[{key:"ifaceInfo",value:function(){return this._iface_info||(this._iface_info=new InterfaceInfo(this._raw_info))}},{key:"bindDerivedKey",value:function(e){throw new Error(InvokerError,"Not Implemented")}},{key:"_close",value:function(){var e=this._comms;for(var r in e)e[r].close();this.emit("close")}}],[{key:"spec",value:function(e){var r;if(this._specs&&(r=this._specs[e]),!r&&this._specs_module_prefix){var t=this._specs_module_prefix+e.replace(".","_");r=module.require(t)}return r}}]),NativeIface}();NativeIface._specs=null,NativeIface._specs_module_prefix=null,module.exports=NativeIface},4485:(e,r,t)=>{"use strict";function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=t(4337),c=a.FutoInError,s=c.InvokerError,u=c.SecurityError,f=t(8312),l=t(2205),p=t(2266),_=t(8754),m=t(4495).Limiter,v=a.Options,d=/^secure\+/,h=/^(https|wss|unix):\/\//,y=function(e,r){return new f(e,r)},b=function(){function e(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;o(this,e),_(this,["register","unregister","close"]),this._iface_info={},this._iface_instance={},this._impl=t||new p(r),this.limitZone("default",{concurrent:8,max_queue:32,rate:10,period_ms:1e3,burst:null})}var r,t;return r=e,(t=[{key:"register",value:function(e,r,t,o,i){var c=this,f=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},l=null===r;!l&&r in this._iface_info&&e.error(s,"Already registered");var p=t.match(a._ifacever_pattern);null===p&&e.error(s,"Invalid ifacever"),f=n({},this._impl.options,f);var _,m=p[a._ifacever_pattern_name],v=p[a._ifacever_pattern_ver],b=p[a._ifacever_pattern_mjr],g=p[a._ifacever_pattern_mnr],w=f.secureChannel||!1,k=null,x=!1,j=!1,O="default";if(l)_="callback",x=!0;else if("string"==typeof o)switch(d.test(o)?(w=!0,o=o.replace(d,"")):h.test(o)&&(w=!0),k=y,_=o.split(":")[0]){case"http":case"https":break;case"ws":case"wss":case"unix":x=!0;break;case"browser":f.targetOrigin&&(w=!0),x=!0;break;default:e.error(s,"Unknown endpoint schema")}else"onInternalRequest"in o?(w=!0,k=y,_="#internal#",x=!0,j=!0,i=i||"-internal",O="unlimited"):(w=!0,k=o,o=null,_=null,x=!0,j=!0);(O=f.limitZone||O)in this._impl.limiters||e.error(s,"Unknown limit zone ".concat(O));var C={iface:m,version:v,mjrver:b,mnrver:g,endpoint:o,endpoint_scheme:_,creds:i||null,creds_master:"master"===i,creds_mac:i&&null!==i.match(/^-[hs]mac:/),secure_channel:w,impl:k,regname:r,inherits:null,funcs:null,constraints:null,options:f,_invoker_use:!0,_user_info:null,_server_executor_context:null,_callback_context:null,limitZone:O,aliases:[]};C.creds_mac&&(i.match(/^-hmac:/)?(f.hmacKey||e.error(s,"Missing options.hmacKey"),f.macKey=f.hmacKey,f.macAlgo=f.hmacAlgo):f.macKey||e.error(s,"Missing options.macKey")),C.creds_master&&!f.masterAuth&&e.error(s,"Missing options.masterAuth"),r&&(this._iface_info[r]=C),e.add((function(e){c._impl.onRegister(e,C),e.add((function(e){C.simple_req||("AllowAnonymous"in C.constraints||C.creds||e.error(u,"Requires authenticated user"),"SecureChannel"in C.constraints&&!w&&e.error(u,"SecureChannel is required"),!("MessageSignature"in C.constraints)||C.creds_master||C.creds_mac||j||e.error(u,"MessageSignature is required"),"BiDirectChannel"in C.constraints&&!x&&e.error(s,"BiDirectChannel is required")),l&&e.success(C,y(c._impl,C)),Object.seal(C),c.emit("register",r,t,C)}))}),(function(e,t){r&&delete c._iface_info[r]}))}},{key:"iface",value:function(e){return this._iface_instance[e]||this._initIface(e)}},{key:"_initIface",value:function(e){var r=this._iface_info[e];if(!r)throw new Error(s);var t=r.regname,n=this._iface_instance,o=n[t];if(!o){var i=r.options.nativeImpl;o=i?new i(this._impl,r):r.impl(this._impl,r),Object.seal(o),n[t]=o}return t!==e&&(n[e]=o),o}},{key:"unRegister",value:function(e){var r=this._iface_info,t=this._iface_instance,n=r[e];if(!n)throw new Error(s);if(n.regname===e){var o=n.aliases,i=t[e];i&&i._close();for(var a=0;a<o.length;++a){var c=o[a];delete r[c],delete t[c]}}else n.aliases.splice(n.aliases.indexOf(e),0);delete r[e],delete t[e],this.emit("unregister",e,n)}},{key:"defense",value:function(){return this.iface(this.SVC_DEFENSE)}},{key:"log",value:function(){return this.iface(this.SVC_LOG)}},{key:"cache",value:function(e){return this.iface(this.SVC_CACHE_+(e||"default"))}},{key:"assertIface",value:function(e,r){var t=this._iface_info[e];if(!t)throw new Error(s);var n=r.match(a._ifacever_pattern);if(null===n)throw new Error(s);var o=n[a._ifacever_pattern_name],i=n[a._ifacever_pattern_mjr],c=n[a._ifacever_pattern_mnr];if(!(t.iface===o&&t.mjrver===i&&t.mnrver>=c)){var u=t.inherits;if(u)for(var f=u.length-1;f>=0;--f){var l=u[f].match(a._ifacever_pattern);if(l[a._ifacever_pattern_name]===o&&l[a._ifacever_pattern_mjr]===i&&l[a._ifacever_pattern_mnr]>=c)return}throw new Error(s)}}},{key:"alias",value:function(e,r){var t=this._iface_info,n=t[e];if(!n||t[r])throw new Error(s);t[r]=n,n.aliases.push(r),this.emit("register",r,"".concat(n.iface,":").concat(n.version),n)}},{key:"close",value:function(){var e=this._iface_instance,r=this._iface_info;for(var t in r){var n=r[t],o=e[t];o&&t===n.regname&&o._close()}this._iface_instance={},this._iface_info={};var i=this._impl,a=i.comms;for(var c in a)a[c].close();i.comms={},this.emit("close")}},{key:"limitZone",value:function(e,r){"unlimited"!==e&&(this._impl.limiters[e]=new m(r))}}])&&i(r.prototype,t),e}();l(b.prototype,v),l(b,v),e.exports=b},7941:(e,r,t)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,r){return(a=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function c(e,r){if(r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=t(6845),f="JSON",l=function(e){!function(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}}),r&&a(e,r)}(_,e);var r,t,n,u,l,p=(u=_,l=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(e){return!1}}(),function(){var e,r=s(u);if(l){var t=s(this).constructor;e=Reflect.construct(r,arguments,t)}else e=r.apply(this,arguments);return c(this,e)});function _(){return o(this,_),p.apply(this,arguments)}return r=_,n=[{key:"register",value:function(){this.registerCoder(f,new this)}}],(t=[{key:"isBinary",value:function(){return!1}},{key:"name",value:function(){return f}},{key:"contentType",value:function(){return"application/futoin+json"}},{key:"detect",value:function(e){return"string"==typeof e?"{"===e.charAt(0):e instanceof ArrayBuffer?123==new Uint8Array(e)[0]:123===e[0]}},{key:"encode",value:function(e){return JSON.stringify(e)}},{key:"decode",value:function(e){return e instanceof ArrayBuffer?JSON.parse((new TextDecoder).decode(e)):JSON.parse(e.toString())}}])&&i(r.prototype,t),n&&i(r,n),_}(u);e.exports=l},2266:(e,r,t)=>{"use strict";function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e=t.nmd(e);var i=t(4337),a=i.FutoInError,c=a.InvokerError,s=a.CommError,u=t(6845),f=i._isNode,l=t(1747),p=f?e.require("./node/comms"):t(5362),_={callTimeoutMS:3e4,prodMode:"object"===("undefined"==typeof process?"undefined":o(process))&&!0,commConfigCallback:null,messageSniffer:function(){},disconnectSniffer:function(){},executor:null,targetOrigin:null,retryCount:1,defaultCoder:"JSON",binaryCoder:"MPCK",secureChannel:!1,commConcurrency:16};Object.freeze(_);var m=function(){function e(r){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),l(r=r||{},_),this.options=r,this.comms={},this.limiters={unlimited:{sync:function(e,r,t){e.add(r,t)}}},this._globalHTTPSecureAgent=null,this._globalHTTPAgent=null,Object.seal(this)}var r,t;return r=e,(t=[{key:"onRegister",value:function(e,r){(r.creds_master||r.creds_mac)&&e.error(c,"Master/HMAC is supported only in AdvancedCCM"),r.funcs={},r.inherits=[],r.constraints={},r.simple_req=!0,r.coder=u.get(r.options.coder||this.options.defaultCoder),r.signMessage=function(){}}},{key:"createMessage",value:function(e,r,t){var n=r.info,o={f:"".concat(n.iface,":").concat(n.version,":").concat(r.name),p:t,forcersp:!0},i=n.creds;return i&&(o.sec=i),o}},{key:"onMessageResponse",value:function(e,r,t){var n=t.e;n?e.error(n,t.edesc):e.success(t.r)}},{key:"onDataResponse",value:function(e,r,t){e.success(t)}},{key:"getComms",value:function(e,r,t,n){var o,i,a=r.options,s=this.options;a.executor!==s.executor||a.messageSniffer!==s.messageSniffer||a.disconnectSniffer!==s.disconnectSniffer||a.commConfigCallback!==s.commConfigCallback?(o=r.native_iface._comms,i=r.info.endpoint_scheme):(o=this.comms,i=r.endpoint+"##"+(r.credentials||"")+"##"+(n||""));var u=o[i];return u||(t||e.error(c,"Not implemented "+r.info.endpoint_scheme+" scheme"),u=new t,o[i]=u),u}},{key:"performCommon",value:function(e,r,t,n){var o,i,a=r.options.retryCount;e.repeat(a+1,(function(e,c){e.add((function(e){n.perform(e,r,t),e.add((function(e,r,t){o=r,i=t,e.break()}))}),(function(e,n){n===s&&(r.native_iface.emit("commError",e.state.error_info,t),c<a&&e.continue())}))})),e.add((function(e){e.success(o,i)}))}},{key:"perfomHTTP",value:function(e,r,t){var n=this.getComms(e,r,p.HTTPComms);this.performCommon(e,r,t,n)}},{key:"perfomWebSocket",value:function(e,r,t){var n=this.getComms(e,r,p.WSComms);this.performCommon(e,r,t,n)}},{key:"perfomUNIX",value:function(e,r,t){e.error(c,"Not implemented unix:// scheme")}},{key:"perfomBrowser",value:function(e,r,t){this.getComms(e,r,p.BrowserComms,r.options.targetOrigin).perform(e,r,t)}}])&&n(r.prototype,t),e}();e.exports=m},5362:(e,r,t)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,r,t){return r&&i(e.prototype,r),t&&i(e,t),e}var c=t(8754),s=t(4337).FutoInError,u=s.InvokerError,f=s.CommError,l=WebSocket,p=t(6845),_=function(){function e(){o(this,e)}return a(e,[{key:"close",value:function(){}},{key:"perform",value:function(e,r,t){var n=this;e.add((function(e){return n._perform(e,r,t)}))}},{key:"_perform",value:function(e,r,t){r.signMessage(e,r,t);var n,o,i=r.options.messageSniffer,a=new XMLHttpRequest,c=r.msg_coder,s=r.endpoint,l=r.upload_data;if(l||""===l){n="application/octet-stream","/"!==s.charAt(s.length-1)&&(s+="/"),s+=t.f.replace(/:/g,"/")+"/";var _=t.sec;_&&(_===r.options.credentials?o="Basic "+window.btoa(_):s+=encodeURIComponent(_)+"/");var m=[];for(var v in t.p){var d=t.p[v];"string"!=typeof d&&(d=JSON.stringify(d)),m.push(encodeURIComponent(v)+"="+encodeURIComponent(d))}s+="?"+m.join("&"),i(r.info,t,!1)}else n=c.contentType(),(l=c.encode(t)).length>r.max_req_size&&e.error(u,"Request message too long: ".concat(l.length," > ").concat(r.max_req_size)),i(r.info,l,!1);r.expect_response&&(r.download_stream&&(a.responseType=r.download_stream),a.onreadystatechange=function(){if(this.readyState===this.DONE){var t=r.download_stream?this.response:this.responseText;if(200===this.status&&t){var n=this.getResponseHeader("content-type")||"",o=n===c.contentType();if(!o&&n.match(/^application\/futoin\+/)){var a=p.detect(t);try{t=a.decode(t),o=!0}catch(e){}}i(r.info,o?t:"%DATA%",!0),e.success(t,o)}else try{e.error(f,"Low error")}catch(e){}}},e.setCancel((function(){return a.abort()}))),a.open("POST",s,!0),a.setRequestHeader("Content-Type",n),o&&a.setRequestHeader("Authorization",o),a.send(l)}}]),e}();r.HTTPComms=_;var m=function(){function e(){o(this,e),this.rid=1,this.reqas={},this.evt={},this.ws=null,c(this.evt,["open"]),this._waiting_open=!1,this.sniffer=null,Object.seal(this)}return a(e,[{key:"init",value:function(e,r){var t=this,n=r.options,o=new l(r.endpoint);this.ws=o,this._waiting_open=!0;var i=this.reqas,a=n.executor||null,c=r.info,s=n.messageSniffer;this.sniffer=s;var u=function(e){for(var a in n.disconnectSniffer(c),o.close(),t.ws=null,t.rid=1,t.reqas={},i)try{i[a].error(f,e.wasClean?"Cleanup":"Error")}catch(e){}t._waiting_open=!1,r.native_iface.emit("disconnect")};o.binaryType="arraybuffer",o.onclose=u,o.onerror=u,o.onopen=function(e){t._waiting_open=!1,t.evt.emit("open"),r.native_iface.emit("connect")},o.onmessage=function(e){var r=e.data;s(c,r,!0);var t=p.detect(r);try{r=t.decode(r)}catch(e){return void console.log("WS Decode error",e.message,e)}var n=r.rid;if(n){var u=i[n];u?(u.success(r,!0),delete i[n]):"S"===n.charAt(0)&&a&&a.onEndpointRequest(c,r,(function(e){return function(e,r){var t=a.packPayload(e,r);s(c,t,!1),o.send(t)}(t,e)}))}}}},{key:"close",value:function(){this.ws&&(this.ws.close(),this.ws=null)}},{key:"perform",value:function(e,r,t){var n=this;this.ws||this.init(e,r),this._waiting_open&&e.add((function(e){if(n._waiting_open){var r=function(){return e.success()};n.evt.once("open",r),e.setCancel((function(){return n.evt.off("open",r)}))}})),e.add((function(e){return n._perform(e,r,t)}))}},{key:"_perform",value:function(e,r,t){this.ws||e.error(f,"Disconnect while in progress");var n=this.reqas,o="C"+this.rid++;t.rid=o,r.signMessage(e,r,t),r.expect_response&&(n[o]=e,e.setCancel((function(){delete n[o]})));var i=r.msg_coder.encode(t);this.sniffer(r.info,i,!1),this.ws.send(i)}}]),e}();r.WSComms=l?m:_;var v=function(){function e(){o(this,e),this.rid=1,this.reqas={},this.opts=null,this.target=null,this.sniffer=null,Object.seal(this)}return a(e,[{key:"init",value:function(e,r){var t=r.options;this.opts=t;var o,i=r.endpoint.split("://",2)[1];"parent"===i?i=window.parent:i in window&&"postMessage"in window[i]?i=window[i]:(o=document.getElementById(i))?i=o.contentWindow:e.error(f,"Unknown target: "+i),i===window&&e.error(f,"Target matches current window"),this.target=i;var a=this.reqas,c=t.executor||null,s=r.info,u=t.targetOrigin,l=t.messageSniffer;this.sniffer=l;var p=function(e){l(u,e,!1),i.postMessage(e,u||"*")};window.addEventListener("message",(function(e){if(l(s,e.data,!0),!e.source||e.source===i){if(u&&e.origin!==u)return console.log("Error: peer origin mismatch "),console.log("Error >origin: "+e.origin),void console.log("Error >required: "+u);var r=e.data;if("object"===n(r)){var t=r.rid;if(t){if("f"in r){if(!("f"in r)||"S"!==t.charAt(0)||!c)return;c.onEndpointRequest(s,r,p)}else{var o=a[t];o&&(o.success(r,!0),delete a[t])}e.stopPropagation&&e.stopPropagation()}}else console.log("Not object response: "+r)}}),!1),r.native_iface.emit("connect")}},{key:"close",value:function(){this.target&&(this.target=null)}},{key:"perform",value:function(e,r,t){var n=this;(r.upload_data||r.download_stream)&&e.error(f,"Raw Data is not supported by Web Messaging yet"),this.target||this.init(e,r),e.add((function(e){var o=n.reqas,i="C"+n.rid++;t.rid=i,r.signMessage(e,r,t),r.expect_response&&(o[i]=e,e.setCancel((function(){delete o[i]}))),n.sniffer(r.info,t,!1),n.target.postMessage(t,n.opts.targetOrigin||"*")}))}}]),e}();r.BrowserComms=v},7138:(e,r,t)=>{"use strict";!function(r){var n=r.FutoIn||r.futoin||{};if(void 0===n.Invoker){t(7941).register();var o=t(4485);r.SimpleCCM=o,n.SimpleCCM=o,r.FutoIn=n,r.futoin=n,n.Invoker={SimpleCCM:o}}e.exports=n.Invoker}(window)},4337:(e,r,t)=>{"use strict";var n=t(4495);r.AsyncSteps=n,r.FutoInError=n.FutoInError,r.Options={SAFE_PAYLOAD_LIMIT:65536,SVC_RESOLVER:"#resolver",SVC_AUTH:"#auth",SVC_DEFENSE:"#defense",SVC_ACL:"#acl",SVC_LOG:"#log",SVC_CACHE_:"#cache."},r._ifacever_pattern=/^(([a-z][a-z0-9]*)(\.[a-z][a-z0-9]*)*):(([0-9]+)\.([0-9]+))$/,r._ifacever_pattern_name=1,r._ifacever_pattern_ver=4,r._ifacever_pattern_mjr=5,r._ifacever_pattern_mnr=6,r._isNode="undefined"==typeof window&&t(5643)},5643:e=>{e.exports=!1},2705:(e,r,t)=>{var n=t(5639).Symbol;e.exports=n},6874:e=>{e.exports=function(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}},4636:(e,r,t)=>{var n=t(2545),o=t(5694),i=t(1469),a=t(4144),c=t(5776),s=t(6719),u=Object.prototype.hasOwnProperty;e.exports=function(e,r){var t=i(e),f=!t&&o(e),l=!t&&!f&&a(e),p=!t&&!f&&!l&&s(e),_=t||f||l||p,m=_?n(e.length,String):[],v=m.length;for(var d in e)!r&&!u.call(e,d)||_&&("length"==d||l&&("offset"==d||"parent"==d)||p&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||c(d,v))||m.push(d);return m}},4865:(e,r,t)=>{var n=t(9465),o=t(7813),i=Object.prototype.hasOwnProperty;e.exports=function(e,r,t){var a=e[r];i.call(e,r)&&o(a,t)&&(void 0!==t||r in e)||n(e,r,t)}},9465:(e,r,t)=>{var n=t(8777);e.exports=function(e,r,t){"__proto__"==r&&n?n(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}},4239:(e,r,t)=>{var n=t(2705),o=t(9607),i=t(2333),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},9454:(e,r,t)=>{var n=t(4239),o=t(7005);e.exports=function(e){return o(e)&&"[object Arguments]"==n(e)}},8458:(e,r,t)=>{var n=t(3560),o=t(5346),i=t(3218),a=t(346),c=/^\[object .+?Constructor\]$/,s=Function.prototype,u=Object.prototype,f=s.toString,l=u.hasOwnProperty,p=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(n(e)?p:c).test(a(e))}},8749:(e,r,t)=>{var n=t(4239),o=t(1780),i=t(7005),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!a[n(e)]}},313:(e,r,t)=>{var n=t(3218),o=t(5726),i=t(3498),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var r=o(e),t=[];for(var c in e)("constructor"!=c||!r&&a.call(e,c))&&t.push(c);return t}},5976:(e,r,t)=>{var n=t(6557),o=t(5357),i=t(61);e.exports=function(e,r){return i(o(e,r,n),e+"")}},6560:(e,r,t)=>{var n=t(5703),o=t(8777),i=t(6557),a=o?function(e,r){return o(e,"toString",{configurable:!0,enumerable:!1,value:n(r),writable:!0})}:i;e.exports=a},2545:e=>{e.exports=function(e,r){for(var t=-1,n=Array(e);++t<e;)n[t]=r(t);return n}},7518:e=>{e.exports=function(e){return function(r){return e(r)}}},8363:(e,r,t)=>{var n=t(4865),o=t(9465);e.exports=function(e,r,t,i){var a=!t;t||(t={});for(var c=-1,s=r.length;++c<s;){var u=r[c],f=i?i(t[u],e[u],u,t,e):void 0;void 0===f&&(f=e[u]),a?o(t,u,f):n(t,u,f)}return t}},4429:(e,r,t)=>{var n=t(5639)["__core-js_shared__"];e.exports=n},1463:(e,r,t)=>{var n=t(5976),o=t(6612);e.exports=function(e){return n((function(r,t){var n=-1,i=t.length,a=i>1?t[i-1]:void 0,c=i>2?t[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,c&&o(t[0],t[1],c)&&(a=i<3?void 0:a,i=1),r=Object(r);++n<i;){var s=t[n];s&&e(r,s,n,a)}return r}))}},8777:(e,r,t)=>{var n=t(852),o=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},1957:e=>{var r="object"==typeof global&&global&&global.Object===Object&&global;e.exports=r},852:(e,r,t)=>{var n=t(8458),o=t(7801);e.exports=function(e,r){var t=o(e,r);return n(t)?t:void 0}},9607:(e,r,t)=>{var n=t(2705),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,c=n?n.toStringTag:void 0;e.exports=function(e){var r=i.call(e,c),t=e[c];try{e[c]=void 0;var n=!0}catch(e){}var o=a.call(e);return n&&(r?e[c]=t:delete e[c]),o}},7801:e=>{e.exports=function(e,r){return null==e?void 0:e[r]}},5776:e=>{var r=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&r.test(e))&&e>-1&&e%1==0&&e<t}},6612:(e,r,t)=>{var n=t(7813),o=t(8612),i=t(5776),a=t(3218);e.exports=function(e,r,t){if(!a(t))return!1;var c=typeof r;return!!("number"==c?o(t)&&i(r,t.length):"string"==c&&r in t)&&n(t[r],e)}},5346:(e,r,t)=>{var n,o=t(4429),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!i&&i in e}},5726:e=>{var r=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}},3498:e=>{e.exports=function(e){var r=[];if(null!=e)for(var t in Object(e))r.push(t);return r}},1167:(e,r,t)=>{e=t.nmd(e);var n=t(1957),o=r&&!r.nodeType&&r,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o&&n.process,c=function(){try{return i&&i.require&&i.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=c},2333:e=>{var r=Object.prototype.toString;e.exports=function(e){return r.call(e)}},5357:(e,r,t)=>{var n=t(6874),o=Math.max;e.exports=function(e,r,t){return r=o(void 0===r?e.length-1:r,0),function(){for(var i=arguments,a=-1,c=o(i.length-r,0),s=Array(c);++a<c;)s[a]=i[r+a];a=-1;for(var u=Array(r+1);++a<r;)u[a]=i[a];return u[r]=t(s),n(e,this,u)}}},5639:(e,r,t)=>{var n=t(1957),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},61:(e,r,t)=>{var n=t(6560),o=t(1275)(n);e.exports=o},1275:e=>{var r=Date.now;e.exports=function(e){var t=0,n=0;return function(){var o=r(),i=16-(o-n);if(n=o,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},346:e=>{var r=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return r.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},3045:(e,r,t)=>{var n=t(8363),o=t(1463),i=t(1704),a=o((function(e,r){n(r,i(r),e)}));e.exports=a},5703:e=>{e.exports=function(e){return function(){return e}}},1747:(e,r,t)=>{var n=t(5976),o=t(7813),i=t(6612),a=t(1704),c=Object.prototype,s=c.hasOwnProperty,u=n((function(e,r){e=Object(e);var t=-1,n=r.length,u=n>2?r[2]:void 0;for(u&&i(r[0],r[1],u)&&(n=1);++t<n;)for(var f=r[t],l=a(f),p=-1,_=l.length;++p<_;){var m=l[p],v=e[m];(void 0===v||o(v,c[m])&&!s.call(e,m))&&(e[m]=f[m])}return e}));e.exports=u},7813:e=>{e.exports=function(e,r){return e===r||e!=e&&r!=r}},2205:(e,r,t)=>{e.exports=t(3045)},6557:e=>{e.exports=function(e){return e}},5694:(e,r,t)=>{var n=t(9454),o=t(7005),i=Object.prototype,a=i.hasOwnProperty,c=i.propertyIsEnumerable,s=n(function(){return arguments}())?n:function(e){return o(e)&&a.call(e,"callee")&&!c.call(e,"callee")};e.exports=s},1469:e=>{var r=Array.isArray;e.exports=r},8612:(e,r,t)=>{var n=t(3560),o=t(1780);e.exports=function(e){return null!=e&&o(e.length)&&!n(e)}},4144:(e,r,t)=>{e=t.nmd(e);var n=t(5639),o=t(5062),i=r&&!r.nodeType&&r,a=i&&e&&!e.nodeType&&e,c=a&&a.exports===i?n.Buffer:void 0,s=(c?c.isBuffer:void 0)||o;e.exports=s},3560:(e,r,t)=>{var n=t(4239),o=t(3218);e.exports=function(e){if(!o(e))return!1;var r=n(e);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}},1780:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},3218:e=>{e.exports=function(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)}},7005:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},6719:(e,r,t)=>{var n=t(8749),o=t(7518),i=t(1167),a=i&&i.isTypedArray,c=a?o(a):n;e.exports=c},1704:(e,r,t)=>{var n=t(4636),o=t(313),i=t(8612);e.exports=function(e){return i(e)?n(e,!0):o(e)}},5062:e=>{e.exports=function(){return!1}},4495:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__4495__},8754:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__8754__}},__webpack_module_cache__={};function __webpack_require__(e){var r=__webpack_module_cache__[e];if(void 0!==r)return r.exports;var t=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e](t,t.exports,__webpack_require__),t.loaded=!0,t.exports}__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__=__webpack_require__(7138);return __webpack_exports__})()}));

@@ -244,2 +244,3 @@ "use strict";

ws.binaryType = 'arraybuffer';
ws.onclose = cleanup;

@@ -246,0 +247,0 @@ ws.onerror = cleanup;

@@ -78,2 +78,4 @@ 'use strict';

return data.charAt(0) === '{';
} else if (data instanceof ArrayBuffer) {
return new Uint8Array(data)[0] == 0x7B;
} else {

@@ -91,3 +93,7 @@ return data[0] === 0x7B;

value: function decode(buffer) {
return JSON.parse(buffer);
if (buffer instanceof ArrayBuffer) {
return JSON.parse(new TextDecoder().decode(buffer));
}
return JSON.parse(buffer.toString());
}

@@ -94,0 +100,0 @@ }], [{

@@ -62,6 +62,2 @@ 'use strict';

value: function detect(data) {
if (typeof data === 'string' && data[0] == '{') {
return coders.JSON;
}
for (var k in coders) {

@@ -68,0 +64,0 @@ var c = coders[k];

@@ -49,2 +49,12 @@ 'use strict';

});
it('should auto-detect binary', function () {
var m = coder.encode(msg);
var res = MessageCoder.detect(Buffer.from(m));
expect(res.name()).to.equal(coder_name);
});
it('should detect binary', function () {
var m = coder.encode(msg);
var res = coder.detect(Buffer.from(m));
expect(res).to.be["true"];
});
it('encode benchmark', function () {

@@ -51,0 +61,0 @@ this.timeout(30e3);

@@ -245,3 +245,5 @@ 'use strict';

frsp = coder.encode(frsp);
ws.send(frsp);
ws.send(frsp, {
binary: true
});
});

@@ -248,0 +250,0 @@ });

{
"name": "futoin-invoker",
"version": "2.4.7",
"version": "2.4.8",
"vcs": "git",

@@ -5,0 +5,0 @@ "rms": "npm",

@@ -228,2 +228,3 @@ "use strict";

ws.binaryType = 'arraybuffer';
ws.onclose = cleanup;

@@ -230,0 +231,0 @@ ws.onerror = cleanup;

@@ -42,2 +42,4 @@ 'use strict';

return data.charAt( 0 ) === '{';
} else if ( data instanceof ArrayBuffer ) {
return ( new Uint8Array( data ) )[0] == 0x7B;
} else {

@@ -53,3 +55,7 @@ return data[0] === 0x7B;

decode( buffer ) {
return JSON.parse( buffer );
if ( buffer instanceof ArrayBuffer ) {
return JSON.parse( new TextDecoder().decode( buffer ) );
}
return JSON.parse( buffer.toString() );
}

@@ -56,0 +62,0 @@

@@ -52,6 +52,2 @@ 'use strict';

static detect( data ) {
if ( typeof data === 'string' && ( data[0] == '{' ) ) {
return coders.JSON;
}
for ( let k in coders ) {

@@ -58,0 +54,0 @@ const c = coders[k];

{
"name": "futoin-invoker",
"version": "2.4.7",
"version": "2.4.8",
"description": "Transparently, efficiently and securely invoke remote or local service methods with strict API definition for Node and Browser",

@@ -5,0 +5,0 @@ "main": "lib/invoker.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc