@reportportal/client-javascript 5.5.10 → 5.5.12

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 CHANGED
@@ -1 +1 @@
1
- 5.5.11-SNAPSHOT
1
+ 5.5.13-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.
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable quotes,no-console,class-methods-use-this */
2
- const UniqId = require('uniqid');
2
+ const { randomUUID } = require('crypto');
3
3
  const { URLSearchParams } = require('url');
4
4
  const helpers = require('./helpers');
5
5
  const RestClient = require('./rest');
@@ -100,7 +100,7 @@ class RPClient {
100
100
  }
101
101
 
102
102
  getUniqId() {
103
- return UniqId();
103
+ return randomUUID();
104
104
  }
105
105
 
106
106
  getRejectAnswer(tempId, error) {
@@ -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.10",
3
+ "version": "5.5.12",
4
4
  "description": "ReportPortal client for Node.js",
5
5
  "author": "ReportPortal.io",
6
6
  "scripts": {
@@ -23,18 +23,16 @@
23
23
  "main": "./lib/report-portal-client",
24
24
  "types": "./index.d.ts",
25
25
  "engines": {
26
- "node": ">=14.x"
26
+ "node": ">=14.17.0"
27
27
  },
28
28
  "dependencies": {
29
- "axios": "^1.12.2",
29
+ "axios": "^1.15.2",
30
30
  "axios-retry": "^4.5.0",
31
- "glob": "^13.0.1",
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",
35
- "proxy-from-env": "^1.1.0",
36
- "uniqid": "^5.4.0",
37
- "uuid": "^9.0.1"
35
+ "proxy-from-env": "^1.1.0"
38
36
  },
39
37
  "license": "Apache-2.0",
40
38
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const util = require('util');
3
3
  const ini = require('ini');
4
- const { v4: uuidv4 } = require('uuid');
4
+ const { randomUUID } = require('crypto');
5
5
  const { ENCODING, CLIENT_ID_KEY, RP_FOLDER_PATH, RP_PROPERTIES_FILE_PATH } = require('./constants');
6
6
 
7
7
  const exists = util.promisify(fs.exists);
@@ -33,7 +33,7 @@ async function storeClientId(clientId) {
33
33
  async function getClientId() {
34
34
  let clientId = await readClientId();
35
35
  if (!clientId) {
36
- clientId = uuidv4(undefined, undefined, 0);
36
+ clientId = randomUUID();
37
37
  try {
38
38
  await storeClientId(clientId);
39
39
  } catch (ignore) {
@@ -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 = {