@orbis-systems/orbis-api-client
Advanced tools
Comparing version 4.0.3 to 4.0.4
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _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 Advisory=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.models=c.request.bind(c,{url:"v2/advisory/models",method:"GET"}),c.model={balance:c.request.bind(c,{url:"v2/advisory/model/balance",method:"GET"}),adjustments:{base:c.request.bind(c,{url:"v2/advisory/model/adjustments",method:"GET"}),preview:c.request.bind(c,{url:"v2/advisory/model/adjustments/preview",method:"GET"}),modify:c.request.bind(c,{url:"v2/advisory/model/adjustments/modify",method:"POST"})},rtb:{base:c.request.bind(c,{url:"v2/advisory/model/rtb",method:"GET"}),history:c.request.bind(c,{url:"v2/advisory/model/rtb/history",method:"GET"})},accounts:{base:c.request.bind(c,{url:"v2/advisory/model/accounts",method:"GET"}),stats:c.request.bind(c,{url:"v2/advisory/model/accounts/stats",method:"GET"})},rtbs:c.request.bind(c,{url:"v2/advisory/model/rtbs",method:"GET"}),portfolios:c.request.bind(c,{url:"v2/advisory/model/portfolios",method:"GET"}),balances:c.request.bind(c,{url:"v2/advisory/model/balances",method:"GET"}),position:{equity:c.request.bind(c,{url:"v2/advisory/model/position/equity",method:"GET"}),option:c.request.bind(c,{url:"v2/advisory/model/position/option",method:"GET"})},create:c.request.bind(c,{url:"v2/advisory/model/create",method:"POST"}),update:c.request.bind(c,{url:"v2/advisory/model/update",method:"POST"}),delete:c.request.bind(c,{url:"v2/advisory/model/delete",method:"POST"}),component:{update:c.request.bind(c,{url:"v2/advisory/model/component/update",method:"POST"})},account:{link:c.request.bind(c,{url:"v2/advisory/model/account/link",method:"POST"}),unlink:c.request.bind(c,{url:"v2/advisory/model/account/unlink",method:"POST"})},orders:{allocate:c.request.bind(c,{url:"v2/advisory/model/orders/allocate",method:"POST"})}},c.allocations=c.request.bind(c,{url:"v2/advisory/allocations",method:"GET"}),c.clients={list:c.request.bind(c,{url:"v2/advisory/clients/list",method:"GET"}),accounts:{base:c.request.bind(c,{url:"v2/advisory/clients/accounts",method:"GET"}),stats:c.request.bind(c,{url:"v2/advisory/clients/accounts/stats",method:"GET"})},account:{notes:c.request.bind(c,{url:"v2/advisory/clients/account/notes",method:"GET"})},user:{notes:c.request.bind(c,{url:"v2/advisory/clients/user/notes",method:"GET"})}},c.analytics={overexposure:c.request.bind(c,{url:"v2/advisory/analytics/overexposure",method:"GET"}),breakdown:{rtbs:c.request.bind(c,{url:"v2/advisory/analytics/breakdown/rtbs",method:"GET"})},model:{performance:c.request.bind(c,{url:"v2/advisory/analytics/model/performance",method:"GET"})}},c.info={base:c.request.bind(c,{url:"v2/advisory/info",method:"GET"}),update:c.request.bind(c,{url:"v2/advisory/info/update",method:"POST"})},c}return _inherits(b,a),b}(_APICategory3.default);exports.default=Advisory; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _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 Advisory=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.models=c.request.bind(c,{url:"v2/advisory/models",method:"GET"}),c.model={balance:c.request.bind(c,{url:"v2/advisory/model/balance",method:"GET"}),adjustments:{base:c.request.bind(c,{url:"v2/advisory/model/adjustments",method:"GET"}),preview:c.request.bind(c,{url:"v2/advisory/model/adjustments/preview",method:"GET"}),preallocate:c.request.bind(c,{url:"v2/advisory/model/adjustments/preallocate",method:"POST"}),allocation:{trigger:c.request.bind(c,{url:"v2/advisory/model/adjustments/allocation/trigger",method:"POST"}),cancel:c.request.bind(c,{url:"v2/advisory/model/adjustments/allocation/cancel",method:"POST"})},modify:c.request.bind(c,{url:"v2/advisory/model/adjustments/modify",method:"POST"})},rtb:{base:c.request.bind(c,{url:"v2/advisory/model/rtb",method:"GET"}),history:c.request.bind(c,{url:"v2/advisory/model/rtb/history",method:"GET"})},accounts:{base:c.request.bind(c,{url:"v2/advisory/model/accounts",method:"GET"}),orphaned:c.request.bind(c,{url:"v2/advisory/model/accounts/orphaned",method:"GET"}),stats:c.request.bind(c,{url:"v2/advisory/model/accounts/stats",method:"GET"})},rtbs:c.request.bind(c,{url:"v2/advisory/model/rtbs",method:"GET"}),portfolios:c.request.bind(c,{url:"v2/advisory/model/portfolios",method:"GET"}),balances:c.request.bind(c,{url:"v2/advisory/model/balances",method:"GET"}),position:{equity:c.request.bind(c,{url:"v2/advisory/model/position/equity",method:"GET"}),option:c.request.bind(c,{url:"v2/advisory/model/position/option",method:"GET"})},create:c.request.bind(c,{url:"v2/advisory/model/create",method:"POST"}),update:c.request.bind(c,{url:"v2/advisory/model/update",method:"POST"}),delete:c.request.bind(c,{url:"v2/advisory/model/delete",method:"POST"}),component:{update:c.request.bind(c,{url:"v2/advisory/model/component/update",method:"POST"})},account:{link:c.request.bind(c,{url:"v2/advisory/model/account/link",method:"POST"}),unlink:c.request.bind(c,{url:"v2/advisory/model/account/unlink",method:"POST"})},orders:{allocate:c.request.bind(c,{url:"v2/advisory/model/orders/allocate",method:"POST"})}},c.clients={list:c.request.bind(c,{url:"v2/advisory/clients/list",method:"GET"}),accounts:{base:c.request.bind(c,{url:"v2/advisory/clients/accounts",method:"GET"}),stats:c.request.bind(c,{url:"v2/advisory/clients/accounts/stats",method:"GET"})},account:{notes:c.request.bind(c,{url:"v2/advisory/clients/account/notes",method:"GET"})},user:{notes:c.request.bind(c,{url:"v2/advisory/clients/user/notes",method:"GET"})}},c.analytics={overexposure:c.request.bind(c,{url:"v2/advisory/analytics/overexposure",method:"GET"}),breakdown:{rtbs:c.request.bind(c,{url:"v2/advisory/analytics/breakdown/rtbs",method:"GET"})},model:{performance:c.request.bind(c,{url:"v2/advisory/analytics/model/performance",method:"GET"})}},c.allocations=c.request.bind(c,{url:"v2/advisory/allocations",method:"GET"}),c.info={base:c.request.bind(c,{url:"v2/advisory/info",method:"GET"}),update:c.request.bind(c,{url:"v2/advisory/info/update",method:"POST"})},c}return _inherits(b,a),b}(_APICategory3.default);exports.default=Advisory; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _APICategory2=require("../APICategory"),_APICategory3=_interopRequireDefault(_APICategory2);function _interopRequireDefault(b){return b&&b.__esModule?b:{default:b}}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 Ipo=function(b){function a(c){_classCallCheck(this,a);var d=_possibleConstructorReturn(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,c));return d.ipo=d.request.bind(d,{url:"esearch/ipo",method:"GET"}),d}return _inherits(a,b),a}(_APICategory3.default);exports.default=Ipo; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _APICategory2=require("../APICategory"),_APICategory3=_interopRequireDefault(_APICategory2);function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _classCallCheck(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(c,a){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a&&("object"==typeof a||"function"==typeof a)?a:c}function _inherits(c,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),a&&(Object.setPrototypeOf?Object.setPrototypeOf(c,a):c.__proto__=a)}var Ipo=function(c){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.ipo=c.request.bind(c,{url:"esearch/ipo",method:"GET"}),c}return _inherits(b,c),b}(_APICategory3.default);exports.default=Ipo; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _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(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.today=c.request.bind(c,{url:"orders/today",method:"GET"}),c.executed=c.request.bind(c,{url:"orders/executed",method:"GET"}),c.latest=c.request.bind(c,{url:"orders/latest",method:"GET"}),c.open=c.request.bind(c,{url:"orders/open",method:"GET"}),c.model=c.request.bind(c,{url:"orders/model",method:"GET"}),c.preview={equity:c.request.bind(c,{url:"orders/preview/equity",method:"POST"}),option:c.request.bind(c,{url:"orders/preview/option",method:"POST"})},c.v2={place:{equity:c.request.bind(c,{url:"orders/v2/place/equity",method:"POST"}),options:{multileg:c.request.bind(c,{url:"orders/v2/place/options/multileg",method:"POST"})}},preview:{options:{multileg:c.request.bind(c,{url:"orders/v2/preview/options/multileg",method:"POST"})}},advisory:{equity:{place:c.request.bind(c,{url:"orders/v2/advisory/equity/place",method:"POST"})}},bond:{place:c.request.bind(c,{url:"orders/v2/bond/place",method:"POST"}),quote:{request:c.request.bind(c,{url:"orders/v2/bond/quote/request",method:"POST"}),accept:c.request.bind(c,{url:"orders/v2/bond/quote/accept",method:"POST"})}},mutualFund:{place:c.request.bind(c,{url:"orders/v2/mutualFund/place",method:"POST"})}},c.place={equity:c.request.bind(c,{url:"orders/place/equity",method:"POST"}),option:c.request.bind(c,{url:"orders/place/option",method:"GET"})},c.replace=c.request.bind(c,{url:"orders/replace",method:"GET"}),c.cancel=c.request.bind(c,{url:"orders/cancel",method:"GET"}),c.status=c.request.bind(c,{url:"orders/status",method:"GET"}),c}return _inherits(b,a),b}(_APICategory3.default);exports.default=Orders; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _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(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.today=c.request.bind(c,{url:"orders/today",method:"GET"}),c.executed=c.request.bind(c,{url:"orders/executed",method:"GET"}),c.latest=c.request.bind(c,{url:"orders/latest",method:"GET"}),c.open=c.request.bind(c,{url:"orders/open",method:"GET"}),c.cost=c.request.bind(c,{url:"orders/cost",method:"GET"}),c.model=c.request.bind(c,{url:"orders/model",method:"GET"}),c.preview={equity:c.request.bind(c,{url:"orders/preview/equity",method:"POST"}),option:c.request.bind(c,{url:"orders/preview/option",method:"POST"})},c.v2={place:{equity:c.request.bind(c,{url:"orders/v2/place/equity",method:"POST"}),options:{multileg:c.request.bind(c,{url:"orders/v2/place/options/multileg",method:"POST"})}},preview:{options:{multileg:c.request.bind(c,{url:"orders/v2/preview/options/multileg",method:"POST"})}},advisory:{equity:{place:c.request.bind(c,{url:"orders/v2/advisory/equity/place",method:"POST"})}},bond:{place:c.request.bind(c,{url:"orders/v2/bond/place",method:"POST"}),quote:{request:c.request.bind(c,{url:"orders/v2/bond/quote/request",method:"POST"}),accept:c.request.bind(c,{url:"orders/v2/bond/quote/accept",method:"POST"})}},mutualFund:{place:c.request.bind(c,{url:"orders/v2/mutualFund/place",method:"POST"})}},c.place={equity:c.request.bind(c,{url:"orders/place/equity",method:"POST"}),option:c.request.bind(c,{url:"orders/place/option",method:"GET"})},c.replace=c.request.bind(c,{url:"orders/replace",method:"GET"}),c.cancel=c.request.bind(c,{url:"orders/cancel",method:"GET"}),c.status=c.request.bind(c,{url:"orders/status",method:"GET"}),c}return _inherits(b,a),b}(_APICategory3.default);exports.default=Orders; |
{ | ||
"name": "@orbis-systems/orbis-api-client", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
@@ -20,12 +20,12 @@ const parser = require('./parse'); | ||
const transform = endpoints => { | ||
return endpoints.reduce((categories, endpoint) => { | ||
if(!blacklist.includes(endpoint.url)){ | ||
const transform = endpoints => { | ||
return endpoints.reduce((categories, endpoint) => { | ||
if (!blacklist.includes(endpoint.url)) { | ||
const urlArguments = endpoint.url.split('/').filter(url => !!url); | ||
const property = urlArguments[0]; | ||
if(!categories.hasOwnProperty(property)){ | ||
if (!categories.hasOwnProperty(property)) { | ||
categories[property] = []; | ||
} | ||
categories[property].push({ | ||
@@ -36,8 +36,8 @@ ...endpoint, | ||
}); | ||
} | ||
} | ||
for (const key in categories) { | ||
categories[key] = _.uniqBy(categories[key], 'url'); | ||
} | ||
return categories; | ||
@@ -48,14 +48,2 @@ }, {}); | ||
const methodTemplate = endpoint => { | ||
if(endpoint.name === ''){ | ||
endpoint.name = 'base'; | ||
} | ||
// return ` | ||
// function() { | ||
// return this.request({ | ||
// url: '${getUrl(endpoint.url).slice(1)}', | ||
// method: '${endpoint.method}', | ||
// }, ...arguments); | ||
// }`; | ||
return ` | ||
@@ -69,6 +57,6 @@ this.request.bind(this, { | ||
const getHierarchy = category => { | ||
const getHierarchy = category => { | ||
const result = {}; | ||
category.forEach(endpoint => { | ||
category.forEach(endpoint => { | ||
let fields = result; | ||
@@ -85,3 +73,3 @@ | ||
fields[name] = temp; | ||
} | ||
} | ||
@@ -91,5 +79,5 @@ fields = fields[name]; | ||
fields[endpoint.name] = endpoint.url; | ||
fields[endpoint.name] = endpoint.url; | ||
}) | ||
return result; | ||
@@ -108,3 +96,3 @@ } | ||
const result = | ||
const result = | ||
`import APICategory from '../APICategory'; | ||
@@ -125,5 +113,5 @@ | ||
const build = async () => { | ||
const endpoints = await parser.endpoints; | ||
const endpoints = await parser.endpoints; | ||
const categories = transform(endpoints); | ||
let imports = []; | ||
@@ -137,14 +125,14 @@ let initializations = []; | ||
} | ||
Object.keys(categories).forEach(key => { | ||
const category = capitalizeFirstLetter(key); | ||
Object.keys(categories).forEach(key => { | ||
const category = capitalizeFirstLetter(key); | ||
imports.push(`import ${category} from './categories/${category}';`); | ||
initializations.push(`\t\t${key}: new ${category}(apiClient),`); | ||
const filePath = `${dirPath}/${category}.js`; | ||
const filePath = `${dirPath}/${category}.js`; | ||
fs.writeFile(filePath, beautify(renderClass(category, getHierarchy(categories[key]), categories[key])), err => err && console.log(err)); // eslint-disable-line | ||
}); | ||
const content = | ||
const content = | ||
`import APIClient from './APIClient'; | ||
@@ -151,0 +139,0 @@ ${imports.join('\n')} |
@@ -10,3 +10,3 @@ const fs = require('fs'); | ||
fs.readdir(directory, (err, files) => { | ||
if(err){ | ||
if (err) { | ||
console.log(err); | ||
@@ -16,5 +16,5 @@ return; | ||
files.forEach(file => { | ||
if(!blacklist.includes(file)){ | ||
if (!blacklist.includes(file)) { | ||
fs.unlink(`${directory}\\${file}`, err => { | ||
if(err){ | ||
if (err) { | ||
console.log(err); | ||
@@ -21,0 +21,0 @@ return; |
const fs = require('fs'); | ||
const regex = [`<div class="url">`, `</div>`, `{{url}}(/v2)?`, `/{{uri}}`, `/api`, '/{.*$', '\\?.*$', '/AAPL', '//' ]; | ||
const regex = [`<div class="url">`, `</div>`, `{{url}}(/v2)?`, `/{{uri}}`, `/api`, '/{.*$', '\\?.*$', '/AAPL', '//']; | ||
const endpoints = new Promise((resolve, reject) => { | ||
fs.readFile(`${__dirname}/temp.html`, 'utf8', (err, content) => { | ||
if(err){ | ||
if (err) { | ||
console.log(err); | ||
@@ -15,10 +15,10 @@ reject(err); | ||
let methods = []; | ||
lines.forEach(line => { | ||
if(line.includes(`<div class="url">`)){ | ||
let url = line.replace(new RegExp(regex.join('|'), 'g') , ''); | ||
if (line.includes(`<div class="url">`)) { | ||
let url = line.replace(new RegExp(regex.join('|'), 'g'), ''); | ||
urls.push(url.trim()); | ||
} | ||
if(line.includes(`method">`)){ | ||
if(line.includes(`<span`)){ | ||
if (line.includes(` method" `)) { | ||
if (line.includes(`<span`)) { | ||
methods.push(line.split('>')[1].split('<')[0].trim()); | ||
@@ -28,3 +28,3 @@ } | ||
}); | ||
resolve(methods.map((method, index) => ({ url: urls[index], method }))); | ||
@@ -31,0 +31,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
1310964
2075