@reportportal/client-javascript 5.0.15 → 5.1.1
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/README.md +1 -1
- package/VERSION +1 -1
- package/lib/rest.js +44 -1
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ When creating a client instance, you need to specify the following options:
|
|
|
61
61
|
| headers | Optional | {} | The object with custom headers for internal http client. |
|
|
62
62
|
| debug | Optional | false | This flag allows seeing the logs of the client. Useful for debugging. |
|
|
63
63
|
| isLaunchMergeRequired | Optional | false | Allows client to merge launches into one at the end of the run via saving their UUIDs to the temp files at filesystem . At the end of the run launches can be merged using `mergeLaunches` method. Temp file format: `rplaunch-${launch_uuid}.tmp`. |
|
|
64
|
-
| restClientConfig | Optional | Not set | The object with `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, may contain other client options eg. `timeout`.
|
|
64
|
+
| restClientConfig | Optional | Not set | The object with `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, may contain other client options eg. `timeout`. For debugging and displaying logs you can set `debug: true` |
|
|
65
65
|
| launchUuidPrint | Optional | false | Whether to print the current launch UUID. |
|
|
66
66
|
| launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR'. Works only if `launchUuidPrint` set to `true`. |
|
|
67
67
|
| token | Deprecated | Not set | Use `apiKey` instead. |
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.
|
|
1
|
+
5.1.2-SNAPSHOT
|
package/lib/rest.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
|
-
const axiosRetry = require('axios-retry');
|
|
2
|
+
const axiosRetry = require('axios-retry').default;
|
|
3
3
|
const http = require('http');
|
|
4
4
|
const https = require('https');
|
|
5
5
|
|
|
@@ -16,6 +16,8 @@ class RestClient {
|
|
|
16
16
|
this.baseURL = options.baseURL;
|
|
17
17
|
this.headers = options.headers;
|
|
18
18
|
this.restClientConfig = options.restClientConfig;
|
|
19
|
+
|
|
20
|
+
addLogger(this.restClientConfig ? this.restClientConfig.debug : false);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
buildPath(path) {
|
|
@@ -112,4 +114,45 @@ method: ${method}`,
|
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
|
|
117
|
+
const addLogger = (debug) => {
|
|
118
|
+
if (debug) {
|
|
119
|
+
axios.interceptors.request.use((config) => {
|
|
120
|
+
const startDate = new Date();
|
|
121
|
+
config.startTime = startDate.valueOf();
|
|
122
|
+
|
|
123
|
+
console.log(`Request method=${config.method} url=${config.url} [${startDate.toISOString()}]`);
|
|
124
|
+
|
|
125
|
+
return config;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
axios.interceptors.response.use(
|
|
129
|
+
(response) => {
|
|
130
|
+
const date = new Date();
|
|
131
|
+
const { status, config } = response;
|
|
132
|
+
|
|
133
|
+
console.log(
|
|
134
|
+
`Response status=${status} url=${config.url} time=${
|
|
135
|
+
date.valueOf() - config.startTime
|
|
136
|
+
}ms [${date.toISOString()}]`,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
return response;
|
|
140
|
+
},
|
|
141
|
+
(error) => {
|
|
142
|
+
const date = new Date();
|
|
143
|
+
const { response, config } = error;
|
|
144
|
+
const status = response ? response.status : null;
|
|
145
|
+
|
|
146
|
+
console.log(
|
|
147
|
+
`Response ${status ? 'status=' + status : "message='" + error.message + "'"} url=${
|
|
148
|
+
config.url
|
|
149
|
+
} time=${date.valueOf() - config.startTime}ms [${date.toISOString()}]`,
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
return Promise.reject(error);
|
|
153
|
+
},
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
115
158
|
module.exports = RestClient;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reportportal/client-javascript",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "ReportPortal client for Node.js",
|
|
5
5
|
"author": "ReportPortal.io",
|
|
6
6
|
"scripts": {
|
|
@@ -21,37 +21,37 @@
|
|
|
21
21
|
],
|
|
22
22
|
"main": "./lib/report-portal-client",
|
|
23
23
|
"engines": {
|
|
24
|
-
"node": ">=
|
|
24
|
+
"node": ">=12.x"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"axios": "^
|
|
28
|
-
"axios-retry": "^
|
|
27
|
+
"axios": "^1.6.5",
|
|
28
|
+
"axios-retry": "^4.0.0",
|
|
29
29
|
"glob": "^7.2.3",
|
|
30
30
|
"ini": "^2.0.0",
|
|
31
31
|
"uniqid": "^5.4.0",
|
|
32
|
-
"uuid": "^9.0.
|
|
32
|
+
"uuid": "^9.0.1"
|
|
33
33
|
},
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/jasmine": "^4.
|
|
37
|
-
"@types/node": "^18.
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "
|
|
39
|
-
"@typescript-eslint/parser": "^5.
|
|
36
|
+
"@types/jasmine": "^4.6.4",
|
|
37
|
+
"@types/node": "^18.19.8",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "5.62.0",
|
|
39
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
40
40
|
"eslint": "^7.32.0",
|
|
41
41
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
42
|
-
"eslint-config-airbnb-typescript": "^17.
|
|
43
|
-
"eslint-config-prettier": "^8.
|
|
44
|
-
"eslint-plugin-import": "^2.
|
|
42
|
+
"eslint-config-airbnb-typescript": "^17.1.0",
|
|
43
|
+
"eslint-config-prettier": "^8.10.0",
|
|
44
|
+
"eslint-plugin-import": "^2.29.1",
|
|
45
45
|
"eslint-plugin-node": "^11.1.0",
|
|
46
46
|
"eslint-plugin-prettier": "^4.2.1",
|
|
47
47
|
"jasmine": "^3.10.0",
|
|
48
48
|
"jasmine-ts": "^0.4.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
50
|
-
"nock": "^13.
|
|
50
|
+
"nock": "^13.5.0",
|
|
51
51
|
"nyc": "^15.1.0",
|
|
52
|
-
"prettier": "^2.8.
|
|
52
|
+
"prettier": "^2.8.8",
|
|
53
53
|
"rimraf": "^3.0.2",
|
|
54
|
-
"ts-node": "^10.9.
|
|
54
|
+
"ts-node": "^10.9.2",
|
|
55
55
|
"typescript": "^4.9.5"
|
|
56
56
|
},
|
|
57
57
|
"contributors": [
|