bulltrackers-module 1.0.119 → 1.0.120
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.
|
@@ -102,20 +102,28 @@ async function checkRootDataAvailability(dateStr, config, dependencies) {
|
|
|
102
102
|
* (NEW) Fetches all computed dependencies for a given pass and date from Firestore.
|
|
103
103
|
* @param {string} dateStr - The date string (YYYY-MM-DD).
|
|
104
104
|
* @param {Array<object>} calcsInPass - The manifest entries for this pass.
|
|
105
|
+
* @param {Array<object>} fullManifest - The *entire* computation manifest.
|
|
105
106
|
* @param {object} config - The computation system configuration.
|
|
106
107
|
* @param {object} dependencies - Contains db, logger.
|
|
107
108
|
* @returns {Promise<object>} A map of { 'calc-name': result, ... }
|
|
108
109
|
*/
|
|
109
|
-
async function fetchDependenciesForPass(dateStr, calcsInPass, config, dependencies) {
|
|
110
|
+
async function fetchDependenciesForPass(dateStr, calcsInPass, fullManifest, config, dependencies) {
|
|
110
111
|
const { db, logger } = dependencies;
|
|
111
112
|
const { resultsCollection, resultsSubcollection, computationsSubcollection } = config;
|
|
112
113
|
|
|
114
|
+
// --- THIS IS THE FIX ---
|
|
115
|
+
// Build the manifestMap from the *fullManifest* so we can find
|
|
116
|
+
// dependencies from *all* passes, not just the current one.
|
|
117
|
+
const manifestMap = new Map();
|
|
118
|
+
for (const calc of fullManifest) {
|
|
119
|
+
manifestMap.set(normalizeName(calc.name), calc);
|
|
120
|
+
}
|
|
121
|
+
// --- END FIX ---
|
|
122
|
+
|
|
113
123
|
const requiredDeps = new Set();
|
|
114
|
-
const manifestMap = new Map(); // Store manifest entry by name
|
|
115
124
|
|
|
116
125
|
// 1. Get all unique dependencies required by calcs in *this* pass
|
|
117
126
|
for (const calc of calcsInPass) {
|
|
118
|
-
manifestMap.set(calc.name, calc);
|
|
119
127
|
if (calc.type === 'meta' && calc.dependencies) {
|
|
120
128
|
calc.dependencies.forEach(depName => requiredDeps.add(normalizeName(depName)));
|
|
121
129
|
}
|
|
@@ -132,10 +140,8 @@ async function fetchDependenciesForPass(dateStr, calcsInPass, config, dependenci
|
|
|
132
140
|
const depNames = [];
|
|
133
141
|
|
|
134
142
|
// 2. Build the list of Firestore document references
|
|
135
|
-
// This assumes all dependencies are in the *main manifest* (which they should be)
|
|
136
|
-
// and we can find their category.
|
|
137
143
|
for (const calcName of requiredDeps) {
|
|
138
|
-
const calcManifest = manifestMap.get(calcName);
|
|
144
|
+
const calcManifest = manifestMap.get(calcName); // Now correctly finds deps from other passes
|
|
139
145
|
if (!calcManifest) {
|
|
140
146
|
logger.log('ERROR', `[PassRunner] Cannot find manifest entry for dependency "${calcName}". This is a manifest error. Skipping dependency.`);
|
|
141
147
|
continue;
|
|
@@ -234,7 +240,13 @@ async function runComputationPass(config, dependencies, computationManifest) {
|
|
|
234
240
|
|
|
235
241
|
// 2. (NEW) Fetch all dependencies for this pass and date from Firestore
|
|
236
242
|
// This is skipped for Pass 1, as `requiredDeps.size` will be 0
|
|
237
|
-
const fetchedDependencies = await fetchDependenciesForPass(
|
|
243
|
+
const fetchedDependencies = await fetchDependenciesForPass(
|
|
244
|
+
dateStr,
|
|
245
|
+
calcsInThisPass,
|
|
246
|
+
computationManifest, // <-- Pass the *full* manifest here
|
|
247
|
+
config,
|
|
248
|
+
dependencies
|
|
249
|
+
);
|
|
238
250
|
|
|
239
251
|
const skippedCalculations = new Set();
|
|
240
252
|
|
package/index.js
CHANGED
|
@@ -44,7 +44,7 @@ const taskEngine = {
|
|
|
44
44
|
handleRequest: require('./functions/task-engine/handler_creator').handleRequest,
|
|
45
45
|
handleDiscover: require('./functions/task-engine/helpers/discover_helpers').handleDiscover,
|
|
46
46
|
handleVerify: require('./functions/task-engine/helpers/verify_helpers').handleVerify,
|
|
47
|
-
handleUpdate: require('./functions/task-engine/helpers/update_helpers').handleUpdate,
|
|
47
|
+
handleUpdate: require('./functions/task-engine/helpers/update_helpers').handleUpdate,pnl
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
// --- Pipe 4: Computation System ---
|