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

@orbis-systems/orbis-api-client

Package Overview
Dependencies
Maintainers
3
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orbis-systems/orbis-api-client - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

.vscode/launch.json

2

dist/lib/APIClient.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_Quotes=require("./categories/Quotes"),_Quotes2=_interopRequireDefault(_Quotes),_Research=require("./categories/Research"),_Research2=_interopRequireDefault(_Research),_User=require("./categories/User"),_User2=_interopRequireDefault(_User),_Options=require("./categories/Options"),_Options2=_interopRequireDefault(_Options),_Advisory=require("./categories/Advisory"),_Advisory2=_interopRequireDefault(_Advisory),_Relationships=require("./categories/Relationships"),_Relationships2=_interopRequireDefault(_Relationships),_Watchlists=require("./categories/Watchlists"),_Watchlists2=_interopRequireDefault(_Watchlists),_ETFs=require("./categories/ETFs"),_ETFs2=_interopRequireDefault(_ETFs),_News=require("./categories/News"),_News2=_interopRequireDefault(_News),_CorporateActions=require("./categories/CorporateActions"),_CorporateActions2=_interopRequireDefault(_CorporateActions),_LocalStorage=require("./session_stores/LocalStorage"),_LocalStorage2=_interopRequireDefault(_LocalStorage),_axios=require("axios"),_axios2=_interopRequireDefault(_axios),_jsonwebtoken=require("jsonwebtoken"),_jsonwebtoken2=_interopRequireDefault(_jsonwebtoken),_base=require("base-64"),_base2=_interopRequireDefault(_base),_Acats=require("./categories/Acats"),_Acats2=_interopRequireDefault(_Acats),_ACHs=require("./categories/ACHs"),_ACHs2=_interopRequireDefault(_ACHs),_Checks=require("./categories/Checks"),_Checks2=_interopRequireDefault(_Checks),_Documents=require("./categories/Documents"),_Documents2=_interopRequireDefault(_Documents),_TipRanks=require("./categories/TipRanks"),_TipRanks2=_interopRequireDefault(_TipRanks),_Wires=require("./categories/Wires"),_Wires2=_interopRequireDefault(_Wires),_Streaming=require("./categories/Streaming"),_Streaming2=_interopRequireDefault(_Streaming),_WSWrapper=require("./WSWrapper"),_WSWrapper2=_interopRequireDefault(_WSWrapper),_Orders=require("./categories/Orders"),_Orders2=_interopRequireDefault(_Orders),_Transfers=require("./categories/Transfers"),_Transfers2=_interopRequireDefault(_Transfers);function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _asyncToGenerator(a){return function(){var b=a.apply(this,arguments);return new Promise(function(a,c){function d(e,f){try{var g=b[e](f),h=g.value}catch(a){return void c(a)}return g.done?void a(h):Promise.resolve(h).then(function(a){d("next",a)},function(a){d("throw",a)})}return d("next")})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}require("babel-core/register"),require("babel-polyfill");var APIClient=function(){function a(b){_classCallCheck(this,a),this.config=b,this.config.session_store||(this.config.session_store=_LocalStorage2.default),this.quotes=new _Quotes2.default(this),this.research=new _Research2.default(this),this.user=new _User2.default(this),this.orders=new _Orders2.default(this),this.options=new _Options2.default(this),this.advisory=new _Advisory2.default(this),this.watchlists=new _Watchlists2.default(this),this.etfs=new _ETFs2.default(this),this.news=new _News2.default(this),this.corporate_actions=new _CorporateActions2.default(this),this.relationships=new _Relationships2.default(this),this.ACATs=new _Acats2.default(this),this.ACHs=new _ACHs2.default(this),this.checks=new _Checks2.default(this),this.documents=new _Documents2.default(this),this.tip_ranks=new _TipRanks2.default(this),this.transfers=new _Transfers2.default(this),this.wires=new _Wires2.default(this),this.streaming=new _Streaming2.default(this)}return _createClass(a,[{key:"login",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.post("auth/v1/login",{username:b,password:c});case 3:if(d=a.sent,!d.success){a.next=8;break}return a.next=7,this.config.session_store.set("sessionId",d.data.sessionId,60);case 7:return a.abrupt("return",!0);case 8:return a.abrupt("return",!1);case 11:return a.prev=11,a.t0=a["catch"](0),a.abrupt("return",!1);case 14:case"end":return a.stop();}},a,this,[[0,11]])}));return function(){return a.apply(this,arguments)}}()},{key:"logout",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.get("auth/v1/logout");case 3:return this.expireSession(),a.abrupt("return",!0);case 7:return a.prev=7,a.t0=a["catch"](0),a.abrupt("return",!1);case 10:case"end":return a.stop();}},a,this,[[0,7]])}));return function(){return a.apply(this,arguments)}}()},{key:"headers",value:function(){return this.hasSession()?{Authorization:"Session "+this.token()}:{}}},{key:"token",value:function(){var a=this.config.session_store,b=a.get("sessionId"),c=_jsonwebtoken2.default.sign({sub:b},"test",{expiresIn:"5s"});return _base2.default.encode(c)}},{key:"hasSession",value:function(){return this.config.session_store.has("sessionId")}},{key:"expireSession",value:function(){var a=this.config.session_store;a.set("sessionId",null,0)}},{key:"handleResponse",value:function(a){var b={status:a&&a.status||-1,message:a&&a.statusText||"",data:a&&a.data||null,success:a&&200<=a.status&&300>a.status||!1};return b.success||console.log(b),b}},{key:"post",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d,e,f,g;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d="auth/v1/login"===b?this.config.auth_url:this.config.base_url,e=d+b,f=this.headers(),a.prev=3,a.next=6,_axios2.default.post(e,c,{headers:f});case 6:return g=a.sent,a.abrupt("return",this.handleResponse(g));case 10:return a.prev=10,a.t0=a["catch"](3),a.abrupt("return",this.handleResponse(a.t0.response));case 13:case"end":return a.stop();}},a,this,[[3,10]])}));return function(){return a.apply(this,arguments)}}()},{key:"get",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d,e,f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=this.config.base_url+b,e=this.headers(),a.prev=2,a.next=5,_axios2.default.get(d,{params:c,headers:e});case 5:return f=a.sent,a.abrupt("return",this.handleResponse(f));case 9:return a.prev=9,a.t0=a["catch"](2),a.abrupt("return",this.handleResponse(a.t0.response));case 12:case"end":return a.stop();}},a,this,[[2,9]])}));return function(){return a.apply(this,arguments)}}()},{key:"delete",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d,e,f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=this.config.base_url+b,e=this.headers(),a.prev=2,a.next=5,_axios2.default.delete(d,{params:c,headers:e});case 5:return f=a.sent,a.abrupt("return",this.handleResponse(f));case 9:return a.prev=9,a.t0=a["catch"](2),a.abrupt("return",this.handleResponse(a.t0.response));case 12:case"end":return a.stop();}},a,this,[[2,9]])}));return function(){return a.apply(this,arguments)}}()},{key:"websocket",value:function(a,b){var c=this,d=b.timeout,e=b.maxAttempts,f=b.onOpen,g=b.onMessage,h=b.onReconnect,i=b.onMaximum,j=b.onClose,k=b.onError,l=function(){return c.config.streaming_url+a+"?auth="+escape("Session "+c.token())},m=new _WSWrapper2.default(l(),{maxAttempts:e,timeout:d||5e3,onopen:f,onmessage:g,onmaximum:i,onerror:k,onclose:j,onreconnect:function(a){m.updateUrl(l()),h&&h(a)}});return m}}]),a}();exports.default=APIClient;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_Quotes=require("./categories/Quotes"),_Quotes2=_interopRequireDefault(_Quotes),_Research=require("./categories/Research"),_Research2=_interopRequireDefault(_Research),_User=require("./categories/User"),_User2=_interopRequireDefault(_User),_Options=require("./categories/Options"),_Options2=_interopRequireDefault(_Options),_Advisory=require("./categories/Advisory"),_Advisory2=_interopRequireDefault(_Advisory),_Relationships=require("./categories/Relationships"),_Relationships2=_interopRequireDefault(_Relationships),_Watchlists=require("./categories/Watchlists"),_Watchlists2=_interopRequireDefault(_Watchlists),_ETFs=require("./categories/ETFs"),_ETFs2=_interopRequireDefault(_ETFs),_News=require("./categories/News"),_News2=_interopRequireDefault(_News),_CorporateActions=require("./categories/CorporateActions"),_CorporateActions2=_interopRequireDefault(_CorporateActions),_LocalStorage=require("./session_stores/LocalStorage"),_LocalStorage2=_interopRequireDefault(_LocalStorage),_axios=require("axios"),_axios2=_interopRequireDefault(_axios),_jsonwebtoken=require("jsonwebtoken"),_jsonwebtoken2=_interopRequireDefault(_jsonwebtoken),_base=require("base-64"),_base2=_interopRequireDefault(_base),_Acats=require("./categories/Acats"),_Acats2=_interopRequireDefault(_Acats),_ACHs=require("./categories/ACHs"),_ACHs2=_interopRequireDefault(_ACHs),_Checks=require("./categories/Checks"),_Checks2=_interopRequireDefault(_Checks),_Documents=require("./categories/Documents"),_Documents2=_interopRequireDefault(_Documents),_TipRanks=require("./categories/TipRanks"),_TipRanks2=_interopRequireDefault(_TipRanks),_Wires=require("./categories/Wires"),_Wires2=_interopRequireDefault(_Wires),_Streaming=require("./categories/Streaming"),_Streaming2=_interopRequireDefault(_Streaming),_WSWrapper=require("./WSWrapper"),_WSWrapper2=_interopRequireDefault(_WSWrapper),_Orders=require("./categories/Orders"),_Orders2=_interopRequireDefault(_Orders),_Transfers=require("./categories/Transfers"),_Transfers2=_interopRequireDefault(_Transfers);function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _asyncToGenerator(a){return function(){var b=a.apply(this,arguments);return new Promise(function(a,c){function d(e,f){try{var g=b[e](f),h=g.value}catch(a){return void c(a)}return g.done?void a(h):Promise.resolve(h).then(function(a){d("next",a)},function(a){d("throw",a)})}return d("next")})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var APIClient=function(){function a(b){_classCallCheck(this,a),this.config=b,this.config.session_store||(this.config.session_store=_LocalStorage2.default),this.quotes=new _Quotes2.default(this),this.research=new _Research2.default(this),this.user=new _User2.default(this),this.orders=new _Orders2.default(this),this.options=new _Options2.default(this),this.advisory=new _Advisory2.default(this),this.watchlists=new _Watchlists2.default(this),this.etfs=new _ETFs2.default(this),this.news=new _News2.default(this),this.corporate_actions=new _CorporateActions2.default(this),this.relationships=new _Relationships2.default(this),this.ACATs=new _Acats2.default(this),this.ACHs=new _ACHs2.default(this),this.checks=new _Checks2.default(this),this.documents=new _Documents2.default(this),this.tip_ranks=new _TipRanks2.default(this),this.transfers=new _Transfers2.default(this),this.wires=new _Wires2.default(this),this.streaming=new _Streaming2.default(this)}return _createClass(a,[{key:"login",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.post("auth/v1/login",{username:b,password:c});case 3:if(d=a.sent,!d.success){a.next=8;break}return a.next=7,this.config.session_store.set("sessionId",d.data.sessionId,60);case 7:return a.abrupt("return",!0);case 8:return a.abrupt("return",!1);case 11:return a.prev=11,a.t0=a["catch"](0),a.abrupt("return",!1);case 14:case"end":return a.stop();}},a,this,[[0,11]])}));return function(){return a.apply(this,arguments)}}()},{key:"logout",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.get("auth/v1/logout");case 3:return this.expireSession(),a.abrupt("return",!0);case 7:return a.prev=7,a.t0=a["catch"](0),a.abrupt("return",!1);case 10:case"end":return a.stop();}},a,this,[[0,7]])}));return function(){return a.apply(this,arguments)}}()},{key:"headers",value:function(){return this.hasSession()?{Authorization:"Session "+this.token()}:{}}},{key:"token",value:function(){var a=this.config.session_store,b=a.get("sessionId"),c=_jsonwebtoken2.default.sign({sub:b},"test",{expiresIn:"5s"});return _base2.default.encode(c)}},{key:"hasSession",value:function(){return this.config.session_store.has("sessionId")}},{key:"expireSession",value:function(){var a=this.config.session_store;a.set("sessionId",null,0)}},{key:"handleResponse",value:function(a){var b={status:a&&a.status||-1,message:a&&a.statusText||"",data:a&&a.data||null,success:a&&200<=a.status&&300>a.status||!1};return b.success||console.log(b),b}},{key:"post",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d,e,f,g;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d="auth/v1/login"===b?this.config.auth_url:this.config.base_url,e=d+b,f=this.headers(),a.prev=3,a.next=6,_axios2.default.post(e,c,{headers:f});case 6:return g=a.sent,a.abrupt("return",this.handleResponse(g));case 10:return a.prev=10,a.t0=a["catch"](3),a.abrupt("return",this.handleResponse(a.t0.response));case 13:case"end":return a.stop();}},a,this,[[3,10]])}));return function(){return a.apply(this,arguments)}}()},{key:"get",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d,e,f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=this.config.base_url+b,e=this.headers(),a.prev=2,a.next=5,_axios2.default.get(d,{params:c,headers:e});case 5:return f=a.sent,a.abrupt("return",this.handleResponse(f));case 9:return a.prev=9,a.t0=a["catch"](2),a.abrupt("return",this.handleResponse(a.t0.response));case 12:case"end":return a.stop();}},a,this,[[2,9]])}));return function(){return a.apply(this,arguments)}}()},{key:"delete",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d,e,f;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=this.config.base_url+b,e=this.headers(),a.prev=2,a.next=5,_axios2.default.delete(d,{params:c,headers:e});case 5:return f=a.sent,a.abrupt("return",this.handleResponse(f));case 9:return a.prev=9,a.t0=a["catch"](2),a.abrupt("return",this.handleResponse(a.t0.response));case 12:case"end":return a.stop();}},a,this,[[2,9]])}));return function(){return a.apply(this,arguments)}}()},{key:"websocket",value:function(a,b){var c=this,d=b.timeout,e=b.maxAttempts,f=b.onOpen,g=b.onMessage,h=b.onReconnect,i=b.onMaximum,j=b.onClose,k=b.onError,l=function(){return c.config.streaming_url+a+"?auth="+escape("Session "+c.token())},m=new _WSWrapper2.default(l(),{maxAttempts:e,timeout:d||5e3,onopen:f,onmessage:g,onmaximum:i,onerror:k,onclose:j,onreconnect:function(a){m.updateUrl(l()),h&&h(a)}});return m}}]),a}();exports.default=APIClient;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_APICategory2=require("./APICategory"),_APICategory3=_interopRequireDefault(_APICategory2);function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&("object"==typeof b||"function"==typeof b)?b:a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var Orders=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"today",value:function(a,b){return this.client.get("orders/today",{accountId:a,loadQuotes:b})}},{key:"executed",value:function(a,b){return this.client.get("orders/executed",{accountId:a,loadQuotes:b})}},{key:"latest",value:function(a,b){return this.client.get("orders/latest",{accountId:a,loadQuotes:b})}},{key:"open",value:function(a,b){return this.client.get("orders/open",{accountId:a,loadQuotes:b})}}]),b}(_APICategory3.default);exports.default=Orders;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_APICategory2=require("./APICategory"),_APICategory3=_interopRequireDefault(_APICategory2);function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&("object"==typeof b||"function"==typeof b)?b:a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var Orders=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"today",value:function(a,b){return this.client.get("orders/today",{accountId:a,loadQuotes:b})}},{key:"executed",value:function(a,b){return this.client.get("orders/executed",{accountId:a,loadQuotes:b})}},{key:"latest",value:function(a,b){return this.client.get("orders/latest",{accountId:a,loadQuotes:b})}},{key:"open",value:function(a,b){return this.client.get("orders/open",{accountId:a,loadQuotes:b})}},{key:"model",value:function(a,b,c){return this.client.get("orders/model/"+a+"/"+b,{loadQuotes:c})}},{key:"status",value:function(a){return this.client.get("orders/status/"+a)}}]),b}(_APICategory3.default);exports.default=Orders;
{
"name": "@orbis-systems/orbis-api-client",
"version": "2.1.4",
"version": "2.1.5",
"description": "",

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

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

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