@barchart/portfolio-client-js 1.3.13 → 1.3.14

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.
@@ -1,4 +1,5 @@
1
- const assert = require('@barchart/common-js/lang/assert'),
1
+ const array = require('@barchart/common-js/lang/array'),
2
+ assert = require('@barchart/common-js/lang/assert'),
2
3
  Day = require('@barchart/common-js/lang/Day'),
3
4
  Disposable = require('@barchart/common-js/lang/Disposable'),
4
5
  Enum = require('@barchart/common-js/lang/Enum'),
@@ -1124,7 +1125,16 @@ module.exports = (() => {
1124
1125
  const deleted = response.data.positions.deleted.map(p => JSON.parse(p, PositionSchema.CLIENT.schema.getReviver()));
1125
1126
  const summaries = response.data.summaries.map(s => JSON.parse(s, PositionSummarySchema.CLIENT.schema.getReviver()));
1126
1127
 
1128
+ let created = array.differenceBy(saved, deleted, extractInstrumentId);
1129
+ let removed = array.differenceBy(deleted, saved, extractInstrumentId);
1130
+ let edited = array.intersectionBy(saved, deleted, extractInstrumentId);
1131
+
1127
1132
  const returnRef = {
1133
+ actions: {
1134
+ created: created,
1135
+ removed: removed,
1136
+ edited: edited
1137
+ },
1128
1138
  positions: {
1129
1139
  saved: saved,
1130
1140
  deleted: deleted
@@ -1159,6 +1169,10 @@ module.exports = (() => {
1159
1169
  }
1160
1170
  }
1161
1171
 
1172
+ function extractInstrumentId(position) {
1173
+ return position.instrument.id;
1174
+ }
1175
+
1162
1176
  /**
1163
1177
  * The result of transaction create operation.
1164
1178
  *
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.3.13'
10
+ version: '1.3.14'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",