@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.
- package/bin/helpers/tfs.d.ts +15 -0
- package/bin/helpers/tfs.js +148 -130
- package/bin/helpers/tfs.js.map +1 -1
- package/bin/modules/TestDataProvider.d.ts +9 -2
- package/bin/modules/TestDataProvider.js +73 -36
- package/bin/modules/TestDataProvider.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/tfs.ts +166 -131
- package/src/modules/TestDataProvider.ts +93 -55
package/bin/helpers/tfs.d.ts
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
export declare class TFSServices {
|
|
2
|
+
private static connectionPool;
|
|
3
|
+
private static axiosInstance;
|
|
2
4
|
static downloadZipFile(url: string, pat: string): Promise<any>;
|
|
3
5
|
static fetchAzureDevOpsImageAsBase64(url: string, pat: string, requestMethod?: string, data?: any, customHeaders?: any, printError?: boolean): Promise<any>;
|
|
4
6
|
static getItemContent(url: string, pat: string, requestMethod?: string, data?: any, customHeaders?: any, printError?: boolean): Promise<any>;
|
|
5
7
|
static getJfrogRequest(url: string, header?: any): Promise<any>;
|
|
6
8
|
static postRequest(url: string, pat: string, requestMethod: string | undefined, data: any, customHeaders?: any): Promise<any>;
|
|
9
|
+
/**
|
|
10
|
+
* Execute a request with intelligent retry logic
|
|
11
|
+
*/
|
|
12
|
+
private static executeWithRetry;
|
|
13
|
+
/**
|
|
14
|
+
* Check if an error is retryable
|
|
15
|
+
*/
|
|
16
|
+
private static isRetryableError;
|
|
17
|
+
/**
|
|
18
|
+
* Log detailed error information
|
|
19
|
+
*/
|
|
20
|
+
private static logDetailedError;
|
|
21
|
+
private static getErrorMessage;
|
|
7
22
|
}
|
package/bin/helpers/tfs.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.TFSServices = void 0;
|
|
4
5
|
const axios_1 = require("axios");
|
|
@@ -6,13 +7,11 @@ const logger_1 = require("../utils/logger");
|
|
|
6
7
|
class TFSServices {
|
|
7
8
|
static async downloadZipFile(url, pat) {
|
|
8
9
|
try {
|
|
9
|
-
|
|
10
|
+
const res = await this.axiosInstance.request({
|
|
10
11
|
url: url,
|
|
11
12
|
headers: { 'Content-Type': 'application/zip' },
|
|
12
|
-
auth: {
|
|
13
|
-
|
|
14
|
-
password: pat,
|
|
15
|
-
},
|
|
13
|
+
auth: { username: '', password: pat },
|
|
14
|
+
timeout: 15000, // Increased timeout for large files
|
|
16
15
|
});
|
|
17
16
|
return res;
|
|
18
17
|
}
|
|
@@ -22,166 +21,185 @@ class TFSServices {
|
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
static async fetchAzureDevOpsImageAsBase64(url, pat, requestMethod = 'get', data = {}, customHeaders = {}, printError = true) {
|
|
25
|
-
|
|
24
|
+
const config = {
|
|
26
25
|
headers: customHeaders,
|
|
27
26
|
method: requestMethod,
|
|
28
|
-
auth: {
|
|
29
|
-
username: '',
|
|
30
|
-
password: pat,
|
|
31
|
-
},
|
|
27
|
+
auth: { username: '', password: pat },
|
|
32
28
|
data: data,
|
|
33
29
|
responseType: 'arraybuffer', // Important for binary data
|
|
34
|
-
timeout:
|
|
30
|
+
timeout: 8000, // Increased timeout for images
|
|
35
31
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
const response = await (0, axios_1.default)(url, config);
|
|
45
|
-
// Convert binary data to Base64
|
|
46
|
-
const base64String = Buffer.from(response.data, 'binary').toString('base64');
|
|
47
|
-
const contentType = response.headers['content-type']; // e.g., "image/png; api-version=7.1"
|
|
48
|
-
const mimeType = contentType.split(';')[0].trim(); // Extracts "image/png"
|
|
49
|
-
return `data:${mimeType};base64,${base64String}`;
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
attempts++;
|
|
53
|
-
if (e.message.includes('ETIMEDOUT') && attempts < maxAttempts) {
|
|
54
|
-
logger_1.default.warn(`Request timed out. Retrying attempt ${attempts} of ${maxAttempts}...`);
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (printError) {
|
|
58
|
-
if (e.response) {
|
|
59
|
-
logger_1.default.error(`Error fetching image from Azure DevOps at ${url}: ${e.message}`);
|
|
60
|
-
logger_1.default.error(`Status: ${e.response.status}`);
|
|
61
|
-
logger_1.default.error(`Response Data: ${JSON.stringify(e.response.data)}`);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
logger_1.default.error(`Error fetching image from Azure DevOps at ${url}: ${e.message}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
throw e;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
32
|
+
return this.executeWithRetry(url, config, printError, (response) => {
|
|
33
|
+
// Convert binary data to Base64
|
|
34
|
+
const base64String = Buffer.from(response.data, 'binary').toString('base64');
|
|
35
|
+
const contentType = response.headers['content-type'] || 'application/octet-stream';
|
|
36
|
+
const mimeType = contentType.split(';')[0].trim();
|
|
37
|
+
return `data:${mimeType};base64,${base64String}`;
|
|
38
|
+
});
|
|
70
39
|
}
|
|
71
40
|
static async getItemContent(url, pat, requestMethod = 'get', data = {}, customHeaders = {}, printError = true) {
|
|
72
|
-
|
|
73
|
-
|
|
41
|
+
// Clean URL
|
|
42
|
+
const cleanUrl = url.replace(/ /g, '%20');
|
|
43
|
+
const config = {
|
|
44
|
+
headers: customHeaders,
|
|
45
|
+
method: requestMethod,
|
|
46
|
+
auth: { username: '', password: pat },
|
|
47
|
+
data: data,
|
|
48
|
+
timeout: 10000, // More reasonable timeout
|
|
49
|
+
};
|
|
50
|
+
return this.executeWithRetry(cleanUrl, config, printError, (response) => {
|
|
51
|
+
// Direct return of data without extra JSON parsing
|
|
52
|
+
return response.data;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
static async getJfrogRequest(url, header) {
|
|
56
|
+
const config = {
|
|
57
|
+
method: 'GET',
|
|
58
|
+
headers: header,
|
|
59
|
+
timeout: 8000, // Reasonable timeout
|
|
60
|
+
};
|
|
61
|
+
try {
|
|
62
|
+
const result = await this.axiosInstance.request(config);
|
|
63
|
+
return result.data;
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
this.logDetailedError(e, url);
|
|
67
|
+
throw e;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
static async postRequest(url, pat, requestMethod = 'post', data, customHeaders = { headers: { 'Content-Type': 'application/json' } }) {
|
|
71
|
+
const config = {
|
|
74
72
|
headers: customHeaders,
|
|
75
73
|
method: requestMethod,
|
|
76
|
-
auth: {
|
|
77
|
-
username: '',
|
|
78
|
-
password: pat,
|
|
79
|
-
},
|
|
74
|
+
auth: { username: '', password: pat },
|
|
80
75
|
data: data,
|
|
81
|
-
timeout:
|
|
76
|
+
timeout: 10000, // More reasonable timeout
|
|
82
77
|
};
|
|
83
|
-
|
|
78
|
+
// Use shorter log format for better performance
|
|
79
|
+
logger_1.default.silly(`Request: ${url} [${requestMethod}]`);
|
|
80
|
+
try {
|
|
81
|
+
const result = await this.axiosInstance.request(config);
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
this.logDetailedError(e, url);
|
|
86
|
+
throw e;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Execute a request with intelligent retry logic
|
|
91
|
+
*/
|
|
92
|
+
static async executeWithRetry(url, config, printError, responseProcessor) {
|
|
84
93
|
let attempts = 0;
|
|
85
94
|
const maxAttempts = 3;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
url: ${url}
|
|
89
|
-
config: ${JSON.stringify(config)}`);
|
|
90
|
-
while (attempts < maxAttempts) {
|
|
95
|
+
const baseDelay = 500; // Start with 500ms delay
|
|
96
|
+
while (true) {
|
|
91
97
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return json;
|
|
98
|
+
const result = await this.axiosInstance.request(Object.assign(Object.assign({}, config), { url }));
|
|
99
|
+
return responseProcessor(result);
|
|
95
100
|
}
|
|
96
101
|
catch (e) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
attempts++;
|
|
103
|
+
const errorMessage = this.getErrorMessage(e);
|
|
104
|
+
// Handle not found errors
|
|
105
|
+
if (errorMessage.includes('could not be found')) {
|
|
100
106
|
logger_1.default.info(`File does not exist, or you do not have permissions to read it.`);
|
|
101
107
|
return undefined;
|
|
102
108
|
}
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
// Check if we should retry
|
|
110
|
+
if (attempts < maxAttempts && this.isRetryableError(e)) {
|
|
111
|
+
// Calculate exponential backoff with jitter
|
|
112
|
+
const jitter = Math.random() * 0.3 + 0.85; // Between 0.85 and 1.15
|
|
113
|
+
const delay = Math.min(baseDelay * Math.pow(2, attempts - 1) * jitter, 5000);
|
|
114
|
+
logger_1.default.warn(`Request failed. Retrying in ${Math.round(delay)}ms (${attempts}/${maxAttempts})`);
|
|
115
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
108
116
|
continue;
|
|
109
117
|
}
|
|
118
|
+
// Log error if needed
|
|
110
119
|
if (printError) {
|
|
111
|
-
|
|
112
|
-
// Log detailed error information including the URL
|
|
113
|
-
logger_1.default.error(`Error making request to Azure DevOps at ${url}: ${e.message}`);
|
|
114
|
-
logger_1.default.error(`Status: ${e.response.status}`);
|
|
115
|
-
logger_1.default.error(`Response Data: ${JSON.stringify((_h = e.response.data) === null || _h === void 0 ? void 0 : _h.message)}`);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
// Handle other errors (network, etc.)
|
|
119
|
-
logger_1.default.error(`Error making request to Azure DevOps at ${url}: ${e.message}`);
|
|
120
|
-
}
|
|
120
|
+
this.logDetailedError(e, url);
|
|
121
121
|
}
|
|
122
122
|
throw e;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Check if an error is retryable
|
|
128
|
+
*/
|
|
129
|
+
static isRetryableError(error) {
|
|
130
|
+
var _b, _c;
|
|
131
|
+
// Network errors
|
|
132
|
+
if (error.code === 'ECONNRESET' || error.code === 'ETIMEDOUT' || error.message.includes('timeout')) {
|
|
133
|
+
return true;
|
|
132
134
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
json = JSON.parse(JSON.stringify(result.data));
|
|
135
|
+
// Server errors (5xx)
|
|
136
|
+
if (((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) >= 500) {
|
|
137
|
+
return true;
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
// Rate limiting (429)
|
|
140
|
+
if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 429) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Log detailed error information
|
|
147
|
+
*/
|
|
148
|
+
static logDetailedError(error, url) {
|
|
149
|
+
if (error.response) {
|
|
150
|
+
logger_1.default.error(`Error for ${url}: ${error.message}`);
|
|
151
|
+
logger_1.default.error(`Status: ${error.response.status}`);
|
|
152
|
+
if (error.response.data) {
|
|
153
|
+
if (typeof error.response.data === 'string') {
|
|
154
|
+
logger_1.default.error(`Response: ${error.response.data.substring(0, 200)}`);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const dataMessage = error.response.data.message || JSON.stringify(error.response.data).substring(0, 200);
|
|
158
|
+
logger_1.default.error(`Response: ${dataMessage}`);
|
|
159
|
+
}
|
|
148
160
|
}
|
|
149
|
-
throw e;
|
|
150
161
|
}
|
|
151
|
-
|
|
162
|
+
else {
|
|
163
|
+
logger_1.default.error(`Error for ${url}: ${error.message}`);
|
|
164
|
+
}
|
|
152
165
|
}
|
|
153
|
-
static
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
method: requestMethod,
|
|
158
|
-
auth: {
|
|
159
|
-
username: '',
|
|
160
|
-
password: pat,
|
|
161
|
-
},
|
|
162
|
-
data: data,
|
|
163
|
-
};
|
|
164
|
-
let result;
|
|
165
|
-
logger_1.default.silly(`making request:
|
|
166
|
-
url: ${url}
|
|
167
|
-
config: ${JSON.stringify(config)}`);
|
|
168
|
-
try {
|
|
169
|
-
result = await (0, axios_1.default)(url, config);
|
|
166
|
+
static getErrorMessage(error) {
|
|
167
|
+
var _b, _c, _d;
|
|
168
|
+
if ((_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) {
|
|
169
|
+
return JSON.stringify(error.response.data.message);
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
171
|
+
else if ((_d = error.response) === null || _d === void 0 ? void 0 : _d.data) {
|
|
172
|
+
return JSON.stringify(error.response.data);
|
|
173
|
+
}
|
|
174
|
+
else if (error.response) {
|
|
175
|
+
return `HTTP ${error.response.status}`;
|
|
176
|
+
}
|
|
177
|
+
else if (error.message) {
|
|
178
|
+
return error.message;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
return 'Unknown error occurred';
|
|
182
182
|
}
|
|
183
|
-
return result;
|
|
184
183
|
}
|
|
185
184
|
}
|
|
186
185
|
exports.TFSServices = TFSServices;
|
|
186
|
+
_a = TFSServices;
|
|
187
|
+
// Connection pooling
|
|
188
|
+
TFSServices.connectionPool = {
|
|
189
|
+
httpAgent: new (require('http').Agent)({
|
|
190
|
+
keepAlive: true,
|
|
191
|
+
maxSockets: 50, // Allow more connections
|
|
192
|
+
keepAliveMsecs: 30000, // Keep connections alive longer
|
|
193
|
+
}),
|
|
194
|
+
httpsAgent: new (require('https').Agent)({
|
|
195
|
+
keepAlive: true,
|
|
196
|
+
maxSockets: 50,
|
|
197
|
+
keepAliveMsecs: 30000,
|
|
198
|
+
}),
|
|
199
|
+
};
|
|
200
|
+
// Axios instance with connection reuse
|
|
201
|
+
TFSServices.axiosInstance = axios_1.default.create({
|
|
202
|
+
httpAgent: _a.connectionPool.httpAgent,
|
|
203
|
+
httpsAgent: _a.connectionPool.httpsAgent,
|
|
204
|
+
});
|
|
187
205
|
//# sourceMappingURL=tfs.js.map
|
package/bin/helpers/tfs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tfs.js","sourceRoot":"","sources":["../../src/helpers/tfs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tfs.js","sourceRoot":"","sources":["../../src/helpers/tfs.ts"],"names":[],"mappings":";;;;AAAA,iCAAiE;AACjE,4CAAqC;AAErC,MAAa,WAAW;IAqBf,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,GAAW,EAAE,GAAW;QAC1D,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;gBAC3C,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,EAAE,cAAc,EAAE,iBAAiB,EAAE;gBAC9C,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;gBACrC,OAAO,EAAE,KAAK,EAAE,oCAAoC;aACrD,CAAC,CAAC;YACH,OAAO,GAAG,CAAC;QACb,CAAC;QAAC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;
|
|
7
9
|
constructor(orgUrl: string, token: string);
|
|
10
|
+
private fetchWithCache;
|
|
8
11
|
GetTestSuiteByTestCase(testCaseId: string): Promise<any>;
|
|
9
12
|
GetTestPlans(project: string): Promise<string>;
|
|
10
13
|
GetTestSuites(project: string, planId: string): Promise<any>;
|
|
11
14
|
GetTestSuitesForPlan(project: string, planid: string): Promise<any>;
|
|
12
15
|
GetTestSuitesByPlan(project: string, planId: string, recursive: boolean): Promise<any>;
|
|
13
16
|
GetTestSuiteById(project: string, planId: string, suiteId: string, recursive: boolean): Promise<any>;
|
|
14
|
-
GetTestCasesBySuites(project: string, planId: string, suiteId: string,
|
|
15
|
-
StructureTestCase(project: string, testCases: any, suite: suiteData, includeRequirements: boolean, CustomerRequirementId: boolean, requirementToTestCaseTraceMap: Map<string, string[]>, testCaseToRequirementsTraceMap: Map<string, string[]>, stepResultDetailsMap?: Map<string, any>): Promise<
|
|
17
|
+
GetTestCasesBySuites(project: string, planId: string, suiteId: string, recursive: boolean, includeRequirements: boolean, CustomerRequirementId: boolean, stepResultDetailsMap?: Map<string, any>): Promise<any>;
|
|
18
|
+
StructureTestCase(project: string, testCases: any, suite: suiteData, includeRequirements: boolean, CustomerRequirementId: boolean, requirementToTestCaseTraceMap: Map<string, string[]>, testCaseToRequirementsTraceMap: Map<string, string[]>, stepResultDetailsMap?: Map<string, any>): Promise<any[]>;
|
|
16
19
|
private createNewRequirement;
|
|
17
20
|
ParseSteps(steps: string): TestSteps[];
|
|
18
21
|
GetTestCases(project: string, planId: string, suiteId: string): Promise<any>;
|
|
@@ -24,4 +27,8 @@ export default class TestDataProvider {
|
|
|
24
27
|
GetTestRunById(projectName: string, runId: string): Promise<any>;
|
|
25
28
|
GetTestPointByTestCaseId(projectName: string, testCaseId: string): Promise<any>;
|
|
26
29
|
private addToMap;
|
|
30
|
+
/**
|
|
31
|
+
* Clears the cache to free memory
|
|
32
|
+
*/
|
|
33
|
+
clearCache(): void;
|
|
27
34
|
}
|