@smartbear/mcp 0.12.1 → 0.13.2

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,123 +1,141 @@
1
1
  import { QMETRY_PATHS } from "../config/rest-endpoints.js";
2
- import { DEFAULT_CREATE_ISSUE_PAYLOAD, DEFAULT_FETCH_ISSUES_LINKED_TO_TESTCASE_PAYLOAD, DEFAULT_FETCH_ISSUES_PAYLOAD, DEFAULT_LINK_ISSUES_TO_TESTCASE_RUN_PAYLOAD, DEFAULT_UPDATE_ISSUE_PAYLOAD, } from "../types/issues.js";
2
+ import { DEFAULT_LINK_ISSUES_TO_TESTCASE_RUN_PAYLOAD, DEFAULT_FETCH_ISSUES_PAYLOAD, DEFAULT_UPDATE_ISSUE_PAYLOAD, DEFAULT_CREATE_ISSUE_PAYLOAD, DEFAULT_FETCH_ISSUES_LINKED_TO_TESTCASE_PAYLOAD } from "../types/issues.js";
3
3
  import { qmetryRequest } from "./api/client-api.js";
4
4
  import { resolveDefaults } from "./utils.js";
5
- /**
6
- * Create Defect/Issue.
7
- * @throws If `issueType` or `issuePriority` or `summary` are missing/invalid.
8
- */
9
- export async function createIssue(token, baseUrl, project, payload) {
10
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
11
- const body = {
12
- ...DEFAULT_CREATE_ISSUE_PAYLOAD,
13
- ...payload,
14
- };
15
- if (typeof body.issueType !== "number") {
16
- throw new Error("[createIssue] Missing or invalid required parameter: 'issueType'.");
17
- }
18
- if (typeof body.issuePriority !== "number") {
19
- throw new Error("[createIssue] Missing or invalid required parameter: 'issuePriority'.");
20
- }
21
- if (typeof body.summary !== "string") {
22
- throw new Error("[createIssue] Missing or invalid required parameter: 'summary'.");
23
- }
24
- return qmetryRequest({
25
- method: "POST",
26
- path: QMETRY_PATHS.ISSUES.CREATE_UPDATE_ISSUE,
27
- token,
28
- project: resolvedProject,
29
- baseUrl: resolvedBaseUrl,
30
- body,
31
- });
5
+ async function createIssue(token, baseUrl, project, payload) {
6
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
7
+ baseUrl,
8
+ project
9
+ );
10
+ const body = {
11
+ ...DEFAULT_CREATE_ISSUE_PAYLOAD,
12
+ ...payload
13
+ };
14
+ if (typeof body.issueType !== "number") {
15
+ throw new Error(
16
+ "[createIssue] Missing or invalid required parameter: 'issueType'."
17
+ );
18
+ }
19
+ if (typeof body.issuePriority !== "number") {
20
+ throw new Error(
21
+ "[createIssue] Missing or invalid required parameter: 'issuePriority'."
22
+ );
23
+ }
24
+ if (typeof body.summary !== "string") {
25
+ throw new Error(
26
+ "[createIssue] Missing or invalid required parameter: 'summary'."
27
+ );
28
+ }
29
+ return qmetryRequest({
30
+ method: "POST",
31
+ path: QMETRY_PATHS.ISSUES.CREATE_UPDATE_ISSUE,
32
+ token,
33
+ project: resolvedProject,
34
+ baseUrl: resolvedBaseUrl,
35
+ body
36
+ });
32
37
  }
33
- /**
34
- * Update Defect/Issue.
35
- * @throws If `DefectId` is missing/invalid.
36
- */
37
- export async function updateIssue(token, baseUrl, project, payload) {
38
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
39
- const body = {
40
- ...DEFAULT_UPDATE_ISSUE_PAYLOAD,
41
- ...payload,
42
- };
43
- if (typeof body.DefectId !== "number") {
44
- throw new Error("[updateIssue] Missing or invalid required parameter: 'DefectId'.");
45
- }
46
- return qmetryRequest({
47
- method: "PUT",
48
- path: QMETRY_PATHS.ISSUES.CREATE_UPDATE_ISSUE,
49
- token,
50
- project: resolvedProject,
51
- baseUrl: resolvedBaseUrl,
52
- body,
53
- });
38
+ async function updateIssue(token, baseUrl, project, payload) {
39
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
40
+ baseUrl,
41
+ project
42
+ );
43
+ const body = {
44
+ ...DEFAULT_UPDATE_ISSUE_PAYLOAD,
45
+ ...payload
46
+ };
47
+ if (typeof body.DefectId !== "number") {
48
+ throw new Error(
49
+ "[updateIssue] Missing or invalid required parameter: 'DefectId'."
50
+ );
51
+ }
52
+ return qmetryRequest({
53
+ method: "PUT",
54
+ path: QMETRY_PATHS.ISSUES.CREATE_UPDATE_ISSUE,
55
+ token,
56
+ project: resolvedProject,
57
+ baseUrl: resolvedBaseUrl,
58
+ body
59
+ });
54
60
  }
55
- /**
56
- * Fetches a list of test suites.
57
- * @throws If `viewId` or `folderPath` are missing/invalid.
58
- */
59
- export async function fetchIssues(token, baseUrl, project, payload) {
60
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
61
- const body = {
62
- ...DEFAULT_FETCH_ISSUES_PAYLOAD,
63
- ...payload,
64
- };
65
- if (typeof body.viewId !== "number") {
66
- throw new Error("[fetchIssues] Missing or invalid required parameter: 'viewId'.");
67
- }
68
- return qmetryRequest({
69
- method: "POST",
70
- path: QMETRY_PATHS.ISSUES.GET_ISSUES_LIST,
71
- token,
72
- project: resolvedProject,
73
- baseUrl: resolvedBaseUrl,
74
- body,
75
- });
61
+ async function fetchIssues(token, baseUrl, project, payload) {
62
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
63
+ baseUrl,
64
+ project
65
+ );
66
+ const body = {
67
+ ...DEFAULT_FETCH_ISSUES_PAYLOAD,
68
+ ...payload
69
+ };
70
+ if (typeof body.viewId !== "number") {
71
+ throw new Error(
72
+ "[fetchIssues] Missing or invalid required parameter: 'viewId'."
73
+ );
74
+ }
75
+ return qmetryRequest({
76
+ method: "POST",
77
+ path: QMETRY_PATHS.ISSUES.GET_ISSUES_LIST,
78
+ token,
79
+ project: resolvedProject,
80
+ baseUrl: resolvedBaseUrl,
81
+ body
82
+ });
76
83
  }
77
- /**
78
- * Fetches issues linked to a specific test case.
79
- * @throws If `tcID` is missing/invalid.
80
- */
81
- export async function fetchIssuesLinkedToTestCase(token, baseUrl, project, payload) {
82
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
83
- const body = {
84
- ...DEFAULT_FETCH_ISSUES_LINKED_TO_TESTCASE_PAYLOAD,
85
- ...payload,
86
- };
87
- if (typeof body.tcID !== "number") {
88
- throw new Error("[fetchIssuesLinkedToTestCase] Missing or invalid required parameter: 'tcID'.");
89
- }
90
- return qmetryRequest({
91
- method: "POST",
92
- path: QMETRY_PATHS.ISSUES.GET_ISSUES_LINKED_TO_TC,
93
- token,
94
- project: resolvedProject,
95
- baseUrl: resolvedBaseUrl,
96
- body,
97
- });
84
+ async function fetchIssuesLinkedToTestCase(token, baseUrl, project, payload) {
85
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
86
+ baseUrl,
87
+ project
88
+ );
89
+ const body = {
90
+ ...DEFAULT_FETCH_ISSUES_LINKED_TO_TESTCASE_PAYLOAD,
91
+ ...payload
92
+ };
93
+ if (typeof body.tcID !== "number") {
94
+ throw new Error(
95
+ "[fetchIssuesLinkedToTestCase] Missing or invalid required parameter: 'tcID'."
96
+ );
97
+ }
98
+ return qmetryRequest({
99
+ method: "POST",
100
+ path: QMETRY_PATHS.ISSUES.GET_ISSUES_LINKED_TO_TC,
101
+ token,
102
+ project: resolvedProject,
103
+ baseUrl: resolvedBaseUrl,
104
+ body
105
+ });
98
106
  }
99
- /**
100
- * Link Issues to Testcase Run.
101
- * @throws If issueIds or tcrId are missing/invalid.
102
- */
103
- export async function linkIssuesToTestcaseRun(token, baseUrl, project, payload) {
104
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
105
- const body = {
106
- ...DEFAULT_LINK_ISSUES_TO_TESTCASE_RUN_PAYLOAD,
107
- ...payload,
108
- };
109
- if (!Array.isArray(body.issueIds) || body.issueIds.length === 0) {
110
- throw new Error("[linkIssuesToTestcaseRun] Missing or invalid required parameter: 'issueIds'.");
111
- }
112
- if (typeof body.tcrId !== "number") {
113
- throw new Error("[linkIssuesToTestcaseRun] Missing or invalid required parameter: 'tcrId'.");
114
- }
115
- return qmetryRequest({
116
- method: "PUT",
117
- path: QMETRY_PATHS.ISSUES.LINK_ISSUES_TO_TESTCASE_RUN,
118
- token,
119
- project: resolvedProject,
120
- baseUrl: resolvedBaseUrl,
121
- body,
122
- });
107
+ async function linkIssuesToTestcaseRun(token, baseUrl, project, payload) {
108
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
109
+ baseUrl,
110
+ project
111
+ );
112
+ const body = {
113
+ ...DEFAULT_LINK_ISSUES_TO_TESTCASE_RUN_PAYLOAD,
114
+ ...payload
115
+ };
116
+ if (!Array.isArray(body.issueIds) || body.issueIds.length === 0) {
117
+ throw new Error(
118
+ "[linkIssuesToTestcaseRun] Missing or invalid required parameter: 'issueIds'."
119
+ );
120
+ }
121
+ if (typeof body.tcrId !== "number") {
122
+ throw new Error(
123
+ "[linkIssuesToTestcaseRun] Missing or invalid required parameter: 'tcrId'."
124
+ );
125
+ }
126
+ return qmetryRequest({
127
+ method: "PUT",
128
+ path: QMETRY_PATHS.ISSUES.LINK_ISSUES_TO_TESTCASE_RUN,
129
+ token,
130
+ project: resolvedProject,
131
+ baseUrl: resolvedBaseUrl,
132
+ body
133
+ });
123
134
  }
135
+ export {
136
+ createIssue,
137
+ fetchIssues,
138
+ fetchIssuesLinkedToTestCase,
139
+ linkIssuesToTestcaseRun,
140
+ updateIssue
141
+ };
@@ -1,186 +1,165 @@
1
1
  import { QMETRY_DEFAULTS } from "../config/constants.js";
2
2
  import { QMETRY_PATHS } from "../config/rest-endpoints.js";
3
- import { DEFAULT_CREATE_CYCLE_PAYLOAD, DEFAULT_CREATE_RELEASE_PAYLOAD, DEFAULT_FETCH_BUILD_PAYLOAD, DEFAULT_FETCH_PLATFORMS_PAYLOAD, DEFAULT_FETCH_PROJECTS_PAYLOAD, } from "../types/project.js";
3
+ import { DEFAULT_CREATE_CYCLE_PAYLOAD, DEFAULT_CREATE_RELEASE_PAYLOAD, DEFAULT_FETCH_PROJECTS_PAYLOAD, DEFAULT_FETCH_BUILD_PAYLOAD, DEFAULT_FETCH_PLATFORMS_PAYLOAD } from "../types/project.js";
4
4
  import { qmetryRequest } from "./api/client-api.js";
5
5
  import { resolveDefaults } from "./utils.js";
6
- /**
7
- * Retrieves project information from QMetry
8
- *
9
- * This function serves dual purpose:
10
- * 1. SET_PROJECT_INFO - Sets/switches the current project context
11
- * 2. FETCH_PROJECT_INFO - Retrieves project details and configuration
12
- *
13
- * Both operations use the same API endpoint as QMetry handles project context
14
- * switching and information retrieval through the same GET request.
15
- *
16
- * @param token - QMetry API authentication token
17
- * @param baseUrl - QMetry instance base URL (defaults to configured URL)
18
- * @param project - Project key to retrieve info for (defaults to configured project)
19
- * @returns Promise resolving to project information including viewIds, folders, and configuration
20
- */
21
- export async function getProjectInfo(token, baseUrl, project) {
22
- return qmetryRequest({
23
- method: "GET",
24
- path: QMETRY_PATHS.PROJECT.GET_INFO,
25
- token,
26
- baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
27
- project: project || QMETRY_DEFAULTS.PROJECT_KEY,
28
- });
6
+ async function getProjectInfo(token, baseUrl, project) {
7
+ return qmetryRequest({
8
+ method: "GET",
9
+ path: QMETRY_PATHS.PROJECT.GET_INFO,
10
+ token,
11
+ baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
12
+ project: project || QMETRY_DEFAULTS.PROJECT_KEY
13
+ });
29
14
  }
30
- /**
31
- * Fetches a List of projects.
32
- */
33
- export async function getProjects(token, baseUrl, project, payload) {
34
- const body = {
35
- ...DEFAULT_FETCH_PROJECTS_PAYLOAD,
36
- ...payload,
37
- };
38
- return qmetryRequest({
39
- method: "POST",
40
- path: QMETRY_PATHS.PROJECT.GET_PROJECTS,
41
- token,
42
- baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
43
- project: project || QMETRY_DEFAULTS.PROJECT_KEY,
44
- body,
45
- });
15
+ async function getProjects(token, baseUrl, project, payload) {
16
+ const body = {
17
+ ...DEFAULT_FETCH_PROJECTS_PAYLOAD,
18
+ ...payload
19
+ };
20
+ return qmetryRequest({
21
+ method: "POST",
22
+ path: QMETRY_PATHS.PROJECT.GET_PROJECTS,
23
+ token,
24
+ baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
25
+ project: project || QMETRY_DEFAULTS.PROJECT_KEY,
26
+ body
27
+ });
46
28
  }
47
- export async function getReleasesCycles(token, baseUrl, project, payload = {}) {
48
- let showArchiveValue;
49
- if (payload.showArchive !== undefined) {
50
- showArchiveValue = payload.showArchive;
51
- }
52
- else {
53
- showArchiveValue = false;
54
- }
55
- const body = {
56
- showArchive: showArchiveValue,
57
- };
58
- return qmetryRequest({
59
- method: "POST",
60
- path: QMETRY_PATHS.PROJECT.GET_RELEASES_CYCLES,
61
- token,
62
- baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
63
- project: project || QMETRY_DEFAULTS.PROJECT_KEY,
64
- body,
65
- });
29
+ async function getReleasesCycles(token, baseUrl, project, payload = {}) {
30
+ let showArchiveValue;
31
+ if (payload.showArchive !== void 0) {
32
+ showArchiveValue = payload.showArchive;
33
+ } else {
34
+ showArchiveValue = false;
35
+ }
36
+ const body = {
37
+ showArchive: showArchiveValue
38
+ };
39
+ return qmetryRequest({
40
+ method: "POST",
41
+ path: QMETRY_PATHS.PROJECT.GET_RELEASES_CYCLES,
42
+ token,
43
+ baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
44
+ project: project || QMETRY_DEFAULTS.PROJECT_KEY,
45
+ body
46
+ });
66
47
  }
67
- /**
68
- * Fetches a List of Builds of the current project.
69
- */
70
- export async function getBuilds(token, baseUrl, project, payload) {
71
- const body = {
72
- ...DEFAULT_FETCH_BUILD_PAYLOAD,
73
- ...payload,
74
- };
75
- return qmetryRequest({
76
- method: "POST",
77
- path: QMETRY_PATHS.PROJECT.GET_BUILD,
78
- token,
79
- baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
80
- project: project || QMETRY_DEFAULTS.PROJECT_KEY,
81
- body,
82
- });
48
+ async function getBuilds(token, baseUrl, project, payload) {
49
+ const body = {
50
+ ...DEFAULT_FETCH_BUILD_PAYLOAD,
51
+ ...payload
52
+ };
53
+ return qmetryRequest({
54
+ method: "POST",
55
+ path: QMETRY_PATHS.PROJECT.GET_BUILD,
56
+ token,
57
+ baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
58
+ project: project || QMETRY_DEFAULTS.PROJECT_KEY,
59
+ body
60
+ });
83
61
  }
84
- /**
85
- * Fetches platforms from the current QMetry project
86
- *
87
- */
88
- export async function getPlatforms(token, baseUrl, project, payload) {
89
- const body = {
90
- ...DEFAULT_FETCH_PLATFORMS_PAYLOAD,
91
- ...payload,
92
- };
93
- return qmetryRequest({
94
- method: "POST",
95
- path: QMETRY_PATHS.PROJECT.GET_PLATFORMS,
96
- token,
97
- baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
98
- project: project || QMETRY_DEFAULTS.PROJECT_KEY,
99
- body,
100
- });
62
+ async function getPlatforms(token, baseUrl, project, payload) {
63
+ const body = {
64
+ ...DEFAULT_FETCH_PLATFORMS_PAYLOAD,
65
+ ...payload
66
+ };
67
+ return qmetryRequest({
68
+ method: "POST",
69
+ path: QMETRY_PATHS.PROJECT.GET_PLATFORMS,
70
+ token,
71
+ baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
72
+ project: project || QMETRY_DEFAULTS.PROJECT_KEY,
73
+ body
74
+ });
101
75
  }
102
- /**
103
- * Creates a new release in QMetry with optional cycle
104
- *
105
- * @param token - QMetry API authentication token
106
- * @param baseUrl - QMetry instance base URL
107
- * @param project - Project key
108
- * @param payload - Release and cycle data
109
- * @returns Promise resolving to the created release information
110
- */
111
- export async function createRelease(token, baseUrl, project, payload) {
112
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
113
- const body = {
114
- ...DEFAULT_CREATE_RELEASE_PAYLOAD,
115
- ...payload,
116
- };
117
- if (typeof body.release.name !== "string") {
118
- throw new Error("[createRelease] Missing or invalid required parameter: 'release.name'.");
119
- }
120
- if (body.cycle && typeof body.cycle.name !== "string") {
121
- throw new Error("[createRelease] Missing or invalid required parameter: 'cycle.name'.");
122
- }
123
- return qmetryRequest({
124
- method: "POST",
125
- path: QMETRY_PATHS.PROJECT.CREATE_RELEASE,
126
- token,
127
- project: resolvedProject,
128
- baseUrl: resolvedBaseUrl,
129
- body,
130
- });
76
+ async function createRelease(token, baseUrl, project, payload) {
77
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
78
+ baseUrl,
79
+ project
80
+ );
81
+ const body = {
82
+ ...DEFAULT_CREATE_RELEASE_PAYLOAD,
83
+ ...payload
84
+ };
85
+ if (typeof body.release.name !== "string") {
86
+ throw new Error(
87
+ "[createRelease] Missing or invalid required parameter: 'release.name'."
88
+ );
89
+ }
90
+ if (body.cycle && typeof body.cycle.name !== "string") {
91
+ throw new Error(
92
+ "[createRelease] Missing or invalid required parameter: 'cycle.name'."
93
+ );
94
+ }
95
+ return qmetryRequest({
96
+ method: "POST",
97
+ path: QMETRY_PATHS.PROJECT.CREATE_RELEASE,
98
+ token,
99
+ project: resolvedProject,
100
+ baseUrl: resolvedBaseUrl,
101
+ body
102
+ });
131
103
  }
132
- /**
133
- * Creates a new cycle within an existing release in QMetry
134
- *
135
- * @param token - QMetry API authentication token
136
- * @param baseUrl - QMetry instance base URL
137
- * @param project - Project key
138
- * @param payload - Cycle data including releaseID
139
- * @returns Promise resolving to the created cycle information
140
- */
141
- export async function createCycle(token, baseUrl, project, payload) {
142
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
143
- const body = {
144
- ...DEFAULT_CREATE_CYCLE_PAYLOAD.cycle,
145
- ...payload,
146
- };
147
- if (typeof body.cycle.name !== "string") {
148
- throw new Error("[createCycle] Missing or invalid required parameter: 'cycle.name'.");
149
- }
150
- if (typeof body.cycle.releaseID !== "number") {
151
- throw new Error("[createCycle] Missing or invalid required parameter: 'cycle.releaseID'.");
152
- }
153
- return qmetryRequest({
154
- method: "POST",
155
- path: QMETRY_PATHS.PROJECT.CREATE_CYCLE,
156
- token,
157
- project: resolvedProject,
158
- baseUrl: resolvedBaseUrl,
159
- body,
160
- });
104
+ async function createCycle(token, baseUrl, project, payload) {
105
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
106
+ baseUrl,
107
+ project
108
+ );
109
+ const body = {
110
+ ...DEFAULT_CREATE_CYCLE_PAYLOAD.cycle,
111
+ ...payload
112
+ };
113
+ if (typeof body.cycle.name !== "string") {
114
+ throw new Error(
115
+ "[createCycle] Missing or invalid required parameter: 'cycle.name'."
116
+ );
117
+ }
118
+ if (typeof body.cycle.releaseID !== "number") {
119
+ throw new Error(
120
+ "[createCycle] Missing or invalid required parameter: 'cycle.releaseID'."
121
+ );
122
+ }
123
+ return qmetryRequest({
124
+ method: "POST",
125
+ path: QMETRY_PATHS.PROJECT.CREATE_CYCLE,
126
+ token,
127
+ project: resolvedProject,
128
+ baseUrl: resolvedBaseUrl,
129
+ body
130
+ });
161
131
  }
162
- /**
163
- * Updates an existing cycle in QMetry
164
- * @param token - QMetry API token
165
- * @param baseUrl - QMetry base URL
166
- * @param project - Project key
167
- * @param payload - Cycle data including buildID and releaseID for identification
168
- * @returns Promise resolving to the updated cycle information
169
- */
170
- export async function updateCycle(token, baseUrl, project, payload) {
171
- const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
172
- if (typeof payload.cycle.buildID !== "number") {
173
- throw new Error("[updateCycle] Missing or invalid required parameter: 'cycle.buildID'.");
174
- }
175
- if (typeof payload.cycle.releaseID !== "number") {
176
- throw new Error("[updateCycle] Missing or invalid required parameter: 'cycle.releaseID'.");
177
- }
178
- return qmetryRequest({
179
- method: "PUT",
180
- path: QMETRY_PATHS.PROJECT.UPDATE_CYCLE,
181
- token,
182
- project: resolvedProject,
183
- baseUrl: resolvedBaseUrl,
184
- body: payload,
185
- });
132
+ async function updateCycle(token, baseUrl, project, payload) {
133
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
134
+ baseUrl,
135
+ project
136
+ );
137
+ if (typeof payload.cycle.buildID !== "number") {
138
+ throw new Error(
139
+ "[updateCycle] Missing or invalid required parameter: 'cycle.buildID'."
140
+ );
141
+ }
142
+ if (typeof payload.cycle.releaseID !== "number") {
143
+ throw new Error(
144
+ "[updateCycle] Missing or invalid required parameter: 'cycle.releaseID'."
145
+ );
146
+ }
147
+ return qmetryRequest({
148
+ method: "PUT",
149
+ path: QMETRY_PATHS.PROJECT.UPDATE_CYCLE,
150
+ token,
151
+ project: resolvedProject,
152
+ baseUrl: resolvedBaseUrl,
153
+ body: payload
154
+ });
186
155
  }
156
+ export {
157
+ createCycle,
158
+ createRelease,
159
+ getBuilds,
160
+ getPlatforms,
161
+ getProjectInfo,
162
+ getProjects,
163
+ getReleasesCycles,
164
+ updateCycle
165
+ };