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

stratumn-sdk

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stratumn-sdk - npm Package Compare versions

Comparing version 1.2.3 to 1.3.1

6

dist/stratumn-sdk.js

@@ -1793,4 +1793,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

function segmentify(agent, obj) {
Object.keys(agent.agentInfo.functions).filter(function (key) {
return ['init', 'catchAll'].indexOf(key) < 0;
Object.keys(agent.agentInfo.actions).filter(function (key) {
return ['init'].indexOf(key) < 0;
}).forEach(function (key) {

@@ -1964,3 +1964,3 @@ /*eslint-disable*/

var parts = Object.keys(obj).reduce(function (curr, key) {
var val = Array.isArray(obj[key]) ? obj[key].join(',') : obj[key];
var val = Array.isArray(obj[key]) ? obj[key].join('+') : obj[key];
curr.push(encodeURIComponent(key) + '=' + encodeURIComponent(val));

@@ -1967,0 +1967,0 @@ return curr;

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StratumnSDK=e():t.StratumnSDK=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var i=n(1),s=r(i),o=n(17),u=r(o),a=n(18),l=r(a),c=n(20),d=r(c),f=n(19),h=r(f);t.exports={getAgent:s["default"],fromSegment:u["default"],getApplication:l["default"],loadLink:d["default"],config:h["default"]}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return new Promise(function(e,n){return o["default"].get(t).end(function(r,i){if(r)return r.status=i.statusCode,void n(r);var s=i.body;s.url=t,s.createMap=a["default"].bind(null,s),s.getSegment=c["default"].bind(null,s),s.findSegments=f["default"].bind(null,s),s.getMapIds=p["default"].bind(null,s),s.getBranches=m["default"].bind(null,s),s.getLink=v["default"].bind(null,s),s.getMap=b["default"].bind(null,s),e(s)})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(7),a=r(u),l=n(10),c=r(l),d=n(11),f=r(d),h=n(13),p=r(h),y=n(14),m=r(y),_=n(15),v=r(_),g=n(16),b=r(g)},function(t,e,n){function r(){}function i(t){if(!_(t))return t;var e=[];for(var n in t)null!=t[n]&&s(e,n,t[n]);return e.join("&")}function s(t,e,n){if(Array.isArray(n))return n.forEach(function(n){s(t,e,n)});if(_(n))for(var r in n)s(t,e+"["+r+"]",n[r]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n))}function o(t){for(var e,n,r={},i=t.split("&"),s=0,o=i.length;o>s;++s)e=i[s],n=e.indexOf("="),-1==n?r[decodeURIComponent(e)]="":r[decodeURIComponent(e.slice(0,n))]=decodeURIComponent(e.slice(n+1));return r}function u(t){var e,n,r,i,s=t.split(/\r?\n/),o={};s.pop();for(var u=0,a=s.length;a>u;++u)n=s[u],e=n.indexOf(":"),r=n.slice(0,e).toLowerCase(),i=g(n.slice(e+1)),o[r]=i;return o}function a(t){return/[\/+]json\b/.test(t)}function l(t){return t.split(/ *; */).shift()}function c(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),r=n.shift(),i=n.shift();return r&&i&&(t[r]=i),t},{})}function d(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this._setStatusProperties(this.xhr.status),this.header=this.headers=u(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function f(t,e){var n=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new d(n)}catch(r){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=r,t.rawResponse=n.xhr&&n.xhr.responseText?n.xhr.responseText:null,t.statusCode=n.xhr&&n.xhr.status?n.xhr.status:null,n.callback(t)}n.emit("response",e);var i;try{(e.status<200||e.status>=300)&&(i=new Error(e.statusText||"Unsuccessful HTTP response"),i.original=t,i.response=e,i.status=e.status)}catch(r){i=r}i?n.callback(i,e):n.callback(null,e)})}function h(t,e){var n=v("DELETE",t);return e&&n.end(e),n}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var y=n(3),m=n(4),_=n(5),v=t.exports=n(6).bind(null,f);v.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var g="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};v.serializeObject=i,v.parseString=o,v.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},v.serialize={"application/x-www-form-urlencoded":i,"application/json":JSON.stringify},v.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},d.prototype.get=function(t){return this.header[t.toLowerCase()]},d.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=l(e);var n=c(e);for(var r in n)this[r]=n[r]},d.prototype._parseBody=function(t){var e=v.parse[this.type];return!e&&a(this.type)&&(e=v.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},d.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=4==e||5==e?this.toError():!1,this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},d.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",i=new Error(r);return i.status=this.status,i.method=e,i.url=n,i},v.Response=d,y(f.prototype);for(var b in m)f.prototype[b]=m[b];f.prototype.type=function(t){return this.set("Content-Type",v.types[t]||t),this},f.prototype.responseType=function(t){return this._responseType=t,this},f.prototype.accept=function(t){return this.set("Accept",v.types[t]||t),this},f.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var r=btoa(t+":"+e);this.set("Authorization","Basic "+r);break;case"auto":this.username=t,this.password=e}return this},f.prototype.query=function(t){return"string"!=typeof t&&(t=i(t)),t&&this._query.push(t),this},f.prototype.attach=function(t,e,n){return this._getFormData().append(t,e,n||e.name),this},f.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},f.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),n(t,e)},f.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},f.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},f.prototype.end=function(t){var e=this,n=this.xhr=v.getXHR(),i=this._timeout,s=this._formData||this._data;this._callback=t||r,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(r){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var o=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),t.direction="download",e.emit("progress",t)};this.hasListeners("progress")&&(n.onprogress=o);try{n.upload&&this.hasListeners("progress")&&(n.upload.onprogress=o)}catch(u){}if(i&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},i)),this._appendQueryString(),this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var l=this._header["content-type"],c=this._serializer||v.serialize[l?l.split(";")[0]:""];!c&&a(l)&&(c=v.serialize["application/json"]),c&&(s=c(s))}for(var d in this.header)null!=this.header[d]&&n.setRequestHeader(d,this.header[d]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof s?s:null),this},v.Request=f,v.get=function(t,e,n){var r=v("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},v.head=function(t,e,n){var r=v("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},v.options=function(t,e,n){var r=v("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},v.del=h,v["delete"]=h,v.patch=function(t,e,n){var r=v("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},v.post=function(t,e,n){var r=v("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},v.put=function(t,e,n){var r=v("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}},function(t,e,n){function r(t){return t?i(t):void 0}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var r=0,i=n.length;i>r;++r)n[r].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,n){var r=n(5);e.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},e.parse=function(t){return this._parser=t,this},e.serialize=function(t){return this._serializer=t,this},e.timeout=function(t){return this._timeout=t,this},e.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,r){n?e(n):t(r)})})}return this._fullfilledPromise.then(t,e)},e.use=function(t){return t(this),this},e.get=function(t){return this._header[t.toLowerCase()]},e.getHeader=e.get,e.set=function(t,e){if(r(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},e.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},e.field=function(t,e){return this._getFormData().append(t,e),this},e.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},e.withCredentials=function(){return this._withCredentials=!0,this},e.redirects=function(t){return this._maxRedirects=t,this},e.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},e._isHost=function(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}},e.send=function(t){var e=r(t),n=this._header["content-type"];if(e&&r(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e){function n(t,e,n){return"function"==typeof n?new t("GET",e).end(n):2==arguments.length?new t("GET",e):new t(e,n)}t.exports=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];return new Promise(function(e,r){var i=t.url+"/segments";return o["default"].post(i).send(n).end(function(n,i){var s=i.body.meta&&i.body.meta.errorMessage?new Error(i.body.meta.errorMessage):n;return s?(s.status=i.statusCode,void r(s)):void e((0,a["default"])(t,i.body))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(8),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return Object.keys(t.agentInfo.functions).filter(function(t){return["init","catchAll"].indexOf(t)<0}).forEach(function(n){e[n]=function(){for(var r=arguments.length,s=Array(r),u=0;r>u;u++)s[u]=arguments[u];return new Promise(function(r,u){var a=t.url+"/segments/"+e.meta.linkHash+"/"+n;return o["default"].post(a).send(s).end(function(e,n){var s=n.body.meta&&n.body.meta.errorMessage?new Error(n.body.meta.errorMessage):e;return s?(s.status=n.statusCode,void u(s)):void r(i(t,n.body))})})}}),e.getPrev=function(){return e.link.meta.prevLinkHash?t.getSegment(e.link.meta.prevLinkHash):Promise.resolve(null)},e.load=function(){return(0,a["default"])("segment#load()"),e},e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(9),a=r(u)},function(t,e){"use strict";function n(t,e){e?console.warn("WARNING: "+t+" is deprecated. Please use "+e+" instead."):console.warn("WARNING: "+t+" is deprecated.")}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return new Promise(function(n,r){var i=t.url+"/segments/"+e;return o["default"].get(i).end(function(e,i){return e?(e.status=i.statusCode,void r(e)):void n((0,a["default"])(t,i.body))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(8),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(n,r){var i=t.url+"/segments"+(0,c["default"])(e);return o["default"].get(i).end(function(e,i){return e?(e.status=i.statusCode,void r(e)):void n(i.body.map(function(e){return(0,a["default"])(t,e)}))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(8),a=r(u),l=n(12),c=r(l)},function(t,e){"use strict";function n(t){var e=Object.keys(t).reduce(function(e,n){var r=Array.isArray(t[n])?t[n].join(","):t[n];return e.push(encodeURIComponent(n)+"="+encodeURIComponent(r)),e},[]);return e.length?"?"+e.join("&"):""}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(n,r){var i=t.url+"/maps"+(0,a["default"])(e);return o["default"].get(i).end(function(t,e){return t?(t.status=e.statusCode,void r(t)):void n(e.body)})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(12),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return(0,a["default"])("Agent#getBranches(agent, prevLinkHash, tags = [])","Agent#findSegments(agent, filter)"),(0,o["default"])(t,{prevLinkHash:e,tags:n})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(11),o=r(s),u=n(9),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return(0,a["default"])("Agent#getLink(agent, hash)","Agent#getSegment(agent, hash)"),(0,o["default"])(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(10),o=r(s),u=n(9),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return(0,a["default"])("getMap(agent, mapId, tags = [])","findSegments(agent, filter)"),(0,o["default"])(t,{mapId:e,tags:n})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(11),o=r(s),u=n(9),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return(0,o["default"])(t.meta.agentUrl||t.meta.applicationLocation).then(function(e){var n=(0,a["default"])(e,t);return{agent:e,segment:n}})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(1),o=r(s),u=n(8),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return(0,a["default"])("getApplication(name, url)","getAgent(url)"),(0,o["default"])(e||c["default"].applicationUrl.replace("%s",t))}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(1),o=r(s),u=n(9),a=r(u),l=n(19),c=r(l)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={applicationUrl:"https://%s.stratumn.rocks"}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return(0,a["default"])("loadLink(obj)","fromSegment(obj)"),(0,o["default"])(t).then(function(t){var e=t.segment;return e})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(17),o=r(s),u=n(9),a=r(u)}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StratumnSDK=e():t.StratumnSDK=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var i=n(1),s=r(i),o=n(17),u=r(o),a=n(18),l=r(a),c=n(20),d=r(c),f=n(19),h=r(f);t.exports={getAgent:s["default"],fromSegment:u["default"],getApplication:l["default"],loadLink:d["default"],config:h["default"]}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return new Promise(function(e,n){return o["default"].get(t).end(function(r,i){if(r)return r.status=i.statusCode,void n(r);var s=i.body;s.url=t,s.createMap=a["default"].bind(null,s),s.getSegment=c["default"].bind(null,s),s.findSegments=f["default"].bind(null,s),s.getMapIds=p["default"].bind(null,s),s.getBranches=m["default"].bind(null,s),s.getLink=v["default"].bind(null,s),s.getMap=b["default"].bind(null,s),e(s)})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(7),a=r(u),l=n(10),c=r(l),d=n(11),f=r(d),h=n(13),p=r(h),y=n(14),m=r(y),_=n(15),v=r(_),g=n(16),b=r(g)},function(t,e,n){function r(){}function i(t){if(!_(t))return t;var e=[];for(var n in t)null!=t[n]&&s(e,n,t[n]);return e.join("&")}function s(t,e,n){if(Array.isArray(n))return n.forEach(function(n){s(t,e,n)});if(_(n))for(var r in n)s(t,e+"["+r+"]",n[r]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n))}function o(t){for(var e,n,r={},i=t.split("&"),s=0,o=i.length;o>s;++s)e=i[s],n=e.indexOf("="),-1==n?r[decodeURIComponent(e)]="":r[decodeURIComponent(e.slice(0,n))]=decodeURIComponent(e.slice(n+1));return r}function u(t){var e,n,r,i,s=t.split(/\r?\n/),o={};s.pop();for(var u=0,a=s.length;a>u;++u)n=s[u],e=n.indexOf(":"),r=n.slice(0,e).toLowerCase(),i=g(n.slice(e+1)),o[r]=i;return o}function a(t){return/[\/+]json\b/.test(t)}function l(t){return t.split(/ *; */).shift()}function c(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),r=n.shift(),i=n.shift();return r&&i&&(t[r]=i),t},{})}function d(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this._setStatusProperties(this.xhr.status),this.header=this.headers=u(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function f(t,e){var n=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new d(n)}catch(r){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=r,t.rawResponse=n.xhr&&n.xhr.responseText?n.xhr.responseText:null,t.statusCode=n.xhr&&n.xhr.status?n.xhr.status:null,n.callback(t)}n.emit("response",e);var i;try{(e.status<200||e.status>=300)&&(i=new Error(e.statusText||"Unsuccessful HTTP response"),i.original=t,i.response=e,i.status=e.status)}catch(r){i=r}i?n.callback(i,e):n.callback(null,e)})}function h(t,e){var n=v("DELETE",t);return e&&n.end(e),n}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var y=n(3),m=n(4),_=n(5),v=t.exports=n(6).bind(null,f);v.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var g="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};v.serializeObject=i,v.parseString=o,v.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},v.serialize={"application/x-www-form-urlencoded":i,"application/json":JSON.stringify},v.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},d.prototype.get=function(t){return this.header[t.toLowerCase()]},d.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=l(e);var n=c(e);for(var r in n)this[r]=n[r]},d.prototype._parseBody=function(t){var e=v.parse[this.type];return!e&&a(this.type)&&(e=v.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},d.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=4==e||5==e?this.toError():!1,this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},d.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",i=new Error(r);return i.status=this.status,i.method=e,i.url=n,i},v.Response=d,y(f.prototype);for(var b in m)f.prototype[b]=m[b];f.prototype.type=function(t){return this.set("Content-Type",v.types[t]||t),this},f.prototype.responseType=function(t){return this._responseType=t,this},f.prototype.accept=function(t){return this.set("Accept",v.types[t]||t),this},f.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var r=btoa(t+":"+e);this.set("Authorization","Basic "+r);break;case"auto":this.username=t,this.password=e}return this},f.prototype.query=function(t){return"string"!=typeof t&&(t=i(t)),t&&this._query.push(t),this},f.prototype.attach=function(t,e,n){return this._getFormData().append(t,e,n||e.name),this},f.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},f.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),n(t,e)},f.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},f.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},f.prototype.end=function(t){var e=this,n=this.xhr=v.getXHR(),i=this._timeout,s=this._formData||this._data;this._callback=t||r,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(r){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var o=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),t.direction="download",e.emit("progress",t)};this.hasListeners("progress")&&(n.onprogress=o);try{n.upload&&this.hasListeners("progress")&&(n.upload.onprogress=o)}catch(u){}if(i&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},i)),this._appendQueryString(),this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var l=this._header["content-type"],c=this._serializer||v.serialize[l?l.split(";")[0]:""];!c&&a(l)&&(c=v.serialize["application/json"]),c&&(s=c(s))}for(var d in this.header)null!=this.header[d]&&n.setRequestHeader(d,this.header[d]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof s?s:null),this},v.Request=f,v.get=function(t,e,n){var r=v("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},v.head=function(t,e,n){var r=v("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},v.options=function(t,e,n){var r=v("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},v.del=h,v["delete"]=h,v.patch=function(t,e,n){var r=v("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},v.post=function(t,e,n){var r=v("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},v.put=function(t,e,n){var r=v("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}},function(t,e,n){function r(t){return t?i(t):void 0}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var r=0,i=n.length;i>r;++r)n[r].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,n){var r=n(5);e.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},e.parse=function(t){return this._parser=t,this},e.serialize=function(t){return this._serializer=t,this},e.timeout=function(t){return this._timeout=t,this},e.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,r){n?e(n):t(r)})})}return this._fullfilledPromise.then(t,e)},e.use=function(t){return t(this),this},e.get=function(t){return this._header[t.toLowerCase()]},e.getHeader=e.get,e.set=function(t,e){if(r(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},e.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},e.field=function(t,e){return this._getFormData().append(t,e),this},e.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},e.withCredentials=function(){return this._withCredentials=!0,this},e.redirects=function(t){return this._maxRedirects=t,this},e.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},e._isHost=function(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}},e.send=function(t){var e=r(t),n=this._header["content-type"];if(e&&r(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e){function n(t,e,n){return"function"==typeof n?new t("GET",e).end(n):2==arguments.length?new t("GET",e):new t(e,n)}t.exports=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];return new Promise(function(e,r){var i=t.url+"/segments";return o["default"].post(i).send(n).end(function(n,i){var s=i.body.meta&&i.body.meta.errorMessage?new Error(i.body.meta.errorMessage):n;return s?(s.status=i.statusCode,void r(s)):void e((0,a["default"])(t,i.body))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(8),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return Object.keys(t.agentInfo.actions).filter(function(t){return["init"].indexOf(t)<0}).forEach(function(n){e[n]=function(){for(var r=arguments.length,s=Array(r),u=0;r>u;u++)s[u]=arguments[u];return new Promise(function(r,u){var a=t.url+"/segments/"+e.meta.linkHash+"/"+n;return o["default"].post(a).send(s).end(function(e,n){var s=n.body.meta&&n.body.meta.errorMessage?new Error(n.body.meta.errorMessage):e;return s?(s.status=n.statusCode,void u(s)):void r(i(t,n.body))})})}}),e.getPrev=function(){return e.link.meta.prevLinkHash?t.getSegment(e.link.meta.prevLinkHash):Promise.resolve(null)},e.load=function(){return(0,a["default"])("segment#load()"),e},e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(9),a=r(u)},function(t,e){"use strict";function n(t,e){e?console.warn("WARNING: "+t+" is deprecated. Please use "+e+" instead."):console.warn("WARNING: "+t+" is deprecated.")}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return new Promise(function(n,r){var i=t.url+"/segments/"+e;return o["default"].get(i).end(function(e,i){return e?(e.status=i.statusCode,void r(e)):void n((0,a["default"])(t,i.body))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(8),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(n,r){var i=t.url+"/segments"+(0,c["default"])(e);return o["default"].get(i).end(function(e,i){return e?(e.status=i.statusCode,void r(e)):void n(i.body.map(function(e){return(0,a["default"])(t,e)}))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(8),a=r(u),l=n(12),c=r(l)},function(t,e){"use strict";function n(t){var e=Object.keys(t).reduce(function(e,n){var r=Array.isArray(t[n])?t[n].join("+"):t[n];return e.push(encodeURIComponent(n)+"="+encodeURIComponent(r)),e},[]);return e.length?"?"+e.join("&"):""}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(n,r){var i=t.url+"/maps"+(0,a["default"])(e);return o["default"].get(i).end(function(t,e){return t?(t.status=e.statusCode,void r(t)):void n(e.body)})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(2),o=r(s),u=n(12),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return(0,a["default"])("Agent#getBranches(agent, prevLinkHash, tags = [])","Agent#findSegments(agent, filter)"),(0,o["default"])(t,{prevLinkHash:e,tags:n})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(11),o=r(s),u=n(9),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return(0,a["default"])("Agent#getLink(agent, hash)","Agent#getSegment(agent, hash)"),(0,o["default"])(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(10),o=r(s),u=n(9),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return(0,a["default"])("getMap(agent, mapId, tags = [])","findSegments(agent, filter)"),(0,o["default"])(t,{mapId:e,tags:n})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(11),o=r(s),u=n(9),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return(0,o["default"])(t.meta.agentUrl||t.meta.applicationLocation).then(function(e){var n=(0,a["default"])(e,t);return{agent:e,segment:n}})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(1),o=r(s),u=n(8),a=r(u)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return(0,a["default"])("getApplication(name, url)","getAgent(url)"),(0,o["default"])(e||c["default"].applicationUrl.replace("%s",t))}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(1),o=r(s),u=n(9),a=r(u),l=n(19),c=r(l)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={applicationUrl:"https://%s.stratumn.rocks"}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return(0,a["default"])("loadLink(obj)","fromSegment(obj)"),(0,o["default"])(t).then(function(t){var e=t.segment;return e})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var s=n(17),o=r(s),u=n(9),a=r(u)}])});

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

var parts = Object.keys(obj).reduce(function (curr, key) {
var val = Array.isArray(obj[key]) ? obj[key].join(',') : obj[key];
var val = Array.isArray(obj[key]) ? obj[key].join('+') : obj[key];
curr.push(encodeURIComponent(key) + '=' + encodeURIComponent(val));

@@ -17,0 +17,0 @@ return curr;

@@ -19,4 +19,4 @@ 'use strict';

function segmentify(agent, obj) {
Object.keys(agent.agentInfo.functions).filter(function (key) {
return ['init', 'catchAll'].indexOf(key) < 0;
Object.keys(agent.agentInfo.actions).filter(function (key) {
return ['init'].indexOf(key) < 0;
}).forEach(function (key) {

@@ -23,0 +23,0 @@ /*eslint-disable*/

{
"name": "stratumn-sdk",
"version": "1.2.3",
"version": "1.3.1",
"description": "Stratumn SDK for Javascript",

@@ -52,3 +52,3 @@ "main": "lib/index.js",

"should": "^8.2.2",
"stratumn-agent": "^0.5.2",
"stratumn-agent": "^0.10.0",
"webpack": "^1.12.14"

@@ -55,0 +55,0 @@ },

@@ -8,3 +8,3 @@ /**

const parts = Object.keys(obj).reduce((curr, key) => {
const val = Array.isArray(obj[key]) ? obj[key].join(',') : obj[key];
const val = Array.isArray(obj[key]) ? obj[key].join('+') : obj[key];
curr.push(`${encodeURIComponent(key)}=${encodeURIComponent(val)}`);

@@ -11,0 +11,0 @@ return curr;

@@ -6,4 +6,4 @@ import request from 'superagent';

Object
.keys(agent.agentInfo.functions)
.filter(key => ['init', 'catchAll'].indexOf(key) < 0)
.keys(agent.agentInfo.actions)
.filter(key => ['init'].indexOf(key) < 0)
.forEach(key => {

@@ -10,0 +10,0 @@ /*eslint-disable*/

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