bulltrackers-module 1.0.686 → 1.0.688

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.
@@ -63,12 +63,15 @@ async function loadAlertTypesFromManifest(logger) {
63
63
  severity: metadata.alert.severity || 'medium',
64
64
  configKey: metadata.alert.configKey,
65
65
  isTest: metadata.isTest === true,
66
- enabled: true
66
+ enabled: true,
67
+ // [FIX] Extract dynamic alert configuration from metadata
68
+ isDynamic: metadata.alert.isDynamic || false,
69
+ dynamicConfig: metadata.alert.dynamicConfig || null
67
70
  };
68
71
 
69
72
  alertTypes.push(alertType);
70
73
 
71
- logger?.log('DEBUG', `[AlertManifestLoader] Loaded alert type: ${alertType.id} from ${metadata.name}`);
74
+ logger?.log('DEBUG', `[AlertManifestLoader] Loaded alert type: ${alertType.id} from ${metadata.name} (isDynamic: ${alertType.isDynamic})`);
72
75
  }
73
76
 
74
77
  logger?.log('INFO', `[AlertManifestLoader] Successfully loaded ${alertTypes.length} alert types from calculations`);
@@ -392,7 +392,10 @@ const manageUserWatchlist = async (db, userId, instruction, payload = {}) => {
392
392
  const sanitizedUserId = sanitizeCid(userId);
393
393
 
394
394
  // 1. Determine Watchlist ID and Reference
395
- const watchlistId = payload.id ? sanitizeDocId(payload.id) : `watchlist_${Date.now()}_${Math.random().toString(16).substr(2, 8)}`;
395
+ // Handle both 'id' (from frontend) and 'watchlistId' (legacy)
396
+ const watchlistId = payload.id ? sanitizeDocId(payload.id)
397
+ : payload.watchlistId ? sanitizeDocId(payload.watchlistId)
398
+ : `watchlist_${Date.now()}_${Math.random().toString(16).substr(2, 8)}`;
396
399
  const userDocRef = db.collection('SignedInUsers').doc(sanitizedUserId).collection('watchlists').doc(watchlistId);
397
400
 
398
401
  try {
@@ -414,11 +417,6 @@ const manageUserWatchlist = async (db, userId, instruction, payload = {}) => {
414
417
  // 3. Calculate Deltas based on Instruction
415
418
  if (instruction === 'create') {
416
419
  addedItems = payload.items || [];
417
-
418
- // DEBUG: Log what we're receiving
419
- console.log('[manageUserWatchlist DEBUG] payload received:', JSON.stringify(payload));
420
- console.log('[manageUserWatchlist DEBUG] payload.type:', payload.type);
421
-
422
420
  // Create the User Document
423
421
  const newDocData = {
424
422
  ...payload,
@@ -429,11 +427,6 @@ const manageUserWatchlist = async (db, userId, instruction, payload = {}) => {
429
427
  copyCount: 0,
430
428
  isAutoGenerated: false
431
429
  };
432
-
433
- // DEBUG: Log what we're about to save
434
- console.log('[manageUserWatchlist DEBUG] newDocData to save:', JSON.stringify(newDocData));
435
- console.log('[manageUserWatchlist DEBUG] newDocData.type:', newDocData.type);
436
-
437
430
  batch.set(userDocRef, newDocData);
438
431
  }
439
432
 
@@ -20,14 +20,15 @@ const router = express.Router();
20
20
  const watchlistManageSchema = z.object({
21
21
  instruction: z.enum(['create', 'update', 'delete', 'add_item', 'remove_item', 'update_item']),
22
22
  payload: z.object({
23
- watchlistId: z.string().optional(),
23
+ id: z.string().optional(), // Frontend sends "id"
24
+ watchlistId: z.string().optional(), // Keep for backward compatibility
24
25
  name: z.string().max(200).optional(),
25
26
  description: z.string().max(1000).optional(),
26
- type: z.enum(['static', 'dynamic']).optional(), // FIX: Allow type field!
27
- visibility: z.enum(['public', 'private']).optional(), // FIX: Allow visibility field!
27
+ type: z.enum(['static', 'dynamic']).optional(),
28
+ visibility: z.enum(['public', 'private']).optional(),
28
29
  items: z.array(z.any()).optional(),
29
30
  item: z.any().optional(),
30
- dynamicConfig: z.any().optional() // FIX: Allow dynamicConfig for dynamic watchlists!
31
+ dynamicConfig: z.any().optional()
31
32
  })
32
33
  });
33
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.686",
3
+ "version": "1.0.688",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [