@smartbear/mcp 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +19 -2
  2. package/dist/api-hub/client/api.js +198 -23
  3. package/dist/api-hub/client/registry-types.js +22 -0
  4. package/dist/api-hub/client/tools.js +19 -1
  5. package/dist/api-hub/client.js +9 -0
  6. package/dist/bugsnag/client/api/CurrentUser.js +13 -50
  7. package/dist/bugsnag/client/api/Error.js +30 -155
  8. package/dist/bugsnag/client/api/Project.js +56 -124
  9. package/dist/bugsnag/client/api/api.js +3743 -0
  10. package/dist/bugsnag/client/api/base.js +107 -32
  11. package/dist/bugsnag/client/api/configuration.js +26 -0
  12. package/dist/bugsnag/client/api/index.js +2 -0
  13. package/dist/bugsnag/client/filters.js +28 -0
  14. package/dist/bugsnag/client.js +157 -325
  15. package/dist/common/server.js +29 -4
  16. package/dist/common/types.js +6 -1
  17. package/dist/index.js +8 -1
  18. package/dist/pactflow/client/prompt-utils.js +2 -1
  19. package/dist/pactflow/client/tools.js +9 -9
  20. package/dist/pactflow/client/utils.js +5 -4
  21. package/dist/pactflow/client.js +16 -14
  22. package/dist/qmetry/client/api/client-api.js +21 -16
  23. package/dist/qmetry/client/api/error-handler.js +329 -0
  24. package/dist/qmetry/client/auto-resolve.js +74 -0
  25. package/dist/qmetry/client/handlers.js +19 -2
  26. package/dist/qmetry/client/issues.js +26 -0
  27. package/dist/qmetry/client/project.js +56 -0
  28. package/dist/qmetry/client/requirement.js +76 -0
  29. package/dist/qmetry/client/testcase.js +46 -8
  30. package/dist/qmetry/client/testsuite.js +117 -0
  31. package/dist/qmetry/client/tools.js +1455 -4
  32. package/dist/qmetry/client/utils.js +16 -0
  33. package/dist/qmetry/client.js +19 -16
  34. package/dist/qmetry/config/constants.js +14 -0
  35. package/dist/qmetry/config/rest-endpoints.js +20 -0
  36. package/dist/qmetry/types/common.js +313 -8
  37. package/dist/qmetry/types/issues.js +6 -0
  38. package/dist/qmetry/types/project.js +10 -0
  39. package/dist/qmetry/types/requirements.js +19 -0
  40. package/dist/qmetry/types/testcase.js +14 -0
  41. package/dist/qmetry/types/testsuite.js +26 -0
  42. package/dist/reflect/client.js +7 -6
  43. package/dist/zephyr/client.js +16 -0
  44. package/dist/zephyr/common/api-client.js +27 -0
  45. package/dist/zephyr/common/auth-service.js +15 -0
  46. package/dist/zephyr/common/types.js +35 -0
  47. package/dist/zephyr/tool/project/get-projects.js +54 -0
  48. package/dist/zephyr/tool/zephyr-tool.js +1 -0
  49. package/package.json +3 -2
  50. package/dist/bugsnag/client/api/filters.js +0 -167
  51. package/dist/bugsnag/client/configuration.js +0 -10
  52. package/dist/bugsnag/client/index.js +0 -2
@@ -1,189 +1,64 @@
1
- import { BaseAPI } from "./base.js";
2
- import { toQueryString } from "./filters.js";
3
- export const ErrorOperations = [
4
- "override_severity",
5
- "assign",
6
- "create_issue",
7
- "link_issue",
8
- "unlink_issue",
9
- "open",
10
- "snooze",
11
- "fix",
12
- "ignore",
13
- "delete",
14
- "discard",
15
- "undiscard",
16
- ];
17
- export const ReopenConditions = [
18
- "occurs_after",
19
- "n_occurrences_in_m_hours",
20
- "n_additional_occurrences",
21
- "n_additional_users",
22
- ];
23
- // --- API Class ---
1
+ import { ErrorsApiFetchParamCreator, } from "./api.js";
2
+ import { BaseAPI, getQueryParams } from "./base.js";
24
3
  export class ErrorAPI extends BaseAPI {
25
4
  static filterFields = ["url", "project_url", "events_url"];
26
- constructor(configuration) {
27
- super(configuration, ErrorAPI.filterFields);
28
- }
29
5
  /**
30
6
  * View an Error on a Project
31
7
  * GET /projects/{project_id}/errors/{error_id}
32
8
  */
33
- async viewErrorOnProject(projectId, errorId, options = {}) {
34
- const params = new URLSearchParams();
35
- for (const [key, value] of Object.entries(options)) {
36
- if (value !== undefined)
37
- params.append(key, String(value));
38
- }
39
- const url = params.toString()
40
- ? `/projects/${projectId}/errors/${errorId}?${params}`
41
- : `/projects/${projectId}/errors/${errorId}`;
42
- return (await this.request({
43
- method: "GET",
44
- url,
45
- }));
46
- }
47
- /**
48
- * View the latest Event on an Error
49
- * GET /errors/{error_id}/latest_event
50
- */
51
- async viewLatestEventOnError(errorId, options = {}) {
52
- const params = new URLSearchParams();
53
- for (const [key, value] of Object.entries(options)) {
54
- if (value !== undefined)
55
- params.append(key, String(value));
56
- }
57
- const url = params.toString()
58
- ? `/errors/${errorId}/latest_event?${params}`
59
- : `/errors/${errorId}/latest_event`;
60
- return (await this.request({
61
- method: "GET",
62
- url,
63
- }));
9
+ async viewErrorOnProject(projectId, errorId) {
10
+ const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).viewErrorOnProject(projectId, errorId);
11
+ return await this.requestObject(localVarFetchArgs.url, localVarFetchArgs.options);
64
12
  }
65
13
  /**
66
- * List the Events on a Project
14
+ * Get the latest Event in a Project, with optional filters
67
15
  * GET /projects/{project_id}/events
68
16
  */
69
- async listEventsOnProject(projectId, queryString = "") {
70
- const url = `/projects/${projectId}/events${queryString}`;
71
- return await this.request({
72
- method: "GET",
73
- url,
74
- });
17
+ async listEventsOnProject(projectId, base, sort, direction, perPage, filters, fullReports) {
18
+ const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).listEventsOnProject(projectId, base ?? undefined, sort, direction, perPage, undefined, fullReports, { query: filters });
19
+ return await this.requestArray(localVarFetchArgs.url, localVarFetchArgs.options, false);
75
20
  }
76
21
  /**
77
22
  * View an Event by ID
78
23
  * GET /projects/{project_id}/events/{event_id}
79
24
  */
80
- async viewEventById(projectId, eventId, options = {}) {
81
- const params = new URLSearchParams();
82
- for (const [key, value] of Object.entries(options)) {
83
- if (value !== undefined)
84
- params.append(key, String(value));
85
- }
86
- const url = params.toString()
87
- ? `/projects/${projectId}/events/${eventId}?${params}`
88
- : `/projects/${projectId}/events/${eventId}`;
89
- return (await this.request({
90
- method: "GET",
91
- url,
92
- }));
25
+ async viewEventById(projectId, eventId) {
26
+ const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).viewEventById(projectId, eventId);
27
+ return await this.requestObject(localVarFetchArgs.url, localVarFetchArgs.options);
93
28
  }
94
29
  /**
95
30
  * List the Errors on a Project
96
31
  * GET /projects/{project_id}/errors
97
32
  */
98
- async listProjectErrors(projectId, options = {}) {
99
- let url = `/projects/${projectId}/errors`;
100
- // Next links need to be used as-is to ensure results are consistent, so only the page size can be modified
101
- if (options.next !== undefined) {
102
- const nextUrl = new URL(options.next);
103
- if (options.per_page !== undefined) {
104
- nextUrl.searchParams.set("per_page", options.per_page.toString());
33
+ async listProjectErrors(projectId, base, sort, direction, perPage, filters, nextUrl) {
34
+ const options = getQueryParams(nextUrl, nextUrl ? undefined : filters);
35
+ if (nextUrl) {
36
+ if (perPage) {
37
+ // Next links need to be used as-is to ensure results are consistent, so only the page size can be modified
38
+ // the others will get overridden
39
+ options.query.per_page = perPage.toString();
105
40
  }
106
- url = nextUrl.toString();
41
+ direction = undefined;
42
+ sort = undefined;
43
+ base = undefined;
107
44
  }
108
- else {
109
- const params = new URLSearchParams();
110
- // Add filter parameters
111
- if (options.filters) {
112
- const filterParams = new URLSearchParams(toQueryString(options.filters));
113
- filterParams.forEach((value, key) => {
114
- params.append(key, value);
115
- });
116
- }
117
- // Add pagination and sorting parameters
118
- if (options.base !== undefined) {
119
- params.append("base", options.base);
120
- }
121
- if (options.sort !== undefined) {
122
- params.append("sort", options.sort);
123
- }
124
- if (options.direction !== undefined) {
125
- params.append("direction", options.direction);
126
- }
127
- if (options.per_page !== undefined) {
128
- params.append("per_page", options.per_page.toString());
129
- }
130
- if (params.size > 0) {
131
- url = `/projects/${projectId}/errors?${params}`;
132
- }
133
- }
134
- return (await this.request({
135
- method: "GET",
136
- url,
137
- }));
45
+ const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).listProjectErrors(projectId, base ?? undefined, sort, direction, perPage, undefined, options);
46
+ return await this.requestArray(localVarFetchArgs.url, localVarFetchArgs.options, false);
138
47
  }
139
48
  /**
140
49
  * Update an Error on a Project
141
50
  * PATCH /projects/{project_id}/errors/{error_id}
142
51
  */
143
- async updateErrorOnProject(projectId, errorId, data, options = {}) {
144
- const params = new URLSearchParams();
145
- for (const [key, value] of Object.entries(options)) {
146
- if (value !== undefined)
147
- params.append(key, String(value));
148
- }
149
- const url = params.toString()
150
- ? `/projects/${projectId}/errors/${errorId}?${params}`
151
- : `/projects/${projectId}/errors/${errorId}`;
152
- return (await this.request({
153
- method: "PATCH",
154
- url,
155
- body: data,
156
- }));
52
+ async updateErrorOnProject(projectId, errorId, body) {
53
+ const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).updateErrorOnProject(body, projectId, errorId);
54
+ return await this.requestObject(localVarFetchArgs.url, localVarFetchArgs.options);
157
55
  }
158
56
  /**
159
57
  * List Pivots on an Error
160
58
  * GET /projects/{project_id}/errors/{error_id}/pivots
161
59
  */
162
- async listErrorPivots(projectId, errorId, options = {}) {
163
- const params = new URLSearchParams();
164
- if (options.filters) {
165
- const filterParams = new URLSearchParams(toQueryString(options.filters));
166
- filterParams.forEach((value, key) => {
167
- params.append(key, value);
168
- });
169
- }
170
- if (options.summary_size !== undefined) {
171
- params.append("summary_size", options.summary_size.toString());
172
- }
173
- if (options.pivots && options.pivots.length > 0) {
174
- options.pivots.forEach((pivot) => {
175
- params.append("pivots[]", pivot);
176
- });
177
- }
178
- if (options.per_page !== undefined) {
179
- params.append("per_page", options.per_page.toString());
180
- }
181
- const url = params.toString()
182
- ? `/projects/${projectId}/errors/${errorId}/pivots?${params}`
183
- : `/projects/${projectId}/errors/${errorId}/pivots`;
184
- return await this.request({
185
- method: "GET",
186
- url,
187
- });
60
+ async getPivotValuesOnAnError(projectId, errorId, filters, summarySize, pivots, perPage) {
61
+ const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).listPivotsOnAnError(projectId, errorId, undefined, summarySize, pivots, perPage, { query: filters });
62
+ return await this.requestArray(localVarFetchArgs.url, localVarFetchArgs.options, false);
188
63
  }
189
64
  }
@@ -1,52 +1,47 @@
1
- import { BaseAPI, pickFields, pickFieldsFromArray, } from "./base.js";
2
- // --- API Class ---
1
+ import { ProjectsApiFetchParamCreator } from "./api.js";
2
+ import { BaseAPI, getQueryParams } from "./base.js";
3
3
  export class ProjectAPI extends BaseAPI {
4
- static filterFields = [
5
- "errors_url",
6
- "events_url",
7
- "url",
8
- "html_url",
4
+ static projectFields = [
5
+ "id",
6
+ "name",
7
+ "slug",
8
+ "apiKey",
9
+ "stabilityTargetType",
10
+ "targetStability",
11
+ "criticalStability",
9
12
  ];
10
13
  static eventFieldFields = [
11
14
  "custom",
12
- "display_id",
13
- "filter_options",
14
- "pivot_options",
15
+ "displayId",
16
+ "filterOptions",
17
+ "pivotOptions",
15
18
  ];
16
19
  static buildFields = [
17
20
  "id",
18
- "release_time",
19
- "app_version",
20
- "release_stage",
21
- "errors_introduced_count",
22
- "errors_seen_count",
23
- "total_sessions_count",
24
- "unhandled_sessions_count",
25
- "accumulative_daily_users_seen",
26
- "accumulative_daily_users_with_unhandled",
21
+ "releaseTime",
22
+ "appVersion",
23
+ "releaseStage",
24
+ "errorsIntroducedCount",
25
+ "errorsSeenCount",
26
+ "totalSessionsCount",
27
+ "unhandledSessionsCount",
28
+ "accumulativeDailyUsersSeen",
29
+ "accumulativeDailyUsersWithUnhandled",
27
30
  ];
28
31
  static releaseFields = [
29
32
  "id",
30
- "release_stage_name",
31
- "app_version",
32
- "first_released_at",
33
- "first_release_id",
34
- "releases_count",
33
+ "releaseStageName",
34
+ "appVersion",
35
+ "firstReleasedAt",
36
+ "firstReleaseId",
37
+ "releasesCount",
35
38
  "visible",
36
- "total_sessions_count",
37
- "unhandled_sessions_count",
38
- "sessions_count_in_last_24h",
39
- "accumulative_daily_users_seen",
40
- "accumulative_daily_users_with_unhandled",
41
- ];
42
- static stabilityFields = [
43
- "critical_stability",
44
- "target_stability",
45
- "stability_target_type",
39
+ "totalSessionsCount",
40
+ "unhandledSessionsCount",
41
+ "sessionsCountInLast24h",
42
+ "accumulativeDailyUsersSeen",
43
+ "accumulativeDailyUsersWithUnhandled",
46
44
  ];
47
- constructor(configuration) {
48
- super(configuration, ProjectAPI.filterFields);
49
- }
50
45
  /**
51
46
  * List the Event Fields for a Project
52
47
  * GET /projects/{project_id}/event_fields
@@ -54,78 +49,19 @@ export class ProjectAPI extends BaseAPI {
54
49
  * @returns A promise that resolves to the list of event fields
55
50
  */
56
51
  async listProjectEventFields(projectId) {
57
- const url = `/projects/${projectId}/event_fields`;
58
- const data = await this.request({
59
- method: "GET",
60
- url,
61
- });
62
- // Only return allowed fields
63
- return {
64
- ...data,
65
- body: pickFieldsFromArray(data.body || [], ProjectAPI.eventFieldFields),
66
- };
67
- }
68
- /**
69
- * Create a Project in an Organization
70
- * POST /organizations/{organization_id}/projects
71
- * @param organizationId The organization ID
72
- * @param data The project creation request body
73
- * @returns A promise that resolves to the created project
74
- */
75
- async createProject(organizationId, data) {
76
- const url = `/organizations/${organizationId}/projects`;
77
- return await this.request({
78
- method: "POST",
79
- url,
80
- body: data,
81
- });
82
- }
83
- /**
84
- * Retrieves the stability targets for a specific project.
85
- * GET /projects/{project_id} (with internal header)
86
- * @param projectId The ID of the project.
87
- * @returns A promise that resolves to the project's stability targets.
88
- */
89
- async getProjectStabilityTargets(projectId) {
90
- const url = `/projects/${projectId}`;
91
- const response = await this.request({
92
- method: "GET",
93
- url,
94
- });
95
- return pickFields(response.body || {}, ProjectAPI.stabilityFields);
96
- }
97
- /**
98
- * Lists builds for a specific project.
99
- * GET /projects/{project_id}/releases
100
- * @param projectId The ID of the project.
101
- * @param opts Options for listing releases, including filtering by release stage.
102
- * @returns A promise that resolves to an array of `ListReleasesResponse` objects.
103
- */
104
- async listBuilds(projectId, opts) {
105
- const url = opts.next_url ??
106
- `/projects/${projectId}/releases${opts.release_stage ? `?release_stage=${opts.release_stage}` : ""}`;
107
- const response = await this.request({
108
- method: "GET",
109
- url,
110
- });
111
- return {
112
- ...response,
113
- body: pickFieldsFromArray(response.body || [], ProjectAPI.buildFields),
114
- };
52
+ const localVarFetchArgs = ProjectsApiFetchParamCreator(this.configuration).listProjectEventFields(projectId);
53
+ return await this.requestArray(localVarFetchArgs.url, localVarFetchArgs.options, true, ProjectAPI.eventFieldFields);
115
54
  }
116
55
  /**
117
56
  * Retrieves a specific build from a project.
118
57
  * GET /projects/{project_id}/releases/{release_id}
119
58
  * @param projectId The ID of the project.
120
- * @param buildId The ID of the release to retrieve.
59
+ * @param releaseId The ID of the release to retrieve.
121
60
  * @returns A promise that resolves to the release data.
122
61
  */
123
- async getBuild(projectId, buildId) {
124
- const url = `/projects/${projectId}/releases/${buildId}`;
125
- return await this.request({
126
- method: "GET",
127
- url,
128
- });
62
+ async getProjectReleaseById(projectId, releaseId) {
63
+ const localVarFetchArgs = ProjectsApiFetchParamCreator(this.configuration).getProjectReleaseById(projectId, releaseId);
64
+ return await this.requestObject(localVarFetchArgs.url, localVarFetchArgs.options, ProjectAPI.buildFields);
129
65
  }
130
66
  /**
131
67
  * Lists releases for a specific project.
@@ -134,17 +70,19 @@ export class ProjectAPI extends BaseAPI {
134
70
  * @param opts Options for listing releases, including filtering by release stage and visibility.
135
71
  * @returns A promise that resolves to an array of `ReleaseSummaryResponse` objects.
136
72
  */
137
- async listReleases(projectId, opts) {
138
- const url = opts.next_url ??
139
- `/projects/${projectId}/release_groups?release_stage_name=${opts.release_stage_name}&visible_only=${opts.visible_only}&top_only=true`;
140
- const response = await this.request({
141
- method: "GET",
142
- url,
143
- });
144
- return {
145
- ...response,
146
- body: pickFieldsFromArray(response.body || [], ProjectAPI.releaseFields),
147
- };
73
+ async listProjectReleaseGroups(projectId, releaseStageName, topOnly, visibleOnly, perPage, nextUrl) {
74
+ const options = getQueryParams(nextUrl);
75
+ // Next links need to be used as-is to ensure results are consistent, so only the page size can be modified
76
+ // the others will get overridden
77
+ if (nextUrl) {
78
+ options.query.per_page = perPage ? perPage.toString() : undefined;
79
+ topOnly = undefined;
80
+ visibleOnly = undefined;
81
+ }
82
+ const localVarFetchArgs = ProjectsApiFetchParamCreator(this.configuration).listProjectReleaseGroups(projectId, releaseStageName, topOnly, visibleOnly, perPage, undefined, // pageToken passed in through options
83
+ options);
84
+ return await this.requestArray(localVarFetchArgs.url, localVarFetchArgs.options, false, // Paginate results
85
+ ProjectAPI.releaseFields);
148
86
  }
149
87
  /**
150
88
  * Retrieves a specific release by its ID.
@@ -152,12 +90,9 @@ export class ProjectAPI extends BaseAPI {
152
90
  * @param releaseId The ID of the release to retrieve.
153
91
  * @returns A promise that resolves to the release data.
154
92
  */
155
- async getRelease(releaseId) {
156
- const url = `/release_groups/${releaseId}`;
157
- return await this.request({
158
- method: "GET",
159
- url,
160
- });
93
+ async getReleaseGroup(releaseId) {
94
+ const localVarFetchArgs = ProjectsApiFetchParamCreator(this.configuration).getReleaseGroup(releaseId);
95
+ return await this.requestObject(localVarFetchArgs.url, localVarFetchArgs.options, ProjectAPI.releaseFields);
161
96
  }
162
97
  /**
163
98
  * Lists builds associated with a specific release group.
@@ -166,10 +101,7 @@ export class ProjectAPI extends BaseAPI {
166
101
  * @return A promise that resolves to an array of `BuildResponse` objects.
167
102
  */
168
103
  async listBuildsInRelease(releaseId) {
169
- const url = `/release_groups/${releaseId}/releases`;
170
- return await this.request({
171
- method: "GET",
172
- url,
173
- }, true);
104
+ const localVarFetchArgs = ProjectsApiFetchParamCreator(this.configuration).getReleaseGroup(releaseId);
105
+ return await this.requestArray(localVarFetchArgs.url, localVarFetchArgs.options, true, ProjectAPI.buildFields);
174
106
  }
175
107
  }