@cnbcool/mcp-server 0.5.0 → 0.6.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 (42) hide show
  1. package/README.md +7 -0
  2. package/README_zh.md +7 -0
  3. package/dist/api/build/build-logs-delete.js +39 -0
  4. package/dist/api/build/build-runner-download-log.js +39 -0
  5. package/dist/api/build/get-build-logs.js +40 -0
  6. package/dist/api/build/get-build-stage.js +39 -0
  7. package/dist/api/build/get-build-status.js +39 -0
  8. package/dist/api/build/start-build.js +41 -0
  9. package/dist/api/build/stop-build.js +39 -0
  10. package/dist/api/client.js +0 -12
  11. package/dist/api/group.js +10 -17
  12. package/dist/api/interfaces/die.weberror.js +15 -0
  13. package/dist/api/interfaces/dto.buildlogsdeleteresult.js +15 -0
  14. package/dist/api/interfaces/dto.buildlogsresult.js +15 -0
  15. package/dist/api/interfaces/dto.buildresult.js +15 -0
  16. package/dist/api/interfaces/dto.buildstageresult.js +15 -0
  17. package/dist/api/interfaces/dto.buildstatusresult.js +15 -0
  18. package/dist/api/interfaces/dto.startbuildreq.js +15 -0
  19. package/dist/api/issue.js +26 -32
  20. package/dist/api/pull.js +16 -22
  21. package/dist/api/repository.js +10 -16
  22. package/dist/api/user.js +2 -7
  23. package/dist/api/workspace.js +6 -12
  24. package/dist/constants/header.js +8 -0
  25. package/dist/constants/toolDescriptions.js +8 -0
  26. package/dist/constants/toolNames.js +8 -0
  27. package/dist/helpers/checkRepoVisibility.js +3 -3
  28. package/dist/helpers/createTransport.js +0 -1
  29. package/dist/helpers/request/cnb/index.js +121 -0
  30. package/dist/helpers/request/cnb/types.js +2 -0
  31. package/dist/helpers/request/index.js +17 -0
  32. package/dist/helpers/request/types.js +2 -0
  33. package/dist/middlewares/logMiddleware.js +49 -0
  34. package/dist/streamable.js +2 -0
  35. package/dist/tools/buildTools.js +158 -0
  36. package/dist/tools/groupTools.js +5 -5
  37. package/dist/tools/index.js +11 -6
  38. package/dist/tools/issueTools.js +13 -13
  39. package/dist/tools/pullTools.js +8 -8
  40. package/dist/tools/repoTools.js +10 -10
  41. package/dist/tools/workspaceTools.js +3 -3
  42. package/package.json +20 -17
package/README.md CHANGED
@@ -34,6 +34,13 @@ CNB(https://cnb.cool) toolkits for LLMs supporting the MCP protocol
34
34
  | cnb_merge_pull | Merge a merge request specified on the CNB platform |
35
35
  | cnb_list_pull_comments | Get a list of comments for a merge request specified on the CNB platform |
36
36
  | cnb_create_pull_comment | Create a new comment on a merge request specified on the CNB platform |
37
+ | cnb_buildLogsDelete | Delete pipeline or cloud-native build log content |
38
+ | cnb_buildRunnerDownloadLog | Download pipeline or cloud-native build runner logs |
39
+ | cnb_getBuildLogs | Query pipeline or cloud-native build list |
40
+ | cnb_getBuildStage | Query pipeline or cloud-native build stage details |
41
+ | cnb_getBuildStatus | Query pipeline or cloud-native build status |
42
+ | cnb_startBuild | Start a build |
43
+ | cnb_stopBuild | Stop a build |
37
44
  | cnb_list_workspaces | Get a list of the current user's cloud-native development environments on the CNB platform |
38
45
  | cnb_delete_workspace | Delete a specified cloud-native development environment on the CNB platform |
39
46
 
package/README_zh.md CHANGED
@@ -34,6 +34,13 @@ CNB(https://cnb.cool) 支持 MCP 协议的 MCP Server
34
34
  | cnb_merge_pull | 合并CNB平台指定的合并请求 |
35
35
  | cnb_list_pull_comments | 获取CNB平台指定合并请求的评论列表 |
36
36
  | cnb_create_pull_comment | 在CNB平台指定的合并请求创建一条新评论 |
37
+ | cnb_buildLogsDelete | 删除流水线或云原生构建日志内容 |
38
+ | cnb_buildRunnerDownloadLog | 流水线或云原生构建runner日志下载 |
39
+ | cnb_getBuildLogs | 查询流水线或云原生构建构建列表 |
40
+ | cnb_getBuildStage | 查询流水线或云原生构建Stage详情 |
41
+ | cnb_getBuildStatus | 查询流水线或云原生构建构建状态 |
42
+ | cnb_startBuild | 开始一个构建 |
43
+ | cnb_stopBuild | 停止一个构建 |
37
44
  | cnb_list_workspaces | 获取当前用户在CNB平台的云原生开发环境列表 |
38
45
  | cnb_delete_workspace | 在CNB平台删除指定的云原生开发环境 |
39
46
 
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * -------------------------------------------------------------------------
9
+ * @Version 1.5.0
10
+ * @Source /{repo}/-/build/logs/{sn}
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.buildLogsDelete = buildLogsDelete;
17
+ const request_1 = __importDefault(require("../../helpers/request"));
18
+ /**
19
+ * @description 访问令牌调用此接口需包含以下权限。Required permissions for access token.
20
+ * repo-cnb-trigger:rw
21
+ * @tags Build
22
+ * @name buildLogsDelete
23
+ * @summary 删除流水线日志内容。Delete pipeline logs content.
24
+ * @request delete:/{repo}/-/build/logs/{sn}
25
+
26
+ ----------------------------------
27
+ * @param {BuildLogsDeleteParams} arg0 - buildLogsDelete request params
28
+ * @param {RequestConfig} arg1 - Other reuqest params
29
+ */
30
+ async function buildLogsDelete({ repo, sn }, { req, options, ...axiosConfig } = {}) {
31
+ return await request_1.default.request({
32
+ ...axiosConfig,
33
+ _next_req: req,
34
+ options: options,
35
+ url: `/${repo}/-/build/logs/${sn}`,
36
+ _apiTag: '/{repo}/-/build/logs/{sn}',
37
+ method: 'delete'
38
+ });
39
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * -------------------------------------------------------------------------
9
+ * @Version 1.5.0
10
+ * @Source /{repo}/-/build/runner/download/log/{pipelineId}
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.buildRunnerDownloadLog = buildRunnerDownloadLog;
17
+ const request_1 = __importDefault(require("../../helpers/request"));
18
+ /**
19
+ * @description 访问令牌调用此接口需包含以下权限。Required permissions for access token.
20
+ * repo-cnb-trigger:r
21
+ * @tags Build
22
+ * @name buildRunnerDownloadLog
23
+ * @summary 流水线runner日志下载。Pipeline runner log download.
24
+ * @request get:/{repo}/-/build/runner/download/log/{pipelineId}
25
+
26
+ ----------------------------------
27
+ * @param {BuildRunnerDownloadLogParams} arg0 - buildRunnerDownloadLog request params
28
+ * @param {RequestConfig} arg1 - Other reuqest params
29
+ */
30
+ async function buildRunnerDownloadLog({ repo, pipelineId }, { req, options, ...axiosConfig } = {}) {
31
+ return await request_1.default.request({
32
+ ...axiosConfig,
33
+ _next_req: req,
34
+ options: options,
35
+ url: `/${repo}/-/build/runner/download/log/${pipelineId}`,
36
+ _apiTag: '/{repo}/-/build/runner/download/log/{pipelineId}',
37
+ method: 'get'
38
+ });
39
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * -------------------------------------------------------------------------
9
+ * @Version 1.5.0
10
+ * @Source /{repo}/-/build/logs
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.getBuildLogs = getBuildLogs;
17
+ const request_1 = __importDefault(require("../../helpers/request"));
18
+ /**
19
+ * @description 访问令牌调用此接口需包含以下权限。Required permissions for access token.
20
+ * repo-cnb-trigger:r
21
+ * @tags Build
22
+ * @name getBuildLogs
23
+ * @summary 查询流水线构建列表。List pipeline builds.
24
+ * @request get:/{repo}/-/build/logs
25
+
26
+ ----------------------------------
27
+ * @param {GetBuildLogsParams} arg0 - getBuildLogs request params
28
+ * @param {RequestConfig} arg1 - Other reuqest params
29
+ */
30
+ async function getBuildLogs({ repo, ...query }, { req, options, ...axiosConfig } = {}) {
31
+ return await request_1.default.request({
32
+ ...axiosConfig,
33
+ _next_req: req,
34
+ options: options,
35
+ url: `/${repo}/-/build/logs`,
36
+ _apiTag: '/{repo}/-/build/logs',
37
+ method: 'get',
38
+ params: query
39
+ });
40
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * -------------------------------------------------------------------------
9
+ * @Version 1.5.0
10
+ * @Source /{repo}/-/build/logs/stage/{sn}/{pipelineId}/{stageId}
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.getBuildStage = getBuildStage;
17
+ const request_1 = __importDefault(require("../../helpers/request"));
18
+ /**
19
+ * @description 访问令牌调用此接口需包含以下权限。Required permissions for access token.
20
+ * repo-cnb-trigger:r
21
+ * @tags Build
22
+ * @name getBuildStage
23
+ * @summary 查询流水线Stage详情。Get pipeline build stage detail.
24
+ * @request get:/{repo}/-/build/logs/stage/{sn}/{pipelineId}/{stageId}
25
+
26
+ ----------------------------------
27
+ * @param {GetBuildStageParams} arg0 - getBuildStage request params
28
+ * @param {RequestConfig} arg1 - Other reuqest params
29
+ */
30
+ async function getBuildStage({ repo, sn, pipelineId, stageId }, { req, options, ...axiosConfig } = {}) {
31
+ return await request_1.default.request({
32
+ ...axiosConfig,
33
+ _next_req: req,
34
+ options: options,
35
+ url: `/${repo}/-/build/logs/stage/${sn}/${pipelineId}/${stageId}`,
36
+ _apiTag: '/{repo}/-/build/logs/stage/{sn}/{pipelineId}/{stageId}',
37
+ method: 'get'
38
+ });
39
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * -------------------------------------------------------------------------
9
+ * @Version 1.5.0
10
+ * @Source /{repo}/-/build/status/{sn}
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.getBuildStatus = getBuildStatus;
17
+ const request_1 = __importDefault(require("../../helpers/request"));
18
+ /**
19
+ * @description 访问令牌调用此接口需包含以下权限。Required permissions for access token.
20
+ * repo-cnb-trigger:r
21
+ * @tags Build
22
+ * @name getBuildStatus
23
+ * @summary 查询流水线构建状态。Get pipeline build status.
24
+ * @request get:/{repo}/-/build/status/{sn}
25
+
26
+ ----------------------------------
27
+ * @param {GetBuildStatusParams} arg0 - getBuildStatus request params
28
+ * @param {RequestConfig} arg1 - Other reuqest params
29
+ */
30
+ async function getBuildStatus({ repo, sn }, { req, options, ...axiosConfig } = {}) {
31
+ return await request_1.default.request({
32
+ ...axiosConfig,
33
+ _next_req: req,
34
+ options: options,
35
+ url: `/${repo}/-/build/status/${sn}`,
36
+ _apiTag: '/{repo}/-/build/status/{sn}',
37
+ method: 'get'
38
+ });
39
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * -------------------------------------------------------------------------
9
+ * @Version 1.5.0
10
+ * @Source /{repo}/-/build/start
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.startBuild = startBuild;
17
+ const request_1 = __importDefault(require("../../helpers/request"));
18
+ /**
19
+ * @description 访问令牌调用此接口需包含以下权限。Required permissions for access token.
20
+ * repo-cnb-trigger:rw
21
+ * @tags Build
22
+ * @name startBuild
23
+ * @summary 开始一个构建。Start a build.
24
+ * @request post:/{repo}/-/build/start
25
+
26
+ ----------------------------------
27
+ * @param {string} arg0
28
+ * @param {DtoStartBuildReq} arg1
29
+ * @param {RequestConfig} arg2 - Other reuqest params
30
+ */
31
+ async function startBuild(repo, request, { req, options, ...axiosConfig } = {}) {
32
+ return await request_1.default.request({
33
+ ...axiosConfig,
34
+ _next_req: req,
35
+ options: options,
36
+ url: `/${repo}-/build/start`,
37
+ _apiTag: '/{repo}/-/build/start',
38
+ method: 'post',
39
+ data: request
40
+ });
41
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * -------------------------------------------------------------------------
9
+ * @Version 1.5.0
10
+ * @Source /{repo}/-/build/stop/{sn}
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.stopBuild = stopBuild;
17
+ const request_1 = __importDefault(require("../../helpers/request"));
18
+ /**
19
+ * @description 访问令牌调用此接口需包含以下权限。Required permissions for access token.
20
+ * repo-cnb-trigger:rw
21
+ * @tags Build
22
+ * @name stopBuild
23
+ * @summary 停止一个构建。 Stop a build.
24
+ * @request post:/{repo}/-/build/stop/{sn}
25
+
26
+ ----------------------------------
27
+ * @param {StopBuildParams} arg0 - stopBuild request params
28
+ * @param {RequestConfig} arg1 - Other reuqest params
29
+ */
30
+ async function stopBuild({ repo, sn }, { req, options, ...axiosConfig } = {}) {
31
+ return await request_1.default.request({
32
+ ...axiosConfig,
33
+ _next_req: req,
34
+ options: options,
35
+ url: `/${repo}/-/build/stop/${sn}`,
36
+ _apiTag: '/{repo}/-/build/stop/{sn}',
37
+ method: 'post'
38
+ });
39
+ }
@@ -8,17 +8,6 @@ class CnbApiClient {
8
8
  get baseUrl() {
9
9
  return this._baseUrl;
10
10
  }
11
- static initialize(options) {
12
- if (!CnbApiClient.instance) {
13
- CnbApiClient.instance = new CnbApiClient(options);
14
- }
15
- }
16
- static getInstance() {
17
- if (!CnbApiClient.instance) {
18
- throw new Error('CnbApiClient not initialized. Call CnbApiClient.initialize(baseUrl, token) first.');
19
- }
20
- return CnbApiClient.instance;
21
- }
22
11
  async request(method, path, body, config, responseType = 'json' // 'json' | 'text' | 'raw'
23
12
  ) {
24
13
  const url = `${this._baseUrl}${path}`;
@@ -46,5 +35,4 @@ class CnbApiClient {
46
35
  return response.json();
47
36
  }
48
37
  }
49
- CnbApiClient.instance = null;
50
38
  exports.default = CnbApiClient;
package/dist/api/group.js CHANGED
@@ -1,16 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.listGroups = listGroups;
7
4
  exports.listSubGroups = listSubGroups;
8
5
  exports.getGroup = getGroup;
9
6
  exports.createGroup = createGroup;
10
- const client_js_1 = __importDefault(require("./client.js"));
11
- async function listGroups(params) {
12
- const cnbInst = client_js_1.default.getInstance();
13
- const url = new URL('/user/groups', cnbInst.baseUrl);
7
+ async function listGroups(client, params) {
8
+ const url = new URL('/user/groups', client.baseUrl);
14
9
  if (params) {
15
10
  for (const [key, value] of Object.entries(params)) {
16
11
  if (value === undefined)
@@ -18,11 +13,10 @@ async function listGroups(params) {
18
13
  url.searchParams.set(key, value.toString());
19
14
  }
20
15
  }
21
- return cnbInst.request('GET', `${url.pathname}${url.search}`);
16
+ return client.request('GET', `${url.pathname}${url.search}`);
22
17
  }
23
- async function listSubGroups(group, params) {
24
- const cnbInst = client_js_1.default.getInstance();
25
- const url = new URL(`/user/groups/${group}`, cnbInst.baseUrl);
18
+ async function listSubGroups(client, group, params) {
19
+ const url = new URL(`/user/groups/${group}`, client.baseUrl);
26
20
  if (params) {
27
21
  for (const [key, value] of Object.entries(params)) {
28
22
  if (value === undefined)
@@ -30,20 +24,19 @@ async function listSubGroups(group, params) {
30
24
  url.searchParams.set(key, value.toString());
31
25
  }
32
26
  }
33
- return cnbInst.request('GET', `${url.pathname}${url.search}`);
27
+ return client.request('GET', `${url.pathname}${url.search}`);
34
28
  }
35
- async function getGroup(group) {
36
- const cnbInst = client_js_1.default.getInstance();
37
- return cnbInst.request('GET', `/${group}`);
29
+ async function getGroup(client, group) {
30
+ return client.request('GET', `/${group}`);
38
31
  }
39
- async function createGroup(params) {
32
+ async function createGroup(client, params) {
40
33
  const body = Object.entries(params).reduce((acc, [key, value]) => {
41
34
  if (value === undefined)
42
35
  return acc;
43
36
  Object.assign(acc, { [key]: value });
44
37
  return acc;
45
38
  }, {});
46
- const response = await client_js_1.default.getInstance().request('POST', '/groups', body, {
39
+ const response = await client.request('POST', '/groups', body, {
47
40
  header: { 'Content-Type': 'application/json' }
48
41
  }, 'raw');
49
42
  if (response.status === 201) {
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * ## ##
9
+ * ## AUTHOR: bapelin ##
10
+ * ## SOURCE: https://cnb.woa.com/cnb/frontend-science/cnb-api-generate ##
11
+ * -------------------------------------------------------------------------
12
+ * @Version 1.5.0
13
+ * @Source die.WebError
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * ## ##
9
+ * ## AUTHOR: bapelin ##
10
+ * ## SOURCE: https://cnb.woa.com/cnb/frontend-science/cnb-api-generate ##
11
+ * -------------------------------------------------------------------------
12
+ * @Version 1.5.0
13
+ * @Source dto.BuildLogsDeleteResult
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * ## ##
9
+ * ## AUTHOR: bapelin ##
10
+ * ## SOURCE: https://cnb.woa.com/cnb/frontend-science/cnb-api-generate ##
11
+ * -------------------------------------------------------------------------
12
+ * @Version 1.5.0
13
+ * @Source dto.BuildLogsResult
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * ## ##
9
+ * ## AUTHOR: bapelin ##
10
+ * ## SOURCE: https://cnb.woa.com/cnb/frontend-science/cnb-api-generate ##
11
+ * -------------------------------------------------------------------------
12
+ * @Version 1.5.0
13
+ * @Source dto.BuildResult
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * ## ##
9
+ * ## AUTHOR: bapelin ##
10
+ * ## SOURCE: https://cnb.woa.com/cnb/frontend-science/cnb-api-generate ##
11
+ * -------------------------------------------------------------------------
12
+ * @Version 1.5.0
13
+ * @Source dto.BuildStageResult
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * ## ##
9
+ * ## AUTHOR: bapelin ##
10
+ * ## SOURCE: https://cnb.woa.com/cnb/frontend-science/cnb-api-generate ##
11
+ * -------------------------------------------------------------------------
12
+ * @Version 1.5.0
13
+ * @Source dto.BuildStatusResult
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /*
6
+ * -------------------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA CNB-API-GENERATE ##
8
+ * ## ##
9
+ * ## AUTHOR: bapelin ##
10
+ * ## SOURCE: https://cnb.woa.com/cnb/frontend-science/cnb-api-generate ##
11
+ * -------------------------------------------------------------------------
12
+ * @Version 1.5.0
13
+ * @Source dto.StartBuildReq
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/api/issue.js CHANGED
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.listIssues = listIssues;
7
4
  exports.getIssue = getIssue;
@@ -15,10 +12,8 @@ exports.addIssueLabels = addIssueLabels;
15
12
  exports.setIssueLabels = setIssueLabels;
16
13
  exports.deleteIssueLabels = deleteIssueLabels;
17
14
  exports.deleteIssueLabel = deleteIssueLabel;
18
- const client_js_1 = __importDefault(require("./client.js"));
19
- async function listIssues(repo, params) {
20
- const cnbInst = client_js_1.default.getInstance();
21
- const url = new URL(`/${repo}/-/issues`, cnbInst.baseUrl);
15
+ async function listIssues(client, repo, params) {
16
+ const url = new URL(`/${repo}/-/issues`, client.baseUrl);
22
17
  if (params) {
23
18
  for (const [key, value] of Object.entries(params)) {
24
19
  if (value === undefined)
@@ -26,30 +21,29 @@ async function listIssues(repo, params) {
26
21
  url.searchParams.set(key, value.toString());
27
22
  }
28
23
  }
29
- return cnbInst.request('GET', `${url.pathname}${url.search}`);
24
+ return client.request('GET', `${url.pathname}${url.search}`);
30
25
  }
31
- async function getIssue(repo, issueId) {
32
- return client_js_1.default.getInstance().request('GET', `/${repo}/-/issues/${issueId}`);
26
+ async function getIssue(client, repo, issueId) {
27
+ return client.request('GET', `/${repo}/-/issues/${issueId}`);
33
28
  }
34
- async function createIssue(repo, params) {
29
+ async function createIssue(client, repo, params) {
35
30
  const newParams = Object.entries(params).reduce((acc, [key, value]) => {
36
31
  if (value === undefined)
37
32
  return acc;
38
33
  Object.assign(acc, { [key]: value });
39
34
  return acc;
40
35
  }, {});
41
- return client_js_1.default.getInstance().request('POST', `/${repo}/-/issues`, newParams, {
36
+ return client.request('POST', `/${repo}/-/issues`, newParams, {
42
37
  header: { 'Content-Type': 'application/json' }
43
38
  });
44
39
  }
45
- async function updateIssue(repo, issueId, params) {
46
- return client_js_1.default.getInstance().request('PATCH', `/${repo}/-/issues/${issueId}`, params, {
40
+ async function updateIssue(client, repo, issueId, params) {
41
+ return client.request('PATCH', `/${repo}/-/issues/${issueId}`, params, {
47
42
  header: { 'Content-Type': 'application/json' }
48
43
  });
49
44
  }
50
- async function listIssueComments(repo, issueId, params) {
51
- const cnbInst = client_js_1.default.getInstance();
52
- const url = new URL(`/${repo}/-/issues/${issueId}/comments`, cnbInst.baseUrl);
45
+ async function listIssueComments(client, repo, issueId, params) {
46
+ const url = new URL(`/${repo}/-/issues/${issueId}/comments`, client.baseUrl);
53
47
  if (params) {
54
48
  for (const [key, value] of Object.entries(params)) {
55
49
  if (value === undefined)
@@ -57,34 +51,34 @@ async function listIssueComments(repo, issueId, params) {
57
51
  url.searchParams.set(key, value.toString());
58
52
  }
59
53
  }
60
- return cnbInst.request('GET', `${url.pathname}${url.search}`);
54
+ return client.request('GET', `${url.pathname}${url.search}`);
61
55
  }
62
- async function createIssueComment(repo, issueId, params) {
63
- return client_js_1.default.getInstance().request('POST', `/${repo}/-/issues/${issueId}/comments`, params, {
56
+ async function createIssueComment(client, repo, issueId, params) {
57
+ return client.request('POST', `/${repo}/-/issues/${issueId}/comments`, params, {
64
58
  header: { 'Content-Type': 'application/json' }
65
59
  });
66
60
  }
67
- async function updateIssueComment(repo, issueId, commentId, params) {
68
- return client_js_1.default.getInstance().request('PATCH', `/${repo}/-/issues/${issueId}/comments/${commentId}`, params, {
61
+ async function updateIssueComment(client, repo, issueId, commentId, params) {
62
+ return client.request('PATCH', `/${repo}/-/issues/${issueId}/comments/${commentId}`, params, {
69
63
  header: { 'Content-Type': 'application/json' }
70
64
  });
71
65
  }
72
- async function listIssueLabels(repo, issueId) {
73
- return client_js_1.default.getInstance().request('GET', `/${repo}/-/issues/${issueId}/labels`);
66
+ async function listIssueLabels(client, repo, issueId) {
67
+ return client.request('GET', `/${repo}/-/issues/${issueId}/labels`);
74
68
  }
75
- async function addIssueLabels(repo, issueId, labels) {
76
- return client_js_1.default.getInstance().request('POST', `/${repo}/-/issues/${issueId}/labels`, { labels }, {
69
+ async function addIssueLabels(client, repo, issueId, labels) {
70
+ return client.request('POST', `/${repo}/-/issues/${issueId}/labels`, { labels }, {
77
71
  header: { 'Content-Type': 'application/json' }
78
72
  });
79
73
  }
80
- async function setIssueLabels(repo, issueId, labels) {
81
- return client_js_1.default.getInstance().request('PUT', `/${repo}/-/issues/${issueId}/labels`, { labels }, {
74
+ async function setIssueLabels(client, repo, issueId, labels) {
75
+ return client.request('PUT', `/${repo}/-/issues/${issueId}/labels`, { labels }, {
82
76
  header: { 'Content-Type': 'application/json' }
83
77
  });
84
78
  }
85
- async function deleteIssueLabels(repo, issueId) {
86
- await client_js_1.default.getInstance().request('DELETE', `/${repo}/-/issues/${issueId}/labels`);
79
+ async function deleteIssueLabels(client, repo, issueId) {
80
+ await client.request('DELETE', `/${repo}/-/issues/${issueId}/labels`);
87
81
  }
88
- async function deleteIssueLabel(repo, issueId, labelName) {
89
- await client_js_1.default.getInstance().request('DELETE', `/${repo}/-/issues/${issueId}/labels/${encodeURIComponent(labelName)}`);
82
+ async function deleteIssueLabel(client, repo, issueId, labelName) {
83
+ await client.request('DELETE', `/${repo}/-/issues/${issueId}/labels/${encodeURIComponent(labelName)}`);
90
84
  }