@smartbear/mcp 0.12.1 → 0.13.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 (89) hide show
  1. package/README.md +30 -6
  2. package/dist/bugsnag/client/api/CurrentUser.js +50 -26
  3. package/dist/bugsnag/client/api/Error.js +156 -93
  4. package/dist/bugsnag/client/api/Project.js +398 -276
  5. package/dist/bugsnag/client/api/api.js +4087 -3837
  6. package/dist/bugsnag/client/api/base.js +155 -173
  7. package/dist/bugsnag/client/api/configuration.js +28 -25
  8. package/dist/bugsnag/client/filters.js +11 -20
  9. package/dist/bugsnag/client.js +1398 -1281
  10. package/dist/bugsnag/input-schemas.js +39 -57
  11. package/dist/collaborator/client.js +335 -371
  12. package/dist/common/bugsnag.js +5 -3
  13. package/dist/common/cache.js +50 -57
  14. package/dist/common/client-registry.js +106 -119
  15. package/dist/common/info.js +7 -3
  16. package/dist/common/register-clients.js +0 -16
  17. package/dist/common/server.js +270 -228
  18. package/dist/common/tools.js +19 -0
  19. package/dist/common/transport-http.js +252 -343
  20. package/dist/common/transport-stdio.js +40 -37
  21. package/dist/common/zod-utils.js +20 -0
  22. package/dist/index.js +18 -23
  23. package/dist/package.json.js +11 -0
  24. package/dist/pactflow/client/ai.js +142 -169
  25. package/dist/pactflow/client/base.js +41 -51
  26. package/dist/pactflow/client/prompt-utils.js +93 -84
  27. package/dist/pactflow/client/prompts.js +95 -92
  28. package/dist/pactflow/client/tools.js +94 -83
  29. package/dist/pactflow/client/utils.js +60 -64
  30. package/dist/pactflow/client.js +399 -320
  31. package/dist/qmetry/client/api/client-api.js +43 -41
  32. package/dist/qmetry/client/api/error-handler.js +264 -310
  33. package/dist/qmetry/client/auto-resolve.js +78 -99
  34. package/dist/qmetry/client/automation.js +139 -162
  35. package/dist/qmetry/client/handlers.js +49 -46
  36. package/dist/qmetry/client/issues.js +133 -115
  37. package/dist/qmetry/client/project.js +153 -174
  38. package/dist/qmetry/client/requirement.js +82 -70
  39. package/dist/qmetry/client/testcase.js +240 -208
  40. package/dist/qmetry/client/testsuite.js +332 -293
  41. package/dist/qmetry/client/tools/automation-tools.js +291 -288
  42. package/dist/qmetry/client/tools/index.js +16 -13
  43. package/dist/qmetry/client/tools/issue-tools.js +534 -543
  44. package/dist/qmetry/client/tools/project-tools.js +635 -656
  45. package/dist/qmetry/client/tools/requirement-tools.js +525 -528
  46. package/dist/qmetry/client/tools/testcase-tools.js +773 -786
  47. package/dist/qmetry/client/tools/testsuite-tools.js +1069 -1083
  48. package/dist/qmetry/client/utils.js +8 -14
  49. package/dist/qmetry/client.js +111 -109
  50. package/dist/qmetry/config/constants.js +48 -44
  51. package/dist/qmetry/config/rest-endpoints.js +51 -48
  52. package/dist/qmetry/types/automation.js +7 -7
  53. package/dist/qmetry/types/common.js +763 -1049
  54. package/dist/qmetry/types/issues.js +26 -19
  55. package/dist/qmetry/types/project.js +32 -25
  56. package/dist/qmetry/types/requirements.js +26 -21
  57. package/dist/qmetry/types/testcase.js +55 -44
  58. package/dist/qmetry/types/testsuite.js +66 -52
  59. package/dist/reflect/client.js +284 -226
  60. package/dist/swagger/client/api.js +645 -662
  61. package/dist/swagger/client/configuration.js +31 -33
  62. package/dist/swagger/client/portal-types.js +204 -244
  63. package/dist/swagger/client/registry-types.js +62 -96
  64. package/dist/swagger/client/tools.js +148 -158
  65. package/dist/swagger/client/user-management-types.js +11 -22
  66. package/dist/swagger/client.js +143 -135
  67. package/dist/swagger/config-utils.js +10 -16
  68. package/dist/zephyr/client.js +43 -42
  69. package/dist/zephyr/common/api-client.js +35 -30
  70. package/dist/zephyr/common/auth-service.js +16 -13
  71. package/dist/zephyr/common/rest-api-schemas.js +3173 -5146
  72. package/dist/zephyr/tool/environment/get-environments.js +66 -66
  73. package/dist/zephyr/tool/priority/get-priorities.js +41 -41
  74. package/dist/zephyr/tool/project/get-project.js +37 -37
  75. package/dist/zephyr/tool/project/get-projects.js +46 -46
  76. package/dist/zephyr/tool/status/get-statuses.js +47 -47
  77. package/dist/zephyr/tool/test-case/get-test-case.js +37 -37
  78. package/dist/zephyr/tool/test-case/get-test-cases.js +62 -62
  79. package/dist/zephyr/tool/test-cycle/get-test-cycle.js +37 -37
  80. package/dist/zephyr/tool/test-cycle/get-test-cycles.js +70 -70
  81. package/dist/zephyr/tool/test-execution/get-test-execution.js +37 -37
  82. package/dist/zephyr/tool/test-execution/get-test-executions.js +43 -43
  83. package/package.json +5 -5
  84. package/dist/bugsnag/client/api/index.js +0 -6
  85. package/dist/common/types.js +0 -6
  86. package/dist/qmetry/client/tools/types.js +0 -1
  87. package/dist/swagger/client/index.js +0 -6
  88. package/dist/tests/unit/bugsnag/utils/factories.js +0 -86
  89. package/dist/zephyr/tool/zephyr-tool.js +0 -1
@@ -1,308 +1,347 @@
1
1
  import { QMETRY_PATHS } from "../config/rest-endpoints.js";
2
- import { DEFAULT_BULK_UPDATE_EXECUTION_STATUS_PAYLOAD, DEFAULT_CREATE_TESTSUITE_PAYLOAD, DEFAULT_FETCH_EXECUTIONS_BY_TESTSUITE_PAYLOAD, DEFAULT_FETCH_LINKED_ISSUES_BY_TESTCASE_RUN_PAYLOAD, DEFAULT_FETCH_TESTCASE_RUNS_BY_TESTSUITE_RUN_PAYLOAD, DEFAULT_FETCH_TESTCASES_BY_TESTSUITE_PAYLOAD, DEFAULT_FETCH_TESTSUITES_FOR_TESTCASE_PAYLOAD, DEFAULT_FETCH_TESTSUITES_PAYLOAD, DEFAULT_LINKED_PLATFORMS_TO_TESTSUITE_PAYLOAD, DEFAULT_LINKED_TESTCASE_TO_TESTSUITE_PAYLOAD, DEFAULT_REQLINKED_TESTCASE_TO_TESTSUITE_PAYLOAD, DEFAULT_UPDATE_TESTSUITE_PAYLOAD, } from "../types/testsuite.js";
2
+ import { DEFAULT_LINKED_PLATFORMS_TO_TESTSUITE_PAYLOAD, DEFAULT_FETCH_LINKED_ISSUES_BY_TESTCASE_RUN_PAYLOAD, DEFAULT_FETCH_TESTCASE_RUNS_BY_TESTSUITE_RUN_PAYLOAD, DEFAULT_BULK_UPDATE_EXECUTION_STATUS_PAYLOAD, DEFAULT_FETCH_EXECUTIONS_BY_TESTSUITE_PAYLOAD, DEFAULT_FETCH_TESTCASES_BY_TESTSUITE_PAYLOAD, DEFAULT_REQLINKED_TESTCASE_TO_TESTSUITE_PAYLOAD, DEFAULT_LINKED_TESTCASE_TO_TESTSUITE_PAYLOAD, DEFAULT_FETCH_TESTSUITES_FOR_TESTCASE_PAYLOAD, DEFAULT_FETCH_TESTSUITES_PAYLOAD, DEFAULT_UPDATE_TESTSUITE_PAYLOAD, DEFAULT_CREATE_TESTSUITE_PAYLOAD } from "../types/testsuite.js";
3
3
  import { qmetryRequest } from "./api/client-api.js";
4
4
  import { resolveDefaults } from "./utils.js";
5
- /**
6
- * Create test suites.
7
- * @throws If `parentFolderId` or `name` are missing/invalid.
8
- */
9
- export async function createTestSuites(token, baseUrl, project, payload) {
10
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
11
- const body = {
12
- ...DEFAULT_CREATE_TESTSUITE_PAYLOAD,
13
- ...payload,
14
- };
15
- if (typeof body.parentFolderId !== "string") {
16
- throw new Error("[createTestSuites] Missing or invalid required parameter: 'parentFolderId'.");
17
- }
18
- if (typeof body.name !== "string") {
19
- throw new Error("[createTestSuites] Missing or invalid required parameter: 'name'.");
20
- }
21
- return qmetryRequest({
22
- method: "POST",
23
- path: QMETRY_PATHS.TESTSUITE.CREATE_UPDATE_TS,
24
- token,
25
- project: resolvedProject,
26
- baseUrl: resolvedBaseUrl,
27
- body,
28
- });
5
+ async function createTestSuites(token, baseUrl, project, payload) {
6
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
7
+ baseUrl,
8
+ project
9
+ );
10
+ const body = {
11
+ ...DEFAULT_CREATE_TESTSUITE_PAYLOAD,
12
+ ...payload
13
+ };
14
+ if (typeof body.parentFolderId !== "string") {
15
+ throw new Error(
16
+ "[createTestSuites] Missing or invalid required parameter: 'parentFolderId'."
17
+ );
18
+ }
19
+ if (typeof body.name !== "string") {
20
+ throw new Error(
21
+ "[createTestSuites] Missing or invalid required parameter: 'name'."
22
+ );
23
+ }
24
+ return qmetryRequest({
25
+ method: "POST",
26
+ path: QMETRY_PATHS.TESTSUITE.CREATE_UPDATE_TS,
27
+ token,
28
+ project: resolvedProject,
29
+ baseUrl: resolvedBaseUrl,
30
+ body
31
+ });
29
32
  }
30
- /**
31
- * Update test suites.
32
- * @throws If `id` or `entityKey` or `TsFolderID` are missing/invalid.
33
- */
34
- export async function updateTestSuite(token, baseUrl, project, payload) {
35
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
36
- const body = {
37
- ...DEFAULT_UPDATE_TESTSUITE_PAYLOAD,
38
- ...payload,
39
- };
40
- if (typeof body.id !== "number") {
41
- throw new Error("[updateTestSuite] Missing or invalid required parameter: 'id'.");
42
- }
43
- if (typeof body.entityKey !== "string") {
44
- throw new Error("[updateTestSuite] Missing or invalid required parameter: 'entityKey'.");
45
- }
46
- if (typeof body.TsFolderID !== "number") {
47
- throw new Error("[updateTestSuite] Missing or invalid required parameter: 'TsFolderID'.");
48
- }
49
- return qmetryRequest({
50
- method: "PUT",
51
- path: QMETRY_PATHS.TESTSUITE.CREATE_UPDATE_TS,
52
- token,
53
- project: resolvedProject,
54
- baseUrl: resolvedBaseUrl,
55
- body,
56
- });
33
+ async function updateTestSuite(token, baseUrl, project, payload) {
34
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
35
+ baseUrl,
36
+ project
37
+ );
38
+ const body = {
39
+ ...DEFAULT_UPDATE_TESTSUITE_PAYLOAD,
40
+ ...payload
41
+ };
42
+ if (typeof body.id !== "number") {
43
+ throw new Error(
44
+ "[updateTestSuite] Missing or invalid required parameter: 'id'."
45
+ );
46
+ }
47
+ if (typeof body.entityKey !== "string") {
48
+ throw new Error(
49
+ "[updateTestSuite] Missing or invalid required parameter: 'entityKey'."
50
+ );
51
+ }
52
+ if (typeof body.TsFolderID !== "number") {
53
+ throw new Error(
54
+ "[updateTestSuite] Missing or invalid required parameter: 'TsFolderID'."
55
+ );
56
+ }
57
+ return qmetryRequest({
58
+ method: "PUT",
59
+ path: QMETRY_PATHS.TESTSUITE.CREATE_UPDATE_TS,
60
+ token,
61
+ project: resolvedProject,
62
+ baseUrl: resolvedBaseUrl,
63
+ body
64
+ });
57
65
  }
58
- /**
59
- * Fetches a list of test suites.
60
- * @throws If `viewId` or `folderPath` are missing/invalid.
61
- */
62
- export async function fetchTestSuites(token, baseUrl, project, payload) {
63
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
64
- const body = {
65
- ...DEFAULT_FETCH_TESTSUITES_PAYLOAD,
66
- ...payload,
67
- };
68
- if (typeof body.viewId !== "number") {
69
- throw new Error("[fetchTestSuites] Missing or invalid required parameter: 'viewId'.");
70
- }
71
- if (typeof body.folderPath !== "string") {
72
- throw new Error("[fetchTestSuites] Missing or invalid required parameter: 'folderPath'.");
73
- }
74
- return qmetryRequest({
75
- method: "POST",
76
- path: QMETRY_PATHS.TESTSUITE.GET_TS_LIST,
77
- token,
78
- project: resolvedProject,
79
- baseUrl: resolvedBaseUrl,
80
- body,
81
- });
66
+ async function fetchTestSuites(token, baseUrl, project, payload) {
67
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
68
+ baseUrl,
69
+ project
70
+ );
71
+ const body = {
72
+ ...DEFAULT_FETCH_TESTSUITES_PAYLOAD,
73
+ ...payload
74
+ };
75
+ if (typeof body.viewId !== "number") {
76
+ throw new Error(
77
+ "[fetchTestSuites] Missing or invalid required parameter: 'viewId'."
78
+ );
79
+ }
80
+ if (typeof body.folderPath !== "string") {
81
+ throw new Error(
82
+ "[fetchTestSuites] Missing or invalid required parameter: 'folderPath'."
83
+ );
84
+ }
85
+ return qmetryRequest({
86
+ method: "POST",
87
+ path: QMETRY_PATHS.TESTSUITE.GET_TS_LIST,
88
+ token,
89
+ project: resolvedProject,
90
+ baseUrl: resolvedBaseUrl,
91
+ body
92
+ });
82
93
  }
83
- /**
84
- * Fetches test suites to link with test case.
85
- * @throws If `tsFolderID` is missing/invalid.
86
- */
87
- export async function fetchTestSuitesForTestCase(token, baseUrl, project, payload) {
88
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
89
- const body = {
90
- ...DEFAULT_FETCH_TESTSUITES_FOR_TESTCASE_PAYLOAD,
91
- ...payload,
92
- };
93
- if (typeof body.tsFolderID !== "number") {
94
- throw new Error("[fetchTestSuitesForTestCase] Missing or invalid required parameter: 'tsFolderID'.");
95
- }
96
- return qmetryRequest({
97
- method: "POST",
98
- path: QMETRY_PATHS.TESTSUITE.GET_TS_LIST_FOR_TC,
99
- token,
100
- project: resolvedProject,
101
- baseUrl: resolvedBaseUrl,
102
- body,
103
- });
94
+ async function fetchTestSuitesForTestCase(token, baseUrl, project, payload) {
95
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
96
+ baseUrl,
97
+ project
98
+ );
99
+ const body = {
100
+ ...DEFAULT_FETCH_TESTSUITES_FOR_TESTCASE_PAYLOAD,
101
+ ...payload
102
+ };
103
+ if (typeof body.tsFolderID !== "number") {
104
+ throw new Error(
105
+ "[fetchTestSuitesForTestCase] Missing or invalid required parameter: 'tsFolderID'."
106
+ );
107
+ }
108
+ return qmetryRequest({
109
+ method: "POST",
110
+ path: QMETRY_PATHS.TESTSUITE.GET_TS_LIST_FOR_TC,
111
+ token,
112
+ project: resolvedProject,
113
+ baseUrl: resolvedBaseUrl,
114
+ body
115
+ });
104
116
  }
105
- /**
106
- * Fetches test cases linked to a given test suite.
107
- * @throws If `tsID` is missing/invalid.
108
- */
109
- export async function fetchTestCasesByTestSuite(token, baseUrl, project, payload) {
110
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
111
- const body = {
112
- ...DEFAULT_FETCH_TESTCASES_BY_TESTSUITE_PAYLOAD,
113
- ...payload,
114
- };
115
- if (typeof body.tsID !== "number") {
116
- throw new Error("[fetchTestCasesByTestSuite] Missing or invalid required parameter: 'tsID'.");
117
- }
118
- return qmetryRequest({
119
- method: "POST",
120
- path: QMETRY_PATHS.TESTSUITE.GET_TESTCASES_BY_TESTSUITE,
121
- token,
122
- project: resolvedProject,
123
- baseUrl: resolvedBaseUrl,
124
- body,
125
- });
117
+ async function fetchTestCasesByTestSuite(token, baseUrl, project, payload) {
118
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
119
+ baseUrl,
120
+ project
121
+ );
122
+ const body = {
123
+ ...DEFAULT_FETCH_TESTCASES_BY_TESTSUITE_PAYLOAD,
124
+ ...payload
125
+ };
126
+ if (typeof body.tsID !== "number") {
127
+ throw new Error(
128
+ "[fetchTestCasesByTestSuite] Missing or invalid required parameter: 'tsID'."
129
+ );
130
+ }
131
+ return qmetryRequest({
132
+ method: "POST",
133
+ path: QMETRY_PATHS.TESTSUITE.GET_TESTCASES_BY_TESTSUITE,
134
+ token,
135
+ project: resolvedProject,
136
+ baseUrl: resolvedBaseUrl,
137
+ body
138
+ });
126
139
  }
127
- /**
128
- * Fetches executions for a given test suite.
129
- * @throws If `tsID` is missing/invalid.
130
- */
131
- export async function fetchExecutionsByTestSuite(token, baseUrl, project, payload) {
132
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
133
- const body = {
134
- ...DEFAULT_FETCH_EXECUTIONS_BY_TESTSUITE_PAYLOAD,
135
- ...payload,
136
- };
137
- if (typeof body.tsID !== "number") {
138
- throw new Error("[fetchExecutionsByTestSuite] Missing or invalid required parameter: 'tsID'.");
139
- }
140
- return qmetryRequest({
141
- method: "POST",
142
- path: QMETRY_PATHS.TESTSUITE.GET_EXECUTIONS_BY_TESTSUITE,
143
- token,
144
- project: resolvedProject,
145
- baseUrl: resolvedBaseUrl,
146
- body,
147
- });
140
+ async function fetchExecutionsByTestSuite(token, baseUrl, project, payload) {
141
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
142
+ baseUrl,
143
+ project
144
+ );
145
+ const body = {
146
+ ...DEFAULT_FETCH_EXECUTIONS_BY_TESTSUITE_PAYLOAD,
147
+ ...payload
148
+ };
149
+ if (typeof body.tsID !== "number") {
150
+ throw new Error(
151
+ "[fetchExecutionsByTestSuite] Missing or invalid required parameter: 'tsID'."
152
+ );
153
+ }
154
+ return qmetryRequest({
155
+ method: "POST",
156
+ path: QMETRY_PATHS.TESTSUITE.GET_EXECUTIONS_BY_TESTSUITE,
157
+ token,
158
+ project: resolvedProject,
159
+ baseUrl: resolvedBaseUrl,
160
+ body
161
+ });
148
162
  }
149
- /**
150
- * Fetches test case runs for a given test suite run ID.
151
- * @throws If `tsrunID` or `viewId` is missing/invalid.
152
- */
153
- export async function fetchTestCaseRunsByTestSuiteRun(token, baseUrl, project, payload) {
154
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
155
- const body = {
156
- ...DEFAULT_FETCH_TESTCASE_RUNS_BY_TESTSUITE_RUN_PAYLOAD,
157
- ...payload,
158
- };
159
- if (typeof body.tsrunID !== "string" || !body.tsrunID) {
160
- throw new Error("[fetchTestCaseRunsByTestSuiteRun] Missing or invalid required parameter: 'tsrunID'.");
161
- }
162
- if (typeof body.viewId !== "number") {
163
- throw new Error("[fetchTestCaseRunsByTestSuiteRun] Missing or invalid required parameter: 'viewId'.");
164
- }
165
- return qmetryRequest({
166
- method: "POST",
167
- path: QMETRY_PATHS.TESTSUITE.GET_TESTCASE_RUNS_BY_TESTSUITE_RUN,
168
- token,
169
- project: resolvedProject,
170
- baseUrl: resolvedBaseUrl,
171
- body,
172
- });
163
+ async function fetchTestCaseRunsByTestSuiteRun(token, baseUrl, project, payload) {
164
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
165
+ baseUrl,
166
+ project
167
+ );
168
+ const body = {
169
+ ...DEFAULT_FETCH_TESTCASE_RUNS_BY_TESTSUITE_RUN_PAYLOAD,
170
+ ...payload
171
+ };
172
+ if (typeof body.tsrunID !== "string" || !body.tsrunID) {
173
+ throw new Error(
174
+ "[fetchTestCaseRunsByTestSuiteRun] Missing or invalid required parameter: 'tsrunID'."
175
+ );
176
+ }
177
+ if (typeof body.viewId !== "number") {
178
+ throw new Error(
179
+ "[fetchTestCaseRunsByTestSuiteRun] Missing or invalid required parameter: 'viewId'."
180
+ );
181
+ }
182
+ return qmetryRequest({
183
+ method: "POST",
184
+ path: QMETRY_PATHS.TESTSUITE.GET_TESTCASE_RUNS_BY_TESTSUITE_RUN,
185
+ token,
186
+ project: resolvedProject,
187
+ baseUrl: resolvedBaseUrl,
188
+ body
189
+ });
173
190
  }
174
- /**
175
- * Fetches linked issues for a specific test case run.
176
- * @throws If `entityId` is missing/invalid.
177
- */
178
- export async function fetchLinkedIssuesByTestCaseRun(token, baseUrl, project, payload) {
179
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
180
- const body = {
181
- ...DEFAULT_FETCH_LINKED_ISSUES_BY_TESTCASE_RUN_PAYLOAD,
182
- ...payload,
183
- };
184
- if (typeof body.entityId !== "number") {
185
- throw new Error("[fetchLinkedIssuesByTestCaseRun] Missing or invalid required parameter: 'entityId'.");
186
- }
187
- return qmetryRequest({
188
- method: "POST",
189
- path: QMETRY_PATHS.TESTSUITE.GET_LINKED_ISSUES_BY_TESTCASE_RUN,
190
- token,
191
- project: resolvedProject,
192
- baseUrl: resolvedBaseUrl,
193
- body,
194
- });
191
+ async function fetchLinkedIssuesByTestCaseRun(token, baseUrl, project, payload) {
192
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
193
+ baseUrl,
194
+ project
195
+ );
196
+ const body = {
197
+ ...DEFAULT_FETCH_LINKED_ISSUES_BY_TESTCASE_RUN_PAYLOAD,
198
+ ...payload
199
+ };
200
+ if (typeof body.entityId !== "number") {
201
+ throw new Error(
202
+ "[fetchLinkedIssuesByTestCaseRun] Missing or invalid required parameter: 'entityId'."
203
+ );
204
+ }
205
+ return qmetryRequest({
206
+ method: "POST",
207
+ path: QMETRY_PATHS.TESTSUITE.GET_LINKED_ISSUES_BY_TESTCASE_RUN,
208
+ token,
209
+ project: resolvedProject,
210
+ baseUrl: resolvedBaseUrl,
211
+ body
212
+ });
195
213
  }
196
- /**
197
- * Link test cases to a test suite.
198
- * @throws If `tcID` or `tcVersionID` are missing/invalid.
199
- */
200
- export async function linkTestCasesToTestSuite(token, baseUrl, project, payload) {
201
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
202
- const body = {
203
- ...DEFAULT_LINKED_TESTCASE_TO_TESTSUITE_PAYLOAD,
204
- ...payload,
205
- };
206
- if (typeof body.tsID !== "number") {
207
- throw new Error("[linkTestCasesToTestSuite] Missing or invalid required parameter: 'tsID'.");
208
- }
209
- if (!body.tcvdIDs) {
210
- throw new Error("[linkTestCasesToTestSuite] 'tcvdIDs' must be provided.");
211
- }
212
- return qmetryRequest({
213
- method: "PUT",
214
- path: QMETRY_PATHS.TESTSUITE.LINKED_TESTCASES_TO_TESTSUITE,
215
- token,
216
- project: resolvedProject,
217
- baseUrl: resolvedBaseUrl,
218
- body,
219
- });
214
+ async function linkTestCasesToTestSuite(token, baseUrl, project, payload) {
215
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
216
+ baseUrl,
217
+ project
218
+ );
219
+ const body = {
220
+ ...DEFAULT_LINKED_TESTCASE_TO_TESTSUITE_PAYLOAD,
221
+ ...payload
222
+ };
223
+ if (typeof body.tsID !== "number") {
224
+ throw new Error(
225
+ "[linkTestCasesToTestSuite] Missing or invalid required parameter: 'tsID'."
226
+ );
227
+ }
228
+ if (!body.tcvdIDs) {
229
+ throw new Error("[linkTestCasesToTestSuite] 'tcvdIDs' must be provided.");
230
+ }
231
+ return qmetryRequest({
232
+ method: "PUT",
233
+ path: QMETRY_PATHS.TESTSUITE.LINKED_TESTCASES_TO_TESTSUITE,
234
+ token,
235
+ project: resolvedProject,
236
+ baseUrl: resolvedBaseUrl,
237
+ body
238
+ });
220
239
  }
221
- /**
222
- * Requirements Linked test cases to a test suite.
223
- * @throws If `tcID` or `rqVersionIds` are missing/invalid.
224
- */
225
- export async function reqLinkedTestCasesToTestSuite(token, baseUrl, project, payload) {
226
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
227
- const body = {
228
- ...DEFAULT_REQLINKED_TESTCASE_TO_TESTSUITE_PAYLOAD,
229
- ...payload,
230
- };
231
- if (typeof body.tsID !== "number") {
232
- throw new Error("[reqLinkedTestCasesToTestSuite] Missing or invalid required parameter: 'tsID'.");
233
- }
234
- if (!body.tcvdIDs) {
235
- throw new Error("[reqLinkedTestCasesToTestSuite] 'tcvdIDs' must be provided.");
236
- }
237
- return qmetryRequest({
238
- method: "PUT",
239
- path: QMETRY_PATHS.TESTSUITE.LINKED_TESTCASES_TO_TESTSUITE,
240
- token,
241
- project: resolvedProject,
242
- baseUrl: resolvedBaseUrl,
243
- body,
244
- });
240
+ async function reqLinkedTestCasesToTestSuite(token, baseUrl, project, payload) {
241
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
242
+ baseUrl,
243
+ project
244
+ );
245
+ const body = {
246
+ ...DEFAULT_REQLINKED_TESTCASE_TO_TESTSUITE_PAYLOAD,
247
+ ...payload
248
+ };
249
+ if (typeof body.tsID !== "number") {
250
+ throw new Error(
251
+ "[reqLinkedTestCasesToTestSuite] Missing or invalid required parameter: 'tsID'."
252
+ );
253
+ }
254
+ if (!body.tcvdIDs) {
255
+ throw new Error(
256
+ "[reqLinkedTestCasesToTestSuite] 'tcvdIDs' must be provided."
257
+ );
258
+ }
259
+ return qmetryRequest({
260
+ method: "PUT",
261
+ path: QMETRY_PATHS.TESTSUITE.LINKED_TESTCASES_TO_TESTSUITE,
262
+ token,
263
+ project: resolvedProject,
264
+ baseUrl: resolvedBaseUrl,
265
+ body
266
+ });
245
267
  }
246
- /**
247
- * Link platforms to a test suite.
248
- * @throws If `qmTsId` or `qmPlatformId` are missing/invalid.
249
- */
250
- export async function linkPlatformsToTestSuite(token, baseUrl, project, payload) {
251
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
252
- const body = {
253
- ...DEFAULT_LINKED_PLATFORMS_TO_TESTSUITE_PAYLOAD,
254
- ...payload,
255
- };
256
- if (typeof body.qmTsId !== "number") {
257
- throw new Error("[linkPlatformsToTestSuite] Missing or invalid required parameter: 'qmTsId'.");
258
- }
259
- if (!body.qmPlatformId ||
260
- typeof body.qmPlatformId !== "string" ||
261
- body.qmPlatformId.trim().length === 0) {
262
- throw new Error("[linkPlatformsToTestSuite] Missing or invalid required parameter: 'qmPlatformId'. It must be a non-empty comma-separated string of Platform IDs.");
263
- }
264
- return qmetryRequest({
265
- method: "PUT",
266
- path: QMETRY_PATHS.TESTSUITE.LINK_PLATFORMS_TO_TESTSUITE,
267
- token,
268
- project: resolvedProject,
269
- baseUrl: resolvedBaseUrl,
270
- body,
271
- });
268
+ async function linkPlatformsToTestSuite(token, baseUrl, project, payload) {
269
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
270
+ baseUrl,
271
+ project
272
+ );
273
+ const body = {
274
+ ...DEFAULT_LINKED_PLATFORMS_TO_TESTSUITE_PAYLOAD,
275
+ ...payload
276
+ };
277
+ if (typeof body.qmTsId !== "number") {
278
+ throw new Error(
279
+ "[linkPlatformsToTestSuite] Missing or invalid required parameter: 'qmTsId'."
280
+ );
281
+ }
282
+ if (!body.qmPlatformId || typeof body.qmPlatformId !== "string" || body.qmPlatformId.trim().length === 0) {
283
+ throw new Error(
284
+ "[linkPlatformsToTestSuite] Missing or invalid required parameter: 'qmPlatformId'. It must be a non-empty comma-separated string of Platform IDs."
285
+ );
286
+ }
287
+ return qmetryRequest({
288
+ method: "PUT",
289
+ path: QMETRY_PATHS.TESTSUITE.LINK_PLATFORMS_TO_TESTSUITE,
290
+ token,
291
+ project: resolvedProject,
292
+ baseUrl: resolvedBaseUrl,
293
+ body
294
+ });
272
295
  }
273
- /**
274
- * Bulk update execution status for test case runs.
275
- * @throws If `entityIDs`, `entityType`, `qmTsRunId`, or `runStatusID` are missing/invalid.
276
- */
277
- export async function bulkUpdateExecutionStatus(token, baseUrl, project, payload) {
278
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
279
- const body = {
280
- ...DEFAULT_BULK_UPDATE_EXECUTION_STATUS_PAYLOAD,
281
- ...payload,
282
- };
283
- if (!body.entityIDs ||
284
- typeof body.entityIDs !== "string" ||
285
- body.entityIDs.trim().length === 0) {
286
- throw new Error("[bulkUpdateExecutionStatus] Missing or invalid required parameter: 'entityIDs'. It must be a non-empty comma-separated string of Test Case Run IDs.");
287
- }
288
- if (!body.entityType ||
289
- (body.entityType !== "TCR" && body.entityType !== "TCSR")) {
290
- throw new Error("[bulkUpdateExecutionStatus] Missing or invalid required parameter: 'entityType'. Must be 'TCR' or 'TCSR'.");
291
- }
292
- if (!body.qmTsRunId ||
293
- typeof body.qmTsRunId !== "string" ||
294
- body.qmTsRunId.trim().length === 0) {
295
- throw new Error("[bulkUpdateExecutionStatus] Missing or invalid required parameter: 'qmTsRunId'. It must be a non-empty string.");
296
- }
297
- if (typeof body.runStatusID !== "number") {
298
- throw new Error("[bulkUpdateExecutionStatus] Missing or invalid required parameter: 'runStatusID'. It must be a number.");
299
- }
300
- return qmetryRequest({
301
- method: "PUT",
302
- path: QMETRY_PATHS.TESTSUITE.BULK_UPDATE_EXECUTION_STATUS,
303
- token,
304
- project: resolvedProject,
305
- baseUrl: resolvedBaseUrl,
306
- body,
307
- });
296
+ async function bulkUpdateExecutionStatus(token, baseUrl, project, payload) {
297
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
298
+ baseUrl,
299
+ project
300
+ );
301
+ const body = {
302
+ ...DEFAULT_BULK_UPDATE_EXECUTION_STATUS_PAYLOAD,
303
+ ...payload
304
+ };
305
+ if (!body.entityIDs || typeof body.entityIDs !== "string" || body.entityIDs.trim().length === 0) {
306
+ throw new Error(
307
+ "[bulkUpdateExecutionStatus] Missing or invalid required parameter: 'entityIDs'. It must be a non-empty comma-separated string of Test Case Run IDs."
308
+ );
309
+ }
310
+ if (!body.entityType || body.entityType !== "TCR" && body.entityType !== "TCSR") {
311
+ throw new Error(
312
+ "[bulkUpdateExecutionStatus] Missing or invalid required parameter: 'entityType'. Must be 'TCR' or 'TCSR'."
313
+ );
314
+ }
315
+ if (!body.qmTsRunId || typeof body.qmTsRunId !== "string" || body.qmTsRunId.trim().length === 0) {
316
+ throw new Error(
317
+ "[bulkUpdateExecutionStatus] Missing or invalid required parameter: 'qmTsRunId'. It must be a non-empty string."
318
+ );
319
+ }
320
+ if (typeof body.runStatusID !== "number") {
321
+ throw new Error(
322
+ "[bulkUpdateExecutionStatus] Missing or invalid required parameter: 'runStatusID'. It must be a number."
323
+ );
324
+ }
325
+ return qmetryRequest({
326
+ method: "PUT",
327
+ path: QMETRY_PATHS.TESTSUITE.BULK_UPDATE_EXECUTION_STATUS,
328
+ token,
329
+ project: resolvedProject,
330
+ baseUrl: resolvedBaseUrl,
331
+ body
332
+ });
308
333
  }
334
+ export {
335
+ bulkUpdateExecutionStatus,
336
+ createTestSuites,
337
+ fetchExecutionsByTestSuite,
338
+ fetchLinkedIssuesByTestCaseRun,
339
+ fetchTestCaseRunsByTestSuiteRun,
340
+ fetchTestCasesByTestSuite,
341
+ fetchTestSuites,
342
+ fetchTestSuitesForTestCase,
343
+ linkPlatformsToTestSuite,
344
+ linkTestCasesToTestSuite,
345
+ reqLinkedTestCasesToTestSuite,
346
+ updateTestSuite
347
+ };