@orbis-systems/orbis-api-client
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -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")}try{require("babel-core/register"),require("babel-polyfill")}catch(a){}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")}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; |
{ | ||
"name": "@orbis-systems/orbis-api-client", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "", | ||
@@ -27,3 +27,5 @@ "main": "dist/lib/index.js", | ||
"moment": "^2.20.1", | ||
"node-localstorage": "^1.3.0" | ||
"node-localstorage": "^1.3.0", | ||
"babel-polyfill": "^6.0.16", | ||
"babel-core": "^6.26.0" | ||
}, | ||
@@ -38,6 +40,4 @@ "devDependencies": { | ||
"browserify": "^16.1.1", | ||
"removeNPMAbsolutePaths": "^1.0.4", | ||
"babel-polyfill": "^6.0.16", | ||
"babel-core": "^6.26.0" | ||
"removeNPMAbsolutePaths": "^1.0.4" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
8
2
450594
7
+ Addedbabel-core@^6.26.0
+ Addedbabel-polyfill@^6.0.16
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedbabel-code-frame@6.26.0(transitive)
+ Addedbabel-core@6.26.3(transitive)
+ Addedbabel-generator@6.26.1(transitive)
+ Addedbabel-helpers@6.24.1(transitive)
+ Addedbabel-messages@6.23.0(transitive)
+ Addedbabel-polyfill@6.26.0(transitive)
+ Addedbabel-register@6.26.0(transitive)
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedbabel-template@6.26.0(transitive)
+ Addedbabel-traverse@6.26.0(transitive)
+ Addedbabel-types@6.26.0(transitive)
+ Addedbabylon@6.18.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconvert-source-map@1.9.0(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddetect-indent@4.0.0(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedglobals@9.18.0(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhome-or-tmp@2.0.0(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedis-finite@1.1.0(transitive)
+ Addedjs-tokens@3.0.2(transitive)
+ Addedjsesc@1.3.0(transitive)
+ Addedjson5@0.5.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.0.0(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedregenerator-runtime@0.10.50.11.1(transitive)
+ Addedrepeating@2.0.1(transitive)
+ Addedslash@1.0.0(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedsource-map-support@0.4.18(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedto-fast-properties@1.0.3(transitive)
+ Addedtrim-right@1.0.1(transitive)