@reportportal/client-javascript 5.5.12 → 5.6.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.
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 +82 -16
  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
package/build/pjson.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PJSON_VERSION = exports.PJSON_NAME = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ // Resolve the package's own package.json by walking up from this module's directory.
10
+ // Works both from compiled output (`build/`) and from source when run via ts-jest (`src/`).
11
+ function findPackageJson(dir) {
12
+ let current = dir;
13
+ for (;;) {
14
+ const candidate = path_1.default.join(current, 'package.json');
15
+ if (fs_1.default.existsSync(candidate)) {
16
+ return JSON.parse(fs_1.default.readFileSync(candidate, 'utf-8'));
17
+ }
18
+ const parent = path_1.default.dirname(current);
19
+ if (parent === current) {
20
+ throw new Error('Unable to locate package.json for @reportportal/client-javascript');
21
+ }
22
+ current = parent;
23
+ }
24
+ }
25
+ const pjson = findPackageJson(__dirname);
26
+ exports.PJSON_NAME = pjson.name;
27
+ exports.PJSON_VERSION = pjson.version;
28
+ //# sourceMappingURL=pjson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pjson.js","sourceRoot":"","sources":["../src/pjson.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAOxB,qFAAqF;AACrF,4FAA4F;AAC5F,SAAS,eAAe,CAAC,GAAW;IAClC,IAAI,OAAO,GAAG,GAAG,CAAC;IAClB,SAAS;QACP,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACrD,IAAI,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;SACxD;QACD,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,OAAO,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;SACtF;QACD,OAAO,GAAG,MAAM,CAAC;KAClB;AACH,CAAC;AAED,MAAM,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAE5B,QAAA,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC;AACxB,QAAA,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC"}
@@ -0,0 +1,28 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import http from 'http';
4
+ import https from 'https';
5
+ import type { RestClientConfig } from './models/config';
6
+ export interface ProxyAgents {
7
+ httpAgent?: http.Agent;
8
+ httpsAgent?: https.Agent;
9
+ }
10
+ /**
11
+ * Checks if a URL should bypass proxy based on NO_PROXY patterns.
12
+ */
13
+ export declare function shouldBypassProxy(url: string, noProxy?: string): boolean;
14
+ /**
15
+ * Gets proxy configuration for a given URL, checking both environment variables and explicit config.
16
+ */
17
+ export declare function getProxyConfig(url: string, proxyConfig?: RestClientConfig): {
18
+ proxyUrl: string;
19
+ } | null;
20
+ /**
21
+ * Creates an HTTP/HTTPS agent with proxy configuration for a specific URL.
22
+ * Agents are cached and reused to enable connection pooling and keepAlive.
23
+ */
24
+ export declare function createProxyAgents(url: string, restClientConfig?: RestClientConfig): ProxyAgents;
25
+ /**
26
+ * Gets proxy agent for a specific request URL. This is the main function used in axios requests.
27
+ */
28
+ export declare function getProxyAgentForUrl(url: string, restClientConfig?: RestClientConfig): ProxyAgents;
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getProxyAgentForUrl = exports.createProxyAgents = exports.getProxyConfig = exports.shouldBypassProxy = void 0;
7
+ const proxy_from_env_1 = require("proxy-from-env");
8
+ const https_proxy_agent_1 = require("https-proxy-agent");
9
+ const http_proxy_agent_1 = require("http-proxy-agent");
10
+ const http_1 = __importDefault(require("http"));
11
+ const https_1 = __importDefault(require("https"));
12
+ /**
13
+ * Sanitizes a URL by removing credentials (username/password) for safe logging.
14
+ */
15
+ function sanitizeUrlForLogging(urlString) {
16
+ try {
17
+ const urlObj = new URL(urlString);
18
+ if (urlObj.username || urlObj.password) {
19
+ urlObj.username = '[REDACTED]';
20
+ urlObj.password = '';
21
+ return urlObj.toString();
22
+ }
23
+ return urlString;
24
+ }
25
+ catch (error) {
26
+ // If URL parsing fails, return as-is (likely not a URL)
27
+ return urlString;
28
+ }
29
+ }
30
+ /**
31
+ * Checks if a URL should bypass proxy based on NO_PROXY patterns.
32
+ */
33
+ function shouldBypassProxy(url, noProxy) {
34
+ if (!noProxy)
35
+ return false;
36
+ try {
37
+ const urlObj = new URL(url);
38
+ const hostname = urlObj.hostname.toLowerCase();
39
+ const patterns = noProxy
40
+ .split(',')
41
+ .map((entry) => entry.trim().toLowerCase())
42
+ .filter(Boolean);
43
+ return patterns.some((pattern) => {
44
+ if (pattern === '*')
45
+ return true;
46
+ if (pattern.startsWith('.')) {
47
+ const cleanPattern = pattern.slice(1);
48
+ return hostname.endsWith(`.${cleanPattern}`);
49
+ }
50
+ if (hostname === pattern)
51
+ return true;
52
+ if (hostname.endsWith(`.${pattern}`))
53
+ return true;
54
+ return false;
55
+ });
56
+ }
57
+ catch (error) {
58
+ // If URL parsing fails, don't bypass proxy
59
+ return false;
60
+ }
61
+ }
62
+ exports.shouldBypassProxy = shouldBypassProxy;
63
+ /**
64
+ * Gets proxy configuration for a given URL, checking both environment variables and explicit config.
65
+ */
66
+ function getProxyConfig(url, proxyConfig = {}) {
67
+ const urlObj = new URL(url);
68
+ const noProxyFromConfig = proxyConfig.noProxy;
69
+ const noProxyFromEnv = process.env.NO_PROXY || process.env.no_proxy || '';
70
+ const noProxy = noProxyFromConfig || noProxyFromEnv;
71
+ if (proxyConfig.debug) {
72
+ console.log(`[ProxyHelper] getProxyConfig called:\n` +
73
+ ` URL: ${url}\n` +
74
+ ` Hostname: ${urlObj.hostname}\n` +
75
+ ` noProxy from config: ${noProxyFromConfig}\n` +
76
+ ` noProxy from env: ${noProxyFromEnv}\n` +
77
+ ` Final noProxy: ${noProxy}`);
78
+ }
79
+ const shouldBypass = shouldBypassProxy(url, noProxy);
80
+ if (proxyConfig.debug) {
81
+ console.log(` Should bypass proxy: ${shouldBypass}`);
82
+ }
83
+ if (shouldBypass) {
84
+ return null;
85
+ }
86
+ if (proxyConfig.proxy === false) {
87
+ return null;
88
+ }
89
+ if (proxyConfig.proxy && typeof proxyConfig.proxy === 'object') {
90
+ const { protocol: proxyProtocol, host, port, auth } = proxyConfig.proxy;
91
+ if (host && port) {
92
+ let proxyUrl = `${proxyProtocol || 'http'}://${host}:${port}`;
93
+ if (auth) {
94
+ const { username, password } = auth;
95
+ proxyUrl = `${proxyProtocol || 'http'}://${username}:${password}@${host}:${port}`;
96
+ }
97
+ return { proxyUrl };
98
+ }
99
+ }
100
+ if (typeof proxyConfig.proxy === 'string') {
101
+ return { proxyUrl: proxyConfig.proxy };
102
+ }
103
+ const proxyUrlFromEnv = (0, proxy_from_env_1.getProxyForUrl)(url);
104
+ if (proxyUrlFromEnv) {
105
+ return { proxyUrl: proxyUrlFromEnv };
106
+ }
107
+ return null;
108
+ }
109
+ exports.getProxyConfig = getProxyConfig;
110
+ // Cache for proxy agents to enable connection reuse
111
+ const agentCache = new Map();
112
+ function getAgentCacheKey(proxyUrl, isHttps) {
113
+ return `${isHttps ? 'https' : 'http'}:${proxyUrl}`;
114
+ }
115
+ /**
116
+ * Creates an HTTP/HTTPS agent with proxy configuration for a specific URL.
117
+ * Agents are cached and reused to enable connection pooling and keepAlive.
118
+ */
119
+ function createProxyAgents(url, restClientConfig = {}) {
120
+ const urlObj = new URL(url);
121
+ const isHttps = urlObj.protocol === 'https:';
122
+ const proxyConfig = getProxyConfig(url, restClientConfig);
123
+ const agentOptions = {
124
+ keepAlive: true,
125
+ keepAliveMsecs: 3000,
126
+ maxSockets: 50,
127
+ maxFreeSockets: 10,
128
+ };
129
+ if (!proxyConfig) {
130
+ if (restClientConfig.debug) {
131
+ console.log(`[ProxyHelper] No proxy for URL (bypassed or not configured): ${url}\n` +
132
+ ` Using default agent to prevent axios from using env proxy`);
133
+ }
134
+ const cacheKey = getAgentCacheKey('no-proxy', isHttps);
135
+ const cached = agentCache.get(cacheKey);
136
+ if (cached) {
137
+ return cached;
138
+ }
139
+ const agents = isHttps
140
+ ? { httpsAgent: new https_1.default.Agent(agentOptions) }
141
+ : { httpAgent: new http_1.default.Agent(agentOptions) };
142
+ agentCache.set(cacheKey, agents);
143
+ return agents;
144
+ }
145
+ const { proxyUrl } = proxyConfig;
146
+ const cacheKey = getAgentCacheKey(proxyUrl, isHttps);
147
+ const cached = agentCache.get(cacheKey);
148
+ if (cached) {
149
+ if (restClientConfig.debug) {
150
+ console.log('[ProxyHelper] Reusing cached proxy agent:', sanitizeUrlForLogging(proxyUrl));
151
+ }
152
+ return cached;
153
+ }
154
+ if (restClientConfig.debug) {
155
+ console.log(`[ProxyHelper] Creating proxy agent:\n` +
156
+ ` URL: ${url}\n` +
157
+ ` Proxy URL: ${sanitizeUrlForLogging(proxyUrl)}`);
158
+ }
159
+ const agents = isHttps
160
+ ? { httpsAgent: new https_proxy_agent_1.HttpsProxyAgent(proxyUrl, agentOptions) }
161
+ : { httpAgent: new http_proxy_agent_1.HttpProxyAgent(proxyUrl, agentOptions) };
162
+ agentCache.set(cacheKey, agents);
163
+ return agents;
164
+ }
165
+ exports.createProxyAgents = createProxyAgents;
166
+ /**
167
+ * Gets proxy agent for a specific request URL. This is the main function used in axios requests.
168
+ */
169
+ function getProxyAgentForUrl(url, restClientConfig = {}) {
170
+ return createProxyAgents(url, restClientConfig);
171
+ }
172
+ exports.getProxyAgentForUrl = getProxyAgentForUrl;
173
+ //# sourceMappingURL=proxyHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxyHelper.js","sourceRoot":"","sources":["../src/proxyHelper.ts"],"names":[],"mappings":";;;;;;AAAA,mDAAgD;AAChD,yDAAoD;AACpD,uDAAkD;AAClD,gDAAwB;AACxB,kDAA0B;AAQ1B;;GAEG;AACH,SAAS,qBAAqB,CAAC,SAAiB;IAC9C,IAAI;QACF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE;YACtC,MAAM,CAAC,QAAQ,GAAG,YAAY,CAAC;YAC/B,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;YACrB,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;SAC1B;QACD,OAAO,SAAS,CAAC;KAClB;IAAC,OAAO,KAAK,EAAE;QACd,wDAAwD;QACxD,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,GAAW,EAAE,OAAgB;IAC7D,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAE3B,IAAI;QACF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAE/C,MAAM,QA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,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC;KACf;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IAEjC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,MAAM,EAAE;QACV,IAAI,gBAAgB,CAAC,KAAK,EAAE;YAC1B,OAAO,CAAC,GAAG,CAAC,2CAA2C,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC3F;QACD,OAAO,MAAM,CAAC;KACf;IAED,IAAI,gBAAgB,CAAC,KAAK,EAAE;QAC1B,OAAO,CAAC,GAAG,CACT,uCAAuC;YACrC,UAAU,GAAG,IAAI;YACjB,gBAAgB,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CACpD,CAAC;KACH;IAED,MAAM,MAAM,GAAgB,OAAO;QACjC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,mCAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,EAAE;QAC7D,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,iCAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,EAAE,CAAC;IAE9D,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC;AA7DD,8CA6DC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,GAAW,EACX,mBAAqC,EAAE;IAEvC,OAAO,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAClD,CAAC;AALD,kDAKC"}
@@ -0,0 +1,37 @@
1
+ import type { Attribute } from './models/common';
2
+ import type { LogOptions } from './models/requests';
3
+ /**
4
+ * Public API to emit additional events to RP JS agents.
5
+ */
6
+ declare class PublicReportingAPI {
7
+ /**
8
+ * Emit set description event.
9
+ */
10
+ static setDescription(text: string, suiteName?: string): void;
11
+ /**
12
+ * Emit add attributes event.
13
+ */
14
+ static addAttributes(attributes: Attribute[], suiteName?: string): void;
15
+ /**
16
+ * Emit send log to test item event.
17
+ */
18
+ static addLog(log: LogOptions, suiteName?: string): void;
19
+ /**
20
+ * Emit send log to current launch event.
21
+ */
22
+ static addLaunchLog(log: LogOptions): void;
23
+ /**
24
+ * Emit set testCaseId event.
25
+ */
26
+ static setTestCaseId(testCaseId: string, suiteName?: string): void;
27
+ /**
28
+ * Emit set status to current launch event.
29
+ */
30
+ static setLaunchStatus(status: string): void;
31
+ /**
32
+ * Emit set status event.
33
+ */
34
+ static setStatus(status: string, suiteName?: string): void;
35
+ }
36
+ declare const publicReportingAPI: typeof PublicReportingAPI;
37
+ export = publicReportingAPI;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ const events_1 = require("./constants/events");
3
+ function emit(event, ...args) {
4
+ return process.emit(event, ...args);
5
+ }
6
+ /**
7
+ * Public API to emit additional events to RP JS agents.
8
+ */
9
+ class PublicReportingAPI {
10
+ /**
11
+ * Emit set description event.
12
+ */
13
+ static setDescription(text, suiteName) {
14
+ emit(events_1.EVENTS.SET_DESCRIPTION, { text, suite: suiteName });
15
+ }
16
+ /**
17
+ * Emit add attributes event.
18
+ */
19
+ static addAttributes(attributes, suiteName) {
20
+ emit(events_1.EVENTS.ADD_ATTRIBUTES, { attributes, suite: suiteName });
21
+ }
22
+ /**
23
+ * Emit send log to test item event.
24
+ */
25
+ static addLog(log, suiteName) {
26
+ emit(events_1.EVENTS.ADD_LOG, { log, suite: suiteName });
27
+ }
28
+ /**
29
+ * Emit send log to current launch event.
30
+ */
31
+ static addLaunchLog(log) {
32
+ emit(events_1.EVENTS.ADD_LAUNCH_LOG, log);
33
+ }
34
+ /**
35
+ * Emit set testCaseId event.
36
+ */
37
+ static setTestCaseId(testCaseId, suiteName) {
38
+ emit(events_1.EVENTS.SET_TEST_CASE_ID, { testCaseId, suite: suiteName });
39
+ }
40
+ /**
41
+ * Emit set status to current launch event.
42
+ */
43
+ static setLaunchStatus(status) {
44
+ emit(events_1.EVENTS.SET_LAUNCH_STATUS, status);
45
+ }
46
+ /**
47
+ * Emit set status event.
48
+ */
49
+ static setStatus(status, suiteName) {
50
+ emit(events_1.EVENTS.SET_STATUS, { status, suite: suiteName });
51
+ }
52
+ }
53
+ // checks static methods
54
+ const publicReportingAPI = PublicReportingAPI;
55
+ module.exports = publicReportingAPI;
56
+ //# sourceMappingURL=publicReportingAPI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publicReportingAPI.js","sourceRoot":"","sources":["../src/publicReportingAPI.ts"],"names":[],"mappings":";AAAA,+CAA4C;AAK5C,SAAS,IAAI,CAAC,KAAa,EAAE,GAAG,IAAe;IAC7C,OAAQ,OAAO,CAAC,IAAgD,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;AACnF,CAAC;AAED;;GAEG;AACH,MAAM,kBAAkB;IACtB;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,IAAY,EAAE,SAAkB;QACpD,IAAI,CAAC,eAAM,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,UAAuB,EAAE,SAAkB;QAC9D,IAAI,CAAC,eAAM,CAAC,cAAc,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,GAAe,EAAE,SAAkB;QAC/C,IAAI,CAAC,eAAM,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,GAAe;QACjC,IAAI,CAAC,eAAM,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,UAAkB,EAAE,SAAkB;QACzD,IAAI,CAAC,eAAM,CAAC,gBAAgB,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAc;QACnC,IAAI,CAAC,eAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,MAAc,EAAE,SAAkB;QACjD,IAAI,CAAC,eAAM,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACxD,CAAC;CACF;AAED,wBAAwB;AACxB,MAAM,kBAAkB,GAAG,kBAAkD,CAAC;AAE9E,iBAAS,kBAAkB,CAAC"}
@@ -0,0 +1,99 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import * as helpers from './helpers';
4
+ import type { AgentParams, Attachment, ClientResponse } from './models/common';
5
+ import type { ReportPortalConfig } from './models/config';
6
+ import type { FinishLaunchOptions, FinishTestItemOptions, FinishTestItemRQ, LogOptions, MergeLaunchesOptions, StartLaunchOptions, StartTestItemOptions, UpdateLaunchOptions } from './models/requests';
7
+ import type { FinishLaunchResponse, FinishTestItemResponse, PageLaunchResource, ServerInfoResponse, StartLaunchResponse, StartTestItemResponse, UpdateLaunchResponse } from './models/responses';
8
+ type PromiseExecutor<T = unknown> = (resolve: (value: T) => void, reject: (reason?: Error) => void) => void;
9
+ interface ItemObj<T = unknown> {
10
+ promiseStart: Promise<T>;
11
+ realId: string;
12
+ children: string[];
13
+ finishSend: boolean;
14
+ promiseFinish: Promise<T>;
15
+ resolveFinish: (value: T) => void;
16
+ rejectFinish: (reason?: Error) => void;
17
+ }
18
+ type RequestPromiseFunc = (itemUuid: string, launchUuid: string) => Promise<unknown>;
19
+ declare class RPClient {
20
+ private config;
21
+ private debug?;
22
+ private isLaunchMergeRequired;
23
+ private apiKey;
24
+ private token;
25
+ private map;
26
+ private baseURL;
27
+ private headers;
28
+ helpers: typeof helpers;
29
+ private restClient;
30
+ private statistics;
31
+ private launchUuid;
32
+ private itemRetriesChainMap;
33
+ private itemRetriesChainKeyMapByTempId;
34
+ /**
35
+ * Create a client for RP.
36
+ */
37
+ constructor(options: ReportPortalConfig, agentParams?: AgentParams);
38
+ logDebug(msg: unknown, dataMsg?: unknown): void;
39
+ calculateItemRetriesChainMapKey(launchId: string, parentId: string | undefined, name: string, itemId?: string): string;
40
+ cleanItemRetriesChain(tempIds: string[]): void;
41
+ getUniqId(): string;
42
+ getRejectAnswer<T = unknown>(tempId: string, error: Error): ClientResponse<T>;
43
+ getNewItemObj<T = unknown>(startPromiseFunc: PromiseExecutor<T>): ItemObj<T>;
44
+ cleanMap(ids: string[]): void;
45
+ checkConnect(): Promise<PageLaunchResource>;
46
+ getServerInfoUrl(): string;
47
+ fetchServerInfo(): Promise<ServerInfoResponse>;
48
+ triggerStatisticsEvent(): Promise<void>;
49
+ /**
50
+ * Start launch and report it.
51
+ */
52
+ startLaunch(launchDataRQ: StartLaunchOptions): ClientResponse<StartLaunchResponse | StartLaunchOptions>;
53
+ /**
54
+ * Finish launch.
55
+ */
56
+ finishLaunch(launchTempId: string, finishExecutionRQ?: FinishLaunchOptions): ClientResponse<FinishLaunchResponse>;
57
+ getMergeLaunchesRequest(launchIds: Array<string | number>, mergeOptions?: MergeLaunchesOptions): {
58
+ extendSuitesDescription: boolean;
59
+ description: string;
60
+ mergeType: string;
61
+ name: string;
62
+ launches: (string | number)[];
63
+ mode: string;
64
+ attributes: import("./models/common").Attribute[] | undefined;
65
+ endTime: number;
66
+ };
67
+ /**
68
+ * This method is used for merge launches in ReportPortal.
69
+ * Please, keep in mind that this method work only in case the option isLaunchMergeRequired is true.
70
+ */
71
+ mergeLaunches(mergeOptions?: MergeLaunchesOptions): Promise<void> | undefined;
72
+ getPromiseFinishAllItems(launchTempId: string): Promise<unknown[]>;
73
+ /**
74
+ * Update launch.
75
+ */
76
+ updateLaunch(launchTempId: string, launchData: UpdateLaunchOptions): ClientResponse<UpdateLaunchResponse>;
77
+ /**
78
+ * If there is no parentItemId starts Suite, else starts test or item.
79
+ */
80
+ startTestItem(testItemDataRQ: StartTestItemOptions, launchTempId: string, parentTempId?: string): ClientResponse<StartTestItemResponse>;
81
+ /**
82
+ * Finish Suite or Step level.
83
+ */
84
+ finishTestItem(itemTempId: string, finishTestItemRQ?: FinishTestItemOptions): ClientResponse<FinishTestItemResponse>;
85
+ saveLog(itemObj: ItemObj, requestPromiseFunc: RequestPromiseFunc): ClientResponse;
86
+ sendLog(itemTempId: string, saveLogRQ: LogOptions, fileObj?: Attachment): ClientResponse;
87
+ /**
88
+ * Send log of test results.
89
+ */
90
+ sendLogWithoutFile(itemTempId: string, saveLogRQ: LogOptions): ClientResponse;
91
+ /**
92
+ * Send log of test results with file.
93
+ */
94
+ sendLogWithFile(itemTempId: string, saveLogRQ: LogOptions, fileObj: Attachment): ClientResponse;
95
+ getRequestLogWithFile(saveLogRQ: LogOptions, fileObj: Attachment): Promise<unknown>;
96
+ buildMultiPartStream(jsonPart: unknown[], filePart: Attachment, boundary: string): Buffer;
97
+ finishTestItemPromiseStart<T = unknown>(itemObj: ItemObj<T>, itemTempId: string, finishTestItemData: FinishTestItemRQ): void;
98
+ }
99
+ export = RPClient;