bulltrackers-module 1.0.683 → 1.0.684
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.
|
@@ -189,25 +189,31 @@ router.get('/types', async (req, res, next) => {
|
|
|
189
189
|
// GET /alerts/dynamic-watchlist-computations - Get available computations for dynamic watchlists
|
|
190
190
|
router.get('/dynamic-watchlist-computations', async (req, res, next) => {
|
|
191
191
|
try {
|
|
192
|
-
|
|
193
|
-
const { getAllAlertTypes } = require('../../alert-system/helpers/alert_type_registry.js');
|
|
194
|
-
const alertTypes = getAllAlertTypes();
|
|
192
|
+
const { logger } = req.dependencies;
|
|
195
193
|
|
|
196
|
-
//
|
|
197
|
-
const
|
|
198
|
-
computationName: type.computationName,
|
|
199
|
-
alertTypeName: type.name,
|
|
200
|
-
description: type.description,
|
|
201
|
-
severity: type.severity
|
|
202
|
-
}));
|
|
194
|
+
// [UPDATED] Load alert types from manifest instead of hardcoded registry
|
|
195
|
+
const alertTypes = await loadAlertTypesFromManifest(logger);
|
|
203
196
|
|
|
204
|
-
//
|
|
197
|
+
// Extract unique computations from alert types (exclude test alerts)
|
|
198
|
+
const computations = alertTypes
|
|
199
|
+
.filter(type => !type.isTest)
|
|
200
|
+
.map(type => ({
|
|
201
|
+
computationName: type.computationName,
|
|
202
|
+
alertTypeName: type.name,
|
|
203
|
+
description: type.description,
|
|
204
|
+
severity: type.severity,
|
|
205
|
+
configKey: type.configKey
|
|
206
|
+
}));
|
|
207
|
+
|
|
208
|
+
// Cache in browser/CDN for 1 hour (data changes infrequently)
|
|
205
209
|
res.set('Cache-Control', 'public, max-age=3600');
|
|
206
210
|
res.json({
|
|
207
211
|
success: true,
|
|
208
|
-
computations
|
|
212
|
+
computations,
|
|
213
|
+
count: computations.length
|
|
209
214
|
});
|
|
210
215
|
} catch (error) {
|
|
216
|
+
logger?.log('ERROR', `[GET /alerts/dynamic-watchlist-computations] Error: ${error.message}`);
|
|
211
217
|
next(error);
|
|
212
218
|
}
|
|
213
219
|
});
|