@barchart/portfolio-client-js 1.2.39 → 1.2.42

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.
@@ -62,20 +62,6 @@ module.exports = function () {
62
62
  return '[Configuration]';
63
63
  }
64
64
  }], [{
65
- key: 'localHost',
66
- get: function get() {
67
- return '127.0.0.1';
68
- }
69
-
70
- /**
71
- * The host of the development system.
72
- *
73
- * @public
74
- * @static
75
- * @returns {String}
76
- */
77
-
78
- }, {
79
65
  key: 'developmentHost',
80
66
  get: function get() {
81
67
  return 'ldnddf3nsh.execute-api.us-east-1.amazonaws.com/dev';
@@ -998,17 +984,17 @@ module.exports = function () {
998
984
  return this._environment;
999
985
  }
1000
986
  }], [{
1001
- key: 'forLocal',
1002
- value: function forLocal(requestInterceptor) {
987
+ key: 'forDevelopment',
988
+ value: function forDevelopment(requestInterceptor) {
1003
989
  return Promise.resolve(requestInterceptor).then(function (requestInterceptor) {
1004
990
  assert.argumentIsOptional(requestInterceptor, 'requestInterceptor', RequestInterceptor, 'RequestInterceptor');
1005
991
 
1006
- return start(new PortfolioGateway('http', Configuration.localHost, 3000, requestInterceptor));
992
+ return start(new PortfolioGateway('https', Configuration.developmentHost, 443, 'development', requestInterceptor));
1007
993
  });
1008
994
  }
1009
995
 
1010
996
  /**
1011
- * Creates and starts a new {@link PortfolioGateway} for use in the development environment.
997
+ * Creates and starts a new {@link PortfolioGateway} for use in the staging environment.
1012
998
  *
1013
999
  * @public
1014
1000
  * @static
@@ -1017,17 +1003,17 @@ module.exports = function () {
1017
1003
  */
1018
1004
 
1019
1005
  }, {
1020
- key: 'forDevelopment',
1021
- value: function forDevelopment(requestInterceptor) {
1006
+ key: 'forStaging',
1007
+ value: function forStaging(requestInterceptor) {
1022
1008
  return Promise.resolve(requestInterceptor).then(function (requestInterceptor) {
1023
1009
  assert.argumentIsOptional(requestInterceptor, 'requestInterceptor', RequestInterceptor, 'RequestInterceptor');
1024
1010
 
1025
- return start(new PortfolioGateway('https', Configuration.developmentHost, 443, 'development', requestInterceptor));
1011
+ return start(new PortfolioGateway('https', Configuration.stagingHost, 443, 'staging', requestInterceptor));
1026
1012
  });
1027
1013
  }
1028
1014
 
1029
1015
  /**
1030
- * Creates and starts a new {@link PortfolioGateway} for use in the staging environment.
1016
+ * Creates and starts a new {@link PortfolioGateway} for use in the production environment.
1031
1017
  *
1032
1018
  * @public
1033
1019
  * @static
@@ -1036,17 +1022,17 @@ module.exports = function () {
1036
1022
  */
1037
1023
 
1038
1024
  }, {
1039
- key: 'forStaging',
1040
- value: function forStaging(requestInterceptor) {
1025
+ key: 'forProduction',
1026
+ value: function forProduction(requestInterceptor) {
1041
1027
  return Promise.resolve(requestInterceptor).then(function (requestInterceptor) {
1042
1028
  assert.argumentIsOptional(requestInterceptor, 'requestInterceptor', RequestInterceptor, 'RequestInterceptor');
1043
1029
 
1044
- return start(new PortfolioGateway('https', Configuration.stagingHost, 443, 'staging', requestInterceptor));
1030
+ return start(new PortfolioGateway('https', Configuration.productionHost, 443, 'production', requestInterceptor));
1045
1031
  });
1046
1032
  }
1047
1033
 
1048
1034
  /**
1049
- * Creates and starts a new {@link PortfolioGateway} for use in the production environment.
1035
+ * Creates and starts a new {@link PortfolioGateway} for use in the administration environment.
1050
1036
  *
1051
1037
  * @public
1052
1038
  * @static
@@ -1055,12 +1041,12 @@ module.exports = function () {
1055
1041
  */
1056
1042
 
1057
1043
  }, {
1058
- key: 'forProduction',
1059
- value: function forProduction(requestInterceptor) {
1044
+ key: 'forAdmin',
1045
+ value: function forAdmin(requestInterceptor) {
1060
1046
  return Promise.resolve(requestInterceptor).then(function (requestInterceptor) {
1061
1047
  assert.argumentIsOptional(requestInterceptor, 'requestInterceptor', RequestInterceptor, 'RequestInterceptor');
1062
1048
 
1063
- return start(new PortfolioGateway('https', Configuration.productionHost, 443, 'production', requestInterceptor));
1049
+ return start(new PortfolioGateway('https', Configuration.adminHost, 443, 'admin', requestInterceptor));
1064
1050
  });
1065
1051
  }
1066
1052
  }]);
@@ -1585,10 +1571,18 @@ module.exports = function () {
1585
1571
  }
1586
1572
 
1587
1573
  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) {
1574
+ return EndpointBuilder.for('read-jwt-token-for-admin', 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.adminHost).withPathBuilder(function (pb) {
1589
1575
  pb.withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
1590
1576
  }).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');
1577
+ if (userId) {
1578
+ qb.withLiteralParameter('user', 'userId', userId);
1579
+ }
1580
+
1581
+ if (legacyUserId) {
1582
+ qb.withLiteralParameter('legacy user', 'userLegacyId', legacyUserId);
1583
+ }
1584
+
1585
+ qb.withLiteralParameter('user context', 'userContext', 'TGAM').withLiteralParameter('user permission level', 'userPermissions', 'registered');
1592
1586
  }).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
1593
1587
  }
1594
1588
 
@@ -1607,7 +1601,7 @@ module.exports = function () {
1607
1601
  return {
1608
1602
  JwtGateway: JwtGateway,
1609
1603
  PortfolioGateway: PortfolioGateway,
1610
- version: '1.2.39'
1604
+ version: '1.2.42'
1611
1605
  };
1612
1606
  }();
1613
1607
 
@@ -11,17 +11,6 @@ module.exports = (() => {
11
11
 
12
12
  }
13
13
 
14
- /**
15
- * The host of the development system.
16
- *
17
- * @public
18
- * @static
19
- * @returns {String}
20
- */
21
- static get localHost() {
22
- return '127.0.0.1';
23
- }
24
-
25
14
  /**
26
15
  * The host of the development system.
27
16
  *
@@ -954,63 +954,63 @@ module.exports = (() => {
954
954
  * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
955
955
  * @returns {Promise.<PortfolioGateway>}
956
956
  */
957
- static forLocal(requestInterceptor) {
957
+ static forDevelopment(requestInterceptor) {
958
958
  return Promise.resolve(requestInterceptor)
959
959
  .then((requestInterceptor) => {
960
960
  assert.argumentIsOptional(requestInterceptor, 'requestInterceptor', RequestInterceptor, 'RequestInterceptor');
961
961
 
962
- return start(new PortfolioGateway('http', Configuration.localHost, 3000, requestInterceptor));
962
+ return start(new PortfolioGateway('https', Configuration.developmentHost, 443, 'development', requestInterceptor));
963
963
  });
964
964
  }
965
965
 
966
966
  /**
967
- * Creates and starts a new {@link PortfolioGateway} for use in the development environment.
967
+ * Creates and starts a new {@link PortfolioGateway} for use in the staging environment.
968
968
  *
969
969
  * @public
970
970
  * @static
971
971
  * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
972
972
  * @returns {Promise.<PortfolioGateway>}
973
973
  */
974
- static forDevelopment(requestInterceptor) {
974
+ static forStaging(requestInterceptor) {
975
975
  return Promise.resolve(requestInterceptor)
976
976
  .then((requestInterceptor) => {
977
977
  assert.argumentIsOptional(requestInterceptor, 'requestInterceptor', RequestInterceptor, 'RequestInterceptor');
978
978
 
979
- return start(new PortfolioGateway('https', Configuration.developmentHost, 443, 'development', requestInterceptor));
979
+ return start(new PortfolioGateway('https', Configuration.stagingHost, 443, 'staging', requestInterceptor));
980
980
  });
981
981
  }
982
982
 
983
983
  /**
984
- * Creates and starts a new {@link PortfolioGateway} for use in the staging environment.
984
+ * Creates and starts a new {@link PortfolioGateway} for use in the production environment.
985
985
  *
986
986
  * @public
987
987
  * @static
988
988
  * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
989
989
  * @returns {Promise.<PortfolioGateway>}
990
990
  */
991
- static forStaging(requestInterceptor) {
991
+ static forProduction(requestInterceptor) {
992
992
  return Promise.resolve(requestInterceptor)
993
993
  .then((requestInterceptor) => {
994
994
  assert.argumentIsOptional(requestInterceptor, 'requestInterceptor', RequestInterceptor, 'RequestInterceptor');
995
995
 
996
- return start(new PortfolioGateway('https', Configuration.stagingHost, 443, 'staging', requestInterceptor));
996
+ return start(new PortfolioGateway('https', Configuration.productionHost, 443, 'production', requestInterceptor));
997
997
  });
998
998
  }
999
999
 
1000
1000
  /**
1001
- * Creates and starts a new {@link PortfolioGateway} for use in the production environment.
1001
+ * Creates and starts a new {@link PortfolioGateway} for use in the administration environment.
1002
1002
  *
1003
1003
  * @public
1004
1004
  * @static
1005
1005
  * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
1006
1006
  * @returns {Promise.<PortfolioGateway>}
1007
1007
  */
1008
- static forProduction(requestInterceptor) {
1008
+ static forAdmin(requestInterceptor) {
1009
1009
  return Promise.resolve(requestInterceptor)
1010
1010
  .then((requestInterceptor) => {
1011
1011
  assert.argumentIsOptional(requestInterceptor, 'requestInterceptor', RequestInterceptor, 'RequestInterceptor');
1012
1012
 
1013
- return start(new PortfolioGateway('https', Configuration.productionHost, 443, 'production', requestInterceptor));
1013
+ return start(new PortfolioGateway('https', Configuration.adminHost, 443, 'admin', requestInterceptor));
1014
1014
  });
1015
1015
  }
1016
1016
 
@@ -335,23 +335,29 @@ module.exports = (() => {
335
335
  }
336
336
 
337
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;
338
+ return EndpointBuilder.for('read-jwt-token-for-admin', '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
+ if (userId) {
349
+ qb.withLiteralParameter('user', 'userId', userId);
350
+ }
351
+
352
+ if (legacyUserId) {
353
+ qb.withLiteralParameter('legacy user', 'userLegacyId', legacyUserId);
354
+ }
355
+
356
+ qb.withLiteralParameter('user context', 'userContext', 'TGAM')
357
+ .withLiteralParameter('user permission level', 'userPermissions', 'registered');
358
+ })
359
+ .withResponseInterceptor(ResponseInterceptor.DATA)
360
+ .endpoint;
355
361
  }
356
362
 
357
363
  return JwtGateway;
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.39'
10
+ version: '1.2.42'
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.39",
3
+ "version": "1.2.42",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",