@meet-im/lxcli 0.1.5 → 0.1.6
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.
|
@@ -11,6 +11,13 @@ function parseTaskId(value) {
|
|
|
11
11
|
const taskId = Number(value);
|
|
12
12
|
return Number.isSafeInteger(taskId) && taskId > 0 ? taskId : null;
|
|
13
13
|
}
|
|
14
|
+
function parseNonNegativeInteger(value) {
|
|
15
|
+
if (!/^\d+$/.test(value)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const number = Number(value);
|
|
19
|
+
return Number.isSafeInteger(number) ? number : null;
|
|
20
|
+
}
|
|
14
21
|
export function createKbAction(method) {
|
|
15
22
|
return async (options) => {
|
|
16
23
|
const user = getCurrentUser(options.user);
|
|
@@ -37,8 +44,9 @@ export function createKbAction(method) {
|
|
|
37
44
|
const p = params;
|
|
38
45
|
const hasUserIds = Array.isArray(p.user_ids) && p.user_ids.length > 0;
|
|
39
46
|
const hasOauth2Uid = Array.isArray(p.oauth2_uid) && p.oauth2_uid.length > 0;
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
const hasName = typeof p.name === 'string' && p.name.trim().length > 0;
|
|
48
|
+
if (!hasUserIds && !hasOauth2Uid && !hasName) {
|
|
49
|
+
outputCliError('PARAM_INVALID', 'queryUsers requires at least one of user_ids, oauth2_uid, or name');
|
|
42
50
|
return;
|
|
43
51
|
}
|
|
44
52
|
}
|
|
@@ -112,9 +120,9 @@ export function createKbAction(method) {
|
|
|
112
120
|
params = { title: options.title, project_id: projectId };
|
|
113
121
|
// 可选快捷参数
|
|
114
122
|
if (options.owner_id) {
|
|
115
|
-
const ownerId =
|
|
123
|
+
const ownerId = parseNonNegativeInteger(options.owner_id);
|
|
116
124
|
if (ownerId === null) {
|
|
117
|
-
outputCliError('PARAM_INVALID', '--owner_id must be a
|
|
125
|
+
outputCliError('PARAM_INVALID', '--owner_id must be a non-negative integer');
|
|
118
126
|
return;
|
|
119
127
|
}
|
|
120
128
|
params.owner_id = ownerId;
|
|
@@ -17,7 +17,8 @@ export const PARAM_DEFS = {
|
|
|
17
17
|
],
|
|
18
18
|
queryUsers: [
|
|
19
19
|
{ name: 'user_ids', type: 'array<integer>', required: false, description: 'Kanboard 用户 ID 列表,例如 [18, 23]' },
|
|
20
|
-
{ name: 'oauth2_uid', type: 'array<
|
|
20
|
+
{ name: 'oauth2_uid', type: 'array<integer>', required: false, description: 'Meet 用户 ID 列表,例如 [100861, 100862]' },
|
|
21
|
+
{ name: 'name', type: 'string', required: false, description: '名字关键词;英文字母匹配不区分大小写,同时按字面内容模糊匹配显示名和登录名。user_ids、oauth2_uid 和 name 至少传入一个;多个条件按 OR 组合。' },
|
|
21
22
|
],
|
|
22
23
|
searchTasks: [
|
|
23
24
|
{ name: 'project_id', type: 'integer', required: true, description: '项目 ID。接口按项目检查查看权限。' },
|
|
@@ -46,8 +47,8 @@ export const PARAM_DEFS = {
|
|
|
46
47
|
{ name: 'title', type: 'string', required: true, description: '需求/bug 标题' },
|
|
47
48
|
{ name: 'project_id', type: 'integer', required: true, description: '所属项目 ID。接口按项目检查创建权限。' },
|
|
48
49
|
{ name: 'description', type: 'string', required: false, description: '描述内容(Markdown)' },
|
|
49
|
-
{ name: 'owner_id', type: 'integer', required: false, description: '处理人 Kanboard 用户 ID
|
|
50
|
-
{ name: 'creator_id', type: 'integer', required: false, description: '创建人 Kanboard 用户 ID
|
|
50
|
+
{ name: 'owner_id', type: 'integer', required: false, description: '处理人 Kanboard 用户 ID。处理人必须可分配到该项目;未传或为 0 时默认使用最终创建人。' },
|
|
51
|
+
{ name: 'creator_id', type: 'integer', required: false, description: '创建人 Kanboard 用户 ID。登录态存在时使用当前用户,否则使用传入的 creator_id。' },
|
|
51
52
|
{ name: 'category_id', type: 'integer', required: false, description: '分类 ID。服务端会根据分类和 bug 类型选择泳道。' },
|
|
52
53
|
{ name: 'iteration_id', type: 'integer', required: false, description: '迭代 ID;未传或为 0 时由服务端选择需求池或首个迭代。可用 getAllActiveIterations 查询启用迭代列表,根据 date_start/date_end(Unix 时间戳)确定目标迭代。' },
|
|
53
54
|
{ name: 'date_due', type: 'string', required: false, description: '截止日期,建议使用 YYYY-MM-DD' },
|