bulltrackers-module 1.0.165 → 1.0.167

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.
@@ -12,8 +12,15 @@
12
12
  */
13
13
 
14
14
  const fs = require('fs');
15
- const path = require('path');
16
- const Viz = require('graphviz'); // Uses your local module
15
+ //Hacky solution to force tmp writes TODO : This Tmp write is really dodgy, not ideal but works, consider less hacky solutions to writing to filesystem
16
+ process.env.TMPDIR = '/tmp';
17
+ process.env.TMP = '/tmp';
18
+ process.env.TEMP = '/tmp';
19
+ const os = require('os');
20
+ os.tmpdir = () => '/tmp';
21
+ try { const temp = require('temp'); const path = require('path'); const fs = require('fs'); const tmp = '/tmp';
22
+ if (!fs.existsSync(tmp)) fs.mkdirSync(tmp); temp.dir = tmp; temp.path = () => path.join(tmp, 'temp-' + Math.random().toString(36).slice(2)); } catch {}
23
+ const Viz = require('graphviz');
17
24
 
18
25
  /* --------------------------------------------------
19
26
  * Pretty Console Helpers
@@ -248,9 +255,10 @@ async function generateSvgGraph(manifest, filename = 'dependency-tree.svg') {
248
255
  // --- MODIFIED PATH ---
249
256
  // Writes to the root of the 'bulltrackers-module' package directory,
250
257
  // which is a safer, more predictable location.
251
- const out = path.join(__dirname, '..', '..', '..', filename);
258
+ const out = path.join('/tmp', filename);
252
259
  fs.writeFileSync(out, svg);
253
260
  log.success(`Dependency tree generated at ${out}`);
261
+
254
262
  } catch (e) { log.error(`SVG generation failed: ${e.message}`); }
255
263
  }
256
264
 
@@ -25,10 +25,18 @@ exports.fetchAndStoreInsights = async (config, dependencies) => {
25
25
  try {
26
26
  logger.log('INFO', '[FetchInsightsHelpers] Attempting fetch via proxy manager...');
27
27
  response = await proxyManager.fetch(config.etoroInsightsUrl, fetchOptions);
28
+ if (!response.ok) {
29
+ const errorText = await response.text();
30
+ throw new Error(`Proxy request failed with status ${response.status}: ${errorText}`);
31
+ }
28
32
  } catch (proxyError) {
29
33
  logger.log('WARNING', `[FetchInsightsHelpers] Proxy manager fetch failed. Attempting fallback with node-fetch. Error: ${proxyError.message}`);
30
34
  try {
31
35
  response = await fetch(config.etoroInsightsUrl, fetchOptions);
36
+ if (!response.ok) {
37
+ const errorText = await response.text();
38
+ throw new Error(`Fallback node-fetch failed with status ${response.status}: ${errorText}`);
39
+ }
32
40
  } catch (nodeFetchError) {
33
41
  logger.log('ERROR', `[FetchInsightsHelpers] Fallback node-fetch also failed. Error: ${nodeFetchError.message}`);
34
42
  throw nodeFetchError; // Throw the error from the last attempt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.165",
3
+ "version": "1.0.167",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [