@barchart/portfolio-client-js 1.2.44 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/example/example.js +65 -103
- package/lib/common/Configuration.js +4 -4
- package/lib/gateway/PortfolioGateway.js +56 -85
- package/lib/gateway/jwt/JwtGateway.js +31 -19
- package/lib/index.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@ The code is documented with [JSDoc](http://usejsdoc.org/). While the output hasn
|
|
|
8
8
|
> npm install
|
|
9
9
|
> gulp document
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
## Development
|
|
13
12
|
|
|
14
13
|
Gulp is used to check "linting" and to run unit tests.
|
|
@@ -18,7 +17,6 @@ Gulp is used to check "linting" and to run unit tests.
|
|
|
18
17
|
> gulp lint
|
|
19
18
|
> gulp test
|
|
20
19
|
|
|
21
|
-
|
|
22
20
|
## Build
|
|
23
21
|
|
|
24
22
|
Polyfills for ES6 are required:
|
package/example/example.js
CHANGED
|
@@ -64,7 +64,7 @@ module.exports = function () {
|
|
|
64
64
|
}], [{
|
|
65
65
|
key: 'developmentHost',
|
|
66
66
|
get: function get() {
|
|
67
|
-
return 'portfolio-dev.aws.barchart.com
|
|
67
|
+
return 'portfolio-dev.aws.barchart.com';
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
@@ -78,7 +78,7 @@ module.exports = function () {
|
|
|
78
78
|
}, {
|
|
79
79
|
key: 'stagingHost',
|
|
80
80
|
get: function get() {
|
|
81
|
-
return 'portfolio-stage.aws.barchart.com
|
|
81
|
+
return 'portfolio-stage.aws.barchart.com';
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
@@ -92,7 +92,7 @@ module.exports = function () {
|
|
|
92
92
|
}, {
|
|
93
93
|
key: 'productionHost',
|
|
94
94
|
get: function get() {
|
|
95
|
-
return 'portfolio.aws.barchart.com
|
|
95
|
+
return 'portfolio.aws.barchart.com';
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
@@ -106,7 +106,7 @@ module.exports = function () {
|
|
|
106
106
|
}, {
|
|
107
107
|
key: 'adminHost',
|
|
108
108
|
get: function get() {
|
|
109
|
-
return 'portfolio-admin.aws.barchart.com
|
|
109
|
+
return 'portfolio-admin.aws.barchart.com';
|
|
110
110
|
}
|
|
111
111
|
}]);
|
|
112
112
|
|
|
@@ -194,37 +194,37 @@ module.exports = function () {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
_this._readPortfoliosEndpoint = EndpointBuilder.for('read-portfolios', 'read portfolios').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
197
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
197
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
198
198
|
}).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPortfolioDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
199
199
|
|
|
200
200
|
_this._createPortfolioEndpoint = EndpointBuilder.for('create-portfolio', 'create portfolio').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
201
|
-
pb.withLiteralParameter('portfolios', 'portfolios');
|
|
201
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios');
|
|
202
202
|
}).withBody('portfolio').withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(RequestInterceptor.fromDelegate(createPortfolioRequestInterceptor)).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPortfolioDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
203
203
|
|
|
204
204
|
_this._updatePortfolioEndpoint = EndpointBuilder.for('update-portfolio', 'update portfolio').withVerb(VerbType.PUT).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
205
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
205
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
206
206
|
}).withBody('portfolio').withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(RequestInterceptor.fromDelegate(updatePortfolioRequestInterceptor)).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPortfolioDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
207
207
|
|
|
208
208
|
_this._deletePortfolioEndpoint = EndpointBuilder.for('delete-portfolio', 'delete portfolio').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
209
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
209
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
210
210
|
}).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
211
211
|
|
|
212
212
|
_this._readPositionsEndpoint = EndpointBuilder.for('read-positions', 'read positions').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
213
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
|
|
213
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
|
|
214
214
|
}).withQueryBuilder(function (qb) {
|
|
215
215
|
qb.withVariableParameter('includePreviousPrice', 'includePreviousPrice', 'includePreviousPrice', true);
|
|
216
216
|
}).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForPositionDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
217
217
|
|
|
218
218
|
_this._updatePositionEndpoint = EndpointBuilder.for('update-position', 'update position').withVerb(VerbType.PUT).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
219
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
|
|
219
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
|
|
220
220
|
}).withBody('portfolio').withRequestInterceptor(RequestInterceptor.fromDelegate(updatePositionRequestInterceptor)).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
221
221
|
|
|
222
222
|
_this._deletePositionEndpoint = EndpointBuilder.for('delete-position', 'delete position').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
223
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
|
|
223
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
|
|
224
224
|
}).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
225
225
|
|
|
226
226
|
_this._readPositionSummariesEndpoint = EndpointBuilder.for('read-position-summaries', 'read position summaries').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
227
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('summaries', 'summaries').withVariableParameter('position', 'position', 'position', false);
|
|
227
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('summaries', 'summaries').withVariableParameter('position', 'position', 'position', false);
|
|
228
228
|
}).withQueryBuilder(function (qb) {
|
|
229
229
|
qb.withVariableParameter('frames', 'frames', 'frames', true, function (frames) {
|
|
230
230
|
return frames.map(function (f) {
|
|
@@ -236,13 +236,13 @@ module.exports = function () {
|
|
|
236
236
|
}).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForPositionSummaryDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
237
237
|
|
|
238
238
|
_this._readTransactionsEndpoint = EndpointBuilder.for('read-transactions', 'read transactions').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
239
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
|
|
239
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
|
|
240
240
|
}).withQueryBuilder(function (qb) {
|
|
241
241
|
qb.withLiteralParameter('mode', 'mode', 'text');
|
|
242
242
|
}).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForTransactionDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
243
243
|
|
|
244
244
|
_this._createTransactionEndpoint = EndpointBuilder.for('create-transaction', 'create transaction').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
245
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
|
|
245
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
|
|
246
246
|
}).withQueryBuilder(function (qb) {
|
|
247
247
|
qb.withVariableParameter('type', 'type', 'type', false, function (x) {
|
|
248
248
|
return x.code;
|
|
@@ -250,11 +250,11 @@ module.exports = function () {
|
|
|
250
250
|
}).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
251
251
|
|
|
252
252
|
_this._batchTransactionEndpoint = EndpointBuilder.for('batch-transactions', 'batch transactions').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
253
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withLiteralParameter('multiple', 'multiple').withLiteralParameter('transactions', 'transactions');
|
|
253
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withLiteralParameter('multiple', 'multiple').withLiteralParameter('transactions', 'transactions');
|
|
254
254
|
}).withBody('transactions').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
255
255
|
|
|
256
256
|
_this._editTransactionEndpoint = EndpointBuilder.for('edit-transaction', 'edit transaction').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
257
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
|
|
257
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
|
|
258
258
|
}).withQueryBuilder(function (qb) {
|
|
259
259
|
qb.withVariableParameter('type', 'type', 'type', false, function (x) {
|
|
260
260
|
return x.code;
|
|
@@ -262,7 +262,7 @@ module.exports = function () {
|
|
|
262
262
|
}).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
263
263
|
|
|
264
264
|
_this._deleteTransactionEndpoint = EndpointBuilder.for('delete-transaction', 'delete transaction').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
265
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
|
|
265
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
|
|
266
266
|
}).withQueryBuilder(function (qb) {
|
|
267
267
|
qb.withVariableParameter('force', 'force', 'force', false).withVariableParameter('echoStart', 'echoStart', 'echoStart', true, function (x) {
|
|
268
268
|
return x.format();
|
|
@@ -272,7 +272,7 @@ module.exports = function () {
|
|
|
272
272
|
}).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
273
273
|
|
|
274
274
|
_this._readTransactionsReportEndpoint = EndpointBuilder.for('read-transaction-report', 'read transaction report').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
275
|
-
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', true).withLiteralParameter('transactions', 'transactions').withLiteralParameter('formatted', 'formatted');
|
|
275
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', true).withLiteralParameter('transactions', 'transactions').withLiteralParameter('formatted', 'formatted');
|
|
276
276
|
}).withQueryBuilder(function (qb) {
|
|
277
277
|
qb.withVariableParameter('start', 'start', 'start', true, function (x) {
|
|
278
278
|
return x.format();
|
|
@@ -282,7 +282,7 @@ module.exports = function () {
|
|
|
282
282
|
}).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
283
283
|
|
|
284
284
|
_this._readBrokerageReportAvailabilityEndpoint = EndpointBuilder.for('read-brokerage-report-availability', 'read brokerage report availability').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
285
|
-
pb.withLiteralParameter('reports', 'reports').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('availability', 'availability');
|
|
285
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('reports', 'reports').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('availability', 'availability');
|
|
286
286
|
}).withQueryBuilder(function (qb) {
|
|
287
287
|
qb.withVariableParameter('frames', 'frames', 'frames', true, function (frames) {
|
|
288
288
|
return frames.map(function (f) {
|
|
@@ -290,14 +290,6 @@ module.exports = function () {
|
|
|
290
290
|
}).join();
|
|
291
291
|
});
|
|
292
292
|
}).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForBrokerageReportAvailabilityDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
293
|
-
|
|
294
|
-
_this._downloadBrokerageReportEndpoint = EndpointBuilder.for('download-brokerage-report', 'download brokerage report').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
295
|
-
pb.withLiteralParameter('reports', 'reports').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('frames', 'frames').withVariableParameter('frame', 'frame', 'frame', false, function (x) {
|
|
296
|
-
return x.code;
|
|
297
|
-
}).withLiteralParameter('date', 'date').withVariableParameter('start', 'start', 'start', false, function (x) {
|
|
298
|
-
return x.format();
|
|
299
|
-
});
|
|
300
|
-
}).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
301
293
|
return _this;
|
|
302
294
|
}
|
|
303
295
|
|
|
@@ -318,7 +310,7 @@ module.exports = function () {
|
|
|
318
310
|
* containing the current instance.
|
|
319
311
|
*
|
|
320
312
|
* @public
|
|
321
|
-
* @returns {Promise
|
|
313
|
+
* @returns {Promise<PortfolioGateway>}
|
|
322
314
|
*/
|
|
323
315
|
value: function start() {
|
|
324
316
|
var _this2 = this;
|
|
@@ -345,7 +337,7 @@ module.exports = function () {
|
|
|
345
337
|
*
|
|
346
338
|
* @public
|
|
347
339
|
* @param {String=} portfolio
|
|
348
|
-
* @returns {Promise
|
|
340
|
+
* @returns {Promise<Portfolio[]>}
|
|
349
341
|
*/
|
|
350
342
|
|
|
351
343
|
}, {
|
|
@@ -367,7 +359,7 @@ module.exports = function () {
|
|
|
367
359
|
*
|
|
368
360
|
* @public
|
|
369
361
|
* @param {Object} portfolio
|
|
370
|
-
* @returns {Promise
|
|
362
|
+
* @returns {Promise<Portfolio>}
|
|
371
363
|
*/
|
|
372
364
|
|
|
373
365
|
}, {
|
|
@@ -389,7 +381,7 @@ module.exports = function () {
|
|
|
389
381
|
*
|
|
390
382
|
* @public
|
|
391
383
|
* @param {Object} portfolio
|
|
392
|
-
* @returns {Promise
|
|
384
|
+
* @returns {Promise<Portfolio>}
|
|
393
385
|
*/
|
|
394
386
|
|
|
395
387
|
}, {
|
|
@@ -411,7 +403,7 @@ module.exports = function () {
|
|
|
411
403
|
*
|
|
412
404
|
* @public
|
|
413
405
|
* @param {Object} portfolio
|
|
414
|
-
* @returns {Promise
|
|
406
|
+
* @returns {Promise<Portfolio>}
|
|
415
407
|
*/
|
|
416
408
|
|
|
417
409
|
}, {
|
|
@@ -433,7 +425,7 @@ module.exports = function () {
|
|
|
433
425
|
*
|
|
434
426
|
* @public
|
|
435
427
|
* @param {String} portfolio - ID of the portfolio to update
|
|
436
|
-
* @returns {Promise
|
|
428
|
+
* @returns {Promise<Portfolio>}
|
|
437
429
|
*/
|
|
438
430
|
|
|
439
431
|
}, {
|
|
@@ -457,7 +449,7 @@ module.exports = function () {
|
|
|
457
449
|
* @param {String=} portfolio
|
|
458
450
|
* @param {String=} position
|
|
459
451
|
* @param {Boolean=} includePreviousPrice
|
|
460
|
-
* @returns {Promise
|
|
452
|
+
* @returns {Promise<Position[]>}
|
|
461
453
|
*/
|
|
462
454
|
|
|
463
455
|
}, {
|
|
@@ -481,7 +473,7 @@ module.exports = function () {
|
|
|
481
473
|
*
|
|
482
474
|
* @public
|
|
483
475
|
* @param {Object} position
|
|
484
|
-
* @returns {Promise
|
|
476
|
+
* @returns {Promise<Position>}
|
|
485
477
|
*/
|
|
486
478
|
|
|
487
479
|
}, {
|
|
@@ -549,10 +541,10 @@ module.exports = function () {
|
|
|
549
541
|
* @public
|
|
550
542
|
* @param {String=} portfolio
|
|
551
543
|
* @param {String=} position
|
|
552
|
-
* @param {Array
|
|
544
|
+
* @param {Array<PositionSummaryFrame>=|Array<String>=} frames
|
|
553
545
|
* @param {Number=} periods
|
|
554
546
|
* @param {Day=|String=} start
|
|
555
|
-
* @returns {Promise
|
|
547
|
+
* @returns {Promise<Position[]>}
|
|
556
548
|
*/
|
|
557
549
|
|
|
558
550
|
}, {
|
|
@@ -624,7 +616,7 @@ module.exports = function () {
|
|
|
624
616
|
* @public
|
|
625
617
|
* @param {String} portfolio
|
|
626
618
|
* @param {String} position
|
|
627
|
-
* @returns {Promise
|
|
619
|
+
* @returns {Promise<Position[]>}
|
|
628
620
|
*/
|
|
629
621
|
|
|
630
622
|
}, {
|
|
@@ -647,7 +639,7 @@ module.exports = function () {
|
|
|
647
639
|
*
|
|
648
640
|
* @public
|
|
649
641
|
* @param {Object} transaction
|
|
650
|
-
* @returns {Promise
|
|
642
|
+
* @returns {Promise<TransactionMutateResult>}
|
|
651
643
|
*/
|
|
652
644
|
|
|
653
645
|
}, {
|
|
@@ -720,7 +712,7 @@ module.exports = function () {
|
|
|
720
712
|
*
|
|
721
713
|
* @public
|
|
722
714
|
* @param {Object} transaction
|
|
723
|
-
* @returns {Promise
|
|
715
|
+
* @returns {Promise<TransactionMutateResult>}
|
|
724
716
|
*/
|
|
725
717
|
|
|
726
718
|
}, {
|
|
@@ -752,7 +744,7 @@ module.exports = function () {
|
|
|
752
744
|
* @param {Boolean=} force
|
|
753
745
|
* @param {Day=} echoStart
|
|
754
746
|
* @param {Day=} echoEnd
|
|
755
|
-
* @returns {Promise
|
|
747
|
+
* @returns {Promise<TransactionMutateResult>}
|
|
756
748
|
*/
|
|
757
749
|
|
|
758
750
|
}, {
|
|
@@ -795,7 +787,7 @@ module.exports = function () {
|
|
|
795
787
|
* @public
|
|
796
788
|
* @param {String} portfolio
|
|
797
789
|
* @param {String=} position
|
|
798
|
-
* @returns {Promise
|
|
790
|
+
* @returns {Promise<Transaction[]>}
|
|
799
791
|
*/
|
|
800
792
|
|
|
801
793
|
}, {
|
|
@@ -823,7 +815,7 @@ module.exports = function () {
|
|
|
823
815
|
* @param {Day=} startDay
|
|
824
816
|
* @param {Day=} endDay
|
|
825
817
|
* @oaram {Boolean=} descending
|
|
826
|
-
* @returns {Promise
|
|
818
|
+
* @returns {Promise<Object[]>}
|
|
827
819
|
*/
|
|
828
820
|
|
|
829
821
|
}, {
|
|
@@ -929,43 +921,13 @@ module.exports = function () {
|
|
|
929
921
|
});
|
|
930
922
|
}
|
|
931
923
|
|
|
932
|
-
/**
|
|
933
|
-
* @public
|
|
934
|
-
* @param {String=} portfolio
|
|
935
|
-
* @param {PositionSummaryFrame} frame
|
|
936
|
-
* @param {Day} end
|
|
937
|
-
* @returns {Promise}
|
|
938
|
-
*/
|
|
939
|
-
|
|
940
|
-
}, {
|
|
941
|
-
key: 'downloadBrokerageReport',
|
|
942
|
-
value: function downloadBrokerageReport(portfolio, frame, end) {
|
|
943
|
-
var _this21 = this;
|
|
944
|
-
|
|
945
|
-
return Promise.resolve().then(function () {
|
|
946
|
-
checkStart.call(_this21);
|
|
947
|
-
|
|
948
|
-
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
949
|
-
assert.argumentIsRequired(frame, 'frame', PositionSummaryFrame, 'PositionSummaryFrame');
|
|
950
|
-
assert.argumentIsRequired(end, 'end', Day, 'Day');
|
|
951
|
-
|
|
952
|
-
var payload = {};
|
|
953
|
-
|
|
954
|
-
payload.portfolio = portfolio;
|
|
955
|
-
payload.frame = frame;
|
|
956
|
-
payload.start = end;
|
|
957
|
-
|
|
958
|
-
return Gateway.invoke(_this21._downloadBrokerageReportEndpoint, payload);
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
|
|
962
924
|
/**
|
|
963
925
|
* Creates and starts a new {@link PortfolioGateway} for use in the development environment.
|
|
964
926
|
*
|
|
965
927
|
* @public
|
|
966
928
|
* @static
|
|
967
|
-
* @param {RequestInterceptor=|Promise
|
|
968
|
-
* @returns {Promise
|
|
929
|
+
* @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
|
|
930
|
+
* @returns {Promise<PortfolioGateway>}
|
|
969
931
|
*/
|
|
970
932
|
|
|
971
933
|
}, {
|
|
@@ -998,8 +960,8 @@ module.exports = function () {
|
|
|
998
960
|
*
|
|
999
961
|
* @public
|
|
1000
962
|
* @static
|
|
1001
|
-
* @param {RequestInterceptor=|Promise
|
|
1002
|
-
* @returns {Promise
|
|
963
|
+
* @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
|
|
964
|
+
* @returns {Promise<PortfolioGateway>}
|
|
1003
965
|
*/
|
|
1004
966
|
|
|
1005
967
|
}, {
|
|
@@ -1017,8 +979,8 @@ module.exports = function () {
|
|
|
1017
979
|
*
|
|
1018
980
|
* @public
|
|
1019
981
|
* @static
|
|
1020
|
-
* @param {RequestInterceptor=|Promise
|
|
1021
|
-
* @returns {Promise
|
|
982
|
+
* @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
|
|
983
|
+
* @returns {Promise<PortfolioGateway>}
|
|
1022
984
|
*/
|
|
1023
985
|
|
|
1024
986
|
}, {
|
|
@@ -1036,8 +998,8 @@ module.exports = function () {
|
|
|
1036
998
|
*
|
|
1037
999
|
* @public
|
|
1038
1000
|
* @static
|
|
1039
|
-
* @param {RequestInterceptor=|Promise
|
|
1040
|
-
* @returns {Promise
|
|
1001
|
+
* @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
|
|
1002
|
+
* @returns {Promise<PortfolioGateway>}
|
|
1041
1003
|
*/
|
|
1042
1004
|
|
|
1043
1005
|
}, {
|
|
@@ -1195,8 +1157,8 @@ module.exports = function () {
|
|
|
1195
1157
|
*
|
|
1196
1158
|
* @typedef TransactionMutateResult
|
|
1197
1159
|
* @type {Object}
|
|
1198
|
-
* @property {
|
|
1199
|
-
* @property {
|
|
1160
|
+
* @property {Object[]} positions - All positions updated as a consequence of processing the transaction.
|
|
1161
|
+
* @property {Object[]} summaries - All position summaries updated as a consequence of processing the transaction.
|
|
1200
1162
|
* @property {Boolean} replaced - If true, the position (and position summaries) need to be replaced.
|
|
1201
1163
|
*/
|
|
1202
1164
|
|
|
@@ -1267,7 +1229,7 @@ module.exports = function () {
|
|
|
1267
1229
|
* containing the current instance
|
|
1268
1230
|
*
|
|
1269
1231
|
* @public
|
|
1270
|
-
* @returns {Promise
|
|
1232
|
+
* @returns {Promise<JwtGateway>}
|
|
1271
1233
|
*/
|
|
1272
1234
|
|
|
1273
1235
|
|
|
@@ -1297,7 +1259,7 @@ module.exports = function () {
|
|
|
1297
1259
|
* Retrieves a JWT token from the remote server.
|
|
1298
1260
|
*
|
|
1299
1261
|
* @public
|
|
1300
|
-
* @returns {Promise
|
|
1262
|
+
* @returns {Promise<String>}
|
|
1301
1263
|
*/
|
|
1302
1264
|
|
|
1303
1265
|
}, {
|
|
@@ -1336,7 +1298,7 @@ module.exports = function () {
|
|
|
1336
1298
|
var refreshToken = function refreshToken() {
|
|
1337
1299
|
var refreshPromise = scheduler.backoff(function () {
|
|
1338
1300
|
return _this4.readToken();
|
|
1339
|
-
},
|
|
1301
|
+
}, 0, 'Read JWT token', 3).then(function (token) {
|
|
1340
1302
|
if (_this4._refreshInterval) {
|
|
1341
1303
|
cachePromise = refreshPromise;
|
|
1342
1304
|
}
|
|
@@ -1393,7 +1355,7 @@ module.exports = function () {
|
|
|
1393
1355
|
* @static
|
|
1394
1356
|
* @param {String} userId - The identifier of the user to impersonate.
|
|
1395
1357
|
* @param {String} userLegacyId - The legacy identifier of the user to impersonate.
|
|
1396
|
-
* @returns {Promise
|
|
1358
|
+
* @returns {Promise<JwtGateway>}
|
|
1397
1359
|
*/
|
|
1398
1360
|
|
|
1399
1361
|
}, {
|
|
@@ -1418,7 +1380,7 @@ module.exports = function () {
|
|
|
1418
1380
|
* @public
|
|
1419
1381
|
* @static
|
|
1420
1382
|
* @param {String} userId - The identifier of the user to impersonate.
|
|
1421
|
-
* @returns {Promise
|
|
1383
|
+
* @returns {Promise<RequestInterceptor>}
|
|
1422
1384
|
*/
|
|
1423
1385
|
|
|
1424
1386
|
}, {
|
|
@@ -1434,8 +1396,8 @@ module.exports = function () {
|
|
|
1434
1396
|
*
|
|
1435
1397
|
* @public
|
|
1436
1398
|
* @static
|
|
1437
|
-
* @param {Promise
|
|
1438
|
-
* @returns {Promise
|
|
1399
|
+
* @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
|
|
1400
|
+
* @returns {Promise<JwtGateway>}
|
|
1439
1401
|
*/
|
|
1440
1402
|
|
|
1441
1403
|
}, {
|
|
@@ -1451,8 +1413,8 @@ module.exports = function () {
|
|
|
1451
1413
|
*
|
|
1452
1414
|
* @public
|
|
1453
1415
|
* @static
|
|
1454
|
-
* @param {Promise
|
|
1455
|
-
* @returns {Promise
|
|
1416
|
+
* @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
|
|
1417
|
+
* @returns {Promise<RequestInterceptor>}
|
|
1456
1418
|
*/
|
|
1457
1419
|
|
|
1458
1420
|
}, {
|
|
@@ -1468,8 +1430,8 @@ module.exports = function () {
|
|
|
1468
1430
|
*
|
|
1469
1431
|
* @public
|
|
1470
1432
|
* @static
|
|
1471
|
-
* @param {Promise
|
|
1472
|
-
* @returns {Promise
|
|
1433
|
+
* @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
|
|
1434
|
+
* @returns {Promise<JwtGateway>}
|
|
1473
1435
|
*/
|
|
1474
1436
|
|
|
1475
1437
|
}, {
|
|
@@ -1485,8 +1447,8 @@ module.exports = function () {
|
|
|
1485
1447
|
*
|
|
1486
1448
|
* @public
|
|
1487
1449
|
* @static
|
|
1488
|
-
* @param {Promise
|
|
1489
|
-
* @returns {Promise
|
|
1450
|
+
* @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
|
|
1451
|
+
* @returns {Promise<RequestInterceptor>}
|
|
1490
1452
|
*/
|
|
1491
1453
|
|
|
1492
1454
|
}, {
|
|
@@ -1504,7 +1466,7 @@ module.exports = function () {
|
|
|
1504
1466
|
* @static
|
|
1505
1467
|
* @param {String} userId - The identifier of the user to impersonate.
|
|
1506
1468
|
* @param {String} userLegacyId - The legacy identifier of the user to impersonate.
|
|
1507
|
-
* @returns {Promise
|
|
1469
|
+
* @returns {Promise<JwtGateway>}
|
|
1508
1470
|
*/
|
|
1509
1471
|
|
|
1510
1472
|
}, {
|
|
@@ -1519,7 +1481,7 @@ module.exports = function () {
|
|
|
1519
1481
|
* @public
|
|
1520
1482
|
* @static
|
|
1521
1483
|
* @param {String} userId - The identifier of the user to impersonate.
|
|
1522
|
-
* @returns {Promise
|
|
1484
|
+
* @returns {Promise<RequestInterceptor>}
|
|
1523
1485
|
*/
|
|
1524
1486
|
|
|
1525
1487
|
}, {
|
|
@@ -1552,7 +1514,7 @@ module.exports = function () {
|
|
|
1552
1514
|
|
|
1553
1515
|
function _forDevelopment(userId, legacyUserId) {
|
|
1554
1516
|
return EndpointBuilder.for('read-jwt-token-for-development', 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.developmentHost).withPathBuilder(function (pb) {
|
|
1555
|
-
pb.withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
|
|
1517
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
|
|
1556
1518
|
}).withQueryBuilder(function (qb) {
|
|
1557
1519
|
qb.withLiteralParameter('user', 'userId', userId).withLiteralParameter('legacy user', 'userLegacyId', legacyUserId).withLiteralParameter('user context', 'userContext', 'TGAM').withLiteralParameter('user permission level', 'userPermissions', 'registered');
|
|
1558
1520
|
}).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
|
|
@@ -1560,19 +1522,19 @@ module.exports = function () {
|
|
|
1560
1522
|
|
|
1561
1523
|
function _forStaging(externalRequestInterceptor) {
|
|
1562
1524
|
return EndpointBuilder.for('translate-jwt-token-for-staging', 'lookup Barchart user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.stagingHost).withPathBuilder(function (pb) {
|
|
1563
|
-
|
|
1525
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('token', 'token').withLiteralParameter('system', 'tgam').withLiteralParameter('converter', 'converter');
|
|
1564
1526
|
}).withRequestInterceptor(externalRequestInterceptor).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
|
|
1565
1527
|
}
|
|
1566
1528
|
|
|
1567
1529
|
function _forProduction(externalRequestInterceptor) {
|
|
1568
1530
|
return EndpointBuilder.for('translate-jwt-token-for-production', 'lookup Barchart user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.productionHost).withPathBuilder(function (pb) {
|
|
1569
|
-
|
|
1531
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('token', 'token').withLiteralParameter('system', 'tgam').withLiteralParameter('converter', 'converter');
|
|
1570
1532
|
}).withRequestInterceptor(externalRequestInterceptor).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
|
|
1571
1533
|
}
|
|
1572
1534
|
|
|
1573
1535
|
function _forAdmin(userId, legacyUserId) {
|
|
1574
1536
|
return EndpointBuilder.for('read-jwt-token-for-admin', 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.adminHost).withPathBuilder(function (pb) {
|
|
1575
|
-
pb.withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
|
|
1537
|
+
pb.withLiteralParameter('json', 'json').withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
|
|
1576
1538
|
}).withQueryBuilder(function (qb) {
|
|
1577
1539
|
if (userId) {
|
|
1578
1540
|
qb.withLiteralParameter('user', 'userId', userId);
|
|
@@ -1601,7 +1563,7 @@ module.exports = function () {
|
|
|
1601
1563
|
return {
|
|
1602
1564
|
JwtGateway: JwtGateway,
|
|
1603
1565
|
PortfolioGateway: PortfolioGateway,
|
|
1604
|
-
version: '1.2
|
|
1566
|
+
version: '1.3.2'
|
|
1605
1567
|
};
|
|
1606
1568
|
}();
|
|
1607
1569
|
|
|
@@ -19,7 +19,7 @@ module.exports = (() => {
|
|
|
19
19
|
* @returns {String}
|
|
20
20
|
*/
|
|
21
21
|
static get developmentHost() {
|
|
22
|
-
return 'portfolio-dev.aws.barchart.com
|
|
22
|
+
return 'portfolio-dev.aws.barchart.com';
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -30,7 +30,7 @@ module.exports = (() => {
|
|
|
30
30
|
* @returns {String}
|
|
31
31
|
*/
|
|
32
32
|
static get stagingHost() {
|
|
33
|
-
return 'portfolio-stage.aws.barchart.com
|
|
33
|
+
return 'portfolio-stage.aws.barchart.com';
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -41,7 +41,7 @@ module.exports = (() => {
|
|
|
41
41
|
* @returns {String}
|
|
42
42
|
*/
|
|
43
43
|
static get productionHost() {
|
|
44
|
-
return 'portfolio.aws.barchart.com
|
|
44
|
+
return 'portfolio.aws.barchart.com';
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -52,7 +52,7 @@ module.exports = (() => {
|
|
|
52
52
|
* @return {String}
|
|
53
53
|
*/
|
|
54
54
|
static get adminHost() {
|
|
55
|
-
return 'portfolio-admin.aws.barchart.com
|
|
55
|
+
return 'portfolio-admin.aws.barchart.com';
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
toString() {
|
|
@@ -65,7 +65,8 @@ module.exports = (() => {
|
|
|
65
65
|
.withHost(host)
|
|
66
66
|
.withPort(port)
|
|
67
67
|
.withPathBuilder((pb) => {
|
|
68
|
-
pb.withLiteralParameter('
|
|
68
|
+
pb.withLiteralParameter('json', 'json')
|
|
69
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
69
70
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
70
71
|
})
|
|
71
72
|
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
|
|
@@ -80,7 +81,8 @@ module.exports = (() => {
|
|
|
80
81
|
.withHost(host)
|
|
81
82
|
.withPort(port)
|
|
82
83
|
.withPathBuilder((pb) => {
|
|
83
|
-
pb.withLiteralParameter('
|
|
84
|
+
pb.withLiteralParameter('json', 'json')
|
|
85
|
+
.withLiteralParameter('portfolios', 'portfolios');
|
|
84
86
|
})
|
|
85
87
|
.withBody('portfolio')
|
|
86
88
|
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
|
|
@@ -96,7 +98,8 @@ module.exports = (() => {
|
|
|
96
98
|
.withHost(host)
|
|
97
99
|
.withPort(port)
|
|
98
100
|
.withPathBuilder((pb) => {
|
|
99
|
-
pb.withLiteralParameter('
|
|
101
|
+
pb.withLiteralParameter('json', 'json')
|
|
102
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
100
103
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
101
104
|
})
|
|
102
105
|
.withBody('portfolio')
|
|
@@ -113,7 +116,8 @@ module.exports = (() => {
|
|
|
113
116
|
.withHost(host)
|
|
114
117
|
.withPort(port)
|
|
115
118
|
.withPathBuilder((pb) => {
|
|
116
|
-
pb.withLiteralParameter('
|
|
119
|
+
pb.withLiteralParameter('json', 'json')
|
|
120
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
117
121
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
118
122
|
})
|
|
119
123
|
.withRequestInterceptor(requestInterceptorToUse)
|
|
@@ -126,7 +130,8 @@ module.exports = (() => {
|
|
|
126
130
|
.withHost(host)
|
|
127
131
|
.withPort(port)
|
|
128
132
|
.withPathBuilder((pb) => {
|
|
129
|
-
pb.withLiteralParameter('
|
|
133
|
+
pb.withLiteralParameter('json', 'json')
|
|
134
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
130
135
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
131
136
|
.withLiteralParameter('positions', 'positions')
|
|
132
137
|
.withVariableParameter('position', 'position', 'position', false);
|
|
@@ -146,7 +151,8 @@ module.exports = (() => {
|
|
|
146
151
|
.withHost(host)
|
|
147
152
|
.withPort(port)
|
|
148
153
|
.withPathBuilder((pb) => {
|
|
149
|
-
pb.withLiteralParameter('
|
|
154
|
+
pb.withLiteralParameter('json', 'json')
|
|
155
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
150
156
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
151
157
|
.withLiteralParameter('positions', 'positions')
|
|
152
158
|
.withVariableParameter('position', 'position', 'position', false);
|
|
@@ -164,7 +170,8 @@ module.exports = (() => {
|
|
|
164
170
|
.withHost(host)
|
|
165
171
|
.withPort(port)
|
|
166
172
|
.withPathBuilder((pb) => {
|
|
167
|
-
pb.withLiteralParameter('
|
|
173
|
+
pb.withLiteralParameter('json', 'json')
|
|
174
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
168
175
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
169
176
|
.withLiteralParameter('positions', 'positions')
|
|
170
177
|
.withVariableParameter('position', 'position', 'position', false);
|
|
@@ -181,7 +188,8 @@ module.exports = (() => {
|
|
|
181
188
|
.withHost(host)
|
|
182
189
|
.withPort(port)
|
|
183
190
|
.withPathBuilder((pb) => {
|
|
184
|
-
pb.withLiteralParameter('
|
|
191
|
+
pb.withLiteralParameter('json', 'json')
|
|
192
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
185
193
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
186
194
|
.withLiteralParameter('summaries', 'summaries')
|
|
187
195
|
.withVariableParameter('position', 'position', 'position', false);
|
|
@@ -203,7 +211,8 @@ module.exports = (() => {
|
|
|
203
211
|
.withHost(host)
|
|
204
212
|
.withPort(port)
|
|
205
213
|
.withPathBuilder((pb) => {
|
|
206
|
-
pb.withLiteralParameter('
|
|
214
|
+
pb.withLiteralParameter('json', 'json')
|
|
215
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
207
216
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
208
217
|
.withLiteralParameter('positions', 'positions')
|
|
209
218
|
.withVariableParameter('position', 'position', 'position', false)
|
|
@@ -224,7 +233,8 @@ module.exports = (() => {
|
|
|
224
233
|
.withHost(host)
|
|
225
234
|
.withPort(port)
|
|
226
235
|
.withPathBuilder((pb) => {
|
|
227
|
-
pb.withLiteralParameter('
|
|
236
|
+
pb.withLiteralParameter('json', 'json')
|
|
237
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
228
238
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
229
239
|
.withLiteralParameter('positions', 'positions')
|
|
230
240
|
.withVariableParameter('position', 'position', 'position', false)
|
|
@@ -245,7 +255,8 @@ module.exports = (() => {
|
|
|
245
255
|
.withHost(host)
|
|
246
256
|
.withPort(port)
|
|
247
257
|
.withPathBuilder((pb) => {
|
|
248
|
-
pb.withLiteralParameter('
|
|
258
|
+
pb.withLiteralParameter('json', 'json')
|
|
259
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
249
260
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
250
261
|
.withLiteralParameter('positions', 'positions')
|
|
251
262
|
.withLiteralParameter('multiple', 'multiple')
|
|
@@ -263,7 +274,8 @@ module.exports = (() => {
|
|
|
263
274
|
.withHost(host)
|
|
264
275
|
.withPort(port)
|
|
265
276
|
.withPathBuilder((pb) => {
|
|
266
|
-
pb.withLiteralParameter('
|
|
277
|
+
pb.withLiteralParameter('json', 'json')
|
|
278
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
267
279
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
268
280
|
.withLiteralParameter('positions', 'positions')
|
|
269
281
|
.withVariableParameter('position', 'position', 'position', false)
|
|
@@ -285,7 +297,8 @@ module.exports = (() => {
|
|
|
285
297
|
.withHost(host)
|
|
286
298
|
.withPort(port)
|
|
287
299
|
.withPathBuilder((pb) => {
|
|
288
|
-
pb.withLiteralParameter('
|
|
300
|
+
pb.withLiteralParameter('json', 'json')
|
|
301
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
289
302
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
290
303
|
.withLiteralParameter('positions', 'positions')
|
|
291
304
|
.withVariableParameter('position', 'position', 'position', false)
|
|
@@ -308,7 +321,8 @@ module.exports = (() => {
|
|
|
308
321
|
.withHost(host)
|
|
309
322
|
.withPort(port)
|
|
310
323
|
.withPathBuilder((pb) => {
|
|
311
|
-
pb.withLiteralParameter('
|
|
324
|
+
pb.withLiteralParameter('json', 'json')
|
|
325
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
312
326
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
313
327
|
.withLiteralParameter('positions', 'positions')
|
|
314
328
|
.withVariableParameter('position', 'position', 'position', true)
|
|
@@ -334,7 +348,8 @@ module.exports = (() => {
|
|
|
334
348
|
.withHost(host)
|
|
335
349
|
.withPort(port)
|
|
336
350
|
.withPathBuilder((pb) => {
|
|
337
|
-
pb.withLiteralParameter('
|
|
351
|
+
pb.withLiteralParameter('json', 'json')
|
|
352
|
+
.withLiteralParameter('reports', 'reports')
|
|
338
353
|
.withLiteralParameter('portfolios', 'portfolios')
|
|
339
354
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
340
355
|
.withLiteralParameter('availability', 'availability');
|
|
@@ -347,24 +362,6 @@ module.exports = (() => {
|
|
|
347
362
|
.withResponseInterceptor(responseInterceptorForBrokerageReportAvailabilityDeserialization)
|
|
348
363
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
349
364
|
.endpoint;
|
|
350
|
-
|
|
351
|
-
this._downloadBrokerageReportEndpoint = EndpointBuilder.for('download-brokerage-report', 'download brokerage report')
|
|
352
|
-
.withVerb(VerbType.GET)
|
|
353
|
-
.withProtocol(protocolType)
|
|
354
|
-
.withHost(host)
|
|
355
|
-
.withPort(port)
|
|
356
|
-
.withPathBuilder((pb) => {
|
|
357
|
-
pb.withLiteralParameter('reports', 'reports')
|
|
358
|
-
.withLiteralParameter('portfolios', 'portfolios')
|
|
359
|
-
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
360
|
-
.withLiteralParameter('frames', 'frames')
|
|
361
|
-
.withVariableParameter('frame', 'frame', 'frame', false, x => x.code)
|
|
362
|
-
.withLiteralParameter('date', 'date')
|
|
363
|
-
.withVariableParameter('start', 'start', 'start', false, x => x.format());
|
|
364
|
-
})
|
|
365
|
-
.withRequestInterceptor(requestInterceptorToUse)
|
|
366
|
-
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
367
|
-
.endpoint;
|
|
368
365
|
}
|
|
369
366
|
|
|
370
367
|
/**
|
|
@@ -382,7 +379,7 @@ module.exports = (() => {
|
|
|
382
379
|
* containing the current instance.
|
|
383
380
|
*
|
|
384
381
|
* @public
|
|
385
|
-
* @returns {Promise
|
|
382
|
+
* @returns {Promise<PortfolioGateway>}
|
|
386
383
|
*/
|
|
387
384
|
start() {
|
|
388
385
|
return Promise.resolve()
|
|
@@ -409,7 +406,7 @@ module.exports = (() => {
|
|
|
409
406
|
*
|
|
410
407
|
* @public
|
|
411
408
|
* @param {String=} portfolio
|
|
412
|
-
* @returns {Promise
|
|
409
|
+
* @returns {Promise<Portfolio[]>}
|
|
413
410
|
*/
|
|
414
411
|
readPortfolios(portfolio) {
|
|
415
412
|
return Promise.resolve()
|
|
@@ -427,7 +424,7 @@ module.exports = (() => {
|
|
|
427
424
|
*
|
|
428
425
|
* @public
|
|
429
426
|
* @param {Object} portfolio
|
|
430
|
-
* @returns {Promise
|
|
427
|
+
* @returns {Promise<Portfolio>}
|
|
431
428
|
*/
|
|
432
429
|
createPortfolio(portfolio) {
|
|
433
430
|
return Promise.resolve()
|
|
@@ -445,7 +442,7 @@ module.exports = (() => {
|
|
|
445
442
|
*
|
|
446
443
|
* @public
|
|
447
444
|
* @param {Object} portfolio
|
|
448
|
-
* @returns {Promise
|
|
445
|
+
* @returns {Promise<Portfolio>}
|
|
449
446
|
*/
|
|
450
447
|
importPortfolio(portfolio, transactions) {
|
|
451
448
|
return Promise.resolve()
|
|
@@ -464,7 +461,7 @@ module.exports = (() => {
|
|
|
464
461
|
*
|
|
465
462
|
* @public
|
|
466
463
|
* @param {Object} portfolio
|
|
467
|
-
* @returns {Promise
|
|
464
|
+
* @returns {Promise<Portfolio>}
|
|
468
465
|
*/
|
|
469
466
|
updatePortfolio(portfolio) {
|
|
470
467
|
return Promise.resolve()
|
|
@@ -482,7 +479,7 @@ module.exports = (() => {
|
|
|
482
479
|
*
|
|
483
480
|
* @public
|
|
484
481
|
* @param {String} portfolio - ID of the portfolio to update
|
|
485
|
-
* @returns {Promise
|
|
482
|
+
* @returns {Promise<Portfolio>}
|
|
486
483
|
*/
|
|
487
484
|
deletePortfolio(portfolio) {
|
|
488
485
|
return Promise.resolve()
|
|
@@ -502,7 +499,7 @@ module.exports = (() => {
|
|
|
502
499
|
* @param {String=} portfolio
|
|
503
500
|
* @param {String=} position
|
|
504
501
|
* @param {Boolean=} includePreviousPrice
|
|
505
|
-
* @returns {Promise
|
|
502
|
+
* @returns {Promise<Position[]>}
|
|
506
503
|
*/
|
|
507
504
|
readPositions(portfolio, position, includePreviousPrice) {
|
|
508
505
|
return Promise.resolve()
|
|
@@ -522,7 +519,7 @@ module.exports = (() => {
|
|
|
522
519
|
*
|
|
523
520
|
* @public
|
|
524
521
|
* @param {Object} position
|
|
525
|
-
* @returns {Promise
|
|
522
|
+
* @returns {Promise<Position>}
|
|
526
523
|
*/
|
|
527
524
|
updatePosition(position) {
|
|
528
525
|
return Promise.resolve()
|
|
@@ -580,10 +577,10 @@ module.exports = (() => {
|
|
|
580
577
|
* @public
|
|
581
578
|
* @param {String=} portfolio
|
|
582
579
|
* @param {String=} position
|
|
583
|
-
* @param {Array
|
|
580
|
+
* @param {Array<PositionSummaryFrame>=|Array<String>=} frames
|
|
584
581
|
* @param {Number=} periods
|
|
585
582
|
* @param {Day=|String=} start
|
|
586
|
-
* @returns {Promise
|
|
583
|
+
* @returns {Promise<Position[]>}
|
|
587
584
|
*/
|
|
588
585
|
readPositionSummaries(portfolio, position, frames, periods, start) {
|
|
589
586
|
return Promise.resolve()
|
|
@@ -651,7 +648,7 @@ module.exports = (() => {
|
|
|
651
648
|
* @public
|
|
652
649
|
* @param {String} portfolio
|
|
653
650
|
* @param {String} position
|
|
654
|
-
* @returns {Promise
|
|
651
|
+
* @returns {Promise<Position[]>}
|
|
655
652
|
*/
|
|
656
653
|
deletePosition(portfolio, position) {
|
|
657
654
|
return Promise.resolve()
|
|
@@ -670,7 +667,7 @@ module.exports = (() => {
|
|
|
670
667
|
*
|
|
671
668
|
* @public
|
|
672
669
|
* @param {Object} transaction
|
|
673
|
-
* @returns {Promise
|
|
670
|
+
* @returns {Promise<TransactionMutateResult>}
|
|
674
671
|
*/
|
|
675
672
|
createTransaction(transaction) {
|
|
676
673
|
return Promise.resolve()
|
|
@@ -735,7 +732,7 @@ module.exports = (() => {
|
|
|
735
732
|
*
|
|
736
733
|
* @public
|
|
737
734
|
* @param {Object} transaction
|
|
738
|
-
* @returns {Promise
|
|
735
|
+
* @returns {Promise<TransactionMutateResult>}
|
|
739
736
|
*/
|
|
740
737
|
editTransaction(transaction) {
|
|
741
738
|
return Promise.resolve()
|
|
@@ -763,7 +760,7 @@ module.exports = (() => {
|
|
|
763
760
|
* @param {Boolean=} force
|
|
764
761
|
* @param {Day=} echoStart
|
|
765
762
|
* @param {Day=} echoEnd
|
|
766
|
-
* @returns {Promise
|
|
763
|
+
* @returns {Promise<TransactionMutateResult>}
|
|
767
764
|
*/
|
|
768
765
|
deleteTransaction(portfolio, position, sequence, force, echoStart, echoEnd) {
|
|
769
766
|
return Promise.resolve()
|
|
@@ -802,7 +799,7 @@ module.exports = (() => {
|
|
|
802
799
|
* @public
|
|
803
800
|
* @param {String} portfolio
|
|
804
801
|
* @param {String=} position
|
|
805
|
-
* @returns {Promise
|
|
802
|
+
* @returns {Promise<Transaction[]>}
|
|
806
803
|
*/
|
|
807
804
|
readTransactions(portfolio, position) {
|
|
808
805
|
return Promise.resolve()
|
|
@@ -826,7 +823,7 @@ module.exports = (() => {
|
|
|
826
823
|
* @param {Day=} startDay
|
|
827
824
|
* @param {Day=} endDay
|
|
828
825
|
* @oaram {Boolean=} descending
|
|
829
|
-
* @returns {Promise
|
|
826
|
+
* @returns {Promise<Object[]>}
|
|
830
827
|
*/
|
|
831
828
|
readTransactionsFormatted(portfolio, position, startDay, endDay, descending) {
|
|
832
829
|
return Promise.resolve()
|
|
@@ -920,39 +917,13 @@ module.exports = (() => {
|
|
|
920
917
|
});
|
|
921
918
|
}
|
|
922
919
|
|
|
923
|
-
/**
|
|
924
|
-
* @public
|
|
925
|
-
* @param {String=} portfolio
|
|
926
|
-
* @param {PositionSummaryFrame} frame
|
|
927
|
-
* @param {Day} end
|
|
928
|
-
* @returns {Promise}
|
|
929
|
-
*/
|
|
930
|
-
downloadBrokerageReport(portfolio, frame, end) {
|
|
931
|
-
return Promise.resolve()
|
|
932
|
-
.then(() => {
|
|
933
|
-
checkStart.call(this);
|
|
934
|
-
|
|
935
|
-
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
936
|
-
assert.argumentIsRequired(frame, 'frame', PositionSummaryFrame, 'PositionSummaryFrame');
|
|
937
|
-
assert.argumentIsRequired(end, 'end', Day, 'Day');
|
|
938
|
-
|
|
939
|
-
const payload = { };
|
|
940
|
-
|
|
941
|
-
payload.portfolio = portfolio;
|
|
942
|
-
payload.frame = frame;
|
|
943
|
-
payload.start = end;
|
|
944
|
-
|
|
945
|
-
return Gateway.invoke(this._downloadBrokerageReportEndpoint, payload);
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
|
-
|
|
949
920
|
/**
|
|
950
921
|
* Creates and starts a new {@link PortfolioGateway} for use in the development environment.
|
|
951
922
|
*
|
|
952
923
|
* @public
|
|
953
924
|
* @static
|
|
954
|
-
* @param {RequestInterceptor=|Promise
|
|
955
|
-
* @returns {Promise
|
|
925
|
+
* @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
|
|
926
|
+
* @returns {Promise<PortfolioGateway>}
|
|
956
927
|
*/
|
|
957
928
|
static forDevelopment(requestInterceptor) {
|
|
958
929
|
return Promise.resolve(requestInterceptor)
|
|
@@ -968,8 +939,8 @@ module.exports = (() => {
|
|
|
968
939
|
*
|
|
969
940
|
* @public
|
|
970
941
|
* @static
|
|
971
|
-
* @param {RequestInterceptor=|Promise
|
|
972
|
-
* @returns {Promise
|
|
942
|
+
* @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
|
|
943
|
+
* @returns {Promise<PortfolioGateway>}
|
|
973
944
|
*/
|
|
974
945
|
static forStaging(requestInterceptor) {
|
|
975
946
|
return Promise.resolve(requestInterceptor)
|
|
@@ -985,8 +956,8 @@ module.exports = (() => {
|
|
|
985
956
|
*
|
|
986
957
|
* @public
|
|
987
958
|
* @static
|
|
988
|
-
* @param {RequestInterceptor=|Promise
|
|
989
|
-
* @returns {Promise
|
|
959
|
+
* @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
|
|
960
|
+
* @returns {Promise<PortfolioGateway>}
|
|
990
961
|
*/
|
|
991
962
|
static forProduction(requestInterceptor) {
|
|
992
963
|
return Promise.resolve(requestInterceptor)
|
|
@@ -1002,8 +973,8 @@ module.exports = (() => {
|
|
|
1002
973
|
*
|
|
1003
974
|
* @public
|
|
1004
975
|
* @static
|
|
1005
|
-
* @param {RequestInterceptor=|Promise
|
|
1006
|
-
* @returns {Promise
|
|
976
|
+
* @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
|
|
977
|
+
* @returns {Promise<PortfolioGateway>}
|
|
1007
978
|
*/
|
|
1008
979
|
static forAdmin(requestInterceptor) {
|
|
1009
980
|
return Promise.resolve(requestInterceptor)
|
|
@@ -1162,8 +1133,8 @@ module.exports = (() => {
|
|
|
1162
1133
|
*
|
|
1163
1134
|
* @typedef TransactionMutateResult
|
|
1164
1135
|
* @type {Object}
|
|
1165
|
-
* @property {
|
|
1166
|
-
* @property {
|
|
1136
|
+
* @property {Object[]} positions - All positions updated as a consequence of processing the transaction.
|
|
1137
|
+
* @property {Object[]} summaries - All position summaries updated as a consequence of processing the transaction.
|
|
1167
1138
|
* @property {Boolean} replaced - If true, the position (and position summaries) need to be replaced.
|
|
1168
1139
|
*/
|
|
1169
1140
|
|
|
@@ -45,7 +45,7 @@ module.exports = (() => {
|
|
|
45
45
|
* containing the current instance
|
|
46
46
|
*
|
|
47
47
|
* @public
|
|
48
|
-
* @returns {Promise
|
|
48
|
+
* @returns {Promise<JwtGateway>}
|
|
49
49
|
*/
|
|
50
50
|
start() {
|
|
51
51
|
return Promise.resolve()
|
|
@@ -71,7 +71,7 @@ module.exports = (() => {
|
|
|
71
71
|
* Retrieves a JWT token from the remote server.
|
|
72
72
|
*
|
|
73
73
|
* @public
|
|
74
|
-
* @returns {Promise
|
|
74
|
+
* @returns {Promise<String>}
|
|
75
75
|
*/
|
|
76
76
|
readToken() {
|
|
77
77
|
return Promise.resolve()
|
|
@@ -101,7 +101,7 @@ module.exports = (() => {
|
|
|
101
101
|
let cacheDisposable = null;
|
|
102
102
|
|
|
103
103
|
const refreshToken = () => {
|
|
104
|
-
const refreshPromise = scheduler.backoff(() => this.readToken(),
|
|
104
|
+
const refreshPromise = scheduler.backoff(() => this.readToken(), 0, 'Read JWT token', 3)
|
|
105
105
|
.then((token) => {
|
|
106
106
|
if (this._refreshInterval) {
|
|
107
107
|
cachePromise = refreshPromise;
|
|
@@ -159,7 +159,7 @@ module.exports = (() => {
|
|
|
159
159
|
* @static
|
|
160
160
|
* @param {String} userId - The identifier of the user to impersonate.
|
|
161
161
|
* @param {String} userLegacyId - The legacy identifier of the user to impersonate.
|
|
162
|
-
* @returns {Promise
|
|
162
|
+
* @returns {Promise<JwtGateway>}
|
|
163
163
|
*/
|
|
164
164
|
static forDevelopment(userId, userLegacyId) {
|
|
165
165
|
return start(new JwtGateway(forDevelopment(userId, userLegacyId), 180000));
|
|
@@ -171,7 +171,7 @@ module.exports = (() => {
|
|
|
171
171
|
* @public
|
|
172
172
|
* @static
|
|
173
173
|
* @param {String} userId - The identifier of the user to impersonate.
|
|
174
|
-
* @returns {Promise
|
|
174
|
+
* @returns {Promise<RequestInterceptor>}
|
|
175
175
|
*/
|
|
176
176
|
static forDevelopmentClient(userId, userLegacyId) {
|
|
177
177
|
return JwtGateway.forDevelopment(userId, userLegacyId)
|
|
@@ -185,8 +185,8 @@ module.exports = (() => {
|
|
|
185
185
|
*
|
|
186
186
|
* @public
|
|
187
187
|
* @static
|
|
188
|
-
* @param {Promise
|
|
189
|
-
* @returns {Promise
|
|
188
|
+
* @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
|
|
189
|
+
* @returns {Promise<JwtGateway>}
|
|
190
190
|
*/
|
|
191
191
|
static forStaging(externalRequestInterceptorPromise) {
|
|
192
192
|
return externalRequestInterceptorPromise.then((externalRequestInterceptor) => {
|
|
@@ -199,8 +199,8 @@ module.exports = (() => {
|
|
|
199
199
|
*
|
|
200
200
|
* @public
|
|
201
201
|
* @static
|
|
202
|
-
* @param {Promise
|
|
203
|
-
* @returns {Promise
|
|
202
|
+
* @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
|
|
203
|
+
* @returns {Promise<RequestInterceptor>}
|
|
204
204
|
*/
|
|
205
205
|
static forStagingClient(externalRequestInterceptorPromise) {
|
|
206
206
|
return JwtGateway.forStaging(externalRequestInterceptorPromise)
|
|
@@ -214,8 +214,8 @@ module.exports = (() => {
|
|
|
214
214
|
*
|
|
215
215
|
* @public
|
|
216
216
|
* @static
|
|
217
|
-
* @param {Promise
|
|
218
|
-
* @returns {Promise
|
|
217
|
+
* @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
|
|
218
|
+
* @returns {Promise<JwtGateway>}
|
|
219
219
|
*/
|
|
220
220
|
static forProduction(externalRequestInterceptorPromise) {
|
|
221
221
|
return externalRequestInterceptorPromise.then((externalRequestInterceptor) => {
|
|
@@ -228,8 +228,8 @@ module.exports = (() => {
|
|
|
228
228
|
*
|
|
229
229
|
* @public
|
|
230
230
|
* @static
|
|
231
|
-
* @param {Promise
|
|
232
|
-
* @returns {Promise
|
|
231
|
+
* @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
|
|
232
|
+
* @returns {Promise<RequestInterceptor>}
|
|
233
233
|
*/
|
|
234
234
|
static forProductionClient(externalRequestInterceptorPromise) {
|
|
235
235
|
return JwtGateway.forProduction(externalRequestInterceptorPromise)
|
|
@@ -245,7 +245,7 @@ module.exports = (() => {
|
|
|
245
245
|
* @static
|
|
246
246
|
* @param {String} userId - The identifier of the user to impersonate.
|
|
247
247
|
* @param {String} userLegacyId - The legacy identifier of the user to impersonate.
|
|
248
|
-
* @returns {Promise
|
|
248
|
+
* @returns {Promise<JwtGateway>}
|
|
249
249
|
*/
|
|
250
250
|
static forAdmin(userId, userLegacyId) {
|
|
251
251
|
return start(new JwtGateway(forAdmin(userId, userLegacyId), 180000));
|
|
@@ -257,7 +257,7 @@ module.exports = (() => {
|
|
|
257
257
|
* @public
|
|
258
258
|
* @static
|
|
259
259
|
* @param {String} userId - The identifier of the user to impersonate.
|
|
260
|
-
* @returns {Promise
|
|
260
|
+
* @returns {Promise<RequestInterceptor>}
|
|
261
261
|
*/
|
|
262
262
|
static forAdminClient(userId, userLegacyId) {
|
|
263
263
|
return JwtGateway.forAdmin(userId, userLegacyId)
|
|
@@ -298,7 +298,8 @@ module.exports = (() => {
|
|
|
298
298
|
.withProtocol(ProtocolType.HTTPS)
|
|
299
299
|
.withHost(Configuration.developmentHost)
|
|
300
300
|
.withPathBuilder((pb) => {
|
|
301
|
-
pb.withLiteralParameter('
|
|
301
|
+
pb.withLiteralParameter('json', 'json')
|
|
302
|
+
.withLiteralParameter('token', 'token')
|
|
302
303
|
.withLiteralParameter('barchart', 'barchart')
|
|
303
304
|
.withLiteralParameter('generator', 'generator');
|
|
304
305
|
})
|
|
@@ -317,7 +318,12 @@ module.exports = (() => {
|
|
|
317
318
|
.withVerb(VerbType.GET)
|
|
318
319
|
.withProtocol(ProtocolType.HTTPS)
|
|
319
320
|
.withHost(Configuration.stagingHost)
|
|
320
|
-
.withPathBuilder((pb) =>
|
|
321
|
+
.withPathBuilder((pb) => {
|
|
322
|
+
pb.withLiteralParameter('json', 'json')
|
|
323
|
+
.withLiteralParameter('token', 'token')
|
|
324
|
+
.withLiteralParameter('system', 'tgam')
|
|
325
|
+
.withLiteralParameter('converter', 'converter');
|
|
326
|
+
})
|
|
321
327
|
.withRequestInterceptor(externalRequestInterceptor)
|
|
322
328
|
.withResponseInterceptor(ResponseInterceptor.DATA)
|
|
323
329
|
.endpoint;
|
|
@@ -328,7 +334,12 @@ module.exports = (() => {
|
|
|
328
334
|
.withVerb(VerbType.GET)
|
|
329
335
|
.withProtocol(ProtocolType.HTTPS)
|
|
330
336
|
.withHost(Configuration.productionHost)
|
|
331
|
-
.withPathBuilder((pb) =>
|
|
337
|
+
.withPathBuilder((pb) => {
|
|
338
|
+
pb.withLiteralParameter('json', 'json')
|
|
339
|
+
.withLiteralParameter('token', 'token')
|
|
340
|
+
.withLiteralParameter('system', 'tgam')
|
|
341
|
+
.withLiteralParameter('converter', 'converter');
|
|
342
|
+
})
|
|
332
343
|
.withRequestInterceptor(externalRequestInterceptor)
|
|
333
344
|
.withResponseInterceptor(ResponseInterceptor.DATA)
|
|
334
345
|
.endpoint;
|
|
@@ -340,7 +351,8 @@ module.exports = (() => {
|
|
|
340
351
|
.withProtocol(ProtocolType.HTTPS)
|
|
341
352
|
.withHost(Configuration.adminHost)
|
|
342
353
|
.withPathBuilder((pb) => {
|
|
343
|
-
pb.withLiteralParameter('
|
|
354
|
+
pb.withLiteralParameter('json', 'json')
|
|
355
|
+
.withLiteralParameter('token', 'token')
|
|
344
356
|
.withLiteralParameter('barchart', 'barchart')
|
|
345
357
|
.withLiteralParameter('generator', 'generator');
|
|
346
358
|
})
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barchart/portfolio-client-js",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "JavaScript library for interfacing with Barchart's Portfolio API",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Bryan Ingle",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "git+ssh://git@github.com/barchart/barchart/
|
|
15
|
+
"url": "git+ssh://git@github.com/barchart/barchart/portfolio-client-js.git"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"Barchart",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"API"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@barchart/common-js": "~3.
|
|
25
|
-
"@barchart/tgam-jwt-js": "~1.
|
|
26
|
-
"@barchart/portfolio-api-common": "~1.
|
|
24
|
+
"@barchart/common-js": "~3.3.0",
|
|
25
|
+
"@barchart/tgam-jwt-js": "~1.3.0",
|
|
26
|
+
"@barchart/portfolio-api-common": "~1.3.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"babel-core": "^6.26.0",
|