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 0.6.0 to 0.7.0

src/getMapIds.js

7

dist/stratumn-sdk.js

@@ -709,2 +709,8 @@ (function (global, factory) {

function getMapIds(agent) {
return get(agent.url + '/maps').then(function (res) {
return res.body;
});
}
function getBranches(app, linkHash) {

@@ -739,2 +745,3 @@ var tags = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];

app.getBranches = getBranches.bind(null, app);
app.getMapIds = getMapIds.bind(null, app);

@@ -741,0 +748,0 @@ return app;

2

dist/stratumn-sdk.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.StratumnSDK=e.StratumnSDK||{})}(this,function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function r(e,t){return t={exports:{}},e(t,t.exports),t.exports}function n(e,t,r){return new Promise(function(n,o){ee({method:e,url:t,body:r},function(e,t){var r=e||t.body&&t.body.meta&&t.body.meta.errorMessage;r?o(r):n(t)})})}function o(e){return n("GET",e)}function s(e,t){return n("POST",e,t)}function a(e,t){return Object.keys(e.agentInfo.functions).filter(function(e){return["init","catchAll"].indexOf(e)<0}).forEach(function(r){t[r]=function(){for(var n=arguments.length,o=Array(n),u=0;u<n;u++)o[u]=arguments[u];var i=te.applicationUrl.replace("%s",e.name)+"/links/"+t.meta.linkHash+"/"+r;return s(i,o).then(function(t){return a(e,t.body)})}}),t.getPrev=function(){return t.link.meta.prevLinkHash?e.getLink(t.link.meta.prevLinkHash):Promise.resolve(null)},t.getBranches=function(r){return e.getBranches(t.meta.linkHash,r)},t.load=function(){return e.getLink(t.meta.linkHash)},t}function u(e){for(var t=te.applicationUrl.replace("%s",e.name)+"/maps",r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return s(t,n).then(function(t){return a(e,t.body)})}function i(e,t){var r=te.applicationUrl.replace("%s",e.name)+"/links/"+t;return o(r).then(function(t){return a(e,t.body)})}function c(e,t){var r=arguments.length<=2||void 0===arguments[2]?[]:arguments[2],n="";r&&r.length&&(n="?tags="+r.join("&tags="));var s=te.applicationUrl.replace("%s",e.name)+"/maps/"+t+n;return o(s).then(function(t){return t.body.map(function(t){return a(e,t)})})}function f(e,t){var r=arguments.length<=2||void 0===arguments[2]?[]:arguments[2],n="";r&&r.length&&(n="?tags="+r.join("&tags="));var s=te.applicationUrl.replace("%s",e.name)+"/branches/"+t+n;return o(s).then(function(t){return t.body.map(function(t){return a(e,t)})})}function p(e,t){var r=t||te.applicationUrl.replace("%s",e);return o(r).then(function(e){var t=e.body;return t.url=r,t.createMap=u.bind(null,t),t.getLink=i.bind(null,t),t.getMap=c.bind(null,t),t.getBranches=f.bind(null,t),t})}function l(e){return p(e.meta.application,e.meta.applicationLocation).then(function(t){var r=e.meta.linkLocation;return o(r).then(function(e){return a(t,e.body)})})}var h=r(function(e){e.exports={processRequest:function(e){var t=e.header("Content-Type"),r=t&&t.indexOf("application/json")!==-1;(null==t||r)&&e.body&&(t||e.header("Content-Type","application/json"),e.body=JSON.stringify(e.body))}}}),d=t(h),y=h.processRequest,b=Object.freeze({default:d,processRequest:y}),m=r(function(e){e.exports={processRequest:function(e){var t=e.header("Accept");null==t&&e.header("Accept","application/json")},processResponse:function(e){if(e.contentType&&/^.*\/(?:.*\+)?json(;|$)/i.test(e.contentType)){var t="string"==typeof e.body?e.body:e.text;t&&(e.body=JSON.parse(t))}}}}),v=t(m),g=m.processRequest,R=m.processResponse,x=Object.freeze({default:v,processRequest:g,processResponse:R}),O=r(function(e){var r=t(b),n=t(x);e.exports={processRequest:function(e){r.processRequest.call(this,e),n.processRequest.call(this,e)},processResponse:function(e){n.processResponse.call(this,e)}}}),q=t(O),k=r(function(e){e.exports={processRequest:function(e){e.url=e.url.replace(/[^%]+/g,function(e){return encodeURI(e)})}}}),j=t(k),T=k.processRequest,w=Object.freeze({default:j,processRequest:T}),H=r(function(e){e.exports=window.XMLHttpRequest}),z=t(H),A=Object.freeze({default:z}),E=r(function(e){e.exports=function(e){return function(){var t=Array.prototype.slice.call(arguments,0),r=function(){return e.apply(null,t)};setTimeout(r,0)}}}),L=t(E),U=Object.freeze({default:L}),P=r(function(e){function t(e){var t="string"==typeof e?{url:e}:e||{};this.method=t.method?t.method.toUpperCase():"GET",this.url=t.url,this.headers=t.headers||{},this.body=t.body,this.timeout=t.timeout||0,this.errorOn404=null==t.errorOn404||t.errorOn404,this.onload=t.onload,this.onerror=t.onerror}t.prototype.abort=function(){if(!this.aborted)return this.aborted=!0,this.xhr.abort(),this},t.prototype.header=function(e,t){var r;for(r in this.headers)if(this.headers.hasOwnProperty(r)&&e.toLowerCase()===r.toLowerCase()){if(1===arguments.length)return this.headers[r];delete this.headers[r];break}if(null!=t)return this.headers[e]=t,t},e.exports=t}),S=t(P),C=Object.freeze({default:S}),M=r(function(e){function t(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}return e}e.exports=t}),X=t(M),B=Object.freeze({default:X}),I=r(function(e){var r=t(B);e.exports=function(e){var t=e.xhr,n={request:e,xhr:t};try{var o,s,a,u={};if(t.getAllResponseHeaders)for(o=t.getAllResponseHeaders().split("\n"),s=0;s<o.length;s++)(a=o[s].match(/\s*([^\s]+):\s+([^\s]+)/))&&(u[a[1]]=a[2]);n=r(n,{status:t.status,contentType:t.contentType||t.getResponseHeader&&t.getResponseHeader("Content-Type"),headers:u,text:t.responseText,body:t.response||t.responseText})}catch(e){}return n}}),D=t(I),G=Object.freeze({default:D}),J=r(function(e){function r(e){this.request=e.request,this.xhr=e.xhr,this.headers=e.headers||{},this.status=e.status||0,this.text=e.text,this.body=e.body,this.contentType=e.contentType,this.isHttpError=e.status>=400}var n=t(C),o=t(G);r.prototype.header=n.prototype.header,r.fromRequest=function(e){return new r(o(e))},e.exports=r}),K=t(J),N=Object.freeze({default:K}),_=r(function(e){function r(e,t){var r=new Error(e);r.name="RequestError",this.name=r.name,this.message=r.message,r.stack&&(this.stack=r.stack),this.toString=function(){return this.message};for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n])}var n=t(N),o=t(G),s=t(B);r.prototype=s(Error.prototype),r.prototype.constructor=r,r.create=function(e,t,s){var a=new r(e,s);return n.call(a,o(t)),a},e.exports=r}),$=t(_),F=Object.freeze({default:$}),Q=r(function(e){e.exports=function(e){var t,r=!1;return function(){return r||(r=!0,t=e.apply(this,arguments)),t}}}),V=t(Q),W=Object.freeze({default:V}),Y=r(function(e){function r(e,t){function s(r,s){var i,h,d,y,b,m;for(r=new f(p(e,r)),o=0;o<t.length;o++)h=t[o],h.processRequest&&h.processRequest(r);for(o=0;o<t.length;o++)if(h=t[o],h.createXHR){i=h.createXHR(r);break}i=i||new a,r.xhr=i,d=l(u(function(e){clearTimeout(b),i.onload=i.onerror=i.onabort=i.onreadystatechange=i.ontimeout=i.onprogress=null;var a=n(r,e),u=a||c.fromRequest(r);for(o=0;o<t.length;o++)h=t[o],h.processResponse&&h.processResponse(u);a&&r.onerror&&r.onerror(a),!a&&r.onload&&r.onload(u),s&&s(a,a?void 0:u)})),m="onload"in i&&"onerror"in i,i.onload=function(){d()},i.onerror=d,i.onabort=function(){d()},i.onreadystatechange=function(){if(4===i.readyState){if(r.aborted)return d();if(!m){var e;try{e=i.status}catch(e){}var t=0===e?new Error("Internal XHR Error"):null;return d(t)}}},i.ontimeout=function(){},i.onprogress=function(){},i.open(r.method,r.url),r.timeout&&(b=setTimeout(function(){r.timedOut=!0,d();try{i.abort()}catch(e){}},r.timeout));for(y in r.headers)r.headers.hasOwnProperty(y)&&i.setRequestHeader(y,r.headers[y]);return i.send(r.body),r}e=e||{},t=t||[];var h,d=["get","post","put","head","patch","delete"],y=function(e){return function(t,r){return t=new f(t),t.method=e,s(t,r)}};for(o=0;o<d.length;o++)h=d[o],s[h]=y(h);return s.plugins=function(){return t},s.defaults=function(n){return n?r(p(e,n),t):e},s.use=function(){var n=Array.prototype.slice.call(arguments,0);return r(e,t.concat(n))},s.bare=function(){return r()},s.Request=f,s.Response=c,s.RequestError=i,s}function n(e,t){if(e.aborted)return h("Request aborted",e,{name:"Abort"});if(e.timedOut)return h("Request timeout",e,{name:"Timeout"});var r,n=e.xhr,o=Math.floor(n.status/100);switch(o){case 0:case 2:if(!t)return;return h(t.message,e);case 4:if(404===n.status&&!e.errorOn404)return;r="Client";break;case 5:r="Server";break;default:r="HTTP"}var s=r+" Error: The server returned a status of "+n.status+' for the request "'+e.method.toUpperCase()+" "+e.url+'"';return h(s,e)}var o,s=t(w),a=t(A),u=t(U),i=t(F),c=t(N),f=t(C),p=t(B),l=t(W),h=i.create;e.exports=r({},[s])}),Z=t(Y),ee=Z.use(q),te={baseUrl:"https://stratumn.rocks",applicationUrl:"https://%s.stratumn.rocks"};e.getApplication=p,e.loadLink=l,e.config=te,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.StratumnSDK=e.StratumnSDK||{})}(this,function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function r(e,t){return t={exports:{}},e(t,t.exports),t.exports}function n(e,t,r){return new Promise(function(n,o){te({method:e,url:t,body:r},function(e,t){var r=e||t.body&&t.body.meta&&t.body.meta.errorMessage;r?o(r):n(t)})})}function o(e){return n("GET",e)}function s(e,t){return n("POST",e,t)}function a(e,t){return Object.keys(e.agentInfo.functions).filter(function(e){return["init","catchAll"].indexOf(e)<0}).forEach(function(r){t[r]=function(){for(var n=arguments.length,o=Array(n),u=0;u<n;u++)o[u]=arguments[u];var i=re.applicationUrl.replace("%s",e.name)+"/links/"+t.meta.linkHash+"/"+r;return s(i,o).then(function(t){return a(e,t.body)})}}),t.getPrev=function(){return t.link.meta.prevLinkHash?e.getLink(t.link.meta.prevLinkHash):Promise.resolve(null)},t.getBranches=function(r){return e.getBranches(t.meta.linkHash,r)},t.load=function(){return e.getLink(t.meta.linkHash)},t}function u(e){for(var t=re.applicationUrl.replace("%s",e.name)+"/maps",r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return s(t,n).then(function(t){return a(e,t.body)})}function i(e,t){var r=re.applicationUrl.replace("%s",e.name)+"/links/"+t;return o(r).then(function(t){return a(e,t.body)})}function c(e,t){var r=arguments.length<=2||void 0===arguments[2]?[]:arguments[2],n="";r&&r.length&&(n="?tags="+r.join("&tags="));var s=re.applicationUrl.replace("%s",e.name)+"/maps/"+t+n;return o(s).then(function(t){return t.body.map(function(t){return a(e,t)})})}function f(e){return o(e.url+"/maps").then(function(e){return e.body})}function p(e,t){var r=arguments.length<=2||void 0===arguments[2]?[]:arguments[2],n="";r&&r.length&&(n="?tags="+r.join("&tags="));var s=re.applicationUrl.replace("%s",e.name)+"/branches/"+t+n;return o(s).then(function(t){return t.body.map(function(t){return a(e,t)})})}function l(e,t){var r=t||re.applicationUrl.replace("%s",e);return o(r).then(function(e){var t=e.body;return t.url=r,t.createMap=u.bind(null,t),t.getLink=i.bind(null,t),t.getMap=c.bind(null,t),t.getBranches=p.bind(null,t),t.getMapIds=f.bind(null,t),t})}function h(e){return l(e.meta.application,e.meta.applicationLocation).then(function(t){var r=e.meta.linkLocation;return o(r).then(function(e){return a(t,e.body)})})}var d=r(function(e){e.exports={processRequest:function(e){var t=e.header("Content-Type"),r=t&&t.indexOf("application/json")!==-1;(null==t||r)&&e.body&&(t||e.header("Content-Type","application/json"),e.body=JSON.stringify(e.body))}}}),y=t(d),b=d.processRequest,m=Object.freeze({default:y,processRequest:b}),v=r(function(e){e.exports={processRequest:function(e){var t=e.header("Accept");null==t&&e.header("Accept","application/json")},processResponse:function(e){if(e.contentType&&/^.*\/(?:.*\+)?json(;|$)/i.test(e.contentType)){var t="string"==typeof e.body?e.body:e.text;t&&(e.body=JSON.parse(t))}}}}),g=t(v),R=v.processRequest,x=v.processResponse,O=Object.freeze({default:g,processRequest:R,processResponse:x}),q=r(function(e){var r=t(m),n=t(O);e.exports={processRequest:function(e){r.processRequest.call(this,e),n.processRequest.call(this,e)},processResponse:function(e){n.processResponse.call(this,e)}}}),k=t(q),j=r(function(e){e.exports={processRequest:function(e){e.url=e.url.replace(/[^%]+/g,function(e){return encodeURI(e)})}}}),T=t(j),w=j.processRequest,H=Object.freeze({default:T,processRequest:w}),z=r(function(e){e.exports=window.XMLHttpRequest}),A=t(z),E=Object.freeze({default:A}),L=r(function(e){e.exports=function(e){return function(){var t=Array.prototype.slice.call(arguments,0),r=function(){return e.apply(null,t)};setTimeout(r,0)}}}),U=t(L),P=Object.freeze({default:U}),S=r(function(e){function t(e){var t="string"==typeof e?{url:e}:e||{};this.method=t.method?t.method.toUpperCase():"GET",this.url=t.url,this.headers=t.headers||{},this.body=t.body,this.timeout=t.timeout||0,this.errorOn404=null==t.errorOn404||t.errorOn404,this.onload=t.onload,this.onerror=t.onerror}t.prototype.abort=function(){if(!this.aborted)return this.aborted=!0,this.xhr.abort(),this},t.prototype.header=function(e,t){var r;for(r in this.headers)if(this.headers.hasOwnProperty(r)&&e.toLowerCase()===r.toLowerCase()){if(1===arguments.length)return this.headers[r];delete this.headers[r];break}if(null!=t)return this.headers[e]=t,t},e.exports=t}),C=t(S),M=Object.freeze({default:C}),I=r(function(e){function t(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}return e}e.exports=t}),X=t(I),B=Object.freeze({default:X}),D=r(function(e){var r=t(B);e.exports=function(e){var t=e.xhr,n={request:e,xhr:t};try{var o,s,a,u={};if(t.getAllResponseHeaders)for(o=t.getAllResponseHeaders().split("\n"),s=0;s<o.length;s++)(a=o[s].match(/\s*([^\s]+):\s+([^\s]+)/))&&(u[a[1]]=a[2]);n=r(n,{status:t.status,contentType:t.contentType||t.getResponseHeader&&t.getResponseHeader("Content-Type"),headers:u,text:t.responseText,body:t.response||t.responseText})}catch(e){}return n}}),G=t(D),J=Object.freeze({default:G}),K=r(function(e){function r(e){this.request=e.request,this.xhr=e.xhr,this.headers=e.headers||{},this.status=e.status||0,this.text=e.text,this.body=e.body,this.contentType=e.contentType,this.isHttpError=e.status>=400}var n=t(M),o=t(J);r.prototype.header=n.prototype.header,r.fromRequest=function(e){return new r(o(e))},e.exports=r}),N=t(K),_=Object.freeze({default:N}),$=r(function(e){function r(e,t){var r=new Error(e);r.name="RequestError",this.name=r.name,this.message=r.message,r.stack&&(this.stack=r.stack),this.toString=function(){return this.message};for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n])}var n=t(_),o=t(J),s=t(B);r.prototype=s(Error.prototype),r.prototype.constructor=r,r.create=function(e,t,s){var a=new r(e,s);return n.call(a,o(t)),a},e.exports=r}),F=t($),Q=Object.freeze({default:F}),V=r(function(e){e.exports=function(e){var t,r=!1;return function(){return r||(r=!0,t=e.apply(this,arguments)),t}}}),W=t(V),Y=Object.freeze({default:W}),Z=r(function(e){function r(e,t){function s(r,s){var i,h,d,y,b,m;for(r=new f(p(e,r)),o=0;o<t.length;o++)h=t[o],h.processRequest&&h.processRequest(r);for(o=0;o<t.length;o++)if(h=t[o],h.createXHR){i=h.createXHR(r);break}i=i||new a,r.xhr=i,d=l(u(function(e){clearTimeout(b),i.onload=i.onerror=i.onabort=i.onreadystatechange=i.ontimeout=i.onprogress=null;var a=n(r,e),u=a||c.fromRequest(r);for(o=0;o<t.length;o++)h=t[o],h.processResponse&&h.processResponse(u);a&&r.onerror&&r.onerror(a),!a&&r.onload&&r.onload(u),s&&s(a,a?void 0:u)})),m="onload"in i&&"onerror"in i,i.onload=function(){d()},i.onerror=d,i.onabort=function(){d()},i.onreadystatechange=function(){if(4===i.readyState){if(r.aborted)return d();if(!m){var e;try{e=i.status}catch(e){}var t=0===e?new Error("Internal XHR Error"):null;return d(t)}}},i.ontimeout=function(){},i.onprogress=function(){},i.open(r.method,r.url),r.timeout&&(b=setTimeout(function(){r.timedOut=!0,d();try{i.abort()}catch(e){}},r.timeout));for(y in r.headers)r.headers.hasOwnProperty(y)&&i.setRequestHeader(y,r.headers[y]);return i.send(r.body),r}e=e||{},t=t||[];var h,d=["get","post","put","head","patch","delete"],y=function(e){return function(t,r){return t=new f(t),t.method=e,s(t,r)}};for(o=0;o<d.length;o++)h=d[o],s[h]=y(h);return s.plugins=function(){return t},s.defaults=function(n){return n?r(p(e,n),t):e},s.use=function(){var n=Array.prototype.slice.call(arguments,0);return r(e,t.concat(n))},s.bare=function(){return r()},s.Request=f,s.Response=c,s.RequestError=i,s}function n(e,t){if(e.aborted)return h("Request aborted",e,{name:"Abort"});if(e.timedOut)return h("Request timeout",e,{name:"Timeout"});var r,n=e.xhr,o=Math.floor(n.status/100);switch(o){case 0:case 2:if(!t)return;return h(t.message,e);case 4:if(404===n.status&&!e.errorOn404)return;r="Client";break;case 5:r="Server";break;default:r="HTTP"}var s=r+" Error: The server returned a status of "+n.status+' for the request "'+e.method.toUpperCase()+" "+e.url+'"';return h(s,e)}var o,s=t(H),a=t(E),u=t(P),i=t(Q),c=t(_),f=t(M),p=t(B),l=t(Y),h=i.create;e.exports=r({},[s])}),ee=t(Z),te=ee.use(k),re={baseUrl:"https://stratumn.rocks",applicationUrl:"https://%s.stratumn.rocks"};e.getApplication=l,e.loadLink=h,e.config=re,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=stratumn-sdk.min.js.map

@@ -120,2 +120,8 @@ (function (global, factory) {

function getMapIds(agent) {
return get(agent.url + '/maps').then(function (res) {
return res.body;
});
}
function getBranches(app, linkHash) {

@@ -150,2 +156,3 @@ var tags = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];

app.getBranches = getBranches.bind(null, app);
app.getMapIds = getMapIds.bind(null, app);

@@ -152,0 +159,0 @@ return app;

{
"name": "stratumn-sdk",
"version": "0.6.0",
"version": "0.7.0",
"description": "Stratumn SDK for Javascript",

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

@@ -143,2 +143,20 @@ # Stratumn SDK for Javascript

### Application#getMapIds()
Returns a promise that resolves with all the map ids in this application.
```javascript
StratumnSDK
.getApplication('quickstart')
.then(function(app) {
return app.getMapIds();
})
.then(function(res) {
console.log(res);
})
.catch(function(err) {
// Handle errors
});
```
### Link#getPrev()

@@ -145,0 +163,0 @@

@@ -6,2 +6,3 @@ import { get } from './request';

import getMap from './getMap';
import getMapIds from './getMapIds';
import getBranches from './getBranches';

@@ -21,2 +22,3 @@

app.getBranches = getBranches.bind(null, app);
app.getMapIds = getMapIds.bind(null, app);

@@ -23,0 +25,0 @@ return app;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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