bulltrackers-module 1.0.455 → 1.0.458

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.
@@ -546,6 +546,7 @@ async function getPiUsername(db, piCid, config, logger) {
546
546
 
547
547
  module.exports = {
548
548
  requestPiFetch,
549
- getPiFetchStatus
549
+ getPiFetchStatus,
550
+ getPiUsername
550
551
  };
551
552
 
@@ -38,11 +38,16 @@ async function handlePopularInvestorUpdate(taskData, config, dependencies) {
38
38
  // If we have a requestId but no cid, try to extract from requestId or use username
39
39
  const effectiveCid = cid || (requestId ? null : null); // Will need to be handled
40
40
 
41
- const {
42
- ETORO_API_PORTFOLIO_URL,
43
- ETORO_API_POSITIONS_URL,
44
- ETORO_API_HISTORY_URL
45
- } = config;
41
+ // Validate and set API URLs with defaults and fallbacks
42
+ const ETORO_API_PORTFOLIO_URL = config.ETORO_API_PORTFOLIO_URL || process.env.ETORO_API_PORTFOLIO_URL || 'https://www.etoro.com/sapi/trade-data-real/live/public/portfolios';
43
+ const ETORO_API_POSITIONS_URL = config.ETORO_API_POSITIONS_URL || process.env.ETORO_API_POSITIONS_URL || 'https://www.etoro.com/sapi/trade-data-real/live/public/positions';
44
+ const ETORO_API_HISTORY_URL = config.ETORO_API_HISTORY_URL || process.env.ETORO_API_HISTORY_URL || 'https://www.etoro.com/sapi/trade-data-real/history/public/credit/flat';
45
+
46
+ if (!ETORO_API_PORTFOLIO_URL || ETORO_API_PORTFOLIO_URL === 'undefined') {
47
+ const errorMsg = 'ETORO_API_PORTFOLIO_URL is not configured. Check taskEngine config.';
48
+ logger.log('ERROR', `[PI Update] ${errorMsg}`);
49
+ throw new Error(errorMsg);
50
+ }
46
51
 
47
52
  logger.log('INFO', `[PI Update] Starting update for User: ${username || 'unknown'} (${cid || 'unknown'})${requestId ? ` [Request: ${requestId}]` : ''}`);
48
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.455",
3
+ "version": "1.0.458",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [