@reportportal/client-javascript 5.5.10 → 5.5.11
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/VERSION +1 -1
- package/index.d.ts +1 -1
- package/lib/report-portal-client.js +18 -0
- package/package.json +3 -3
- package/statistics/statistics.js +11 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.5.
|
|
1
|
+
5.5.12-SNAPSHOT
|
package/index.d.ts
CHANGED
|
@@ -268,7 +268,7 @@ declare module '@reportportal/client-javascript' {
|
|
|
268
268
|
/**
|
|
269
269
|
* Initializes a new Report Portal client.
|
|
270
270
|
*/
|
|
271
|
-
constructor(config: ReportPortalConfig, agentInfo?: { name?: string; version?: string });
|
|
271
|
+
constructor(config: ReportPortalConfig, agentInfo?: { name?: string; version?: string; framework_version?: string });
|
|
272
272
|
|
|
273
273
|
/**
|
|
274
274
|
* Starts a new launch.
|
|
@@ -146,10 +146,28 @@ class RPClient {
|
|
|
146
146
|
return this.restClient.request('GET', url, {});
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
getServerInfoUrl() {
|
|
150
|
+
return this.config.endpoint.replace('/v1', '/info').replace('/v2', '/info');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async fetchServerInfo() {
|
|
154
|
+
const url = this.getServerInfoUrl();
|
|
155
|
+
return this.restClient.request('GET', url, {});
|
|
156
|
+
}
|
|
157
|
+
|
|
149
158
|
async triggerStatisticsEvent() {
|
|
150
159
|
if (process.env.REPORTPORTAL_CLIENT_JS_NO_ANALYTICS) {
|
|
151
160
|
return;
|
|
152
161
|
}
|
|
162
|
+
try {
|
|
163
|
+
const serverInfo = await this.fetchServerInfo();
|
|
164
|
+
const instanceID = serverInfo?.extensions?.result?.['server.details.instance'];
|
|
165
|
+
if (instanceID) {
|
|
166
|
+
this.statistics.setInstanceID(instanceID);
|
|
167
|
+
}
|
|
168
|
+
} catch (e) {
|
|
169
|
+
this.statistics.setInstanceID('not_set');
|
|
170
|
+
}
|
|
153
171
|
await this.statistics.trackEvent();
|
|
154
172
|
}
|
|
155
173
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reportportal/client-javascript",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.11",
|
|
4
4
|
"description": "ReportPortal client for Node.js",
|
|
5
5
|
"author": "ReportPortal.io",
|
|
6
6
|
"scripts": {
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"node": ">=14.x"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"axios": "^1.
|
|
29
|
+
"axios": "^1.15.2",
|
|
30
30
|
"axios-retry": "^4.5.0",
|
|
31
|
-
"glob": "^13.0.
|
|
31
|
+
"glob": "^13.0.6",
|
|
32
32
|
"http-proxy-agent": "^7.0.2",
|
|
33
33
|
"https-proxy-agent": "^7.0.6",
|
|
34
34
|
"ini": "^2.0.0",
|
package/statistics/statistics.js
CHANGED
|
@@ -24,9 +24,20 @@ class Statistics {
|
|
|
24
24
|
if (agentParams && hasOption(agentParams, 'version') && agentParams.version) {
|
|
25
25
|
params.agent_version = agentParams.version;
|
|
26
26
|
}
|
|
27
|
+
if (
|
|
28
|
+
agentParams &&
|
|
29
|
+
hasOption(agentParams, 'framework_version') &&
|
|
30
|
+
agentParams.framework_version
|
|
31
|
+
) {
|
|
32
|
+
params.framework_version = agentParams.framework_version;
|
|
33
|
+
}
|
|
27
34
|
return params;
|
|
28
35
|
}
|
|
29
36
|
|
|
37
|
+
setInstanceID(instanceID) {
|
|
38
|
+
this.eventParams.instanceID = instanceID;
|
|
39
|
+
}
|
|
40
|
+
|
|
30
41
|
async trackEvent() {
|
|
31
42
|
try {
|
|
32
43
|
const requestBody = {
|