@hecom/codearts 0.3.0 → 0.3.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.
@@ -86,7 +86,7 @@ exports.HOLIDAYS = {
86
86
  },
87
87
  bigWeekWorkdays: [
88
88
  ['2026-01-17', '2026-01-31'],
89
- ['2026-02-07', '2026-02-21'],
89
+ ['2026-02-07', '2026-02-23'],
90
90
  ['2026-03-07', '2026-03-21'],
91
91
  ['2026-04-11', '2026-04-25'],
92
92
  ['2026-05-16', '2026-05-30'], // ?
@@ -0,0 +1,3 @@
1
+ export { ApiService } from './services/api.service';
2
+ export { BusinessService } from './services/business.service';
3
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.BusinessService = exports.ApiService = void 0;
18
+ // 导出API服务和类型定义
19
+ var api_service_1 = require("./services/api.service");
20
+ Object.defineProperty(exports, "ApiService", { enumerable: true, get: function () { return api_service_1.ApiService; } });
21
+ var business_service_1 = require("./services/business.service");
22
+ Object.defineProperty(exports, "BusinessService", { enumerable: true, get: function () { return business_service_1.BusinessService; } });
23
+ __exportStar(require("./types"), exports);
@@ -1,4 +1,4 @@
1
- import { ApiResponse, CachedToken, HuaweiCloudConfig, ListChildIssuesV2Response, ListChildIssuesV4Response, ListIssuesV4Request, ListIssuesV4Response, ListProjectIterationsV4Request, ListProjectIterationsV4Response, ProjectListResponse, ProjectMemberListResponse, ProjectMemberQueryParams, ProjectQueryParams, ShowProjectWorkHoursRequest, ShowProjectWorkHoursResponse } from '../types';
1
+ import { AddIssueNotesRequest, AddIssueNotesResponse, ApiResponse, CachedToken, HuaweiCloudConfig, ListChildIssuesV2Response, ListChildIssuesV4Response, ListIssuesV4Request, ListIssuesV4Response, ListProjectIterationsV4Request, ListProjectIterationsV4Response, ProjectListResponse, ProjectMemberListResponse, ProjectMemberQueryParams, ProjectQueryParams, ShowProjectWorkHoursRequest, ShowProjectWorkHoursResponse } from '../types';
2
2
  /**
3
3
  * 华为云CodeArts API服务类
4
4
  * 支持IAM Token认证和CodeArts API调用
@@ -71,6 +71,10 @@ export declare class ApiService {
71
71
  * 创建工作项
72
72
  */
73
73
  createIssue(projectId: string, issueData: unknown): Promise<ApiResponse<unknown>>;
74
+ /**
75
+ * 工作项添加评论
76
+ */
77
+ addIssueNotes(params: AddIssueNotesRequest): Promise<ApiResponse<AddIssueNotesResponse>>;
74
78
  /**
75
79
  * 更新工作项
76
80
  */
@@ -347,6 +347,15 @@ class ApiService {
347
347
  data: issueData,
348
348
  });
349
349
  }
350
+ /**
351
+ * 工作项添加评论
352
+ */
353
+ async addIssueNotes(params) {
354
+ return this.request('/v2/issues/update-issue-notes', {
355
+ method: 'POST',
356
+ data: params,
357
+ });
358
+ }
350
359
  /**
351
360
  * 更新工作项
352
361
  */
@@ -43,6 +43,7 @@ export declare class BusinessService {
43
43
  * @returns Task类型的工作项列表
44
44
  */
45
45
  getWorkloadByIterationsAndUsers(projectId: string, iterationIds: number[], userIds: string[]): Promise<IssueItem[]>;
46
+ addIssueNote(projectId: string, issueId: number, content: string): Promise<unknown>;
46
47
  /**
47
48
  * 统计工作项进度信息
48
49
  * @param issues 工作项列表
@@ -134,6 +134,17 @@ class BusinessService {
134
134
  }
135
135
  return issuesResponse.data?.issues || [];
136
136
  }
137
+ async addIssueNote(projectId, issueId, content) {
138
+ const result = await this.apiService.addIssueNotes({
139
+ projectUUId: projectId,
140
+ id: String(issueId),
141
+ notes: content,
142
+ });
143
+ if (result.data?.status === 'success') {
144
+ return result.data.result.issue;
145
+ }
146
+ throw new Error(`添加工作项备注失败: ${result.data?.status || '未知错误'}`);
147
+ }
137
148
  /**
138
149
  * 统计工作项进度信息
139
150
  * @param issues 工作项列表
@@ -568,3 +568,10 @@ export interface ConsoleTotal<T> {
568
568
  totalMap: [string, string | (() => string)][];
569
569
  list: T[];
570
570
  }
571
+ export interface AddIssueNotesResponse {
572
+ result: AddIssueNotesResult;
573
+ status: string;
574
+ }
575
+ export interface AddIssueNotesResult {
576
+ issue: unknown;
577
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hecom/codearts",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "华为云 CodeArts 统计分析工具",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,7 +53,7 @@
53
53
  "devDependencies": {
54
54
  "@types/commander": "^2.12.0",
55
55
  "@types/inquirer": "^9.0.9",
56
- "@types/jest": "^29.5.5",
56
+ "@types/jest": "^29.5.14",
57
57
  "@types/node": "^20.19.33",
58
58
  "@types/ora": "^3.1.0",
59
59
  "@typescript-eslint/eslint-plugin": "^6.7.2",
@@ -65,7 +65,7 @@
65
65
  "jest": "^29.7.0",
66
66
  "prettier": "^3.0.3",
67
67
  "rimraf": "^5.0.1",
68
- "ts-jest": "^29.1.1",
68
+ "ts-jest": "^29.4.6",
69
69
  "ts-node": "^10.9.1",
70
70
  "typescript": "^5.2.2"
71
71
  }