@barchart/portfolio-client-js 1.2.36 → 1.2.39

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.
@@ -78,7 +78,7 @@ module.exports = function () {
78
78
  }, {
79
79
  key: 'developmentHost',
80
80
  get: function get() {
81
- return 'y0glq1g3x7.execute-api.us-east-1.amazonaws.com/dev';
81
+ return 'ldnddf3nsh.execute-api.us-east-1.amazonaws.com/dev';
82
82
  }
83
83
 
84
84
  /**
@@ -108,6 +108,20 @@ module.exports = function () {
108
108
  get: function get() {
109
109
  return 'o77obtxxr4.execute-api.us-east-1.amazonaws.com/prod';
110
110
  }
111
+
112
+ /**
113
+ * The host of the internal admin system.
114
+ *
115
+ * @public
116
+ * @static
117
+ * @return {String}
118
+ */
119
+
120
+ }, {
121
+ key: 'adminHost',
122
+ get: function get() {
123
+ return '38moiq7ek9.execute-api.us-east-1.amazonaws.com/admin';
124
+ }
111
125
  }]);
112
126
 
113
127
  return Configuration;
@@ -282,7 +296,7 @@ module.exports = function () {
282
296
  }).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
283
297
 
284
298
  _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('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('summaries', 'summaries').withLiteralParameter('ranges', 'ranges');
299
+ pb.withLiteralParameter('reports', 'reports').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('availability', 'availability');
286
300
  }).withQueryBuilder(function (qb) {
287
301
  qb.withVariableParameter('frames', 'frames', 'frames', true, function (frames) {
288
302
  return frames.map(function (f) {
@@ -1216,8 +1230,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
1216
1230
 
1217
1231
  var assert = require('@barchart/common-js/lang/assert'),
1218
1232
  Disposable = require('@barchart/common-js/lang/Disposable'),
1219
- Enum = require('@barchart/common-js/lang/Enum'),
1220
- is = require('@barchart/common-js/lang/is'),
1221
1233
  Scheduler = require('@barchart/common-js/timing/Scheduler');
1222
1234
 
1223
1235
  var EndpointBuilder = require('@barchart/common-js/api/http/builders/EndpointBuilder'),
@@ -1411,7 +1423,7 @@ module.exports = function () {
1411
1423
  }], [{
1412
1424
  key: 'forDevelopment',
1413
1425
  value: function forDevelopment(userId, userLegacyId) {
1414
- return start(new JwtGateway(_forDevelopment(userId, userLegacyId), 60000));
1426
+ return start(new JwtGateway(_forDevelopment(userId, userLegacyId), 180000));
1415
1427
  }
1416
1428
 
1417
1429
  /**
@@ -1498,6 +1510,39 @@ module.exports = function () {
1498
1510
  return jwtGateway.toRequestInterceptor();
1499
1511
  });
1500
1512
  }
1513
+
1514
+ /**
1515
+ * Creates and starts a new {@link JwtGateway} for use in the internal admin environment.
1516
+ *
1517
+ * @public
1518
+ * @static
1519
+ * @param {String} userId - The identifier of the user to impersonate.
1520
+ * @param {String} userLegacyId - The legacy identifier of the user to impersonate.
1521
+ * @returns {Promise.<JwtGateway>}
1522
+ */
1523
+
1524
+ }, {
1525
+ key: 'forAdmin',
1526
+ value: function forAdmin(userId, userLegacyId) {
1527
+ return start(new JwtGateway(_forAdmin(userId, userLegacyId), 180000));
1528
+ }
1529
+
1530
+ /**
1531
+ * Creates and starts a new {@link RequestInterceptor} for use in the internal admin environment.
1532
+ *
1533
+ * @public
1534
+ * @static
1535
+ * @param {String} userId - The identifier of the user to impersonate.
1536
+ * @returns {Promise.<RequestInterceptor>}
1537
+ */
1538
+
1539
+ }, {
1540
+ key: 'forAdminClient',
1541
+ value: function forAdminClient(userId, userLegacyId) {
1542
+ return JwtGateway.forAdmin(userId, userLegacyId).then(function (jwtGateway) {
1543
+ return jwtGateway.toRequestInterceptor();
1544
+ });
1545
+ }
1501
1546
  }]);
1502
1547
 
1503
1548
  return JwtGateway;
@@ -1539,10 +1584,18 @@ module.exports = function () {
1539
1584
  }).withRequestInterceptor(externalRequestInterceptor).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
1540
1585
  }
1541
1586
 
1587
+ function _forAdmin(userId, legacyUserId) {
1588
+ return EndpointBuilder.for('read-jwt-token-for-development', 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.adminHost).withPathBuilder(function (pb) {
1589
+ pb.withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
1590
+ }).withQueryBuilder(function (qb) {
1591
+ qb.withLiteralParameter('user', 'userId', userId).withLiteralParameter('legacy user', 'userLegacyId', legacyUserId).withLiteralParameter('user context', 'userContext', 'TGAM').withLiteralParameter('user permission level', 'userPermissions', 'registered');
1592
+ }).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
1593
+ }
1594
+
1542
1595
  return JwtGateway;
1543
1596
  }();
1544
1597
 
1545
- },{"./../../common/Configuration":2,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/failures/FailureType":8,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/Endpoint":12,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/timing/Scheduler":50}],5:[function(require,module,exports){
1598
+ },{"./../../common/Configuration":2,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/failures/FailureType":8,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/Endpoint":12,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/assert":37,"@barchart/common-js/timing/Scheduler":50}],5:[function(require,module,exports){
1546
1599
  'use strict';
1547
1600
 
1548
1601
  var JwtGateway = require('./gateway/jwt/JwtGateway'),
@@ -1554,7 +1607,7 @@ module.exports = function () {
1554
1607
  return {
1555
1608
  JwtGateway: JwtGateway,
1556
1609
  PortfolioGateway: PortfolioGateway,
1557
- version: '1.2.36'
1610
+ version: '1.2.39'
1558
1611
  };
1559
1612
  }();
1560
1613
 
@@ -30,7 +30,7 @@ module.exports = (() => {
30
30
  * @returns {String}
31
31
  */
32
32
  static get developmentHost() {
33
- return 'y0glq1g3x7.execute-api.us-east-1.amazonaws.com/dev';
33
+ return 'ldnddf3nsh.execute-api.us-east-1.amazonaws.com/dev';
34
34
  }
35
35
 
36
36
  /**
@@ -55,6 +55,17 @@ module.exports = (() => {
55
55
  return 'o77obtxxr4.execute-api.us-east-1.amazonaws.com/prod';
56
56
  }
57
57
 
58
+ /**
59
+ * The host of the internal admin system.
60
+ *
61
+ * @public
62
+ * @static
63
+ * @return {String}
64
+ */
65
+ static get adminHost() {
66
+ return '38moiq7ek9.execute-api.us-east-1.amazonaws.com/admin';
67
+ }
68
+
58
69
  toString() {
59
70
  return '[Configuration]';
60
71
  }
@@ -334,10 +334,10 @@ module.exports = (() => {
334
334
  .withHost(host)
335
335
  .withPort(port)
336
336
  .withPathBuilder((pb) => {
337
- pb.withLiteralParameter('portfolios', 'portfolios')
338
- .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
339
- .withLiteralParameter('summaries', 'summaries')
340
- .withLiteralParameter('ranges', 'ranges');
337
+ pb.withLiteralParameter('reports', 'reports')
338
+ .withLiteralParameter('portfolios', 'portfolios')
339
+ .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
340
+ .withLiteralParameter('availability', 'availability');
341
341
  })
342
342
  .withQueryBuilder((qb) => {
343
343
  qb.withVariableParameter('frames', 'frames', 'frames', true, frames => frames.map(f => f.code).join());
@@ -1,7 +1,5 @@
1
1
  const assert = require('@barchart/common-js/lang/assert'),
2
2
  Disposable = require('@barchart/common-js/lang/Disposable'),
3
- Enum = require('@barchart/common-js/lang/Enum'),
4
- is = require('@barchart/common-js/lang/is'),
5
3
  Scheduler = require('@barchart/common-js/timing/Scheduler');
6
4
 
7
5
  const EndpointBuilder = require('@barchart/common-js/api/http/builders/EndpointBuilder'),
@@ -164,7 +162,7 @@ module.exports = (() => {
164
162
  * @returns {Promise.<JwtGateway>}
165
163
  */
166
164
  static forDevelopment(userId, userLegacyId) {
167
- return start(new JwtGateway(forDevelopment(userId, userLegacyId), 60000));
165
+ return start(new JwtGateway(forDevelopment(userId, userLegacyId), 180000));
168
166
  }
169
167
 
170
168
  /**
@@ -240,6 +238,34 @@ module.exports = (() => {
240
238
  });
241
239
  }
242
240
 
241
+ /**
242
+ * Creates and starts a new {@link JwtGateway} for use in the internal admin environment.
243
+ *
244
+ * @public
245
+ * @static
246
+ * @param {String} userId - The identifier of the user to impersonate.
247
+ * @param {String} userLegacyId - The legacy identifier of the user to impersonate.
248
+ * @returns {Promise.<JwtGateway>}
249
+ */
250
+ static forAdmin(userId, userLegacyId) {
251
+ return start(new JwtGateway(forAdmin(userId, userLegacyId), 180000));
252
+ }
253
+
254
+ /**
255
+ * Creates and starts a new {@link RequestInterceptor} for use in the internal admin environment.
256
+ *
257
+ * @public
258
+ * @static
259
+ * @param {String} userId - The identifier of the user to impersonate.
260
+ * @returns {Promise.<RequestInterceptor>}
261
+ */
262
+ static forAdminClient(userId, userLegacyId) {
263
+ return JwtGateway.forAdmin(userId, userLegacyId)
264
+ .then((jwtGateway) => {
265
+ return jwtGateway.toRequestInterceptor();
266
+ });
267
+ }
268
+
243
269
  _onDispose() {
244
270
  return;
245
271
  }
@@ -308,5 +334,25 @@ module.exports = (() => {
308
334
  .endpoint;
309
335
  }
310
336
 
337
+ function forAdmin(userId, legacyUserId) {
338
+ return EndpointBuilder.for('read-jwt-token-for-development', 'lookup user identity')
339
+ .withVerb(VerbType.GET)
340
+ .withProtocol(ProtocolType.HTTPS)
341
+ .withHost(Configuration.adminHost)
342
+ .withPathBuilder((pb) => {
343
+ pb.withLiteralParameter('token', 'token')
344
+ .withLiteralParameter('barchart', 'barchart')
345
+ .withLiteralParameter('generator', 'generator');
346
+ })
347
+ .withQueryBuilder((qb) => {
348
+ qb.withLiteralParameter('user', 'userId', userId)
349
+ .withLiteralParameter('legacy user', 'userLegacyId', legacyUserId)
350
+ .withLiteralParameter('user context', 'userContext', 'TGAM')
351
+ .withLiteralParameter('user permission level', 'userPermissions', 'registered');
352
+ })
353
+ .withResponseInterceptor(ResponseInterceptor.DATA)
354
+ .endpoint;
355
+ }
356
+
311
357
  return JwtGateway;
312
358
  })();
package/lib/index.js CHANGED
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtGateway: JwtGateway,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '1.2.36'
10
+ version: '1.2.39'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "1.2.36",
3
+ "version": "1.2.39",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",