@barchart/portfolio-client-js 10.5.0 → 10.5.1

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.
@@ -17,6 +17,7 @@ const BrokerageReportAvailabilitySchema = require('@barchart/portfolio-api-commo
17
17
  TransactionSchema = require('@barchart/portfolio-api-common/lib/serialization/TransactionSchema');
18
18
 
19
19
  const PositionSummaryFrame = require('@barchart/portfolio-api-common/lib/data/PositionSummaryFrame'),
20
+ SnapTradeLinkMode = require('@barchart/portfolio-api-common/lib/data/SnapTradeLinkMode'),
20
21
  SnapTradeLinkStatus = require('@barchart/portfolio-api-common/lib/data/SnapTradeLinkStatus');
21
22
 
22
23
  const EndpointBuilder = require('@barchart/common-js/api/http/builders/EndpointBuilder'),
@@ -632,7 +633,7 @@ module.exports = (() => {
632
633
  .withVariableParameter('account', 'account', 'account', false);
633
634
  })
634
635
  .withQueryBuilder((qb) => {
635
- qb.withVariableParameter('openOnly', 'openOnly', 'openOnly', true);
636
+ qb.withVariableParameter('mode', 'mode', 'mode', true, mode => mode.code);
636
637
  })
637
638
  .withRequestInterceptor(requestInterceptor)
638
639
  .withResponseInterceptor(responseInterceptorForSnapTradeAccountLinkResponse)
@@ -674,7 +675,7 @@ module.exports = (() => {
674
675
  .withVariableParameter('account', 'account', 'account', false);
675
676
  })
676
677
  .withQueryBuilder((qb) => {
677
- qb.withVariableParameter('openOnly', 'openOnly', 'openOnly', true);
678
+ qb.withVariableParameter('mode', 'mode', 'mode', true, mode => mode.code);
678
679
  })
679
680
  .withRequestInterceptor(requestInterceptor)
680
681
  .withResponseInterceptor(responseInterceptorForSnapTradeAccountLinkResponse)
@@ -1554,20 +1555,20 @@ module.exports = (() => {
1554
1555
  * @async
1555
1556
  * @param {String} connection - The SnapTrade identifier for the brokerage connection.
1556
1557
  * @param {String} account - The SnapTrade identifier for the brokerage account.
1557
- * @param {Boolean=} openOnly - When true, links only open positions. When false, links all positions.
1558
+ * @param {SnapTradeLinkMode=} mode - The strategy used when importing positions into the linked portfolio.
1558
1559
  * @returns {Promise<Schema.SnapTradeLinkingReport>}
1559
1560
  */
1560
- async linkSnapTradeAccount(connection, account, openOnly) {
1561
+ async linkSnapTradeAccount(connection, account, mode) {
1561
1562
  checkStart.call(this);
1562
1563
 
1563
1564
  assert.argumentIsRequired(connection, 'connection', String);
1564
1565
  assert.argumentIsRequired(account, 'account', String);
1565
- assert.argumentIsOptional(openOnly, 'openOnly', Boolean);
1566
+ assert.argumentIsOptional(mode, 'mode', SnapTradeLinkMode, 'SnapTradeLinkMode');
1566
1567
 
1567
1568
  const payload = { connection, account };
1568
1569
 
1569
- if (is.boolean(openOnly)) {
1570
- payload.openOnly = openOnly;
1570
+ if (mode) {
1571
+ payload.mode = mode;
1571
1572
  }
1572
1573
 
1573
1574
  return Gateway.invoke(this._linkSnapTradeAccountEndpoint, payload);
@@ -1596,20 +1597,20 @@ module.exports = (() => {
1596
1597
  * @async
1597
1598
  * @param {String} connection - The SnapTrade identifier for the brokerage connection.
1598
1599
  * @param {String} account - The SnapTrade identifier for the brokerage account.
1599
- * @param {Boolean=} openOnly - When true, refreshes only open positions. When false, refreshes all positions.
1600
+ * @param {SnapTradeLinkMode=} mode - The strategy used when importing positions into the linked portfolio.
1600
1601
  * @returns {Promise<Schema.SnapTradeLinkingReport>}
1601
1602
  */
1602
- async refreshSnapTradeAccount(connection, account, openOnly) {
1603
+ async refreshSnapTradeAccount(connection, account, mode) {
1603
1604
  checkStart.call(this);
1604
1605
 
1605
1606
  assert.argumentIsRequired(connection, 'connection', String);
1606
1607
  assert.argumentIsRequired(account, 'account', String);
1607
- assert.argumentIsOptional(openOnly, 'openOnly', Boolean);
1608
+ assert.argumentIsOptional(mode, 'mode', SnapTradeLinkMode, 'SnapTradeLinkMode');
1608
1609
 
1609
1610
  const payload = { connection, account };
1610
1611
 
1611
- if (is.boolean(openOnly)) {
1612
- payload.openOnly = openOnly;
1612
+ if (mode) {
1613
+ payload.mode = mode;
1613
1614
  }
1614
1615
 
1615
1616
  return Gateway.invoke(this._refreshSnapTradeAccountEndpoint, payload);
@@ -1999,6 +2000,7 @@ module.exports = (() => {
1999
2000
 
2000
2001
  accounts.forEach((account) => {
2001
2002
  if (account.link) {
2003
+ account.link.mode = SnapTradeLinkMode.parse(account.link.mode);
2002
2004
  account.link.status = SnapTradeLinkStatus.parse(account.link.status);
2003
2005
  account.link.timestamp = Timestamp.parse(account.link.timestamp);
2004
2006
  }
package/lib/index.js CHANGED
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtProvider: JwtProvider,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '10.5.0'
10
+ version: '10.5.1'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "10.5.0",
3
+ "version": "10.5.1",
4
4
  "description": "JavaScript SDK for Barchart's Portfolio Service",
5
5
  "homepage": "https://docs.barchart.com/portfolio/#/",
6
6
  "author": {
@@ -16,6 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "scripts": {
19
+ "clean": "rm -rf node_modules",
19
20
  "test": "echo \"Error: Please use gulp to run tests\" && exit 1"
20
21
  },
21
22
  "repository": {
@@ -36,7 +37,7 @@
36
37
  ],
37
38
  "dependencies": {
38
39
  "@barchart/common-js": "^4.70.0",
39
- "@barchart/portfolio-api-common": "^7.4.0"
40
+ "@barchart/portfolio-api-common": "^7.5.2"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@babel/core": "^7.11.1",