bulltrackers-module 1.0.106 → 1.0.107
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.
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* passes computed dependencies in-memory.
|
|
7
7
|
* NEW: Checks for root data (portfolios, insights, social)
|
|
8
8
|
* before processing any calculations for a given day.
|
|
9
|
+
*
|
|
10
|
+
* MODIFICATION: Meta calculations now receive rootData in their
|
|
11
|
+
* dependencies object to allow them to stream users.
|
|
9
12
|
*/
|
|
10
13
|
|
|
11
14
|
const { FieldPath } = require('@google-cloud/firestore');
|
|
@@ -161,7 +164,8 @@ async function runComputationOrchestrator(config, dependencies, computationManif
|
|
|
161
164
|
`Pass ${passNum} (Meta)`,
|
|
162
165
|
config,
|
|
163
166
|
dependencies,
|
|
164
|
-
dailyResultsCache // <-- PASS THE CACHE
|
|
167
|
+
dailyResultsCache, // <-- PASS THE CACHE
|
|
168
|
+
rootData // <--- !! MODIFICATION: PASS rootData !!
|
|
165
169
|
);
|
|
166
170
|
|
|
167
171
|
// Add results to cache
|
|
@@ -540,9 +544,18 @@ async function runUnifiedComputation(dateToProcess, calculationsToRun, passName,
|
|
|
540
544
|
/**
|
|
541
545
|
* Internal sub-pipe: Runs "meta" or "backtest" computations for a single date.
|
|
542
546
|
* MODIFIED: Accepts in-memory cache and passes dependencies to calcs.
|
|
547
|
+
* MODIFIED: Accepts rootData and adds it to the dependencies object.
|
|
543
548
|
* Returns a map of results.
|
|
544
549
|
*/
|
|
545
|
-
async function runMetaComputation(
|
|
550
|
+
async function runMetaComputation(
|
|
551
|
+
dateToProcess,
|
|
552
|
+
calculationsToRun,
|
|
553
|
+
passName,
|
|
554
|
+
config,
|
|
555
|
+
dependencies,
|
|
556
|
+
dailyResultsCache,
|
|
557
|
+
rootData // <--- !! MODIFICATION: ACCEPT rootData !!
|
|
558
|
+
) {
|
|
546
559
|
const { db, logger } = dependencies;
|
|
547
560
|
const dateStr = dateToProcess.toISOString().slice(0, 10);
|
|
548
561
|
logger.log('INFO', `[${passName}] Starting run for ${dateStr} with ${calculationsToRun.length} calcs.`);
|
|
@@ -552,6 +565,13 @@ async function runMetaComputation(dateToProcess, calculationsToRun, passName, co
|
|
|
552
565
|
try {
|
|
553
566
|
const resultsCollectionRef = db.collection(config.resultsCollection).doc(dateStr).collection(config.resultsSubcollection);
|
|
554
567
|
let successCount = 0;
|
|
568
|
+
|
|
569
|
+
// --- !! MODIFICATION: Add rootData to the dependencies object !! ---
|
|
570
|
+
const dependenciesForMetaCalc = {
|
|
571
|
+
...dependencies,
|
|
572
|
+
rootData: rootData
|
|
573
|
+
};
|
|
574
|
+
// --- END MODIFICATION ---
|
|
555
575
|
|
|
556
576
|
for (const manifestCalc of calculationsToRun) {
|
|
557
577
|
const calcName = normalizeName(manifestCalc.name);
|
|
@@ -586,7 +606,7 @@ async function runMetaComputation(dateToProcess, calculationsToRun, passName, co
|
|
|
586
606
|
// --- Call process with the dependencies ---
|
|
587
607
|
const result = await Promise.resolve(instance.process(
|
|
588
608
|
dateStr,
|
|
589
|
-
|
|
609
|
+
dependenciesForMetaCalc, // <-- PASS MODIFIED DEPS
|
|
590
610
|
config,
|
|
591
611
|
computedDependencies // <-- PASS IN-MEMORY DEPS
|
|
592
612
|
));
|