@elisra-devops/docgen-data-provider 1.18.0 → 1.20.0

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.
@@ -7,10 +7,13 @@ const tfs_data_2 = require("../models/tfs-data");
7
7
  const xml2js = require("xml2js");
8
8
  const logger_1 = require("../utils/logger");
9
9
  const testStepParserHelper_1 = require("../utils/testStepParserHelper");
10
+ const pLimit = require('p-limit');
10
11
  class TestDataProvider {
11
12
  constructor(orgUrl, token) {
12
13
  this.orgUrl = '';
13
14
  this.token = '';
15
+ this.cache = new Map(); // Cache for API responses
16
+ this.limit = pLimit(10);
14
17
  this.addToMap = (map, key, value) => {
15
18
  var _a;
16
19
  if (!map.has(key)) {
@@ -22,25 +25,43 @@ class TestDataProvider {
22
25
  this.token = token;
23
26
  this.testStepParserHelper = new testStepParserHelper_1.default(orgUrl, token);
24
27
  }
28
+ async fetchWithCache(url, ttlMs = 60000) {
29
+ if (this.cache.has(url)) {
30
+ const cached = this.cache.get(url);
31
+ if (cached.timestamp + ttlMs > Date.now()) {
32
+ return cached.data;
33
+ }
34
+ }
35
+ try {
36
+ const result = await tfs_1.TFSServices.getItemContent(url, this.token);
37
+ this.cache.set(url, {
38
+ data: result,
39
+ timestamp: Date.now(),
40
+ });
41
+ return result;
42
+ }
43
+ catch (error) {
44
+ logger_1.default.error(`Error fetching ${url}: ${error.message}`);
45
+ throw error;
46
+ }
47
+ }
25
48
  async GetTestSuiteByTestCase(testCaseId) {
26
49
  let url = `${this.orgUrl}/_apis/testplan/suites?testCaseId=${testCaseId}`;
27
- let testCaseData = await tfs_1.TFSServices.getItemContent(url, this.token);
28
- return testCaseData;
50
+ return this.fetchWithCache(url);
29
51
  }
30
- //get all test plans in the project
31
52
  async GetTestPlans(project) {
32
53
  let testPlanUrl = `${this.orgUrl}${project}/_apis/test/plans`;
33
- return tfs_1.TFSServices.getItemContent(testPlanUrl, this.token);
54
+ return this.fetchWithCache(testPlanUrl);
34
55
  }
35
- //async get data test
36
- // get all test suits in projct test plan
37
56
  async GetTestSuites(project, planId) {
38
57
  let testsuitesUrl = this.orgUrl + project + '/_apis/test/Plans/' + planId + '/suites';
39
58
  try {
40
- let testSuites = await tfs_1.TFSServices.getItemContent(testsuitesUrl, this.token);
41
- return testSuites;
59
+ return this.fetchWithCache(testsuitesUrl);
60
+ }
61
+ catch (e) {
62
+ logger_1.default.error(`Failed to get test suites: ${e}`);
63
+ return null;
42
64
  }
43
- catch (e) { }
44
65
  }
45
66
  async GetTestSuitesForPlan(project, planid) {
46
67
  if (!project) {
@@ -50,45 +71,56 @@ class TestDataProvider {
50
71
  throw new Error('Plan not selected');
51
72
  }
52
73
  let url = this.orgUrl + '/' + project + '/_api/_testManagement/GetTestSuitesForPlan?__v=5&planId=' + planid;
53
- let suites = await tfs_1.TFSServices.getItemContent(url, this.token);
54
- return suites;
74
+ return this.fetchWithCache(url);
55
75
  }
56
76
  async GetTestSuitesByPlan(project, planId, recursive) {
57
77
  let suiteId = Number(planId) + 1;
58
- let suites = await this.GetTestSuiteById(project, planId, suiteId.toString(), recursive);
59
- return suites;
78
+ return this.GetTestSuiteById(project, planId, suiteId.toString(), recursive);
60
79
  }
61
- //gets all testsuits recorsivly under test suite
62
80
  async GetTestSuiteById(project, planId, suiteId, recursive) {
63
81
  let testSuites = await this.GetTestSuitesForPlan(project, planId);
64
- // GetTestSuites(project, planId);
65
82
  helper_1.Helper.suitList = [];
66
83
  let dataSuites = helper_1.Helper.findSuitesRecursive(planId, this.orgUrl, project, testSuites.testSuites, suiteId, recursive);
67
84
  helper_1.Helper.first = true;
68
- // let levledSuites: any = Helper.buildSuiteslevel(dataSuites);
69
85
  return dataSuites;
70
86
  }
71
- //gets all testcase under test suite acording to recursive flag
72
- async GetTestCasesBySuites(project, planId, suiteId, recursiv, includeRequirements, CustomerRequirementId, stepResultDetailsMap) {
87
+ async GetTestCasesBySuites(project, planId, suiteId, recursive, includeRequirements, CustomerRequirementId, stepResultDetailsMap) {
73
88
  let testCasesList = new Array();
74
89
  const requirementToTestCaseTraceMap = new Map();
75
90
  const testCaseToRequirementsTraceMap = new Map();
76
- let suitesTestCasesList = await this.GetTestSuiteById(project, planId, suiteId, recursiv);
77
- for (let i = 0; i < suitesTestCasesList.length; i++) {
78
- let testCases = await this.GetTestCases(project, planId, suitesTestCasesList[i].id);
79
- let testCseseWithSteps = await this.StructureTestCase(project, testCases, suitesTestCasesList[i], includeRequirements, CustomerRequirementId, requirementToTestCaseTraceMap, testCaseToRequirementsTraceMap, stepResultDetailsMap);
80
- if (testCseseWithSteps.length > 0)
81
- testCasesList = [...testCasesList, ...testCseseWithSteps];
82
- }
91
+ // const startTime = performance.now();
92
+ let suitesTestCasesList = await this.GetTestSuiteById(project, planId, suiteId, recursive);
93
+ // Create array of promises that each return their test cases
94
+ const testCaseListPromises = suitesTestCasesList.map((suite) => this.limit(async () => {
95
+ try {
96
+ const testCases = await this.GetTestCases(project, planId, suite.id);
97
+ // const structureStartTime = performance.now();
98
+ const testCasesWithSteps = await this.StructureTestCase(project, testCases, suite, includeRequirements, CustomerRequirementId, requirementToTestCaseTraceMap, testCaseToRequirementsTraceMap, stepResultDetailsMap);
99
+ // logger.debug(
100
+ // `Performance: structured suite ${suite.id} in ${performance.now() - structureStartTime}ms`
101
+ // );
102
+ // Return the results instead of modifying shared array
103
+ return testCasesWithSteps || [];
104
+ }
105
+ catch (error) {
106
+ logger_1.default.error(`Error processing suite ${suite.id}: ${error}`);
107
+ return []; // Return empty array on error
108
+ }
109
+ }));
110
+ // Wait for all promises and only then combine the results
111
+ const results = await Promise.all(testCaseListPromises);
112
+ testCasesList = results.flat(); // Combine all results into a single array
113
+ // logger.debug(`Performance: GetTestCasesBySuites completed in ${performance.now() - startTime}ms`);
83
114
  return { testCasesList, requirementToTestCaseTraceMap, testCaseToRequirementsTraceMap };
84
115
  }
85
116
  async StructureTestCase(project, testCases, suite, includeRequirements, CustomerRequirementId, requirementToTestCaseTraceMap, testCaseToRequirementsTraceMap, stepResultDetailsMap) {
86
117
  let url = this.orgUrl + project + '/_workitems/edit/';
87
- let testCasesUrlList = new Array();
118
+ let testCasesUrlList = [];
88
119
  logger_1.default.debug(`Trying to structure Test case for ${project} suite: ${suite.id}:${suite.name}`);
89
120
  try {
90
- if (!testCases) {
91
- throw new Error('test cases were not found');
121
+ if (!testCases || !testCases.value || testCases.count === 0) {
122
+ logger_1.default.warn(`No test cases found for suite: ${suite.id}`);
123
+ return [];
92
124
  }
93
125
  for (let i = 0; i < testCases.count; i++) {
94
126
  try {
@@ -96,7 +128,7 @@ class TestDataProvider {
96
128
  let newurl = !(stepDetailObject === null || stepDetailObject === void 0 ? void 0 : stepDetailObject.testCaseRevision)
97
129
  ? testCases.value[i].testCase.url + '?$expand=All'
98
130
  : `${testCases.value[i].testCase.url}/revisions/${stepDetailObject.testCaseRevision}?$expand=All`;
99
- let test = await tfs_1.TFSServices.getItemContent(newurl, this.token);
131
+ let test = await this.fetchWithCache(newurl);
100
132
  let testCase = new tfs_data_2.TestCase();
101
133
  testCase.title = test.fields['System.Title'];
102
134
  testCase.area = test.fields['System.AreaPath'];
@@ -119,7 +151,7 @@ class TestDataProvider {
119
151
  // Only proceed if the URL contains 'workItems'
120
152
  if (relation.url.includes('/workItems/')) {
121
153
  try {
122
- let relatedItemContent = await tfs_1.TFSServices.getItemContent(relation.url, this.token);
154
+ let relatedItemContent = await this.fetchWithCache(relation.url);
123
155
  // Check if the WorkItemType is "Requirement" before adding to relations
124
156
  if (relatedItemContent.fields['System.WorkItemType'] === 'Requirement') {
125
157
  const newRequirementRelation = this.createNewRequirement(CustomerRequirementId, relatedItemContent);
@@ -148,8 +180,8 @@ class TestDataProvider {
148
180
  testCasesUrlList.push(testCase);
149
181
  }
150
182
  catch (_a) {
151
- const errorMsg = `ran into an issue while retriving testCase ${testCases.value[i].testCase.id}`;
152
- logger_1.default.error(`errorMsg`);
183
+ const errorMsg = `ran into an issue while retrieving testCase ${testCases.value[i].testCase.id}`;
184
+ logger_1.default.error(`Error: ${errorMsg}`);
153
185
  throw new Error(errorMsg);
154
186
  }
155
187
  }
@@ -205,15 +237,13 @@ class TestDataProvider {
205
237
  }
206
238
  async GetTestCases(project, planId, suiteId) {
207
239
  let testCaseUrl = this.orgUrl + project + '/_apis/test/Plans/' + planId + '/suites/' + suiteId + '/testcases/';
208
- let testCases = await tfs_1.TFSServices.getItemContent(testCaseUrl, this.token);
240
+ let testCases = await this.fetchWithCache(testCaseUrl);
209
241
  logger_1.default.debug(`test cases for plan ${planId} and ${suiteId} were ${testCases ? 'found' : 'not found'}`);
210
242
  return testCases;
211
243
  }
212
- //gets all test point in a test case
213
244
  async GetTestPoint(project, planId, suiteId, testCaseId) {
214
245
  let testPointUrl = `${this.orgUrl}${project}/_apis/test/Plans/${planId}/Suites/${suiteId}/points?testCaseId=${testCaseId}`;
215
- let testPoints = await tfs_1.TFSServices.getItemContent(testPointUrl, this.token);
216
- return testPoints;
246
+ return this.fetchWithCache(testPointUrl);
217
247
  }
218
248
  async CreateTestRun(projectName, testRunName, testPlanId, testPointId) {
219
249
  try {
@@ -320,6 +350,13 @@ class TestDataProvider {
320
350
  let res = await tfs_1.TFSServices.postRequest(url, this.token, 'Post', data, null);
321
351
  return res;
322
352
  }
353
+ /**
354
+ * Clears the cache to free memory
355
+ */
356
+ clearCache() {
357
+ this.cache.clear();
358
+ logger_1.default.debug('Cache cleared');
359
+ }
323
360
  }
324
361
  exports.default = TestDataProvider;
325
362
  //# sourceMappingURL=TestDataProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TestDataProvider.js","sourceRoot":"","sources":["../../src/modules/TestDataProvider.ts"],"names":[],"mappings":";;AAAA,wCAA6C;AAE7C,8CAA+E;AAC/E,iDAAoG;AAKpG,iDAA8C;AAC9C,iCAAiC;AAEjC,4CAAqC;AACrC,wEAAiE;AAEjE,MAAqB,gBAAgB;IAKnC,YAAY,MAAc,EAAE,KAAa;QAJzC,WAAM,GAAW,EAAE,CAAC;QACp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,UAAU,CAAC;aAC1B;SACF,CAAC;QACF,IAAI,GAAG,GAAG,MAAM,iBAAW,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7E,OAAO,GAAG,CAAC;IACb,CAAC;IASD;;OAEG;IACI,UAAU;QACf,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,gBAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAChC,CAAC;CACF;AA9bD,mCA8bC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elisra-devops/docgen-data-provider",
3
- "version": "1.18.0",
3
+ "version": "1.20.0",
4
4
  "description": "A document generator data provider, aimed to retrive data from azure devops",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,16 +1,34 @@
1
- import axios from 'axios';
1
+ import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
2
2
  import logger from '../utils/logger';
3
3
 
4
4
  export class TFSServices {
5
+ // Connection pooling
6
+ private static connectionPool = {
7
+ httpAgent: new (require('http').Agent)({
8
+ keepAlive: true,
9
+ maxSockets: 50, // Allow more connections
10
+ keepAliveMsecs: 30000, // Keep connections alive longer
11
+ }),
12
+ httpsAgent: new (require('https').Agent)({
13
+ keepAlive: true,
14
+ maxSockets: 50,
15
+ keepAliveMsecs: 30000,
16
+ }),
17
+ };
18
+
19
+ // Axios instance with connection reuse
20
+ private static axiosInstance: AxiosInstance = axios.create({
21
+ httpAgent: this.connectionPool.httpAgent,
22
+ httpsAgent: this.connectionPool.httpsAgent,
23
+ });
24
+
5
25
  public static async downloadZipFile(url: string, pat: string): Promise<any> {
6
26
  try {
7
- let res = await axios.request({
27
+ const res = await this.axiosInstance.request({
8
28
  url: url,
9
29
  headers: { 'Content-Type': 'application/zip' },
10
- auth: {
11
- username: '',
12
- password: pat,
13
- },
30
+ auth: { username: '', password: pat },
31
+ timeout: 15000, // Increased timeout for large files
14
32
  });
15
33
  return res;
16
34
  } catch (e) {
@@ -27,52 +45,22 @@ export class TFSServices {
27
45
  customHeaders: any = {},
28
46
  printError: boolean = true
29
47
  ): Promise<any> {
30
- let config: any = {
48
+ const config: AxiosRequestConfig = {
31
49
  headers: customHeaders,
32
50
  method: requestMethod,
33
- auth: {
34
- username: '',
35
- password: pat,
36
- },
51
+ auth: { username: '', password: pat },
37
52
  data: data,
38
53
  responseType: 'arraybuffer', // Important for binary data
39
- timeout: 5000, // Set timeout to 5 seconds
54
+ timeout: 8000, // Increased timeout for images
40
55
  };
41
- let json;
42
- let attempts = 0;
43
- const maxAttempts = 3;
44
-
45
- logger.silly(`making request:
46
- url: ${url}
47
- config: ${JSON.stringify(config)}`);
48
56
 
49
- while (attempts < maxAttempts) {
50
- try {
51
- const response = await axios(url, config);
52
-
53
- // Convert binary data to Base64
54
- const base64String = Buffer.from(response.data, 'binary').toString('base64');
55
- const contentType = response.headers['content-type']; // e.g., "image/png; api-version=7.1"
56
- const mimeType = contentType.split(';')[0].trim(); // Extracts "image/png"
57
- return `data:${mimeType};base64,${base64String}`;
58
- } catch (e: any) {
59
- attempts++;
60
- if (e.message.includes('ETIMEDOUT') && attempts < maxAttempts) {
61
- logger.warn(`Request timed out. Retrying attempt ${attempts} of ${maxAttempts}...`);
62
- continue;
63
- }
64
- if (printError) {
65
- if (e.response) {
66
- logger.error(`Error fetching image from Azure DevOps at ${url}: ${e.message}`);
67
- logger.error(`Status: ${e.response.status}`);
68
- logger.error(`Response Data: ${JSON.stringify(e.response.data)}`);
69
- } else {
70
- logger.error(`Error fetching image from Azure DevOps at ${url}: ${e.message}`);
71
- }
72
- }
73
- throw e;
74
- }
75
- }
57
+ return this.executeWithRetry(url, config, printError, (response) => {
58
+ // Convert binary data to Base64
59
+ const base64String = Buffer.from(response.data, 'binary').toString('base64');
60
+ const contentType = response.headers['content-type'] || 'application/octet-stream';
61
+ const mimeType = contentType.split(';')[0].trim();
62
+ return `data:${mimeType};base64,${base64String}`;
63
+ });
76
64
  }
77
65
 
78
66
  public static async getItemContent(
@@ -83,87 +71,37 @@ export class TFSServices {
83
71
  customHeaders: any = {},
84
72
  printError: boolean = true
85
73
  ): Promise<any> {
86
- let config: any = {
74
+ // Clean URL
75
+ const cleanUrl = url.replace(/ /g, '%20');
76
+
77
+ const config: AxiosRequestConfig = {
87
78
  headers: customHeaders,
88
79
  method: requestMethod,
89
- auth: {
90
- username: '',
91
- password: pat,
92
- },
80
+ auth: { username: '', password: pat },
93
81
  data: data,
94
- timeout: 3000, // Set timeout to 3 seconds
82
+ timeout: 10000, // More reasonable timeout
95
83
  };
96
- let json;
97
- let attempts = 0;
98
- const maxAttempts = 3;
99
- url = url.replace(/ /g, '%20');
100
- logger.silly(`making request:
101
- url: ${url}
102
- config: ${JSON.stringify(config)}`);
103
-
104
- while (attempts < maxAttempts) {
105
- try {
106
- let result = await axios(url, config);
107
- json = JSON.parse(JSON.stringify(result.data));
108
- return json;
109
- } catch (e: any) {
110
- logger.warn(`error fetching item content from azure devops at ${url}`);
111
- logger.warn(`error: ${JSON.stringify(e.response?.data?.message)}`);
112
- if (e.response?.data?.message.includes('could not be found')) {
113
- logger.info(`File does not exist, or you do not have permissions to read it.`);
114
- return undefined;
115
- }
116
84
 
117
- attempts++;
118
- if (
119
- e.message.includes('ETIMEDOUT') ||
120
- e.message.includes('timeout') ||
121
- (e.response?.data?.message?.includes('timeout') && attempts < maxAttempts)
122
- ) {
123
- logger.warn(`Request timed out. Retrying attempt ${attempts} of ${maxAttempts}...`);
124
- continue;
125
- }
126
- if (printError) {
127
- if (e.response) {
128
- // Log detailed error information including the URL
129
- logger.error(`Error making request to Azure DevOps at ${url}: ${e.message}`);
130
- logger.error(`Status: ${e.response.status}`);
131
- logger.error(`Response Data: ${JSON.stringify(e.response.data?.message)}`);
132
- } else {
133
- // Handle other errors (network, etc.)
134
- logger.error(`Error making request to Azure DevOps at ${url}: ${e.message}`);
135
- }
136
- }
137
- throw e;
138
- }
139
- }
85
+ return this.executeWithRetry(cleanUrl, config, printError, (response) => {
86
+ // Direct return of data without extra JSON parsing
87
+ return response.data;
88
+ });
140
89
  }
141
90
 
142
91
  public static async getJfrogRequest(url: string, header?: any) {
143
- let config: any = {
92
+ const config: AxiosRequestConfig = {
144
93
  method: 'GET',
94
+ headers: header,
95
+ timeout: 8000, // Reasonable timeout
145
96
  };
146
- if (header) {
147
- config['headers'] = header;
148
- }
149
97
 
150
- let json;
151
98
  try {
152
- let result = await axios(url, config);
153
- json = JSON.parse(JSON.stringify(result.data));
99
+ const result = await this.axiosInstance.request(config);
100
+ return result.data;
154
101
  } catch (e: any) {
155
- if (e.response) {
156
- // Log detailed error information including the URL
157
- logger.error(`Error making request Jfrog at ${url}: ${e.message}`);
158
- logger.error(`Status: ${e.response.status}`);
159
- logger.error(`Response Data: ${JSON.stringify(e.response.data)}`);
160
- } else {
161
- // Handle other errors (network, etc.)
162
- logger.error(`Error making request to Jfrog at ${url}: ${e.message}`);
163
- }
102
+ this.logDetailedError(e, url);
164
103
  throw e;
165
104
  }
166
- return json;
167
105
  }
168
106
 
169
107
  public static async postRequest(
@@ -173,32 +111,129 @@ export class TFSServices {
173
111
  data: any,
174
112
  customHeaders: any = { headers: { 'Content-Type': 'application/json' } }
175
113
  ): Promise<any> {
176
- let config: any = {
114
+ const config: AxiosRequestConfig = {
177
115
  headers: customHeaders,
178
116
  method: requestMethod,
179
- auth: {
180
- username: '',
181
- password: pat,
182
- },
117
+ auth: { username: '', password: pat },
183
118
  data: data,
119
+ timeout: 10000, // More reasonable timeout
184
120
  };
185
- let result;
186
- logger.silly(`making request:
187
- url: ${url}
188
- config: ${JSON.stringify(config)}`);
121
+
122
+ // Use shorter log format for better performance
123
+ logger.silly(`Request: ${url} [${requestMethod}]`);
124
+
189
125
  try {
190
- result = await axios(url, config);
126
+ const result = await this.axiosInstance.request(config);
127
+ return result;
191
128
  } catch (e: any) {
192
- if (e.response) {
193
- // Log detailed error information including the URL
194
- logger.error(`Error making request to Azure DevOps at ${url}: ${e.message}`);
195
- logger.error(`Status: ${e.response.status}`);
196
- logger.error(`Response Data: ${JSON.stringify(e.response.data?.message)}`);
197
- } else {
198
- // Handle other errors (network, etc.)
199
- logger.error(`Error making request to Azure DevOps at ${url}: ${e.message}`);
129
+ this.logDetailedError(e, url);
130
+ throw e;
131
+ }
132
+ }
133
+
134
+ /**
135
+ * Execute a request with intelligent retry logic
136
+ */
137
+ private static async executeWithRetry(
138
+ url: string,
139
+ config: AxiosRequestConfig,
140
+ printError: boolean,
141
+ responseProcessor: (response: any) => any
142
+ ): Promise<any> {
143
+ let attempts = 0;
144
+ const maxAttempts = 3;
145
+ const baseDelay = 500; // Start with 500ms delay
146
+
147
+ while (true) {
148
+ try {
149
+ const result = await this.axiosInstance.request({ ...config, url });
150
+ return responseProcessor(result);
151
+ } catch (e: any) {
152
+ attempts++;
153
+ const errorMessage = this.getErrorMessage(e);
154
+
155
+ // Handle not found errors
156
+ if (errorMessage.includes('could not be found')) {
157
+ logger.info(`File does not exist, or you do not have permissions to read it.`);
158
+ return undefined;
159
+ }
160
+
161
+ // Check if we should retry
162
+ if (attempts < maxAttempts && this.isRetryableError(e)) {
163
+ // Calculate exponential backoff with jitter
164
+ const jitter = Math.random() * 0.3 + 0.85; // Between 0.85 and 1.15
165
+ const delay = Math.min(baseDelay * Math.pow(2, attempts - 1) * jitter, 5000);
166
+
167
+ logger.warn(`Request failed. Retrying in ${Math.round(delay)}ms (${attempts}/${maxAttempts})`);
168
+ await new Promise((resolve) => setTimeout(resolve, delay));
169
+ continue;
170
+ }
171
+
172
+ // Log error if needed
173
+ if (printError) {
174
+ this.logDetailedError(e, url);
175
+ }
176
+
177
+ throw e;
200
178
  }
201
179
  }
202
- return result;
180
+ }
181
+
182
+ /**
183
+ * Check if an error is retryable
184
+ */
185
+ private static isRetryableError(error: any): boolean {
186
+ // Network errors
187
+ if (error.code === 'ECONNRESET' || error.code === 'ETIMEDOUT' || error.message.includes('timeout')) {
188
+ return true;
189
+ }
190
+
191
+ // Server errors (5xx)
192
+ if (error.response?.status >= 500) {
193
+ return true;
194
+ }
195
+
196
+ // Rate limiting (429)
197
+ if (error.response?.status === 429) {
198
+ return true;
199
+ }
200
+
201
+ return false;
202
+ }
203
+
204
+ /**
205
+ * Log detailed error information
206
+ */
207
+ private static logDetailedError(error: any, url: string): void {
208
+ if (error.response) {
209
+ logger.error(`Error for ${url}: ${error.message}`);
210
+ logger.error(`Status: ${error.response.status}`);
211
+
212
+ if (error.response.data) {
213
+ if (typeof error.response.data === 'string') {
214
+ logger.error(`Response: ${error.response.data.substring(0, 200)}`);
215
+ } else {
216
+ const dataMessage =
217
+ error.response.data.message || JSON.stringify(error.response.data).substring(0, 200);
218
+ logger.error(`Response: ${dataMessage}`);
219
+ }
220
+ }
221
+ } else {
222
+ logger.error(`Error for ${url}: ${error.message}`);
223
+ }
224
+ }
225
+
226
+ private static getErrorMessage(error: any): string {
227
+ if (error.response?.data?.message) {
228
+ return JSON.stringify(error.response.data.message);
229
+ } else if (error.response?.data) {
230
+ return JSON.stringify(error.response.data);
231
+ } else if (error.response) {
232
+ return `HTTP ${error.response.status}`;
233
+ } else if (error.message) {
234
+ return error.message;
235
+ } else {
236
+ return 'Unknown error occurred';
237
+ }
203
238
  }
204
239
  }