bulltrackers-module 1.0.530 → 1.0.532

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.
@@ -252,6 +252,7 @@ function buildManifest(productLinesToRun = [], calculations) {
252
252
  type: metadata.type,
253
253
  isHistorical: metadata.isHistorical !== undefined ? metadata.isHistorical : false,
254
254
  rootDataDependencies: metadata.rootDataDependencies || [],
255
+ canHaveMissingRoots: metadata.canHaveMissingRoots || false,
255
256
  userType: metadata.userType,
256
257
  dependencies: dependencies,
257
258
  pass: 0,
@@ -3,4 +3,4 @@
3
3
  * PURPOSE: Master override for BuildReporter.
4
4
  * Increment this string to force a full re-analysis regardless of code or data stability.
5
5
  */
6
- module.exports = "reporter-epoch-10";
6
+ module.exports = "reporter-epoch-11";
@@ -1,2 +1,2 @@
1
1
  // Change this string to force a global re-computation
2
- module.exports = "v2.0-epoch-3";
2
+ module.exports = "v2.0-epoch-5";
@@ -116,7 +116,15 @@ function getLegacyPath(dataType, userCid, config = {}, params = {}, category = n
116
116
  // Try to get legacy paths from collection registry first
117
117
  if (category && subcategory) {
118
118
  try {
119
- const { getCollectionMetadata: getMetadata, resolvePath: resolve } = getRegistryFunctions(options);
119
+ const registryFuncs = getRegistryFunctions(options);
120
+ const getMetadata = registryFuncs.getCollectionMetadata;
121
+ const resolve = registryFuncs.resolvePath;
122
+
123
+ // Check if getCollectionMetadata is available
124
+ if (!getMetadata || typeof getMetadata !== 'function') {
125
+ throw new Error('getCollectionMetadata is not available');
126
+ }
127
+
120
128
  const metadata = getMetadata(category, subcategory);
121
129
  if (metadata && metadata.legacyPaths && metadata.legacyPaths.length > 0) {
122
130
  // Use first legacy path from registry (can be enhanced to try multiple)
@@ -472,6 +472,12 @@ exports.runRootDataIndexer = async (config, dependencies) => {
472
472
 
473
473
  await db.collection(availabilityCollection).doc(dateStr).set(availability);
474
474
  updatesCount++;
475
+
476
+ // Log detailed results for this date
477
+ const detailsLog = Object.entries(availability.details)
478
+ .map(([key, value]) => `${key}: ${value ? '✓' : '✗'}`)
479
+ .join(', ');
480
+ logger.log('INFO', `[RootDataIndexer/${dateStr}] Data availability: ${detailsLog}`);
475
481
 
476
482
  } catch (e) {
477
483
  logger.log('ERROR', `[RootDataIndexer] Failed to index ${dateStr}`, {
@@ -126,16 +126,19 @@ async function processSocial(context, config, taskData, isPI) {
126
126
  stats: { likes: d.emotionsData?.like?.paging?.totalCount || 0, comments: d.summary?.totalCommentsAndReplies || 0 }
127
127
  }));
128
128
 
129
- if (posts.length > 0) {
130
- if (isPI) await storePopularInvestorSocialPosts({ db, logger, collectionRegistry, cid, date: today, posts });
131
- else await storeSignedInUserSocialPosts({ db, logger, collectionRegistry, cid, date: today, posts });
132
- await updateLastUpdated(db, collectionRegistry, cid, isPI ? 'popularInvestor' : 'signedInUser', 'socialPosts', logger);
133
- return true;
134
- }
129
+ // Store posts even if empty (to mark that social fetch was attempted)
130
+ if (isPI) await storePopularInvestorSocialPosts({ db, logger, collectionRegistry, cid, date: today, posts });
131
+ else await storeSignedInUserSocialPosts({ db, logger, collectionRegistry, cid, date: today, posts });
132
+
133
+ // Update lastUpdated timestamp to indicate social fetch completed (even if 0 posts)
134
+ await updateLastUpdated(db, collectionRegistry, cid, isPI ? 'popularInvestor' : 'signedInUser', 'socialPosts', logger);
135
+
136
+ // Return true if posts were stored (even if 0, the fetch was successful)
137
+ return true;
135
138
  } catch (e) {
136
139
  logger.log('WARN', `[Social] Failed for ${username}: ${e.message}`);
140
+ return false;
137
141
  }
138
- return false;
139
142
  }
140
143
 
141
144
  // ==========================================
@@ -293,23 +296,30 @@ async function finalizeOnDemandRequest(deps, config, taskData, isPI, success, to
293
296
  // 1. Run Root Data Indexer and wait for completion
294
297
  let indexerCompleted = false;
295
298
  try {
296
- const indexerResult = await conditionallyRunRootDataIndexer({
297
- db, logger, dateStr: today,
298
- rootDataIndexerConfig: config.rootDataIndexer,
299
- dependencies: deps, counterRef: null, dataTypesRun: dataTypes
300
- });
299
+ logger.log('INFO', `[On-Demand] Starting root data indexer for ${today} (data types: ${dataTypes.join(', ') || 'all'})`);
301
300
 
302
- // indexerResult is true if it ran, false if skipped (already indexed)
303
- // Both cases mean the indexer is "complete" for our purposes
304
- indexerCompleted = true;
305
- logger.log('INFO', `[On-Demand] Root data indexer ${indexerResult ? 'completed' : 'skipped (already indexed)'} for ${today}`);
301
+ if (!config.rootDataIndexer) {
302
+ logger.log('WARN', `[On-Demand] Root data indexer config is missing, skipping indexer`);
303
+ indexerCompleted = false;
304
+ } else {
305
+ const indexerResult = await conditionallyRunRootDataIndexer({
306
+ db, logger, dateStr: today,
307
+ rootDataIndexerConfig: config.rootDataIndexer,
308
+ dependencies: deps, counterRef: null, dataTypesRun: dataTypes
309
+ });
306
310
 
307
- await reqRef.update({
308
- status: 'computing',
309
- indexedAt: FieldValue.serverTimestamp(),
310
- indexerCompleted: true,
311
- indexerRan: indexerResult
312
- });
311
+ // indexerResult is true if it ran, false if skipped (already indexed)
312
+ // Both cases mean the indexer is "complete" for our purposes
313
+ indexerCompleted = true;
314
+ logger.log('INFO', `[On-Demand] Root data indexer ${indexerResult ? 'completed' : 'skipped (already indexed)'} for ${today}`);
315
+
316
+ await reqRef.update({
317
+ status: 'computing',
318
+ indexedAt: FieldValue.serverTimestamp(),
319
+ indexerCompleted: true,
320
+ indexerRan: indexerResult
321
+ });
322
+ }
313
323
 
314
324
  // Send progress notification for computing
315
325
  if (metadata?.requestingUserCid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.530",
3
+ "version": "1.0.532",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [