@reportportal/client-javascript 5.5.8 → 5.5.10

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.
Files changed (3) hide show
  1. package/VERSION +1 -1
  2. package/index.d.ts +443 -0
  3. package/package.json +4 -3
package/VERSION CHANGED
@@ -1 +1 @@
1
- 5.5.9-SNAPSHOT
1
+ 5.5.11-SNAPSHOT
package/index.d.ts ADDED
@@ -0,0 +1,443 @@
1
+ declare module '@reportportal/client-javascript' {
2
+ /**
3
+ * OAuth 2.0 configuration for password grant flow.
4
+ */
5
+ export interface OAuthConfig {
6
+ /**
7
+ * OAuth 2.0 token endpoint URL for password grant flow.
8
+ */
9
+ tokenEndpoint: string;
10
+ /**
11
+ * Username for OAuth 2.0 password grant.
12
+ */
13
+ username: string;
14
+ /**
15
+ * Password for OAuth 2.0 password grant.
16
+ */
17
+ password: string;
18
+ /**
19
+ * OAuth 2.0 client ID.
20
+ */
21
+ clientId: string;
22
+ /**
23
+ * OAuth 2.0 client secret (optional, depending on your OAuth server configuration).
24
+ */
25
+ clientSecret?: string;
26
+ /**
27
+ * OAuth 2.0 scope (optional, space-separated list of scopes).
28
+ */
29
+ scope?: string;
30
+ }
31
+
32
+ /**
33
+ * Proxy configuration object.
34
+ */
35
+ export interface ProxyConfig {
36
+ /**
37
+ * Protocol for the proxy (http or https).
38
+ */
39
+ protocol?: string;
40
+ /**
41
+ * Proxy host.
42
+ */
43
+ host: string;
44
+ /**
45
+ * Proxy port.
46
+ */
47
+ port: number;
48
+ /**
49
+ * Optional authentication for the proxy.
50
+ */
51
+ auth?: {
52
+ username: string;
53
+ password: string;
54
+ };
55
+ /**
56
+ * Optional debug logs for the proxy.
57
+ */
58
+ debug?: boolean;
59
+ }
60
+
61
+ /**
62
+ * REST client configuration options.
63
+ */
64
+ export interface RestClientConfig {
65
+ /**
66
+ * Request timeout in milliseconds.
67
+ */
68
+ timeout?: number;
69
+ /**
70
+ * Proxy configuration. Can be:
71
+ * - false: Disable proxy
72
+ * - string: Proxy URL (e.g., 'http://proxy.example.com:8080')
73
+ * - ProxyConfig object: Detailed proxy configuration
74
+ */
75
+ proxy?: false | string | ProxyConfig;
76
+ /**
77
+ * Comma-separated list of domains to bypass proxy.
78
+ * Example: 'localhost,127.0.0.1,.example.com'
79
+ * This takes precedence over NO_PROXY environment variable.
80
+ */
81
+ noProxy?: string;
82
+ /**
83
+ * Custom HTTP agent options.
84
+ */
85
+ agent?: any;
86
+ /**
87
+ * Retry configuration.
88
+ */
89
+ retry?: number | any;
90
+ /**
91
+ * Enable debug logging.
92
+ */
93
+ debug?: boolean;
94
+ /**
95
+ * Any other axios configuration options.
96
+ */
97
+ [key: string]: any;
98
+ }
99
+
100
+ /**
101
+ * Configuration options for initializing the Report Portal client.
102
+ *
103
+ * @example API Key Authentication
104
+ * ```typescript
105
+ * const rp = new ReportPortalClient({
106
+ * endpoint: 'https://your.reportportal.server/api/v1',
107
+ * project: 'your_project_name',
108
+ * apiKey: 'your_api_key',
109
+ * });
110
+ * ```
111
+ *
112
+ * @example OAuth 2.0 Authentication
113
+ * ```typescript
114
+ * const rp = new ReportPortalClient({
115
+ * endpoint: 'https://your.reportportal.server/api/v1',
116
+ * project: 'your_project_name',
117
+ * oauth: {
118
+ * tokenEndpoint: 'https://your-oauth-server.com/oauth/token',
119
+ * username: 'your-username',
120
+ * password: 'your-password',
121
+ * clientId: 'your-client-id',
122
+ * clientSecret: 'your-client-secret', // optional
123
+ * scope: 'reportportal', // optional
124
+ * }
125
+ * });
126
+ * ```
127
+ *
128
+ * @example With Proxy Configuration
129
+ * ```typescript
130
+ * const rp = new ReportPortalClient({
131
+ * endpoint: 'https://your.reportportal.server/api/v1',
132
+ * project: 'your_project_name',
133
+ * apiKey: 'your_api_key',
134
+ * restClientConfig: {
135
+ * proxy: {
136
+ * protocol: 'https',
137
+ * host: '127.0.0.1',
138
+ * port: 8080,
139
+ * },
140
+ * noProxy: 'localhost,.local.domain',
141
+ * }
142
+ * });
143
+ * ```
144
+ */
145
+ export interface ReportPortalConfig {
146
+ apiKey?: string;
147
+ endpoint: string;
148
+ launch: string;
149
+ project: string;
150
+ headers?: Record<string, string>;
151
+ debug?: boolean;
152
+ isLaunchMergeRequired?: boolean;
153
+ launchUuidPrint?: boolean;
154
+ launchUuidPrintOutput?: string;
155
+ restClientConfig?: RestClientConfig;
156
+ token?: string;
157
+ skippedIsNotIssue?: boolean;
158
+ /**
159
+ * OAuth 2.0 configuration object. When provided, OAuth authentication will be used instead of API key.
160
+ */
161
+ oauth?: OAuthConfig;
162
+ }
163
+
164
+ /**
165
+ * Options to start a new launch.
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * const launch = rp.startLaunch({
170
+ * name: 'My Test Launch',
171
+ * startTime: rp.helpers.now(),
172
+ * });
173
+ * ```
174
+ */
175
+ export interface LaunchOptions {
176
+ name?: string;
177
+ startTime?: string | number;
178
+ description?: string;
179
+ attributes?: Array<{ key?: string; value?: string } | string>;
180
+ mode?: string;
181
+ id?: string;
182
+ }
183
+
184
+ /**
185
+ * Options to start a new test item (e.g., test case or suite).
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const testItem = rp.startTestItem({
190
+ * name: 'My Test Case',
191
+ * type: 'TEST',
192
+ * startTime: rp.helpers.now(),
193
+ * });
194
+ * ```
195
+ */
196
+ export interface StartTestItemOptions {
197
+ name: string;
198
+ type: string;
199
+ description?: string;
200
+ startTime?: string | number;
201
+ attributes?: Array<{ key?: string; value?: string } | string>;
202
+ hasStats?: boolean;
203
+ }
204
+
205
+ /**
206
+ * Options to send logs to Report Portal.
207
+ *
208
+ * @example
209
+ * ```typescript
210
+ * await rp.sendLog(testItem.tempId, {
211
+ * level: 'INFO',
212
+ * message: 'Step executed successfully',
213
+ * time: rp.helpers.now(),
214
+ * });
215
+ * ```
216
+ */
217
+ export interface LogOptions {
218
+ level?: string;
219
+ message?: string;
220
+ time?: string | number;
221
+ file?: {
222
+ name: string;
223
+ content: string;
224
+ type: string;
225
+ };
226
+ }
227
+
228
+ /**
229
+ * Options to finish a test item.
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * await rp.finishTestItem(testItem.tempId, {
234
+ * status: 'PASSED',
235
+ * endTime: rp.helpers.now(),
236
+ * });
237
+ * ```
238
+ */
239
+ export interface FinishTestItemOptions {
240
+ status?: string;
241
+ endTime?: string | number;
242
+ issue?: {
243
+ issueType: string;
244
+ comment?: string;
245
+ externalSystemIssues?: Array<any>;
246
+ };
247
+ }
248
+
249
+ /**
250
+ * Options to finish a launch.
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * await rp.finishLaunch(launch.tempId, {
255
+ * endTime: rp.helpers.now(),
256
+ * });
257
+ * ```
258
+ */
259
+ export interface FinishLaunchOptions {
260
+ endTime?: string | number;
261
+ status?: string;
262
+ }
263
+
264
+ /**
265
+ * Main Report Portal client for interacting with the API.
266
+ */
267
+ export default class ReportPortalClient {
268
+ /**
269
+ * Initializes a new Report Portal client.
270
+ */
271
+ constructor(config: ReportPortalConfig, agentInfo?: { name?: string; version?: string });
272
+
273
+ /**
274
+ * Starts a new launch.
275
+ * @example
276
+ * ```typescript
277
+ * const launchObj = rpClient.startLaunch({
278
+ * name: 'Client test',
279
+ * startTime: rpClient.helpers.now(),
280
+ * description: 'description of the launch',
281
+ * attributes: [
282
+ * {
283
+ * 'key': 'yourKey',
284
+ * 'value': 'yourValue'
285
+ * },
286
+ * {
287
+ * 'value': 'yourValue'
288
+ * }
289
+ * ],
290
+ * //this param used only when you need client to send data into the existing launch
291
+ * id: 'id'
292
+ * });
293
+ * await launchObj.promise;
294
+ * ```
295
+ */
296
+ startLaunch(options: LaunchOptions): { tempId: string; promise: Promise<any> };
297
+
298
+ /**
299
+ * Finishes an active launch.
300
+ * @example
301
+ * ```typescript
302
+ * const launchFinishObj = rpClient.finishLaunch(launchObj.tempId, {
303
+ * endTime: rpClient.helpers.now()
304
+ * });
305
+ * await launchFinishObj.promise;
306
+ * ```
307
+ */
308
+ finishLaunch(
309
+ launchId: string,
310
+ options?: FinishLaunchOptions,
311
+ ): { tempId: string; promise: Promise<any> };
312
+
313
+ /**
314
+ * Update the launch data
315
+ * @example
316
+ * ```typescript
317
+ * const updateLunch = rpClient.updateLaunch(
318
+ * launchObj.tempId,
319
+ * {
320
+ * description: 'new launch description',
321
+ * attributes: [
322
+ * {
323
+ * key: 'yourKey',
324
+ * value: 'yourValue'
325
+ * },
326
+ * {
327
+ * value: 'yourValue'
328
+ * }
329
+ * ],
330
+ * mode: 'DEBUG'
331
+ * }
332
+ * );
333
+ * await updateLaunch.promise;
334
+ * ```
335
+ */
336
+ updateLaunch(
337
+ launchId: string,
338
+ options: LaunchOptions,
339
+ ): { tempId: string; promise: Promise<any> };
340
+
341
+ /**
342
+ * Starts a new test item under a launch or parent item.
343
+ * @example
344
+ * ```typescript
345
+ * const suiteObj = rpClient.startTestItem({
346
+ * description: makeid(),
347
+ * name: makeid(),
348
+ * startTime: rpClient.helpers.now(),
349
+ * type: 'SUITE'
350
+ * }, launchObj.tempId);
351
+ * const stepObj = rpClient.startTestItem({
352
+ * description: makeid(),
353
+ * name: makeid(),
354
+ * startTime: rpClient.helpers.now(),
355
+ * attributes: [
356
+ * {
357
+ * key: 'yourKey',
358
+ * value: 'yourValue'
359
+ * },
360
+ * {
361
+ * value: 'yourValue'
362
+ * }
363
+ * ],
364
+ * type: 'STEP'
365
+ * }, launchObj.tempId, suiteObj.tempId);
366
+ * ```
367
+ */
368
+ startTestItem(
369
+ options: StartTestItemOptions,
370
+ launchId: string,
371
+ parentId?: string,
372
+ ): {
373
+ tempId: string;
374
+ promise: Promise<any>;
375
+ };
376
+
377
+ /**
378
+ * Finishes a test item.
379
+ * @example
380
+ * ```typescript
381
+ * const finishObj = rpClient.finishTestItem(itemObj.tempId, {
382
+ * status: 'failed'
383
+ * });
384
+ * await finishObj.promise;
385
+ * ```
386
+ */
387
+ finishTestItem(
388
+ itemId: string,
389
+ options: FinishTestItemOptions,
390
+ ): { tempId: string; promise: Promise<any> };
391
+
392
+ /**
393
+ * Sends a log entry to a test item.
394
+ * @example
395
+ * ```typescript
396
+ * const logObj = rpClient.sendLog(stepObj.tempId, {
397
+ * level: 'INFO',
398
+ * message: 'User clicks login button',
399
+ * time: rpClient.helpers.now()
400
+ * });
401
+ * await logObj.promise;
402
+ * ```
403
+ */
404
+ sendLog(
405
+ itemId: string,
406
+ options: LogOptions,
407
+ file?: { name: string; content: string | Buffer; type: string },
408
+ ): { tempId: string; promise: Promise<any> };
409
+
410
+ /**
411
+ * Waits for all test items to be finished.
412
+ * @example
413
+ * ```typescript
414
+ * await agent.getPromiseFinishAllItems(agent.tempLaunchId);
415
+ * ```
416
+ */
417
+ getPromiseFinishAllItems(launchId: string): Promise<any>;
418
+
419
+ /**
420
+ * Check if connection is established
421
+ * @example
422
+ * ```typescript
423
+ * await agent.checkConnect();
424
+ * ```
425
+ */
426
+ checkConnect(): Promise<any>;
427
+
428
+ helpers: {
429
+ /**
430
+ * Generate ISO timestamp
431
+ * @example
432
+ * ```typescript
433
+ * await rpClient.sendLog(stepObj.tempId, {
434
+ * level: 'INFO',
435
+ * message: 'User clicks login button',
436
+ * time: rpClient.helpers.now()
437
+ * });
438
+ * ```
439
+ */
440
+ now(): string;
441
+ };
442
+ }
443
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportportal/client-javascript",
3
- "version": "5.5.8",
3
+ "version": "5.5.10",
4
4
  "description": "ReportPortal client for Node.js",
5
5
  "author": "ReportPortal.io",
6
6
  "scripts": {
@@ -17,7 +17,8 @@
17
17
  "files": [
18
18
  "/lib",
19
19
  "/statistics",
20
- "/VERSION"
20
+ "/VERSION",
21
+ "index.d.ts"
21
22
  ],
22
23
  "main": "./lib/report-portal-client",
23
24
  "types": "./index.d.ts",
@@ -27,7 +28,7 @@
27
28
  "dependencies": {
28
29
  "axios": "^1.12.2",
29
30
  "axios-retry": "^4.5.0",
30
- "glob": "^11.1.0",
31
+ "glob": "^13.0.1",
31
32
  "http-proxy-agent": "^7.0.2",
32
33
  "https-proxy-agent": "^7.0.6",
33
34
  "ini": "^2.0.0",