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

@serverless/fdk

Package Overview
Dependencies
Maintainers
7
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serverless/fdk - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

docker-compose.yml

2

dist/fdk.min.js

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

!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(t.fdk={})}(this,function(t){"use strict";function r(t,r){return r={exports:{}},t(r,r.exports),r.exports}function e(t){return decodeURIComponent(t.replace(/\+/g," "))}function n(t){var r,e={},n=void 0===(t=t||s.location||{})?"undefined":a(t);if("blob:"===t.protocol)e=new u(unescape(t.pathname),{});else if("string"===n){e=new u(t,{});for(r in E)delete e[r]}else if("object"===n){for(r in t)r in E||(e[r]=t[r]);void 0===e.slashes&&(e.slashes=v.test(t.href))}return e}function o(t){var r=m.exec(t);return{protocol:r[1]?r[1].toLowerCase():"",slashes:!!r[2],rest:r[3]}}function i(t,r){for(var e=(r||"/").split("/").slice(0,-1).concat(t.split("/")),n=e.length,o=e[n-1],i=!1,u=0;n--;)"."===e[n]?e.splice(n,1):".."===e[n]?(e.splice(n,1),u++):u&&(0===n&&(i=!0),e.splice(n,1),u--);return i&&e.unshift(""),"."!==o&&".."!==o||e.push(""),e.join("/")}function u(t,r,e){if(!(this instanceof u))return new u(t,r,e);var s,c,f,h,l,p,d=g.slice(),b=void 0===r?"undefined":a(r),m=this,v=0;for("object"!==b&&"string"!==b&&(e=r,r=null),e&&"function"!=typeof e&&(e=w.parse),r=n(r),s=!(c=o(t||"")).protocol&&!c.slashes,m.slashes=c.slashes||s&&r.slashes,m.protocol=c.protocol||r.protocol||"",t=c.rest,c.slashes||(d[2]=[/(.*)/,"pathname"]);v<d.length;v++)f=(h=d[v])[0],p=h[1],f!==f?m[p]=t:"string"==typeof f?~(l=t.indexOf(f))&&("number"==typeof h[2]?(m[p]=t.slice(0,l),t=t.slice(l+h[2])):(m[p]=t.slice(l),t=t.slice(0,l))):(l=f.exec(t))&&(m[p]=l[1],t=t.slice(0,l.index)),m[p]=m[p]||(s&&h[3]?r[p]||"":""),h[4]&&(m[p]=m[p].toLowerCase());e&&(m.query=e(m.query)),s&&r.slashes&&"/"!==m.pathname.charAt(0)&&(""!==m.pathname||""!==r.pathname)&&(m.pathname=i(m.pathname,r.pathname)),y(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(h=m.auth.split(":"),m.username=h[0]||"",m.password=h[1]||""),m.origin=m.protocol&&m.host&&"file:"!==m.protocol?m.protocol+"//"+m.host:"null",m.href=m.toString()}var s="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=function(t){return null!=t&&"object"===(void 0===t?"undefined":a(t))&&!0===t["@@functional/placeholder"]},f=function(t){return function r(e){return 0===arguments.length||c(e)?r:t.apply(this,arguments)}},h=f(function(t){return null==t}),l=function(t){return function r(e,n){switch(arguments.length){case 0:return r;case 1:return c(e)?r:f(function(r){return t(e,r)});default:return c(e)&&c(n)?r:c(e)?f(function(r){return t(r,n)}):c(n)?f(function(r){return t(e,r)}):t(e,n)}}},p=function(t){return"[object String]"===Object.prototype.toString.call(t)},d=l(function(t,r){var e=t<0?r.length+t:t;return p(r)?r.charAt(e):r[e]})(-1),y=function(t,r){if(r=r.split(":")[0],!(t=+t))return!1;switch(r){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t},b=Object.prototype.hasOwnProperty,w={stringify:function(t,r){var e=[];"string"!=typeof(r=r||"")&&(r="?");for(var n in t)b.call(t,n)&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.length?r+e.join("&"):""},parse:function(t){for(var r,n=/([^=?&]+)=?([^&]*)/g,o={};r=n.exec(t);o[e(r[1])]=e(r[2]));return o}},m=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,v=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,g=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],E={hash:1,query:1};u.prototype={set:function(t,r,e){var n=this;switch(t){case"query":"string"==typeof r&&r.length&&(r=(e||w.parse)(r)),n[t]=r;break;case"port":n[t]=r,y(r,n.protocol)?r&&(n.host=n.hostname+":"+r):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=r,n.port&&(r+=":"+n.port),n.host=r;break;case"host":n[t]=r,/:\d+$/.test(r)?(r=r.split(":"),n.port=r.pop(),n.hostname=r.join(":")):(n.hostname=r,n.port="");break;case"protocol":n.protocol=r.toLowerCase(),n.slashes=!e;break;case"pathname":n.pathname=r.length&&"/"!==r.charAt(0)?"/"+r:r;break;default:n[t]=r}for(var o=0;o<g.length;o++){var i=g[o];i[4]&&(n[i[1]]=n[i[1]].toLowerCase())}return n.origin=n.protocol&&n.host&&"file:"!==n.protocol?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(t){t&&"function"==typeof t||(t=w.stringify);var r,e=this,n=e.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var o=n+(e.slashes?"//":"");return e.username&&(o+=e.username,e.password&&(o+=":"+e.password),o+="@"),o+=e.host+e.pathname,(r="object"===a(e.query)?t(e.query):e.query)&&(o+="?"!==r.charAt(0)?"?"+r:r),e.hash&&(o+=e.hash),o}},u.extractProtocol=o,u.location=n,u.qs=w;var j=u,x=r(function(t){t.exports={generateConfigureUrl:function(t){var r=new j(t),e=r.auth?r.auth+"@":"";return r.protocol+"//"+e+r.hostname+":4001/"},joinUrlWithPath:function(t,r){var e="/"===d(t),n="/"===r[0];return e&&n?""+t+r.substring(1):e||n?""+t+r:t+"/"+r}}}),A=r(function(t){t.exports=function(t,r){return t.fetch(x.joinUrlWithPath(t.configurationUrl,"/v1/functions"),{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}}).then(function(t){if(200!==t.status){var e=null,n=r.functionId;return t.json().then(function(t){throw e=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw e?new Error("Failed to register the function "+n+" due the error: "+e):new Error("Failed to register the function "+n+" and couldn't parse error body.")})}return t.json()})}}),P=r(function(t){t.exports=function(t,r){return t.fetch(x.joinUrlWithPath(t.configurationUrl,"/v1/functions/"+r.functionId),{method:"DELETE"}).then(function(t){if(204!==t.status){var e=null;return t.json().then(function(t){throw e=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw e?new Error("Failed to delete the function "+r.functionId+" due the error: "+e):new Error("Failed to delete the function "+r.functionId+" and couldn't parse error body.")})}})}}),T=r(function(t){t.exports=function(t){return t.fetch(x.joinUrlWithPath(t.configurationUrl,"/v1/functions")).then(function(t){if(200!==t.status){var r=null;return t.json().then(function(t){throw r=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw r?new Error("Failed to fetch the function list due the error: "+r):new Error("Failed to fetch the function list and couldn't parse error body.")})}return t.json()})}}),O=r(function(t){t.exports=function(t,r){return t.fetch(x.joinUrlWithPath(t.configurationUrl,"/v1/subscriptions"),{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}}).then(function(t){if(200!==t.status){var e=null,n="Failed to subscribe the event "+r.event+" to the function "+r.functionId;return t.json().then(function(t){throw e=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw e?new Error(n+" due the error: "+e):new Error(n+" and couldn't parse error body.")})}return t.json()})}}),U=r(function(t){t.exports=function(t,r){return t.fetch(x.joinUrlWithPath(t.configurationUrl,"/v1/subscriptions/"+r.subscriptionId),{method:"DELETE"}).then(function(t){if(204!==t.status){var e=null,n="Failed to unsubscribe the subscription "+r.subscriptionId;return t.json().then(function(t){throw e=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw e?new Error(n+" due the error: "+e):new Error(n+" and couldn't parse error body.")})}})}}),I=r(function(t){t.exports=function(t){return t.fetch(x.joinUrlWithPath(t.configurationUrl,"/v1/subscriptions")).then(function(t){if(200!==t.status){var r=null;return t.json().then(function(t){throw r=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw r?new Error("Failed to fetch the subscriptions list due the error: "+r):new Error("Failed to fetch the subscriptions list and couldn't parse error body.")})}return t.json()})}}),S=function(t,r){switch(t){case 0:return function(){return r.apply(this,arguments)};case 1:return function(t){return r.apply(this,arguments)};case 2:return function(t,e){return r.apply(this,arguments)};case 3:return function(t,e,n){return r.apply(this,arguments)};case 4:return function(t,e,n,o){return r.apply(this,arguments)};case 5:return function(t,e,n,o,i){return r.apply(this,arguments)};case 6:return function(t,e,n,o,i,u){return r.apply(this,arguments)};case 7:return function(t,e,n,o,i,u,s){return r.apply(this,arguments)};case 8:return function(t,e,n,o,i,u,s,a){return r.apply(this,arguments)};case 9:return function(t,e,n,o,i,u,s,a,c){return r.apply(this,arguments)};case 10:return function(t,e,n,o,i,u,s,a,c,f){return r.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}},_=function(t,r){return function(){return r.call(this,t.apply(this,arguments))}},F=function(t){return function r(e,n,o){switch(arguments.length){case 0:return r;case 1:return c(e)?r:l(function(r,n){return t(e,r,n)});case 2:return c(e)&&c(n)?r:c(e)?l(function(r,e){return t(r,n,e)}):c(n)?l(function(r,n){return t(e,r,n)}):f(function(r){return t(e,n,r)});default:return c(e)&&c(n)&&c(o)?r:c(e)&&c(n)?l(function(r,e){return t(r,e,o)}):c(e)&&c(o)?l(function(r,e){return t(r,n,e)}):c(n)&&c(o)?l(function(r,n){return t(e,r,n)}):c(e)?f(function(r){return t(r,n,o)}):c(n)?f(function(r){return t(e,r,o)}):c(o)?f(function(r){return t(e,n,r)}):t(e,n,o)}}},B=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)},C=f(function(t){return!!B(t)||!!t&&("object"===(void 0===t?"undefined":a(t))&&(!p(t)&&(1===t.nodeType?!!t.length:0===t.length||t.length>0&&(t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1)))))}),R=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,r){return this.f(t,r)},function(r){return new t(r)}}(),D=l(function(t,r){return S(t.length,function(){return t.apply(r,arguments)})}),k=function(){function t(t,r,e){for(var n=0,o=e.length;n<o;){if((r=t["@@transducer/step"](r,e[n]))&&r["@@transducer/reduced"]){r=r["@@transducer/value"];break}n+=1}return t["@@transducer/result"](r)}function r(t,r,e){for(var n=e.next();!n.done;){if((r=t["@@transducer/step"](r,n.value))&&r["@@transducer/reduced"]){r=r["@@transducer/value"];break}n=e.next()}return t["@@transducer/result"](r)}function e(t,r,e,n){return t["@@transducer/result"](e[n](D(t["@@transducer/step"],t),r))}var n="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";return function(o,i,u){if("function"==typeof o&&(o=R(o)),C(u))return t(o,i,u);if("function"==typeof u["fantasy-land/reduce"])return e(o,i,u,"fantasy-land/reduce");if(null!=u[n])return r(o,i,u[n]());if("function"==typeof u.next)return r(o,i,u);if("function"==typeof u.reduce)return e(o,i,u,"reduce");throw new TypeError("reduce: list must be array or iterable")}}(),q=F(k),L=function(t,r){return function(){var e=arguments.length;if(0===e)return r();var n=arguments[e-1];return B(n)||"function"!=typeof n[t]?r.apply(this,arguments):n[t].apply(n,Array.prototype.slice.call(arguments,0,e-1))}},N=F(L("slice",function(t,r,e){return Array.prototype.slice.call(e,t,r)})),G=f(L("tail",N(1,1/0))),W=function(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return S(arguments[0].length,q(_,arguments[0],G(arguments)))},H=function(t,r){return Object.prototype.hasOwnProperty.call(r,t)},z=F(function(t,r,e){return null!=e&&H(r,e)?e[r]:t}),J=function(t){return"function"==typeof t["@@transducer/step"]},X=function(t,r){for(var e=0,n=r.length,o=Array(n);e<n;)o[e]=t(r[e]),e+=1;return o},$={init:function(){return this.xf["@@transducer/init"]()},result:function(t){return this.xf["@@transducer/result"](t)}},M=function(){function t(t,r){this.xf=r,this.f=t}return t.prototype["@@transducer/init"]=$.init,t.prototype["@@transducer/result"]=$.result,t.prototype["@@transducer/step"]=function(t,r){return this.xf["@@transducer/step"](t,this.f(r))},l(function(r,e){return new t(r,e)})}(),V=function t(r,e,n){return function(){for(var o=[],i=0,u=r,s=0;s<e.length||i<arguments.length;){var a;s<e.length&&(!c(e[s])||i>=arguments.length)?a=e[s]:(a=arguments[i],i+=1),o[s]=a,c(a)||(u-=1),s+=1}return u<=0?n.apply(this,o):S(u,t(r,o,n))}},Z=l(function(t,r){return 1===t?f(r):S(t,V(t,[],r))}),K=function(){var t=Object.prototype.toString;return"[object Arguments]"===t.call(arguments)?function(r){return"[object Arguments]"===t.call(r)}:function(t){return H("callee",t)}}(),Q=function(){var t=!{toString:null}.propertyIsEnumerable("toString"),r=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],e=function(){return arguments.propertyIsEnumerable("length")}(),n=function(t,r){for(var e=0;e<t.length;){if(t[e]===r)return!0;e+=1}return!1};return f("function"!=typeof Object.keys||e?function(o){if(Object(o)!==o)return[];var i,u,s=[],a=e&&K(o);for(i in o)!H(i,o)||a&&"length"===i||(s[s.length]=i);if(t)for(u=r.length-1;u>=0;)H(i=r[u],o)&&!n(s,i)&&(s[s.length]=i),u-=1;return s}:function(t){return Object(t)!==t?[]:Object.keys(t)})}(),Y=l(function(t,r,e){return function(){if(0===arguments.length)return e();var n=Array.prototype.slice.call(arguments,0),o=n.pop();if(!B(o)){for(var i=0;i<t.length;){if("function"==typeof o[t[i]])return o[t[i]].apply(o,n);i+=1}if(J(o))return r.apply(null,n)(o)}return e.apply(this,arguments)}}(["fantasy-land/map","map"],M,function(t,r){switch(Object.prototype.toString.call(r)){case"[object Function]":return Z(r.length,function(){return t.call(this,r.apply(this,arguments))});case"[object Object]":return k(function(e,n){return e[n]=t(r[n]),e},{},Q(r));default:return X(t,r)}})),tt=r(function(t){t.exports=function(t,r){var e=W(z([],"functions"),Y(function(r){return A(t,r)})),n=W(z([],"subscriptions"),Y(function(r){return O(t,r)}));return Promise.all(e(r)).then(function(t){return Promise.all(n(r)).then(function(r){return{functions:t,subscriptions:r}}).catch(function(t){throw new Error("Failed to configure the Event Gateway. "+t.message)})}).catch(function(t){throw new Error("Failed to configure the Event Gateway. "+t.message)})}}),rt=function(t){return Promise.all([T(t),I(t)]).then(function(r){return Promise.all(r[1].subscriptions.map(function(r){return U(t,{subscriptionId:r.subscriptionId})})).then(function(){return Promise.all(r[0].functions.map(function(r){return P(t,{functionId:r.functionId})})).then(function(){}).catch(function(t){throw new Error("Failed to reset the Event Gateway configuration. "+t.message)})}).catch(function(t){throw new Error("Failed to reset the Event Gateway configuration. "+t.message)})})},et=r(function(t){t.exports=function(t,r){var e=r.dataType?r.data:JSON.stringify(r.data);return t.fetch(""+t.apiUrl,{method:"POST",body:e,headers:{"Content-Type":r.dataType||"application/json",Event:r.event}}).then(function(t){if(202!==t.status)throw new Error("Failed to emit the event "+r.event);return t})}}),nt=r(function(t){t.exports=function(t,r){var e=r.dataType?r.data:JSON.stringify(r.data);return t.fetch(""+t.apiUrl,{method:"POST",body:e,headers:{"Content-Type":r.dataType||"application/json",Event:"invoke","Function-ID":r.functionId}}).then(function(t){if(200!==t.status){var e=null;return t.text().then(function(t){throw e=t,new Error("Internal rethrow of "+t)}).catch(function(){throw e?new Error("Failed to invoke function "+r.functionId+" due the error: "+e):new Error("Failed to invoke function "+r.functionId+" and couldn't parse error body.")})}return t})}});!function(t){function r(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function e(t){return"string"!=typeof t&&(t=String(t)),t}function n(t){var r={next:function(){var r=t.shift();return{done:void 0===r,value:r}}};return w.iterable&&(r[Symbol.iterator]=function(){return r}),r}function o(t){this.map={},t instanceof o?t.forEach(function(t,r){this.append(r,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(r){this.append(r,t[r])},this)}function i(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function u(t){return new Promise(function(r,e){t.onload=function(){r(t.result)},t.onerror=function(){e(t.error)}})}function s(t){var r=new FileReader,e=u(r);return r.readAsArrayBuffer(t),e}function a(t){var r=new FileReader,e=u(r);return r.readAsText(t),e}function c(t){for(var r=new Uint8Array(t),e=new Array(r.length),n=0;n<r.length;n++)e[n]=String.fromCharCode(r[n]);return e.join("")}function f(t){if(t.slice)return t.slice(0);var r=new Uint8Array(t.byteLength);return r.set(new Uint8Array(t)),r.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(w.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(w.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(w.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(w.arrayBuffer&&w.blob&&v(t))this._bodyArrayBuffer=f(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!w.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!g(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=f(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):w.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},w.blob&&(this.blob=function(){var t=i(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?i(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(s)}),this.text=function(){var t=i(this);if(t)return t;if(this._bodyBlob)return a(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(c(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},w.formData&&(this.formData=function(){return this.text().then(d)}),this.json=function(){return this.text().then(JSON.parse)},this}function l(t){var r=t.toUpperCase();return E.indexOf(r)>-1?r:t}function p(t,r){var e=(r=r||{}).body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,r.headers||(this.headers=new o(t.headers)),this.method=t.method,this.mode=t.mode,e||null==t._bodyInit||(e=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=r.credentials||this.credentials||"omit",!r.headers&&this.headers||(this.headers=new o(r.headers)),this.method=l(r.method||this.method||"GET"),this.mode=r.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&e)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(e)}function d(t){var r=new FormData;return t.trim().split("&").forEach(function(t){if(t){var e=t.split("="),n=e.shift().replace(/\+/g," "),o=e.join("=").replace(/\+/g," ");r.append(decodeURIComponent(n),decodeURIComponent(o))}}),r}function y(t){var r=new o;return t.split(/\r?\n/).forEach(function(t){var e=t.split(":"),n=e.shift().trim();if(n){var o=e.join(":").trim();r.append(n,o)}}),r}function b(t,r){r||(r={}),this.type="default",this.status="status"in r?r.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in r?r.statusText:"OK",this.headers=new o(r.headers),this.url=r.url||"",this._initBody(t)}if(!t.fetch){var w={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(w.arrayBuffer)var m=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],v=function(t){return t&&DataView.prototype.isPrototypeOf(t)},g=ArrayBuffer.isView||function(t){return t&&m.indexOf(Object.prototype.toString.call(t))>-1};o.prototype.append=function(t,n){t=r(t),n=e(n);var o=this.map[t];this.map[t]=o?o+","+n:n},o.prototype.delete=function(t){delete this.map[r(t)]},o.prototype.get=function(t){return t=r(t),this.has(t)?this.map[t]:null},o.prototype.has=function(t){return this.map.hasOwnProperty(r(t))},o.prototype.set=function(t,n){this.map[r(t)]=e(n)},o.prototype.forEach=function(t,r){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(r,this.map[e],e,this)},o.prototype.keys=function(){var t=[];return this.forEach(function(r,e){t.push(e)}),n(t)},o.prototype.values=function(){var t=[];return this.forEach(function(r){t.push(r)}),n(t)},o.prototype.entries=function(){var t=[];return this.forEach(function(r,e){t.push([e,r])}),n(t)},w.iterable&&(o.prototype[Symbol.iterator]=o.prototype.entries);var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},h.call(p.prototype),h.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new o(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var j=[301,302,303,307,308];b.redirect=function(t,r){if(-1===j.indexOf(r))throw new RangeError("Invalid status code");return new b(null,{status:r,headers:{location:t}})},t.Headers=o,t.Request=p,t.Response=b,t.fetch=function(t,r){return new Promise(function(e,n){var o=new p(t,r),i=new XMLHttpRequest;i.onload=function(){var t={status:i.status,statusText:i.statusText,headers:y(i.getAllResponseHeaders()||"")};t.url="responseURL"in i?i.responseURL:t.headers.get("X-Request-URL");var r="response"in i?i.response:i.responseText;e(new b(r,t))},i.onerror=function(){n(new TypeError("Network request failed"))},i.ontimeout=function(){n(new TypeError("Network request failed"))},i.open(o.method,o.url,!0),"include"===o.credentials&&(i.withCredentials=!0),"responseType"in i&&w.blob&&(i.responseType="blob"),o.headers.forEach(function(t,r){i.setRequestHeader(r,t)}),i.send(void 0===o._bodyInit?null:o._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:void 0);var ot=self.fetch.bind(self),it=r(function(t){t.exports={eventGateway:function(t){if(h(t)||"object"!==(void 0===t?"undefined":a(t))||h(t.url)||"string"!=typeof t.url)throw new Error("Please provide an object with the property 'url' to eventGateway");var r={apiUrl:t.url,configurationUrl:t.configurationUrl||x.generateConfigureUrl(t.url),fetch:t.fetch||ot};return{emit:function(t){return et(r,t)},invoke:function(t){return nt(r,t)},configure:function(t){return tt(r,t)},resetConfiguration:function(t){return rt(r)},registerFunction:function(t){return A(r,t)},deleteFunction:function(t){return P(r,t)},listFunctions:function(t){return T(r,t)},subscribe:function(t){return O(r,t)},unsubscribe:function(t){return U(r,t)},listSubscriptions:function(t){return I(r,t)}}}}}),ut=it.eventGateway;t.default=it,t.eventGateway=ut,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.fdk={})}(this,function(t){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t,e){return t(e={exports:{}},e.exports),e.exports}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){return null!=t&&"object"===(void 0===t?"undefined":n(t))&&!0===t["@@functional/placeholder"]},i=function(t){return function e(r){return 0===arguments.length||o(r)?e:t.apply(this,arguments)}},s=i(function(t){return null==t}),u=function(t){return function e(r,n){switch(arguments.length){case 0:return e;case 1:return o(r)?e:i(function(e){return t(r,e)});default:return o(r)&&o(n)?e:o(r)?i(function(e){return t(e,n)}):o(n)?i(function(e){return t(r,e)}):t(r,n)}}},a=function(t){return"[object String]"===Object.prototype.toString.call(t)},c=u(function(t,e){var r=t<0?e.length+t:t;return a(e)?e.charAt(r):e[r]})(-1),f=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t},h=Object.prototype.hasOwnProperty;function l(t){return decodeURIComponent(t.replace(/\+/g," "))}var p={stringify:function(t,e){var r=[];"string"!=typeof(e=e||"")&&(e="?");for(var n in t)h.call(t,n)&&r.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return r.length?e+r.join("&"):""},parse:function(t){for(var e,r=/([^=?&]+)=?([^&]*)/g,n={};e=r.exec(t);n[l(e[1])]=l(e[2]));return n}},d=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,y=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,b=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],w={hash:1,query:1};function v(t){var r,o={},i=void 0===(t=t||e.location||{})?"undefined":n(t);if("blob:"===t.protocol)o=new g(unescape(t.pathname),{});else if("string"===i){o=new g(t,{});for(r in w)delete o[r]}else if("object"===i){for(r in t)r in w||(o[r]=t[r]);void 0===o.slashes&&(o.slashes=y.test(t.href))}return o}function m(t){var e=d.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]}}function g(t,e,r){if(!(this instanceof g))return new g(t,e,r);var o,i,s,u,a,c,h=b.slice(),l=void 0===e?"undefined":n(e),d=0;for("object"!==l&&"string"!==l&&(r=e,e=null),r&&"function"!=typeof r&&(r=p.parse),e=v(e),o=!(i=m(t||"")).protocol&&!i.slashes,this.slashes=i.slashes||o&&e.slashes,this.protocol=i.protocol||e.protocol||"",t=i.rest,i.slashes||(h[2]=[/(.*)/,"pathname"]);d<h.length;d++)s=(u=h[d])[0],c=u[1],s!=s?this[c]=t:"string"==typeof s?~(a=t.indexOf(s))&&("number"==typeof u[2]?(this[c]=t.slice(0,a),t=t.slice(a+u[2])):(this[c]=t.slice(a),t=t.slice(0,a))):(a=s.exec(t))&&(this[c]=a[1],t=t.slice(0,a.index)),this[c]=this[c]||(o&&u[3]?e[c]||"":""),u[4]&&(this[c]=this[c].toLowerCase());r&&(this.query=r(this.query)),o&&e.slashes&&"/"!==this.pathname.charAt(0)&&(""!==this.pathname||""!==e.pathname)&&(this.pathname=function(t,e){for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(this.pathname,e.pathname)),f(this.port,this.protocol)||(this.host=this.hostname,this.port=""),this.username=this.password="",this.auth&&(u=this.auth.split(":"),this.username=u[0]||"",this.password=u[1]||""),this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null",this.href=this.toString()}g.prototype={set:function(t,e,r){switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||p.parse)(e)),this[t]=e;break;case"port":this[t]=e,f(e,this.protocol)?e&&(this.host=this.hostname+":"+e):(this.host=this.hostname,this[t]="");break;case"hostname":this[t]=e,this.port&&(e+=":"+this.port),this.host=e;break;case"host":this[t]=e,/:\d+$/.test(e)?(e=e.split(":"),this.port=e.pop(),this.hostname=e.join(":")):(this.hostname=e,this.port="");break;case"protocol":this.protocol=e.toLowerCase(),this.slashes=!r;break;case"pathname":case"hash":if(e){var n="pathname"===t?"/":"#";this[t]=e.charAt(0)!==n?n+e:e}else this[t]=e;break;default:this[t]=e}for(var o=0;o<b.length;o++){var i=b[o];i[4]&&(this[i[1]]=this[i[1]].toLowerCase())}return this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null",this.href=this.toString(),this},toString:function(t){t&&"function"==typeof t||(t=p.stringify);var e,r=this.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var o=r+(this.slashes?"//":"");return this.username&&(o+=this.username,this.password&&(o+=":"+this.password),o+="@"),o+=this.host+this.pathname,(e="object"===n(this.query)?t(this.query):this.query)&&(o+="?"!==e.charAt(0)?"?"+e:e),this.hash&&(o+=this.hash),o}},g.extractProtocol=m,g.location=v,g.qs=p;var E,j,A,x=g,O=r(function(t){t.exports={generateConfigureUrl:function(t){var e=new x(t),r=e.auth?e.auth+"@":"";return e.protocol+"//"+r+e.hostname+":4001/"},joinUrlWithPath:function(t,e){var r="/"===c(t),n="/"===e[0];return r&&n?""+t+e.substring(1):r||n?""+t+e:t+"/"+e}}}),S=r(function(t){t.exports=function(t,e){return t.fetch(O.joinUrlWithPath(t.configurationUrl,"/v1/functions"),{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}}).then(function(t){if(200!==t.status){var r=null,n=e.functionId;return t.json().then(function(t){throw r=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw r?new Error("Failed to register the function "+n+" due the error: "+r):new Error("Failed to register the function "+n+" and couldn't parse error body.")})}return t.json()})}}),P=r(function(t){t.exports=function(t,e){return t.fetch(O.joinUrlWithPath(t.configurationUrl,"/v1/functions/"+e.functionId),{method:"DELETE"}).then(function(t){if(204!==t.status){var r=null;return t.json().then(function(t){throw r=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw r?new Error("Failed to delete the function "+e.functionId+" due the error: "+r):new Error("Failed to delete the function "+e.functionId+" and couldn't parse error body.")})}})}}),T=r(function(t){t.exports=function(t){return t.fetch(O.joinUrlWithPath(t.configurationUrl,"/v1/functions")).then(function(t){if(200!==t.status){var e=null;return t.json().then(function(t){throw e=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw e?new Error("Failed to fetch the function list due the error: "+e):new Error("Failed to fetch the function list and couldn't parse error body.")})}return t.json()})}}),I=r(function(t){t.exports=function(t,e){return t.fetch(O.joinUrlWithPath(t.configurationUrl,"/v1/subscriptions"),{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}}).then(function(t){if(200!==t.status){var r=null,n="Failed to subscribe the event "+e.event+" to the function "+e.functionId;return t.json().then(function(t){throw r=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw r?new Error(n+" due the error: "+r):new Error(n+" and couldn't parse error body.")})}return t.json()})}}),U=r(function(t){t.exports=function(t,e){return t.fetch(O.joinUrlWithPath(t.configurationUrl,"/v1/subscriptions/"+e.subscriptionId),{method:"DELETE"}).then(function(t){if(204!==t.status){var r=null,n="Failed to unsubscribe the subscription "+e.subscriptionId;return t.json().then(function(t){throw r=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw r?new Error(n+" due the error: "+r):new Error(n+" and couldn't parse error body.")})}})}}),_=r(function(t){t.exports=function(t){return t.fetch(O.joinUrlWithPath(t.configurationUrl,"/v1/subscriptions")).then(function(t){if(200!==t.status){var e=null;return t.json().then(function(t){throw e=t.error,new Error("Internal rethrow of "+t)}).catch(function(){throw e?new Error("Failed to fetch the subscriptions list due the error: "+e):new Error("Failed to fetch the subscriptions list and couldn't parse error body.")})}return t.json()})}}),F=function(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(t){return e.apply(this,arguments)};case 2:return function(t,r){return e.apply(this,arguments)};case 3:return function(t,r,n){return e.apply(this,arguments)};case 4:return function(t,r,n,o){return e.apply(this,arguments)};case 5:return function(t,r,n,o,i){return e.apply(this,arguments)};case 6:return function(t,r,n,o,i,s){return e.apply(this,arguments)};case 7:return function(t,r,n,o,i,s,u){return e.apply(this,arguments)};case 8:return function(t,r,n,o,i,s,u,a){return e.apply(this,arguments)};case 9:return function(t,r,n,o,i,s,u,a,c){return e.apply(this,arguments)};case 10:return function(t,r,n,o,i,s,u,a,c,f){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}},B=function(t,e){return function(){return e.call(this,t.apply(this,arguments))}},k=function(t){return function e(r,n,s){switch(arguments.length){case 0:return e;case 1:return o(r)?e:u(function(e,n){return t(r,e,n)});case 2:return o(r)&&o(n)?e:o(r)?u(function(e,r){return t(e,n,r)}):o(n)?u(function(e,n){return t(r,e,n)}):i(function(e){return t(r,n,e)});default:return o(r)&&o(n)&&o(s)?e:o(r)&&o(n)?u(function(e,r){return t(e,r,s)}):o(r)&&o(s)?u(function(e,r){return t(e,n,r)}):o(n)&&o(s)?u(function(e,n){return t(r,e,n)}):o(r)?i(function(e){return t(e,n,s)}):o(n)?i(function(e){return t(r,e,s)}):o(s)?i(function(e){return t(r,n,e)}):t(r,n,s)}}},q=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)},C=i(function(t){return!!q(t)||!!t&&("object"===(void 0===t?"undefined":n(t))&&(!a(t)&&(1===t.nodeType?!!t.length:0===t.length||t.length>0&&(t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1)))))}),R=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,e){return this.f(t,e)},function(e){return new t(e)}}(),D=u(function(t,e){return F(t.length,function(){return t.apply(e,arguments)})}),L=function(){function t(t,e,r){for(var n=r.next();!n.done;){if((e=t["@@transducer/step"](e,n.value))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}n=r.next()}return t["@@transducer/result"](e)}function e(t,e,r,n){return t["@@transducer/result"](r[n](D(t["@@transducer/step"],t),e))}var r="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";return function(n,o,i){if("function"==typeof n&&(n=R(n)),C(i))return function(t,e,r){for(var n=0,o=r.length;n<o;){if((e=t["@@transducer/step"](e,r[n]))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}n+=1}return t["@@transducer/result"](e)}(n,o,i);if("function"==typeof i["fantasy-land/reduce"])return e(n,o,i,"fantasy-land/reduce");if(null!=i[r])return t(n,o,i[r]());if("function"==typeof i.next)return t(n,o,i);if("function"==typeof i.reduce)return e(n,o,i,"reduce");throw new TypeError("reduce: list must be array or iterable")}}(),N=k(L),G=function(t,e){return function(){var r=arguments.length;if(0===r)return e();var n=arguments[r-1];return q(n)||"function"!=typeof n[t]?e.apply(this,arguments):n[t].apply(n,Array.prototype.slice.call(arguments,0,r-1))}},W=k(G("slice",function(t,e,r){return Array.prototype.slice.call(r,t,e)})),H=i(G("tail",W(1,1/0))),z=function(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return F(arguments[0].length,N(B,arguments[0],H(arguments)))},J=function(t,e){return Object.prototype.hasOwnProperty.call(e,t)},V=k(function(t,e,r){return null!=r&&J(e,r)?r[e]:t}),K=function(){return this.xf["@@transducer/init"]()},M=function(t){return this.xf["@@transducer/result"](t)},X=function(){function t(t,e){this.xf=e,this.f=t}return t.prototype["@@transducer/init"]=K,t.prototype["@@transducer/result"]=M,t.prototype["@@transducer/step"]=function(t,e){return this.xf["@@transducer/step"](t,this.f(e))},u(function(e,r){return new t(e,r)})}(),$=u(function(t,e){return 1===t?i(e):F(t,function t(e,r,n){return function(){for(var i=[],s=0,u=e,a=0;a<r.length||s<arguments.length;){var c;a<r.length&&(!o(r[a])||s>=arguments.length)?c=r[a]:(c=arguments[s],s+=1),i[a]=c,o(c)||(u-=1),a+=1}return u<=0?n.apply(this,i):F(u,t(e,i,n))}}(t,[],e))}),Z=function(){var t=Object.prototype.toString;return"[object Arguments]"===t.call(arguments)?function(e){return"[object Arguments]"===t.call(e)}:function(t){return J("callee",t)}}(),Q=function(){var t=!{toString:null}.propertyIsEnumerable("toString"),e=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],r=function(){return arguments.propertyIsEnumerable("length")}(),n=function(t,e){for(var r=0;r<t.length;){if(t[r]===e)return!0;r+=1}return!1};return"function"!=typeof Object.keys||r?i(function(o){if(Object(o)!==o)return[];var i,s,u=[],a=r&&Z(o);for(i in o)!J(i,o)||a&&"length"===i||(u[u.length]=i);if(t)for(s=e.length-1;s>=0;)J(i=e[s],o)&&!n(u,i)&&(u[u.length]=i),s-=1;return u}):i(function(t){return Object(t)!==t?[]:Object.keys(t)})}(),Y=u((E=["fantasy-land/map","map"],j=X,A=function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return $(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return L(function(r,n){return r[n]=t(e[n]),r},{},Q(e));default:return function(t,e){for(var r=0,n=e.length,o=Array(n);r<n;)o[r]=t(e[r]),r+=1;return o}(t,e)}},function(){if(0===arguments.length)return A();var t=Array.prototype.slice.call(arguments,0),e=t.pop();if(!q(e)){for(var r=0;r<E.length;){if("function"==typeof e[E[r]])return e[E[r]].apply(e,t);r+=1}if("function"==typeof e["@@transducer/step"])return j.apply(null,t)(e)}return A.apply(this,arguments)})),tt=r(function(t){t.exports=function(t,e){var r=z(V([],"functions"),Y(function(e){return S(t,e)})),n=z(V([],"subscriptions"),Y(function(e){return I(t,e)}));return Promise.all(r(e)).then(function(t){return Promise.all(n(e)).then(function(e){return{functions:t,subscriptions:e}}).catch(function(t){throw new Error("Failed to configure the Event Gateway. "+t.message)})}).catch(function(t){throw new Error("Failed to configure the Event Gateway. "+t.message)})}}),et=function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r},rt=u(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}),nt=i(function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),ot=function t(e,r,o,i){if(rt(e,r))return!0;if(nt(e)!==nt(r))return!1;if(null==e||null==r)return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof r["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](r)&&"function"==typeof r["fantasy-land/equals"]&&r["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof r.equals)return"function"==typeof e.equals&&e.equals(r)&&"function"==typeof r.equals&&r.equals(e);switch(nt(e)){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===function(t){var e=String(t).match(/^function (\w*)/);return null==e?"":e[1]}(e.constructor))return e===r;break;case"Boolean":case"Number":case"String":if((void 0===e?"undefined":n(e))!==(void 0===r?"undefined":n(r))||!rt(e.valueOf(),r.valueOf()))return!1;break;case"Date":if(!rt(e.valueOf(),r.valueOf()))return!1;break;case"Error":return e.name===r.name&&e.message===r.message;case"RegExp":if(e.source!==r.source||e.global!==r.global||e.ignoreCase!==r.ignoreCase||e.multiline!==r.multiline||e.sticky!==r.sticky||e.unicode!==r.unicode)return!1;break;case"Map":case"Set":if(!t(et(e.entries()),et(r.entries()),o,i))return!1;break;case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var s=Q(e);if(s.length!==Q(r).length)return!1;for(var u=o.length-1;u>=0;){if(o[u]===e)return i[u]===r;u-=1}for(o.push(e),i.push(r),u=s.length-1;u>=0;){var a=s[u];if(!J(a,r)||!t(r[a],e[a],o,i))return!1;u-=1}return o.pop(),i.pop(),!0},it=u(function(t,e){return ot(t,e,[],[])}),st=u(function(t,e){return function(t,e,r){var o,i;if("function"==typeof t.indexOf)switch(void 0===e?"undefined":n(e)){case"number":if(0===e){for(o=1/e;r<t.length;){if(0===(i=t[r])&&1/i===o)return r;r+=1}return-1}if(e!=e){for(;r<t.length;){if("number"==typeof(i=t[r])&&i!=i)return r;r+=1}return-1}return t.indexOf(e,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(e,r);case"object":if(null===e)return t.indexOf(e,r)}for(;r<t.length;){if(it(t[r],e))return r;r+=1}return-1}(e,t,0)>=0}),ut=k(function(t,e,r){var n={};for(var o in r)n[o]=r[o];return n[t]=e,n}),at=r(function(t){t.exports={injectServerlessApplicationToken:function(t){var e=Object.assign({},t);return st("SERVERLESS_APPLICATION_TOKEN",Q(process.env))&&(e=ut("Authorization","bearer "+process.env.SERVERLESS_APPLICATION_TOKEN,t)),e}}}),ct=r(function(t){t.exports=function(t,e){var r=e.dataType?e.data:JSON.stringify(e.data),n={"Content-Type":e.dataType||"application/json",Event:e.event};return n=at.injectServerlessApplicationToken(n),t.fetch(""+t.apiUrl,{method:"POST",body:r,headers:n}).then(function(t){if(202!==t.status)throw new Error("Failed to emit the event "+e.event);return t})}}),ft=r(function(t){t.exports=function(t,e){var r=e.dataType?e.data:JSON.stringify(e.data),n={"Content-Type":e.dataType||"application/json",Event:"invoke","Function-ID":e.functionId};return n=at.injectServerlessApplicationToken(n),t.fetch(""+t.apiUrl,{method:"POST",body:r,headers:n}).then(function(t){if(200!==t.status){var r=null;return t.text().then(function(t){throw r=t,new Error("Internal rethrow of "+t)}).catch(function(){throw r?new Error("Failed to invoke function "+e.functionId+" due the error: "+r):new Error("Failed to invoke function "+e.functionId+" and couldn't parse error body.")})}return t})}});!function(t){if(!t.fetch){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=function(t){return t&&DataView.prototype.isPrototypeOf(t)},o=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};f.prototype.append=function(t,e){t=u(t),e=a(e);var r=this.map[t];this.map[t]=r?r+","+e:e},f.prototype.delete=function(t){delete this.map[u(t)]},f.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},f.prototype.set=function(t,e){this.map[u(t)]=a(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),c(t)},f.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),c(t)},f.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),c(t)},e.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},y.call(b.prototype),y.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var s=[301,302,303,307,308];v.redirect=function(t,e){if(-1===s.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},t.Headers=f,t.Request=b,t.Response=v,t.fetch=function(t,r){return new Promise(function(n,o){var i=new b(t,r),s=new XMLHttpRequest;s.onload=function(){var t={status:s.status,statusText:s.statusText,headers:function(t){var e=new f;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e}(s.getAllResponseHeaders()||"")};t.url="responseURL"in s?s.responseURL:t.headers.get("X-Request-URL");var e="response"in s?s.response:s.responseText;n(new v(e,t))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials&&(s.withCredentials=!0),"responseType"in s&&e.blob&&(s.responseType="blob"),i.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function f(t){this.map={},t instanceof f?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function p(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&n(t))this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!o(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=d(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,r=l(e);return e.readAsText(t),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(t,e){var r=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=function(t){var e=t.toUpperCase();return i.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function w(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function v(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!=typeof self?self:void 0);var ht=self.fetch.bind(self),lt=r(function(t){t.exports={eventGateway:function(t){if(s(t)||"object"!==(void 0===t?"undefined":n(t))||s(t.url)||"string"!=typeof t.url)throw new Error("Please provide an object with the property 'url' to eventGateway");var e={apiUrl:t.url,configurationUrl:t.configurationUrl||O.generateConfigureUrl(t.url),fetch:t.fetch||ht};return{emit:function(t){return ct(e,t)},invoke:function(t){return ft(e,t)},configure:function(t){return tt(e,t)},resetConfiguration:function(t){return r=e,Promise.all([T(r),_(r)]).then(function(t){return Promise.all(t[1].subscriptions.map(function(t){return U(r,{subscriptionId:t.subscriptionId})})).then(function(){return Promise.all(t[0].functions.map(function(t){return P(r,{functionId:t.functionId})})).then(function(){}).catch(function(t){throw new Error("Failed to reset the Event Gateway configuration. "+t.message)})}).catch(function(t){throw new Error("Failed to reset the Event Gateway configuration. "+t.message)})});var r},registerFunction:function(t){return S(e,t)},deleteFunction:function(t){return P(e,t)},listFunctions:function(t){return T(e,t)},subscribe:function(t){return I(e,t)},unsubscribe:function(t){return U(e,t)},listSubscriptions:function(t){return _(e,t)}}}}}),pt=lt.eventGateway;t.default=lt,t.eventGateway=pt,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=fdk.min.js.map
'use strict'
const urlUtils = require('./urlUtils')
const urlUtils = require('./utils/url')

@@ -5,0 +5,0 @@ module.exports = (config, params) =>

'use strict'
const headersUtils = require('./utils/headers')
module.exports = (config, params) => {
const data = params.dataType ? params.data : JSON.stringify(params.data)
let headers = {
'Content-Type': params.dataType || 'application/json',
Event: params.event,
}
headers = headersUtils.injectServerlessApplicationToken(headers)
return config

@@ -9,6 +16,3 @@ .fetch(`${config.apiUrl}`, {

body: data,
headers: {
'Content-Type': params.dataType || 'application/json',
Event: params.event,
},
headers,
})

@@ -15,0 +19,0 @@ .then(response => {

@@ -14,3 +14,3 @@ 'use strict'

const invoke = require('./invoke')
const urlUtils = require('./urlUtils')
const urlUtils = require('./utils/url')

@@ -17,0 +17,0 @@ const eventGateway = configuration => {

'use strict'
const headersUtils = require('./utils/headers')
module.exports = (config, params) => {
const data = params.dataType ? params.data : JSON.stringify(params.data)
let headers = {
'Content-Type': params.dataType || 'application/json',
Event: 'invoke',
'Function-ID': params.functionId,
}
headers = headersUtils.injectServerlessApplicationToken(headers)
return config

@@ -9,7 +17,3 @@ .fetch(`${config.apiUrl}`, {

body: data,
headers: {
'Content-Type': params.dataType || 'application/json',
Event: 'invoke',
'Function-ID': params.functionId,
},
headers,
})

@@ -16,0 +20,0 @@ .then(response => {

'use strict'
const urlUtils = require('./urlUtils')
const urlUtils = require('./utils/url')

@@ -5,0 +5,0 @@ module.exports = config =>

'use strict'
const urlUtils = require('./urlUtils')
const urlUtils = require('./utils/url')

@@ -5,0 +5,0 @@ module.exports = config =>

'use strict'
const urlUtils = require('./urlUtils')
const urlUtils = require('./utils/url')

@@ -5,0 +5,0 @@ module.exports = (config, params) =>

'use strict'
const urlUtils = require('./urlUtils')
const urlUtils = require('./utils/url')

@@ -5,0 +5,0 @@ module.exports = (config, params) =>

'use strict'
const urlUtils = require('./urlUtils')
const urlUtils = require('./utils/url')

@@ -5,0 +5,0 @@ module.exports = (config, params) =>

{
"name": "@serverless/fdk",
"version": "0.5.1",
"version": "0.6.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": "https://github.com/serverless/fdk",

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