bulltrackers-module 1.0.700 → 1.0.701
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.
|
@@ -226,6 +226,7 @@ async function fetchDependencies(date, calcs, config, deps, manifestLookup = {},
|
|
|
226
226
|
async function fetchResultSeries(endDateStr, calcNames, manifestLookup, config, deps, lookbackDays) {
|
|
227
227
|
const { db, logger } = deps;
|
|
228
228
|
const results = {}; // normalizedName -> { date -> data }
|
|
229
|
+
const { resultsCollection = 'computation_results', resultsSubcollection = 'results', computationsSubcollection = 'computations' } = config;
|
|
229
230
|
|
|
230
231
|
// Initialize results structure
|
|
231
232
|
calcNames.forEach(n => results[normalizeName(n)] = {});
|
|
@@ -238,6 +239,15 @@ async function fetchResultSeries(endDateStr, calcNames, manifestLookup, config,
|
|
|
238
239
|
dates.push(d.toISOString().slice(0, 10));
|
|
239
240
|
}
|
|
240
241
|
|
|
242
|
+
// [DEBUG] Log the manifest lookup and resolved categories
|
|
243
|
+
logger.log('INFO', `[DependencyFetcher] 🔍 ManifestLookup has ${Object.keys(manifestLookup).length} entries`);
|
|
244
|
+
for (const rawName of calcNames) {
|
|
245
|
+
const norm = normalizeName(rawName);
|
|
246
|
+
const category = manifestLookup[norm] || 'analytics';
|
|
247
|
+
const samplePath = `${resultsCollection}/${dates[0]}/${resultsSubcollection}/${category}/${computationsSubcollection}/${rawName}`;
|
|
248
|
+
logger.log('INFO', `[DependencyFetcher] 📍 '${rawName}' -> category='${category}' -> Path: ${samplePath}`);
|
|
249
|
+
}
|
|
250
|
+
|
|
241
251
|
// Build Fetch Operations
|
|
242
252
|
const ops = [];
|
|
243
253
|
for (const dateStr of dates) {
|
|
@@ -260,6 +270,13 @@ async function fetchResultSeries(endDateStr, calcNames, manifestLookup, config,
|
|
|
260
270
|
for (let i = 0; i < ops.length; i += BATCH_SIZE) {
|
|
261
271
|
await Promise.all(ops.slice(i, i + BATCH_SIZE).map(fn => fn()));
|
|
262
272
|
}
|
|
273
|
+
|
|
274
|
+
// [DEBUG] Log results summary
|
|
275
|
+
for (const rawName of calcNames) {
|
|
276
|
+
const norm = normalizeName(rawName);
|
|
277
|
+
const foundDates = Object.keys(results[norm] || {});
|
|
278
|
+
logger.log('INFO', `[DependencyFetcher] ✅ '${rawName}' found data for ${foundDates.length}/${lookbackDays} days`);
|
|
279
|
+
}
|
|
263
280
|
|
|
264
281
|
return results;
|
|
265
282
|
}
|
|
@@ -9,14 +9,11 @@ const { commitResults } = require('../persistence/ResultCommitter');
|
|
|
9
9
|
const { fetchResultSeries } = require('../data/DependencyFetcher');
|
|
10
10
|
const { getManifest } = require('../topology/ManifestLoader');
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
catch (e) { _calculations = {}; }
|
|
18
|
-
}
|
|
19
|
-
return _calculations;
|
|
12
|
+
// Helper to get calculations - prefer config.calculations, fallback to direct require
|
|
13
|
+
function getCalculations(config) {
|
|
14
|
+
if (config && config.calculations) return config.calculations;
|
|
15
|
+
try { return require('aiden-shared-calculations-unified').calculations; }
|
|
16
|
+
catch (e) { return {}; }
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
class MetaExecutor {
|
|
@@ -29,8 +26,8 @@ class MetaExecutor {
|
|
|
29
26
|
const dStr = date.toISOString().slice(0, 10);
|
|
30
27
|
const loader = new CachedDataLoader(config, deps);
|
|
31
28
|
|
|
32
|
-
// 1. Setup Manifest Lookup
|
|
33
|
-
const allManifests = getManifest(config.
|
|
29
|
+
// 1. Setup Manifest Lookup (use activeProductLines and calculations from config)
|
|
30
|
+
const allManifests = getManifest(config.activeProductLines || [], getCalculations(config), deps);
|
|
34
31
|
const manifestLookup = Object.fromEntries(allManifests.map(m => [normalizeName(m.name), m.category]));
|
|
35
32
|
|
|
36
33
|
// 2. Load Base Data (Always Required)
|
|
@@ -104,8 +101,8 @@ class MetaExecutor {
|
|
|
104
101
|
const { logger } = deps;
|
|
105
102
|
const calcs = [metadata]; // Treat single as list for helpers
|
|
106
103
|
|
|
107
|
-
//
|
|
108
|
-
const allManifests = getManifest([], getCalculations(), deps);
|
|
104
|
+
// Build manifestLookup using calculations from config (set in index.js)
|
|
105
|
+
const allManifests = getManifest(config.activeProductLines || [], getCalculations(config), deps);
|
|
109
106
|
const manifestLookup = Object.fromEntries(allManifests.map(m => [normalizeName(m.name), m.category]));
|
|
110
107
|
|
|
111
108
|
// 1. Load Data using Shared Helpers
|
|
@@ -13,14 +13,11 @@ const mathLayer = require('../layers/index');
|
|
|
13
13
|
const { performance } = require('perf_hooks');
|
|
14
14
|
const v8 = require('v8');
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
catch (e) { _calculations = {}; }
|
|
22
|
-
}
|
|
23
|
-
return _calculations;
|
|
16
|
+
// Helper to get calculations - prefer config.calculations, fallback to direct require
|
|
17
|
+
function getCalculations(config) {
|
|
18
|
+
if (config && config.calculations) return config.calculations;
|
|
19
|
+
try { return require('aiden-shared-calculations-unified').calculations; }
|
|
20
|
+
catch (e) { return {}; }
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
class StandardExecutor {
|
|
@@ -420,14 +417,13 @@ async function loadSeriesData(loader, dateStr, calcs, config, deps) {
|
|
|
420
417
|
if (rootMap[key]) series.root[key] = (await loader.loadSeries(rootMap[key], dateStr, days)).data;
|
|
421
418
|
}));
|
|
422
419
|
|
|
423
|
-
//
|
|
420
|
+
// Build lookup from ALL computations using config.calculations
|
|
424
421
|
const depEntries = Object.values(depReqs);
|
|
425
422
|
if (depEntries.length) {
|
|
426
423
|
const depOriginalNames = depEntries.map(e => e.originalName);
|
|
427
424
|
const maxDays = Math.max(...depEntries.map(e => e.days));
|
|
428
425
|
|
|
429
|
-
|
|
430
|
-
const allManifests = getManifest([], getCalculations(), deps);
|
|
426
|
+
const allManifests = getManifest(config.activeProductLines || [], getCalculations(config), deps);
|
|
431
427
|
const lookup = Object.fromEntries(allManifests.map(m => [normalizeName(m.name), m.category]));
|
|
432
428
|
|
|
433
429
|
series.results = await fetchResultSeries(dateStr, depOriginalNames, lookup, config, deps, maxDays);
|