@smartbear/mcp 0.12.0 → 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 +158 -57
  4. package/dist/bugsnag/client/api/Project.js +398 -243
  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 -1277
  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,76 +1,88 @@
1
1
  import { QMETRY_PATHS } from "../config/rest-endpoints.js";
2
- import { DEFAULT_FETCH_REQUIREMENT_DETAILS_PAYLOAD, DEFAULT_FETCH_REQUIREMENTS_LINKED_TO_TESTCASE_PAYLOAD, DEFAULT_FETCH_REQUIREMENTS_PAYLOAD, } from "../types/requirements.js";
2
+ import { DEFAULT_FETCH_REQUIREMENTS_LINKED_TO_TESTCASE_PAYLOAD, DEFAULT_FETCH_REQUIREMENT_DETAILS_PAYLOAD, DEFAULT_FETCH_REQUIREMENTS_PAYLOAD } from "../types/requirements.js";
3
3
  import { qmetryRequest } from "./api/client-api.js";
4
4
  import { resolveDefaults } from "./utils.js";
5
- /**
6
- * Fetches a list of requirements.
7
- * @throws If `viewId` or `folderPath` are missing/invalid.
8
- */
9
- export async function fetchRequirements(token, baseUrl, project, payload) {
10
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
11
- const body = {
12
- ...DEFAULT_FETCH_REQUIREMENTS_PAYLOAD,
13
- ...payload,
14
- };
15
- if (typeof body.viewId !== "number") {
16
- throw new Error("[fetchRequirements] Missing or invalid required parameter: 'viewId'.");
17
- }
18
- if (typeof body.folderPath !== "string") {
19
- throw new Error("[fetchRequirements] Missing or invalid required parameter: 'folderPath'.");
20
- }
21
- return qmetryRequest({
22
- method: "POST",
23
- path: QMETRY_PATHS.REQUIREMENT.GET_RQ_LIST,
24
- token,
25
- project: resolvedProject,
26
- baseUrl: resolvedBaseUrl,
27
- body,
28
- });
5
+ async function fetchRequirements(token, baseUrl, project, payload) {
6
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
7
+ baseUrl,
8
+ project
9
+ );
10
+ const body = {
11
+ ...DEFAULT_FETCH_REQUIREMENTS_PAYLOAD,
12
+ ...payload
13
+ };
14
+ if (typeof body.viewId !== "number") {
15
+ throw new Error(
16
+ "[fetchRequirements] Missing or invalid required parameter: 'viewId'."
17
+ );
18
+ }
19
+ if (typeof body.folderPath !== "string") {
20
+ throw new Error(
21
+ "[fetchRequirements] Missing or invalid required parameter: 'folderPath'."
22
+ );
23
+ }
24
+ return qmetryRequest({
25
+ method: "POST",
26
+ path: QMETRY_PATHS.REQUIREMENT.GET_RQ_LIST,
27
+ token,
28
+ project: resolvedProject,
29
+ baseUrl: resolvedBaseUrl,
30
+ body
31
+ });
29
32
  }
30
- /**
31
- * Fetches requirement details by numeric ID.
32
- * @throws If `id` or `version` are missing/invalid.
33
- */
34
- export async function fetchRequirementDetails(token, baseUrl, project, payload) {
35
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
36
- const body = {
37
- ...DEFAULT_FETCH_REQUIREMENT_DETAILS_PAYLOAD,
38
- ...payload,
39
- };
40
- if (typeof body.id !== "number") {
41
- throw new Error("[fetchRequirementDetails] Missing or invalid required parameter: 'id'.");
42
- }
43
- if (typeof body.version !== "number") {
44
- throw new Error("[fetchRequirementDetails] Missing or invalid required parameter: 'version'.");
45
- }
46
- return qmetryRequest({
47
- method: "POST",
48
- path: QMETRY_PATHS.REQUIREMENT.GET_RQ_DETAILS,
49
- token,
50
- project: resolvedProject,
51
- baseUrl: resolvedBaseUrl,
52
- body,
53
- });
33
+ async function fetchRequirementDetails(token, baseUrl, project, payload) {
34
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
35
+ baseUrl,
36
+ project
37
+ );
38
+ const body = {
39
+ ...DEFAULT_FETCH_REQUIREMENT_DETAILS_PAYLOAD,
40
+ ...payload
41
+ };
42
+ if (typeof body.id !== "number") {
43
+ throw new Error(
44
+ "[fetchRequirementDetails] Missing or invalid required parameter: 'id'."
45
+ );
46
+ }
47
+ if (typeof body.version !== "number") {
48
+ throw new Error(
49
+ "[fetchRequirementDetails] Missing or invalid required parameter: 'version'."
50
+ );
51
+ }
52
+ return qmetryRequest({
53
+ method: "POST",
54
+ path: QMETRY_PATHS.REQUIREMENT.GET_RQ_DETAILS,
55
+ token,
56
+ project: resolvedProject,
57
+ baseUrl: resolvedBaseUrl,
58
+ body
59
+ });
54
60
  }
55
- /**
56
- * Fetches requirements linked to a specific test case.
57
- * @throws If `tcID` is missing/invalid.
58
- */
59
- export async function fetchRequirementsLinkedToTestCase(token, baseUrl, project, payload) {
60
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
61
- const body = {
62
- ...DEFAULT_FETCH_REQUIREMENTS_LINKED_TO_TESTCASE_PAYLOAD,
63
- ...payload,
64
- };
65
- if (typeof body.tcID !== "number") {
66
- throw new Error("[fetchRequirementsLinkedToTestCase] Missing or invalid required parameter: 'tcID'.");
67
- }
68
- return qmetryRequest({
69
- method: "POST",
70
- path: QMETRY_PATHS.REQUIREMENT.GET_RQ_LINKED_TO_TC,
71
- token,
72
- project: resolvedProject,
73
- baseUrl: resolvedBaseUrl,
74
- body,
75
- });
61
+ async function fetchRequirementsLinkedToTestCase(token, baseUrl, project, payload) {
62
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
63
+ baseUrl,
64
+ project
65
+ );
66
+ const body = {
67
+ ...DEFAULT_FETCH_REQUIREMENTS_LINKED_TO_TESTCASE_PAYLOAD,
68
+ ...payload
69
+ };
70
+ if (typeof body.tcID !== "number") {
71
+ throw new Error(
72
+ "[fetchRequirementsLinkedToTestCase] Missing or invalid required parameter: 'tcID'."
73
+ );
74
+ }
75
+ return qmetryRequest({
76
+ method: "POST",
77
+ path: QMETRY_PATHS.REQUIREMENT.GET_RQ_LINKED_TO_TC,
78
+ token,
79
+ project: resolvedProject,
80
+ baseUrl: resolvedBaseUrl,
81
+ body
82
+ });
76
83
  }
84
+ export {
85
+ fetchRequirementDetails,
86
+ fetchRequirements,
87
+ fetchRequirementsLinkedToTestCase
88
+ };
@@ -1,220 +1,252 @@
1
1
  import { QMETRY_PATHS } from "../config/rest-endpoints.js";
2
- import { DEFAULT_CREATE_TESTCASES_PAYLOAD, DEFAULT_FETCH_TESTCASE_DETAILS_PAYLOAD, DEFAULT_FETCH_TESTCASE_EXECUTIONS_PAYLOAD, DEFAULT_FETCH_TESTCASE_STEPS_PAYLOAD, DEFAULT_FETCH_TESTCASE_VERSION_DETAILS_PAYLOAD, DEFAULT_FETCH_TESTCASES_LINKED_TO_REQUIREMENT_PAYLOAD, DEFAULT_FETCH_TESTCASES_PAYLOAD, DEFAULT_LINKED_REQUIREMENT_TO_TESTCASE_PAYLOAD, DEFAULT_UPDATE_TESTCASES_PAYLOAD, } from "../types/testcase.js";
2
+ import { DEFAULT_FETCH_TESTCASES_LINKED_TO_REQUIREMENT_PAYLOAD, DEFAULT_LINKED_REQUIREMENT_TO_TESTCASE_PAYLOAD, DEFAULT_FETCH_TESTCASE_EXECUTIONS_PAYLOAD, DEFAULT_FETCH_TESTCASE_STEPS_PAYLOAD, DEFAULT_FETCH_TESTCASE_VERSION_DETAILS_PAYLOAD, DEFAULT_FETCH_TESTCASE_DETAILS_PAYLOAD, DEFAULT_FETCH_TESTCASES_PAYLOAD, DEFAULT_UPDATE_TESTCASES_PAYLOAD, DEFAULT_CREATE_TESTCASES_PAYLOAD } from "../types/testcase.js";
3
3
  import { qmetryRequest } from "./api/client-api.js";
4
4
  import { resolveDefaults } from "./utils.js";
5
- /**
6
- * Create test cases.
7
- * @throws If `tcFolderID` or `name` are missing/invalid.
8
- */
9
- export async function createTestCases(token, baseUrl, project, payload) {
10
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
11
- const body = {
12
- ...DEFAULT_CREATE_TESTCASES_PAYLOAD,
13
- ...payload,
14
- };
15
- if (typeof body.tcFolderID !== "string") {
16
- throw new Error("[createTestCases] Missing or invalid required parameter: 'tcFolderID'.");
17
- }
18
- if (typeof body.name !== "string") {
19
- throw new Error("[createTestCases] Missing or invalid required parameter: 'name'.");
20
- }
21
- return qmetryRequest({
22
- method: "POST",
23
- path: QMETRY_PATHS.TESTCASE.CREATE_UPDATE_TC,
24
- token,
25
- project: resolvedProject,
26
- baseUrl: resolvedBaseUrl,
27
- body,
28
- });
5
+ async function createTestCases(token, baseUrl, project, payload) {
6
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
7
+ baseUrl,
8
+ project
9
+ );
10
+ const body = {
11
+ ...DEFAULT_CREATE_TESTCASES_PAYLOAD,
12
+ ...payload
13
+ };
14
+ if (typeof body.tcFolderID !== "string") {
15
+ throw new Error(
16
+ "[createTestCases] Missing or invalid required parameter: 'tcFolderID'."
17
+ );
18
+ }
19
+ if (typeof body.name !== "string") {
20
+ throw new Error(
21
+ "[createTestCases] Missing or invalid required parameter: 'name'."
22
+ );
23
+ }
24
+ return qmetryRequest({
25
+ method: "POST",
26
+ path: QMETRY_PATHS.TESTCASE.CREATE_UPDATE_TC,
27
+ token,
28
+ project: resolvedProject,
29
+ baseUrl: resolvedBaseUrl,
30
+ body
31
+ });
29
32
  }
30
- /**
31
- * Update test cases.
32
- * @throws If `tcID` or `tcVersionID` are missing/invalid.
33
- */
34
- export async function updateTestCase(token, baseUrl, project, payload) {
35
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
36
- const body = {
37
- ...DEFAULT_UPDATE_TESTCASES_PAYLOAD,
38
- ...payload,
39
- };
40
- if (typeof body.tcID !== "number") {
41
- throw new Error("[updateTestCase] Missing or invalid required parameter: 'tcID'.");
42
- }
43
- if (typeof body.tcVersionID !== "number") {
44
- throw new Error("[updateTestCase] Missing or invalid required parameter: 'tcVersionID'.");
45
- }
46
- return qmetryRequest({
47
- method: "PUT",
48
- path: QMETRY_PATHS.TESTCASE.CREATE_UPDATE_TC,
49
- token,
50
- project: resolvedProject,
51
- baseUrl: resolvedBaseUrl,
52
- body,
53
- });
33
+ async function updateTestCase(token, baseUrl, project, payload) {
34
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
35
+ baseUrl,
36
+ project
37
+ );
38
+ const body = {
39
+ ...DEFAULT_UPDATE_TESTCASES_PAYLOAD,
40
+ ...payload
41
+ };
42
+ if (typeof body.tcID !== "number") {
43
+ throw new Error(
44
+ "[updateTestCase] Missing or invalid required parameter: 'tcID'."
45
+ );
46
+ }
47
+ if (typeof body.tcVersionID !== "number") {
48
+ throw new Error(
49
+ "[updateTestCase] Missing or invalid required parameter: 'tcVersionID'."
50
+ );
51
+ }
52
+ return qmetryRequest({
53
+ method: "PUT",
54
+ path: QMETRY_PATHS.TESTCASE.CREATE_UPDATE_TC,
55
+ token,
56
+ project: resolvedProject,
57
+ baseUrl: resolvedBaseUrl,
58
+ body
59
+ });
54
60
  }
55
- /**
56
- * Fetches a list of test cases.
57
- * @throws If `viewId` or `folderPath` are missing/invalid.
58
- */
59
- export async function fetchTestCases(token, baseUrl, project, payload) {
60
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
61
- const body = {
62
- ...DEFAULT_FETCH_TESTCASES_PAYLOAD,
63
- ...payload,
64
- };
65
- if (typeof body.viewId !== "number") {
66
- throw new Error("[fetchTestCases] Missing or invalid required parameter: 'viewId'.");
67
- }
68
- if (typeof body.folderPath !== "string") {
69
- throw new Error("[fetchTestCases] Missing or invalid required parameter: 'folderPath'.");
70
- }
71
- return qmetryRequest({
72
- method: "POST",
73
- path: QMETRY_PATHS.TESTCASE.GET_TC_LIST,
74
- token,
75
- project: resolvedProject,
76
- baseUrl: resolvedBaseUrl,
77
- body,
78
- });
61
+ async function fetchTestCases(token, baseUrl, project, payload) {
62
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
63
+ baseUrl,
64
+ project
65
+ );
66
+ const body = {
67
+ ...DEFAULT_FETCH_TESTCASES_PAYLOAD,
68
+ ...payload
69
+ };
70
+ if (typeof body.viewId !== "number") {
71
+ throw new Error(
72
+ "[fetchTestCases] Missing or invalid required parameter: 'viewId'."
73
+ );
74
+ }
75
+ if (typeof body.folderPath !== "string") {
76
+ throw new Error(
77
+ "[fetchTestCases] Missing or invalid required parameter: 'folderPath'."
78
+ );
79
+ }
80
+ return qmetryRequest({
81
+ method: "POST",
82
+ path: QMETRY_PATHS.TESTCASE.GET_TC_LIST,
83
+ token,
84
+ project: resolvedProject,
85
+ baseUrl: resolvedBaseUrl,
86
+ body
87
+ });
79
88
  }
80
- /**
81
- * Fetches a test case details.
82
- * @throws If `tcID` is missing/invalid.
83
- */
84
- export async function fetchTestCaseDetails(token, baseUrl, project, payload) {
85
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
86
- const body = {
87
- ...DEFAULT_FETCH_TESTCASE_DETAILS_PAYLOAD,
88
- ...payload,
89
- };
90
- if (typeof body.tcID !== "number") {
91
- throw new Error("[fetchTestCaseDetails] Missing or invalid required parameter: 'tcID'.");
92
- }
93
- return qmetryRequest({
94
- method: "POST",
95
- path: QMETRY_PATHS.TESTCASE.GET_TC_DETAILS,
96
- token,
97
- project: resolvedProject,
98
- baseUrl: resolvedBaseUrl,
99
- body,
100
- });
89
+ async function fetchTestCaseDetails(token, baseUrl, project, payload) {
90
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
91
+ baseUrl,
92
+ project
93
+ );
94
+ const body = {
95
+ ...DEFAULT_FETCH_TESTCASE_DETAILS_PAYLOAD,
96
+ ...payload
97
+ };
98
+ if (typeof body.tcID !== "number") {
99
+ throw new Error(
100
+ "[fetchTestCaseDetails] Missing or invalid required parameter: 'tcID'."
101
+ );
102
+ }
103
+ return qmetryRequest({
104
+ method: "POST",
105
+ path: QMETRY_PATHS.TESTCASE.GET_TC_DETAILS,
106
+ token,
107
+ project: resolvedProject,
108
+ baseUrl: resolvedBaseUrl,
109
+ body
110
+ });
101
111
  }
102
- /**
103
- * Fetches a test case details by version.
104
- * @throws If `id` is missing/invalid.
105
- */
106
- export async function fetchTestCaseVersionDetails(token, baseUrl, project, payload) {
107
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
108
- const body = {
109
- ...DEFAULT_FETCH_TESTCASE_VERSION_DETAILS_PAYLOAD,
110
- ...payload,
111
- };
112
- if (!body.id) {
113
- throw new Error("[fetchTestCaseVersionDetails] Missing or invalid required parameter: 'id'.");
114
- }
115
- if (typeof body.version !== "number") {
116
- throw new Error("[fetchTestCaseVersionDetails] Missing or invalid required parameter: 'version'.");
117
- }
118
- return qmetryRequest({
119
- method: "POST",
120
- path: QMETRY_PATHS.TESTCASE.GET_TC_DETAILS_BY_VERSION,
121
- token,
122
- project: resolvedProject,
123
- baseUrl: resolvedBaseUrl,
124
- body,
125
- });
112
+ async function fetchTestCaseVersionDetails(token, baseUrl, project, payload) {
113
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
114
+ baseUrl,
115
+ project
116
+ );
117
+ const body = {
118
+ ...DEFAULT_FETCH_TESTCASE_VERSION_DETAILS_PAYLOAD,
119
+ ...payload
120
+ };
121
+ if (!body.id) {
122
+ throw new Error(
123
+ "[fetchTestCaseVersionDetails] Missing or invalid required parameter: 'id'."
124
+ );
125
+ }
126
+ if (typeof body.version !== "number") {
127
+ throw new Error(
128
+ "[fetchTestCaseVersionDetails] Missing or invalid required parameter: 'version'."
129
+ );
130
+ }
131
+ return qmetryRequest({
132
+ method: "POST",
133
+ path: QMETRY_PATHS.TESTCASE.GET_TC_DETAILS_BY_VERSION,
134
+ token,
135
+ project: resolvedProject,
136
+ baseUrl: resolvedBaseUrl,
137
+ body
138
+ });
126
139
  }
127
- /**
128
- * Fetches a test case steps.
129
- * @throws If `id` is missing/invalid.
130
- */
131
- export async function fetchTestCaseSteps(token, baseUrl, project, payload) {
132
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
133
- const body = {
134
- ...DEFAULT_FETCH_TESTCASE_STEPS_PAYLOAD,
135
- ...payload,
136
- };
137
- if (typeof body.id !== "number") {
138
- throw new Error("[fetchTestCaseSteps] Missing or invalid required parameter: 'id'.");
139
- }
140
- return qmetryRequest({
141
- method: "POST",
142
- path: QMETRY_PATHS.TESTCASE.GET_TC_STEPS,
143
- token,
144
- project: resolvedProject,
145
- baseUrl: resolvedBaseUrl,
146
- body,
147
- });
140
+ async function fetchTestCaseSteps(token, baseUrl, project, payload) {
141
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
142
+ baseUrl,
143
+ project
144
+ );
145
+ const body = {
146
+ ...DEFAULT_FETCH_TESTCASE_STEPS_PAYLOAD,
147
+ ...payload
148
+ };
149
+ if (typeof body.id !== "number") {
150
+ throw new Error(
151
+ "[fetchTestCaseSteps] Missing or invalid required parameter: 'id'."
152
+ );
153
+ }
154
+ return qmetryRequest({
155
+ method: "POST",
156
+ path: QMETRY_PATHS.TESTCASE.GET_TC_STEPS,
157
+ token,
158
+ project: resolvedProject,
159
+ baseUrl: resolvedBaseUrl,
160
+ body
161
+ });
148
162
  }
149
- /**
150
- * Fetches test cases linked to a specific requirement.
151
- * @throws If `rqID` is missing/invalid.
152
- */
153
- export async function fetchTestCasesLinkedToRequirement(token, baseUrl, project, payload) {
154
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
155
- const body = {
156
- ...DEFAULT_FETCH_TESTCASES_LINKED_TO_REQUIREMENT_PAYLOAD,
157
- ...payload,
158
- };
159
- if (typeof body.rqID !== "number") {
160
- throw new Error("[fetchTestCasesLinkedToRequirement] Missing or invalid required parameter: 'rqID'.");
161
- }
162
- return qmetryRequest({
163
- method: "POST",
164
- path: QMETRY_PATHS.TESTCASE.GET_TC_LINKED_TO_RQ,
165
- token,
166
- project: resolvedProject,
167
- baseUrl: resolvedBaseUrl,
168
- body,
169
- });
163
+ async function fetchTestCasesLinkedToRequirement(token, baseUrl, project, payload) {
164
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
165
+ baseUrl,
166
+ project
167
+ );
168
+ const body = {
169
+ ...DEFAULT_FETCH_TESTCASES_LINKED_TO_REQUIREMENT_PAYLOAD,
170
+ ...payload
171
+ };
172
+ if (typeof body.rqID !== "number") {
173
+ throw new Error(
174
+ "[fetchTestCasesLinkedToRequirement] Missing or invalid required parameter: 'rqID'."
175
+ );
176
+ }
177
+ return qmetryRequest({
178
+ method: "POST",
179
+ path: QMETRY_PATHS.TESTCASE.GET_TC_LINKED_TO_RQ,
180
+ token,
181
+ project: resolvedProject,
182
+ baseUrl: resolvedBaseUrl,
183
+ body
184
+ });
170
185
  }
171
- /**
172
- * Fetches executions for a specific test case.
173
- * @throws If `tcid` is missing/invalid.
174
- */
175
- export async function fetchTestCaseExecutions(token, baseUrl, project, payload) {
176
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
177
- const body = {
178
- ...DEFAULT_FETCH_TESTCASE_EXECUTIONS_PAYLOAD,
179
- ...payload,
180
- };
181
- if (typeof body.tcid !== "number") {
182
- throw new Error("[fetchTestCaseExecutions] Missing or invalid required parameter: 'tcid'.");
183
- }
184
- return qmetryRequest({
185
- method: "POST",
186
- path: QMETRY_PATHS.TESTCASE.GET_TC_EXECUTIONS,
187
- token,
188
- project: resolvedProject,
189
- baseUrl: resolvedBaseUrl,
190
- body,
191
- });
186
+ async function fetchTestCaseExecutions(token, baseUrl, project, payload) {
187
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
188
+ baseUrl,
189
+ project
190
+ );
191
+ const body = {
192
+ ...DEFAULT_FETCH_TESTCASE_EXECUTIONS_PAYLOAD,
193
+ ...payload
194
+ };
195
+ if (typeof body.tcid !== "number") {
196
+ throw new Error(
197
+ "[fetchTestCaseExecutions] Missing or invalid required parameter: 'tcid'."
198
+ );
199
+ }
200
+ return qmetryRequest({
201
+ method: "POST",
202
+ path: QMETRY_PATHS.TESTCASE.GET_TC_EXECUTIONS,
203
+ token,
204
+ project: resolvedProject,
205
+ baseUrl: resolvedBaseUrl,
206
+ body
207
+ });
192
208
  }
193
- /**
194
- * Links a requirement to a test case.
195
- * @throws If `tcID` or `tcVersionID` or `rqVersionIds` are missing/invalid.
196
- */
197
- export async function linkRequirementToTestCase(token, baseUrl, project, payload) {
198
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
199
- const body = {
200
- ...DEFAULT_LINKED_REQUIREMENT_TO_TESTCASE_PAYLOAD,
201
- ...payload,
202
- };
203
- if (typeof body.tcID !== "string") {
204
- throw new Error("[linkRequirementToTestCase] Missing or invalid required parameter: 'tcID'.");
205
- }
206
- if (typeof body.tcVersionId !== "number") {
207
- throw new Error("[linkRequirementToTestCase] Missing or invalid required parameter: 'tcVersionId'.");
208
- }
209
- if (typeof body.rqVersionIds !== "string") {
210
- throw new Error("[linkRequirementToTestCase] Missing or invalid required parameter: 'rqVersionIds'.");
211
- }
212
- return qmetryRequest({
213
- method: "PUT",
214
- path: QMETRY_PATHS.TESTCASE.LINKED_RQ_TO_TC,
215
- token,
216
- project: resolvedProject,
217
- baseUrl: resolvedBaseUrl,
218
- body,
219
- });
209
+ async function linkRequirementToTestCase(token, baseUrl, project, payload) {
210
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
211
+ baseUrl,
212
+ project
213
+ );
214
+ const body = {
215
+ ...DEFAULT_LINKED_REQUIREMENT_TO_TESTCASE_PAYLOAD,
216
+ ...payload
217
+ };
218
+ if (typeof body.tcID !== "string") {
219
+ throw new Error(
220
+ "[linkRequirementToTestCase] Missing or invalid required parameter: 'tcID'."
221
+ );
222
+ }
223
+ if (typeof body.tcVersionId !== "number") {
224
+ throw new Error(
225
+ "[linkRequirementToTestCase] Missing or invalid required parameter: 'tcVersionId'."
226
+ );
227
+ }
228
+ if (typeof body.rqVersionIds !== "string") {
229
+ throw new Error(
230
+ "[linkRequirementToTestCase] Missing or invalid required parameter: 'rqVersionIds'."
231
+ );
232
+ }
233
+ return qmetryRequest({
234
+ method: "PUT",
235
+ path: QMETRY_PATHS.TESTCASE.LINKED_RQ_TO_TC,
236
+ token,
237
+ project: resolvedProject,
238
+ baseUrl: resolvedBaseUrl,
239
+ body
240
+ });
220
241
  }
242
+ export {
243
+ createTestCases,
244
+ fetchTestCaseDetails,
245
+ fetchTestCaseExecutions,
246
+ fetchTestCaseSteps,
247
+ fetchTestCaseVersionDetails,
248
+ fetchTestCases,
249
+ fetchTestCasesLinkedToRequirement,
250
+ linkRequirementToTestCase,
251
+ updateTestCase
252
+ };