weaver-work-cli 0.1.32 → 0.1.33
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 -2
- package/dist/chunks/{archive-UMGX72K6.js → archive-FVFY6GZN.js} +2 -2
- package/dist/chunks/{archive-oa-N2IYBLF3.js → archive-oa-NW3OD4UV.js} +2 -2
- package/dist/chunks/{asset-GLEGKFG5.js → asset-7QJKMIDV.js} +2 -2
- package/dist/chunks/{attachment-content-AQNX5N3S.js → attachment-content-OSAVA6K3.js} +3 -2
- package/dist/chunks/{blog-E44OTVDA.js → blog-I7SDPNW4.js} +2 -2
- package/dist/chunks/{caizhilian-DQUFZXZL.js → caizhilian-O37ZIQNY.js} +2 -2
- package/dist/chunks/{calendar-JKPIRKFD.js → calendar-7KXE4ED3.js} +2 -2
- package/dist/chunks/{chunk-4YC43QQ4.js → chunk-2FLWXFVS.js} +4 -4
- package/dist/chunks/{chunk-QWY6PGL6.js → chunk-2LV74IWP.js} +361 -56
- package/dist/chunks/chunk-3SO6QL6U.js +73 -0
- package/dist/chunks/{chunk-DW6AUUKS.js → chunk-6ATGWRZM.js} +6 -4
- package/dist/chunks/chunk-BYATLLEF.js +68 -0
- package/dist/chunks/chunk-BYBSCN4X.js +932 -0
- package/dist/chunks/{chunk-2GA5ZIQL.js → chunk-D223PTXU.js} +1 -0
- package/dist/chunks/{chunk-H7J4DC5R.js → chunk-EEWPQE3O.js} +2 -2
- package/dist/chunks/{chunk-6RKD4DRZ.js → chunk-GFPXQIY2.js} +2 -2
- package/dist/chunks/{chunk-C6R3B2ML.js → chunk-HEL5XTYI.js} +12 -6
- package/dist/chunks/{chunk-CVZ2JOSW.js → chunk-IHUYP6LO.js} +1 -1
- package/dist/chunks/{chunk-YRVDW4WN.js → chunk-ILMBNVSG.js} +2 -2
- package/dist/chunks/{chunk-G3QJULO2.js → chunk-KAS45KNR.js} +1 -1
- package/dist/chunks/{chunk-H6XSTSLM.js → chunk-MEEFGWTM.js} +54 -196
- package/dist/chunks/{chunk-GCG2NMWR.js → chunk-MQ2I5AA3.js} +4 -2
- package/dist/chunks/chunk-NHA62QD7.js +774 -0
- package/dist/chunks/{chunk-WKI2FBIQ.js → chunk-OCU4RLHC.js} +641 -309
- package/dist/chunks/{chunk-WSKBSQ2U.js → chunk-PRHJGPMA.js} +2 -2
- package/dist/chunks/{chunk-6EFWDL7Y.js → chunk-Q6LWB5HX.js} +2 -2
- package/dist/chunks/{chunk-IURUFGZK.js → chunk-RBGOMK4Y.js} +50 -33
- package/dist/chunks/chunk-VBCFFFGT.js +226 -0
- package/dist/chunks/{ebuilder-form-V5FG2EHC.js → chunk-WRRJ4GG2.js} +22 -1148
- package/dist/chunks/{chunk-E4Z23GHM.js → chunk-WY74UBJ6.js} +264 -750
- package/dist/chunks/conflict-SFNEVJY5.js +21 -0
- package/dist/chunks/continuation-RN6PZN2M.js +11 -0
- package/dist/chunks/cowork-CKWYHXYB.js +2508 -0
- package/dist/chunks/ebuilder-form-KOLJRVZD.js +121 -0
- package/dist/chunks/{ehr-HMFY6VIL.js → ehr-WFOC3B4D.js} +1174 -20
- package/dist/chunks/{esb-ZYSVB7SG.js → esb-LJZTN663.js} +4 -4
- package/dist/chunks/{fna-B7RKPAZD.js → fna-F7QRIIZC.js} +2 -2
- package/dist/chunks/{host-45WED2KK.js → host-BCGUVEWX.js} +3 -3
- package/dist/chunks/host-BQBRHVR3.js +23 -0
- package/dist/chunks/{host-I4Z6BFYX.js → host-DGE2TZD4.js} +3 -3
- package/dist/chunks/{host-KNZ52LJZ.js → host-KXPTEWFS.js} +3 -3
- package/dist/chunks/{host-OCH2BCCV.js → host-VQ6JJXGQ.js} +3 -3
- package/dist/chunks/{hrm-2KAZGUHI.js → hrm-NI6XAKW5.js} +3 -3
- package/dist/chunks/{im-ACJJWH4U.js → im-7TRTF3KT.js} +88 -12
- package/dist/chunks/{invoice-ZK3WCX2U.js → invoice-AOXWJKYT.js} +3 -3
- package/dist/chunks/{jiuchuanhui-5PQD3IL2.js → jiuchuanhui-7NQWEZAW.js} +2 -2
- package/dist/chunks/{lazy-dispatch-JQXBW3GM.js → lazy-dispatch-RNS4EE4S.js} +4 -4
- package/dist/chunks/{mail-S2HDDXO2.js → mail-VDHJAB4O.js} +3 -3
- package/dist/chunks/{meeting-QVN3I37L.js → meeting-GA7XCNNP.js} +214 -43
- package/dist/chunks/{okr-QNG4VC2Q.js → okr-TQIRERPQ.js} +2 -2
- package/dist/chunks/operations-5QL3AECO.js +11 -0
- package/dist/chunks/{plan-A25EMW6U.js → plan-4RY4LN2P.js} +2 -2
- package/dist/chunks/{project-G6XV66DZ.js → project-D6XT2OC5.js} +2 -2
- package/dist/chunks/{registry-DC6KR3NH.js → registry-JHRIDQ3A.js} +4 -4
- package/dist/chunks/{registry-2VLUAESA.js → registry-OZSMDVPP.js} +2 -2
- package/dist/chunks/{registry-TI3CIUXF.js → registry-QKMI43Q6.js} +8 -6
- package/dist/chunks/{registry-7C5UMIPL.js → registry-VOGKFFTR.js} +2 -2
- package/dist/chunks/{room-recommend-WRTHO6Y2.js → room-recommend-D4EUOOWY.js} +4 -3
- package/dist/chunks/{schedule-KFIITGSK.js → schedule-XPFBHPCV.js} +4 -3
- package/dist/chunks/{workflow-DJ7SYWAF.js → workflow-HLBZRWIY.js} +172 -6
- package/dist/index.js +30 -25
- package/dist/internal/e10/auth-recovery.js +14 -4
- package/dist/shortcuts/contract/host.js +34 -59
- package/dist/shortcuts/cowork/continuation.js +70 -0
- package/dist/shortcuts/cowork/errors.js +59 -0
- package/dist/shortcuts/cowork/host.js +172 -0
- package/dist/shortcuts/cowork/index.js +166 -0
- package/dist/shortcuts/cowork/manifest.js +65 -0
- package/dist/shortcuts/cowork/operations/discuss-write.js +277 -0
- package/dist/shortcuts/cowork/operations/item-write.js +380 -0
- package/dist/shortcuts/cowork/operations/member-write.js +283 -0
- package/dist/shortcuts/cowork/operations/permission-write.js +286 -0
- package/dist/shortcuts/cowork/operations/read.js +423 -0
- package/dist/shortcuts/cowork/operations/registry.js +39 -0
- package/dist/shortcuts/cowork/operations/review-write.js +157 -0
- package/dist/shortcuts/cowork/operations/shared.js +215 -0
- package/dist/shortcuts/cowork/operations/types.js +24 -0
- package/dist/shortcuts/cowork/operations.js +19 -0
- package/dist/shortcuts/ehr/host.js +4 -1
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +757 -0
- package/dist/shortcuts/ehr/operations/recruit-position.js +367 -0
- package/dist/shortcuts/ehr/operations/recruit-stats.js +133 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +8 -16
- package/dist/shortcuts/ehr/operations/recruit.js +35 -10
- package/dist/shortcuts/ehr/operations/registry.js +6 -0
- package/dist/shortcuts/im/diagnostics.js +97 -0
- package/dist/shortcuts/im/host.js +58 -31
- package/dist/shortcuts/im/index.js +7 -2
- package/dist/shortcuts/im/operations/at-mention.js +127 -0
- package/dist/shortcuts/im/operations/file-user.js +10 -2
- package/dist/shortcuts/im/operations/group-read.js +26 -5
- package/dist/shortcuts/im/operations/group-write.js +35 -28
- package/dist/shortcuts/im/operations/msg-sync.js +7 -2
- package/dist/shortcuts/im/operations/msg-write.js +76 -10
- package/dist/shortcuts/im/operations/quote-mention.js +119 -0
- package/dist/shortcuts/im/operations/session.js +1 -1
- package/dist/shortcuts/im/operations/shared.js +10 -0
- package/dist/shortcuts/im/operations/types.js +13 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/mail/host.js +4 -1
- package/dist/shortcuts/meeting/host.js +27 -34
- package/dist/shortcuts/meeting/operations/create.js +4 -1
- package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -0
- package/dist/shortcuts/meeting/operations/eb/conflict.js +78 -7
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +168 -26
- package/dist/shortcuts/meeting/operations/eb/factory.js +69 -1
- package/dist/shortcuts/meeting/operations/eb/index.js +16 -3
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +14 -3
- package/dist/shortcuts/meeting/operations/eb-fallback.js +159 -0
- package/dist/shortcuts/meeting/operations/env.js +93 -46
- package/dist/shortcuts/meeting/operations/form-fields.js +110 -0
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/meeting/operations/standard-guard.js +71 -0
- package/dist/shortcuts/meeting/operations.js +16 -0
- package/dist/shortcuts/workflow/index.js +110 -1
- package/dist/shortcuts/workflow/operations/form.js +24 -3
- package/dist/shortcuts/workflow/operations/read.js +104 -23
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +448 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupStore.js +106 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/businessRules.js +47 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +30 -23
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +2 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +2 -4
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +138 -181
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +12 -7
- package/docs/e10-auth.md +1 -1
- package/docs/im.md +8 -1
- package/docs/todo-smart-convert/README.md +1 -1
- package/docs/todo-smart-convert/data-contract.md +2 -2
- package/docs/todo-smart-convert/subgroup-rules.md +6 -0
- package/package.json +1 -1
- package/skill-template/domains/yimiaoban.md +3 -3
- package/skill-template/skill-template.md +1 -1
- package/skills/weaver-e10-blog/SKILL.md +5 -5
- package/skills/weaver-e10-caizhilian/SKILL.md +5 -5
- package/skills/weaver-e10-calendar/SKILL.md +5 -5
- package/skills/weaver-e10-esb/SKILL.md +5 -5
- package/skills/weaver-e10-hrm/SKILL.md +5 -5
- package/skills/weaver-e10-jinchengda/SKILL.md +2 -2
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +5 -5
- package/skills/weaver-e10-jucailin/SKILL.md +18 -12
- package/skills/weaver-e10-jucailin/references/recruit-create.md +104 -0
- package/skills/weaver-e10-mail/SKILL.md +5 -5
- package/skills/weaver-e10-meeting/SKILL.md +171 -25
- package/skills/weaver-e10-meeting/references/meeting-eb.md +4 -3
- package/skills/weaver-e10-meeting/references/meeting-queries.md +9 -6
- package/skills/weaver-e10-meeting/references/meeting-verification.md +8 -6
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-okr/SKILL.md +5 -5
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-plan/SKILL.md +5 -5
- package/skills/weaver-e10-shared/SKILL.md +12 -12
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -4
- package/skills/weaver-e10-wenshuding/SKILL.md +5 -5
- package/skills/weaver-e10-workflow/SKILL.md +29 -5
- package/skills/weaver-e10-workflow/aigroup/default.json +88 -0
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +66 -14
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +12 -10
- package/skills/weaver-e10-workflow/references/workflow-view.md +2 -2
- package/skills/weaver-e10-workflow/tools/todo-serve.cjs +239 -0
- package/skills/weaver-e10-workflow/{scripts → tools}/todo-summary.cjs +218 -28
- package/skills/weaver-e10-yepiaotong/SKILL.md +10 -8
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +7 -7
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +10 -10
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +40 -37
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +27 -38
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +37 -29
- package/skills/weaver-e10-yimiaoban/SKILL.md +156 -33
- package/skills/weaver-e10-yimiaoban/references/ding-write.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/error-codes.md +5 -1
- package/skills/weaver-e10-yimiaoban/references/group-read.md +5 -1
- package/skills/weaver-e10-yimiaoban/references/group-write.md +6 -4
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +1 -0
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +34 -2
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +5 -2
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +79 -58
- package/skills/weaver-e10-yimiaoban/references/user-remind.md +2 -2
- package/skills/weaver-e10-ziguanjia/SKILL.md +5 -5
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { coworkConfirmationError, coworkValidationError } from '../errors.js';
|
|
2
|
+
/** 原型污染防护:输入 JSON 不得携带这些键。 */
|
|
3
|
+
const FORBIDDEN_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
4
|
+
export function asObject(value) {
|
|
5
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
6
|
+
throw coworkValidationError('input_not_object', '输入必须是 JSON 对象');
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
export function assertNoForbiddenKeys(input) {
|
|
11
|
+
for (const key of Object.keys(input)) {
|
|
12
|
+
if (FORBIDDEN_KEYS.has(key)) {
|
|
13
|
+
throw coworkValidationError('forbidden_key', `输入包含非法字段:${key}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** 协作所有 ID 都是 18 位大整数,必须以字符串形式保留(JSON number 会丢精度)。 */
|
|
18
|
+
export function toId(value, field) {
|
|
19
|
+
if (value === undefined || value === null || value === '')
|
|
20
|
+
return undefined;
|
|
21
|
+
if (typeof value === 'number' && !Number.isSafeInteger(value)) {
|
|
22
|
+
throw coworkValidationError('id_precision', `${field} 超出安全整数范围,请以字符串传入`);
|
|
23
|
+
}
|
|
24
|
+
const text = String(value).trim();
|
|
25
|
+
if (!/^\d+$/.test(text)) {
|
|
26
|
+
throw coworkValidationError('id_invalid', `${field} 必须是数字 ID:${text}`);
|
|
27
|
+
}
|
|
28
|
+
return text;
|
|
29
|
+
}
|
|
30
|
+
export function toIdList(value, field) {
|
|
31
|
+
if (value === undefined || value === null)
|
|
32
|
+
return undefined;
|
|
33
|
+
if (!Array.isArray(value))
|
|
34
|
+
throw coworkValidationError('id_list_invalid', `${field} 必须是 ID 数组`);
|
|
35
|
+
return value.map((item, index) => {
|
|
36
|
+
const id = toId(item, `${field}[${index}]`);
|
|
37
|
+
if (!id)
|
|
38
|
+
throw coworkValidationError('id_list_invalid', `${field}[${index}] 不能为空`);
|
|
39
|
+
return id;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function toPositiveInt(value, field) {
|
|
43
|
+
if (value === undefined || value === null || value === '')
|
|
44
|
+
return undefined;
|
|
45
|
+
const numeric = Number(value);
|
|
46
|
+
if (!Number.isFinite(numeric)) {
|
|
47
|
+
throw coworkValidationError('number_invalid', `${field} 必须是数字`);
|
|
48
|
+
}
|
|
49
|
+
const truncated = Math.trunc(numeric);
|
|
50
|
+
if (truncated !== numeric || truncated <= 0) {
|
|
51
|
+
throw coworkValidationError('number_invalid', `${field} 必须是正整数`);
|
|
52
|
+
}
|
|
53
|
+
return truncated;
|
|
54
|
+
}
|
|
55
|
+
export function compact(body) {
|
|
56
|
+
for (const key of Object.keys(body)) {
|
|
57
|
+
if (body[key] === undefined)
|
|
58
|
+
delete body[key];
|
|
59
|
+
}
|
|
60
|
+
return body;
|
|
61
|
+
}
|
|
62
|
+
export function assertEnum(value, allowed, field) {
|
|
63
|
+
const text = typeof value === 'string' ? value : String(value);
|
|
64
|
+
if (!allowed.includes(text)) {
|
|
65
|
+
throw coworkValidationError('enum_invalid', `${field} 取值必须是 ${allowed.join(' / ')} 之一`);
|
|
66
|
+
}
|
|
67
|
+
return text;
|
|
68
|
+
}
|
|
69
|
+
export function assertString(value, field, maxLength = 500) {
|
|
70
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
71
|
+
throw coworkValidationError('string_invalid', `${field} 必须是非空字符串`);
|
|
72
|
+
}
|
|
73
|
+
const text = value.trim();
|
|
74
|
+
if (text.length > maxLength) {
|
|
75
|
+
throw coworkValidationError('string_too_long', `${field} 超过 ${maxLength} 字符上限`);
|
|
76
|
+
}
|
|
77
|
+
return text;
|
|
78
|
+
}
|
|
79
|
+
export function assertDateTime(value, field) {
|
|
80
|
+
const text = assertString(value, field, 32);
|
|
81
|
+
if (!/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(text)) {
|
|
82
|
+
throw coworkValidationError('datetime_invalid', `${field} 格式必须是 YYYY-MM-DD HH:mm`);
|
|
83
|
+
}
|
|
84
|
+
return text;
|
|
85
|
+
}
|
|
86
|
+
export function unwrapData(response) {
|
|
87
|
+
if (!response || typeof response !== 'object')
|
|
88
|
+
return response;
|
|
89
|
+
return response.data;
|
|
90
|
+
}
|
|
91
|
+
/** 协作列表的 data 形如 { pageSize, total, current, pageUid, columns[], data[] }。 */
|
|
92
|
+
export function normalizePaged(response) {
|
|
93
|
+
const data = unwrapData(response);
|
|
94
|
+
const page = {};
|
|
95
|
+
const candidates = [data, response];
|
|
96
|
+
for (const source of candidates) {
|
|
97
|
+
if (!source || typeof source !== 'object')
|
|
98
|
+
continue;
|
|
99
|
+
for (const key of ['current', 'pageSize', 'total', 'pageUid', 'tableType']) {
|
|
100
|
+
if (source[key] !== undefined && page[key] === undefined)
|
|
101
|
+
page[key] = source[key];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return { data, page };
|
|
105
|
+
}
|
|
106
|
+
/** 列表归一化:协作列表把行放在 data.data,个别接口用 records/list。 */
|
|
107
|
+
export function normalizeList(response) {
|
|
108
|
+
const { data, page } = normalizePaged(response);
|
|
109
|
+
const payload = data;
|
|
110
|
+
const items = Array.isArray(payload?.data) ? payload.data
|
|
111
|
+
: Array.isArray(payload?.records) ? payload.records
|
|
112
|
+
: Array.isArray(payload?.list) ? payload.list
|
|
113
|
+
: Array.isArray(payload) ? payload
|
|
114
|
+
: [];
|
|
115
|
+
return { data: items, page };
|
|
116
|
+
}
|
|
117
|
+
/** 协作正文(itemContent / clobContent)要求 Base64 编码的 HTML。 */
|
|
118
|
+
export function toBase64Html(text) {
|
|
119
|
+
return Buffer.from(String(text), 'utf8').toString('base64');
|
|
120
|
+
}
|
|
121
|
+
export function requireConfirm(args, action) {
|
|
122
|
+
if (args.confirm !== true) {
|
|
123
|
+
throw coworkConfirmationError(action, { hint: '重新调用时传入 confirm=true 与 prepare 返回的 continuation' });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** 校验 continuation 与当前登录上下文一致,避免切换租户/账号后误执行写操作。 */
|
|
127
|
+
export async function verifyLease(args, action, env) {
|
|
128
|
+
const lease = await env.continuation.verify(args.continuation, action);
|
|
129
|
+
const session = await env.host.getSession();
|
|
130
|
+
if (lease.baseUrl !== session.baseUrl || lease.profile !== session.profile || lease.userId !== session.userId) {
|
|
131
|
+
throw coworkValidationError('context_mismatch', '确认上下文已变化(租户或登录账号不同),请重新执行 prepare');
|
|
132
|
+
}
|
|
133
|
+
return lease;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* 协作主列表族(main / attention / collect / mineDiscuss / mineComment / mineItem / related /
|
|
137
|
+
* apply / approve / log / quit)的通用请求体。
|
|
138
|
+
* 文档给出的固定默认值:itemStatus=1(进行中)、hidden=0(不含隐藏)、type=and。
|
|
139
|
+
*/
|
|
140
|
+
export function buildListBody(args, scope) {
|
|
141
|
+
// 交流审批表口径最窄:只有分页 + 组合方式 + dateType(脚本实测)。
|
|
142
|
+
if (scope === 'discussApprove') {
|
|
143
|
+
return compact({
|
|
144
|
+
current: toPositiveInt(args.current, 'current') ?? 1,
|
|
145
|
+
type: typeof args.type === 'string' && args.type ? args.type : 'and',
|
|
146
|
+
dateType: typeof args.dateType === 'string' ? args.dateType : '',
|
|
147
|
+
...(toPositiveInt(args.pageSize, 'pageSize') !== undefined
|
|
148
|
+
? { pageSize: toPositiveInt(args.pageSize, 'pageSize') }
|
|
149
|
+
: {}),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const body = {
|
|
153
|
+
current: toPositiveInt(args.current, 'current') ?? 1,
|
|
154
|
+
type: typeof args.type === 'string' && args.type ? args.type : 'and',
|
|
155
|
+
};
|
|
156
|
+
const paging = toPositiveInt(args.pageSize, 'pageSize');
|
|
157
|
+
if (paging !== undefined)
|
|
158
|
+
body.pageSize = paging;
|
|
159
|
+
// 条件匹配字段:值 + 匹配模式(in 精确 / bl 模糊),与页面高级搜索一致。
|
|
160
|
+
const conditions = [
|
|
161
|
+
['itemName', 'itemNameCondition'],
|
|
162
|
+
['sectionId', 'sectionCondition'],
|
|
163
|
+
['principal', 'principalCondition'],
|
|
164
|
+
['creator', 'creatorCondition'],
|
|
165
|
+
['tagId', 'tagCondition'],
|
|
166
|
+
['tagCommonId', 'tagCommonCondition'],
|
|
167
|
+
['applyer', 'applyerCondition'],
|
|
168
|
+
['applyerDept', 'applyerDeptCondition'],
|
|
169
|
+
['approver', 'approverCondition'],
|
|
170
|
+
['applyStatus', 'applyStatusCondition'],
|
|
171
|
+
];
|
|
172
|
+
for (const [valueField, conditionField] of conditions) {
|
|
173
|
+
if (args[valueField] === undefined)
|
|
174
|
+
continue;
|
|
175
|
+
const condition = typeof args[conditionField] === 'string' && args[conditionField]
|
|
176
|
+
? String(args[conditionField])
|
|
177
|
+
: 'in';
|
|
178
|
+
body[conditionField] = condition;
|
|
179
|
+
body[valueField] = String(args[valueField]);
|
|
180
|
+
}
|
|
181
|
+
// 状态/隐藏开关只对事项型列表生效(申请/日志/退出列表没有这两个字段)。
|
|
182
|
+
if (scope === 'main' || scope === 'attention' || scope === 'mineItem' || scope === 'apply' || scope === 'itemApprove') {
|
|
183
|
+
body.itemStatus = args.itemStatus === undefined ? '1' : String(args.itemStatus);
|
|
184
|
+
body.hidden = args.hidden === undefined ? '0' : String(args.hidden);
|
|
185
|
+
}
|
|
186
|
+
// 事项审批表的固定条件(脚本实测口径:主题精确 + 版块/负责人/创建人模糊占位)。
|
|
187
|
+
if (scope === 'itemApprove') {
|
|
188
|
+
body.itemNameCondition = body.itemNameCondition ?? 'in';
|
|
189
|
+
body.sectionCondition = body.sectionCondition ?? 'bl';
|
|
190
|
+
body.principalCondition = body.principalCondition ?? 'bl';
|
|
191
|
+
body.creatorCondition = body.creatorCondition ?? 'bl';
|
|
192
|
+
}
|
|
193
|
+
// 交流审批表已在上方单独返回,此处只剩事项型列表。
|
|
194
|
+
if (scope === 'main' && typeof args.creatorSearch === 'string' && args.creatorSearch) {
|
|
195
|
+
body.creatorSearch = args.creatorSearch;
|
|
196
|
+
}
|
|
197
|
+
if (scope === 'collect') {
|
|
198
|
+
body.orderBy = typeof args.orderBy === 'string' && args.orderBy ? args.orderBy : 'collectTime';
|
|
199
|
+
body.sortOrder = typeof args.sortOrder === 'string' && args.sortOrder ? args.sortOrder : 'desc';
|
|
200
|
+
if (args.quickSearchDatas && typeof args.quickSearchDatas === 'object') {
|
|
201
|
+
body.quickSearchDatas = args.quickSearchDatas;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (scope === 'mineDiscuss' || scope === 'mineComment') {
|
|
205
|
+
if (typeof args.tabKey === 'string' && args.tabKey)
|
|
206
|
+
body.tabKey = args.tabKey;
|
|
207
|
+
}
|
|
208
|
+
if (scope === 'mineItem') {
|
|
209
|
+
body.tabKey = typeof args.tabKey === 'string' && args.tabKey ? args.tabKey : 'mineItemCreate';
|
|
210
|
+
}
|
|
211
|
+
if (scope === 'related') {
|
|
212
|
+
body.discussFrom = typeof args.discussFrom === 'string' && args.discussFrom ? args.discussFrom : 'relatedMenu';
|
|
213
|
+
}
|
|
214
|
+
return compact(body);
|
|
215
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const READ = 'read';
|
|
2
|
+
export const READ_BEFORE_WRITE = 'read-before-write';
|
|
3
|
+
export const WRITE = 'write';
|
|
4
|
+
export function coworkSuccess(action, data, meta) {
|
|
5
|
+
const payload = { ok: true, action, data };
|
|
6
|
+
if (meta && Object.keys(meta).length > 0)
|
|
7
|
+
payload.meta = meta;
|
|
8
|
+
return payload;
|
|
9
|
+
}
|
|
10
|
+
/** 构造「对象类型 + 严格禁止额外字段」的 JSON Schema。 */
|
|
11
|
+
export function schemaOf(properties, options = {}) {
|
|
12
|
+
return {
|
|
13
|
+
type: 'object',
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
properties,
|
|
16
|
+
...(options.required?.length ? { required: options.required } : {}),
|
|
17
|
+
...(options.description ? { description: options.description } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export const SCHEMA_ID = { oneOf: [{ type: 'integer' }, { type: 'string', pattern: '^\\d+$' }] };
|
|
21
|
+
export const SCHEMA_ID_LIST = { type: 'array', items: SCHEMA_ID };
|
|
22
|
+
export const SCHEMA_PAGE_CURRENT = { type: 'integer', minimum: 1 };
|
|
23
|
+
export const SCHEMA_PAGE_SIZE = { type: 'integer', minimum: 1, maximum: 200 };
|
|
24
|
+
export const SCHEMA_DATETIME = { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$' };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getCoworkOperation } from './operations/registry.js';
|
|
2
|
+
import { assertNoForbiddenKeys, asObject } from './operations/shared.js';
|
|
3
|
+
export async function executeCoworkOperation(operation, rawInput, context) {
|
|
4
|
+
const definition = getCoworkOperation(operation);
|
|
5
|
+
const input = asObject(rawInput);
|
|
6
|
+
assertNoForbiddenKeys(input);
|
|
7
|
+
const host = {
|
|
8
|
+
request(request) {
|
|
9
|
+
return context.host.request({
|
|
10
|
+
...request,
|
|
11
|
+
operation: request.operation || operation,
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
getSession() {
|
|
15
|
+
return context.host.getSession();
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
return definition.handler(input, { ...context, host });
|
|
19
|
+
}
|
|
@@ -116,7 +116,10 @@ function mapRuntimeNetworkError(error) {
|
|
|
116
116
|
export function createEhrHost(ctx, dependencies = {}) {
|
|
117
117
|
let e10Session = null;
|
|
118
118
|
let sessionContext = null;
|
|
119
|
-
|
|
119
|
+
// 与 workflow 模块同口径(2026-10-29 实测):auth 文件里已有登录时落盘的 userId,
|
|
120
|
+
// 业务命令不需要 teamsCheck 的登录人信息富化 ⇒ 跳过它,省掉每次调用一次串行 HTTPS 往返(实测约 250ms)。
|
|
121
|
+
const requireSession = dependencies.requireSession
|
|
122
|
+
|| ((innerCtx) => requireE10Session(innerCtx, { skipProfileEnrichment: true }));
|
|
120
123
|
async function ensureSession() {
|
|
121
124
|
if (!e10Session) {
|
|
122
125
|
e10Session = await requireSession(ctx);
|