zentao-api 0.3.3 → 0.4.1
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.
- package/README.md +2 -0
- package/dist/browser/zentao-api.global.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/modules/generated.d.ts +26 -82
- package/dist/modules/generated.js +26 -34
- package/dist/modules/override.js +14 -0
- package/dist/modules/query.d.ts +17 -7
- package/dist/modules/query.js +65 -11
- package/dist/modules/registry.d.ts +27 -83
- package/dist/modules/registry.js +1 -1
- package/dist/modules/resolve.d.ts +2 -2
- package/dist/modules/resolve.js +94 -53
- package/dist/request/index.d.ts +2 -0
- package/dist/request/index.js +14 -4
- package/dist/types/module.d.ts +5 -1
- package/dist/types/options.d.ts +2 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/object.d.ts +2 -0
- package/dist/utils/object.js +4 -0
- package/dist/version.js +2 -2
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { ZentaoClient } from './client/index.js';
|
|
|
2
2
|
export { ERRORS, ZentaoError } from './misc/errors.js';
|
|
3
3
|
export { getGlobalOptions, setGlobalOptions } from './misc/global-options.js';
|
|
4
4
|
export { ZENTAO_PROFILES_STORAGE_KEY, addProfile, deleteProfile, getAllProfiles, getProfile, getProfileKey, switchProfile, } from './profiles/index.js';
|
|
5
|
-
export { defineModuleActions, defineModules, extendModuleAction, getModuleNames, getModule, getModuleAction, } from './modules/registry.js';
|
|
5
|
+
export { defineModuleActions, defineModules, extendModuleAction, getModuleNames, getModule, getModuleAction, getModuleActionParams, } from './modules/registry.js';
|
|
6
6
|
export { request, } from './request/index.js';
|
|
7
7
|
export { pickFields, pickFieldsSingle, filterData, searchData, sortData, processData, } from './utils/index.js';
|
|
8
8
|
export { BUILD, VERSION } from './version.js';
|
|
@@ -1037,19 +1037,12 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
1037
1037
|
readonly display: "获取产品计划列表,支持获取产品下的产品计划";
|
|
1038
1038
|
readonly type: "list";
|
|
1039
1039
|
readonly method: "get";
|
|
1040
|
-
readonly path: "/
|
|
1040
|
+
readonly path: "/products/{productID}/productplans";
|
|
1041
1041
|
readonly resultType: "list";
|
|
1042
1042
|
readonly pagerGetter: "pager";
|
|
1043
1043
|
readonly resultGetter: "productplans";
|
|
1044
1044
|
readonly pathParams: {
|
|
1045
|
-
readonly
|
|
1046
|
-
readonly description: "产品计划范围";
|
|
1047
|
-
readonly options: readonly [{
|
|
1048
|
-
readonly value: "products";
|
|
1049
|
-
readonly label: "产品";
|
|
1050
|
-
}];
|
|
1051
|
-
};
|
|
1052
|
-
readonly scopeID: "范围ID";
|
|
1045
|
+
readonly productID: "所属产品ID";
|
|
1053
1046
|
};
|
|
1054
1047
|
readonly params: readonly [{
|
|
1055
1048
|
readonly name: "browseType";
|
|
@@ -1245,7 +1238,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
1245
1238
|
readonly resultGetter: "stories";
|
|
1246
1239
|
readonly pathParams: {
|
|
1247
1240
|
readonly scope: {
|
|
1248
|
-
readonly description: "
|
|
1241
|
+
readonly description: "需求所属范围";
|
|
1249
1242
|
readonly options: readonly [{
|
|
1250
1243
|
readonly value: "products";
|
|
1251
1244
|
readonly label: "产品";
|
|
@@ -1257,7 +1250,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
1257
1250
|
readonly label: "执行";
|
|
1258
1251
|
}];
|
|
1259
1252
|
};
|
|
1260
|
-
readonly scopeID: "
|
|
1253
|
+
readonly scopeID: "所属范围ID";
|
|
1261
1254
|
};
|
|
1262
1255
|
readonly params: readonly [{
|
|
1263
1256
|
readonly name: "browseType";
|
|
@@ -1580,19 +1573,12 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
1580
1573
|
readonly display: "获取业务需求列表,支持获取产品下的业务需求";
|
|
1581
1574
|
readonly type: "list";
|
|
1582
1575
|
readonly method: "get";
|
|
1583
|
-
readonly path: "/
|
|
1576
|
+
readonly path: "/products/{productID}/epics";
|
|
1584
1577
|
readonly resultType: "list";
|
|
1585
1578
|
readonly pagerGetter: "pager";
|
|
1586
1579
|
readonly resultGetter: "epics";
|
|
1587
1580
|
readonly pathParams: {
|
|
1588
|
-
readonly
|
|
1589
|
-
readonly description: "业务需求范围";
|
|
1590
|
-
readonly options: readonly [{
|
|
1591
|
-
readonly value: "products";
|
|
1592
|
-
readonly label: "产品";
|
|
1593
|
-
}];
|
|
1594
|
-
};
|
|
1595
|
-
readonly scopeID: "范围ID";
|
|
1581
|
+
readonly productID: "所属产品ID";
|
|
1596
1582
|
};
|
|
1597
1583
|
readonly params: readonly [{
|
|
1598
1584
|
readonly name: "browseType";
|
|
@@ -1906,19 +1892,12 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
1906
1892
|
readonly display: "获取用户需求列表,支持获取产品下的用户需求";
|
|
1907
1893
|
readonly type: "list";
|
|
1908
1894
|
readonly method: "get";
|
|
1909
|
-
readonly path: "/
|
|
1895
|
+
readonly path: "/products/{productID}/requirements";
|
|
1910
1896
|
readonly resultType: "list";
|
|
1911
1897
|
readonly pagerGetter: "pager";
|
|
1912
1898
|
readonly resultGetter: "requirements";
|
|
1913
1899
|
readonly pathParams: {
|
|
1914
|
-
readonly
|
|
1915
|
-
readonly description: "用户需求范围";
|
|
1916
|
-
readonly options: readonly [{
|
|
1917
|
-
readonly value: "products";
|
|
1918
|
-
readonly label: "产品";
|
|
1919
|
-
}];
|
|
1920
|
-
};
|
|
1921
|
-
readonly scopeID: "范围ID";
|
|
1900
|
+
readonly productID: "所属产品ID";
|
|
1922
1901
|
};
|
|
1923
1902
|
readonly params: readonly [{
|
|
1924
1903
|
readonly name: "browseType";
|
|
@@ -2229,7 +2208,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
2229
2208
|
readonly resultGetter: "bugs";
|
|
2230
2209
|
readonly pathParams: {
|
|
2231
2210
|
readonly scope: {
|
|
2232
|
-
readonly description: "Bug
|
|
2211
|
+
readonly description: "Bug所属范围";
|
|
2233
2212
|
readonly options: readonly [{
|
|
2234
2213
|
readonly value: "products";
|
|
2235
2214
|
readonly label: "产品";
|
|
@@ -2241,7 +2220,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
2241
2220
|
readonly label: "执行";
|
|
2242
2221
|
}];
|
|
2243
2222
|
};
|
|
2244
|
-
readonly scopeID: "
|
|
2223
|
+
readonly scopeID: "所属范围ID";
|
|
2245
2224
|
};
|
|
2246
2225
|
readonly params: readonly [{
|
|
2247
2226
|
readonly name: "browseType";
|
|
@@ -2563,7 +2542,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
2563
2542
|
readonly resultGetter: "testcases";
|
|
2564
2543
|
readonly pathParams: {
|
|
2565
2544
|
readonly scope: {
|
|
2566
|
-
readonly description: "
|
|
2545
|
+
readonly description: "测试用例所属范围";
|
|
2567
2546
|
readonly options: readonly [{
|
|
2568
2547
|
readonly value: "products";
|
|
2569
2548
|
readonly label: "产品";
|
|
@@ -2575,7 +2554,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
2575
2554
|
readonly label: "执行";
|
|
2576
2555
|
}];
|
|
2577
2556
|
};
|
|
2578
|
-
readonly scopeID: "
|
|
2557
|
+
readonly scopeID: "所属范围ID";
|
|
2579
2558
|
};
|
|
2580
2559
|
readonly params: readonly [{
|
|
2581
2560
|
readonly name: "browseType";
|
|
@@ -2807,19 +2786,12 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
2807
2786
|
readonly display: "获取任务列表,支持获取执行下的任务";
|
|
2808
2787
|
readonly type: "list";
|
|
2809
2788
|
readonly method: "get";
|
|
2810
|
-
readonly path: "/
|
|
2789
|
+
readonly path: "/executions/{executionID}/tasks";
|
|
2811
2790
|
readonly resultType: "list";
|
|
2812
2791
|
readonly pagerGetter: "pager";
|
|
2813
2792
|
readonly resultGetter: "tasks";
|
|
2814
2793
|
readonly pathParams: {
|
|
2815
|
-
readonly
|
|
2816
|
-
readonly description: "任务范围";
|
|
2817
|
-
readonly options: readonly [{
|
|
2818
|
-
readonly value: "executions";
|
|
2819
|
-
readonly label: "执行";
|
|
2820
|
-
}];
|
|
2821
|
-
};
|
|
2822
|
-
readonly scopeID: "范围ID";
|
|
2794
|
+
readonly executionID: "所属执行ID";
|
|
2823
2795
|
};
|
|
2824
2796
|
readonly params: readonly [{
|
|
2825
2797
|
readonly name: "status";
|
|
@@ -3183,19 +3155,12 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
3183
3155
|
readonly display: "获取反馈列表,支持获取产品下的反馈";
|
|
3184
3156
|
readonly type: "list";
|
|
3185
3157
|
readonly method: "get";
|
|
3186
|
-
readonly path: "/
|
|
3158
|
+
readonly path: "/products/{productID}/feedbacks";
|
|
3187
3159
|
readonly resultType: "list";
|
|
3188
3160
|
readonly pagerGetter: "pager";
|
|
3189
3161
|
readonly resultGetter: "feedbacks";
|
|
3190
3162
|
readonly pathParams: {
|
|
3191
|
-
readonly
|
|
3192
|
-
readonly description: "反馈范围";
|
|
3193
|
-
readonly options: readonly [{
|
|
3194
|
-
readonly value: "products";
|
|
3195
|
-
readonly label: "产品";
|
|
3196
|
-
}];
|
|
3197
|
-
};
|
|
3198
|
-
readonly scopeID: "范围ID";
|
|
3163
|
+
readonly productID: "所属产品ID";
|
|
3199
3164
|
};
|
|
3200
3165
|
readonly params: readonly [{
|
|
3201
3166
|
readonly name: "browseType";
|
|
@@ -3443,19 +3408,12 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
3443
3408
|
readonly display: "获取工单列表,支持获取产品下的工单";
|
|
3444
3409
|
readonly type: "list";
|
|
3445
3410
|
readonly method: "get";
|
|
3446
|
-
readonly path: "/
|
|
3411
|
+
readonly path: "/products/{productID}/tickets";
|
|
3447
3412
|
readonly resultType: "list";
|
|
3448
3413
|
readonly pagerGetter: "pager";
|
|
3449
3414
|
readonly resultGetter: "tickets";
|
|
3450
3415
|
readonly pathParams: {
|
|
3451
|
-
readonly
|
|
3452
|
-
readonly description: "工单范围";
|
|
3453
|
-
readonly options: readonly [{
|
|
3454
|
-
readonly value: "products";
|
|
3455
|
-
readonly label: "产品";
|
|
3456
|
-
}];
|
|
3457
|
-
};
|
|
3458
|
-
readonly scopeID: "范围ID";
|
|
3416
|
+
readonly productID: "所属产品ID";
|
|
3459
3417
|
};
|
|
3460
3418
|
readonly params: readonly [{
|
|
3461
3419
|
readonly name: "browseType";
|
|
@@ -3719,18 +3677,11 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
3719
3677
|
readonly display: "获取应用列表,支持获取产品下的应用";
|
|
3720
3678
|
readonly type: "list";
|
|
3721
3679
|
readonly method: "get";
|
|
3722
|
-
readonly path: "/
|
|
3680
|
+
readonly path: "/products/{productID}/systems";
|
|
3723
3681
|
readonly resultType: "list";
|
|
3724
3682
|
readonly pagerGetter: "pager";
|
|
3725
3683
|
readonly pathParams: {
|
|
3726
|
-
readonly
|
|
3727
|
-
readonly description: "应用范围";
|
|
3728
|
-
readonly options: readonly [{
|
|
3729
|
-
readonly value: "products";
|
|
3730
|
-
readonly label: "产品";
|
|
3731
|
-
}];
|
|
3732
|
-
};
|
|
3733
|
-
readonly scopeID: "范围ID";
|
|
3684
|
+
readonly productID: "所属产品ID";
|
|
3734
3685
|
};
|
|
3735
3686
|
}, {
|
|
3736
3687
|
readonly name: "create";
|
|
@@ -3825,7 +3776,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
3825
3776
|
readonly resultGetter: "builds";
|
|
3826
3777
|
readonly pathParams: {
|
|
3827
3778
|
readonly scope: {
|
|
3828
|
-
readonly description: "
|
|
3779
|
+
readonly description: "版本所属范围";
|
|
3829
3780
|
readonly options: readonly [{
|
|
3830
3781
|
readonly value: "projects";
|
|
3831
3782
|
readonly label: "项目";
|
|
@@ -3834,7 +3785,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
3834
3785
|
readonly label: "执行";
|
|
3835
3786
|
}];
|
|
3836
3787
|
};
|
|
3837
|
-
readonly scopeID: "
|
|
3788
|
+
readonly scopeID: "所属范围ID";
|
|
3838
3789
|
};
|
|
3839
3790
|
}, {
|
|
3840
3791
|
readonly name: "create";
|
|
@@ -3977,7 +3928,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
3977
3928
|
readonly resultGetter: "testtasks";
|
|
3978
3929
|
readonly pathParams: {
|
|
3979
3930
|
readonly scope: {
|
|
3980
|
-
readonly description: "
|
|
3931
|
+
readonly description: "测试单所属范围";
|
|
3981
3932
|
readonly options: readonly [{
|
|
3982
3933
|
readonly value: "products";
|
|
3983
3934
|
readonly label: "产品";
|
|
@@ -3989,7 +3940,7 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
3989
3940
|
readonly label: "执行";
|
|
3990
3941
|
}];
|
|
3991
3942
|
};
|
|
3992
|
-
readonly scopeID: "
|
|
3943
|
+
readonly scopeID: "所属范围ID";
|
|
3993
3944
|
};
|
|
3994
3945
|
}, {
|
|
3995
3946
|
readonly name: "create";
|
|
@@ -4135,19 +4086,12 @@ export declare const BUILTIN_MODULES: readonly [{
|
|
|
4135
4086
|
readonly display: "获取发布列表,支持获取产品下的发布";
|
|
4136
4087
|
readonly type: "list";
|
|
4137
4088
|
readonly method: "get";
|
|
4138
|
-
readonly path: "/
|
|
4089
|
+
readonly path: "/products/{productID}/releases";
|
|
4139
4090
|
readonly resultType: "list";
|
|
4140
4091
|
readonly pagerGetter: "pager";
|
|
4141
4092
|
readonly resultGetter: "releases";
|
|
4142
4093
|
readonly pathParams: {
|
|
4143
|
-
readonly
|
|
4144
|
-
readonly description: "发布范围";
|
|
4145
|
-
readonly options: readonly [{
|
|
4146
|
-
readonly value: "products";
|
|
4147
|
-
readonly label: "产品";
|
|
4148
|
-
}];
|
|
4149
|
-
};
|
|
4150
|
-
readonly scopeID: "范围ID";
|
|
4094
|
+
readonly productID: "所属产品ID";
|
|
4151
4095
|
};
|
|
4152
4096
|
}, {
|
|
4153
4097
|
readonly name: "create";
|
|
@@ -1016,13 +1016,12 @@ export const BUILTIN_MODULES = [
|
|
|
1016
1016
|
display: '获取产品计划列表,支持获取产品下的产品计划',
|
|
1017
1017
|
type: 'list',
|
|
1018
1018
|
method: 'get',
|
|
1019
|
-
path: '/
|
|
1019
|
+
path: '/products/{productID}/productplans',
|
|
1020
1020
|
resultType: 'list',
|
|
1021
1021
|
pagerGetter: 'pager',
|
|
1022
1022
|
resultGetter: 'productplans',
|
|
1023
1023
|
pathParams: {
|
|
1024
|
-
|
|
1025
|
-
scopeID: '范围ID',
|
|
1024
|
+
productID: '所属产品ID',
|
|
1026
1025
|
},
|
|
1027
1026
|
params: [
|
|
1028
1027
|
{
|
|
@@ -1207,8 +1206,8 @@ export const BUILTIN_MODULES = [
|
|
|
1207
1206
|
pagerGetter: 'pager',
|
|
1208
1207
|
resultGetter: 'stories',
|
|
1209
1208
|
pathParams: {
|
|
1210
|
-
scope: { description: '
|
|
1211
|
-
scopeID: '
|
|
1209
|
+
scope: { description: '需求所属范围', options: [{ value: 'products', label: '产品' }, { value: 'projects', label: '项目' }, { value: 'executions', label: '执行' }] },
|
|
1210
|
+
scopeID: '所属范围ID',
|
|
1212
1211
|
},
|
|
1213
1212
|
params: [
|
|
1214
1213
|
{
|
|
@@ -1529,13 +1528,12 @@ export const BUILTIN_MODULES = [
|
|
|
1529
1528
|
display: '获取业务需求列表,支持获取产品下的业务需求',
|
|
1530
1529
|
type: 'list',
|
|
1531
1530
|
method: 'get',
|
|
1532
|
-
path: '/
|
|
1531
|
+
path: '/products/{productID}/epics',
|
|
1533
1532
|
resultType: 'list',
|
|
1534
1533
|
pagerGetter: 'pager',
|
|
1535
1534
|
resultGetter: 'epics',
|
|
1536
1535
|
pathParams: {
|
|
1537
|
-
|
|
1538
|
-
scopeID: '范围ID',
|
|
1536
|
+
productID: '所属产品ID',
|
|
1539
1537
|
},
|
|
1540
1538
|
params: [
|
|
1541
1539
|
{
|
|
@@ -1847,13 +1845,12 @@ export const BUILTIN_MODULES = [
|
|
|
1847
1845
|
display: '获取用户需求列表,支持获取产品下的用户需求',
|
|
1848
1846
|
type: 'list',
|
|
1849
1847
|
method: 'get',
|
|
1850
|
-
path: '/
|
|
1848
|
+
path: '/products/{productID}/requirements',
|
|
1851
1849
|
resultType: 'list',
|
|
1852
1850
|
pagerGetter: 'pager',
|
|
1853
1851
|
resultGetter: 'requirements',
|
|
1854
1852
|
pathParams: {
|
|
1855
|
-
|
|
1856
|
-
scopeID: '范围ID',
|
|
1853
|
+
productID: '所属产品ID',
|
|
1857
1854
|
},
|
|
1858
1855
|
params: [
|
|
1859
1856
|
{
|
|
@@ -2159,8 +2156,8 @@ export const BUILTIN_MODULES = [
|
|
|
2159
2156
|
pagerGetter: 'pager',
|
|
2160
2157
|
resultGetter: 'bugs',
|
|
2161
2158
|
pathParams: {
|
|
2162
|
-
scope: { description: 'Bug
|
|
2163
|
-
scopeID: '
|
|
2159
|
+
scope: { description: 'Bug所属范围', options: [{ value: 'products', label: '产品' }, { value: 'projects', label: '项目' }, { value: 'executions', label: '执行' }] },
|
|
2160
|
+
scopeID: '所属范围ID',
|
|
2164
2161
|
},
|
|
2165
2162
|
params: [
|
|
2166
2163
|
{
|
|
@@ -2476,8 +2473,8 @@ export const BUILTIN_MODULES = [
|
|
|
2476
2473
|
pagerGetter: 'pager',
|
|
2477
2474
|
resultGetter: 'testcases',
|
|
2478
2475
|
pathParams: {
|
|
2479
|
-
scope: { description: '
|
|
2480
|
-
scopeID: '
|
|
2476
|
+
scope: { description: '测试用例所属范围', options: [{ value: 'products', label: '产品' }, { value: 'projects', label: '项目' }, { value: 'executions', label: '执行' }] },
|
|
2477
|
+
scopeID: '所属范围ID',
|
|
2481
2478
|
},
|
|
2482
2479
|
params: [
|
|
2483
2480
|
{
|
|
@@ -2707,13 +2704,12 @@ export const BUILTIN_MODULES = [
|
|
|
2707
2704
|
display: '获取任务列表,支持获取执行下的任务',
|
|
2708
2705
|
type: 'list',
|
|
2709
2706
|
method: 'get',
|
|
2710
|
-
path: '/
|
|
2707
|
+
path: '/executions/{executionID}/tasks',
|
|
2711
2708
|
resultType: 'list',
|
|
2712
2709
|
pagerGetter: 'pager',
|
|
2713
2710
|
resultGetter: 'tasks',
|
|
2714
2711
|
pathParams: {
|
|
2715
|
-
|
|
2716
|
-
scopeID: '范围ID',
|
|
2712
|
+
executionID: '所属执行ID',
|
|
2717
2713
|
},
|
|
2718
2714
|
params: [
|
|
2719
2715
|
{
|
|
@@ -3073,13 +3069,12 @@ export const BUILTIN_MODULES = [
|
|
|
3073
3069
|
display: '获取反馈列表,支持获取产品下的反馈',
|
|
3074
3070
|
type: 'list',
|
|
3075
3071
|
method: 'get',
|
|
3076
|
-
path: '/
|
|
3072
|
+
path: '/products/{productID}/feedbacks',
|
|
3077
3073
|
resultType: 'list',
|
|
3078
3074
|
pagerGetter: 'pager',
|
|
3079
3075
|
resultGetter: 'feedbacks',
|
|
3080
3076
|
pathParams: {
|
|
3081
|
-
|
|
3082
|
-
scopeID: '范围ID',
|
|
3077
|
+
productID: '所属产品ID',
|
|
3083
3078
|
},
|
|
3084
3079
|
params: [
|
|
3085
3080
|
{
|
|
@@ -3320,13 +3315,12 @@ export const BUILTIN_MODULES = [
|
|
|
3320
3315
|
display: '获取工单列表,支持获取产品下的工单',
|
|
3321
3316
|
type: 'list',
|
|
3322
3317
|
method: 'get',
|
|
3323
|
-
path: '/
|
|
3318
|
+
path: '/products/{productID}/tickets',
|
|
3324
3319
|
resultType: 'list',
|
|
3325
3320
|
pagerGetter: 'pager',
|
|
3326
3321
|
resultGetter: 'tickets',
|
|
3327
3322
|
pathParams: {
|
|
3328
|
-
|
|
3329
|
-
scopeID: '范围ID',
|
|
3323
|
+
productID: '所属产品ID',
|
|
3330
3324
|
},
|
|
3331
3325
|
params: [
|
|
3332
3326
|
{
|
|
@@ -3579,12 +3573,11 @@ export const BUILTIN_MODULES = [
|
|
|
3579
3573
|
display: '获取应用列表,支持获取产品下的应用',
|
|
3580
3574
|
type: 'list',
|
|
3581
3575
|
method: 'get',
|
|
3582
|
-
path: '/
|
|
3576
|
+
path: '/products/{productID}/systems',
|
|
3583
3577
|
resultType: 'list',
|
|
3584
3578
|
pagerGetter: 'pager',
|
|
3585
3579
|
pathParams: {
|
|
3586
|
-
|
|
3587
|
-
scopeID: '范围ID',
|
|
3580
|
+
productID: '所属产品ID',
|
|
3588
3581
|
},
|
|
3589
3582
|
}, {
|
|
3590
3583
|
name: 'create',
|
|
@@ -3690,8 +3683,8 @@ export const BUILTIN_MODULES = [
|
|
|
3690
3683
|
pagerGetter: 'pager',
|
|
3691
3684
|
resultGetter: 'builds',
|
|
3692
3685
|
pathParams: {
|
|
3693
|
-
scope: { description: '
|
|
3694
|
-
scopeID: '
|
|
3686
|
+
scope: { description: '版本所属范围', options: [{ value: 'projects', label: '项目' }, { value: 'executions', label: '执行' }] },
|
|
3687
|
+
scopeID: '所属范围ID',
|
|
3695
3688
|
},
|
|
3696
3689
|
}, {
|
|
3697
3690
|
name: 'create',
|
|
@@ -3851,8 +3844,8 @@ export const BUILTIN_MODULES = [
|
|
|
3851
3844
|
pagerGetter: 'pager',
|
|
3852
3845
|
resultGetter: 'testtasks',
|
|
3853
3846
|
pathParams: {
|
|
3854
|
-
scope: { description: '
|
|
3855
|
-
scopeID: '
|
|
3847
|
+
scope: { description: '测试单所属范围', options: [{ value: 'products', label: '产品' }, { value: 'projects', label: '项目' }, { value: 'executions', label: '执行' }] },
|
|
3848
|
+
scopeID: '所属范围ID',
|
|
3856
3849
|
},
|
|
3857
3850
|
}, {
|
|
3858
3851
|
name: 'create',
|
|
@@ -4013,13 +4006,12 @@ export const BUILTIN_MODULES = [
|
|
|
4013
4006
|
display: '获取发布列表,支持获取产品下的发布',
|
|
4014
4007
|
type: 'list',
|
|
4015
4008
|
method: 'get',
|
|
4016
|
-
path: '/
|
|
4009
|
+
path: '/products/{productID}/releases',
|
|
4017
4010
|
resultType: 'list',
|
|
4018
4011
|
pagerGetter: 'pager',
|
|
4019
4012
|
resultGetter: 'releases',
|
|
4020
4013
|
pathParams: {
|
|
4021
|
-
|
|
4022
|
-
scopeID: '范围ID',
|
|
4014
|
+
productID: '所属产品ID',
|
|
4023
4015
|
},
|
|
4024
4016
|
}, {
|
|
4025
4017
|
name: 'create',
|
package/dist/modules/override.js
CHANGED
|
@@ -110,4 +110,18 @@ export function applyBuiltinOverrides() {
|
|
|
110
110
|
return action;
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
|
+
// 为 task/create|update 补充 parent 字段(创建子任务)
|
|
114
|
+
['create', 'update'].forEach((actionName) => {
|
|
115
|
+
extendModuleAction('task', actionName, (action) => {
|
|
116
|
+
const properties = action.requestBody?.schema?.properties;
|
|
117
|
+
if (properties && !properties.parent) {
|
|
118
|
+
properties.parent = {
|
|
119
|
+
type: 'integer',
|
|
120
|
+
description: '父任务',
|
|
121
|
+
format: 'int32',
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return action;
|
|
125
|
+
});
|
|
126
|
+
});
|
|
113
127
|
}
|
package/dist/modules/query.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModuleAction, ModuleDefinition } from '../types/index.js';
|
|
1
|
+
import type { ModuleAction, ModuleActionParam, ModuleActionParamRole, ModuleDefinition } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* 获取模块定义。
|
|
4
4
|
*
|
|
@@ -6,10 +6,9 @@ import type { ModuleAction, ModuleDefinition } from '../types/index.js';
|
|
|
6
6
|
* 任何写入尝试在严格模式下会抛 `TypeError`;如需修改请使用 {@link defineModules}。
|
|
7
7
|
*
|
|
8
8
|
* @param moduleName - 模块名。
|
|
9
|
-
* @returns
|
|
10
|
-
* @throws {ZentaoError} `E_INVALID_MODULE` —— 模块未注册。
|
|
9
|
+
* @returns 已注册的模块定义;模块未注册时返回 `undefined`。
|
|
11
10
|
*/
|
|
12
|
-
export declare function getModule(moduleName: string): ModuleDefinition;
|
|
11
|
+
export declare function getModule(moduleName: string): ModuleDefinition | undefined;
|
|
13
12
|
/**
|
|
14
13
|
* 获取指定模块下的某个动作。
|
|
15
14
|
*
|
|
@@ -23,10 +22,21 @@ export declare function getModule(moduleName: string): ModuleDefinition;
|
|
|
23
22
|
*
|
|
24
23
|
* @param moduleName - 模块名(大小写不敏感)。
|
|
25
24
|
* @param actionName - 动作名(大小写不敏感);支持 `ls` 作为 `list` 的别名。
|
|
26
|
-
* @returns
|
|
27
|
-
* @throws {ZentaoError} `E_INVALID_MODULE`(模块未注册)或 `E_INVALID_ACTION`(动作不存在)。
|
|
25
|
+
* @returns 匹配到的动作定义;模块未注册或动作不存在时返回 `undefined`。
|
|
28
26
|
*/
|
|
29
|
-
export declare function getModuleAction(moduleName: string, actionName: string): ModuleAction;
|
|
27
|
+
export declare function getModuleAction(moduleName: string, actionName: string): ModuleAction | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* 获取指定模块下的某个动作的参数。
|
|
30
|
+
*
|
|
31
|
+
* @param moduleName - 模块名(大小写不敏感)。
|
|
32
|
+
* @param actionName - 动作名(大小写不敏感);支持 `ls` 作为 `list` 的别名。
|
|
33
|
+
* @param options - 选项。
|
|
34
|
+
* @param options.roles - 角色,可选 `path`、`query`、`body`。
|
|
35
|
+
* @returns 动作参数。
|
|
36
|
+
*/
|
|
37
|
+
export declare function getModuleActionParams(moduleName: string, actionName: string, options?: {
|
|
38
|
+
roles?: ModuleActionParamRole[];
|
|
39
|
+
}): ModuleActionParam[];
|
|
30
40
|
/**
|
|
31
41
|
* 返回当前运行时注册表中的所有模块名。
|
|
32
42
|
*
|
package/dist/modules/query.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ZentaoError } from '../misc/errors.js';
|
|
2
1
|
import { getModuleMapState, getModulesState } from './registry-store.js';
|
|
3
2
|
/**
|
|
4
3
|
* 获取模块定义。
|
|
@@ -7,15 +6,10 @@ import { getModuleMapState, getModulesState } from './registry-store.js';
|
|
|
7
6
|
* 任何写入尝试在严格模式下会抛 `TypeError`;如需修改请使用 {@link defineModules}。
|
|
8
7
|
*
|
|
9
8
|
* @param moduleName - 模块名。
|
|
10
|
-
* @returns
|
|
11
|
-
* @throws {ZentaoError} `E_INVALID_MODULE` —— 模块未注册。
|
|
9
|
+
* @returns 已注册的模块定义;模块未注册时返回 `undefined`。
|
|
12
10
|
*/
|
|
13
11
|
export function getModule(moduleName) {
|
|
14
|
-
|
|
15
|
-
if (!module) {
|
|
16
|
-
throw new ZentaoError('E_INVALID_MODULE', { module: moduleName });
|
|
17
|
-
}
|
|
18
|
-
return module;
|
|
12
|
+
return getModuleMapState().get(moduleName.toLowerCase());
|
|
19
13
|
}
|
|
20
14
|
/**
|
|
21
15
|
* 获取指定模块下的某个动作。
|
|
@@ -30,11 +24,12 @@ export function getModule(moduleName) {
|
|
|
30
24
|
*
|
|
31
25
|
* @param moduleName - 模块名(大小写不敏感)。
|
|
32
26
|
* @param actionName - 动作名(大小写不敏感);支持 `ls` 作为 `list` 的别名。
|
|
33
|
-
* @returns
|
|
34
|
-
* @throws {ZentaoError} `E_INVALID_MODULE`(模块未注册)或 `E_INVALID_ACTION`(动作不存在)。
|
|
27
|
+
* @returns 匹配到的动作定义;模块未注册或动作不存在时返回 `undefined`。
|
|
35
28
|
*/
|
|
36
29
|
export function getModuleAction(moduleName, actionName) {
|
|
37
30
|
const module = getModule(moduleName);
|
|
31
|
+
if (!module)
|
|
32
|
+
return undefined;
|
|
38
33
|
const normalized = actionName === 'ls' ? 'list' : actionName;
|
|
39
34
|
const direct = module.actions.find((action) => String(action.name).toLowerCase() === normalized.toLowerCase());
|
|
40
35
|
if (direct)
|
|
@@ -45,7 +40,66 @@ export function getModuleAction(moduleName, actionName) {
|
|
|
45
40
|
if (custom)
|
|
46
41
|
return custom;
|
|
47
42
|
}
|
|
48
|
-
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 获取指定模块下的某个动作的参数。
|
|
47
|
+
*
|
|
48
|
+
* @param moduleName - 模块名(大小写不敏感)。
|
|
49
|
+
* @param actionName - 动作名(大小写不敏感);支持 `ls` 作为 `list` 的别名。
|
|
50
|
+
* @param options - 选项。
|
|
51
|
+
* @param options.roles - 角色,可选 `path`、`query`、`body`。
|
|
52
|
+
* @returns 动作参数。
|
|
53
|
+
*/
|
|
54
|
+
export function getModuleActionParams(moduleName, actionName, options) {
|
|
55
|
+
const { roles } = options ?? {};
|
|
56
|
+
const params = [];
|
|
57
|
+
const action = getModuleAction(moduleName, actionName);
|
|
58
|
+
if (!action) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
if (action.pathParams && (!roles || roles.includes('path'))) {
|
|
62
|
+
Object.entries(action.pathParams).forEach(([name, param]) => {
|
|
63
|
+
if (typeof param === 'string') {
|
|
64
|
+
param = {
|
|
65
|
+
description: param,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
params.push({
|
|
69
|
+
name,
|
|
70
|
+
role: 'path',
|
|
71
|
+
required: true,
|
|
72
|
+
...param,
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (action.params && (!roles || roles.includes('query'))) {
|
|
77
|
+
params.push(...action.params.map(x => ({ ...x, role: 'query' })));
|
|
78
|
+
}
|
|
79
|
+
const schema = action.requestBody?.schema;
|
|
80
|
+
if (schema && (!roles || roles.includes('body'))) {
|
|
81
|
+
if (schema.type === 'object') {
|
|
82
|
+
const requiredSet = new Set(schema.required ? schema.required.map(x => x.toLowerCase()) : []);
|
|
83
|
+
Object.entries(schema.properties).forEach(([name, property]) => {
|
|
84
|
+
params.push({
|
|
85
|
+
name,
|
|
86
|
+
role: 'body',
|
|
87
|
+
required: property.required ?? requiredSet.has(name.toLowerCase()),
|
|
88
|
+
type: (property.type === 'integer' ? 'number' : property.type) ?? 'string',
|
|
89
|
+
...property,
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
params.push({
|
|
95
|
+
name: 'data',
|
|
96
|
+
role: 'body',
|
|
97
|
+
required: true,
|
|
98
|
+
type: schema.type,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return params;
|
|
49
103
|
}
|
|
50
104
|
/**
|
|
51
105
|
* 返回当前运行时注册表中的所有模块名。
|