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.0.0 to 1.0.1-alpha

2

dist/stratumn-sdk.js

@@ -1753,3 +1753,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

return new Promise(function (resolve, reject) {
var url = agent.url + '/maps?' + (0, _makeQueryString2.default)(opts);
var url = agent.url + '/maps' + (0, _makeQueryString2.default)(opts);

@@ -1756,0 +1756,0 @@ return _superagent2.default.get(url).end(function (err, res) {

@@ -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(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var o=r(1),i=n(o),s=r(11),u=n(s);t.exports={getAgent:i["default"],fromSegment:u["default"]}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){return new Promise(function(e,r){return s["default"].get(t).end(function(n,o){if(n)return void r(n);var i=o.body;i.url=t,i.createMap=a["default"].bind(null,i),i.getSegment=l["default"].bind(null,i),i.findSegments=f["default"].bind(null,i),i.getMapIds=p["default"].bind(null,i),e(i)})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(5),a=n(u),c=r(7),l=n(c),h=r(8),f=n(h),d=r(10),p=n(d)},function(t,e,r){function n(){}function o(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function i(t){return t===Object(t)}function s(t){if(!i(t))return t;var e=[];for(var r in t)null!=t[r]&&u(e,r,t[r]);return e.join("&")}function u(t,e,r){return Array.isArray(r)?r.forEach(function(r){u(t,e,r)}):void t.push(encodeURIComponent(e)+"="+encodeURIComponent(r))}function a(t){for(var e,r,n={},o=t.split("&"),i=0,s=o.length;s>i;++i)r=o[i],e=r.split("="),n[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return n}function c(t){var e,r,n,o,i=t.split(/\r?\n/),s={};i.pop();for(var u=0,a=i.length;a>u;++u)r=i[u],e=r.indexOf(":"),n=r.slice(0,e).toLowerCase(),o=g(r.slice(e+1)),s[n]=o;return s}function l(t){return/[\/+]json\b/.test(t)}function h(t){return t.split(/ *; */).shift()}function f(t){return b(t.split(/ *; */),function(t,e){var r=e.split(/ *= */),n=r.shift(),o=r.shift();return n&&o&&(t[n]=o),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=c(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 p(t,e){var r=this;_.call(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(r)}catch(n){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=n,t.rawResponse=r.xhr&&r.xhr.responseText?r.xhr.responseText:null,r.callback(t)}if(r.emit("response",e),t)return r.callback(t,e);if(e.status>=200&&e.status<300)return r.callback(t,e);var o=new Error(e.statusText||"Unsuccessful HTTP response");o.original=t,o.response=e,o.status=e.status,r.callback(o,e)})}function y(t,e){return"function"==typeof e?new p("GET",t).end(e):1==arguments.length?new p("GET",t):new p(t,e)}function m(t,e){var r=y("DELETE",t);return e&&r.end(e),r}var v,_=r(3),b=r(4);v="undefined"!=typeof window?window:"undefined"!=typeof self?self:this,y.getXHR=function(){if(!(!v.XMLHttpRequest||v.location&&"file:"==v.location.protocol&&v.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){}return!1};var g="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};y.serializeObject=s,y.parseString=a,y.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"},y.serialize={"application/x-www-form-urlencoded":s,"application/json":JSON.stringify},y.parse={"application/x-www-form-urlencoded":a,"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=h(e);var r=f(e);for(var n in r)this[n]=r[n]},d.prototype.parseBody=function(t){var e=y.parse[this.type];return 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,r=t.url,n="cannot "+e+" "+r+" ("+this.status+")",o=new Error(n);return o.status=this.status,o.method=e,o.url=r,o},y.Response=d,_(p.prototype),p.prototype.use=function(t){return t(this),this},p.prototype.timeout=function(t){return this._timeout=t,this},p.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},p.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},p.prototype.set=function(t,e){if(i(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},p.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},p.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},p.prototype.type=function(t){return this.set("Content-Type",y.types[t]||t),this},p.prototype.parse=function(t){return this._parser=t,this},p.prototype.accept=function(t){return this.set("Accept",y.types[t]||t),this},p.prototype.auth=function(t,e){var r=btoa(t+":"+e);return this.set("Authorization","Basic "+r),this},p.prototype.query=function(t){return"string"!=typeof t&&(t=s(t)),t&&this._query.push(t),this},p.prototype.field=function(t,e){return this._formData||(this._formData=new v.FormData),this._formData.append(t,e),this},p.prototype.attach=function(t,e,r){return this._formData||(this._formData=new v.FormData),this._formData.append(t,e,r||e.name),this},p.prototype.send=function(t){var e=i(t),r=this.getHeader("Content-Type");if(e&&i(this._data))for(var n in t)this._data[n]=t[n];else"string"==typeof t?(r||this.type("form"),r=this.getHeader("Content-Type"),"application/x-www-form-urlencoded"==r?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||o(t)?this:(r||this.type("json"),this)},p.prototype.callback=function(t,e){var r=this._callback;this.clearTimeout(),r(t,e)},p.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)},p.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},p.prototype.withCredentials=function(){return this._withCredentials=!0,this},p.prototype.end=function(t){var e=this,r=this.xhr=y.getXHR(),i=this._query.join("&"),s=this._timeout,u=this._formData||this._data;this._callback=t||n,r.onreadystatechange=function(){if(4==r.readyState){var t;try{t=r.status}catch(n){t=0}if(0==t){if(e.timedout)return e.timeoutError();if(e.aborted)return;return e.crossDomainError()}e.emit("end")}};var a=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),t.direction="download",e.emit("progress",t)};this.hasListeners("progress")&&(r.onprogress=a);try{r.upload&&this.hasListeners("progress")&&(r.upload.onprogress=a)}catch(c){}if(s&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},s)),i&&(i=y.serializeObject(i),this.url+=~this.url.indexOf("?")?"&"+i:"?"+i),r.open(this.method,this.url,!0),this._withCredentials&&(r.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof u&&!o(u)){var h=this.getHeader("Content-Type"),f=this._parser||y.serialize[h?h.split(";")[0]:""];!f&&l(h)&&(f=y.serialize["application/json"]),f&&(u=f(u))}for(var d in this.header)null!=this.header[d]&&r.setRequestHeader(d,this.header[d]);return this.emit("request",this),r.send("undefined"!=typeof u?u:null),this},p.prototype.then=function(t,e){return this.end(function(r,n){r?e(r):t(n)})},y.Request=p,y.get=function(t,e,r){var n=y("GET",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},y.head=function(t,e,r){var n=y("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},y.del=m,y["delete"]=m,y.patch=function(t,e,r){var n=y("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},y.post=function(t,e,r){var n=y("POST",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},y.put=function(t,e,r){var n=y("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},t.exports=y},function(t,e){function r(t){return t?n(t):void 0}function n(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 r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),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 r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r){r=r.slice(0);for(var n=0,o=r.length;o>n;++n)r[n].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){t.exports=function(t,e,r){for(var n=0,o=t.length,i=3==arguments.length?r:t[n++];o>n;)i=e.call(null,i,t[n],++n,t);return i}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];return new Promise(function(e,n){var o=t.url+"/segments";return s["default"].post(o).send(r).end(function(r,o){var i=r||o.body.meta&&o.body.meta.errorMessage;return i?void n(i):void e((0,a["default"])(t,o.body))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(6),a=n(u)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return Object.keys(t.agentInfo.functions).filter(function(t){return["init","catchAll"].indexOf(t)<0}).forEach(function(r){e[r]=function(){for(var n=arguments.length,i=Array(n),u=0;n>u;u++)i[u]=arguments[u];return new Promise(function(n,u){var a=t.url+"/segments/"+e.meta.linkHash+"/"+r;return s["default"].post(a).send(i).end(function(e,r){var i=e||r.body.meta&&r.body.meta.errorMessage;return i?void u(i):void n(o(t,r.body))})})}}),e.getPrev=function(){return e.link.meta.prevLinkHash?t.getSegment(e.link.meta.prevLinkHash):Promise.resolve(null)},e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return new Promise(function(r,n){var o=t.url+"/segments/"+e;return s["default"].get(o).end(function(e,o){return e?void n(e):void r((0,a["default"])(t,o.body))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(6),a=n(u)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(r,n){var o=t.url+"/segments"+(0,l["default"])(e);return s["default"].get(o).end(function(e,o){return e?void n(e):void r(o.body.map(function(e){return(0,a["default"])(t,e)}))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(6),a=n(u),c=r(9),l=n(c)},function(t,e){"use strict";function r(t){var e=Object.keys(t).reduce(function(e,r){var n=Array.isArray(t[r])?t[r].join(","):t[r];return e.push(encodeURIComponent(r)+"="+encodeURIComponent(n)),e},[]);return e.length?"?"+e.join("&"):""}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(r,n){var o=t.url+"/maps?"+(0,a["default"])(e);return s["default"].get(o).end(function(t,e){return t?void n(t):void r(e.body)})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(9),a=n(u)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){return(0,s["default"])(t.meta.agentUrl).then(function(e){var r=(0,a["default"])(e,t);return{agent:e,segment:r}})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(1),s=n(i),u=r(6),a=n(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(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var o=r(1),i=n(o),s=r(11),u=n(s);t.exports={getAgent:i["default"],fromSegment:u["default"]}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){return new Promise(function(e,r){return s["default"].get(t).end(function(n,o){if(n)return void r(n);var i=o.body;i.url=t,i.createMap=a["default"].bind(null,i),i.getSegment=l["default"].bind(null,i),i.findSegments=f["default"].bind(null,i),i.getMapIds=p["default"].bind(null,i),e(i)})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(5),a=n(u),c=r(7),l=n(c),h=r(8),f=n(h),d=r(10),p=n(d)},function(t,e,r){function n(){}function o(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function i(t){return t===Object(t)}function s(t){if(!i(t))return t;var e=[];for(var r in t)null!=t[r]&&u(e,r,t[r]);return e.join("&")}function u(t,e,r){return Array.isArray(r)?r.forEach(function(r){u(t,e,r)}):void t.push(encodeURIComponent(e)+"="+encodeURIComponent(r))}function a(t){for(var e,r,n={},o=t.split("&"),i=0,s=o.length;s>i;++i)r=o[i],e=r.split("="),n[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return n}function c(t){var e,r,n,o,i=t.split(/\r?\n/),s={};i.pop();for(var u=0,a=i.length;a>u;++u)r=i[u],e=r.indexOf(":"),n=r.slice(0,e).toLowerCase(),o=g(r.slice(e+1)),s[n]=o;return s}function l(t){return/[\/+]json\b/.test(t)}function h(t){return t.split(/ *; */).shift()}function f(t){return b(t.split(/ *; */),function(t,e){var r=e.split(/ *= */),n=r.shift(),o=r.shift();return n&&o&&(t[n]=o),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=c(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 p(t,e){var r=this;_.call(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(r)}catch(n){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=n,t.rawResponse=r.xhr&&r.xhr.responseText?r.xhr.responseText:null,r.callback(t)}if(r.emit("response",e),t)return r.callback(t,e);if(e.status>=200&&e.status<300)return r.callback(t,e);var o=new Error(e.statusText||"Unsuccessful HTTP response");o.original=t,o.response=e,o.status=e.status,r.callback(o,e)})}function y(t,e){return"function"==typeof e?new p("GET",t).end(e):1==arguments.length?new p("GET",t):new p(t,e)}function m(t,e){var r=y("DELETE",t);return e&&r.end(e),r}var v,_=r(3),b=r(4);v="undefined"!=typeof window?window:"undefined"!=typeof self?self:this,y.getXHR=function(){if(!(!v.XMLHttpRequest||v.location&&"file:"==v.location.protocol&&v.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){}return!1};var g="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};y.serializeObject=s,y.parseString=a,y.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"},y.serialize={"application/x-www-form-urlencoded":s,"application/json":JSON.stringify},y.parse={"application/x-www-form-urlencoded":a,"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=h(e);var r=f(e);for(var n in r)this[n]=r[n]},d.prototype.parseBody=function(t){var e=y.parse[this.type];return 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,r=t.url,n="cannot "+e+" "+r+" ("+this.status+")",o=new Error(n);return o.status=this.status,o.method=e,o.url=r,o},y.Response=d,_(p.prototype),p.prototype.use=function(t){return t(this),this},p.prototype.timeout=function(t){return this._timeout=t,this},p.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},p.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},p.prototype.set=function(t,e){if(i(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},p.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},p.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},p.prototype.type=function(t){return this.set("Content-Type",y.types[t]||t),this},p.prototype.parse=function(t){return this._parser=t,this},p.prototype.accept=function(t){return this.set("Accept",y.types[t]||t),this},p.prototype.auth=function(t,e){var r=btoa(t+":"+e);return this.set("Authorization","Basic "+r),this},p.prototype.query=function(t){return"string"!=typeof t&&(t=s(t)),t&&this._query.push(t),this},p.prototype.field=function(t,e){return this._formData||(this._formData=new v.FormData),this._formData.append(t,e),this},p.prototype.attach=function(t,e,r){return this._formData||(this._formData=new v.FormData),this._formData.append(t,e,r||e.name),this},p.prototype.send=function(t){var e=i(t),r=this.getHeader("Content-Type");if(e&&i(this._data))for(var n in t)this._data[n]=t[n];else"string"==typeof t?(r||this.type("form"),r=this.getHeader("Content-Type"),"application/x-www-form-urlencoded"==r?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||o(t)?this:(r||this.type("json"),this)},p.prototype.callback=function(t,e){var r=this._callback;this.clearTimeout(),r(t,e)},p.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)},p.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},p.prototype.withCredentials=function(){return this._withCredentials=!0,this},p.prototype.end=function(t){var e=this,r=this.xhr=y.getXHR(),i=this._query.join("&"),s=this._timeout,u=this._formData||this._data;this._callback=t||n,r.onreadystatechange=function(){if(4==r.readyState){var t;try{t=r.status}catch(n){t=0}if(0==t){if(e.timedout)return e.timeoutError();if(e.aborted)return;return e.crossDomainError()}e.emit("end")}};var a=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),t.direction="download",e.emit("progress",t)};this.hasListeners("progress")&&(r.onprogress=a);try{r.upload&&this.hasListeners("progress")&&(r.upload.onprogress=a)}catch(c){}if(s&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},s)),i&&(i=y.serializeObject(i),this.url+=~this.url.indexOf("?")?"&"+i:"?"+i),r.open(this.method,this.url,!0),this._withCredentials&&(r.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof u&&!o(u)){var h=this.getHeader("Content-Type"),f=this._parser||y.serialize[h?h.split(";")[0]:""];!f&&l(h)&&(f=y.serialize["application/json"]),f&&(u=f(u))}for(var d in this.header)null!=this.header[d]&&r.setRequestHeader(d,this.header[d]);return this.emit("request",this),r.send("undefined"!=typeof u?u:null),this},p.prototype.then=function(t,e){return this.end(function(r,n){r?e(r):t(n)})},y.Request=p,y.get=function(t,e,r){var n=y("GET",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},y.head=function(t,e,r){var n=y("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},y.del=m,y["delete"]=m,y.patch=function(t,e,r){var n=y("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},y.post=function(t,e,r){var n=y("POST",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},y.put=function(t,e,r){var n=y("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},t.exports=y},function(t,e){function r(t){return t?n(t):void 0}function n(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 r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),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 r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r){r=r.slice(0);for(var n=0,o=r.length;o>n;++n)r[n].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){t.exports=function(t,e,r){for(var n=0,o=t.length,i=3==arguments.length?r:t[n++];o>n;)i=e.call(null,i,t[n],++n,t);return i}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];return new Promise(function(e,n){var o=t.url+"/segments";return s["default"].post(o).send(r).end(function(r,o){var i=r||o.body.meta&&o.body.meta.errorMessage;return i?void n(i):void e((0,a["default"])(t,o.body))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(6),a=n(u)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return Object.keys(t.agentInfo.functions).filter(function(t){return["init","catchAll"].indexOf(t)<0}).forEach(function(r){e[r]=function(){for(var n=arguments.length,i=Array(n),u=0;n>u;u++)i[u]=arguments[u];return new Promise(function(n,u){var a=t.url+"/segments/"+e.meta.linkHash+"/"+r;return s["default"].post(a).send(i).end(function(e,r){var i=e||r.body.meta&&r.body.meta.errorMessage;return i?void u(i):void n(o(t,r.body))})})}}),e.getPrev=function(){return e.link.meta.prevLinkHash?t.getSegment(e.link.meta.prevLinkHash):Promise.resolve(null)},e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return new Promise(function(r,n){var o=t.url+"/segments/"+e;return s["default"].get(o).end(function(e,o){return e?void n(e):void r((0,a["default"])(t,o.body))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(6),a=n(u)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(r,n){var o=t.url+"/segments"+(0,l["default"])(e);return s["default"].get(o).end(function(e,o){return e?void n(e):void r(o.body.map(function(e){return(0,a["default"])(t,e)}))})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(6),a=n(u),c=r(9),l=n(c)},function(t,e){"use strict";function r(t){var e=Object.keys(t).reduce(function(e,r){var n=Array.isArray(t[r])?t[r].join(","):t[r];return e.push(encodeURIComponent(r)+"="+encodeURIComponent(n)),e},[]);return e.length?"?"+e.join("&"):""}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(r,n){var o=t.url+"/maps"+(0,a["default"])(e);return s["default"].get(o).end(function(t,e){return t?void n(t):void r(e.body)})})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(2),s=n(i),u=r(9),a=n(u)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){return(0,s["default"])(t.meta.agentUrl).then(function(e){var r=(0,a["default"])(e,t);return{agent:e,segment:r}})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var i=r(1),s=n(i),u=r(6),a=n(u)}])});

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

return new Promise(function (resolve, reject) {
var url = agent.url + '/maps?' + (0, _makeQueryString2.default)(opts);
var url = agent.url + '/maps' + (0, _makeQueryString2.default)(opts);

@@ -25,0 +25,0 @@ return _superagent2.default.get(url).end(function (err, res) {

{
"name": "stratumn-sdk",
"version": "1.0.0",
"version": "1.0.1-alpha",
"description": "Stratumn SDK for Javascript",

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

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

return new Promise((resolve, reject) => {
const url = `${agent.url}/maps?${makeQueryString(opts)}`;
const url = `${agent.url}/maps${makeQueryString(opts)}`;

@@ -9,0 +9,0 @@ return request

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