bulltrackers-module 1.0.143 → 1.0.144

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.
@@ -55,7 +55,21 @@ async function checkRootDataAvailability(dateStr, config, dependencies, earliest
55
55
  // We return null to skip the entire day
56
56
  return null;
57
57
  }
58
- return {portfolioRefs, insightsData,socialData,historyRefs,status: { hasPortfolio, hasInsights, hasSocial, hasHistory }};
58
+
59
+ /**
60
+ * --- THIS IS THE FIX ---
61
+ * Rename keys to match what streamAndProcess (Stage 8) expects.
62
+ * 'insightsData' is renamed to 'todayInsights'.
63
+ * 'socialData' is renamed to 'todaySocialPostInsights'.
64
+ */
65
+ return {
66
+ portfolioRefs,
67
+ todayInsights: insightsData, // <-- FIX
68
+ todaySocialPostInsights: socialData, // <-- FIX
69
+ historyRefs,
70
+ status: { hasPortfolio, hasInsights, hasSocial, hasHistory }
71
+ };
72
+
59
73
  } catch (err) { logger.log('ERROR', `[PassRunner] Error checking data for ${dateStr}`, { errorMessage: err.message }); return null; }
60
74
  }
61
75
 
@@ -224,6 +238,7 @@ async function loadHistoricalData(date, calcs, config, deps, rootData) {
224
238
  async function streamAndProcess(dateStr, state, passName, config, deps, rootData) {
225
239
  const { logger, calculationUtils } = deps;
226
240
  // --- MODIFIED: yesterdayInsights/Social are now loaded by loadHistoricalData ---
241
+ // --- THIS WILL NOW WORK, as rootData contains 'todayInsights' from Stage 3 ---
227
242
  const { todayInsights, yesterdayInsights, todaySocialPostInsights, yesterdaySocialPostInsights, todayHistoryData, yesterdayHistoryData, yesterdayPortfolios } = rootData;
228
243
 
229
244
  // --- NEW: Check if streaming is even needed ---
@@ -240,6 +255,7 @@ async function streamAndProcess(dateStr, state, passName, config, deps, rootData
240
255
  if(cat==='socialPosts'||cat==='insights') {
241
256
  if (firstUser) {
242
257
  logger.log('INFO', `[${passName}] Running non-streaming calc: ${name}`);
258
+ // --- This 'args' array will now receive the correct data ---
243
259
  let args=[null,null,null,{...context, userType: 'n/a'},todayInsights,yesterdayInsights,todaySocialPostInsights,yesterdaySocialPostInsights,todayHistoryData,yesterdayHistoryData];
244
260
  // Pass historical data if needed
245
261
  if(calc.manifest.isHistorical) {
@@ -269,6 +285,7 @@ async function streamAndProcess(dateStr, state, passName, config, deps, rootData
269
285
  // --- MODIFIED: Skip social/insights here, they ran above ---
270
286
  if(isSocialOrInsights) continue;
271
287
 
288
+ // --- This 'args' array will now receive the correct data ---
272
289
  let args=[p,null,uid,context,todayInsights,yesterdayInsights,todaySocialPostInsights,yesterdaySocialPostInsights,todayHistoryData,yesterdayHistoryData];
273
290
 
274
291
  if(isHistorical){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.143",
3
+ "version": "1.0.144",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [