@barchart/portfolio-api-common 1.0.249 → 1.0.253

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.
@@ -88,7 +88,7 @@ module.exports = (() => {
88
88
  .withField('open', DataType.BOOLEAN, true)
89
89
  .withField('transaction', DataType.NUMBER)
90
90
  .withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
91
- .withField('reinvest', DataType.BOOLEAN)
91
+ .withField('reinvest', DataType.BOOLEAN, true)
92
92
  .withField('snapshot.date', DataType.DAY)
93
93
  .withField('snapshot.open', DataType.DECIMAL)
94
94
  .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
@@ -120,7 +120,7 @@ module.exports = (() => {
120
120
  .withField('open', DataType.BOOLEAN, true)
121
121
  .withField('transaction', DataType.NUMBER)
122
122
  .withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
123
- .withField('reinvest', DataType.BOOLEAN)
123
+ .withField('reinvest', DataType.BOOLEAN, true)
124
124
  .withField('snapshot.date', DataType.DAY)
125
125
  .withField('snapshot.open', DataType.DECIMAL)
126
126
  .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
@@ -258,6 +258,7 @@ module.exports = (() => {
258
258
  .withField('quantity', DataType.DECIMAL)
259
259
  .withField('fee', DataType.DECIMAL, true)
260
260
  .withField('force', DataType.BOOLEAN, true)
261
+ .withField('reinvest', DataType.BOOLEAN, true)
261
262
  .schema
262
263
  );
263
264
 
@@ -282,6 +283,7 @@ module.exports = (() => {
282
283
  .withField('quantity', DataType.DECIMAL)
283
284
  .withField('fee', DataType.DECIMAL, true)
284
285
  .withField('force', DataType.BOOLEAN, true)
286
+ .withField('reinvest', DataType.BOOLEAN, true)
285
287
  .schema
286
288
  );
287
289
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.249",
3
+ "version": "1.0.253",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -3830,6 +3830,33 @@ module.exports = function () {
3830
3830
  }
3831
3831
  }
3832
3832
 
3833
+ /**
3834
+ * Climbs the tree, evaluating each parent until a predicate is matched. Once matched,
3835
+ * the {@link Tree} node is returned. Otherwise, if the predicate cannot be matched,
3836
+ * a null value is returned.
3837
+ *
3838
+ * @public
3839
+ * @param {Tree~nodePredicate} predicate - A predicate that tests each child node. The predicate takes two arguments -- the node's value, and the node itself.
3840
+ * @param {boolean=} includeCurrentNode - If true, the predicate will be applied to the current node.
3841
+ * @returns {Tree|null}
3842
+ */
3843
+
3844
+ }, {
3845
+ key: 'findParent',
3846
+ value: function findParent(predicate, includeCurrentNode) {
3847
+ var returnRef = void 0;
3848
+
3849
+ if (is.boolean(includeCurrentNode) && includeCurrentNode && predicate(this.getValue(), this)) {
3850
+ returnRef = this;
3851
+ } else if (this._parent !== null) {
3852
+ returnRef = this._parent.findParent(predicate, true);
3853
+ } else {
3854
+ returnRef = null;
3855
+ }
3856
+
3857
+ return returnRef;
3858
+ }
3859
+
3833
3860
  /**
3834
3861
  * Creates a representation of the tree using JavaScript objects and arrays.
3835
3862
  *