@barchart/portfolio-client-js 1.2.8 → 1.2.9

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.
@@ -616,7 +616,13 @@ module.exports = function () {
616
616
  assert.argumentIsRequired(portfolio, 'portfolio', Object);
617
617
  assert.argumentIsArray(transactions, 'transactions', Object);
618
618
 
619
- var batchData = transactions.reduce(function (data, transaction) {
619
+ var batchData = {};
620
+
621
+ batchData.portfolio = portfolio;
622
+ batchData.transactionTypes = [];
623
+ batchData.transactionItems = [];
624
+
625
+ transactions.forEach(function (transaction) {
620
626
  transaction.portfolio = portfolio.portfolio;
621
627
 
622
628
  if (!transaction.position) {
@@ -626,13 +632,8 @@ module.exports = function () {
626
632
  var code = getTransactionTypeCode(transaction);
627
633
  var schema = getTransactionSchema(transaction);
628
634
 
629
- data.types.push(code);
630
- data.transactions.push(JSON.stringify(schema.schema.format(transaction)));
631
-
632
- return data;
633
- }, {
634
- types: [],
635
- transactions: []
635
+ batchData.transactionTypes.push(code);
636
+ batchData.transactionItems.push(JSON.stringify(schema.schema.format(transaction)));
636
637
  });
637
638
 
638
639
  return Gateway.invoke(_this13._batchTransactionEndpoint, batchData);
@@ -1321,7 +1322,7 @@ module.exports = function () {
1321
1322
  return {
1322
1323
  JwtGateway: JwtGateway,
1323
1324
  PortfolioGateway: PortfolioGateway,
1324
- version: '1.2.7'
1325
+ version: '1.2.9'
1325
1326
  };
1326
1327
  }();
1327
1328
 
@@ -262,11 +262,11 @@ module.exports = (() => {
262
262
  .withPort(port)
263
263
  .withPathBuilder((pb) => {
264
264
  pb.withLiteralParameter('portfolios', 'portfolios')
265
- .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
266
- .withLiteralParameter('positions', 'positions')
267
- .withVariableParameter('position', 'position', 'position', false)
268
- .withLiteralParameter('transactions', 'transactions')
269
- .withVariableParameter('sequence', 'sequence', 'sequence', false)
265
+ .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
266
+ .withLiteralParameter('positions', 'positions')
267
+ .withVariableParameter('position', 'position', 'position', false)
268
+ .withLiteralParameter('transactions', 'transactions')
269
+ .withVariableParameter('sequence', 'sequence', 'sequence', false);
270
270
  })
271
271
  .withQueryBuilder((qb) => {
272
272
  qb.withVariableParameter('type', 'type', 'type', false, t => getTransactionTypeCode(t));
@@ -624,7 +624,7 @@ module.exports = (() => {
624
624
  batchData.transactionTypes = [ ];
625
625
  batchData.transactionItems = [ ];
626
626
 
627
- const batchData = transactions.reduce((data, transaction) => {
627
+ transactions.forEach((transaction) => {
628
628
  transaction.portfolio = portfolio.portfolio;
629
629
 
630
630
  if (!transaction.position) {
@@ -634,11 +634,9 @@ module.exports = (() => {
634
634
  const code = getTransactionTypeCode(transaction);
635
635
  const schema = getTransactionSchema(transaction);
636
636
 
637
- data.transactionTypes.push(code);
638
- data.transactionItems.push(JSON.stringify(schema.schema.format(transaction)));
639
-
640
- return data;
641
- }, batchData);
637
+ batchData.transactionTypes.push(code);
638
+ batchData.transactionItems.push(JSON.stringify(schema.schema.format(transaction)));
639
+ });
642
640
 
643
641
  return Gateway.invoke(this._batchTransactionEndpoint, batchData);
644
642
  });
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.8'
10
+ version: '1.2.9'
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.8",
3
+ "version": "1.2.9",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",