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
1
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 1.0.14 to 1.0.15

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),_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);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.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)}return _createClass(a,[{key:"login",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d,e,f,g,h,i,j;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=this.config.domain,e=this.config,f=e.session_store,g=e.token,h=e.cert,i=_jsonwebtoken2.default.sign({iss:g,sub:d},h,{algorithm:"ES512",expiresIn:"1h"}),a.prev=3,a.next=6,this.post("auth/v1/login",{username:b,password:c,signature:i});case 6:j=a.sent,f.set("sessionId",j.sessionId,60),a.next=13;break;case 10:throw a.prev=10,a.t0=a["catch"](3),Error(a.t0);case 13:case"end":return a.stop();}},a,this,[[3,10]])}));return function(){return a.apply(this,arguments)}}()},{key:"logout",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return b=this.config.session_store,a.prev=1,a.next=4,this.get("auth/v1/logout");case 4:a.next=9;break;case 6:throw a.prev=6,a.t0=a["catch"](1),Error(a.t0);case 9:return a.prev=9,b.set("sessionId",null,0),a.finish(9);case 12:case"end":return a.stop();}},a,this,[[1,6,9,12]])}));return function(){return a.apply(this,arguments)}}()},{key:"headers",value:function(){var a=this.config.domain;if(!this.hasSession())return console.log("No session"),{Referer:a};console.log("Has session");var b=this.config,c=b.session_store,d=b.cert,e=c.get("sessionId"),f=_jsonwebtoken2.default.sign({sub:e},d,{algorithm:"ES512",expiresIn:"5s"});return{Referer:a,Authorization:"Session "+Buffer.from(f).toString("base64")}}},{key:"hasSession",value:function(){return this.config.session_store.has("sessionId")}},{key:"post",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.next=4,_axios2.default.post(d,c,{headers:e});case 4:return f=a.sent,a.abrupt("return",f.data);case 6:case"end":return a.stop();}},a,this)}));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.next=4,_axios2.default.get(d,{params:c,headers:e});case 4:return f=a.sent,a.abrupt("return",f.data);case 6:case"end":return a.stop();}},a,this)}));return function(){return a.apply(this,arguments)}}()}]),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),_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);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.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)}return _createClass(a,[{key:"login",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){var d,e,f,g,h,i,j;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=this.config.domain,e=this.config,f=e.session_store,g=e.token,h=e.cert,i=_jsonwebtoken2.default.sign({iss:g,sub:d},h,{algorithm:"ES512",expiresIn:"1h"}),a.prev=3,a.next=6,this.post("auth/v1/login",{username:b,password:c,signature:i});case 6:j=a.sent,f.set("sessionId",j.sessionId,60),a.next=13;break;case 10:throw a.prev=10,a.t0=a["catch"](3),Error(a.t0);case 13:case"end":return a.stop();}},a,this,[[3,10]])}));return function(){return a.apply(this,arguments)}}()},{key:"logout",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return b=this.config.session_store,a.prev=1,a.next=4,this.get("auth/v1/logout");case 4:a.next=9;break;case 6:throw a.prev=6,a.t0=a["catch"](1),Error(a.t0);case 9:return a.prev=9,b.set("sessionId",null,0),a.finish(9);case 12:case"end":return a.stop();}},a,this,[[1,6,9,12]])}));return function(){return a.apply(this,arguments)}}()},{key:"headers",value:function(){var a=this.config.domain;if(!this.hasSession())return{Referer:a};var b=this.config,c=b.session_store,d=b.cert,e=c.get("sessionId"),f=_jsonwebtoken2.default.sign({sub:e},d,{algorithm:"ES512",expiresIn:"5s"});return{Referer:a,Authorization:"Session "+Buffer.from(f).toString("base64")}}},{key:"hasSession",value:function(){return this.config.session_store.has("sessionId")}},{key:"post",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.next=4,_axios2.default.post(d,c,{headers:e});case 4:return f=a.sent,a.abrupt("return",f.data);case 6:case"end":return a.stop();}},a,this)}));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.next=4,_axios2.default.get(d,{params:c,headers:e});case 4:return f=a.sent,a.abrupt("return",f.data);case 6:case"end":return a.stop();}},a,this)}));return function(){return a.apply(this,arguments)}}()}]),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}}(),_SessionStore2=require("./SessionStore"),_SessionStore3=_interopRequireDefault(_SessionStore2);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 LocalStorage=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,null,[{key:"client",value:function(){try{if("undefined"==typeof localStorage||null===localStorage)return new(require("node-localstorage").LocalStorage)("./session")}catch(a){return localStorage}return localStorage}},{key:"get",value:function(a){if(!b.has(a))return null;var c=b.client().getItem(a);return JSON.parse(c).value}},{key:"set",value:function(a,c,d){var e=+new Date;return b.client().setItem(a,JSON.stringify({value:c,expiration:e+1e3*(60*d)}))}},{key:"has",value:function(a){var c=b.client().getItem(a);if(null===c||void 0===c)return!1;if(c=JSON.parse(c),!c.hasOwnProperty("expiration")||!c.hasOwnProperty("value"))return!1;var d=+new Date;return c.expiration>d}}]),b}(_SessionStore3.default);exports.default=LocalStorage;
"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}}(),_SessionStore2=require("./SessionStore"),_SessionStore3=_interopRequireDefault(_SessionStore2);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 LocalStorage=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,null,[{key:"client",value:function(){return"undefined"==typeof localStorage||null===localStorage?new(require("node-localstorage").LocalStorage)("./session"):localStorage}},{key:"get",value:function(a){if(!b.has(a))return null;var c=b.client().getItem(a);return JSON.parse(c).value}},{key:"set",value:function(a,c,d){var e=+new Date;return b.client().setItem(a,JSON.stringify({value:c,expiration:e+1e3*(60*d)}))}},{key:"has",value:function(a){var c=b.client().getItem(a);if(null===c||void 0===c)return!1;if(c=JSON.parse(c),!c.hasOwnProperty("expiration")||!c.hasOwnProperty("value"))return!1;var d=+new Date;return c.expiration>d}}]),b}(_SessionStore3.default);exports.default=LocalStorage;
{
"name": "@orbis-systems/orbis-api-client",
"version": "1.0.14",
"version": "1.0.15",
"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