@barchart/portfolio-api-common 1.0.148 → 1.0.149
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.
|
@@ -34,10 +34,9 @@ module.exports = (() => {
|
|
|
34
34
|
* @param {Array.<Object>} portfolios
|
|
35
35
|
* @param {Array.<Object>} positions
|
|
36
36
|
* @param {Array.<Object>} summaries
|
|
37
|
-
* @param {Object=} exclusionDependencies
|
|
38
37
|
*/
|
|
39
38
|
class PositionContainer {
|
|
40
|
-
constructor(definitions, portfolios, positions, summaries
|
|
39
|
+
constructor(definitions, portfolios, positions, summaries) {
|
|
41
40
|
assert.argumentIsArray(definitions, 'definitions', PositionTreeDefinition, 'PositionTreeDefinition');
|
|
42
41
|
assert.argumentIsArray(portfolios, 'portfolios');
|
|
43
42
|
assert.argumentIsArray(positions, 'positions');
|
|
@@ -246,17 +245,9 @@ module.exports = (() => {
|
|
|
246
245
|
|
|
247
246
|
const treeName = treeDefinition.name;
|
|
248
247
|
|
|
249
|
-
if (exclusionDependencies
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (is.string(dependantNames)) {
|
|
253
|
-
dependantNames = [ dependantNames ];
|
|
254
|
-
} else if (!is.array(dependantNames)) {
|
|
255
|
-
dependantNames = [ ];
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const dependantTrees = dependantNames.reduce((trees, name) => {
|
|
259
|
-
if ( this._trees.hasOwnProperty(name)) {
|
|
248
|
+
if (treeDefinition.exclusionDependencies.length > 0) {
|
|
249
|
+
const dependantTrees = treeDefinition.exclusionDependencies.reduce((trees, name) => {
|
|
250
|
+
if (this._trees.hasOwnProperty(name)) {
|
|
260
251
|
trees.push(this._trees[name]);
|
|
261
252
|
}
|
|
262
253
|
|
|
@@ -13,12 +13,17 @@ module.exports = (() => {
|
|
|
13
13
|
* @param {Array.<PositionLevelDefinition>} definitions
|
|
14
14
|
*/
|
|
15
15
|
class PositionTreeDefinitions {
|
|
16
|
-
constructor(name, definitions) {
|
|
16
|
+
constructor(name, definitions, exclusionDependencies) {
|
|
17
17
|
assert.argumentIsRequired(name, 'name', String);
|
|
18
18
|
assert.argumentIsArray(definitions, 'definitions', PositionLevelDefinition, 'PositionLevelDefinition');
|
|
19
19
|
|
|
20
|
+
if (exclusionDependencies) {
|
|
21
|
+
assert.argumentIsArray(exclusionDependencies, 'exclusionDependencies', String);
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
this._name = name;
|
|
21
25
|
this._definitions = definitions;
|
|
26
|
+
this._exclusionDependencies = exclusionDependencies || [ ];
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
/**
|
|
@@ -44,6 +49,17 @@ module.exports = (() => {
|
|
|
44
49
|
return this._definitions;
|
|
45
50
|
}
|
|
46
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Returns the names of other trees which should be impacted when a
|
|
54
|
+
* group (from the current tree) is excluded.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
* @return {Array.<String>}
|
|
58
|
+
*/
|
|
59
|
+
get exclusionDependencies() {
|
|
60
|
+
return this._exclusionDependencies;
|
|
61
|
+
}
|
|
62
|
+
|
|
47
63
|
toString() {
|
|
48
64
|
return '[PositionTreeDefinitions]';
|
|
49
65
|
}
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -750,10 +750,9 @@ module.exports = (() => {
|
|
|
750
750
|
* @param {Array.<Object>} portfolios
|
|
751
751
|
* @param {Array.<Object>} positions
|
|
752
752
|
* @param {Array.<Object>} summaries
|
|
753
|
-
* @param {Object=} exclusionDependencies
|
|
754
753
|
*/
|
|
755
754
|
class PositionContainer {
|
|
756
|
-
constructor(definitions, portfolios, positions, summaries
|
|
755
|
+
constructor(definitions, portfolios, positions, summaries) {
|
|
757
756
|
assert.argumentIsArray(definitions, 'definitions', PositionTreeDefinition, 'PositionTreeDefinition');
|
|
758
757
|
assert.argumentIsArray(portfolios, 'portfolios');
|
|
759
758
|
assert.argumentIsArray(positions, 'positions');
|
|
@@ -962,17 +961,9 @@ module.exports = (() => {
|
|
|
962
961
|
|
|
963
962
|
const treeName = treeDefinition.name;
|
|
964
963
|
|
|
965
|
-
if (exclusionDependencies
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
if (is.string(dependantNames)) {
|
|
969
|
-
dependantNames = [ dependantNames ];
|
|
970
|
-
} else if (!is.array(dependantNames)) {
|
|
971
|
-
dependantNames = [ ];
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
const dependantTrees = dependantNames.reduce((trees, name) => {
|
|
975
|
-
if ( this._trees.hasOwnProperty(name)) {
|
|
964
|
+
if (treeDefinition.exclusionDependencies.length > 0) {
|
|
965
|
+
const dependantTrees = treeDefinition.exclusionDependencies.reduce((trees, name) => {
|
|
966
|
+
if (this._trees.hasOwnProperty(name)) {
|
|
976
967
|
trees.push(this._trees[name]);
|
|
977
968
|
}
|
|
978
969
|
|
|
@@ -2444,12 +2435,17 @@ module.exports = (() => {
|
|
|
2444
2435
|
* @param {Array.<PositionLevelDefinition>} definitions
|
|
2445
2436
|
*/
|
|
2446
2437
|
class PositionTreeDefinitions {
|
|
2447
|
-
constructor(name, definitions) {
|
|
2438
|
+
constructor(name, definitions, exclusionDependencies) {
|
|
2448
2439
|
assert.argumentIsRequired(name, 'name', String);
|
|
2449
2440
|
assert.argumentIsArray(definitions, 'definitions', PositionLevelDefinition, 'PositionLevelDefinition');
|
|
2450
2441
|
|
|
2442
|
+
if (exclusionDependencies) {
|
|
2443
|
+
assert.argumentIsArray(exclusionDependencies, 'exclusionDependencies', String);
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2451
2446
|
this._name = name;
|
|
2452
2447
|
this._definitions = definitions;
|
|
2448
|
+
this._exclusionDependencies = exclusionDependencies || [ ];
|
|
2453
2449
|
}
|
|
2454
2450
|
|
|
2455
2451
|
/**
|
|
@@ -2475,6 +2471,17 @@ module.exports = (() => {
|
|
|
2475
2471
|
return this._definitions;
|
|
2476
2472
|
}
|
|
2477
2473
|
|
|
2474
|
+
/**
|
|
2475
|
+
* Returns the names of other trees which should be impacted when a
|
|
2476
|
+
* group (from the current tree) is excluded.
|
|
2477
|
+
*
|
|
2478
|
+
* @public
|
|
2479
|
+
* @return {Array.<String>}
|
|
2480
|
+
*/
|
|
2481
|
+
get exclusionDependencies() {
|
|
2482
|
+
return this._exclusionDependencies;
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2478
2485
|
toString() {
|
|
2479
2486
|
return '[PositionTreeDefinitions]';
|
|
2480
2487
|
}
|