@barchart/portfolio-api-common 1.0.180 → 1.0.181
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.
|
@@ -629,7 +629,7 @@ module.exports = (() => {
|
|
|
629
629
|
const items = populatedObjects[key];
|
|
630
630
|
const first = items[0];
|
|
631
631
|
|
|
632
|
-
list.push(new PositionGroup(this, parent, levelDefinition, items, levelDefinition.currencySelector(first), key, levelDefinition.descriptionSelector(first), levelDefinition.
|
|
632
|
+
list.push(new PositionGroup(this, parent, levelDefinition, items, levelDefinition.currencySelector(first), key, levelDefinition.descriptionSelector(first), levelDefinition.aggregateCash));
|
|
633
633
|
|
|
634
634
|
return list;
|
|
635
635
|
}, [ ]);
|
|
@@ -28,11 +28,10 @@ module.exports = (() => {
|
|
|
28
28
|
* @param {Currency} currency
|
|
29
29
|
* @param {String} key
|
|
30
30
|
* @param {String} description
|
|
31
|
-
* @param {Boolean=} single
|
|
32
31
|
* @param {Boolean=} aggregateCash
|
|
33
32
|
*/
|
|
34
33
|
class PositionGroup {
|
|
35
|
-
constructor(container, parent, definition, items, currency, key, description,
|
|
34
|
+
constructor(container, parent, definition, items, currency, key, description, aggregateCash) {
|
|
36
35
|
this._id = counter++;
|
|
37
36
|
|
|
38
37
|
this._definition = definition;
|
|
@@ -46,7 +45,7 @@ module.exports = (() => {
|
|
|
46
45
|
this._key = key;
|
|
47
46
|
this._description = description;
|
|
48
47
|
|
|
49
|
-
this._single =
|
|
48
|
+
this._single = this._definition.single;
|
|
50
49
|
this._aggregateCash = is.boolean(aggregateCash) && aggregateCash;
|
|
51
50
|
|
|
52
51
|
this._excluded = false;
|
|
@@ -20,12 +20,11 @@ module.exports = (() => {
|
|
|
20
20
|
* @param {PositionLevelDefinition~descriptionSelector} descriptionSelector
|
|
21
21
|
* @param {PositionLevelDefinition~currencySelector} currencySelector
|
|
22
22
|
* @param {Array.<PositionLevelDefinition~RequiredGroup>=} requiredGroups
|
|
23
|
-
* @param {Boolean=} single
|
|
24
23
|
* @param {Boolean=} aggregateCash
|
|
25
24
|
* @param {Function=} requiredGroupGenerator
|
|
26
25
|
*/
|
|
27
26
|
class PositionLevelDefinition {
|
|
28
|
-
constructor(name, type, keySelector, descriptionSelector, currencySelector, requiredGroups,
|
|
27
|
+
constructor(name, type, keySelector, descriptionSelector, currencySelector, requiredGroups, aggregateCash, requiredGroupGenerator) {
|
|
29
28
|
assert.argumentIsRequired(name, 'name', String);
|
|
30
29
|
assert.argumentIsRequired(type, 'type', PositionLevelType, 'PositionLevelType');
|
|
31
30
|
assert.argumentIsRequired(keySelector, 'keySelector', Function);
|
|
@@ -36,7 +35,6 @@ module.exports = (() => {
|
|
|
36
35
|
assert.argumentIsArray(requiredGroups, 'requiredGroups', String);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
assert.argumentIsOptional(single, 'single', Boolean);
|
|
40
38
|
assert.argumentIsOptional(aggregateCash, 'aggregateCash', Boolean);
|
|
41
39
|
assert.argumentIsOptional(requiredGroupGenerator, 'requiredGroupGenerator', Function);
|
|
42
40
|
|
|
@@ -49,7 +47,7 @@ module.exports = (() => {
|
|
|
49
47
|
|
|
50
48
|
this._requiredGroups = requiredGroups || [ ];
|
|
51
49
|
|
|
52
|
-
this._single =
|
|
50
|
+
this._single = type === PositionLevelType.POSITION;
|
|
53
51
|
this._aggregateCash = is.boolean(aggregateCash) && aggregateCash;
|
|
54
52
|
|
|
55
53
|
this._requiredGroupGenerator = requiredGroupGenerator || (input => null);
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1345,7 +1345,7 @@ module.exports = (() => {
|
|
|
1345
1345
|
const items = populatedObjects[key];
|
|
1346
1346
|
const first = items[0];
|
|
1347
1347
|
|
|
1348
|
-
list.push(new PositionGroup(this, parent, levelDefinition, items, levelDefinition.currencySelector(first), key, levelDefinition.descriptionSelector(first), levelDefinition.
|
|
1348
|
+
list.push(new PositionGroup(this, parent, levelDefinition, items, levelDefinition.currencySelector(first), key, levelDefinition.descriptionSelector(first), levelDefinition.aggregateCash));
|
|
1349
1349
|
|
|
1350
1350
|
return list;
|
|
1351
1351
|
}, [ ]);
|
|
@@ -1554,11 +1554,10 @@ module.exports = (() => {
|
|
|
1554
1554
|
* @param {Currency} currency
|
|
1555
1555
|
* @param {String} key
|
|
1556
1556
|
* @param {String} description
|
|
1557
|
-
* @param {Boolean=} single
|
|
1558
1557
|
* @param {Boolean=} aggregateCash
|
|
1559
1558
|
*/
|
|
1560
1559
|
class PositionGroup {
|
|
1561
|
-
constructor(container, parent, definition, items, currency, key, description,
|
|
1560
|
+
constructor(container, parent, definition, items, currency, key, description, aggregateCash) {
|
|
1562
1561
|
this._id = counter++;
|
|
1563
1562
|
|
|
1564
1563
|
this._definition = definition;
|
|
@@ -1572,7 +1571,7 @@ module.exports = (() => {
|
|
|
1572
1571
|
this._key = key;
|
|
1573
1572
|
this._description = description;
|
|
1574
1573
|
|
|
1575
|
-
this._single =
|
|
1574
|
+
this._single = this._definition.single;
|
|
1576
1575
|
this._aggregateCash = is.boolean(aggregateCash) && aggregateCash;
|
|
1577
1576
|
|
|
1578
1577
|
this._excluded = false;
|
|
@@ -2711,12 +2710,11 @@ module.exports = (() => {
|
|
|
2711
2710
|
* @param {PositionLevelDefinition~descriptionSelector} descriptionSelector
|
|
2712
2711
|
* @param {PositionLevelDefinition~currencySelector} currencySelector
|
|
2713
2712
|
* @param {Array.<PositionLevelDefinition~RequiredGroup>=} requiredGroups
|
|
2714
|
-
* @param {Boolean=} single
|
|
2715
2713
|
* @param {Boolean=} aggregateCash
|
|
2716
2714
|
* @param {Function=} requiredGroupGenerator
|
|
2717
2715
|
*/
|
|
2718
2716
|
class PositionLevelDefinition {
|
|
2719
|
-
constructor(name, type, keySelector, descriptionSelector, currencySelector, requiredGroups,
|
|
2717
|
+
constructor(name, type, keySelector, descriptionSelector, currencySelector, requiredGroups, aggregateCash, requiredGroupGenerator) {
|
|
2720
2718
|
assert.argumentIsRequired(name, 'name', String);
|
|
2721
2719
|
assert.argumentIsRequired(type, 'type', PositionLevelType, 'PositionLevelType');
|
|
2722
2720
|
assert.argumentIsRequired(keySelector, 'keySelector', Function);
|
|
@@ -2727,7 +2725,6 @@ module.exports = (() => {
|
|
|
2727
2725
|
assert.argumentIsArray(requiredGroups, 'requiredGroups', String);
|
|
2728
2726
|
}
|
|
2729
2727
|
|
|
2730
|
-
assert.argumentIsOptional(single, 'single', Boolean);
|
|
2731
2728
|
assert.argumentIsOptional(aggregateCash, 'aggregateCash', Boolean);
|
|
2732
2729
|
assert.argumentIsOptional(requiredGroupGenerator, 'requiredGroupGenerator', Function);
|
|
2733
2730
|
|
|
@@ -2740,7 +2737,7 @@ module.exports = (() => {
|
|
|
2740
2737
|
|
|
2741
2738
|
this._requiredGroups = requiredGroups || [ ];
|
|
2742
2739
|
|
|
2743
|
-
this._single =
|
|
2740
|
+
this._single = type === PositionLevelType.POSITION;
|
|
2744
2741
|
this._aggregateCash = is.boolean(aggregateCash) && aggregateCash;
|
|
2745
2742
|
|
|
2746
2743
|
this._requiredGroupGenerator = requiredGroupGenerator || (input => null);
|