bulltrackers-module 1.0.254 → 1.0.256

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.
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @fileoverview Main Orchestrator. Coordinates the topological execution.
3
- * UPDATED: Implements State Simulation and handles Indexer-based null references.
3
+ * UPDATED: Uses centralized AvailabilityChecker for strict UserType validation.
4
4
  */
5
5
  const { normalizeName, DEFINITIVE_EARLIEST_DATES } = require('./utils/utils');
6
- const { checkRootDataAvailability } = require('./data/AvailabilityChecker');
6
+ const { checkRootDataAvailability, checkRootDependencies } = require('./data/AvailabilityChecker');
7
7
  const { fetchExistingResults } = require('./data/DependencyFetcher');
8
8
  const { fetchComputationStatus, updateComputationStatus } = require('./persistence/StatusRepository');
9
9
  const { StandardExecutor } = require('./executors/StandardExecutor');
@@ -64,22 +64,18 @@ function analyzeDateExecution(dateStr, calcsInPass, rootDataStatus, dailyStatus,
64
64
  continue;
65
65
  }
66
66
 
67
- const missingRoots = [];
68
- if (calc.rootDataDependencies) {
69
- for (const dep of calc.rootDataDependencies) {
70
- if (dep === 'portfolio' && !rootDataStatus.hasPortfolio) missingRoots.push('portfolio');
71
- if (dep === 'insights' && !rootDataStatus.hasInsights) missingRoots.push('insights');
72
- if (dep === 'social' && !rootDataStatus.hasSocial) missingRoots.push('social');
73
- if (dep === 'history' && !rootDataStatus.hasHistory) missingRoots.push('history');
74
- if (dep === 'price' && !rootDataStatus.hasPrices) missingRoots.push('price');
75
- }
76
- }
77
-
78
- if (missingRoots.length > 0) {
67
+ // [FIX] Use the shared, strict checking logic from AvailabilityChecker
68
+ // This ensures 'speculator' calculations check 'speculatorPortfolio', etc.
69
+ const rootCheck = checkRootDependencies(calc, rootDataStatus);
70
+
71
+ if (!rootCheck.canRun) {
72
+ const missingStr = rootCheck.missing.join(', ');
79
73
  if (!isTargetToday) {
80
- markImpossible(`Missing Root Data: ${missingRoots.join(', ')} (Historical)`);
74
+ // Historical missing data is usually permanent/impossible
75
+ markImpossible(`Missing Root Data: ${missingStr} (Historical)`);
81
76
  } else {
82
- report.blocked.push({ name: cName, reason: `Missing Root Data: ${missingRoots.join(', ')} (Waiting)` });
77
+ // Today's missing data might just be late (Blocked)
78
+ report.blocked.push({ name: cName, reason: `Missing Root Data: ${missingStr} (Waiting)` });
83
79
  }
84
80
  continue;
85
81
  }
@@ -79,7 +79,8 @@ async function checkRootDataAvailability(dateStr, config, dependencies, earliest
79
79
 
80
80
  try {
81
81
  // 1. Try reading the Index
82
- const indexDoc = db.collection(INDEX_COLLECTION).doc(dateStr).get();
82
+ // FIX: Added 'await' here to resolve the Promise before checking .exists
83
+ const indexDoc = await db.collection(INDEX_COLLECTION).doc(dateStr).get();
83
84
 
84
85
  if (indexDoc.exists) {
85
86
  const data = indexDoc.data();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.254",
3
+ "version": "1.0.256",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [