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 0.5.6 to 0.5.7

2

bower.json
{
"name": "futoin-invoker",
"version": "0.5.6",
"version": "0.5.7",
"main": "dist/futoin-invoker.js",

@@ -5,0 +5,0 @@ "moduleType": [

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

!function(a){"function"==typeof define&&define.amd?define(["futoin-asyncsteps"],a):"object"==typeof exports?module.exports=a(require("futoin-asyncsteps")):this.FutoInInvoker=a($as)}(function(a){function b(a){var c=b.cache[a];if(!c){var d={};c=b.cache[a]={id:a,exports:d},b.modules[a].call(d,c,d)}return c.exports}var c=this;return b.cache=[],b.modules=[function(a,c){"use strict";function d(a){a=a||{};var b=a.specDirs||[];b instanceof Array||(b=[b]),a.specDirs=b,h.SimpleCCMImpl.call(this,a)}var e=b(7),f=b(3),g=f.FutoInError,h=b(6);c=a.exports=function(b){return new a.exports.AdvancedCCMImpl(b)};var i=h.SimpleCCMImpl.prototype;d.prototype={onRegister:function(a,b){e.loadIface(a,b,b.options.specDirs),b.options.prodMode||e.checkConsistency(a,b)},checkParams:function(a,b,c){var d,f=b.info,h=b.name;"SecureChannel"in f.constraints&&!f.secure_channel&&a.error(g.SecurityError,"Requires secure channel"),"AllowAnonymous"in f.constraints||f.creds||a.error(g.SecurityError,"Requires authenticated user"),h in f.funcs||a.error(g.InvokerError,"Unknown interface function: "+h);var i=f.funcs[h];b.upload_data&&!i.rawupload&&a.error(g.InvokerError,"Raw upload is not allowed"),!Object.keys(i.params).length&&Object.keys(c).length&&a.error(g.InvokerError,"No params are defined");for(d in c)i.params.hasOwnProperty(d)||a.error(g.InvokerError,"Unknown parameter: "+d),e.checkParameterType(a,f,h,d,c[d]);for(d in i.params)c.hasOwnProperty(d)||i.params[d].hasOwnProperty("default")||a.error(g.InvokerError,"Missing parameter "+d)},createMessage:function(a,b,c){b.info.options.prodMode||this.checkParams(a,b,c);var d=b.info,e={f:d.iface+":"+d.version+":"+b.name,p:c};null!==d.creds&&("master"===d.creds||(e.sec=d.creds)),b.expect_response=d.funcs[b.name].expect_result,a.success(e)},onMessageResponse:function(a,b,c){var d=b.info,f=b.name,h=d.funcs[f];if("e"in c){var i=c.e;i in h["throws"]||i in e.standard_errors?a.error(i,c.edesc):a.error(g.InternalError,"Not expected exception from Executor")}h.rawresult&&a.error(g.InternalError,"Raw result is expected"),"master"===d.creds;var j=h.result,k=Object.keys(j).length;for(var l in c.r)j.hasOwnProperty(l)&&(e.checkResultType(a,d,f,l,c.r[l]),--k);k>0&&a.error(g.InternalError,"Missing result variables"),a.success(c.r)},onDataResponse:function(a,b,c){b.info.funcs[b.name].rawresult?a.success(c):a.error(g.InternalError,"Raw result is not expected")},getComms:i.getComms,performCommon:i.performCommon,perfomHTTP:i.perfomHTTP,perfomWebSocket:i.perfomWebSocket,perfomUNIX:i.perfomUNIX,perfomBrowser:i.perfomBrowser},c.AdvancedCCMImpl=d},function(a){!function(c){"use strict";var d=c.FutoIn||{};if("undefined"==typeof d.Invoker){var e=b(4),f=e.SimpleCCM;c.SimpleCCM=f;var g=e.AdvancedCCM;c.AdvancedCCM=g,d.Invoker=e,c.FutoInInvoker=e,c.FutoIn=d,a&&(a.exports=e)}}(window)},function(a,c){"use strict";var d=b(9),e=b(3),f=e.FutoInError,g=WebSocket,h=e.Options.FUTOIN_CONTENT_TYPE;c.HTTPComms=function(){},c.HTTPComms.prototype={close:function(){},perform:function(a,b,c){var d=this;a.add(function(a){d._perform(a,b,c)})},_perform:function(a,b,c){var d,e=b.options.messageSniffer,g=new XMLHttpRequest,i=b.endpoint,j=b.upload_data;if(j||""===j){d="application/octet-stream","/"!==i.charAt(i.length-1)&&(i+="/"),i+=c.f.replace(/:/g,"/")+"/","sec"in c&&(i+=c.sec+"/");var k=[];for(var l in c.p)k.push(encodeURIComponent(l)+"="+encodeURIComponent(c.p[l]));i+="?"+k.join("&"),e(b.info,c,!1)}else d=h,j=JSON.stringify(c),e(b.info,j,!1);b.expect_response&&(b.download_stream&&(g.responseType=b.download_stream),g.onreadystatechange=function(){if(this.readyState===this.DONE){var c=b.download_stream?this.response:this.responseText;if(c){var d=this.getResponseHeader("content-type");d===h?e(b.info,c,!0):e(b.info,"%DATA%",!0),a.success(c,d)}else try{a.error(f.CommError,"Low error")}catch(g){}}},a.setCancel(function(){g.abort()})),g.open("POST",i,!0),g.setRequestHeader("Content-Type",d),g.send(j),b.expect_response||a.success()}},c.WSComms=function(){this.rid=1,this.reqas={},this.evt=d()},c.WSComms.prototype={_waiting_open:!1,init:function(a,b){var c=b.options,d=new g(b.endpoint);this.ws=d,this._waiting_open=!0;var e=this.reqas,h=c.executor||null,i=b.info,j=this,k=c.messageSniffer;this.sniffer=k;var l=function(a){var b=h.packPayloadJSON(a);k(i,b,!1),d.send(b)},m=function(a){c.disconnectSniffer(i),d.close(),delete j.ws;for(var g in e)try{e[g].error(f.CommError,a.wasClean?"Cleanup":"Error")}catch(h){}delete j.reqas,j.reqas={},j._waiting_open=!1,b.native_iface.emit("disconnect")};d.onclose=m,d.onerror=m,d.onopen=function(a){j._waiting_open=!1,j.evt.emit("open"),b.native_iface.emit("connect")},d.onmessage=function(a){k(i,a.data,!0);var b;try{b=JSON.parse(a.data)}catch(c){return}if("rid"in b){var d=b.rid;d in e?(e[d].success(b,!0),delete e[d]):"S"===d.charAt(0)&&h&&h.onEndpointRequest(i,b,l)}}},close:function(){this.ws&&this.ws.close()},perform:function(a,b,c){var d=this;"ws"in this||d.init(a,b),this._waiting_open&&a.add(function(a){if(d._waiting_open){var b=function(){a.success()};d.evt.once("open",b),a.setCancel(function(){d.evt.off("open",b)})}}),a.add(function(a){d._perform(a,b,c)})},_perform:function(a,b,c){"ws"in this||a.error(f.CommError,"Disconnect while in progress");var d=this.reqas,e="C"+this.rid++;b.expect_response&&(d[e]=a,a.setCancel(function(){delete d[e]})),c.rid=e;var g=JSON.stringify(c);this.sniffer(b.info,g,!1),this.ws.send(g)}},g||(c.WSComms=c.HTTPComms),c.BrowserComms=function(){this.rid=1,this.reqas={}},c.BrowserComms.prototype={init:function(a,b){var c=b.options;this.opts=c;var d,e=b.endpoint.split("://",2)[1],g=window;if("parent"===e)e=g.parent;else if(e in g&&"postMessage"in g[e])e=g[e];else{var h=document;d=h.getElementById(e),d?e=d.contentWindow:a.error(f.CommError,"Unknown target: "+e)}e===g&&a.error(f.CommError,"Target matches current window"),this.target=e;var i=this.reqas,j=c.executor||null,k=b.info,l=c.targetOrigin,m=c.messageSniffer;this.sniffer=m;var n=function(a){m(l,a,!1),e.postMessage(a,l||"*")},o=function(a){if(m(k,a.data,!0),!a.source||a.source===e){if(l){if(a.origin!==l)return console.log("Error: peer origin mismatch "),console.log("Error >origin: "+a.origin),void console.log("Error >required: "+l)}else;var b=a.data;if("object"!=typeof b)return void console.log("Not object response: "+b);if("rid"in b){var c=b.rid;if(!("f"in b)&&c in i)i[c].success(b,!0),delete i[c];else{if(!("f"in b&&"S"===c.charAt(0)&&j))return;j.onEndpointRequest(k,b,n)}a.stopPropagation&&a.stopPropagation()}}};g.addEventListener("message",o,!1),b.native_iface.emit("connect")},close:function(){this.target&&(this.target=null)},perform:function(a,b,c){(b.upload_data||b.download_stream)&&a.error(f.CommError,"Raw Data is not supported by Web Messaging yet"),this.target||this.init(a,b);var d=this;a.add(function(a){var e=d.reqas,f="C"+d.rid++;b.expect_response&&(e[f]=a,a.setCancel(function(a){delete e[f]})),c.rid=f,d.sniffer(b.info,c,!1),d.target.postMessage(c,d.opts.targetOrigin||"*")})}}},function(a,c){"use strict";var d=b(24);c.AsyncSteps=d,c.FutoInError=d.FutoInError,c.Options={OPT_CALL_TIMEOUT_MS:"callTimeoutMS",OPT_PROD_MODE:"prodMode",OPT_COMM_CONFIG_CB:"commConfigCallback",OPT_MSG_SNIFFER:"messageSniffer",OPT_DISCONNECT_SNIFFER:"disconnectSniffer",OPT_SPEC_DIRS:"specDirs",OPT_EXECUTOR:"executor",OPT_TARGET_ORIGIN:"targetOrigin",OPT_RETRY_COUNT:"retryCount",SAFE_PAYLOAD_LIMIT:65536,SVC_RESOLVER:"#resolver",SVC_AUTH:"#auth",SVC_DEFENSE:"#defense",SVC_ACL:"#acl",SVC_LOG:"#log",SVC_CACHE_:"#cache.",FUTOIN_CONTENT_TYPE:"application/futoin+json"},c._ifacever_pattern=/^(([a-z][a-z0-9]*)(\.[a-z][a-z0-9]*)*):(([0-9]+)\.([0-9]+))$/},function(a,c){"use strict";function d(a){n(this),this._iface_info={},this._iface_impl={},this._impl=k(a),i(this,p)}function e(a){n(this),this._iface_info={},this._iface_impl={},this._impl=l(a),i(this,q)}var f=b(3),g=f.FutoInError,h=b(5),i=b(63),j=b(62),k=b(6),l=b(0),m=b(7),n=b(9),o=f.Options;i(d,o);var p={_secure_replace:/^secure\+/,_secure_test:/^(https|wss|unix):\/\//,_native_iface_builder:function(a,b){return h(a,b)}};i(p,o),p.register=function(a,b,c,d,e,h){var i=null===b;!i&&b in this._iface_info&&a.error(g.InvokerError,"Already registered");var k=c.match(f._ifacever_pattern);null===k&&a.error(g.InvokerError,"Invalid ifacever");var l,m=k[1],n=k[4],o=k[5],p=k[6],q=!1,r=null,s=!1;if(i)l="callback",s=!0;else if("string"==typeof d)switch(this._secure_replace.test(d)?(q=!0,d=d.replace(this._secure_replace,"")):this._secure_test.test(d)&&(q=!0),r=this._native_iface_builder,l=d.split(":")[0]){case"http":case"https":break;case"ws":case"wss":case"unix":s=!0;break;case"browser":h&&h.targetOrigin&&(q=!0),s=!0;break;default:a.error(g.InvokerError,"Unknown endpoint schema")}else"onInternalRequest"in d?(q=!0,r=this._native_iface_builder,l="#internal#",s=!0):(q=!0,r=d,d=null,l=null,s=!0);h=h||{},j(h,this._impl.options);var t={iface:m,version:n,mjrver:o,mnrver:p,endpoint:d,endpoint_scheme:l,creds:e||null,secure_channel:q,impl:r,regname:b,inherits:null,funcs:null,constraints:null,options:h,_invoker_use:!0,_user_info:null};b&&(this._iface_info[b]=t);var u=this;a.add(function(a){u._impl.onRegister(a,t),a.add(function(a){"SecureChannel"in t.constraints&&!q&&a.error(g.SecurityError,"SecureChannel is required"),"BiDirectChannel"in t.constraints&&!s&&a.error(g.InvokerError,"BiDirectChannel is required"),i&&a.success(t,u._native_iface_builder(u._impl,t)),u.emit("register",b,c,t)})},function(a,c){b&&delete u._iface_info[b]})},p.iface=function(a){var b=this._iface_info[a];if(!b)throw new Error(g.InvokerError);var c=b.regname,d=this._iface_impl[c];if(!d){var e=b.options.nativeImpl;d=e?new e(this._impl,b):b.impl(this._impl,b),this._iface_impl[c]=d}return d},p.unRegister=function(a){var b=this._iface_info[a];if(!b)throw new Error(g.InvokerError);var c=b.regname;if(c===a){delete this._iface_info[c];var d=this._iface_impl[c];if(d&&(d._close(),delete this._iface_impl[c]),b.aliases)for(var e=b.aliases,f=0;f<e.length;++f)delete this._iface_info[e[f]]}else delete this._iface_info[a],b.aliases.splice(b.aliases.indexOf(a),0);this.emit("unregister",a,b)},p.defense=function(){return this.iface(this.SVC_DEFENSE)},p.log=function(){return this.iface(this.SVC_LOG)},p.cache=function(a){return this.iface(this.SVC_CACHE_+(a||"default"))},p.assertIface=function(a,b){var c=this._iface_info[a];if(!c)throw new Error(g.InvokerError);var d=b.match(f._ifacever_pattern);if(null===d)throw new Error(g.InvokerError);var e=d[1],h=d[5],i=d[6];if(c.iface!==e||c.mjrver!==h||c.mnrver<i)throw new Error(g.InvokerError)},p.alias=function(a,b){var c=this._iface_info[a];if(!c||this._iface_info[b])throw new Error(g.InvokerError);this._iface_info[b]=c,c.aliases?c.aliases.push(b):c.aliases=[b],this.emit("register",b,c.iface+":"+c.version,c)},p.close=function(){var a=this._iface_impl;for(var b in a)a[b]._close();var c=this._impl.comms;for(var d in c)c[d].close();this.emit("close")},i(e,o);var q={};i(q,p),q.initFromCache=function(a,b){a.error(g.NotImplemented,"Caching is not supported yet")},q.cacheInit=function(a){},c.SimpleCCM=d,c.AdvancedCCM=e,c.FutoInError=g,c.NativeIface=h.NativeIface,c.InterfaceInfo=h.InterfaceInfo,c.SpecTools=m,c.SpecTools._ifacever_pattern=f._ifacever_pattern},function(a,c){"use strict";function d(a){this._raw_info=a}function e(a,b){this._ccmimpl=a,this._raw_info=b,this._iface_info=null,this._comms={},h(this,m),j(this);for(var c in this._raw_info.funcs){var d=this._raw_info.funcs[c];d.rawupload||c in this||(this[c]=this._member_call_generate(c,d))}}var f=b(3),g=f.FutoInError,h=b(63),i=b(26),j=b(9),k=b(24),l=f.Options.FUTOIN_CONTENT_TYPE;c=a.exports=function(b,c){return new a.exports.NativeIface(b,c)},d.prototype={name:function(){return this._raw_info.iface},version:function(){return this._raw_info.version},inherits:function(){return this._raw_info.inherits},funcs:function(){return this._raw_info.funcs},constraints:function(){return this._raw_info.constraints}},c.InterfaceInfo=d;var m={call:function(a,b,c,d,e,f){c=c||{};var h=this._raw_info,i={ccmimpl:this._ccmimpl,name:b,info:h,upload_data:d,download_stream:e,rsp_content_type:null,native_iface:this,options:h.options,endpoint:h.endpoint,expect_response:!0},j=this._ccmimpl;a.add(function(a){j.createMessage(a,i,c)}),a.add(function(a,c){var m;i.expect_response?(m=a,"number"!=typeof f&&(f=i.info.options.callTimeoutMS),f>0&&m.setTimeout(f)):m=k();var n=h.endpoint_scheme;if("#internal#"===n)i.endpoint.onInternalRequest(m,h,c,d,e);else if("http"===n||"https"===n)j.perfomHTTP(m,i,c);else if("ws"===n||"wss"===n){var o,p=i.download_stream||i.info.funcs&&(o=i.info.funcs[b])&&o.rawresult;i.upload_data||p?(i.endpoint=i.endpoint.replace("ws","http"),i.rawresult=p,j.perfomHTTP(m,i,c)):j.perfomWebSocket(m,i,c)}else i.upload_data?m.error(g.InvokerError,"Upload data is allowed only for HTTP/WS endpoints"):i.download_stream?m.error(g.InvokerError,"Download stream is allowed only for HTTP/WS endpoints"):"browser"===n?j.perfomBrowser(m,i,c):"unix"===n?j.perfomUNIX(m,i,c):"callback"===n?i.endpoint(m,i,c):m.error(g.InvokerError,"Unknown endpoint scheme");m!==a?(m.execute(),a.success()):m.add(function(a,b,c){if(i.download_stream)a.success(!0);else if(c===l||c===!0){if("string"==typeof b)try{b=JSON.parse(b)}catch(d){a.error(g.CommError,"JSON:"+d.message)}j.onMessageResponse(a,i,b)}else j.onDataResponse(a,i,b)})})},_member_call_intercept:function(a,b,c,d){var e=c.params,f=Object.keys(e);d.length>f.length?a.error(g.InvokerError,"Unknown parameters"):d.length<c.min_args?a.error(g.InvokerError,"Missing parameters"):d.length<f.length&&(f=f.splice(0,d.length));var h=i(f,d);this.call(a,b,h)},_member_call_generate:function(a,b){return function(c){this._member_call_intercept(c,a,b,Array.prototype.slice.call(arguments,1))}},ifaceInfo:function(){return this._iface_info||(this._iface_info=new d(this._raw_info)),this._iface_info},bindDerivedKey:function(a){throw new Error(g.InvokerError,"Not Implemented")},_close:function(){var a=this._comms;for(var b in a)a[b].close();this.emit("close")}};c.NativeIface=e},function(a,c){"use strict";function d(a){a=a||{},i(a,k),this.options=a,this.comms={}}var e,f=b(3),g=f.FutoInError,h=b(8),i=b(62);if(h){var j=require;e=j("./node_comms")}else e=b(2);c=a.exports=function(b){return new a.exports.SimpleCCMImpl(b)};var k={callTimeoutMS:3e4,prodMode:!1,commConfigCallback:null,retryCount:1,messageSniffer:function(){},disconnectSniffer:function(){}};d.prototype={onRegister:function(a,b){b.funcs={},b.inherits=[],b.constraints={}},createMessage:function(a,b,c){var d=b.info,e={f:d.iface+":"+d.version+":"+b.name,p:c,forcersp:!0};null!==d.creds&&"master"!==d.creds&&(e.sec=d.creds),a.success(e)},onMessageResponse:function(a,b,c){"e"in c?a.error(c.e,c.edesc):a.success(c.r)},onDataResponse:function(a,b,c){a.success(c)},getComms:function(a,b,c,d){var e,f,h=b.options,i=this.options;h.executor!==i.executor||h.messageSniffer!==i.messageSniffer||h.disconnectSniffer!==i.disconnectSniffer||h.commConfigCallback!==i.commConfigCallback?(e=b.native_iface._comms,f=b.info.endpoint_scheme):(e=this.comms,f=b.endpoint+"##"+(b.credentials||"")+"##"+(d||""));var j=e[f];return j||(c||a.error(g.InvokerError,"Not implemented "+b.info.endpoint_scheme+" scheme"),j=new c,e[f]=j),j},performCommon:function(a,b,c,d){var e,f;a.repeat(b.options.retryCount+1,function(a){a.add(function(a){d.perform(a,b,c),a.add(function(a,b,c){e=b,f=c,a["break"]()})},function(a,d){d===g.CommError&&(b.native_iface.emit("commError",a.state.error_info,c),a["continue"]())})}).add(function(a){a.success(e,f)})},perfomHTTP:function(a,b,c){var d=this.getComms(a,b,e.HTTPComms);this.performCommon(a,b,c,d)},perfomWebSocket:function(a,b,c){var d=this.getComms(a,b,e.WSComms);this.performCommon(a,b,c,d)},perfomUNIX:function(a,b,c){a.error(g.InvokerError,"Not implemented unix:// scheme")},perfomBrowser:function(a,b,c){var d=this.getComms(a,b,e.BrowserComms,b.options.targetOrigin);d.perform(a,b,c)}},c.SimpleCCMImpl=d},function(a){"use strict";var c,d,e=b(3),f=e.FutoInError,g=b(8),h=b(56),i=b(26),j=b(25);if(g){var k=require;c=k("fs"),d=k("request")}var l={standard_errors:{UnknownInterface:!0,NotSupportedVersion:!0,NotImplemented:!0,Unauthorized:!0,InternalError:!0,InvalidRequest:!0,DefenseRejected:!0,PleaseReauth:!0,SecurityError:!0},_ver_pattern:/^([0-9]+)\.([0-9]+)$/,loadIface:function(a,b,e){var h=null;a.forEach(e,function(a,e,f){var i=b.iface+"-"+b.version+"-iface.json";a.add(function(a){if("string"==typeof f&&g){var b=f+"/"+i,e=function(b){if(a){try{return f=JSON.parse(b),f._just_loaded=!0,void a.success()}catch(c){}try{a["continue"]()}catch(c){}}};"http"===b.substr(0,4)?d(b,function(a,b,c){e(c)}):c.readFile(b,{encoding:"utf8"},function(a,b){e(b)}),a.setCancel(function(b){a=null})}}).add(function(a){if("string"==typeof f&&!g){var b=f+"/"+i,c=new XMLHttpRequest;c.onreadystatechange=function(){if(this.readyState===this.DONE){var b=this.responseText;if(b)try{return f=JSON.parse(b),f._just_loaded=!0,void a.success()}catch(c){}try{a["continue"]()}catch(d){}}},c.open("GET",b,!0),c.send(),a.setCancel(function(a){c.abort()})}}).add(function(a){"object"==typeof f&&f.iface===b.iface&&f.version===b.version&&(h=f,a["break"]())})}).add(function(a){null===h&&a.error(f.InternalError,"Failed to load valid spec for "+b.iface+":"+b.version),l.parseIface(a,b,e,h)})},parseIface:function(a,b,c,d){if(d._just_loaded?(b.funcs=d.funcs||{},b.types=d.types||{}):(b.funcs=h(d.funcs||{}),b.types=h(d.types||{})),l._parseFuncs(a,b),l._parseTypes(a,b),"requires"in d){var g=d.requires;Array.isArray(g)||a.error(f.InternalError,'"requires" is not array'),b.constraints=i(g,g)}else b.constraints={};if(l._checkFTN3Rev(a,b,d),b.inherits=[],"inherit"in d){var j=d.inherit.match(e._ifacever_pattern);null===j&&a.error(f.InvokerError,"Invalid inherit ifacever: "+d.inherit);var k={};k.iface=j[1],k.version=j[4],l.loadIface(a,k,c),a.add(function(a){l._parseImportInherit(a,b,c,d,k),b.inherits.push(d.inherit),b.inherits=b.inherits.concat(k.inherits)})}"imports"in d?(b.imports=d.imports.slice(),a.forEach(d.imports,function(a,g,h){var i=h.match(e._ifacever_pattern);null===i&&a.error(f.InvokerError,"Invalid import ifacever: "+h);var j={};j.iface=i[1],j.version=i[4],l.loadIface(a,j,c),a.add(function(a){l._parseImportInherit(a,b,c,d,j),b.imports=b.imports.concat(j.imports)})})):b.imports=[]},_checkFTN3Rev:function(a,b,c){var d=c.ftn3rev||"1.0",e=d.match(l._ver_pattern);null===e&&a.error(f.InternalError,"Invalid ftn3rev field");var g=parseInt(e[1]),h=parseInt(e[2]);1===g?(1>h&&(c.imports||c.types||"BiDirectChannel"in b.constraints)&&a.error(f.InternalError,"Missing ftn3rev field when FTN3 v1.1 features are used"),!b._invoker_use&&h>1&&a.error(f.InternalError,"Not supported FTN3 revision for Executor")):a.error(f.InternalError,"Not supported FTN3 revision")},_parseFuncs:function(a,b){var c,d;for(var e in b.funcs){if(c=b.funcs[e],c.min_args=0,"params"in c){var g=c.params;"object"!=typeof g&&a.error(f.InternalError,"Invalid params object");for(d in g){var h=g[d];"object"!=typeof h&&a.error(f.InternalError,"Invalid param object"),"type"in h||a.error(f.InternalError,"Missing type for params"),"default"in h||(c.min_args+=1)}}else c.params={};if(c.expect_result=!1,"result"in c){var j=c.result;"object"!=typeof j&&a.error(f.InternalError,"Invalid result object");for(var k in j){var l=j[k];"object"!=typeof l&&a.error(f.InternalError,"Invalid resultvar object"),"type"in l||a.error(f.InternalError,"Missing type for result"),c.expect_result=!0}}else c.result={};if("rawupload"in c||(c.rawupload=!1),"rawresult"in c||(c.rawresult=!1),c.rawresult&&(c.expect_result=!0),"throws"in c){c.expect_result||a.error(f.InternalError,'"throws" without result');var m=c["throws"];Array.isArray(m)||a.error(f.InternalError,'"throws" is not array'),c["throws"]=i(m,m)}else c["throws"]={}}},_parseTypes:function(a,b){var c;for(var d in b.types)if(c=b.types[d],"type"in c||a.error(f.InternalError,'Missing "type" for custom type'),"map"===c.type){if(!("fields"in c)){c.fields={};continue}for(var e in c.fields)"type"in c.fields[e]||a.error(f.InternalError,'Missing "type" for custom type field')}},_parseImportInherit:function(a,b,c,d,e){var g,h;for(var i in e.types)i in b.types?a.error(f.InternalError,"Iface type redifintion: "+i):b.types[i]=e.types[i];for(var k in e.funcs){var l=e.funcs[k];if(k in b.funcs){var m=l.params,n=b.funcs[k].params,o=Object.keys(m),p=Object.keys(n);for(p.length<o.length&&a.error(f.InternalError,"Invalid param count for '"+k+"'"),g=0;g<o.length;++g)h=o[g],h!==p[g]&&a.error(f.InternalError,"Invalid param order for '"+k+"/"+h+"'"),m[h].type!==n[h].type&&a.error(f.InternalError,"Param type mismatch '"+k+"/"+h+"'");for(;g<p.length;++g)h=p[g],h in m||"default"in n[h]||null===n[h]||a.error(f.InternalError,"Missing default for '"+k+"/"+h+"'");l.rawresult!==b.funcs[k].rawresult&&a.error(f.InternalError,"'rawresult' flag mismatch for '"+k+"'"),l.rawupload&&!b.funcs[k].rawupload&&a.error(f.InternalError,"'rawupload' flag is missing for '"+k+"'")}else b.funcs[k]=l}j(Object.keys(e.constraints),d.requires).length&&a.error(f.InternalError,"Missing constraints from inherited")},checkConsistency:function(a,b){},checkType:function(a,b,c,d){if(null===c)return!1;switch(b){case"any":return!0;case"boolean":case"string":case"number":return typeof c===b;case"map":return"object"==typeof c&&!(c instanceof Array);case"integer":return"number"==typeof c&&(0|c)===c;case"array":return c instanceof Array;default:if(!("types"in a&&b in a.types))return!1}if(b in a.types){var e=a.types[b];d=d||{};var g=e.type;if(g in d)throw console&&console.log("[ERROR] Custom type recursion: "+e),new Error(f.InternalError);if(d[b]=!0,!this.checkType(a,g,c,d))return!1;switch(g){case"integer":case"number":return"min"in e&&c<e.min?!1:"max"in e&&c>e.max?!1:!0;case"string":if("regex"in e){var h;return"_comp_regex"in a?h=a._comp_regex:(h={},a._comp_regex=h),b in h||(h[b]=new RegExp(e.regex)),null!==c.match(h[b])}return!0;case"array":var i=c.length;if("minlen"in e&&i<e.minlen)return!1;if("maxlen"in e&&i>e.maxlen)return!1;if("elemtype"in e)for(var j=e.elemtype,k=0;i>k;++k)if(!this.checkType(a,j,c[k],[]))return!1;return!0;case"map":var l=e.fields;for(var m in l){var n=l[m];if(!(m in c)||null===c[m])return n.optional?(c[m]=null,!0):!1;if(!this.checkType(a,n.type,c[m],[]))return!1}return!0}}return!1},checkParameterType:function(a,b,c,d,e){l.checkType(b,b.funcs[c].params[d].type,e)||a.error(f.InvalidRequest,"Type mismatch for parameter: "+d)},checkResultType:function(a,b,c,d,e){l.checkType(b,b.funcs[c].result[d].type,e)||a.error(f.InvalidRequest,"Type mismatch for result: "+d)},checkFutoInType:function(a,b,c,d){l.checkType({},b,d)||a.error(f.InvalidRequest,"Type mismatch for parameter: "+c)}};a.exports=l},function(a){a.exports=!1;try{a.exports="[object process]"===Object.prototype.toString.call(c.process)}catch(b){}},function(a,c){"use strict";var d,e,f,g,h,i,j,k=b(10),l=b(19),m=Function.prototype.apply,n=Function.prototype.call,o=Object.create,p=Object.defineProperty,q=Object.defineProperties,r=Object.prototype.hasOwnProperty,s={configurable:!0,enumerable:!1,writable:!0};d=function(a,b){var c;return l(b),r.call(this,"__ee__")?c=this.__ee__:(c=s.value=o(null),p(this,"__ee__",s),s.value=null),c[a]?"object"==typeof c[a]?c[a].push(b):c[a]=[c[a],b]:c[a]=b,this},e=function(a,b){var c,e;return l(b),e=this,d.call(this,a,c=function(){f.call(e,a,c),m.call(b,this,arguments)}),c.__eeOnceListener__=b,this},f=function(a,b){var c,d,e,f;if(l(b),!r.call(this,"__ee__"))return this;if(c=this.__ee__,!c[a])return this;if(d=c[a],"object"==typeof d)for(f=0;e=d[f];++f)(e===b||e.__eeOnceListener__===b)&&(2===d.length?c[a]=d[f?0:1]:d.splice(f,1));else(d===b||d.__eeOnceListener__===b)&&delete c[a];return this},g=function(a){var b,c,d,e,f;if(r.call(this,"__ee__")&&(e=this.__ee__[a]))if("object"==typeof e){for(c=arguments.length,f=new Array(c-1),b=1;c>b;++b)f[b-1]=arguments[b];for(e=e.slice(),b=0;d=e[b];++b)m.call(d,this,f)}else switch(arguments.length){case 1:n.call(e,this);break;case 2:n.call(e,this,arguments[1]);break;case 3:n.call(e,this,arguments[1],arguments[2]);break;default:for(c=arguments.length,f=new Array(c-1),b=1;c>b;++b)f[b-1]=arguments[b];m.call(e,this,f)}},h={on:d,once:e,off:f,emit:g},i={on:k(d),once:k(e),off:k(f),emit:k(g)},j=q({},i),a.exports=c=function(a){return null==a?o(j):q(Object(a),i)},c.methods=h},function(a){"use strict";var c,d=b(11),e=b(18),f=b(14),g=b(21);c=a.exports=function(a,b){var c,f,h,i,j;return arguments.length<2||"string"!=typeof a?(i=b,b=a,a=null):i=arguments[2],null==a?(c=h=!0,f=!1):(c=g.call(a,"c"),f=g.call(a,"e"),h=g.call(a,"w")),j={value:b,configurable:c,enumerable:f,writable:h},i?d(e(i),j):j},c.gs=function(a,b,c){var h,i,j,k;return"string"!=typeof a?(j=c,c=b,b=a,a=null):j=arguments[3],null==b?b=void 0:f(b)?null==c?c=void 0:f(c)||(j=c,c=void 0):(j=b,b=c=void 0),null==a?(h=!0,i=!1):(h=g.call(a,"c"),i=g.call(a,"e")),k={get:b,set:c,configurable:h,enumerable:i},j?d(e(j),k):k}},function(a){"use strict";a.exports=b(12)()?Object.assign:b(13)},function(a){"use strict";a.exports=function(){var a,b=Object.assign;return"function"!=typeof b?!1:(a={foo:"raz"},b(a,{bar:"dwa"},{trzy:"trzy"}),a.foo+a.bar+a.trzy==="razdwatrzy")}},function(a){"use strict";var c=b(15),d=b(20),e=Math.max;a.exports=function(a,b){var f,g,h,i=e(arguments.length,2);for(a=Object(d(a)),h=function(c){try{a[c]=b[c]}catch(d){f||(f=d)}},g=1;i>g;++g)b=arguments[g],c(b).forEach(h);if(void 0!==f)throw f;return a}},function(a){"use strict";a.exports=function(a){return"function"==typeof a}},function(a){"use strict";a.exports=b(16)()?Object.keys:b(17)},function(a){"use strict";a.exports=function(){try{return Object.keys("primitive"),!0}catch(a){return!1}}},function(a){"use strict";var b=Object.keys;a.exports=function(a){return b(null==a?a:Object(a))}},function(a){"use strict";var c,d=b(11),e=Array.prototype.forEach,f=Object.create,g=Object.getPrototypeOf;c=function(a,b){var e=g(a);return d(e?c(e,b):b,a)},a.exports=function(){var a=f(null);return e.call(arguments,function(b){null!=b&&c(Object(b),a)}),a}},function(a){"use strict";a.exports=function(a){if("function"!=typeof a)throw new TypeError(a+" is not a function");return a}},function(a){"use strict";a.exports=function(a){if(null==a)throw new TypeError("Cannot use null or undefined");return a}},function(a){"use strict";a.exports=b(22)()?String.prototype.contains:b(23)},function(a){"use strict";var b="razdwatrzy";a.exports=function(){return"function"!=typeof b.contains?!1:b.contains("dwa")===!0&&b.contains("foo")===!1}},function(a){"use strict";var b=String.prototype.indexOf;a.exports=function(a){return b.call(this,a,arguments[1])>-1}},function(b){b.exports=a},function(a){function c(){for(var a=-1,b=arguments.length;++a<b;){var c=arguments[a];if(g(c)||f(c))break}return d(c,e(arguments,!1,!0,++a))}var d=b(34),e=b(35),f=b(57),g=b(58);a.exports=c},function(a){function c(a,b){var c=-1,e=a?a.length:0,f={};for(!e||b||d(a[0])||(b=[]);++c<e;){var g=a[c];b?f[g]=b[c]:g&&(f[g[0]]=g[1])}return f}var d=b(58);a.exports=c},function(a){function d(a){var b=a?a.length:0;for(this.data={hash:h(null),set:new g};b--;)this.push(a[b])}var e=b(43),f=b(59),g=f(g=c.Set)&&g,h=f(h=Object.create)&&h;d.prototype.push=e,a.exports=d},function(a){function b(a,b){var c=-1,d=a.length;for(b||(b=Array(d));++c<d;)b[c]=a[c];return b}a.exports=b},function(a){function b(a,b){for(var c=-1,d=a.length;++c<d&&b(a[c],c,a)!==!1;);return a}a.exports=b},function(a){function b(a,b){return"undefined"==typeof a?b:a}a.exports=b},function(a){function c(a,b,c){var f=e(b);if(!c)return d(b,a,f);for(var g=-1,h=f.length;++g<h;){var i=f[g],j=a[i],k=c(j,b[i],i,a,b);(k===k?k===j:j!==j)&&("undefined"!=typeof j||i in a)||(a[i]=k)}return a}var d=b(33),e=b(64);a.exports=c},function(a){function c(a,b,o,p,q,r,t){var u;if(o&&(u=q?o(a,p,q):o(a)),"undefined"!=typeof u)return u;if(!l(a))return a;var w=k(a);if(w){if(u=h(a),!b)return d(a,u)}else{var x=M.call(a),y=x==s;if(x!=v&&x!=n&&(!y||q))return K[x]?i(a,x,b):q?a:{};if(u=j(y?{}:a),!b)return f(a,u,m(a))}r||(r=[]),t||(t=[]);for(var z=r.length;z--;)if(r[z]==a)return t[z];return r.push(a),t.push(u),(w?e:g)(a,function(d,e){u[e]=c(d,b,o,e,a,r,t)}),u}var d=b(28),e=b(29),f=b(33),g=b(37),h=b(47),i=b(48),j=b(49),k=b(58),l=b(60),m=b(64),n="[object Arguments]",o="[object Array]",p="[object Boolean]",q="[object Date]",r="[object Error]",s="[object Function]",t="[object Map]",u="[object Number]",v="[object Object]",w="[object RegExp]",x="[object Set]",y="[object String]",z="[object WeakMap]",A="[object ArrayBuffer]",B="[object Float32Array]",C="[object Float64Array]",D="[object Int8Array]",E="[object Int16Array]",F="[object Int32Array]",G="[object Uint8Array]",H="[object Uint8ClampedArray]",I="[object Uint16Array]",J="[object Uint32Array]",K={};K[n]=K[o]=K[A]=K[p]=K[q]=K[B]=K[C]=K[D]=K[E]=K[F]=K[u]=K[v]=K[w]=K[y]=K[G]=K[H]=K[I]=K[J]=!0,K[r]=K[s]=K[t]=K[x]=K[z]=!1;var L=Object.prototype,M=L.toString;a.exports=c},function(a){function b(a,b,c){c||(c=b,b={});for(var d=-1,e=c.length;++d<e;){var f=c[d];b[f]=a[f]}return b}a.exports=b},function(a){function c(a,b){var c=a?a.length:0,g=[];if(!c)return g;var h=-1,i=d,j=!0,k=j&&b.length>=200&&f(b),l=b.length;k&&(i=e,j=!1,b=k);a:for(;++h<c;){var m=a[h];if(j&&m===m){for(var n=l;n--;)if(b[n]===m)continue a;g.push(m)}else i(b,m)<0&&g.push(m)}return g}var d=b(38),e=b(42),f=b(45);a.exports=c},function(a){function c(a,b,h,i){for(var j=(i||0)-1,k=a.length,l=-1,m=[];++j<k;){var n=a[j];if(g(n)&&f(n.length)&&(e(n)||d(n))){b&&(n=c(n,b,h));var o=-1,p=n.length;for(m.length+=p;++o<p;)m[++l]=n[o]}else h||(m[++l]=n)}return m}var d=b(57),e=b(58),f=b(52),g=b(53);a.exports=c},function(a){function c(a,b,c){for(var e=-1,f=d(a),g=c(a),h=g.length;++e<h;){var i=g[e];if(b(f[i],i,f)===!1)break}return a}var d=b(55);a.exports=c},function(a){function c(a,b){return d(a,b,e)}var d=b(36),e=b(64);a.exports=c},function(a){function c(a,b,c){if(b!==b)return d(a,c);for(var e=(c||0)-1,f=a.length;++e<f;)if(a[e]===b)return e;return-1}var d=b(46);a.exports=c},function(a){function b(a){return"string"==typeof a?a:null==a?"":a+""}a.exports=b},function(a){function c(a,b,c){if("function"!=typeof a)return d;if("undefined"==typeof b)return a;switch(c){case 1:return function(c){return a.call(b,c)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)};case 5:return function(c,d,e,f,g){return a.call(b,c,d,e,f,g)}}return function(){return a.apply(b,arguments)}}var d=b(69);a.exports=c},function(a){function d(a){return h.call(a,0)}var e=b(68),f=b(59),g=f(g=c.ArrayBuffer)&&g,h=f(h=g&&new g(0).slice)&&h,i=Math.floor,j=f(j=c.Uint8Array)&&j,k=function(){try{var a=f(a=c.Float64Array)&&a,b=new a(new g(10),0,1)&&a}catch(d){}return b}(),l=k?k.BYTES_PER_ELEMENT:0;h||(d=g&&j?function(a){var b=a.byteLength,c=k?i(b/l):0,d=c*l,e=new g(b);if(c){var f=new k(e,0,c);f.set(new k(a,0,c))}return b!=d&&(f=new j(e,d),f.set(new j(a,d))),e}:e(null)),a.exports=d},function(a){function c(a,b){var c=a.data,e="string"==typeof b||d(b)?c.set.has(b):c.hash[b];return e?0:-1}var d=b(60);a.exports=c},function(a){function c(a){var b=this.data;"string"==typeof a||d(a)?b.set.add(a):b.hash[a]=!0}var d=b(60);a.exports=c},function(a){function c(a){return function(){var b=arguments.length,c=arguments[0];if(2>b||null==c)return c;if(b>3&&e(arguments[1],arguments[2],arguments[3])&&(b=2),b>3&&"function"==typeof arguments[b-2])var f=d(arguments[--b-1],arguments[b--],5);else b>2&&"function"==typeof arguments[b-1]&&(f=arguments[--b]);for(var g=0;++g<b;){var h=arguments[g];h&&a(c,h,f)}return c}}var d=b(40),e=b(51);a.exports=c},function(a){var d=b(27),e=b(68),f=b(59),g=f(g=c.Set)&&g,h=f(h=Object.create)&&h,i=h&&g?function(a){return new d(a)}:e(null);a.exports=i},function(a){function b(a,b,c){for(var d=a.length,e=c?b||d:(b||0)-1;c?e--:++e<d;){var f=a[e];if(f!==f)return e}return-1}a.exports=b},function(a){function b(a){var b=a.length,c=new a.constructor(b);return b&&"string"==typeof a[0]&&d.call(a,"index")&&(c.index=a.index,c.input=a.input),c
}var c=Object.prototype,d=c.hasOwnProperty;a.exports=b},function(a){function c(a,b,c){var u=a.constructor;switch(b){case j:return d(a);case e:case f:return new u(+a);case k:case l:case m:case n:case o:case p:case q:case r:case s:var v=a.buffer;return new u(c?d(v):v,a.byteOffset,a.length);case g:case i:return new u(a);case h:var w=new u(a.source,t.exec(a));w.lastIndex=a.lastIndex}return w}var d=b(41),e="[object Boolean]",f="[object Date]",g="[object Number]",h="[object RegExp]",i="[object String]",j="[object ArrayBuffer]",k="[object Float32Array]",l="[object Float64Array]",m="[object Int8Array]",n="[object Int16Array]",o="[object Int32Array]",p="[object Uint8Array]",q="[object Uint8ClampedArray]",r="[object Uint16Array]",s="[object Uint32Array]",t=/\w*$/;a.exports=c},function(a){function b(a){var b=a.constructor;return"function"==typeof b&&b instanceof b||(b=Object),new b}a.exports=b},function(a){function b(a,b){return a=+a,b=null==b?c:b,a>-1&&a%1==0&&b>a}var c=Math.pow(2,53)-1;a.exports=b},function(a){function c(a,b,c){if(!f(c))return!1;var g=typeof b;if("number"==g)var h=c.length,i=e(h)&&d(b,h);else i="string"==g&&b in a;return i&&c[b]===a}var d=b(50),e=b(52),f=b(60);a.exports=c},function(a){function b(a){return"number"==typeof a&&a>-1&&a%1==0&&c>=a}var c=Math.pow(2,53)-1;a.exports=b},function(a){function b(a){return a&&"object"==typeof a||!1}a.exports=b},function(a){function c(a){for(var b=h(a),c=b.length,j=c&&a.length,l=j&&g(j)&&(e(a)||i.nonEnumArgs&&d(a)),m=-1,n=[];++m<c;){var o=b[m];(l&&f(o,j)||k.call(a,o))&&n.push(o)}return n}var d=b(57),e=b(58),f=b(50),g=b(52),h=b(65),i=b(67),j=Object.prototype,k=j.hasOwnProperty;a.exports=c},function(a){function c(a){return d(a)?a:Object(a)}var d=b(60);a.exports=c},function(a){function c(a,b,c){return b="function"==typeof b&&e(b,c,1),d(a,!0,b)}var d=b(32),e=b(40);a.exports=c},function(a){function c(a){var b=e(a)?a.length:void 0;return d(b)&&h.call(a)==f||!1}var d=b(52),e=b(53),f="[object Arguments]",g=Object.prototype,h=g.toString;a.exports=c},function(a){var c=b(52),d=b(59),e=b(53),f="[object Array]",g=Object.prototype,h=g.toString,i=d(i=Array.isArray)&&i,j=i||function(a){return e(a)&&c(a.length)&&h.call(a)==f||!1};a.exports=j},function(a){function c(a){return null==a?!1:j.call(a)==f?k.test(i.call(a)):e(a)&&g.test(a)||!1}var d=b(66),e=b(53),f="[object Function]",g=/^\[object .+?Constructor\]$/,h=Object.prototype,i=Function.prototype.toString,j=h.toString,k=RegExp("^"+d(j).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");a.exports=c},function(a){function b(a){var b=typeof a;return"function"==b||a&&"object"==b||!1}a.exports=b},function(a){var c=b(31),d=b(44),e=d(c);a.exports=e},function(a){function c(a){if(null==a)return a;var b=d(arguments);return b.push(f),e.apply(void 0,b)}var d=b(28),e=b(61),f=b(30);a.exports=c},function(a){a.exports=b(61)},function(a){var c=b(52),d=b(59),e=b(60),f=b(54),g=d(g=Object.keys)&&g,h=g?function(a){if(a)var b=a.constructor,d=a.length;return"function"==typeof b&&b.prototype===a||"function"!=typeof a&&d&&c(d)?f(a):e(a)?g(a):[]}:f;a.exports=h},function(a){function c(a){if(null==a)return[];h(a)||(a=Object(a));var b=a.length;b=b&&g(b)&&(e(a)||i.nonEnumArgs&&d(a))&&b||0;for(var c=a.constructor,j=-1,l="function"==typeof c&&c.prototype==a,m=Array(b),n=b>0;++j<b;)m[j]=j+"";for(var o in a)n&&f(o,b)||"constructor"==o&&(l||!k.call(a,o))||m.push(o);return m}var d=b(57),e=b(58),f=b(50),g=b(52),h=b(60),i=b(67),j=Object.prototype,k=j.hasOwnProperty;a.exports=c},function(a){function c(a){return a=d(a),a&&f.test(a)?a.replace(e,"\\$&"):a}var d=b(39),e=/[.*+?^${}()|[\]\/\\]/g,f=RegExp(e.source);a.exports=c},function(a){var d=b(59),e=/\bthis\b/,f=Object.prototype,g=(g=c.window)&&g.document,h=f.propertyIsEnumerable,i={};!function(){i.funcDecomp=!d(c.WinRTError)&&e.test(function(){return this}),i.funcNames="string"==typeof Function.name;try{i.dom=11===g.createDocumentFragment().nodeType}catch(a){i.dom=!1}try{i.nonEnumArgs=!h.call(arguments,1)}catch(a){i.nonEnumArgs=!0}}(0,0),a.exports=i},function(a){function b(a){return function(){return a}}a.exports=b},function(a){function b(a){return a}a.exports=b}],b(1)});
!function(a){"function"==typeof define&&define.amd?define(["futoin-asyncsteps"],a):"object"==typeof exports?module.exports=a(require("futoin-asyncsteps")):this.FutoInInvoker=a($as)}(function(a){function b(a){var c=b.cache[a];if(!c){var d={};c=b.cache[a]={id:a,exports:d},b.modules[a].call(d,c,d)}return c.exports}var c=this;return b.cache=[],b.modules=[function(a,c){"use strict";function d(a){a=a||{};var b=a.specDirs||[];b instanceof Array||(b=[b]),a.specDirs=b,h.SimpleCCMImpl.call(this,a)}var e=b(7),f=b(3),g=f.FutoInError,h=b(6);c=a.exports=function(b){return new a.exports.AdvancedCCMImpl(b)};var i=h.SimpleCCMImpl.prototype;d.prototype={onRegister:function(a,b){e.loadIface(a,b,b.options.specDirs),b.options.prodMode||e.checkConsistency(a,b)},checkParams:function(a,b,c){var d,f=b.info,h=b.name;"SecureChannel"in f.constraints&&!f.secure_channel&&a.error(g.SecurityError,"Requires secure channel"),"AllowAnonymous"in f.constraints||f.creds||a.error(g.SecurityError,"Requires authenticated user"),h in f.funcs||a.error(g.InvokerError,"Unknown interface function: "+h);var i=f.funcs[h];b.upload_data&&!i.rawupload&&a.error(g.InvokerError,"Raw upload is not allowed"),!Object.keys(i.params).length&&Object.keys(c).length&&a.error(g.InvokerError,"No params are defined");for(d in c)i.params.hasOwnProperty(d)||a.error(g.InvokerError,"Unknown parameter: "+d),e.checkParameterType(a,f,h,d,c[d]);for(d in i.params)c.hasOwnProperty(d)||i.params[d].hasOwnProperty("default")||a.error(g.InvokerError,"Missing parameter "+d)},createMessage:function(a,b,c){b.info.options.prodMode||this.checkParams(a,b,c);var d=b.info,e={f:d.iface+":"+d.version+":"+b.name,p:c};null!==d.creds&&("master"===d.creds||(e.sec=d.creds)),b.expect_response=d.funcs[b.name].expect_result,a.success(e)},onMessageResponse:function(a,b,c){var d=b.info,f=b.name,h=d.funcs[f];if("e"in c){var i=c.e;i in h["throws"]||i in e.standard_errors?a.error(i,c.edesc):a.error(g.InternalError,"Not expected exception from Executor")}h.rawresult&&a.error(g.InternalError,"Raw result is expected"),"master"===d.creds;var j=h.result,k=Object.keys(j).length;for(var l in c.r)j.hasOwnProperty(l)&&(e.checkResultType(a,d,f,l,c.r[l]),--k);k>0&&a.error(g.InternalError,"Missing result variables"),a.success(c.r)},onDataResponse:function(a,b,c){b.info.funcs[b.name].rawresult?a.success(c):a.error(g.InternalError,"Raw result is not expected")},getComms:i.getComms,performCommon:i.performCommon,perfomHTTP:i.perfomHTTP,perfomWebSocket:i.perfomWebSocket,perfomUNIX:i.perfomUNIX,perfomBrowser:i.perfomBrowser},c.AdvancedCCMImpl=d},function(a){!function(c){"use strict";var d=c.FutoIn||{};if("undefined"==typeof d.Invoker){var e=b(4),f=e.SimpleCCM;c.SimpleCCM=f;var g=e.AdvancedCCM;c.AdvancedCCM=g,d.Invoker=e,c.FutoInInvoker=e,c.FutoIn=d,a&&(a.exports=e)}}(window)},function(a,c){"use strict";var d=b(9),e=b(3),f=e.FutoInError,g=WebSocket,h=e.Options.FUTOIN_CONTENT_TYPE;c.HTTPComms=function(){},c.HTTPComms.prototype={close:function(){},perform:function(a,b,c){var d=this;a.add(function(a){d._perform(a,b,c)})},_perform:function(a,b,c){var d,e,g=b.options.messageSniffer,i=new XMLHttpRequest,j=b.endpoint,k=b.upload_data;if(k||""===k){d="application/octet-stream","/"!==j.charAt(j.length-1)&&(j+="/"),j+=c.f.replace(/:/g,"/")+"/","sec"in c&&(c.sec===b.options.credentials?e="Basic "+window.btoa(c.sec):j+=c.sec+"/");var l=[];for(var m in c.p)l.push(encodeURIComponent(m)+"="+encodeURIComponent(c.p[m]));j+="?"+l.join("&"),g(b.info,c,!1)}else d=h,k=JSON.stringify(c),g(b.info,k,!1);b.expect_response&&(b.download_stream&&(i.responseType=b.download_stream),i.onreadystatechange=function(){if(this.readyState===this.DONE){var c=b.download_stream?this.response:this.responseText;if(c){var d=this.getResponseHeader("content-type");d===h?g(b.info,c,!0):g(b.info,"%DATA%",!0),a.success(c,d)}else try{a.error(f.CommError,"Low error")}catch(e){}}},a.setCancel(function(){i.abort()})),i.open("POST",j,!0),i.setRequestHeader("Content-Type",d),e&&i.setRequestHeader("Authorization",e),i.send(k),b.expect_response||a.success()}},c.WSComms=function(){this.rid=1,this.reqas={},this.evt=d()},c.WSComms.prototype={_waiting_open:!1,init:function(a,b){var c=b.options,d=new g(b.endpoint);this.ws=d,this._waiting_open=!0;var e=this.reqas,h=c.executor||null,i=b.info,j=this,k=c.messageSniffer;this.sniffer=k;var l=function(a){var b=h.packPayloadJSON(a);k(i,b,!1),d.send(b)},m=function(a){c.disconnectSniffer(i),d.close(),delete j.ws;for(var g in e)try{e[g].error(f.CommError,a.wasClean?"Cleanup":"Error")}catch(h){}delete j.reqas,j.reqas={},j._waiting_open=!1,b.native_iface.emit("disconnect")};d.onclose=m,d.onerror=m,d.onopen=function(a){j._waiting_open=!1,j.evt.emit("open"),b.native_iface.emit("connect")},d.onmessage=function(a){k(i,a.data,!0);var b;try{b=JSON.parse(a.data)}catch(c){return}if("rid"in b){var d=b.rid;d in e?(e[d].success(b,!0),delete e[d]):"S"===d.charAt(0)&&h&&h.onEndpointRequest(i,b,l)}}},close:function(){this.ws&&this.ws.close()},perform:function(a,b,c){var d=this;"ws"in this||d.init(a,b),this._waiting_open&&a.add(function(a){if(d._waiting_open){var b=function(){a.success()};d.evt.once("open",b),a.setCancel(function(){d.evt.off("open",b)})}}),a.add(function(a){d._perform(a,b,c)})},_perform:function(a,b,c){"ws"in this||a.error(f.CommError,"Disconnect while in progress");var d=this.reqas,e="C"+this.rid++;b.expect_response&&(d[e]=a,a.setCancel(function(){delete d[e]})),c.rid=e;var g=JSON.stringify(c);this.sniffer(b.info,g,!1),this.ws.send(g)}},g||(c.WSComms=c.HTTPComms),c.BrowserComms=function(){this.rid=1,this.reqas={}},c.BrowserComms.prototype={init:function(a,b){var c=b.options;this.opts=c;var d,e=b.endpoint.split("://",2)[1],g=window;if("parent"===e)e=g.parent;else if(e in g&&"postMessage"in g[e])e=g[e];else{var h=document;d=h.getElementById(e),d?e=d.contentWindow:a.error(f.CommError,"Unknown target: "+e)}e===g&&a.error(f.CommError,"Target matches current window"),this.target=e;var i=this.reqas,j=c.executor||null,k=b.info,l=c.targetOrigin,m=c.messageSniffer;this.sniffer=m;var n=function(a){m(l,a,!1),e.postMessage(a,l||"*")},o=function(a){if(m(k,a.data,!0),!a.source||a.source===e){if(l){if(a.origin!==l)return console.log("Error: peer origin mismatch "),console.log("Error >origin: "+a.origin),void console.log("Error >required: "+l)}else;var b=a.data;if("object"!=typeof b)return void console.log("Not object response: "+b);if("rid"in b){var c=b.rid;if(!("f"in b)&&c in i)i[c].success(b,!0),delete i[c];else{if(!("f"in b&&"S"===c.charAt(0)&&j))return;j.onEndpointRequest(k,b,n)}a.stopPropagation&&a.stopPropagation()}}};g.addEventListener("message",o,!1),b.native_iface.emit("connect")},close:function(){this.target&&(this.target=null)},perform:function(a,b,c){(b.upload_data||b.download_stream)&&a.error(f.CommError,"Raw Data is not supported by Web Messaging yet"),this.target||this.init(a,b);var d=this;a.add(function(a){var e=d.reqas,f="C"+d.rid++;b.expect_response&&(e[f]=a,a.setCancel(function(a){delete e[f]})),c.rid=f,d.sniffer(b.info,c,!1),d.target.postMessage(c,d.opts.targetOrigin||"*")})}}},function(a,c){"use strict";var d=b(24);c.AsyncSteps=d,c.FutoInError=d.FutoInError,c.Options={OPT_CALL_TIMEOUT_MS:"callTimeoutMS",OPT_PROD_MODE:"prodMode",OPT_COMM_CONFIG_CB:"commConfigCallback",OPT_MSG_SNIFFER:"messageSniffer",OPT_DISCONNECT_SNIFFER:"disconnectSniffer",OPT_SPEC_DIRS:"specDirs",OPT_EXECUTOR:"executor",OPT_TARGET_ORIGIN:"targetOrigin",OPT_RETRY_COUNT:"retryCount",SAFE_PAYLOAD_LIMIT:65536,SVC_RESOLVER:"#resolver",SVC_AUTH:"#auth",SVC_DEFENSE:"#defense",SVC_ACL:"#acl",SVC_LOG:"#log",SVC_CACHE_:"#cache.",FUTOIN_CONTENT_TYPE:"application/futoin+json"},c._ifacever_pattern=/^(([a-z][a-z0-9]*)(\.[a-z][a-z0-9]*)*):(([0-9]+)\.([0-9]+))$/},function(a,c){"use strict";function d(a){n(this),this._iface_info={},this._iface_impl={},this._impl=k(a),i(this,p)}function e(a){n(this),this._iface_info={},this._iface_impl={},this._impl=l(a),i(this,q)}var f=b(3),g=f.FutoInError,h=b(5),i=b(63),j=b(62),k=b(6),l=b(0),m=b(7),n=b(9),o=f.Options;i(d,o);var p={_secure_replace:/^secure\+/,_secure_test:/^(https|wss|unix):\/\//,_native_iface_builder:function(a,b){return h(a,b)}};i(p,o),p.register=function(a,b,c,d,e,h){var i=null===b;!i&&b in this._iface_info&&a.error(g.InvokerError,"Already registered");var k=c.match(f._ifacever_pattern);null===k&&a.error(g.InvokerError,"Invalid ifacever");var l,m=k[1],n=k[4],o=k[5],p=k[6],q=!1,r=null,s=!1;if(i)l="callback",s=!0;else if("string"==typeof d)switch(this._secure_replace.test(d)?(q=!0,d=d.replace(this._secure_replace,"")):this._secure_test.test(d)&&(q=!0),r=this._native_iface_builder,l=d.split(":")[0]){case"http":case"https":break;case"ws":case"wss":case"unix":s=!0;break;case"browser":h&&h.targetOrigin&&(q=!0),s=!0;break;default:a.error(g.InvokerError,"Unknown endpoint schema")}else"onInternalRequest"in d?(q=!0,r=this._native_iface_builder,l="#internal#",s=!0):(q=!0,r=d,d=null,l=null,s=!0);h=h||{},j(h,this._impl.options);var t={iface:m,version:n,mjrver:o,mnrver:p,endpoint:d,endpoint_scheme:l,creds:e||null,secure_channel:q,impl:r,regname:b,inherits:null,funcs:null,constraints:null,options:h,_invoker_use:!0,_user_info:null};b&&(this._iface_info[b]=t);var u=this;a.add(function(a){u._impl.onRegister(a,t),a.add(function(a){"SecureChannel"in t.constraints&&!q&&a.error(g.SecurityError,"SecureChannel is required"),"BiDirectChannel"in t.constraints&&!s&&a.error(g.InvokerError,"BiDirectChannel is required"),i&&a.success(t,u._native_iface_builder(u._impl,t)),u.emit("register",b,c,t)})},function(a,c){b&&delete u._iface_info[b]})},p.iface=function(a){var b=this._iface_info[a];if(!b)throw new Error(g.InvokerError);var c=b.regname,d=this._iface_impl[c];if(!d){var e=b.options.nativeImpl;d=e?new e(this._impl,b):b.impl(this._impl,b),this._iface_impl[c]=d}return d},p.unRegister=function(a){var b=this._iface_info[a];if(!b)throw new Error(g.InvokerError);var c=b.regname;if(c===a){delete this._iface_info[c];var d=this._iface_impl[c];if(d&&(d._close(),delete this._iface_impl[c]),b.aliases)for(var e=b.aliases,f=0;f<e.length;++f)delete this._iface_info[e[f]]}else delete this._iface_info[a],b.aliases.splice(b.aliases.indexOf(a),0);this.emit("unregister",a,b)},p.defense=function(){return this.iface(this.SVC_DEFENSE)},p.log=function(){return this.iface(this.SVC_LOG)},p.cache=function(a){return this.iface(this.SVC_CACHE_+(a||"default"))},p.assertIface=function(a,b){var c=this._iface_info[a];if(!c)throw new Error(g.InvokerError);var d=b.match(f._ifacever_pattern);if(null===d)throw new Error(g.InvokerError);var e=d[1],h=d[5],i=d[6];if(c.iface!==e||c.mjrver!==h||c.mnrver<i)throw new Error(g.InvokerError)},p.alias=function(a,b){var c=this._iface_info[a];if(!c||this._iface_info[b])throw new Error(g.InvokerError);this._iface_info[b]=c,c.aliases?c.aliases.push(b):c.aliases=[b],this.emit("register",b,c.iface+":"+c.version,c)},p.close=function(){var a=this._iface_impl;for(var b in a)a[b]._close();var c=this._impl.comms;for(var d in c)c[d].close();this.emit("close")},i(e,o);var q={};i(q,p),q.initFromCache=function(a,b){a.error(g.NotImplemented,"Caching is not supported yet")},q.cacheInit=function(a){},c.SimpleCCM=d,c.AdvancedCCM=e,c.FutoInError=g,c.NativeIface=h.NativeIface,c.InterfaceInfo=h.InterfaceInfo,c.SpecTools=m,c.SpecTools._ifacever_pattern=f._ifacever_pattern},function(a,c){"use strict";function d(a){this._raw_info=a}function e(a,b){this._ccmimpl=a,this._raw_info=b,this._iface_info=null,this._comms={},h(this,m),j(this);for(var c in this._raw_info.funcs){var d=this._raw_info.funcs[c];d.rawupload||c in this||(this[c]=this._member_call_generate(c,d))}}var f=b(3),g=f.FutoInError,h=b(63),i=b(26),j=b(9),k=b(24),l=f.Options.FUTOIN_CONTENT_TYPE;c=a.exports=function(b,c){return new a.exports.NativeIface(b,c)},d.prototype={name:function(){return this._raw_info.iface},version:function(){return this._raw_info.version},inherits:function(){return this._raw_info.inherits},funcs:function(){return this._raw_info.funcs},constraints:function(){return this._raw_info.constraints}},c.InterfaceInfo=d;var m={call:function(a,b,c,d,e,f){c=c||{};var h=this._raw_info,i={ccmimpl:this._ccmimpl,name:b,info:h,upload_data:d,download_stream:e,rsp_content_type:null,native_iface:this,options:h.options,endpoint:h.endpoint,expect_response:!0},j=this._ccmimpl;a.add(function(a){j.createMessage(a,i,c)}),a.add(function(a,c){var m;i.expect_response?(m=a,"number"!=typeof f&&(f=i.info.options.callTimeoutMS),f>0&&m.setTimeout(f)):m=k();var n=h.endpoint_scheme;if("#internal#"===n)i.endpoint.onInternalRequest(m,h,c,d,e);else if("http"===n||"https"===n)j.perfomHTTP(m,i,c);else if("ws"===n||"wss"===n){var o,p=i.download_stream||i.info.funcs&&(o=i.info.funcs[b])&&o.rawresult;i.upload_data||p?(i.endpoint=i.endpoint.replace("ws","http"),i.rawresult=p,j.perfomHTTP(m,i,c)):j.perfomWebSocket(m,i,c)}else i.upload_data?m.error(g.InvokerError,"Upload data is allowed only for HTTP/WS endpoints"):i.download_stream?m.error(g.InvokerError,"Download stream is allowed only for HTTP/WS endpoints"):"browser"===n?j.perfomBrowser(m,i,c):"unix"===n?j.perfomUNIX(m,i,c):"callback"===n?i.endpoint(m,i,c):m.error(g.InvokerError,"Unknown endpoint scheme");m!==a?(m.execute(),a.success()):m.add(function(a,b,c){if(i.download_stream)a.success(!0);else if(c===l||c===!0){if("string"==typeof b)try{b=JSON.parse(b)}catch(d){a.error(g.CommError,"JSON:"+d.message)}j.onMessageResponse(a,i,b)}else j.onDataResponse(a,i,b)})})},_member_call_intercept:function(a,b,c,d){var e=c.params,f=Object.keys(e);d.length>f.length?a.error(g.InvokerError,"Unknown parameters"):d.length<c.min_args?a.error(g.InvokerError,"Missing parameters"):d.length<f.length&&(f=f.splice(0,d.length));var h=i(f,d);this.call(a,b,h)},_member_call_generate:function(a,b){return function(c){this._member_call_intercept(c,a,b,Array.prototype.slice.call(arguments,1))}},ifaceInfo:function(){return this._iface_info||(this._iface_info=new d(this._raw_info)),this._iface_info},bindDerivedKey:function(a){throw new Error(g.InvokerError,"Not Implemented")},_close:function(){var a=this._comms;for(var b in a)a[b].close();this.emit("close")}};c.NativeIface=e},function(a,c){"use strict";function d(a){a=a||{},i(a,k),this.options=a,this.comms={}}var e,f=b(3),g=f.FutoInError,h=b(8),i=b(62);if(h){var j=require;e=j("./node_comms")}else e=b(2);c=a.exports=function(b){return new a.exports.SimpleCCMImpl(b)};var k={callTimeoutMS:3e4,prodMode:!1,commConfigCallback:null,retryCount:1,messageSniffer:function(){},disconnectSniffer:function(){}};d.prototype={onRegister:function(a,b){b.funcs={},b.inherits=[],b.constraints={}},createMessage:function(a,b,c){var d=b.info,e={f:d.iface+":"+d.version+":"+b.name,p:c,forcersp:!0};null!==d.creds&&"master"!==d.creds&&(e.sec=d.creds),a.success(e)},onMessageResponse:function(a,b,c){"e"in c?a.error(c.e,c.edesc):a.success(c.r)},onDataResponse:function(a,b,c){a.success(c)},getComms:function(a,b,c,d){var e,f,h=b.options,i=this.options;h.executor!==i.executor||h.messageSniffer!==i.messageSniffer||h.disconnectSniffer!==i.disconnectSniffer||h.commConfigCallback!==i.commConfigCallback?(e=b.native_iface._comms,f=b.info.endpoint_scheme):(e=this.comms,f=b.endpoint+"##"+(b.credentials||"")+"##"+(d||""));var j=e[f];return j||(c||a.error(g.InvokerError,"Not implemented "+b.info.endpoint_scheme+" scheme"),j=new c,e[f]=j),j},performCommon:function(a,b,c,d){var e,f,h=b.options.retryCount;a.repeat(h+1,function(a,i){a.add(function(a){d.perform(a,b,c),a.add(function(a,b,c){e=b,f=c,a["break"]()})},function(a,d){d===g.CommError&&(b.native_iface.emit("commError",a.state.error_info,c),h>i&&a["continue"]())})}).add(function(a){a.success(e,f)})},perfomHTTP:function(a,b,c){var d=this.getComms(a,b,e.HTTPComms);this.performCommon(a,b,c,d)},perfomWebSocket:function(a,b,c){var d=this.getComms(a,b,e.WSComms);this.performCommon(a,b,c,d)},perfomUNIX:function(a,b,c){a.error(g.InvokerError,"Not implemented unix:// scheme")},perfomBrowser:function(a,b,c){var d=this.getComms(a,b,e.BrowserComms,b.options.targetOrigin);d.perform(a,b,c)}},c.SimpleCCMImpl=d},function(a){"use strict";var c,d,e=b(3),f=e.FutoInError,g=b(8),h=b(56),i=b(26),j=b(25);if(g){var k=require;c=k("fs"),d=k("request")}var l={standard_errors:{UnknownInterface:!0,NotSupportedVersion:!0,NotImplemented:!0,Unauthorized:!0,InternalError:!0,InvalidRequest:!0,DefenseRejected:!0,PleaseReauth:!0,SecurityError:!0},_ver_pattern:/^([0-9]+)\.([0-9]+)$/,loadIface:function(a,b,e){var h=null;a.forEach(e,function(a,e,f){var i=b.iface+"-"+b.version+"-iface.json";a.add(function(a){if("string"==typeof f&&g){var b=f+"/"+i,e=function(b){if(a){try{return f=JSON.parse(b),f._just_loaded=!0,void a.success()}catch(c){}try{a["continue"]()}catch(c){}}};"http"===b.substr(0,4)?d(b,function(a,b,c){e(c)}):c.readFile(b,{encoding:"utf8"},function(a,b){e(b)}),a.setCancel(function(b){a=null})}}).add(function(a){if("string"==typeof f&&!g){var b=f+"/"+i,c=new XMLHttpRequest;c.onreadystatechange=function(){if(this.readyState===this.DONE){var b=this.responseText;if(b)try{return f=JSON.parse(b),f._just_loaded=!0,void a.success()}catch(c){}try{a["continue"]()}catch(d){}}},c.open("GET",b,!0),c.send(),a.setCancel(function(a){c.abort()})}}).add(function(a){"object"==typeof f&&f.iface===b.iface&&f.version===b.version&&(h=f,a["break"]())})}).add(function(a){null===h&&a.error(f.InternalError,"Failed to load valid spec for "+b.iface+":"+b.version),l.parseIface(a,b,e,h)})},parseIface:function(a,b,c,d){if(d._just_loaded?(b.funcs=d.funcs||{},b.types=d.types||{}):(b.funcs=h(d.funcs||{}),b.types=h(d.types||{})),l._parseFuncs(a,b),l._parseTypes(a,b),"requires"in d){var g=d.requires;Array.isArray(g)||a.error(f.InternalError,'"requires" is not array'),b.constraints=i(g,g)}else b.constraints={};if(l._checkFTN3Rev(a,b,d),b.inherits=[],"inherit"in d){var j=d.inherit.match(e._ifacever_pattern);null===j&&a.error(f.InvokerError,"Invalid inherit ifacever: "+d.inherit);var k={};k.iface=j[1],k.version=j[4],l.loadIface(a,k,c),a.add(function(a){l._parseImportInherit(a,b,c,d,k),b.inherits.push(d.inherit),b.inherits=b.inherits.concat(k.inherits)})}"imports"in d?(b.imports=d.imports.slice(),a.forEach(d.imports,function(a,g,h){var i=h.match(e._ifacever_pattern);null===i&&a.error(f.InvokerError,"Invalid import ifacever: "+h);var j={};j.iface=i[1],j.version=i[4],l.loadIface(a,j,c),a.add(function(a){l._parseImportInherit(a,b,c,d,j),b.imports=b.imports.concat(j.imports)})})):b.imports=[]},_checkFTN3Rev:function(a,b,c){var d=c.ftn3rev||"1.0",e=d.match(l._ver_pattern);null===e&&a.error(f.InternalError,"Invalid ftn3rev field");var g=parseInt(e[1]),h=parseInt(e[2]);1===g?(1>h&&(c.imports||c.types||"BiDirectChannel"in b.constraints)&&a.error(f.InternalError,"Missing ftn3rev field when FTN3 v1.1 features are used"),!b._invoker_use&&h>1&&a.error(f.InternalError,"Not supported FTN3 revision for Executor")):a.error(f.InternalError,"Not supported FTN3 revision")},_parseFuncs:function(a,b){var c,d;for(var e in b.funcs){if(c=b.funcs[e],c.min_args=0,"params"in c){var g=c.params;"object"!=typeof g&&a.error(f.InternalError,"Invalid params object");for(d in g){var h=g[d];"object"!=typeof h&&a.error(f.InternalError,"Invalid param object"),"type"in h||a.error(f.InternalError,"Missing type for params"),"default"in h||(c.min_args+=1)}}else c.params={};if(c.expect_result=!1,"result"in c){var j=c.result;"object"!=typeof j&&a.error(f.InternalError,"Invalid result object");for(var k in j){var l=j[k];"object"!=typeof l&&a.error(f.InternalError,"Invalid resultvar object"),"type"in l||a.error(f.InternalError,"Missing type for result"),c.expect_result=!0}}else c.result={};if("rawupload"in c||(c.rawupload=!1),"rawresult"in c||(c.rawresult=!1),c.rawresult&&(c.expect_result=!0),"throws"in c){c.expect_result||a.error(f.InternalError,'"throws" without result');var m=c["throws"];Array.isArray(m)||a.error(f.InternalError,'"throws" is not array'),c["throws"]=i(m,m)}else c["throws"]={}}},_parseTypes:function(a,b){var c;for(var d in b.types)if(c=b.types[d],"type"in c||a.error(f.InternalError,'Missing "type" for custom type'),"map"===c.type){if(!("fields"in c)){c.fields={};continue}for(var e in c.fields)"type"in c.fields[e]||a.error(f.InternalError,'Missing "type" for custom type field')}},_parseImportInherit:function(a,b,c,d,e){var g,h;for(var i in e.types)i in b.types?a.error(f.InternalError,"Iface type redifintion: "+i):b.types[i]=e.types[i];for(var k in e.funcs){var l=e.funcs[k];if(k in b.funcs){var m=l.params,n=b.funcs[k].params,o=Object.keys(m),p=Object.keys(n);for(p.length<o.length&&a.error(f.InternalError,"Invalid param count for '"+k+"'"),g=0;g<o.length;++g)h=o[g],h!==p[g]&&a.error(f.InternalError,"Invalid param order for '"+k+"/"+h+"'"),m[h].type!==n[h].type&&a.error(f.InternalError,"Param type mismatch '"+k+"/"+h+"'");for(;g<p.length;++g)h=p[g],h in m||"default"in n[h]||null===n[h]||a.error(f.InternalError,"Missing default for '"+k+"/"+h+"'");l.rawresult!==b.funcs[k].rawresult&&a.error(f.InternalError,"'rawresult' flag mismatch for '"+k+"'"),l.rawupload&&!b.funcs[k].rawupload&&a.error(f.InternalError,"'rawupload' flag is missing for '"+k+"'")}else b.funcs[k]=l}j(Object.keys(e.constraints),d.requires).length&&a.error(f.InternalError,"Missing constraints from inherited")},checkConsistency:function(a,b){},checkType:function(a,b,c,d){if(null===c)return!1;switch(b){case"any":return!0;case"boolean":case"string":case"number":return typeof c===b;case"map":return"object"==typeof c&&!(c instanceof Array);case"integer":return"number"==typeof c&&(0|c)===c;case"array":return c instanceof Array;default:if(!("types"in a&&b in a.types))return!1}if(b in a.types){var e=a.types[b];d=d||{};var g=e.type;if(g in d)throw console&&console.log("[ERROR] Custom type recursion: "+e),new Error(f.InternalError);if(d[b]=!0,!this.checkType(a,g,c,d))return!1;switch(g){case"integer":case"number":return"min"in e&&c<e.min?!1:"max"in e&&c>e.max?!1:!0;case"string":if("regex"in e){var h;return"_comp_regex"in a?h=a._comp_regex:(h={},a._comp_regex=h),b in h||(h[b]=new RegExp(e.regex)),null!==c.match(h[b])}return!0;case"array":var i=c.length;if("minlen"in e&&i<e.minlen)return!1;if("maxlen"in e&&i>e.maxlen)return!1;if("elemtype"in e)for(var j=e.elemtype,k=0;i>k;++k)if(!this.checkType(a,j,c[k],[]))return!1;return!0;case"map":var l=e.fields;for(var m in l){var n=l[m];if(!(m in c)||null===c[m])return n.optional?(c[m]=null,!0):!1;if(!this.checkType(a,n.type,c[m],[]))return!1}return!0}}return!1},checkParameterType:function(a,b,c,d,e){l.checkType(b,b.funcs[c].params[d].type,e)||a.error(f.InvalidRequest,"Type mismatch for parameter: "+d)},checkResultType:function(a,b,c,d,e){l.checkType(b,b.funcs[c].result[d].type,e)||a.error(f.InvalidRequest,"Type mismatch for result: "+d)},checkFutoInType:function(a,b,c,d){l.checkType({},b,d)||a.error(f.InvalidRequest,"Type mismatch for parameter: "+c)}};a.exports=l},function(a){a.exports=!1;try{a.exports="[object process]"===Object.prototype.toString.call(c.process)}catch(b){}},function(a,c){"use strict";var d,e,f,g,h,i,j,k=b(10),l=b(19),m=Function.prototype.apply,n=Function.prototype.call,o=Object.create,p=Object.defineProperty,q=Object.defineProperties,r=Object.prototype.hasOwnProperty,s={configurable:!0,enumerable:!1,writable:!0};d=function(a,b){var c;return l(b),r.call(this,"__ee__")?c=this.__ee__:(c=s.value=o(null),p(this,"__ee__",s),s.value=null),c[a]?"object"==typeof c[a]?c[a].push(b):c[a]=[c[a],b]:c[a]=b,this},e=function(a,b){var c,e;return l(b),e=this,d.call(this,a,c=function(){f.call(e,a,c),m.call(b,this,arguments)}),c.__eeOnceListener__=b,this},f=function(a,b){var c,d,e,f;if(l(b),!r.call(this,"__ee__"))return this;if(c=this.__ee__,!c[a])return this;if(d=c[a],"object"==typeof d)for(f=0;e=d[f];++f)(e===b||e.__eeOnceListener__===b)&&(2===d.length?c[a]=d[f?0:1]:d.splice(f,1));else(d===b||d.__eeOnceListener__===b)&&delete c[a];return this},g=function(a){var b,c,d,e,f;if(r.call(this,"__ee__")&&(e=this.__ee__[a]))if("object"==typeof e){for(c=arguments.length,f=new Array(c-1),b=1;c>b;++b)f[b-1]=arguments[b];for(e=e.slice(),b=0;d=e[b];++b)m.call(d,this,f)}else switch(arguments.length){case 1:n.call(e,this);break;case 2:n.call(e,this,arguments[1]);break;case 3:n.call(e,this,arguments[1],arguments[2]);break;default:for(c=arguments.length,f=new Array(c-1),b=1;c>b;++b)f[b-1]=arguments[b];m.call(e,this,f)}},h={on:d,once:e,off:f,emit:g},i={on:k(d),once:k(e),off:k(f),emit:k(g)},j=q({},i),a.exports=c=function(a){return null==a?o(j):q(Object(a),i)},c.methods=h},function(a){"use strict";var c,d=b(11),e=b(18),f=b(14),g=b(21);c=a.exports=function(a,b){var c,f,h,i,j;return arguments.length<2||"string"!=typeof a?(i=b,b=a,a=null):i=arguments[2],null==a?(c=h=!0,f=!1):(c=g.call(a,"c"),f=g.call(a,"e"),h=g.call(a,"w")),j={value:b,configurable:c,enumerable:f,writable:h},i?d(e(i),j):j},c.gs=function(a,b,c){var h,i,j,k;return"string"!=typeof a?(j=c,c=b,b=a,a=null):j=arguments[3],null==b?b=void 0:f(b)?null==c?c=void 0:f(c)||(j=c,c=void 0):(j=b,b=c=void 0),null==a?(h=!0,i=!1):(h=g.call(a,"c"),i=g.call(a,"e")),k={get:b,set:c,configurable:h,enumerable:i},j?d(e(j),k):k}},function(a){"use strict";a.exports=b(12)()?Object.assign:b(13)},function(a){"use strict";a.exports=function(){var a,b=Object.assign;return"function"!=typeof b?!1:(a={foo:"raz"},b(a,{bar:"dwa"},{trzy:"trzy"}),a.foo+a.bar+a.trzy==="razdwatrzy")}},function(a){"use strict";var c=b(15),d=b(20),e=Math.max;a.exports=function(a,b){var f,g,h,i=e(arguments.length,2);for(a=Object(d(a)),h=function(c){try{a[c]=b[c]}catch(d){f||(f=d)}},g=1;i>g;++g)b=arguments[g],c(b).forEach(h);if(void 0!==f)throw f;return a}},function(a){"use strict";a.exports=function(a){return"function"==typeof a}},function(a){"use strict";a.exports=b(16)()?Object.keys:b(17)},function(a){"use strict";a.exports=function(){try{return Object.keys("primitive"),!0}catch(a){return!1}}},function(a){"use strict";var b=Object.keys;a.exports=function(a){return b(null==a?a:Object(a))}},function(a){"use strict";var b=Array.prototype.forEach,c=Object.create,d=function(a,b){var c;for(c in a)b[c]=a[c]};a.exports=function(){var a=c(null);return b.call(arguments,function(b){null!=b&&d(Object(b),a)}),a}},function(a){"use strict";a.exports=function(a){if("function"!=typeof a)throw new TypeError(a+" is not a function");return a}},function(a){"use strict";a.exports=function(a){if(null==a)throw new TypeError("Cannot use null or undefined");return a}},function(a){"use strict";a.exports=b(22)()?String.prototype.contains:b(23)},function(a){"use strict";var b="razdwatrzy";a.exports=function(){return"function"!=typeof b.contains?!1:b.contains("dwa")===!0&&b.contains("foo")===!1}},function(a){"use strict";var b=String.prototype.indexOf;a.exports=function(a){return b.call(this,a,arguments[1])>-1}},function(b){b.exports=a},function(a){function c(){for(var a=-1,b=arguments.length;++a<b;){var c=arguments[a];if(g(c)||f(c))break}return d(c,e(arguments,!1,!0,++a))}var d=b(34),e=b(35),f=b(57),g=b(58);a.exports=c},function(a){function c(a,b){var c=-1,e=a?a.length:0,f={};for(!e||b||d(a[0])||(b=[]);++c<e;){var g=a[c];b?f[g]=b[c]:g&&(f[g[0]]=g[1])}return f}var d=b(58);a.exports=c},function(a){function d(a){var b=a?a.length:0;for(this.data={hash:h(null),set:new g};b--;)this.push(a[b])}var e=b(43),f=b(59),g=f(g=c.Set)&&g,h=f(h=Object.create)&&h;d.prototype.push=e,a.exports=d},function(a){function b(a,b){var c=-1,d=a.length;for(b||(b=Array(d));++c<d;)b[c]=a[c];return b}a.exports=b},function(a){function b(a,b){for(var c=-1,d=a.length;++c<d&&b(a[c],c,a)!==!1;);return a}a.exports=b},function(a){function b(a,b){return"undefined"==typeof a?b:a}a.exports=b},function(a){function c(a,b,c){var f=e(b);if(!c)return d(b,a,f);for(var g=-1,h=f.length;++g<h;){var i=f[g],j=a[i],k=c(j,b[i],i,a,b);(k===k?k===j:j!==j)&&("undefined"!=typeof j||i in a)||(a[i]=k)}return a}var d=b(33),e=b(64);a.exports=c},function(a){function c(a,b,o,p,q,r,t){var u;if(o&&(u=q?o(a,p,q):o(a)),"undefined"!=typeof u)return u;if(!l(a))return a;var w=k(a);if(w){if(u=h(a),!b)return d(a,u)}else{var x=M.call(a),y=x==s;if(x!=v&&x!=n&&(!y||q))return K[x]?i(a,x,b):q?a:{};if(u=j(y?{}:a),!b)return f(a,u,m(a))}r||(r=[]),t||(t=[]);for(var z=r.length;z--;)if(r[z]==a)return t[z];return r.push(a),t.push(u),(w?e:g)(a,function(d,e){u[e]=c(d,b,o,e,a,r,t)}),u}var d=b(28),e=b(29),f=b(33),g=b(37),h=b(47),i=b(48),j=b(49),k=b(58),l=b(60),m=b(64),n="[object Arguments]",o="[object Array]",p="[object Boolean]",q="[object Date]",r="[object Error]",s="[object Function]",t="[object Map]",u="[object Number]",v="[object Object]",w="[object RegExp]",x="[object Set]",y="[object String]",z="[object WeakMap]",A="[object ArrayBuffer]",B="[object Float32Array]",C="[object Float64Array]",D="[object Int8Array]",E="[object Int16Array]",F="[object Int32Array]",G="[object Uint8Array]",H="[object Uint8ClampedArray]",I="[object Uint16Array]",J="[object Uint32Array]",K={};K[n]=K[o]=K[A]=K[p]=K[q]=K[B]=K[C]=K[D]=K[E]=K[F]=K[u]=K[v]=K[w]=K[y]=K[G]=K[H]=K[I]=K[J]=!0,K[r]=K[s]=K[t]=K[x]=K[z]=!1;var L=Object.prototype,M=L.toString;a.exports=c},function(a){function b(a,b,c){c||(c=b,b={});for(var d=-1,e=c.length;++d<e;){var f=c[d];b[f]=a[f]}return b}a.exports=b},function(a){function c(a,b){var c=a?a.length:0,g=[];if(!c)return g;var h=-1,i=d,j=!0,k=j&&b.length>=200&&f(b),l=b.length;k&&(i=e,j=!1,b=k);a:for(;++h<c;){var m=a[h];if(j&&m===m){for(var n=l;n--;)if(b[n]===m)continue a;g.push(m)}else i(b,m)<0&&g.push(m)}return g}var d=b(38),e=b(42),f=b(45);a.exports=c},function(a){function c(a,b,h,i){for(var j=(i||0)-1,k=a.length,l=-1,m=[];++j<k;){var n=a[j];if(g(n)&&f(n.length)&&(e(n)||d(n))){b&&(n=c(n,b,h));var o=-1,p=n.length;for(m.length+=p;++o<p;)m[++l]=n[o]}else h||(m[++l]=n)}return m}var d=b(57),e=b(58),f=b(52),g=b(53);a.exports=c},function(a){function c(a,b,c){for(var e=-1,f=d(a),g=c(a),h=g.length;++e<h;){var i=g[e];if(b(f[i],i,f)===!1)break}return a}var d=b(55);a.exports=c},function(a){function c(a,b){return d(a,b,e)}var d=b(36),e=b(64);a.exports=c},function(a){function c(a,b,c){if(b!==b)return d(a,c);for(var e=(c||0)-1,f=a.length;++e<f;)if(a[e]===b)return e;return-1}var d=b(46);a.exports=c},function(a){function b(a){return"string"==typeof a?a:null==a?"":a+""}a.exports=b},function(a){function c(a,b,c){if("function"!=typeof a)return d;if("undefined"==typeof b)return a;switch(c){case 1:return function(c){return a.call(b,c)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)};case 5:return function(c,d,e,f,g){return a.call(b,c,d,e,f,g)}}return function(){return a.apply(b,arguments)}}var d=b(69);a.exports=c},function(a){function d(a){return h.call(a,0)}var e=b(68),f=b(59),g=f(g=c.ArrayBuffer)&&g,h=f(h=g&&new g(0).slice)&&h,i=Math.floor,j=f(j=c.Uint8Array)&&j,k=function(){try{var a=f(a=c.Float64Array)&&a,b=new a(new g(10),0,1)&&a}catch(d){}return b}(),l=k?k.BYTES_PER_ELEMENT:0;h||(d=g&&j?function(a){var b=a.byteLength,c=k?i(b/l):0,d=c*l,e=new g(b);if(c){var f=new k(e,0,c);f.set(new k(a,0,c))}return b!=d&&(f=new j(e,d),f.set(new j(a,d))),e}:e(null)),a.exports=d},function(a){function c(a,b){var c=a.data,e="string"==typeof b||d(b)?c.set.has(b):c.hash[b];return e?0:-1}var d=b(60);a.exports=c},function(a){function c(a){var b=this.data;"string"==typeof a||d(a)?b.set.add(a):b.hash[a]=!0}var d=b(60);a.exports=c},function(a){function c(a){return function(){var b=arguments.length,c=arguments[0];if(2>b||null==c)return c;if(b>3&&e(arguments[1],arguments[2],arguments[3])&&(b=2),b>3&&"function"==typeof arguments[b-2])var f=d(arguments[--b-1],arguments[b--],5);else b>2&&"function"==typeof arguments[b-1]&&(f=arguments[--b]);for(var g=0;++g<b;){var h=arguments[g];h&&a(c,h,f)}return c}}var d=b(40),e=b(51);a.exports=c},function(a){var d=b(27),e=b(68),f=b(59),g=f(g=c.Set)&&g,h=f(h=Object.create)&&h,i=h&&g?function(a){return new d(a)}:e(null);a.exports=i},function(a){function b(a,b,c){for(var d=a.length,e=c?b||d:(b||0)-1;c?e--:++e<d;){var f=a[e];if(f!==f)return e}return-1}a.exports=b},function(a){function b(a){var b=a.length,c=new a.constructor(b);return b&&"string"==typeof a[0]&&d.call(a,"index")&&(c.index=a.index,c.input=a.input),c
}var c=Object.prototype,d=c.hasOwnProperty;a.exports=b},function(a){function c(a,b,c){var u=a.constructor;switch(b){case j:return d(a);case e:case f:return new u(+a);case k:case l:case m:case n:case o:case p:case q:case r:case s:var v=a.buffer;return new u(c?d(v):v,a.byteOffset,a.length);case g:case i:return new u(a);case h:var w=new u(a.source,t.exec(a));w.lastIndex=a.lastIndex}return w}var d=b(41),e="[object Boolean]",f="[object Date]",g="[object Number]",h="[object RegExp]",i="[object String]",j="[object ArrayBuffer]",k="[object Float32Array]",l="[object Float64Array]",m="[object Int8Array]",n="[object Int16Array]",o="[object Int32Array]",p="[object Uint8Array]",q="[object Uint8ClampedArray]",r="[object Uint16Array]",s="[object Uint32Array]",t=/\w*$/;a.exports=c},function(a){function b(a){var b=a.constructor;return"function"==typeof b&&b instanceof b||(b=Object),new b}a.exports=b},function(a){function b(a,b){return a=+a,b=null==b?c:b,a>-1&&a%1==0&&b>a}var c=Math.pow(2,53)-1;a.exports=b},function(a){function c(a,b,c){if(!f(c))return!1;var g=typeof b;if("number"==g)var h=c.length,i=e(h)&&d(b,h);else i="string"==g&&b in c;return i&&c[b]===a}var d=b(50),e=b(52),f=b(60);a.exports=c},function(a){function b(a){return"number"==typeof a&&a>-1&&a%1==0&&c>=a}var c=Math.pow(2,53)-1;a.exports=b},function(a){function b(a){return a&&"object"==typeof a||!1}a.exports=b},function(a){function c(a){for(var b=h(a),c=b.length,j=c&&a.length,l=j&&g(j)&&(e(a)||i.nonEnumArgs&&d(a)),m=-1,n=[];++m<c;){var o=b[m];(l&&f(o,j)||k.call(a,o))&&n.push(o)}return n}var d=b(57),e=b(58),f=b(50),g=b(52),h=b(65),i=b(67),j=Object.prototype,k=j.hasOwnProperty;a.exports=c},function(a){function c(a){return d(a)?a:Object(a)}var d=b(60);a.exports=c},function(a){function c(a,b,c){return b="function"==typeof b&&e(b,c,1),d(a,!0,b)}var d=b(32),e=b(40);a.exports=c},function(a){function c(a){var b=e(a)?a.length:void 0;return d(b)&&h.call(a)==f||!1}var d=b(52),e=b(53),f="[object Arguments]",g=Object.prototype,h=g.toString;a.exports=c},function(a){var c=b(52),d=b(59),e=b(53),f="[object Array]",g=Object.prototype,h=g.toString,i=d(i=Array.isArray)&&i,j=i||function(a){return e(a)&&c(a.length)&&h.call(a)==f||!1};a.exports=j},function(a){function c(a){return null==a?!1:j.call(a)==f?k.test(i.call(a)):e(a)&&g.test(a)||!1}var d=b(66),e=b(53),f="[object Function]",g=/^\[object .+?Constructor\]$/,h=Object.prototype,i=Function.prototype.toString,j=h.toString,k=RegExp("^"+d(j).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");a.exports=c},function(a){function b(a){var b=typeof a;return"function"==b||a&&"object"==b||!1}a.exports=b},function(a){var c=b(31),d=b(44),e=d(c);a.exports=e},function(a){function c(a){if(null==a)return a;var b=d(arguments);return b.push(f),e.apply(void 0,b)}var d=b(28),e=b(61),f=b(30);a.exports=c},function(a){a.exports=b(61)},function(a){var c=b(52),d=b(59),e=b(60),f=b(54),g=d(g=Object.keys)&&g,h=g?function(a){if(a)var b=a.constructor,d=a.length;return"function"==typeof b&&b.prototype===a||"function"!=typeof a&&d&&c(d)?f(a):e(a)?g(a):[]}:f;a.exports=h},function(a){function c(a){if(null==a)return[];h(a)||(a=Object(a));var b=a.length;b=b&&g(b)&&(e(a)||i.nonEnumArgs&&d(a))&&b||0;for(var c=a.constructor,j=-1,l="function"==typeof c&&c.prototype==a,m=Array(b),n=b>0;++j<b;)m[j]=j+"";for(var o in a)n&&f(o,b)||"constructor"==o&&(l||!k.call(a,o))||m.push(o);return m}var d=b(57),e=b(58),f=b(50),g=b(52),h=b(60),i=b(67),j=Object.prototype,k=j.hasOwnProperty;a.exports=c},function(a){function c(a){return a=d(a),a&&f.test(a)?a.replace(e,"\\$&"):a}var d=b(39),e=/[.*+?^${}()|[\]\/\\]/g,f=RegExp(e.source);a.exports=c},function(a){var d=b(59),e=/\bthis\b/,f=Object.prototype,g=(g=c.window)&&g.document,h=f.propertyIsEnumerable,i={};!function(){i.funcDecomp=!d(c.WinRTError)&&e.test(function(){return this}),i.funcNames="string"==typeof Function.name;try{i.dom=11===g.createDocumentFragment().nodeType}catch(a){i.dom=!1}try{i.nonEnumArgs=!h.call(arguments,1)}catch(a){i.nonEnumArgs=!0}}(0,0),a.exports=i},function(a){function b(a){return function(){return a}}a.exports=b},function(a){function b(a){return a}a.exports=b}],b(1)});

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

var content_type;
var auth_header;

@@ -63,3 +64,11 @@ if ( rawreq ||

{
url += req.sec + '/';
// clear-text auth should go as HTTP Basic (FTN5)
if ( req.sec === ctx.options.credentials )
{
auth_header = 'Basic ' + window.btoa( req.sec ); // jshint ignore:line
}
else
{
url += req.sec + '/';
}
}

@@ -140,2 +149,8 @@

httpreq.setRequestHeader( 'Content-Type', content_type );
if ( auth_header )
{
httpreq.setRequestHeader( 'Authorization', auth_header );
}
httpreq.send( rawreq );

@@ -142,0 +157,0 @@

@@ -176,3 +176,12 @@ "use strict";

{
path += "/" + req.sec;
// clear-text auth should go as HTTP Basic (FTN5)
if ( req.sec === ctx.options.credentials )
{
httpopts.headers.authorization =
'Basic ' + new Buffer( req.sec ).toString( 'base64' );
}
else
{
path += "/" + req.sec;
}
}

@@ -179,0 +188,0 @@

@@ -134,4 +134,5 @@ "use strict";

var content_type;
var retries = ctx.options.retryCount;
as.repeat( ctx.options.retryCount + 1, function( as )
as.repeat( retries + 1, function( as, attempt )
{

@@ -154,3 +155,7 @@ as.add(

ctx.native_iface.emit( 'commError', as.state.error_info, req );
as.continue();
if ( attempt < retries )
{
as.continue();
}
}

@@ -157,0 +162,0 @@ }

{
"name": "futoin-invoker",
"version": "0.5.6",
"version": "0.5.7",
"description": "FutoIn Invoker - Reference Implementation. Transparently and efficiently invoke remote or local service methods with strict API definition for Node and Browser",

@@ -42,3 +42,3 @@ "main": "lib/invoker.js",

"faye-websocket": "^0.9.2",
"futoin-asyncsteps": "^1.5.1",
"futoin-asyncsteps": "^1.5.3",
"keep-alive-agent": "*",

@@ -69,5 +69,4 @@ "lodash": "*",

"mocha-phantomjs": "*",
"performance-now": "*",
"wolfy87-eventemitter": "*"
"performance-now": "*"
}
}

Sorry, the diff of this file is not supported yet

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

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