weaver-work-cli 0.1.7 → 0.1.20
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 +11 -11
- package/dist/cmd/action.js +76 -0
- package/dist/cmd/index.js +2 -0
- package/dist/cmd/refs/index.js +103 -0
- package/dist/cmd/register.js +31 -0
- package/dist/cmd/root.js +1 -0
- package/dist/cmd/setup/index.js +25 -5
- package/dist/cmd/skills/index.js +37 -5
- package/dist/core/connector.js +54 -0
- package/dist/core/context.js +2 -1
- package/dist/core/input.js +48 -0
- package/dist/core/output.js +298 -3
- package/dist/core/refs.js +432 -0
- package/dist/core/state.js +26 -0
- package/dist/internal/e10/auth/commands.js +2 -2
- package/dist/internal/e10/auth/session.js +14 -0
- package/dist/internal/e10/auth/xiaoe.js +116 -51
- package/dist/internal/e10/request-runtime.js +5 -0
- package/dist/internal/skills/install.js +148 -28
- package/dist/internal/skills/reader.js +12 -9
- package/dist/shortcuts/blog/continuation.js +74 -0
- package/dist/shortcuts/blog/errors.js +60 -0
- package/dist/shortcuts/blog/host.js +175 -0
- package/dist/shortcuts/blog/index.js +324 -0
- package/dist/shortcuts/blog/manifest.js +415 -0
- package/dist/shortcuts/blog/operations/comment.js +125 -0
- package/dist/shortcuts/blog/operations/comments.js +31 -0
- package/dist/shortcuts/blog/operations/edit.js +131 -0
- package/dist/shortcuts/blog/operations/export.js +46 -0
- package/dist/shortcuts/blog/operations/like.js +80 -0
- package/dist/shortcuts/blog/operations/publish.js +157 -0
- package/dist/shortcuts/blog/operations/query-user.js +58 -0
- package/dist/shortcuts/blog/operations/query.js +96 -0
- package/dist/shortcuts/blog/operations/registry.js +54 -0
- package/dist/shortcuts/blog/operations/remind.js +176 -0
- package/dist/shortcuts/blog/operations/shared.js +330 -0
- package/dist/shortcuts/blog/operations/types.js +16 -0
- package/dist/shortcuts/blog/operations.js +9 -0
- package/dist/shortcuts/caizhilian/continuation.js +70 -0
- package/dist/shortcuts/caizhilian/errors.js +53 -0
- package/dist/shortcuts/caizhilian/host.js +190 -0
- package/dist/shortcuts/caizhilian/index.js +186 -0
- package/dist/shortcuts/caizhilian/manifest.js +42 -0
- package/dist/shortcuts/caizhilian/operations/api.js +801 -0
- package/dist/shortcuts/caizhilian/operations/confirm.js +75 -0
- package/dist/shortcuts/caizhilian/operations/files.js +306 -0
- package/dist/shortcuts/caizhilian/operations/form.js +170 -0
- package/dist/shortcuts/caizhilian/operations/handlers/collab.js +611 -0
- package/dist/shortcuts/caizhilian/operations/handlers/document.js +890 -0
- package/dist/shortcuts/caizhilian/operations/handlers/file-collection.js +346 -0
- package/dist/shortcuts/caizhilian/operations/handlers/file-upload.js +192 -0
- package/dist/shortcuts/caizhilian/operations/handlers/fileops.js +570 -0
- package/dist/shortcuts/caizhilian/operations/handlers/folder.js +969 -0
- package/dist/shortcuts/caizhilian/operations/handlers/search.js +318 -0
- package/dist/shortcuts/caizhilian/operations/handlers/setting-attach.js +294 -0
- package/dist/shortcuts/caizhilian/operations/handlers/setting-backup.js +423 -0
- package/dist/shortcuts/caizhilian/operations/handlers/setting-encrypt.js +238 -0
- package/dist/shortcuts/caizhilian/operations/handlers/setting-storage.js +364 -0
- package/dist/shortcuts/caizhilian/operations/handlers/system.js +106 -0
- package/dist/shortcuts/caizhilian/operations/registry.js +151 -0
- package/dist/shortcuts/caizhilian/operations/shared.js +408 -0
- package/dist/shortcuts/caizhilian/operations/specs.js +623 -0
- package/dist/shortcuts/caizhilian/operations/types.js +57 -0
- package/dist/shortcuts/caizhilian/operations.js +21 -0
- package/dist/shortcuts/contract/continuation.js +70 -0
- package/dist/shortcuts/contract/errors.js +62 -0
- package/dist/shortcuts/contract/host.js +205 -0
- package/dist/shortcuts/contract/index.js +318 -0
- package/dist/shortcuts/contract/manifest.js +596 -0
- package/dist/shortcuts/contract/operations/clause-reference.js +78 -0
- package/dist/shortcuts/contract/operations/form-info.js +371 -0
- package/dist/shortcuts/contract/operations/read.js +118 -0
- package/dist/shortcuts/contract/operations/registry.js +43 -0
- package/dist/shortcuts/contract/operations/request.js +300 -0
- package/dist/shortcuts/contract/operations/shared.js +133 -0
- package/dist/shortcuts/contract/operations/subject.js +157 -0
- package/dist/shortcuts/contract/operations/template.js +81 -0
- package/dist/shortcuts/contract/operations/types.js +7 -0
- package/dist/shortcuts/contract/operations/workflow.js +52 -0
- package/dist/shortcuts/contract/operations/write.js +131 -0
- package/dist/shortcuts/contract/operations.js +8 -0
- package/dist/shortcuts/hrm/index.js +83 -2
- package/dist/shortcuts/hrm/operations/employee.js +160 -30
- package/dist/shortcuts/hrm/operations/org.js +17 -3
- package/dist/shortcuts/hrm/operations/position.js +18 -2
- package/dist/shortcuts/index.js +5 -1
- package/dist/shortcuts/invoice/index.js +74 -36
- package/dist/shortcuts/invoice/manifest.js +674 -4
- package/dist/shortcuts/invoice/markdown.js +172 -0
- package/dist/shortcuts/invoice/operations/add.js +3 -3
- package/dist/shortcuts/invoice/operations/delete.js +2 -2
- package/dist/shortcuts/invoice/operations/get.js +10 -2
- package/dist/shortcuts/invoice/operations/import.js +2 -2
- package/dist/shortcuts/invoice/operations/registry.js +8 -1
- package/dist/shortcuts/invoice/operations/reim-auto.js +719 -0
- package/dist/shortcuts/invoice/operations/reim.js +85 -2
- package/dist/shortcuts/invoice/operations/shared.js +75 -8
- package/dist/shortcuts/invoice/operations/update.js +2 -2
- package/dist/shortcuts/invoice/operations/upload-and-validate.js +93 -0
- package/dist/shortcuts/invoice/operations/validate-preview.js +2 -1
- package/dist/shortcuts/invoice/projection.js +328 -0
- package/dist/shortcuts/meeting/host.js +18 -1
- package/dist/shortcuts/meeting/manifest.js +30 -18
- package/dist/shortcuts/meeting/operations/eb/catalog.js +390 -0
- package/dist/shortcuts/meeting/operations/eb/conflict.js +389 -0
- package/dist/shortcuts/meeting/operations/eb/factory.js +389 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +22 -0
- package/dist/shortcuts/meeting/operations/env.js +8 -1
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/meeting/operations/signs.js +216 -2
- package/dist/shortcuts/workflow/endpoints.js +2 -1
- package/dist/shortcuts/workflow/errors.js +8 -2
- package/dist/shortcuts/workflow/host.js +6 -3
- package/dist/shortcuts/workflow/operations/form.js +931 -533
- package/dist/shortcuts/workflow/operations/read.js +462 -81
- package/dist/shortcuts/workflow/operations/shared.js +44 -0
- package/dist/shortcuts/workflow/operations/write.js +760 -56
- package/dist/shortcuts/workflow/operations.js +36 -10
- package/docs/_catalog.md +6 -0
- package/docs/agent-invoice.md +5 -1
- package/docs/agent-io-channel-design.md +468 -0
- package/docs/agent-skill-install.md +9 -4
- package/docs/blog.md +123 -0
- package/docs/caizhilian.md +304 -0
- package/docs/contract.md +91 -0
- package/docs/e10-auth.md +2 -2
- package/docs/hrm.md +19 -9
- package/docs/invoice.md +5 -1
- package/docs/meeting.md +1 -1
- package/docs/operation-manual.md +15 -3
- package/docs/skill-review-2026-09-19.md +2 -2
- package/package.json +2 -2
- package/scripts/package-skill.mjs +33 -20
- package/skill-template/business-info.json +113 -14
- package/skill-template/domains/blog.md +24 -0
- package/skill-template/domains/caizhilian.md +22 -0
- package/skill-template/domains/jinchengda.md +23 -0
- package/skill-template/domains/meeting.md +1 -1
- package/skill-template/domains/workflow.md +1 -1
- package/skill-template/skill-template.md +1 -1
- package/skills/weaver-e10-blog/SKILL.md +111 -0
- package/skills/weaver-e10-blog/references/blog-comment.md +51 -0
- package/skills/weaver-e10-blog/references/blog-comments.md +39 -0
- package/skills/weaver-e10-blog/references/blog-default-permission.md +38 -0
- package/skills/weaver-e10-blog/references/blog-disabled-capabilities.md +11 -0
- package/skills/weaver-e10-blog/references/blog-edit.md +51 -0
- package/skills/weaver-e10-blog/references/blog-export.md +42 -0
- package/skills/weaver-e10-blog/references/blog-like.md +50 -0
- package/skills/weaver-e10-blog/references/blog-publish.md +52 -0
- package/skills/weaver-e10-blog/references/blog-query-user.md +45 -0
- package/skills/weaver-e10-blog/references/blog-query.md +49 -0
- package/skills/weaver-e10-blog/references/blog-remind.md +51 -0
- package/skills/weaver-e10-blog/references/blog-resolve-users.md +38 -0
- package/skills/weaver-e10-blog/references/source-manifest.json +1540 -0
- package/skills/weaver-e10-caizhilian/SKILL.md +216 -0
- package/skills/weaver-e10-caizhilian/references/agent-entry.md +106 -0
- package/skills/weaver-e10-caizhilian/references/collaboration.md +112 -0
- package/skills/weaver-e10-caizhilian/references/document.md +111 -0
- package/skills/weaver-e10-caizhilian/references/file-collection.md +136 -0
- package/skills/weaver-e10-caizhilian/references/file-upload.md +309 -0
- package/skills/weaver-e10-caizhilian/references/files.md +120 -0
- package/skills/weaver-e10-caizhilian/references/folder.md +118 -0
- package/skills/weaver-e10-caizhilian/references/org-browser.md +104 -0
- package/skills/weaver-e10-caizhilian/references/setting-attach.md +410 -0
- package/skills/weaver-e10-caizhilian/references/setting-backup.md +372 -0
- package/skills/weaver-e10-caizhilian/references/setting-encrypt.md +399 -0
- package/skills/weaver-e10-caizhilian/references/setting-storage.md +603 -0
- package/skills/weaver-e10-caizhilian/references/source-manifest.json +5079 -0
- package/skills/weaver-e10-caizhilian/references/withheld.md +93 -0
- package/skills/weaver-e10-caizhilian/references/write-protocol.md +120 -0
- package/skills/weaver-e10-calendar/SKILL.md +4 -3
- package/skills/weaver-e10-ebuilder-form/SKILL.md +4 -9
- package/skills/weaver-e10-ebuilder-form/references/context-routing.md +0 -9
- package/skills/weaver-e10-ebuilder-form/references/custom-api.md +1 -5
- package/skills/weaver-e10-ebuilder-form/references/fields-browser.md +1 -5
- package/skills/weaver-e10-ebuilder-form/references/list-nlist.md +1 -5
- package/skills/weaver-e10-ebuilder-form/references/openapi-read.md +1 -5
- package/skills/weaver-e10-ebuilder-form/references/openapi-write.md +1 -5
- package/skills/weaver-e10-esb/SKILL.md +2 -2
- package/skills/weaver-e10-esb/references/source-manifest.json +9 -9
- package/skills/weaver-e10-hrm/SKILL.md +54 -6
- package/skills/weaver-e10-hrm/references/employee.md +89 -15
- package/skills/weaver-e10-hrm/references/org.md +7 -4
- package/skills/weaver-e10-hrm/references/position.md +14 -7
- package/skills/weaver-e10-hrm/references/source-manifest.json +1 -1
- package/skills/weaver-e10-jinchengda/SKILL.md +166 -0
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +82 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +69 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +78 -0
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +27 -0
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +71 -0
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +94 -0
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +89 -0
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +77 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +66 -0
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +94 -0
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +259 -0
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +5 -11
- package/skills/weaver-e10-jucailin/SKILL.md +4 -3
- package/skills/weaver-e10-mail/SKILL.md +4 -11
- package/skills/weaver-e10-meeting/SKILL.md +66 -32
- package/skills/weaver-e10-meeting/references/meeting-change.md +5 -2
- package/skills/weaver-e10-meeting/references/meeting-create.md +2 -1
- package/skills/weaver-e10-meeting/references/meeting-eb.md +114 -0
- package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +9 -8
- package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +35 -7
- package/skills/weaver-e10-meeting/references/meeting-update.md +1 -1
- package/skills/weaver-e10-okr/SKILL.md +6 -11
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-plan/SKILL.md +3 -3
- package/skills/weaver-e10-plan/references/plan-collect-and-compose.md +1 -1
- package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +1 -1
- package/skills/weaver-e10-plan/references/source-manifest.json +13 -13
- package/skills/weaver-e10-qiyecheng/SKILL.md +4 -10
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +9 -9
- package/skills/weaver-e10-shared/SKILL.md +36 -25
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +10 -31
- package/skills/weaver-e10-shared/references/json-output-contract.md +20 -11
- package/skills/weaver-e10-shijingran/SKILL.md +2 -1
- package/skills/weaver-e10-shijingran/references/source-manifest.json +9 -9
- package/skills/weaver-e10-skill-maker/SKILL.md +4 -10
- package/skills/weaver-e10-skill-maker/references/business-skill-generation.md +5 -3
- package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +12 -27
- package/skills/weaver-e10-skill-maker/references/module-gap-audit-and-repair.md +17 -5
- package/skills/weaver-e10-skill-maker/references/source-update-detection.md +4 -27
- package/skills/weaver-e10-wenshuding/SKILL.md +5 -16
- package/skills/weaver-e10-wenshuding/references/source-manifest.json +7 -7
- package/skills/weaver-e10-workflow/SKILL.md +32 -37
- package/skills/weaver-e10-workflow/references/source-manifest.json +40 -77
- package/skills/weaver-e10-workflow/references/workflow-batch.md +90 -29
- package/skills/weaver-e10-workflow/references/workflow-create.md +79 -109
- package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -9
- package/skills/weaver-e10-workflow/references/workflow-operate.md +2 -2
- package/skills/weaver-e10-workflow/references/workflow-query.md +37 -20
- package/skills/weaver-e10-workflow/references/workflow-share.md +18 -2
- package/skills/weaver-e10-workflow/references/workflow-view.md +4 -4
- package/skills/weaver-e10-yepiaotong/SKILL.md +75 -39
- package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +22 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +3 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing.md +5 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +135 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +15 -3
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-summarize.py +217 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +88 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +7 -2
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +90 -10
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +1 -0
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +70 -49
- package/skills/weaver-e10-yepiaotong/references/reim-fast-path.md +119 -0
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +55 -36
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +4 -0
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +149 -0
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +125 -5
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +430 -63
- package/skills/weaver-e10-yimiaoban/SKILL.md +4 -12
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
- package/skills/weaver-e10-ziguanjia/SKILL.md +2 -1
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +3 -3
- package/tools/weaver-skill-detector-1.0.13/SKILL.md +9 -9
- package/tools/weaver-skill-detector-1.0.13/references/checklist.md +3 -3
- package/tools/weaver-skill-detector-1.0.13/scripts/__pycache__/validate_skill.cpython-313.pyc +0 -0
- package/tools/weaver-skill-detector-1.0.13/scripts/validate_skill.py +98 -91
- package/scripts/sync-connector-skills.mjs +0 -172
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* caizhilian.file-collection — 文件采集(FTP/SFTP)
|
|
3
|
+
*
|
|
4
|
+
* 覆盖文件采集的生命周期:
|
|
5
|
+
* - 任务列表/详情/删除
|
|
6
|
+
* - 扫描/运行/取消
|
|
7
|
+
* - 进度查询/结果查询
|
|
8
|
+
*
|
|
9
|
+
* 接口:
|
|
10
|
+
* - 列任务:GET /api/file/coll/taskTable
|
|
11
|
+
* - 读表单:GET /api/file/coll/taskForm
|
|
12
|
+
* - 保存任务:POST /api/file/coll/save
|
|
13
|
+
* - 另存为:POST /api/file/coll/saveAs
|
|
14
|
+
* - 检查存储:GET /api/file/coll/checkStorageConnect
|
|
15
|
+
* - 扫描:POST /api/file/coll/scan
|
|
16
|
+
* - 扫描进度:GET /api/file/coll/scan/progress
|
|
17
|
+
* - 运行/暂停:POST /api/file/coll/run
|
|
18
|
+
* - 运行进度:GET /api/file/coll/run/progress
|
|
19
|
+
* - 详情:GET /api/file/coll/detailTable
|
|
20
|
+
* - 取消:POST /api/file/coll/cancel
|
|
21
|
+
* - 删除:POST /api/file/coll/delete
|
|
22
|
+
*/
|
|
23
|
+
import { CaizhilianCliError } from '../../errors.js';
|
|
24
|
+
import { caizhilianSuccess } from '../types.js';
|
|
25
|
+
import { requireId } from '../shared.js';
|
|
26
|
+
const ACTION = 'caizhilian.file-collection';
|
|
27
|
+
// ── 接口路径 ──────────────────────────────────────────────
|
|
28
|
+
const LIST_TASKS_PATH = '/api/file/coll/taskTable';
|
|
29
|
+
const GET_TASK_FORM_PATH = '/api/file/coll/taskForm';
|
|
30
|
+
const SAVE_TASK_PATH = '/api/file/coll/save';
|
|
31
|
+
const SAVE_AS_TASK_PATH = '/api/file/coll/saveAs';
|
|
32
|
+
const CHECK_STORAGE_PATH = '/api/file/coll/checkStorageConnect';
|
|
33
|
+
const SCAN_PATH = '/api/file/coll/scan';
|
|
34
|
+
const SCAN_PROGRESS_PATH = '/api/file/coll/scan/progress';
|
|
35
|
+
const RUN_PATH = '/api/file/coll/run';
|
|
36
|
+
const RUN_PROGRESS_PATH = '/api/file/coll/run/progress';
|
|
37
|
+
const DETAIL_TABLE_PATH = '/api/file/coll/detailTable';
|
|
38
|
+
const CANCEL_PATH = '/api/file/coll/cancel';
|
|
39
|
+
const DELETE_PATH = '/api/file/coll/delete';
|
|
40
|
+
// ── 辅助函数 ──────────────────────────────────────────────
|
|
41
|
+
function asRecord(value) {
|
|
42
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
43
|
+
}
|
|
44
|
+
function asList(value) {
|
|
45
|
+
return Array.isArray(value) ? value : [];
|
|
46
|
+
}
|
|
47
|
+
function isPlainObject(value) {
|
|
48
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
49
|
+
}
|
|
50
|
+
// ── 列出采集任务 ──────────────────────────────────────────
|
|
51
|
+
async function listTasks(args, env) {
|
|
52
|
+
const response = await env.host.request({
|
|
53
|
+
method: 'GET',
|
|
54
|
+
path: LIST_TASKS_PATH,
|
|
55
|
+
operation: ACTION,
|
|
56
|
+
});
|
|
57
|
+
const data = asRecord(response);
|
|
58
|
+
if (!data.status && !data.success) {
|
|
59
|
+
throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '查询采集任务失败'), {
|
|
60
|
+
code: data.code ?? data.status,
|
|
61
|
+
details: { action: ACTION, message: String(data.msg || data.message || '查询采集任务失败') },
|
|
62
|
+
exitCode: 1,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const result = asRecord(data.data);
|
|
66
|
+
const tasks = asList(result.data || result).map((item) => ({
|
|
67
|
+
id: item.id,
|
|
68
|
+
name: item.taskName || '',
|
|
69
|
+
status: item.status || '',
|
|
70
|
+
source_type: item.sourceType || '',
|
|
71
|
+
create_time: item.createTime || '',
|
|
72
|
+
}));
|
|
73
|
+
return caizhilianSuccess(ACTION, {
|
|
74
|
+
tasks,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// ── 获取采集任务详情 ──────────────────────────────────────
|
|
78
|
+
async function getTaskForm(args, env) {
|
|
79
|
+
const taskId = args.id ? requireId(args.id, 'id') : '';
|
|
80
|
+
const url = taskId ? `${GET_TASK_FORM_PATH}?id=${taskId}` : GET_TASK_FORM_PATH;
|
|
81
|
+
const response = await env.host.request({
|
|
82
|
+
method: 'GET',
|
|
83
|
+
path: url,
|
|
84
|
+
operation: ACTION,
|
|
85
|
+
});
|
|
86
|
+
const data = asRecord(response);
|
|
87
|
+
if (!data.status && !data.success) {
|
|
88
|
+
throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '查询采集任务失败'), {
|
|
89
|
+
code: data.code ?? data.status,
|
|
90
|
+
details: { action: ACTION, message: String(data.msg || data.message || '查询采集任务失败') },
|
|
91
|
+
exitCode: 1,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const result = asRecord(data.data);
|
|
95
|
+
return caizhilianSuccess(ACTION, {
|
|
96
|
+
form: result,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
// ── 检查存储连接 ──────────────────────────────────────────
|
|
100
|
+
async function checkStorage(args, env) {
|
|
101
|
+
const response = await env.host.request({
|
|
102
|
+
method: 'GET',
|
|
103
|
+
path: CHECK_STORAGE_PATH,
|
|
104
|
+
operation: ACTION,
|
|
105
|
+
});
|
|
106
|
+
const data = asRecord(response);
|
|
107
|
+
const connected = data.data ?? data.status ?? data.success;
|
|
108
|
+
return caizhilianSuccess(ACTION, {
|
|
109
|
+
connected: !!connected,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
// ── 扫描(prepare/apply)──────────────────────────────────────
|
|
113
|
+
async function scanPrepare(args, env) {
|
|
114
|
+
const taskId = requireId(args.task_id, 'task_id');
|
|
115
|
+
const fullColl = args.full_coll ?? false;
|
|
116
|
+
// 签发 continuation
|
|
117
|
+
const continuation = await env.continuation.issue({
|
|
118
|
+
operation: 'caizhilian.file-collection.scan.apply',
|
|
119
|
+
taskId,
|
|
120
|
+
fullColl,
|
|
121
|
+
});
|
|
122
|
+
return caizhilianSuccess('caizhilian.file-collection.scan.prepare', {
|
|
123
|
+
task_id: taskId,
|
|
124
|
+
full_coll: fullColl,
|
|
125
|
+
continuation,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async function scanApply(args, env, lease) {
|
|
129
|
+
const taskId = lease.payload?.taskId;
|
|
130
|
+
const fullColl = lease.payload?.fullColl;
|
|
131
|
+
const response = await env.host.request({
|
|
132
|
+
method: 'POST',
|
|
133
|
+
path: SCAN_PATH,
|
|
134
|
+
body: { taskId, fullColl },
|
|
135
|
+
operation: 'caizhilian.file-collection.scan.apply',
|
|
136
|
+
});
|
|
137
|
+
const data = asRecord(response);
|
|
138
|
+
if (!data.status && !data.success) {
|
|
139
|
+
throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '扫描失败'), {
|
|
140
|
+
code: data.code ?? data.status,
|
|
141
|
+
details: { action: 'caizhilian.file-collection.scan.apply', message: String(data.msg || data.message || '扫描失败') },
|
|
142
|
+
exitCode: 1,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const result = asRecord(data.data);
|
|
146
|
+
return caizhilianSuccess('caizhilian.file-collection.scan.apply', {
|
|
147
|
+
runtime_id: result.runtimeId || result.id || '',
|
|
148
|
+
status: result.status || '',
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
// ── 扫描进度 ──────────────────────────────────────────────
|
|
152
|
+
async function scanProgress(args, env) {
|
|
153
|
+
const response = await env.host.request({
|
|
154
|
+
method: 'GET',
|
|
155
|
+
path: SCAN_PROGRESS_PATH,
|
|
156
|
+
operation: ACTION,
|
|
157
|
+
});
|
|
158
|
+
const data = asRecord(response);
|
|
159
|
+
if (!data.status && !data.success) {
|
|
160
|
+
throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '查询扫描进度失败'), {
|
|
161
|
+
code: data.code ?? data.status,
|
|
162
|
+
details: { action: ACTION, message: String(data.msg || data.message || '查询扫描进度失败') },
|
|
163
|
+
exitCode: 1,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const result = asRecord(data.data);
|
|
167
|
+
return caizhilianSuccess(ACTION, {
|
|
168
|
+
progress: result,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
// ── 运行/暂停(prepare/apply)──────────────────────────────────────
|
|
172
|
+
async function runPrepare(args, env) {
|
|
173
|
+
const taskId = requireId(args.task_id, 'task_id');
|
|
174
|
+
const action = args.action || 'run';
|
|
175
|
+
// 签发 continuation
|
|
176
|
+
const continuation = await env.continuation.issue({
|
|
177
|
+
operation: 'caizhilian.file-collection.run.apply',
|
|
178
|
+
taskId,
|
|
179
|
+
action,
|
|
180
|
+
});
|
|
181
|
+
return caizhilianSuccess('caizhilian.file-collection.run.prepare', {
|
|
182
|
+
task_id: taskId,
|
|
183
|
+
action,
|
|
184
|
+
continuation,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
async function runApply(args, env, lease) {
|
|
188
|
+
const taskId = lease.payload?.taskId;
|
|
189
|
+
const action = lease.payload?.action;
|
|
190
|
+
const response = await env.host.request({
|
|
191
|
+
method: 'POST',
|
|
192
|
+
path: RUN_PATH,
|
|
193
|
+
body: { taskId, action },
|
|
194
|
+
operation: 'caizhilian.file-collection.run.apply',
|
|
195
|
+
});
|
|
196
|
+
const data = asRecord(response);
|
|
197
|
+
if (!data.status && !data.success) {
|
|
198
|
+
throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '运行失败'), {
|
|
199
|
+
code: data.code ?? data.status,
|
|
200
|
+
details: { action: 'caizhilian.file-collection.run.apply', message: String(data.msg || data.message || '运行失败') },
|
|
201
|
+
exitCode: 1,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
const result = asRecord(data.data);
|
|
205
|
+
return caizhilianSuccess('caizhilian.file-collection.run.apply', {
|
|
206
|
+
status: result.status || '',
|
|
207
|
+
action,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
// ── 运行进度 ──────────────────────────────────────────────
|
|
211
|
+
async function runProgress(args, env) {
|
|
212
|
+
const response = await env.host.request({
|
|
213
|
+
method: 'GET',
|
|
214
|
+
path: RUN_PROGRESS_PATH,
|
|
215
|
+
operation: ACTION,
|
|
216
|
+
});
|
|
217
|
+
const data = asRecord(response);
|
|
218
|
+
if (!data.status && !data.success) {
|
|
219
|
+
throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '查询运行进度失败'), {
|
|
220
|
+
code: data.code ?? data.status,
|
|
221
|
+
details: { action: ACTION, message: String(data.msg || data.message || '查询运行进度失败') },
|
|
222
|
+
exitCode: 1,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
const result = asRecord(data.data);
|
|
226
|
+
return caizhilianSuccess(ACTION, {
|
|
227
|
+
progress: result,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
// ── 采集详情 ──────────────────────────────────────────────
|
|
231
|
+
async function detailTable(args, env) {
|
|
232
|
+
const response = await env.host.request({
|
|
233
|
+
method: 'GET',
|
|
234
|
+
path: DETAIL_TABLE_PATH,
|
|
235
|
+
operation: ACTION,
|
|
236
|
+
});
|
|
237
|
+
const data = asRecord(response);
|
|
238
|
+
if (!data.status && !data.success) {
|
|
239
|
+
throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '查询采集详情失败'), {
|
|
240
|
+
code: data.code ?? data.status,
|
|
241
|
+
details: { action: ACTION, message: String(data.msg || data.message || '查询采集详情失败') },
|
|
242
|
+
exitCode: 1,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
const result = asRecord(data.data);
|
|
246
|
+
return caizhilianSuccess(ACTION, {
|
|
247
|
+
details: result,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
// ── 取消采集(prepare/apply)──────────────────────────────────────
|
|
251
|
+
async function cancelPrepare(args, env) {
|
|
252
|
+
const taskId = requireId(args.task_id, 'task_id');
|
|
253
|
+
// 签发 continuation
|
|
254
|
+
const continuation = await env.continuation.issue({
|
|
255
|
+
operation: 'caizhilian.file-collection.cancel.apply',
|
|
256
|
+
taskId,
|
|
257
|
+
});
|
|
258
|
+
return caizhilianSuccess('caizhilian.file-collection.cancel.prepare', {
|
|
259
|
+
task_id: taskId,
|
|
260
|
+
continuation,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
async function cancelApply(args, env, lease) {
|
|
264
|
+
const taskId = lease.payload?.taskId;
|
|
265
|
+
const response = await env.host.request({
|
|
266
|
+
method: 'POST',
|
|
267
|
+
path: CANCEL_PATH,
|
|
268
|
+
body: { taskId },
|
|
269
|
+
operation: 'caizhilian.file-collection.cancel.apply',
|
|
270
|
+
});
|
|
271
|
+
const data = asRecord(response);
|
|
272
|
+
if (!data.status && !data.success) {
|
|
273
|
+
throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '取消失败'), {
|
|
274
|
+
code: data.code ?? data.status,
|
|
275
|
+
details: { action: 'caizhilian.file-collection.cancel.apply', message: String(data.msg || data.message || '取消失败') },
|
|
276
|
+
exitCode: 1,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return caizhilianSuccess('caizhilian.file-collection.cancel.apply', {
|
|
280
|
+
cancelled: true,
|
|
281
|
+
task_id: taskId,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
// ── 删除采集任务(prepare/apply)──────────────────────────────────────
|
|
285
|
+
async function deleteTaskPrepare(args, env) {
|
|
286
|
+
const taskId = requireId(args.task_id, 'task_id');
|
|
287
|
+
// 签发 continuation
|
|
288
|
+
const continuation = await env.continuation.issue({
|
|
289
|
+
operation: 'caizhilian.file-collection.delete.apply',
|
|
290
|
+
taskId,
|
|
291
|
+
});
|
|
292
|
+
return caizhilianSuccess('caizhilian.file-collection.delete.prepare', {
|
|
293
|
+
task_id: taskId,
|
|
294
|
+
continuation,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
async function deleteTaskApply(args, env, lease) {
|
|
298
|
+
const taskId = lease.payload?.taskId;
|
|
299
|
+
const response = await env.host.request({
|
|
300
|
+
method: 'POST',
|
|
301
|
+
path: DELETE_PATH,
|
|
302
|
+
body: { taskId },
|
|
303
|
+
operation: 'caizhilian.file-collection.delete.apply',
|
|
304
|
+
});
|
|
305
|
+
const data = asRecord(response);
|
|
306
|
+
if (!data.status && !data.success) {
|
|
307
|
+
throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '删除失败'), {
|
|
308
|
+
code: data.code ?? data.status,
|
|
309
|
+
details: { action: 'caizhilian.file-collection.delete.apply', message: String(data.msg || data.message || '删除失败') },
|
|
310
|
+
exitCode: 1,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
return caizhilianSuccess('caizhilian.file-collection.delete.apply', {
|
|
314
|
+
deleted: true,
|
|
315
|
+
task_id: taskId,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
// ── 处理器汇总 ────────────────────────────────────────────
|
|
319
|
+
export const caizhilianFileCollectionHandlers = {
|
|
320
|
+
'caizhilian.file-collection.task.list': { execute: listTasks },
|
|
321
|
+
'caizhilian.file-collection.task.form': { execute: getTaskForm },
|
|
322
|
+
'caizhilian.file-collection.storage.check': { execute: checkStorage },
|
|
323
|
+
'caizhilian.file-collection.scan': {
|
|
324
|
+
prepare: scanPrepare,
|
|
325
|
+
apply: scanApply,
|
|
326
|
+
targetKeys: ['task_id'],
|
|
327
|
+
},
|
|
328
|
+
'caizhilian.file-collection.scan.progress': { execute: scanProgress },
|
|
329
|
+
'caizhilian.file-collection.run': {
|
|
330
|
+
prepare: runPrepare,
|
|
331
|
+
apply: runApply,
|
|
332
|
+
targetKeys: ['task_id'],
|
|
333
|
+
},
|
|
334
|
+
'caizhilian.file-collection.run.progress': { execute: runProgress },
|
|
335
|
+
'caizhilian.file-collection.detail': { execute: detailTable },
|
|
336
|
+
'caizhilian.file-collection.cancel': {
|
|
337
|
+
prepare: cancelPrepare,
|
|
338
|
+
apply: cancelApply,
|
|
339
|
+
targetKeys: ['task_id'],
|
|
340
|
+
},
|
|
341
|
+
'caizhilian.file-collection.delete': {
|
|
342
|
+
prepare: deleteTaskPrepare,
|
|
343
|
+
apply: deleteTaskApply,
|
|
344
|
+
targetKeys: ['task_id'],
|
|
345
|
+
},
|
|
346
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* caizhilian.file-upload — 文件上传(本地文件上传到文件服务)
|
|
3
|
+
*
|
|
4
|
+
* 覆盖本地文件上传到 E10 文件服务的完整流程:
|
|
5
|
+
* - contract: 获取上传接口合约
|
|
6
|
+
* - prepare: 本地文件校验与元数据准备
|
|
7
|
+
* - upload: 上传文件并获取 fileId
|
|
8
|
+
*
|
|
9
|
+
* 接口:
|
|
10
|
+
* - 预检查:POST /api/file/preUploadCheck?sf_request_type=ajax
|
|
11
|
+
* - 上传:POST /api/file/module/upload?sf_request_type=ajax
|
|
12
|
+
*/
|
|
13
|
+
import { CaizhilianCliError, caizhilianValidationError } from '../../errors.js';
|
|
14
|
+
import { caizhilianSuccess } from '../types.js';
|
|
15
|
+
import { requireNonEmpty } from '../shared.js';
|
|
16
|
+
import { createHash } from 'node:crypto';
|
|
17
|
+
import { readFileSync, statSync } from 'node:fs';
|
|
18
|
+
import { basename, extname } from 'node:path';
|
|
19
|
+
const ACTION = 'caizhilian.file-upload';
|
|
20
|
+
// ── 接口路径 ──────────────────────────────────────────────
|
|
21
|
+
const PRE_UPLOAD_CHECK_PATH = '/api/file/preUploadCheck?sf_request_type=ajax';
|
|
22
|
+
const UPLOAD_PATH = '/api/file/module/upload?sf_request_type=ajax';
|
|
23
|
+
// ── 辅助函数 ──────────────────────────────────────────────
|
|
24
|
+
function asRecord(value) {
|
|
25
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
26
|
+
}
|
|
27
|
+
function isPlainObject(value) {
|
|
28
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
29
|
+
}
|
|
30
|
+
function md5File(filePath) {
|
|
31
|
+
const content = readFileSync(filePath);
|
|
32
|
+
return createHash('md5').update(content).digest('hex');
|
|
33
|
+
}
|
|
34
|
+
function sha256File(filePath) {
|
|
35
|
+
const content = readFileSync(filePath);
|
|
36
|
+
return createHash('sha256').update(content).digest('hex');
|
|
37
|
+
}
|
|
38
|
+
// ── 获取上传合约 ──────────────────────────────────────────
|
|
39
|
+
async function getContract(args, env) {
|
|
40
|
+
return caizhilianSuccess(ACTION, {
|
|
41
|
+
contract: {
|
|
42
|
+
version: 'agent_callable_interface_contract.v1',
|
|
43
|
+
actions: ['contract', 'prepare', 'upload'],
|
|
44
|
+
required: {
|
|
45
|
+
prepare: ['file_path', 'module'],
|
|
46
|
+
upload: ['file_path', 'module', 'user_confirmed'],
|
|
47
|
+
},
|
|
48
|
+
optional: {
|
|
49
|
+
prepare: ['context_file'],
|
|
50
|
+
upload: ['context_file', 'login_mode'],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// ── 准备上传(prepare/apply)──────────────────────────────────────
|
|
56
|
+
async function prepareUpload(args, env) {
|
|
57
|
+
const filePath = requireNonEmpty(args.file_path, 'file_path');
|
|
58
|
+
const module = requireNonEmpty(args.module, 'module');
|
|
59
|
+
// 校验文件存在
|
|
60
|
+
let stat;
|
|
61
|
+
try {
|
|
62
|
+
stat = statSync(filePath);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
throw caizhilianValidationError('file_not_found', `文件不存在: ${filePath}`);
|
|
66
|
+
}
|
|
67
|
+
if (!stat.isFile()) {
|
|
68
|
+
throw caizhilianValidationError('file_not_regular', `不是普通文件: ${filePath}`);
|
|
69
|
+
}
|
|
70
|
+
// 计算元数据
|
|
71
|
+
const fileName = basename(filePath);
|
|
72
|
+
const ext = extname(filePath).slice(1).toLowerCase();
|
|
73
|
+
const size = stat.size;
|
|
74
|
+
const md5 = md5File(filePath);
|
|
75
|
+
const sha256 = sha256File(filePath);
|
|
76
|
+
// 签发 continuation
|
|
77
|
+
const continuation = await env.continuation.issue({
|
|
78
|
+
operation: 'caizhilian.file-upload.upload.apply',
|
|
79
|
+
filePath,
|
|
80
|
+
module,
|
|
81
|
+
fileName,
|
|
82
|
+
ext,
|
|
83
|
+
size,
|
|
84
|
+
md5,
|
|
85
|
+
sha256,
|
|
86
|
+
});
|
|
87
|
+
return caizhilianSuccess('caizhilian.file-upload.prepare', {
|
|
88
|
+
file_path: filePath,
|
|
89
|
+
file_name: fileName,
|
|
90
|
+
ext,
|
|
91
|
+
size,
|
|
92
|
+
md5,
|
|
93
|
+
sha256,
|
|
94
|
+
module,
|
|
95
|
+
continuation,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
async function uploadApply(args, env, lease) {
|
|
99
|
+
const filePath = lease.payload?.filePath;
|
|
100
|
+
const module = lease.payload?.module;
|
|
101
|
+
const fileName = lease.payload?.fileName;
|
|
102
|
+
const ext = lease.payload?.ext;
|
|
103
|
+
const size = lease.payload?.size;
|
|
104
|
+
const md5 = lease.payload?.md5;
|
|
105
|
+
const sha256 = lease.payload?.sha256;
|
|
106
|
+
// 预检查
|
|
107
|
+
const preCheckResponse = await env.host.request({
|
|
108
|
+
method: 'POST',
|
|
109
|
+
path: PRE_UPLOAD_CHECK_PATH,
|
|
110
|
+
body: {
|
|
111
|
+
fileName,
|
|
112
|
+
fileSize: size,
|
|
113
|
+
module,
|
|
114
|
+
md5,
|
|
115
|
+
},
|
|
116
|
+
operation: 'caizhilian.file-upload.upload.apply',
|
|
117
|
+
});
|
|
118
|
+
const preCheckData = asRecord(preCheckResponse);
|
|
119
|
+
if (!preCheckData.status && !preCheckData.success) {
|
|
120
|
+
throw new CaizhilianCliError('api', 'business_error', String(preCheckData.msg || preCheckData.message || '预检查失败'), {
|
|
121
|
+
code: preCheckData.code ?? preCheckData.status,
|
|
122
|
+
details: { action: 'caizhilian.file-upload.upload.apply', message: String(preCheckData.msg || preCheckData.message || '预检查失败') },
|
|
123
|
+
exitCode: 1,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const preCheckResult = asRecord(preCheckData.data);
|
|
127
|
+
// 判断上传策略
|
|
128
|
+
const uploadType = preCheckResult.uploadType || 'common';
|
|
129
|
+
const preUploadId = preCheckResult.preUploadId;
|
|
130
|
+
// 如果是 second 策略,直接返回已有 file ID
|
|
131
|
+
if (uploadType === 'second') {
|
|
132
|
+
const fileId = preCheckResult.fileId || preCheckResult.fileid || preCheckResult.uploadModuleDto?.fileObj?.fileId;
|
|
133
|
+
if (!fileId) {
|
|
134
|
+
throw new CaizhilianCliError('api', 'business_error', 'second 策略未返回 file ID', {
|
|
135
|
+
details: { action: 'caizhilian.file-upload.upload.apply' },
|
|
136
|
+
exitCode: 1,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return caizhilianSuccess('caizhilian.file-upload.upload.apply', {
|
|
140
|
+
file_id: String(fileId),
|
|
141
|
+
file_name: fileName,
|
|
142
|
+
size,
|
|
143
|
+
ext,
|
|
144
|
+
upload_type: uploadType,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// common/chunk 策略:上传文件
|
|
148
|
+
const fileContent = readFileSync(filePath);
|
|
149
|
+
const formData = new FormData();
|
|
150
|
+
formData.append('file', new Blob([fileContent]), fileName);
|
|
151
|
+
formData.append('preUploadId', preUploadId || '');
|
|
152
|
+
formData.append('module', module);
|
|
153
|
+
const uploadResponse = await env.host.request({
|
|
154
|
+
method: 'POST',
|
|
155
|
+
path: UPLOAD_PATH,
|
|
156
|
+
body: formData,
|
|
157
|
+
operation: 'caizhilian.file-upload.upload.apply',
|
|
158
|
+
});
|
|
159
|
+
const uploadData = asRecord(uploadResponse);
|
|
160
|
+
if (!uploadData.status && !uploadData.success) {
|
|
161
|
+
throw new CaizhilianCliError('api', 'business_error', String(uploadData.msg || uploadData.message || '上传失败'), {
|
|
162
|
+
code: uploadData.code ?? uploadData.status,
|
|
163
|
+
details: { action: 'caizhilian.file-upload.upload.apply', message: String(uploadData.msg || uploadData.message || '上传失败') },
|
|
164
|
+
exitCode: 1,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const uploadResult = asRecord(uploadData.data);
|
|
168
|
+
const fileId = uploadResult.fileId || uploadResult.fileid || '';
|
|
169
|
+
if (!fileId) {
|
|
170
|
+
throw new CaizhilianCliError('api', 'business_error', '上传未返回 file ID', {
|
|
171
|
+
details: { action: 'caizhilian.file-upload.upload.apply' },
|
|
172
|
+
exitCode: 1,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return caizhilianSuccess('caizhilian.file-upload.upload.apply', {
|
|
176
|
+
file_id: String(fileId),
|
|
177
|
+
file_name: fileName,
|
|
178
|
+
size,
|
|
179
|
+
ext,
|
|
180
|
+
upload_type: uploadType,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
// ── 处理器汇总 ────────────────────────────────────────────
|
|
184
|
+
export const caizhilianFileUploadHandlers = {
|
|
185
|
+
'caizhilian.file-upload.contract': { execute: getContract },
|
|
186
|
+
'caizhilian.file-upload.prepare': { execute: prepareUpload },
|
|
187
|
+
'caizhilian.file-upload.upload': {
|
|
188
|
+
prepare: prepareUpload,
|
|
189
|
+
apply: uploadApply,
|
|
190
|
+
targetKeys: ['file_path', 'module'],
|
|
191
|
+
},
|
|
192
|
+
};
|