bulltrackers-module 1.0.762 → 1.0.763
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.
|
@@ -11,6 +11,27 @@
|
|
|
11
11
|
// Load business rules
|
|
12
12
|
const rules = require('../rules');
|
|
13
13
|
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
|
|
17
|
+
// Dynamic Computation Loader
|
|
18
|
+
function loadComputations() {
|
|
19
|
+
const computationsDir = path.join(__dirname, '../computations');
|
|
20
|
+
const files = fs.readdirSync(computationsDir);
|
|
21
|
+
|
|
22
|
+
return files
|
|
23
|
+
.filter(file => file.endsWith('.js') && !file.startsWith('_')) // Skip hidden/test files
|
|
24
|
+
.map(file => {
|
|
25
|
+
try {
|
|
26
|
+
return require(path.join(computationsDir, file));
|
|
27
|
+
} catch (e) {
|
|
28
|
+
console.error(`[Config] Failed to load computation ${file}:`, e.message);
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
.filter(Boolean); // Remove nulls
|
|
33
|
+
}
|
|
34
|
+
|
|
14
35
|
module.exports = {
|
|
15
36
|
// =========================================================================
|
|
16
37
|
// PROJECT CONFIGURATION
|
|
@@ -201,10 +222,7 @@ module.exports = {
|
|
|
201
222
|
// by one as they're migrated from v1.
|
|
202
223
|
// =========================================================================
|
|
203
224
|
|
|
204
|
-
computations:
|
|
205
|
-
// Add migrated computations here:
|
|
206
|
-
// require('../computations/UserRiskScore'),
|
|
207
|
-
],
|
|
225
|
+
computations: loadComputations(),
|
|
208
226
|
|
|
209
227
|
// =========================================================================
|
|
210
228
|
// PREDEFINED FILTER SETS
|
|
@@ -9,15 +9,6 @@ const config = require('./config/bulltrackers.config');
|
|
|
9
9
|
const { ManifestBuilder } = require('./framework/core/Manifest');
|
|
10
10
|
const { Computation } = require('./framework/core/Computation');
|
|
11
11
|
|
|
12
|
-
// Add computations to config
|
|
13
|
-
config.computations = [
|
|
14
|
-
require('./computations/UserPortfolioSummary'),
|
|
15
|
-
require('./computations/PopularInvestorProfileMetrics'),
|
|
16
|
-
require('./computations/PopularInvestorRiskAssessment'),
|
|
17
|
-
require('./computations/PopularInvestorRiskMetrics'),
|
|
18
|
-
// Add more computations here as they're migrated
|
|
19
|
-
];
|
|
20
|
-
|
|
21
12
|
// Singleton orchestrator instance
|
|
22
13
|
let orchestrator = null;
|
|
23
14
|
|