zentao-api 0.6.1 → 0.6.3

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.
@@ -3403,6 +3403,9 @@ export declare const MODULES: ({
3403
3403
  name?: undefined;
3404
3404
  parent?: undefined;
3405
3405
  comment?: undefined;
3406
+ deadline?: undefined;
3407
+ status?: undefined;
3408
+ mailto?: undefined;
3406
3409
  resolution?: undefined;
3407
3410
  resolvedDate?: undefined;
3408
3411
  resolvedBuild?: undefined;
@@ -3504,6 +3507,9 @@ export declare const MODULES: ({
3504
3507
  name?: undefined;
3505
3508
  parent?: undefined;
3506
3509
  comment?: undefined;
3510
+ deadline?: undefined;
3511
+ status?: undefined;
3512
+ mailto?: undefined;
3507
3513
  resolution?: undefined;
3508
3514
  resolvedDate?: undefined;
3509
3515
  resolvedBuild?: undefined;
@@ -3555,6 +3561,9 @@ export declare const MODULES: ({
3555
3561
  story?: undefined;
3556
3562
  assignedTo?: undefined;
3557
3563
  comment?: undefined;
3564
+ deadline?: undefined;
3565
+ status?: undefined;
3566
+ mailto?: undefined;
3558
3567
  resolution?: undefined;
3559
3568
  resolvedDate?: undefined;
3560
3569
  resolvedBuild?: undefined;
@@ -3647,6 +3656,9 @@ export declare const MODULES: ({
3647
3656
  story?: undefined;
3648
3657
  name?: undefined;
3649
3658
  parent?: undefined;
3659
+ deadline?: undefined;
3660
+ status?: undefined;
3661
+ mailto?: undefined;
3650
3662
  resolution?: undefined;
3651
3663
  resolvedDate?: undefined;
3652
3664
  resolvedBuild?: undefined;
@@ -3694,6 +3706,81 @@ export declare const MODULES: ({
3694
3706
  assignedTo?: undefined;
3695
3707
  name?: undefined;
3696
3708
  parent?: undefined;
3709
+ deadline?: undefined;
3710
+ status?: undefined;
3711
+ mailto?: undefined;
3712
+ resolution?: undefined;
3713
+ resolvedDate?: undefined;
3714
+ resolvedBuild?: undefined;
3715
+ };
3716
+ required?: undefined;
3717
+ };
3718
+ };
3719
+ pagerGetter?: undefined;
3720
+ resultGetter?: undefined;
3721
+ params?: undefined;
3722
+ } | {
3723
+ name: "confirm";
3724
+ display: string;
3725
+ type: "action";
3726
+ method: "put";
3727
+ path: string;
3728
+ resultType: "text";
3729
+ pathParams: {
3730
+ bugID: string;
3731
+ scope?: undefined;
3732
+ scopeID?: undefined;
3733
+ productID?: undefined;
3734
+ moduleID?: undefined;
3735
+ };
3736
+ requestBody: {
3737
+ required: true;
3738
+ type: "object";
3739
+ schema: {
3740
+ type: string;
3741
+ properties: {
3742
+ assignedTo: {
3743
+ type: string;
3744
+ description: string;
3745
+ };
3746
+ type: {
3747
+ type: string;
3748
+ description: string;
3749
+ };
3750
+ pri: {
3751
+ type: string;
3752
+ description: string;
3753
+ format: string;
3754
+ };
3755
+ deadline: {
3756
+ type: string;
3757
+ description: string;
3758
+ };
3759
+ status: {
3760
+ type: string;
3761
+ description: string;
3762
+ };
3763
+ mailto: {
3764
+ type: string;
3765
+ items: {
3766
+ type: string;
3767
+ };
3768
+ description: string;
3769
+ };
3770
+ comment: {
3771
+ type: string;
3772
+ description: string;
3773
+ };
3774
+ productID?: undefined;
3775
+ title?: undefined;
3776
+ openedBuild?: undefined;
3777
+ project?: undefined;
3778
+ execution?: undefined;
3779
+ severity?: undefined;
3780
+ steps?: undefined;
3781
+ story?: undefined;
3782
+ name?: undefined;
3783
+ parent?: undefined;
3697
3784
  resolution?: undefined;
3698
3785
  resolvedDate?: undefined;
3699
3786
  resolvedBuild?: undefined;
@@ -3756,6 +3843,9 @@ export declare const MODULES: ({
3756
3843
  story?: undefined;
3757
3844
  name?: undefined;
3758
3845
  parent?: undefined;
3846
+ deadline?: undefined;
3847
+ status?: undefined;
3848
+ mailto?: undefined;
3759
3849
  };
3760
3850
  required: string[];
3761
3851
  };
@@ -7100,13 +7190,11 @@ export declare const MODULES: ({
7100
7190
  requestBody: {
7101
7191
  required: true;
7102
7192
  type: "object";
7103
- mediaType: "multipart/form-data";
7104
7193
  schema: {
7105
7194
  type: string;
7106
7195
  properties: {
7107
7196
  file: {
7108
7197
  type: string;
7109
- format: string;
7110
7198
  description: string;
7111
7199
  };
7112
7200
  objectType: {
@@ -7150,7 +7238,6 @@ export declare const MODULES: ({
7150
7238
  };
7151
7239
  required: string[];
7152
7240
  };
7153
- mediaType?: undefined;
7154
7241
  };
7155
7242
  } | {
7156
7243
  name: "delete";
@@ -7400,6 +7487,7 @@ export declare const MODULES: ({
7400
7487
  path: string;
7401
7488
  resultType: "list";
7402
7489
  pagerGetter: string;
7490
+ resultGetter: string;
7403
7491
  pathParams: {
7404
7492
  spaceID: string;
7405
7493
  libID: string;
@@ -7408,7 +7496,6 @@ export declare const MODULES: ({
7408
7496
  docID?: undefined;
7409
7497
  moduleID?: undefined;
7410
7498
  };
7411
- resultGetter: string;
7412
7499
  requestBody?: undefined;
7413
7500
  } | {
7414
7501
  name: "productDocs";
@@ -8455,6 +8542,11 @@ export declare const MODULES: ({
8455
8542
  type: string;
8456
8543
  description: string;
8457
8544
  };
8545
+ objectID: {
8546
+ type: string;
8547
+ description: string;
8548
+ format: string;
8549
+ };
8458
8550
  begin: {
8459
8551
  type: string;
8460
8552
  description: string;
@@ -8504,6 +8596,11 @@ export declare const MODULES: ({
8504
8596
  type: string;
8505
8597
  description: string;
8506
8598
  };
8599
+ objectID: {
8600
+ type: string;
8601
+ description: string;
8602
+ format: string;
8603
+ };
8507
8604
  begin: {
8508
8605
  type: string;
8509
8606
  description: string;
@@ -9008,6 +9105,7 @@ export declare const MODULES: ({
9008
9105
  path: string;
9009
9106
  resultType: "list";
9010
9107
  pagerGetter: string;
9108
+ resultGetter: string;
9011
9109
  params: ({
9012
9110
  name: string;
9013
9111
  required: false;
@@ -9036,7 +9134,6 @@ export declare const MODULES: ({
9036
9134
  defaultValue?: undefined;
9037
9135
  options?: undefined;
9038
9136
  })[];
9039
- resultGetter: string;
9040
9137
  } | {
9041
9138
  name: "issues";
9042
9139
  display: string;
@@ -1,7 +1,7 @@
1
- import type { ListPagerInfo, ModuleAction, ModuleActionRequest, ModuleDefinition } from '../types/index.js';
1
+ import type { ListPagerInfo, ModuleAction, ModuleActionRequest, ModuleDefinition, RequestProcessOptions } from '../types/index.js';
2
2
  /** 将模块名、动作名和调用参数解析为实际 API 请求路径、查询参数和请求体。 */
3
3
  export declare function resolveActionRequest(module: ModuleDefinition, actionName: string, params?: Record<string, unknown>): ModuleActionRequest;
4
4
  /** 根据动作定义中的 resultGetter,从原始响应里提取业务数据。 */
5
- export declare function extractResult(action: ModuleAction, response: Record<string, unknown>, params?: Record<string, unknown>): unknown;
5
+ export declare function extractResult(action: ModuleAction, response: Record<string, unknown>, params?: Record<string, unknown>, options?: RequestProcessOptions): unknown;
6
6
  /** 根据动作定义中的 pagerGetter,从原始响应里提取分页信息。 */
7
- export declare function extractPager(action: ModuleAction, response: Record<string, unknown>, params?: Record<string, unknown>): ListPagerInfo | undefined;
7
+ export declare function extractPager(action: ModuleAction, response: Record<string, unknown>, params?: Record<string, unknown>, options?: RequestProcessOptions): ListPagerInfo | undefined;
@@ -214,12 +214,12 @@ export function resolveActionRequest(module, actionName, params = {}) {
214
214
  };
215
215
  }
216
216
  /** 根据动作定义中的 resultGetter,从原始响应里提取业务数据。 */
217
- export function extractResult(action, response, params = {}) {
217
+ export function extractResult(action, response, params = {}, options = {}) {
218
218
  const getter = action.resultGetter;
219
219
  if (!getter)
220
220
  return response.data ?? response;
221
221
  if (typeof getter === 'function')
222
- return getter(response, params);
222
+ return getter(response, params, options);
223
223
  if (typeof getter === 'string')
224
224
  return getNestedValue(response, getter);
225
225
  const result = {};
@@ -229,12 +229,12 @@ export function extractResult(action, response, params = {}) {
229
229
  return result;
230
230
  }
231
231
  /** 根据动作定义中的 pagerGetter,从原始响应里提取分页信息。 */
232
- export function extractPager(action, response, params = {}) {
232
+ export function extractPager(action, response, params = {}, options = {}) {
233
233
  const getter = action.pagerGetter;
234
234
  if (!getter)
235
235
  return response.pager;
236
236
  if (typeof getter === 'function')
237
- return getter(response, params);
237
+ return getter(response, params, options);
238
238
  if (typeof getter === 'string')
239
239
  return getNestedValue(response, getter);
240
240
  const page = getNestedValue(response, getter.pageID);
@@ -148,9 +148,9 @@ function normalizeResponse(command, raw, options) {
148
148
  }
149
149
  const record = raw;
150
150
  const status = record.status === 'fail' ? 'fail' : 'success';
151
- const data = applyProcessing(extractResult(command.action, record, command.params), options);
151
+ const data = applyProcessing(extractResult(command.action, record, command.params, options), options);
152
152
  const rawMessage = record.message;
153
- const pager = extractPager(command.action, record, command.params);
153
+ const pager = extractPager(command.action, record, command.params, options);
154
154
  const response = {
155
155
  status,
156
156
  message: stringifyMessage(rawMessage),
@@ -1,4 +1,5 @@
1
1
  import type { HttpMethod } from './client.js';
2
+ import type { RequestProcessOptions } from './options.js';
2
3
  import type { Pager } from './response.js';
3
4
  /** 模块动作类型:基础 CRUD 或自定义动作。 */
4
5
  export type ModuleActionType = 'list' | 'get' | 'create' | 'update' | 'delete' | 'action';
@@ -78,8 +79,9 @@ export type ModuleActionResultFieldMap = Readonly<Record<string, string>>;
78
79
  * 从原始响应中提取数据时使用的函数形态。
79
80
  * @param data 原始响应对象。
80
81
  * @param params 触发本次请求的原始调用参数。
82
+ * @param options 本次请求的数据处理选项;直接调用 getter 时可以省略。
81
83
  */
82
- export type ModuleActionGetterFn<T> = (data: unknown, params: Record<string, unknown>) => T;
84
+ export type ModuleActionGetterFn<T, O = RequestProcessOptions> = (data: unknown, params: Record<string, unknown>, options?: O) => T;
83
85
  /** 禅道模块中的单个 API 动作定义。 */
84
86
  export interface ModuleAction {
85
87
  /** 动作名称,例如 `list`、`get`、`close`。 */
@@ -55,3 +55,4 @@ export interface RequestOptions extends ProcessListOptions {
55
55
  /** 是否返回原始响应体,默认 false。 */
56
56
  raw?: boolean;
57
57
  }
58
+ export type RequestProcessOptions = ProcessListOptions & Pick<RequestOptions, 'convertSingle'>;
@@ -0,0 +1,3 @@
1
+ import type { HtmlOptions, SnapshotInput } from './types.js';
2
+ /** Convert a BlockSuite 0.19.x snapshot to semantic, escaped HTML. */
3
+ export declare function snapshotToHtml(input: SnapshotInput, options?: HtmlOptions): string;