@reportportal/client-javascript 5.5.11 → 5.6.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.
Files changed (107) hide show
  1. package/README.md +22 -0
  2. package/VERSION +1 -1
  3. package/build/commons/config.d.ts +5 -0
  4. package/build/commons/config.js +125 -0
  5. package/build/commons/config.js.map +1 -0
  6. package/build/commons/errors.d.ts +9 -0
  7. package/build/commons/errors.js +28 -0
  8. package/build/commons/errors.js.map +1 -0
  9. package/build/constants/events.d.ts +9 -0
  10. package/build/constants/events.js +14 -0
  11. package/build/constants/events.js.map +1 -0
  12. package/build/constants/index.d.ts +7 -0
  13. package/build/constants/index.js +19 -0
  14. package/build/constants/index.js.map +1 -0
  15. package/build/constants/launchModes.d.ts +4 -0
  16. package/build/constants/launchModes.js +9 -0
  17. package/build/constants/launchModes.js.map +1 -0
  18. package/build/constants/logLevels.d.ts +9 -0
  19. package/build/constants/logLevels.js +13 -0
  20. package/build/constants/logLevels.js.map +1 -0
  21. package/build/constants/mergeTypes.d.ts +4 -0
  22. package/build/constants/mergeTypes.js +9 -0
  23. package/build/constants/mergeTypes.js.map +1 -0
  24. package/build/constants/outputs.d.ts +2 -0
  25. package/build/constants/outputs.js +35 -0
  26. package/build/constants/outputs.js.map +1 -0
  27. package/build/constants/statuses.d.ts +14 -0
  28. package/build/constants/statuses.js +19 -0
  29. package/build/constants/statuses.js.map +1 -0
  30. package/build/constants/testItemTypes.d.ts +17 -0
  31. package/build/constants/testItemTypes.js +22 -0
  32. package/build/constants/testItemTypes.js.map +1 -0
  33. package/build/helpers.d.ts +22 -0
  34. package/build/helpers.js +110 -0
  35. package/build/helpers.js.map +1 -0
  36. package/build/logger.d.ts +2 -0
  37. package/build/logger.js +28 -0
  38. package/build/logger.js.map +1 -0
  39. package/build/models/common.d.ts +37 -0
  40. package/build/models/common.js +3 -0
  41. package/build/models/common.js.map +1 -0
  42. package/build/models/config.d.ts +97 -0
  43. package/build/models/config.js +3 -0
  44. package/build/models/config.js.map +1 -0
  45. package/build/models/index.d.ts +5 -0
  46. package/build/models/index.js +22 -0
  47. package/build/models/index.js.map +1 -0
  48. package/build/models/reporting.d.ts +11 -0
  49. package/build/models/reporting.js +3 -0
  50. package/build/models/reporting.js.map +1 -0
  51. package/build/models/requests.d.ts +84 -0
  52. package/build/models/requests.js +3 -0
  53. package/build/models/requests.js.map +1 -0
  54. package/build/models/responses.d.ts +87 -0
  55. package/build/models/responses.js +3 -0
  56. package/build/models/responses.js.map +1 -0
  57. package/build/oauth.d.ts +42 -0
  58. package/build/oauth.js +182 -0
  59. package/build/oauth.js.map +1 -0
  60. package/build/pjson.d.ts +2 -0
  61. package/build/pjson.js +28 -0
  62. package/build/pjson.js.map +1 -0
  63. package/build/proxyHelper.d.ts +28 -0
  64. package/build/proxyHelper.js +173 -0
  65. package/build/proxyHelper.js.map +1 -0
  66. package/build/publicReportingAPI.d.ts +37 -0
  67. package/build/publicReportingAPI.js +56 -0
  68. package/build/publicReportingAPI.js.map +1 -0
  69. package/build/report-portal-client.d.ts +99 -0
  70. package/build/report-portal-client.js +607 -0
  71. package/build/report-portal-client.js.map +1 -0
  72. package/build/rest.d.ts +23 -0
  73. package/build/rest.js +205 -0
  74. package/build/rest.js.map +1 -0
  75. package/build/statistics/client-id.d.ts +1 -0
  76. package/build/statistics/client-id.js +73 -0
  77. package/build/statistics/client-id.js.map +1 -0
  78. package/build/statistics/constants.d.ts +11 -0
  79. package/build/statistics/constants.js +52 -0
  80. package/build/statistics/constants.js.map +1 -0
  81. package/build/statistics/statistics.d.ts +19 -0
  82. package/build/statistics/statistics.js +57 -0
  83. package/build/statistics/statistics.js.map +1 -0
  84. package/constants.d.ts +1 -0
  85. package/constants.js +1 -0
  86. package/helpers.d.ts +2 -0
  87. package/helpers.js +1 -0
  88. package/models.d.ts +1 -0
  89. package/package.json +83 -18
  90. package/publicReportingAPI.d.ts +2 -0
  91. package/publicReportingAPI.js +1 -0
  92. package/index.d.ts +0 -443
  93. package/lib/commons/config.js +0 -133
  94. package/lib/commons/errors.js +0 -29
  95. package/lib/constants/events.js +0 -11
  96. package/lib/constants/outputs.js +0 -13
  97. package/lib/constants/statuses.js +0 -12
  98. package/lib/helpers.js +0 -111
  99. package/lib/logger.js +0 -41
  100. package/lib/oauth.js +0 -226
  101. package/lib/proxyHelper.js +0 -232
  102. package/lib/publicReportingAPI.js +0 -92
  103. package/lib/report-portal-client.js +0 -905
  104. package/lib/rest.js +0 -218
  105. package/statistics/client-id.js +0 -46
  106. package/statistics/constants.js +0 -49
  107. package/statistics/statistics.js +0 -63
@@ -0,0 +1,607 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ const crypto_1 = require("crypto");
29
+ const url_1 = require("url");
30
+ const helpers = __importStar(require("./helpers"));
31
+ const rest_1 = __importDefault(require("./rest"));
32
+ const config_1 = require("./commons/config");
33
+ const statistics_1 = __importDefault(require("./statistics/statistics"));
34
+ const constants_1 = require("./statistics/constants");
35
+ const statuses_1 = require("./constants/statuses");
36
+ const MULTIPART_BOUNDARY = Math.floor(Math.random() * 10000000000).toString();
37
+ class RPClient {
38
+ /**
39
+ * Create a client for RP.
40
+ */
41
+ constructor(options, agentParams) {
42
+ this.config = (0, config_1.getClientConfig)(options);
43
+ this.debug = this.config.debug;
44
+ this.isLaunchMergeRequired = this.config.isLaunchMergeRequired;
45
+ this.apiKey = this.config.apiKey;
46
+ // deprecated
47
+ this.token = this.apiKey;
48
+ this.map = {};
49
+ this.baseURL = [this.config.endpoint, this.config.project].join('/');
50
+ const headers = {
51
+ 'User-Agent': 'NodeJS',
52
+ 'Content-Type': 'application/json; charset=UTF-8',
53
+ ...(this.config.headers || {}),
54
+ };
55
+ // Only set API key header if OAuth is not configured
56
+ // OAuth interceptor will handle Authorization header when configured
57
+ if (!this.config.oauth && this.apiKey) {
58
+ headers.Authorization = `Bearer ${this.apiKey}`;
59
+ }
60
+ this.headers = headers;
61
+ this.helpers = helpers;
62
+ this.restClient = new rest_1.default({
63
+ baseURL: this.baseURL,
64
+ headers: this.headers,
65
+ restClientConfig: this.config.restClientConfig,
66
+ oauthConfig: this.config.oauth,
67
+ debug: this.debug,
68
+ });
69
+ this.statistics = new statistics_1.default(constants_1.EVENT_NAME, agentParams);
70
+ this.launchUuid = '';
71
+ this.itemRetriesChainMap = new Map();
72
+ this.itemRetriesChainKeyMapByTempId = new Map();
73
+ }
74
+ logDebug(msg, dataMsg = '') {
75
+ if (this.debug) {
76
+ console.log(msg, dataMsg);
77
+ }
78
+ }
79
+ calculateItemRetriesChainMapKey(launchId, parentId, name, itemId = '') {
80
+ return `${launchId}__${parentId}__${name}__${itemId}`;
81
+ }
82
+ cleanItemRetriesChain(tempIds) {
83
+ tempIds.forEach((id) => {
84
+ const key = this.itemRetriesChainKeyMapByTempId.get(id);
85
+ if (key) {
86
+ this.itemRetriesChainMap.delete(key);
87
+ }
88
+ this.itemRetriesChainKeyMapByTempId.delete(id);
89
+ });
90
+ }
91
+ getUniqId() {
92
+ return (0, crypto_1.randomUUID)();
93
+ }
94
+ getRejectAnswer(tempId, error) {
95
+ return {
96
+ tempId,
97
+ promise: Promise.reject(error),
98
+ };
99
+ }
100
+ getNewItemObj(startPromiseFunc) {
101
+ let resolveFinish;
102
+ let rejectFinish;
103
+ const obj = {
104
+ promiseStart: new Promise(startPromiseFunc),
105
+ realId: '',
106
+ children: [],
107
+ finishSend: false,
108
+ promiseFinish: new Promise((resolve, reject) => {
109
+ resolveFinish = resolve;
110
+ rejectFinish = reject;
111
+ }),
112
+ resolveFinish,
113
+ rejectFinish,
114
+ };
115
+ return obj;
116
+ }
117
+ cleanMap(ids) {
118
+ ids.forEach((id) => {
119
+ delete this.map[id];
120
+ });
121
+ }
122
+ checkConnect() {
123
+ const url = [this.config.endpoint.replace('/v2', '/v1'), this.config.project, 'launch']
124
+ .join('/')
125
+ .concat('?page.page=1&page.size=1');
126
+ return this.restClient.request('GET', url, {});
127
+ }
128
+ getServerInfoUrl() {
129
+ return this.config.endpoint.replace('/v1', '/info').replace('/v2', '/info');
130
+ }
131
+ async fetchServerInfo() {
132
+ const url = this.getServerInfoUrl();
133
+ return this.restClient.request('GET', url, {});
134
+ }
135
+ async triggerStatisticsEvent() {
136
+ if (process.env.REPORTPORTAL_CLIENT_JS_NO_ANALYTICS) {
137
+ return;
138
+ }
139
+ try {
140
+ const serverInfo = await this.fetchServerInfo();
141
+ const instanceID = serverInfo?.extensions?.result?.['server.details.instance'];
142
+ if (instanceID) {
143
+ this.statistics.setInstanceID(instanceID);
144
+ }
145
+ }
146
+ catch (e) {
147
+ this.statistics.setInstanceID('not_set');
148
+ }
149
+ await this.statistics.trackEvent();
150
+ }
151
+ /**
152
+ * Start launch and report it.
153
+ */
154
+ startLaunch(launchDataRQ) {
155
+ const tempId = this.getUniqId();
156
+ // Result of starting or reusing a launch.
157
+ let launchObj;
158
+ if (launchDataRQ.id) {
159
+ this.logDebug(`Use existing launch with tempId ${tempId}`, launchDataRQ);
160
+ launchObj = this.getNewItemObj((resolve) => resolve(launchDataRQ));
161
+ this.map[tempId] = launchObj;
162
+ this.map[tempId].realId = launchDataRQ.id;
163
+ this.launchUuid = launchDataRQ.id;
164
+ }
165
+ else {
166
+ const systemAttr = helpers.getSystemAttributes();
167
+ if (this.config.skippedIsNotIssue === true) {
168
+ const skippedIsNotIssueAttribute = {
169
+ key: 'skippedIssue',
170
+ value: 'false',
171
+ system: true,
172
+ };
173
+ systemAttr.push(skippedIsNotIssueAttribute);
174
+ }
175
+ const attributes = Array.isArray(launchDataRQ.attributes)
176
+ ? launchDataRQ.attributes.concat(systemAttr)
177
+ : systemAttr;
178
+ const launchData = {
179
+ name: this.config.launch || 'Test launch name',
180
+ startTime: this.helpers.now(),
181
+ ...launchDataRQ,
182
+ attributes,
183
+ };
184
+ launchObj = this.getNewItemObj((resolve, reject) => {
185
+ const url = 'launch';
186
+ this.logDebug(`Start launch with tempId ${tempId}`, launchData);
187
+ this.restClient.create(url, launchData).then((response) => {
188
+ this.map[tempId].realId = response.id;
189
+ this.launchUuid = response.id;
190
+ if (this.config.launchUuidPrint) {
191
+ this.config.launchUuidPrintOutput(this.launchUuid);
192
+ }
193
+ if (this.isLaunchMergeRequired) {
194
+ helpers.saveLaunchIdToFile(response.id);
195
+ }
196
+ this.logDebug(`Success start launch with tempId ${tempId}`, response);
197
+ resolve(response);
198
+ }, (error) => {
199
+ this.logDebug(`Error start launch with tempId ${tempId}`, error);
200
+ console.dir(error);
201
+ reject(error);
202
+ });
203
+ });
204
+ this.map[tempId] = launchObj;
205
+ }
206
+ this.triggerStatisticsEvent().catch(console.error);
207
+ return {
208
+ tempId,
209
+ promise: launchObj.promiseStart,
210
+ };
211
+ }
212
+ /**
213
+ * Finish launch.
214
+ */
215
+ finishLaunch(launchTempId, finishExecutionRQ = {}) {
216
+ const launchObj = this.map[launchTempId];
217
+ if (!launchObj) {
218
+ return this.getRejectAnswer(launchTempId, new Error(`Launch with tempId "${launchTempId}" not found`));
219
+ }
220
+ const finishExecutionData = { endTime: this.helpers.now(), ...finishExecutionRQ };
221
+ launchObj.finishSend = true;
222
+ Promise.all(launchObj.children.map((itemId) => this.map[itemId].promiseFinish)).then(() => {
223
+ launchObj.promiseStart.then(() => {
224
+ this.logDebug(`Finish launch with tempId ${launchTempId}`, finishExecutionData);
225
+ const url = ['launch', launchObj.realId, 'finish'].join('/');
226
+ this.restClient.update(url, finishExecutionData).then((response) => {
227
+ this.logDebug(`Success finish launch with tempId ${launchTempId}`, response);
228
+ console.log(`\nReportPortal Launch Link: ${response.link}`);
229
+ launchObj.resolveFinish(response);
230
+ }, (error) => {
231
+ this.logDebug(`Error finish launch with tempId ${launchTempId}`, error);
232
+ console.dir(error);
233
+ launchObj.rejectFinish(error);
234
+ });
235
+ }, (error) => {
236
+ console.dir(error);
237
+ launchObj.rejectFinish(error);
238
+ });
239
+ }, (error) => {
240
+ console.dir(error);
241
+ launchObj.rejectFinish(error);
242
+ });
243
+ return {
244
+ tempId: launchTempId,
245
+ promise: launchObj.promiseFinish,
246
+ };
247
+ }
248
+ /*
249
+ * This method is used to create data object for merge request to ReportPortal.
250
+ */
251
+ getMergeLaunchesRequest(launchIds, mergeOptions = {}) {
252
+ return {
253
+ launches: launchIds,
254
+ mergeType: 'BASIC',
255
+ description: this.config.description || 'Merged launch',
256
+ mode: this.config.mode || 'DEFAULT',
257
+ name: this.config.launch || 'Test launch name',
258
+ attributes: this.config.attributes,
259
+ endTime: this.helpers.now(),
260
+ extendSuitesDescription: true,
261
+ ...mergeOptions,
262
+ };
263
+ }
264
+ /**
265
+ * This method is used for merge launches in ReportPortal.
266
+ * Please, keep in mind that this method work only in case the option isLaunchMergeRequired is true.
267
+ */
268
+ mergeLaunches(mergeOptions = {}) {
269
+ if (this.isLaunchMergeRequired) {
270
+ const launchUUIds = helpers.readLaunchesFromFile();
271
+ const params = new url_1.URLSearchParams({
272
+ 'filter.in.uuid': launchUUIds,
273
+ 'page.size': launchUUIds.length,
274
+ });
275
+ const launchSearchUrl = this.config.mode === 'DEBUG'
276
+ ? `launch/mode?${params.toString()}`
277
+ : `launch?${params.toString()}`;
278
+ this.logDebug(`Find launches with UUIDs to merge: ${launchUUIds}`);
279
+ return this.restClient
280
+ .retrieveSyncAPI(launchSearchUrl)
281
+ .then((response) => {
282
+ const launchIds = response.content.map((launch) => launch.id);
283
+ this.logDebug(`Found launches: ${launchIds}`, response.content);
284
+ return launchIds;
285
+ }, (error) => {
286
+ this.logDebug(`Error during launches search with UUIDs: ${launchUUIds}`, error);
287
+ console.dir(error);
288
+ return [];
289
+ })
290
+ .then((launchIds) => {
291
+ const request = this.getMergeLaunchesRequest(launchIds, mergeOptions);
292
+ this.logDebug(`Merge launches with ids: ${launchIds}`, request);
293
+ const mergeURL = 'launch/merge';
294
+ return this.restClient.create(mergeURL, request);
295
+ })
296
+ .then((response) => {
297
+ this.logDebug(`Launches with UUIDs: ${launchUUIds} were successfully merged!`);
298
+ if (this.config.launchUuidPrint && response.uuid) {
299
+ this.config.launchUuidPrintOutput(response.uuid);
300
+ }
301
+ })
302
+ .catch((error) => {
303
+ this.logDebug(`Error merging launches with UUIDs: ${launchUUIds}`, error);
304
+ console.dir(error);
305
+ });
306
+ }
307
+ this.logDebug('Option isLaunchMergeRequired is false, merge process cannot be done as no launch UUIDs where saved.');
308
+ return undefined;
309
+ }
310
+ /*
311
+ * This method is used for frameworks as Jasmine. There is problem when
312
+ * it doesn't wait for promise resolve and stop the process.
313
+ */
314
+ getPromiseFinishAllItems(launchTempId) {
315
+ const launchObj = this.map[launchTempId];
316
+ return Promise.all(launchObj.children.map((itemId) => this.map[itemId].promiseFinish));
317
+ }
318
+ /**
319
+ * Update launch.
320
+ */
321
+ updateLaunch(launchTempId, launchData) {
322
+ const launchObj = this.map[launchTempId];
323
+ if (!launchObj) {
324
+ return this.getRejectAnswer(launchTempId, new Error(`Launch with tempId "${launchTempId}" not found`));
325
+ }
326
+ let resolvePromise;
327
+ let rejectPromise;
328
+ const promise = new Promise((resolve, reject) => {
329
+ resolvePromise = resolve;
330
+ rejectPromise = reject;
331
+ });
332
+ launchObj.promiseFinish.then(() => {
333
+ const url = ['launch', launchObj.realId, 'update'].join('/');
334
+ this.logDebug(`Update launch with tempId ${launchTempId}`, launchData);
335
+ this.restClient.update(url, launchData).then((response) => {
336
+ this.logDebug(`Launch with tempId ${launchTempId} were successfully updated`, response);
337
+ resolvePromise(response);
338
+ }, (error) => {
339
+ this.logDebug(`Error when updating launch with tempId ${launchTempId}`, error);
340
+ console.dir(error);
341
+ rejectPromise(error);
342
+ });
343
+ }, (error) => {
344
+ rejectPromise(error);
345
+ });
346
+ return {
347
+ tempId: launchTempId,
348
+ promise,
349
+ };
350
+ }
351
+ /**
352
+ * If there is no parentItemId starts Suite, else starts test or item.
353
+ */
354
+ startTestItem(testItemDataRQ, launchTempId, parentTempId) {
355
+ let parentMapId = launchTempId;
356
+ const launchObj = this.map[launchTempId];
357
+ if (!launchObj) {
358
+ return this.getRejectAnswer(launchTempId, new Error(`Launch with tempId "${launchTempId}" not found`));
359
+ }
360
+ // TODO: Allow items reporting to finished launch
361
+ if (launchObj.finishSend) {
362
+ const err = new Error(`Launch with tempId "${launchTempId}" is already finished, you can not add an item to it`);
363
+ return this.getRejectAnswer(launchTempId, err);
364
+ }
365
+ const testCaseId = testItemDataRQ.testCaseId ||
366
+ helpers.generateTestCaseId(testItemDataRQ.codeRef, testItemDataRQ.parameters);
367
+ const testItemData = {
368
+ startTime: this.helpers.now(),
369
+ ...testItemDataRQ,
370
+ ...(testCaseId && { testCaseId }),
371
+ };
372
+ let parentPromise = launchObj.promiseStart;
373
+ if (parentTempId) {
374
+ parentMapId = parentTempId;
375
+ const parentObj = this.map[parentTempId];
376
+ if (!parentObj) {
377
+ return this.getRejectAnswer(launchTempId, new Error(`Item with tempId "${parentTempId}" not found`));
378
+ }
379
+ parentPromise = parentObj.promiseStart;
380
+ }
381
+ const itemKey = this.calculateItemRetriesChainMapKey(launchTempId, parentTempId, testItemDataRQ.name, testItemDataRQ.uniqueId);
382
+ const executionItemPromise = testItemDataRQ.retry && this.itemRetriesChainMap.get(itemKey);
383
+ const tempId = this.getUniqId();
384
+ const itemObj = this.getNewItemObj((resolve, reject) => {
385
+ (executionItemPromise || parentPromise).then((prevResponse) => {
386
+ const realLaunchId = this.map[launchTempId].realId;
387
+ let url = 'item/';
388
+ if (parentTempId) {
389
+ const realParentId = this.map[parentTempId].realId;
390
+ url += `${realParentId}`;
391
+ }
392
+ const prevId = prevResponse?.id;
393
+ if (executionItemPromise && prevId) {
394
+ testItemData.retry_of = prevId;
395
+ }
396
+ testItemData.launchUuid = realLaunchId;
397
+ this.logDebug(`Start test item with tempId ${tempId}`, testItemData);
398
+ this.restClient.create(url, testItemData).then((response) => {
399
+ this.logDebug(`Success start item with tempId ${tempId}`, response);
400
+ this.map[tempId].realId = response.id;
401
+ resolve(response);
402
+ }, (error) => {
403
+ this.logDebug(`Error start item with tempId ${tempId}`, error);
404
+ console.dir(error);
405
+ reject(error);
406
+ });
407
+ }, (error) => {
408
+ reject(error);
409
+ });
410
+ });
411
+ this.map[tempId] = itemObj;
412
+ this.map[parentMapId].children.push(tempId);
413
+ this.itemRetriesChainKeyMapByTempId.set(tempId, itemKey);
414
+ this.itemRetriesChainMap.set(itemKey, itemObj.promiseStart);
415
+ return {
416
+ tempId,
417
+ promise: itemObj.promiseStart,
418
+ };
419
+ }
420
+ /**
421
+ * Finish Suite or Step level.
422
+ */
423
+ finishTestItem(itemTempId, finishTestItemRQ = {}) {
424
+ const itemObj = this.map[itemTempId];
425
+ if (!itemObj) {
426
+ return this.getRejectAnswer(itemTempId, new Error(`Item with tempId "${itemTempId}" not found`));
427
+ }
428
+ const finishTestItemData = {
429
+ endTime: this.helpers.now(),
430
+ ...(itemObj.children.length ? {} : { status: statuses_1.STATUSES.PASSED }),
431
+ ...finishTestItemRQ,
432
+ };
433
+ if (finishTestItemData.status === statuses_1.STATUSES.SKIPPED && this.config.skippedIsNotIssue === true) {
434
+ finishTestItemData.issue = { issueType: 'NOT_ISSUE' };
435
+ }
436
+ itemObj.finishSend = true;
437
+ this.logDebug(`Finish all children for test item with tempId ${itemTempId}`);
438
+ Promise.allSettled(itemObj.children.map((itemId) => this.map[itemId] && this.map[itemId].promiseFinish))
439
+ .then((results) => {
440
+ if (this.debug) {
441
+ results.forEach((result, index) => {
442
+ if (result.status === 'fulfilled') {
443
+ this.logDebug(`Successfully finish child with tempId ${itemObj.children[index]}
444
+ of test item with tempId ${itemTempId}`);
445
+ }
446
+ else {
447
+ this.logDebug(`Failed to finish child with tempId ${itemObj.children[index]}
448
+ of test item with tempId ${itemTempId}`);
449
+ }
450
+ });
451
+ }
452
+ this.cleanItemRetriesChain(itemObj.children);
453
+ this.cleanMap(itemObj.children);
454
+ this.logDebug(`Finish test item with tempId ${itemTempId}`, finishTestItemRQ);
455
+ this.finishTestItemPromiseStart(itemObj, itemTempId, Object.assign(finishTestItemData, { launchUuid: this.launchUuid }));
456
+ })
457
+ .catch(() => {
458
+ this.logDebug(`Error finish children of test item with tempId ${itemTempId}`);
459
+ });
460
+ return {
461
+ tempId: itemTempId,
462
+ promise: itemObj.promiseFinish,
463
+ };
464
+ }
465
+ saveLog(itemObj, requestPromiseFunc) {
466
+ const tempId = this.getUniqId();
467
+ this.map[tempId] = this.getNewItemObj((resolve, reject) => {
468
+ itemObj.promiseStart.then(() => {
469
+ this.logDebug(`Save log with tempId ${tempId}`, itemObj);
470
+ requestPromiseFunc(itemObj.realId, this.launchUuid).then((response) => {
471
+ this.logDebug(`Successfully save log with tempId ${tempId}`, response);
472
+ resolve(response);
473
+ }, (error) => {
474
+ this.logDebug(`Error save log with tempId ${tempId}`, error);
475
+ console.dir(error);
476
+ reject(error);
477
+ });
478
+ }, (error) => {
479
+ reject(error);
480
+ });
481
+ });
482
+ itemObj.children.push(tempId);
483
+ const logObj = this.map[tempId];
484
+ logObj.finishSend = true;
485
+ logObj.promiseStart.then((response) => logObj.resolveFinish(response), (error) => logObj.rejectFinish(error));
486
+ return {
487
+ tempId,
488
+ promise: this.map[tempId].promiseFinish,
489
+ };
490
+ }
491
+ sendLog(itemTempId, saveLogRQ, fileObj) {
492
+ const saveLogData = {
493
+ time: this.helpers.now(),
494
+ message: '',
495
+ level: '',
496
+ ...saveLogRQ,
497
+ };
498
+ if (fileObj) {
499
+ return this.sendLogWithFile(itemTempId, saveLogData, fileObj);
500
+ }
501
+ return this.sendLogWithoutFile(itemTempId, saveLogData);
502
+ }
503
+ /**
504
+ * Send log of test results.
505
+ */
506
+ sendLogWithoutFile(itemTempId, saveLogRQ) {
507
+ const itemObj = this.map[itemTempId];
508
+ if (!itemObj) {
509
+ return this.getRejectAnswer(itemTempId, new Error(`Item with tempId "${itemTempId}" not found`));
510
+ }
511
+ const requestPromise = (itemUuid, launchUuid) => {
512
+ const url = 'log';
513
+ const isItemUuid = itemUuid !== launchUuid;
514
+ return this.restClient.create(url, Object.assign(saveLogRQ, { launchUuid }, isItemUuid && { itemUuid }));
515
+ };
516
+ return this.saveLog(itemObj, requestPromise);
517
+ }
518
+ /**
519
+ * Send log of test results with file.
520
+ */
521
+ sendLogWithFile(itemTempId, saveLogRQ, fileObj) {
522
+ const itemObj = this.map[itemTempId];
523
+ if (!itemObj) {
524
+ return this.getRejectAnswer(itemTempId, new Error(`Item with tempId "${itemTempId}" not found`));
525
+ }
526
+ const requestPromise = (itemUuid, launchUuid) => {
527
+ const isItemUuid = itemUuid !== launchUuid;
528
+ return this.getRequestLogWithFile(Object.assign(saveLogRQ, { launchUuid }, isItemUuid && { itemUuid }), fileObj);
529
+ };
530
+ return this.saveLog(itemObj, requestPromise);
531
+ }
532
+ getRequestLogWithFile(saveLogRQ, fileObj) {
533
+ const url = 'log';
534
+ // eslint-disable-next-line no-param-reassign
535
+ saveLogRQ.file = { name: fileObj.name };
536
+ this.logDebug(`Save log with file: ${fileObj.name}`, saveLogRQ);
537
+ return this.restClient
538
+ .create(url, this.buildMultiPartStream([saveLogRQ], fileObj, MULTIPART_BOUNDARY), {
539
+ headers: {
540
+ 'Content-Type': `multipart/form-data; boundary=${MULTIPART_BOUNDARY}`,
541
+ },
542
+ })
543
+ .then((response) => {
544
+ this.logDebug(`Success save log with file: ${fileObj.name}`, response);
545
+ return response;
546
+ })
547
+ .catch((error) => {
548
+ this.logDebug(`Error save log with file: ${fileObj.name}`, error);
549
+ console.dir(error);
550
+ });
551
+ }
552
+ buildMultiPartStream(jsonPart, filePart, boundary) {
553
+ const eol = '\r\n';
554
+ const bx = `--${boundary}`;
555
+ const buffers = [
556
+ // eslint-disable-next-line function-paren-newline
557
+ Buffer.from(
558
+ // eslint-disable-next-line prefer-template
559
+ bx +
560
+ eol +
561
+ 'Content-Disposition: form-data; name="json_request_part"' +
562
+ eol +
563
+ 'Content-Type: application/json' +
564
+ eol +
565
+ eol +
566
+ eol +
567
+ JSON.stringify(jsonPart) +
568
+ eol),
569
+ // eslint-disable-next-line function-paren-newline
570
+ Buffer.from(
571
+ // eslint-disable-next-line prefer-template
572
+ bx +
573
+ eol +
574
+ 'Content-Disposition: form-data; name="file"; filename="' +
575
+ filePart.name +
576
+ '"' +
577
+ eol +
578
+ 'Content-Type: ' +
579
+ filePart.type +
580
+ eol +
581
+ eol),
582
+ Buffer.from(filePart.content, 'base64'),
583
+ Buffer.from(`${eol + bx}--${eol}`),
584
+ ];
585
+ return Buffer.concat(buffers);
586
+ }
587
+ finishTestItemPromiseStart(itemObj, itemTempId, finishTestItemData) {
588
+ itemObj.promiseStart.then(() => {
589
+ const url = ['item', itemObj.realId].join('/');
590
+ this.logDebug(`Finish test item with tempId ${itemTempId}`, itemObj);
591
+ this.restClient
592
+ .update(url, Object.assign(finishTestItemData, { launchUuid: this.launchUuid }))
593
+ .then((response) => {
594
+ this.logDebug(`Success finish item with tempId ${itemTempId}`, response);
595
+ itemObj.resolveFinish(response);
596
+ }, (error) => {
597
+ this.logDebug(`Error finish test item with tempId ${itemTempId}`, error);
598
+ console.dir(error);
599
+ itemObj.rejectFinish(error);
600
+ });
601
+ }, (error) => {
602
+ itemObj.rejectFinish(error);
603
+ });
604
+ }
605
+ }
606
+ module.exports = RPClient;
607
+ //# sourceMappingURL=report-portal-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-portal-client.js","sourceRoot":"","sources":["../src/report-portal-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAoC;AACpC,6BAAsC;AACtC,mDAAqC;AACrC,kDAAgC;AAChC,6CAAmD;AACnD,yEAAiD;AACjD,sDAAoD;AACpD,mDAAgD;AA0BhD,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC;AAoB9E,MAAM,QAAQ;IA8BZ;;OAEG;IACH,YAAY,OAA2B,EAAE,WAAyB;QAChE,IAAI,CAAC,MAAM,GAAG,IAAA,wBAAe,EAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC;QAC/D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACjC,aAAa;QACb,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAEzB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErE,MAAM,OAAO,GAA2B;YACtC,YAAY,EAAE,QAAQ;YACtB,cAAc,EAAE,iCAAiC;YACjD,GAAG,CAAC,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,CAAC,GAAG,CAAC,CAAC;YAC/C,IAAI,CAAC,QAAQ,CAAC,gCAAgC,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;YACrE,IAAI,CAAC,UAAU;iBACZ,MAAM,CAAI,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;iBAClF,IAAI,CACH,CAAC,QAAQ,EAAE,EAAE;gBACX,IAAI,CAAC,QAAQ,CAAC,mCAAmC,UAAU,EAAE,EAAE,QAAQ,CAAC,CAAC;gBACzE,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;gBACR,IAAI,CAAC,QAAQ,CAAC,sCAAsC,UAAU,EAAE,EAAE,KAAK,CAAC,CAAC;gBACzE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBACnB,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CACF,CAAC;QACN,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;YACR,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,iBAAS,QAAQ,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { IAxiosRetryConfig } from 'axios-retry';
3
+ import type { RestClientOptions } from './models/config';
4
+ declare class RestClient {
5
+ private baseURL;
6
+ private headers?;
7
+ private restClientConfig?;
8
+ private oauthConfig?;
9
+ private debug?;
10
+ private axiosInstance;
11
+ constructor(options: RestClientOptions);
12
+ buildPath(path: string): string;
13
+ buildPathToSyncAPI(path: string): string;
14
+ request<T = unknown>(method: string, url: string, data: unknown, options?: AxiosRequestConfig): Promise<T>;
15
+ getRestConfig(): AxiosRequestConfig;
16
+ getRetryConfig(): IAxiosRetryConfig;
17
+ create<T = unknown>(path: string, data: unknown, options?: AxiosRequestConfig): Promise<T>;
18
+ retrieve<T = unknown>(path: string, options?: AxiosRequestConfig): Promise<T>;
19
+ update<T = unknown>(path: string, data: unknown, options?: AxiosRequestConfig): Promise<T>;
20
+ delete<T = unknown>(path: string, data: unknown, options?: AxiosRequestConfig): Promise<T>;
21
+ retrieveSyncAPI<T = unknown>(path: string, options?: AxiosRequestConfig): Promise<T>;
22
+ }
23
+ export = RestClient;