weaver-work-cli 0.1.47 → 0.1.49
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/dist/chunks/{archive-oa-BBDP7AKJ.js → archive-oa-57R2FYHV.js} +565 -17
- package/dist/chunks/{attachment-content-MCXQBD6N.js → attachment-content-MU2LPI5P.js} +3 -3
- package/dist/chunks/{chunk-J2VEB5K3.js → chunk-2BQESR2U.js} +2 -2
- package/dist/chunks/{chunk-727FH2NI.js → chunk-2IGZUMNG.js} +15 -2
- package/dist/chunks/{chunk-IP4CWQCF.js → chunk-3NV2ETZR.js} +8 -8
- package/dist/chunks/{chunk-OXHHJWNC.js → chunk-3X7VOSBA.js} +1 -1
- package/dist/chunks/chunk-5QYE52LG.js +223 -0
- package/dist/chunks/{chunk-IRMIEDXN.js → chunk-6GWU63YF.js} +1 -1
- package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
- package/dist/chunks/{chunk-Q4OYAQYH.js → chunk-72MI3MBX.js} +4 -0
- package/dist/chunks/{chunk-AD46OMQK.js → chunk-BRRW7CWA.js} +121 -46
- package/dist/chunks/{chunk-76H3IKH6.js → chunk-D2QRZUW4.js} +221 -37
- package/dist/chunks/{chunk-GSZTA43P.js → chunk-EJVA5ZVB.js} +2 -2
- package/dist/chunks/{chunk-4RWS2YYL.js → chunk-GEOMANP7.js} +3 -3
- package/dist/chunks/{chunk-LIEQJIGM.js → chunk-GR76ZDDX.js} +0 -3
- package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
- package/dist/chunks/chunk-JEQHNNSS.js +158 -0
- package/dist/chunks/{chunk-6V5ZPKHV.js → chunk-K3BT54CU.js} +4 -4
- package/dist/chunks/{chunk-6AXKWFKG.js → chunk-KV5SOWMS.js} +4 -4
- package/dist/chunks/{chunk-JB34OE7R.js → chunk-NBEWUR7L.js} +1 -1
- package/dist/chunks/{chunk-PSOMGA3U.js → chunk-ZKEUGS2U.js} +36 -7
- package/dist/chunks/{conflict-H7EHQXYY.js → conflict-6347A7YK.js} +2 -2
- package/dist/chunks/{contract-3QLAGYQL.js → contract-N6P2HIIE.js} +425 -187
- package/dist/chunks/{create-flow-VRVJEOBX.js → create-flow-7WG7LVX5.js} +6 -6
- package/dist/chunks/data-QO7QWOIV.js +2525 -0
- package/dist/chunks/{ehr-SH2LM3NK.js → ehr-XI4BIVR2.js} +16 -5
- package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
- package/dist/chunks/{env-66FPSJDV.js → env-LHRKSLG6.js} +2 -2
- package/dist/chunks/{factory-UH2TZBVA.js → factory-2H7Z4RWJ.js} +1 -1
- package/dist/chunks/{group-chat-CAKMMV7K.js → group-chat-EW6PNDDT.js} +3 -3
- package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
- package/dist/chunks/{im-NJB7ZYMH.js → im-3RCNL5GT.js} +107 -1
- package/dist/chunks/{invoice-UEAHSYAE.js → invoice-FXWH5GPO.js} +2 -71
- package/dist/chunks/{lazy-dispatch-25XGTXLM.js → lazy-dispatch-XSAHDK6Z.js} +3 -3
- package/dist/chunks/{meeting-VTBFW4HI.js → meeting-N2FQBHXI.js} +10 -10
- package/dist/chunks/org-NFE7X7FK.js +12 -0
- package/dist/chunks/{reception-5WITA44R.js → reception-MYOKJULO.js} +905 -116
- package/dist/chunks/{recruit-stage-CAKZTUA7.js → recruit-stage-FKWS5UQF.js} +118 -29
- package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
- package/dist/chunks/{registry-AQVGHUM6.js → registry-7VZ6YJUF.js} +2 -2
- package/dist/chunks/{registry-PVUZQDDQ.js → registry-BUTEDK3C.js} +1 -1
- package/dist/chunks/{registry-JVQBLFQ5.js → registry-CKUVBS53.js} +10 -10
- package/dist/chunks/{room-recommend-5U55FMXZ.js → room-recommend-MBCYENQ2.js} +4 -4
- package/dist/chunks/{schedule-IDETODCA.js → schedule-5IFMCXME.js} +4 -4
- package/dist/chunks/{workflow-BSYT5TGL.js → workflow-2TRU2ZSP.js} +5 -5
- package/dist/core/refs.js +19 -2
- package/dist/index.js +20 -15
- package/dist/shortcuts/archive-oa/constants.js +42 -0
- package/dist/shortcuts/archive-oa/host.js +2 -2
- package/dist/shortcuts/archive-oa/index.js +38 -0
- package/dist/shortcuts/archive-oa/operations/borrow-car.js +117 -3
- package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
- package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
- package/dist/shortcuts/archive-oa/operations/my-borrow-contract.js +271 -0
- package/dist/shortcuts/archive-oa/operations/registry.js +9 -4
- package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
- package/dist/shortcuts/contract/index.js +9 -1
- package/dist/shortcuts/contract/manifest.js +14 -2
- package/dist/shortcuts/contract/operations/card.js +231 -0
- package/dist/shortcuts/contract/operations/registry.js +2 -0
- package/dist/shortcuts/contract/operations/review.js +16 -5
- package/dist/shortcuts/contract/operations/summary.js +25 -17
- package/dist/shortcuts/data/errors.js +64 -0
- package/dist/shortcuts/data/host.js +140 -0
- package/dist/shortcuts/data/index.js +429 -0
- package/dist/shortcuts/data/manifest.js +133 -0
- package/dist/shortcuts/data/operations/attend.js +62 -0
- package/dist/shortcuts/data/operations/conf.js +384 -0
- package/dist/shortcuts/data/operations/ds.js +686 -0
- package/dist/shortcuts/data/operations/field.js +68 -0
- package/dist/shortcuts/data/operations/index.js +65 -0
- package/dist/shortcuts/data/operations/module.js +383 -0
- package/dist/shortcuts/data/operations/noun.js +102 -0
- package/dist/shortcuts/data/operations/query.js +85 -0
- package/dist/shortcuts/data/operations/scene.js +235 -0
- package/dist/shortcuts/data/operations/shared.js +279 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +22 -5
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +28 -12
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/ehr/recruit-stage/shared.js +90 -8
- package/dist/shortcuts/im/index.js +128 -0
- package/dist/shortcuts/im/operations/session.js +6 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/host.js +0 -3
- package/dist/shortcuts/invoice/manifest.js +0 -1
- package/dist/shortcuts/invoice/operations/reim-subsidy.js +1 -71
- package/dist/shortcuts/meeting/operations/eb/conflict.js +26 -3
- package/dist/shortcuts/meeting/operations/eb/continuation-alias.js +63 -0
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +71 -12
- package/dist/shortcuts/meeting/operations/eb/factory.js +5 -3
- package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/reception/constants.js +11 -0
- package/dist/shortcuts/reception/host.js +33 -1
- package/dist/shortcuts/reception/index.js +22 -1
- package/dist/shortcuts/reception/manifest.js +55 -2
- package/dist/shortcuts/reception/operations/ask.js +37 -1
- package/dist/shortcuts/reception/operations/compose.js +124 -3
- package/dist/shortcuts/reception/operations/doc.js +59 -0
- package/dist/shortcuts/reception/operations/docrender.js +25 -1
- package/dist/shortcuts/reception/operations/leads.js +245 -0
- package/dist/shortcuts/reception/operations/markdown.js +22 -0
- package/dist/shortcuts/reception/operations/panels.js +84 -21
- package/dist/shortcuts/reception/operations/registry.js +2 -0
- package/dist/shortcuts/reception/operations/render.js +76 -3
- package/dist/shortcuts/reception/operations/restaurant-rooms.js +118 -0
- package/dist/shortcuts/reception/operations/restaurant.js +264 -0
- package/dist/shortcuts/reception/operations/restaurantrooms.js +42 -0
- package/dist/shortcuts/reception/operations/schedule.js +7 -1
- package/dist/shortcuts/reception/upload.js +22 -6
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +28 -12
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/recruit-stage/shared.js +99 -14
- package/docs/SKILL.md +1 -0
- package/docs/_catalog.md +3 -0
- package/docs/archive-oa.md +4 -2
- package/docs/data.md +149 -0
- package/docs/reception.md +59 -5
- package/package.json +1 -1
- package/scripts/check-skill-sync.mjs +188 -0
- package/scripts/package-skill.mjs +17 -3
- package/skill-template/business-info.json +23 -0
- package/skill-template/domains/archive-oa.md +2 -1
- package/skill-template/domains/data.md +15 -0
- package/skill-template/master-skill-template.md +1 -0
- package/skill-template/skill-template.md +1 -0
- package/skills/weaver-e10-archive-oa/SKILL.md +35 -7
- package/skills/weaver-e10-archive-oa/references/borrow-car.md +32 -7
- package/skills/weaver-e10-archive-oa/references/contract-search.md +105 -4
- package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +2 -2
- package/skills/weaver-e10-archive-oa/references/my-borrow-contract.md +97 -0
- package/skills/weaver-e10-archive-oa/references/my-borrow.md +6 -1
- package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +48 -2
- package/skills/weaver-e10-calendar/SKILL.md +1 -1
- package/skills/weaver-e10-calendar/references/calendar-query.md +1 -1
- package/skills/weaver-e10-calendar/references/calendar-write.md +9 -9
- package/skills/weaver-e10-cowork/SKILL.md +9 -6
- package/skills/weaver-e10-data/SKILL.md +118 -0
- package/skills/weaver-e10-data/references/config-center.md +90 -0
- package/skills/weaver-e10-data/references/datasource.md +136 -0
- package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +10 -7
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +17 -0
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +263 -35
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +8 -5
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +175 -22
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +124 -19
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +178 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
- package/skills/weaver-e10-jinchengda/references/orchestration.md +7 -7
- package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +279 -0
- package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +450 -0
- package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +358 -0
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +505 -0
- package/skills/weaver-e10-jucailin/SKILL.md +7 -4
- package/skills/weaver-e10-jucailin/references/recruit-create.md +3 -2
- package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -1
- package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +3 -3
- package/skills/weaver-e10-jucailin/references/safety-boundaries.md +30 -2
- package/skills/weaver-e10-mail/SKILL.md +17 -4
- package/skills/weaver-e10-meeting/SKILL.md +129 -412
- package/skills/weaver-e10-meeting/references/create-flow.md +188 -0
- package/skills/weaver-e10-meeting/references/create-guardrails.md +234 -0
- package/skills/weaver-e10-meeting/references/pitfalls.md +40 -0
- package/skills/weaver-e10-reception-flow/SKILL.md +77 -19
- package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +628 -26
- package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +96 -26
- package/skills/weaver-e10-reception-flow/references/guide.md +4 -3
- package/skills/weaver-e10-reception-flow/scripts/render.py +84 -3
- package/skills/weaver-e10-recruit-stage/SKILL.md +45 -12
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +78 -8
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +5 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +16 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +169 -0
- package/skills/weaver-e10-shijingran/SKILL.md +6 -2
- package/skills/weaver-e10-shijingran/references/source-manifest.json +5 -4
- package/skills/weaver-e10-workflow/SKILL.md +1 -1
- package/skills/weaver-e10-yepiaotong/SKILL.md +8 -4
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +2 -2
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +1 -0
- package/skills/weaver-e10-yimiaoban/SKILL.md +2 -1
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +32 -0
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +3 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +11 -11
- package/dist/chunks/{ebuilder-form-GWDTKEI2.js → ebuilder-form-CBYI6CQ6.js} +3 -3
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-README.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-SKILL.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-openai.yaml +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-position-templates.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +0 -0
|
@@ -0,0 +1,686 @@
|
|
|
1
|
+
import { needArg } from '../host.js';
|
|
2
|
+
import { dataValidationError } from '../errors.js';
|
|
3
|
+
import { applyAppId, baseDto, parseOrder, parseStat, parseWhere, readListArg, renderTable, scanTips, tipsLines, } from './shared.js';
|
|
4
|
+
// ---------------------------------------------------------------- 分组清单
|
|
5
|
+
//
|
|
6
|
+
// 这 58 个分组**仅作 `ds find` 的默认扫描候选集**,不参与任何取数参数推导。
|
|
7
|
+
// 分组随环境模块安装情况增减,故支持 `--groups` 显式覆盖。
|
|
8
|
+
const DS_GROUPS = [
|
|
9
|
+
[1, '业务表单', 'weaver-formreport-service', 'form'],
|
|
10
|
+
[2, '流程', 'weaver-workflow-report-serviceworkflowreport', 'workflow'],
|
|
11
|
+
[3, '任务', 'weaver-project-servicetask', 'task'],
|
|
12
|
+
[4, '日志', 'weaver-elog-service', 'elog'],
|
|
13
|
+
[5, '会议', 'weaver-meeting-service', 'meeting'],
|
|
14
|
+
[6, '日报', 'weaver-blog-service', 'blog'],
|
|
15
|
+
[7, 'OKR', 'weaver-wr-goal-service', 'goal'],
|
|
16
|
+
[8, '流程列表', 'weaver-workflow-list-service', 'workflow'],
|
|
17
|
+
[9, '考勤', 'weaver-attend-service', 'attend'],
|
|
18
|
+
[10, 'CRM', 'weaver-crm-service', 'customer'],
|
|
19
|
+
[11, '组织画像', 'weaver-portrait-service', 'portrait'],
|
|
20
|
+
[12, '工作流报告', 'weaver-workflow-report-serviceworkflow_report', 'workflow'],
|
|
21
|
+
[13, '绩效', 'weaver-wr-performance-service', 'kpi'],
|
|
22
|
+
[14, '项目', 'weaver-project-service', 'mainline'],
|
|
23
|
+
[15, '基础定时模块', 'weaver-basic-schedule-service', 'escheduler'],
|
|
24
|
+
[16, '知识画像', 'weaver-doc-service', 'document'],
|
|
25
|
+
[17, 'HRM', 'weaver-hrm-service', 'hrm'],
|
|
26
|
+
[18, 'e-builder报表', 'weaver-edcreportd-service', null],
|
|
27
|
+
[19, 'e-builder应用', 'weaver-ebuilder-app-service', 'ebuilder'],
|
|
28
|
+
[20, 'e-builder表单', 'weaver-ebuilder-form-service', 'ebuilder'],
|
|
29
|
+
[21, '日程', 'weaver-calendar-service', 'calendar'],
|
|
30
|
+
[22, '文档', 'weaver-doc-servicedocument', 'document'],
|
|
31
|
+
[23, '文件', 'weaver-file-service', 'file'],
|
|
32
|
+
[24, '公文管理', 'weaver-odoc-service', 'odoc'],
|
|
33
|
+
[25, 'SCRM', 'weaver-crm-market-service', 'scrm'],
|
|
34
|
+
[26, '协作区', 'weaver-cowork-service', 'cowork'],
|
|
35
|
+
[27, '数据源', 'weaver-datasource-service', 'datasource'],
|
|
36
|
+
[28, '计划报告', 'weaver-wr-plan-service', 'workreport'],
|
|
37
|
+
[29, '电子签', 'weaver-signcenter-service', 'signcontract'],
|
|
38
|
+
[30, '表单加密', 'weaver-datasecurity', 'datasecurity'],
|
|
39
|
+
[31, '人事', 'weaver-hr-service', null],
|
|
40
|
+
[32, '动作流', 'weaver-esb-setting-serviceesbCustom', 'esb'],
|
|
41
|
+
[33, '发票云', 'weaver-inc-biz-service', 'inc'],
|
|
42
|
+
[34, '绩效核算', 'weaver-ebuilder-contract-servicecmdatauFJXHS', 'ebuilder'],
|
|
43
|
+
[35, 'EB合同管理', 'weaver-ebuilder-contract-service', null],
|
|
44
|
+
[36, '待办事项', 'weaver-my-service', null],
|
|
45
|
+
[37, '签名', 'weaver-signature-service', null],
|
|
46
|
+
[38, '邮件', 'weaver-mail-base-service', 'email'],
|
|
47
|
+
[39, '薪酬', 'weaver-hrm-salary', 'hrmsalary'],
|
|
48
|
+
[40, '系统安全', 'weaver-security-framework-service', 'security'],
|
|
49
|
+
[41, '公文交换中心', 'weaver-odocexchange-service', 'odocexchange'],
|
|
50
|
+
[42, '招聘管理', 'weaver-recruit-service', 'recruit'],
|
|
51
|
+
[43, '微搜', 'weaver-esearch-search-service', null],
|
|
52
|
+
[44, '统一审批中心', 'weaver-intunifytodo-server-config-service', 'intunifytodos'],
|
|
53
|
+
[45, '公共数据源', 'weaver-component-web-service', 'common'],
|
|
54
|
+
[46, '数据分析', 'weaver-analyze-service', 'analyze'],
|
|
55
|
+
[47, '财务模块', 'weaver-fna-expense-servicefexs', 'fna'],
|
|
56
|
+
[48, 'ESB连接器', 'weaver-esb-setting-serviceesbConnect', 'esb'],
|
|
57
|
+
[49, 'AI连接器', 'weaver-ai-application-service', 'ai'],
|
|
58
|
+
[50, '外部流程', 'weaver-workflow-core-serviceworkflowCoreOuterwf', 'workflow'],
|
|
59
|
+
[51, '绩效考核', 'weaver-wr-performance-eb-service', 'ebuilder'],
|
|
60
|
+
[52, '问题定位平台', 'weaver-tissot-service', 'tissot'],
|
|
61
|
+
[53, '工作流基础效率', 'weaver-workflow-report-serviceworkflowEffReport', 'workflow'],
|
|
62
|
+
[54, '工作流操作者效率', 'weaver-workflow-report-serviceworkflowEffOperateReport', 'workflow'],
|
|
63
|
+
[55, '工作流节点效率', 'weaver-workflow-report-serviceworkflowEffNodeReport', 'workflow'],
|
|
64
|
+
[56, '规则引擎', 'weaver-logicflow-service', 'logicflow'],
|
|
65
|
+
[57, '工作流表单', 'weaver-workflow-report-serviceworkflowFormReport', 'workflow'],
|
|
66
|
+
[58, '统一认证中心', 'weaver-intunifyauth-server-base-service', null],
|
|
67
|
+
];
|
|
68
|
+
const DS_CORE_GROUPS = [
|
|
69
|
+
'weaver-formreport-service',
|
|
70
|
+
'weaver-ebuilder-form-service',
|
|
71
|
+
'weaver-workflow-report-serviceworkflowreport',
|
|
72
|
+
];
|
|
73
|
+
const DS_FIND_SEMANTIC_RULES = [
|
|
74
|
+
{ tag: '考勤/假期', re: /考勤|打卡|出勤|请假|假期|年假|事假|病假|加班|外勤|工时|调休|补卡|申诉/, groups: ['weaver-attend-service', 'weaver-hr-service'] },
|
|
75
|
+
{ tag: '流程/审批', re: /流程|审批|待办|已办|发起|抄送|传阅|征询|签字|节点|报销|申请单/, groups: ['weaver-workflow-report-serviceworkflowreport', 'weaver-workflow-list-service'] },
|
|
76
|
+
{ tag: '日报/周报', re: /日报|周报|月报|年报|工作总结/, groups: ['weaver-blog-service', 'weaver-wr-plan-service'] },
|
|
77
|
+
{ tag: '文档/附件', re: /文档|附件|文件夹|共享|资料/, groups: ['weaver-doc-servicedocument', 'weaver-doc-service', 'weaver-file-service'] },
|
|
78
|
+
{ tag: '项目/任务', re: /项目|任务|工时|里程碑|延期|验收/, groups: ['weaver-project-service', 'weaver-project-servicetask'] },
|
|
79
|
+
{ tag: '客户/商机', re: /客户|商机|线索|联系人|公海|销售|CRM|营销/i, groups: ['weaver-crm-service', 'weaver-crm-market-service'] },
|
|
80
|
+
{ tag: '会议/日程', re: /会议|日程|日历|预约|会议室|预定/, groups: ['weaver-meeting-service', 'weaver-calendar-service'] },
|
|
81
|
+
{ tag: '人事/招聘', re: /招聘|入职|离职|offer|人才|员工|人员|通讯录|调岗|组织/i, groups: ['weaver-recruit-service', 'weaver-hr-service', 'weaver-hrm-service'] },
|
|
82
|
+
{ tag: '薪酬/绩效', re: /薪酬|薪资|工资|社保|公积金|绩效|考核|KPI|OKR/i, groups: ['weaver-hrm-salary', 'weaver-wr-performance-service', 'weaver-wr-goal-service'] },
|
|
83
|
+
{ tag: '合同/收款', re: /合同|签约|收款|回款|开票|发票|应收/, groups: ['weaver-ebuilder-contract-service', 'weaver-ebuilder-contract-servicecmdatauFJXHS', 'weaver-inc-biz-service'] },
|
|
84
|
+
{ tag: '邮件/公文', re: /邮件|收件箱|公文|发文|档案|借阅/, groups: ['weaver-mail-base-service', 'weaver-odoc-service'] },
|
|
85
|
+
{ tag: '资产/日志', re: /资产|台账|日志|动作流|自动化/, groups: ['weaver-elog-service', 'weaver-esb-setting-serviceesbCustom'] },
|
|
86
|
+
];
|
|
87
|
+
function groupLabel(groupId) {
|
|
88
|
+
const hit = DS_GROUPS.find((item) => item[2] === groupId);
|
|
89
|
+
return hit ? hit[1] : null;
|
|
90
|
+
}
|
|
91
|
+
function groupMark(groupId) {
|
|
92
|
+
const hit = DS_GROUPS.find((item) => item[2] === groupId);
|
|
93
|
+
return hit ? hit[3] : null;
|
|
94
|
+
}
|
|
95
|
+
function explicitAppId(input) {
|
|
96
|
+
const appId = input.app_id;
|
|
97
|
+
return typeof appId === 'string' && appId !== '' && appId !== 'auto' ? appId : null;
|
|
98
|
+
}
|
|
99
|
+
// ---------------------------------------------------------------- 端点封装
|
|
100
|
+
const DS_LB_PATH = '/api/dw/newetl/chatBi/ds/listByPage';
|
|
101
|
+
/**
|
|
102
|
+
* `ds listByPage`:**当前忽略 name**(传 name/tableName/keyword 都返回该分组全量)。
|
|
103
|
+
* 后端升级支持 name 后,`ds find` 自动恢复服务端过滤能力,无需改代码。
|
|
104
|
+
*/
|
|
105
|
+
async function listByPage(host, form) {
|
|
106
|
+
return host.request({ method: 'POST', path: DS_LB_PATH, multipart: form, operation: 'ds.listByPage' });
|
|
107
|
+
}
|
|
108
|
+
function fieldsForm(groupId, tableId, sourceType) {
|
|
109
|
+
return {
|
|
110
|
+
groupId,
|
|
111
|
+
sourceId: tableId,
|
|
112
|
+
sourceType,
|
|
113
|
+
detailFieldsGroup: 'true',
|
|
114
|
+
enableMerge: 'true',
|
|
115
|
+
needTableName: 'true',
|
|
116
|
+
params: '[]',
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
async function fetchFields(host, input, path) {
|
|
120
|
+
const groupId = needArg(input, 'group');
|
|
121
|
+
const tableId = needArg(input, 'table');
|
|
122
|
+
const form = fieldsForm(groupId, tableId, String(input.source_type || 'LOGIC'));
|
|
123
|
+
const appId = explicitAppId(input);
|
|
124
|
+
if (appId)
|
|
125
|
+
form.appId = appId;
|
|
126
|
+
return host.request({ method: 'POST', path, multipart: form, operation: 'ds.fields' });
|
|
127
|
+
}
|
|
128
|
+
function renderFields(response) {
|
|
129
|
+
const lines = [];
|
|
130
|
+
for (const node of (response?.data || [])) {
|
|
131
|
+
lines.push(`== 表: ${node.name} (id=${node.id}) 字段 ${(node.fields || []).length} 个 ==`);
|
|
132
|
+
for (const field of (node.fields || [])) {
|
|
133
|
+
lines.push([field.name, field.text, field.type, field.mainPrimaryKey ? 'PK' : ''].filter(Boolean).join('\t'));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return lines.length ? lines.join('\n') : '(空:未返回字段)';
|
|
137
|
+
}
|
|
138
|
+
// ---------------------------------------------------------------- 命令
|
|
139
|
+
export async function dsGroups(input) {
|
|
140
|
+
const pattern = input.pattern ? String(input.pattern) : null;
|
|
141
|
+
const groups = DS_GROUPS
|
|
142
|
+
.filter((item) => !pattern || item[2].includes(pattern) || item[1].includes(pattern))
|
|
143
|
+
.map((item) => ({ groupId: item[2], label: item[1], serviceMark: item[3] }));
|
|
144
|
+
const data = {
|
|
145
|
+
count: groups.length,
|
|
146
|
+
groups,
|
|
147
|
+
coreGroups: DS_CORE_GROUPS,
|
|
148
|
+
semanticRules: DS_FIND_SEMANTIC_RULES.map((rule) => ({ tag: rule.tag, groups: rule.groups })),
|
|
149
|
+
note: '内置分组清单,仅用于 ds find 的默认扫描候选集;分组随环境变动时用 --groups 显式覆盖',
|
|
150
|
+
};
|
|
151
|
+
return { data, text: renderTable(`内置分组清单 ${groups.length} 个`, groups, ['groupId', 'label', 'serviceMark']) };
|
|
152
|
+
}
|
|
153
|
+
export async function dsTables(input, host) {
|
|
154
|
+
const groupId = needArg(input, 'group');
|
|
155
|
+
const form = {
|
|
156
|
+
name: input.name || '',
|
|
157
|
+
pageNo: String(input.page || '1'),
|
|
158
|
+
pageSize: String(input.size || '100'),
|
|
159
|
+
groupId,
|
|
160
|
+
sourceType: String(input.source_type || 'LOGIC'),
|
|
161
|
+
dataUsage: '',
|
|
162
|
+
};
|
|
163
|
+
const appId = explicitAppId(input);
|
|
164
|
+
if (appId)
|
|
165
|
+
form.appId = appId;
|
|
166
|
+
const response = await listByPage(host, form);
|
|
167
|
+
const records = response?.data?.records || [];
|
|
168
|
+
return {
|
|
169
|
+
data: response,
|
|
170
|
+
text: renderTable(`分组表清单 (total=${response?.data?.total})`, records, ['id', 'name', 'appId', 'tableText', 'detailTable', 'usage']),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export async function dsFields(input, host) {
|
|
174
|
+
const response = await fetchFields(host, input, '/api/ebuilder/common/ds/fields');
|
|
175
|
+
return { data: response, text: renderFields(response) };
|
|
176
|
+
}
|
|
177
|
+
export async function dsFieldsDsl(input, host) {
|
|
178
|
+
const response = await fetchFields(host, input, '/api/dw/newetl/chatBi/ds/fieldsForDSL');
|
|
179
|
+
return { data: response, text: renderFields(response) };
|
|
180
|
+
}
|
|
181
|
+
export async function dsList(input, host) {
|
|
182
|
+
// 先校验必填参数再取登录态:未登录时缺参必须报用法错误(退出码 8),
|
|
183
|
+
// 否则会被登录失败抢先,把「参数写错」误报成「登录态失效」。
|
|
184
|
+
const groupId = needArg(input, 'group');
|
|
185
|
+
const tableId = needArg(input, 'table');
|
|
186
|
+
const fieldIds = readListArg(needArg(input, 'fields')).split(',').map((item) => item.trim()).filter(Boolean);
|
|
187
|
+
const session = await host.session();
|
|
188
|
+
const dto = applyAppId(baseDto(session, tableId, groupId, Number(input.page || '1') || 1, Number(input.size || '20') || 20, 'getListData'), input.app_id);
|
|
189
|
+
dto.queryFields = fieldIds.map((field) => ({ fieldId: field, fieldName: field, objId: String(tableId), mainField: true }));
|
|
190
|
+
dto.orderFields = parseOrder(input.order);
|
|
191
|
+
const conditionTree = parseWhere(input.where);
|
|
192
|
+
if (conditionTree)
|
|
193
|
+
dto.conditionTrees = conditionTree;
|
|
194
|
+
dto.queryCount = true;
|
|
195
|
+
const response = await host.request({
|
|
196
|
+
method: 'POST',
|
|
197
|
+
path: '/api/dw/newetl/chatBi/ds/getListDatas',
|
|
198
|
+
multipart: { sourceType: String(input.source_type || 'LOGIC'), queryDto: dto },
|
|
199
|
+
operation: 'ds.list',
|
|
200
|
+
});
|
|
201
|
+
const data = response?.data || {};
|
|
202
|
+
const lines = [...tipsLines(scanTips(response)), `== 数据列表 count=${data.count} 行=${(data.list || []).length} ==`];
|
|
203
|
+
lines.push(renderTable('', data.list || [], fieldIds));
|
|
204
|
+
return { data: response, text: lines.join('\n') };
|
|
205
|
+
}
|
|
206
|
+
export async function dsChart(input, host) {
|
|
207
|
+
const groupId = needArg(input, 'group');
|
|
208
|
+
const tableId = needArg(input, 'table');
|
|
209
|
+
const groupBy = readListArg(needArg(input, 'group_by')).split(',').map((item) => item.trim()).filter(Boolean);
|
|
210
|
+
const statFields = parseStat(needArg(input, 'stat'));
|
|
211
|
+
const session = await host.session();
|
|
212
|
+
const dto = applyAppId(baseDto(session, tableId, groupId, Number(input.page || '1') || 1, Number(input.size || '100') || 100, 'getChartData'), input.app_id);
|
|
213
|
+
dto.groupFields = groupBy.map((field) => ({ fieldId: field, fieldName: field, objId: String(tableId), mainField: true }));
|
|
214
|
+
dto.groupStatFields = statFields.map((stat) => ({ ...stat, objId: String(tableId) }));
|
|
215
|
+
const conditionTree = parseWhere(input.where);
|
|
216
|
+
if (conditionTree)
|
|
217
|
+
dto.conditionTrees = conditionTree;
|
|
218
|
+
const response = await host.request({
|
|
219
|
+
method: 'POST',
|
|
220
|
+
path: '/api/dw/newetl/chatBi/ds/getChartDatas',
|
|
221
|
+
multipart: { sourceType: String(input.source_type || 'LOGIC'), queryDto: dto },
|
|
222
|
+
operation: 'ds.chart',
|
|
223
|
+
});
|
|
224
|
+
const rows = response?.data || [];
|
|
225
|
+
return {
|
|
226
|
+
data: response,
|
|
227
|
+
text: [...tipsLines(scanTips(response)), renderTable(`分组聚合 rows=${rows.length}`, rows)].join('\n'),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
export async function dsStat(input, host) {
|
|
231
|
+
const groupId = needArg(input, 'group');
|
|
232
|
+
const tableId = needArg(input, 'table');
|
|
233
|
+
const statFields = parseStat(needArg(input, 'stat'));
|
|
234
|
+
const session = await host.session();
|
|
235
|
+
const dto = applyAppId(baseDto(session, tableId, groupId, 1, 10, 'getStatData'), input.app_id);
|
|
236
|
+
dto.statFields = statFields.map((stat) => ({ ...stat, objId: String(tableId) }));
|
|
237
|
+
const conditionTree = parseWhere(input.where);
|
|
238
|
+
if (conditionTree)
|
|
239
|
+
dto.conditionTrees = conditionTree;
|
|
240
|
+
const response = await host.request({
|
|
241
|
+
method: 'POST',
|
|
242
|
+
path: '/api/dw/newetl/chatBi/ds/getStatDatas',
|
|
243
|
+
multipart: { sourceType: String(input.source_type || 'LOGIC'), queryDto: dto },
|
|
244
|
+
operation: 'ds.stat',
|
|
245
|
+
});
|
|
246
|
+
const fields = response?.data?.fields || [];
|
|
247
|
+
const lines = tipsLines(scanTips(response));
|
|
248
|
+
if (fields.length)
|
|
249
|
+
for (const field of fields)
|
|
250
|
+
lines.push(JSON.stringify(field));
|
|
251
|
+
else
|
|
252
|
+
lines.push('(无统计结果)');
|
|
253
|
+
return { data: response, text: lines.join('\n') };
|
|
254
|
+
}
|
|
255
|
+
export async function dsCount(input, host) {
|
|
256
|
+
const groupId = needArg(input, 'group');
|
|
257
|
+
const tableId = needArg(input, 'table');
|
|
258
|
+
const session = await host.session();
|
|
259
|
+
const dto = applyAppId(baseDto(session, tableId, groupId, 1, 10, 'getCountData'), input.app_id);
|
|
260
|
+
const conditionTree = parseWhere(input.where);
|
|
261
|
+
if (conditionTree)
|
|
262
|
+
dto.conditionTrees = conditionTree;
|
|
263
|
+
const response = await host.request({
|
|
264
|
+
method: 'POST',
|
|
265
|
+
path: '/api/dw/newetl/chatBi/ds/getCountData',
|
|
266
|
+
multipart: { sourceType: String(input.source_type || 'LOGIC'), queryDto: dto },
|
|
267
|
+
operation: 'ds.count',
|
|
268
|
+
});
|
|
269
|
+
const tips = scanTips(response);
|
|
270
|
+
return {
|
|
271
|
+
data: response,
|
|
272
|
+
text: [...tipsLines(tips), `totalCount = ${response?.data?.totalCount ?? '-'}`].join('\n'),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
// ---------------------------------------------------------------- find / describe
|
|
276
|
+
function pickFindGroups(input, keyword) {
|
|
277
|
+
if (input.groups) {
|
|
278
|
+
return { mode: 'explicit', groups: String(input.groups).split(',').map((item) => item.trim()).filter(Boolean) };
|
|
279
|
+
}
|
|
280
|
+
if (input.all_groups)
|
|
281
|
+
return { mode: 'all', groups: DS_GROUPS.map((item) => item[2]) };
|
|
282
|
+
const max = Math.max(Number(input.max_groups || '6') || 6, DS_CORE_GROUPS.length);
|
|
283
|
+
const picked = [];
|
|
284
|
+
const push = (groupId) => {
|
|
285
|
+
if (groupId && !picked.includes(groupId))
|
|
286
|
+
picked.push(groupId);
|
|
287
|
+
};
|
|
288
|
+
for (const groupId of DS_CORE_GROUPS)
|
|
289
|
+
push(groupId);
|
|
290
|
+
for (const rule of DS_FIND_SEMANTIC_RULES) {
|
|
291
|
+
if (rule.re.test(keyword))
|
|
292
|
+
for (const groupId of rule.groups)
|
|
293
|
+
push(groupId);
|
|
294
|
+
}
|
|
295
|
+
return { mode: 'core', groups: picked.slice(0, max) };
|
|
296
|
+
}
|
|
297
|
+
async function mapLimit(items, limit, fn) {
|
|
298
|
+
const out = new Array(items.length);
|
|
299
|
+
let next = 0;
|
|
300
|
+
const workers = Array.from({ length: Math.max(1, Math.min(limit, items.length)) }, async () => {
|
|
301
|
+
for (;;) {
|
|
302
|
+
const index = next++;
|
|
303
|
+
if (index >= items.length)
|
|
304
|
+
return;
|
|
305
|
+
out[index] = await fn(items[index], index);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
await Promise.all(workers);
|
|
309
|
+
return out;
|
|
310
|
+
}
|
|
311
|
+
async function scanGroups(host, groupIds, keyword, sourceType, pageSize, concurrency, appId, pages) {
|
|
312
|
+
return mapLimit(groupIds, concurrency, async (groupId) => {
|
|
313
|
+
const result = {
|
|
314
|
+
groupId,
|
|
315
|
+
label: groupLabel(groupId),
|
|
316
|
+
serviceMark: groupMark(groupId),
|
|
317
|
+
records: [],
|
|
318
|
+
error: null,
|
|
319
|
+
total: null,
|
|
320
|
+
pagesFetched: 0,
|
|
321
|
+
};
|
|
322
|
+
try {
|
|
323
|
+
for (let page = 1; page <= pages; page += 1) {
|
|
324
|
+
const form = {
|
|
325
|
+
name: keyword,
|
|
326
|
+
pageNo: String(page),
|
|
327
|
+
pageSize: String(pageSize),
|
|
328
|
+
groupId,
|
|
329
|
+
sourceType,
|
|
330
|
+
dataUsage: '',
|
|
331
|
+
};
|
|
332
|
+
if (appId)
|
|
333
|
+
form.appId = String(appId);
|
|
334
|
+
const response = await listByPage(host, form);
|
|
335
|
+
const records = response?.data?.records || [];
|
|
336
|
+
if (result.total === null)
|
|
337
|
+
result.total = response?.data?.total ?? null;
|
|
338
|
+
result.records = result.records.concat(records);
|
|
339
|
+
result.pagesFetched += 1;
|
|
340
|
+
if (records.length < pageSize)
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
result.error = String(error?.message || error);
|
|
346
|
+
}
|
|
347
|
+
return result;
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function groupPriority(groupId) {
|
|
351
|
+
if (groupId === 'weaver-ebuilder-form-service')
|
|
352
|
+
return 100;
|
|
353
|
+
if (groupId === 'weaver-formreport-service')
|
|
354
|
+
return 95;
|
|
355
|
+
if (groupId === 'weaver-workflow-report-serviceworkflowreport')
|
|
356
|
+
return 90;
|
|
357
|
+
if (/workflowEff|workflowFormReport|workflow_report$/i.test(groupId))
|
|
358
|
+
return 20;
|
|
359
|
+
return 50;
|
|
360
|
+
}
|
|
361
|
+
function mergeCandidates(scan, limit) {
|
|
362
|
+
const map = new Map();
|
|
363
|
+
for (const result of scan) {
|
|
364
|
+
for (const record of result.records) {
|
|
365
|
+
const groupId = record.groupId || result.groupId;
|
|
366
|
+
const name = String(record.originalName || record.tableText || record.name || '').trim();
|
|
367
|
+
const key = name.replace(/\s+/g, '').toLowerCase() || `${groupId}|${record.id}`;
|
|
368
|
+
const item = {
|
|
369
|
+
groupId,
|
|
370
|
+
groupLabel: result.label,
|
|
371
|
+
serviceMark: record.serviceMark ?? result.serviceMark ?? null,
|
|
372
|
+
tableId: String(record.id ?? ''),
|
|
373
|
+
name: String(record.tableText || record.name || name),
|
|
374
|
+
originalName: name,
|
|
375
|
+
objType: record.objType ?? null,
|
|
376
|
+
physicalTable: record.physicalTable ?? null,
|
|
377
|
+
appId: record.appId ?? null,
|
|
378
|
+
isPhysical: record.isPhysical ?? null,
|
|
379
|
+
detailTable: !!record.detailTable,
|
|
380
|
+
usage: record.usage ?? null,
|
|
381
|
+
sourceType: record.sourceType ?? null,
|
|
382
|
+
alsoInGroups: [],
|
|
383
|
+
_pri: groupPriority(groupId),
|
|
384
|
+
};
|
|
385
|
+
const previous = map.get(key);
|
|
386
|
+
if (!previous) {
|
|
387
|
+
map.set(key, item);
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
const winner = previous._pri >= item._pri ? previous : item;
|
|
391
|
+
const loser = previous._pri >= item._pri ? item : previous;
|
|
392
|
+
winner.alsoInGroups = winner.alsoInGroups.concat([{ groupId: loser.groupId, groupLabel: loser.groupLabel, tableId: loser.tableId, serviceMark: loser.serviceMark }], loser.alsoInGroups || []);
|
|
393
|
+
map.set(key, winner);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
const list = [...map.values()].sort((a, b) => b._pri - a._pri || String(a.originalName).localeCompare(String(b.originalName)));
|
|
397
|
+
const max = Number(limit || '0') || 0;
|
|
398
|
+
return (max > 0 ? list.slice(0, max) : list).map(({ _pri, ...rest }) => rest);
|
|
399
|
+
}
|
|
400
|
+
function routeHint(candidates) {
|
|
401
|
+
const has = (fn) => candidates.some(fn);
|
|
402
|
+
if (has((c) => /workflow/i.test(c.groupId) || c.serviceMark === 'workflow')) {
|
|
403
|
+
return { channel: 'WORKFLOW', desc: 'WORKFLOW 模块配置通道 —— 流程类问题一律走模块接口,不用 DSL,也不走数据源', reason: '命中流程类分组' };
|
|
404
|
+
}
|
|
405
|
+
if (has((c) => c.groupId === 'weaver-ebuilder-form-service' || c.serviceMark === 'ebuilder')) {
|
|
406
|
+
return { channel: 'DS_EB', desc: '数据源通道(EB 建模表单)—— 不做权限前置校验,appId 取自 ebdf_obj.app_id', reason: '命中 EB 分组' };
|
|
407
|
+
}
|
|
408
|
+
if (has((c) => c.serviceMark === 'form')) {
|
|
409
|
+
return { channel: 'DS_FORM', desc: '数据源通道(业务表单 / 流程业务表单)', reason: '命中业务表单分组' };
|
|
410
|
+
}
|
|
411
|
+
if (has((c) => c.serviceMark === 'task' || c.serviceMark === 'mainline')) {
|
|
412
|
+
return { channel: 'PROJECT/PMO', desc: '项目类:PMO 指标走 business/project-mgmt + DSL;明细/下拉选项走 PROJECT 模块', reason: '命中项目分组' };
|
|
413
|
+
}
|
|
414
|
+
if (has((c) => c.serviceMark === 'attend'))
|
|
415
|
+
return { channel: 'EHR', desc: 'EHR 模块配置通道(考勤/人事)', reason: '命中考勤分组' };
|
|
416
|
+
if (has((c) => c.serviceMark === 'blog'))
|
|
417
|
+
return { channel: 'BLOG_DAILY', desc: 'BLOG_DAILY 模块配置通道(日报)', reason: '命中日报分组' };
|
|
418
|
+
if (has((c) => c.serviceMark === 'document'))
|
|
419
|
+
return { channel: 'DOCUMENT', desc: 'DOCUMENT 模块配置通道(文档)', reason: '命中文档分组' };
|
|
420
|
+
if (has((c) => c.serviceMark === 'customer' || c.serviceMark === 'scrm')) {
|
|
421
|
+
return { channel: 'CRM', desc: 'CRM 模块配置通道(客户/商机/线索)', reason: '命中 CRM 分组' };
|
|
422
|
+
}
|
|
423
|
+
if (has((c) => c.serviceMark === 'esb'))
|
|
424
|
+
return { channel: 'ESB', desc: '动作流(ESB)—— 无标准问数通道,需人工确认', reason: '仅命中动作流分组' };
|
|
425
|
+
return { channel: 'DS', desc: '数据源通道(ds list / chart / stat / count)', reason: '通用' };
|
|
426
|
+
}
|
|
427
|
+
export async function dsFind(input, host) {
|
|
428
|
+
const keyword = String(input.name || input.keyword || '').trim();
|
|
429
|
+
if (!keyword)
|
|
430
|
+
throw dataValidationError('missing_argument', '缺少必填参数 --name <关键词>');
|
|
431
|
+
const sourceType = String(input.source_type || 'LOGIC');
|
|
432
|
+
const pageSize = Math.min(Math.max(Number(input.size || '100') || 100, 1), 2000);
|
|
433
|
+
const pages = Math.min(Math.max(Number(input.pages || '1') || 1, 1), 50);
|
|
434
|
+
const concurrency = Math.max(1, Number(input.concurrency || '10') || 10);
|
|
435
|
+
const appId = explicitAppId(input);
|
|
436
|
+
const picked = pickFindGroups(input, keyword);
|
|
437
|
+
const startedAt = Date.now();
|
|
438
|
+
let scan = await scanGroups(host, picked.groups, keyword, sourceType, pageSize, concurrency, appId, pages);
|
|
439
|
+
const keywordNorm = keyword.replace(/\s+/g, '').toLowerCase();
|
|
440
|
+
const looseSample = [];
|
|
441
|
+
let looseDropped = 0;
|
|
442
|
+
let rowsScanned = 0;
|
|
443
|
+
const applyStrict = (results) => results.map((result) => {
|
|
444
|
+
rowsScanned += result.records.length;
|
|
445
|
+
if (input.loose)
|
|
446
|
+
return result;
|
|
447
|
+
const keep = [];
|
|
448
|
+
const drop = [];
|
|
449
|
+
for (const record of result.records) {
|
|
450
|
+
const name = String(record.originalName || record.tableText || record.name || '').replace(/\s+/g, '').toLowerCase();
|
|
451
|
+
(name.includes(keywordNorm) ? keep : drop).push(record);
|
|
452
|
+
}
|
|
453
|
+
looseDropped += drop.length;
|
|
454
|
+
for (const item of drop.slice(0, 3)) {
|
|
455
|
+
if (looseSample.length < 6) {
|
|
456
|
+
looseSample.push({ groupId: result.groupId, name: String(item.originalName || item.tableText || item.name || '') });
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return { ...result, records: keep };
|
|
460
|
+
});
|
|
461
|
+
scan = applyStrict(scan);
|
|
462
|
+
let escalated = false;
|
|
463
|
+
const escalateOk = pages * pageSize <= 2000;
|
|
464
|
+
if (!scan.some((result) => result.records.length) && picked.mode === 'core' && !input.no_escalate && escalateOk) {
|
|
465
|
+
escalated = true;
|
|
466
|
+
const seen = new Set(picked.groups);
|
|
467
|
+
const extra = DS_GROUPS.map((item) => item[2]).filter((groupId) => !seen.has(groupId));
|
|
468
|
+
scan = scan.concat(applyStrict(await scanGroups(host, extra, keyword, sourceType, pageSize, concurrency, appId, pages)));
|
|
469
|
+
}
|
|
470
|
+
const elapsedMs = Date.now() - startedAt;
|
|
471
|
+
const okScan = scan.filter((result) => !result.error);
|
|
472
|
+
const errs = scan.filter((result) => result.error);
|
|
473
|
+
if (!okScan.length && errs.length && errs.some((result) => /登录态失效|401/.test(String(result.error)))) {
|
|
474
|
+
throw dataValidationError('session_expired', '登录态失效:请重新登录 weaver-work-cli(`weaver-work-cli auth login --base-url <域名>`)后重试(本次未取到任何分组)', 2);
|
|
475
|
+
}
|
|
476
|
+
const candidates = mergeCandidates(scan, input.limit);
|
|
477
|
+
const data = {
|
|
478
|
+
keyword,
|
|
479
|
+
sourceType,
|
|
480
|
+
scanMode: picked.mode + (escalated ? '+escalated' : ''),
|
|
481
|
+
scannedGroups: scan.length,
|
|
482
|
+
hitGroups: scan.filter((result) => result.records.length).length,
|
|
483
|
+
escalated,
|
|
484
|
+
elapsedMs,
|
|
485
|
+
concurrency,
|
|
486
|
+
candidates,
|
|
487
|
+
routeHint: routeHint(candidates),
|
|
488
|
+
nameFilter: input.loose
|
|
489
|
+
? { serverSide: false, filtered: false, pages, pageSize, rowsScanned, note: '--loose:未做本地过滤,直接采用后端返回' }
|
|
490
|
+
: {
|
|
491
|
+
serverSide: false,
|
|
492
|
+
filtered: true,
|
|
493
|
+
pages,
|
|
494
|
+
pageSize,
|
|
495
|
+
rowsScanned,
|
|
496
|
+
dropped: looseDropped,
|
|
497
|
+
sample: looseSample,
|
|
498
|
+
note: `端点 /api/dw/newetl/chatBi/ds/listByPage **当前忽略 name**(后端待升级)⇒ 本次为「抓 ${pages} 页 × ${pageSize} 行 + 本地按表名过滤」,共比对 ${rowsScanned} 行;`
|
|
499
|
+
+ `**未命中只代表未落在该窗口内,不等于该表不存在**(若该分组行数 > ${pages * pageSize} 请调大 --size/--pages)。后端支持 name 后自动恢复精确过滤,无需改调用方式。`,
|
|
500
|
+
},
|
|
501
|
+
scopeNote: scan.some((result) => result.groupId === 'weaver-ebuilder-form-service')
|
|
502
|
+
? (appId
|
|
503
|
+
? `本次已带 --app-id=${appId}(EB 分组按应用分域,用于限定/对齐应用范围)`
|
|
504
|
+
: '⚠️ 本次未带 --app-id:EB 分组(weaver-ebuilder-form-service)按应用分域,如需限定某个应用请带 --app-id <该应用ID>')
|
|
505
|
+
: null,
|
|
506
|
+
errors: errs.map((result) => ({ groupId: result.groupId, error: result.error })),
|
|
507
|
+
};
|
|
508
|
+
const lines = [
|
|
509
|
+
`== 找表「${keyword}」扫描 ${data.scannedGroups} 组 / 抓取 ${rowsScanned} 行 / 命中 ${data.hitGroups} 组 (${elapsedMs}ms${escalated ? ',已升级全扫' : ''}) ==`,
|
|
510
|
+
];
|
|
511
|
+
if (!candidates.length) {
|
|
512
|
+
lines.push(`(未命中) ⚠️ 端点当前忽略 name,本次是「抓 ${pages} 页 × ${pageSize} 行 + 本地过滤」比对 ${rowsScanned} 行;`);
|
|
513
|
+
lines.push(` **未命中 ≠ 该表不存在** —— 该分组行数若超过 ${pages * pageSize},请调大 --size(≤2000)/--pages(≤50)再试;`);
|
|
514
|
+
lines.push(' 也可显式指定 --groups a,b / --all-groups;分组清单见 ds groups。');
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
for (const candidate of candidates) {
|
|
518
|
+
const extra = candidate.alsoInGroups?.length
|
|
519
|
+
? ` [同实体亦见于: ${candidate.alsoInGroups.map((item) => item.groupId).join(', ')}]`
|
|
520
|
+
: '';
|
|
521
|
+
lines.push([
|
|
522
|
+
candidate.groupId,
|
|
523
|
+
candidate.tableId,
|
|
524
|
+
candidate.originalName || candidate.name,
|
|
525
|
+
candidate.physicalTable ? `物理表=${candidate.physicalTable}` : '',
|
|
526
|
+
candidate.appId ? `appId=${candidate.appId}` : '',
|
|
527
|
+
].filter(Boolean).join('\t') + extra);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
lines.push(`路由建议: ${data.routeHint.channel} —— ${data.routeHint.desc}`);
|
|
531
|
+
if (data.scopeNote)
|
|
532
|
+
lines.push(`范围提示: ${data.scopeNote}`);
|
|
533
|
+
if (errs.length)
|
|
534
|
+
lines.push(`⚠ 有 ${errs.length} 个分组请求失败(--json 看详情)`);
|
|
535
|
+
return { data, text: lines.join('\n') };
|
|
536
|
+
}
|
|
537
|
+
function collectFieldNodes(list, out, subName) {
|
|
538
|
+
for (const field of list || []) {
|
|
539
|
+
if (!field)
|
|
540
|
+
continue;
|
|
541
|
+
if (field.isDetailtable) {
|
|
542
|
+
const node = { subTableName: field.name, fields: [] };
|
|
543
|
+
collectFieldNodes(field.fields, node.fields, field.name);
|
|
544
|
+
out.push({ __detail: true, ...node });
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
out.push({
|
|
548
|
+
name: field.name,
|
|
549
|
+
text: field.text ?? null,
|
|
550
|
+
type: field.type ?? null,
|
|
551
|
+
dbFieldType: field.dbFieldType ?? null,
|
|
552
|
+
isPK: !!field.mainPrimaryKey,
|
|
553
|
+
subTable: subName || null,
|
|
554
|
+
dataKey: (field.config && field.config.dataKey) || null,
|
|
555
|
+
formTableId: (field.config && field.config.formTableId) || null,
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function normalizeFieldsResponse(response) {
|
|
561
|
+
const node = (response?.data || [])[0] || {};
|
|
562
|
+
const flat = [];
|
|
563
|
+
collectFieldNodes(node.fields, flat, null);
|
|
564
|
+
const main = flat.filter((item) => !item.__detail);
|
|
565
|
+
const detail = flat.filter((item) => item.__detail)
|
|
566
|
+
.map((item) => ({ subTableName: item.subTableName, fieldCount: item.fields.length, fields: item.fields }));
|
|
567
|
+
return {
|
|
568
|
+
tableName: node.name ?? null,
|
|
569
|
+
tableId: node.id ?? null,
|
|
570
|
+
mainCount: main.length,
|
|
571
|
+
detailCount: detail.reduce((sum, item) => sum + item.fieldCount, 0),
|
|
572
|
+
main,
|
|
573
|
+
detail,
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
function relatedHint(groupId, detailCount) {
|
|
577
|
+
if (groupId === 'weaver-ebuilder-form-service') {
|
|
578
|
+
return {
|
|
579
|
+
likelyApplicable: true,
|
|
580
|
+
tableOrigin: 'eb',
|
|
581
|
+
note: `EB 表:按 ebdf_obj ⋈ form_table ⋈ form 三表 JOIN 定位,再用 form_field / form_table_field 提关联字段;明细子表走 sub_form(本表明细字段 ${detailCount} 个)`,
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
if (/^weaver-workflow/.test(groupId)) {
|
|
585
|
+
return { likelyApplicable: true, tableOrigin: 'flow', note: '流程相关表:按 ec_weaver_wfp_fusion 的 form_field / form_table_field 提关联字段' };
|
|
586
|
+
}
|
|
587
|
+
if (groupId === 'weaver-formreport-service') {
|
|
588
|
+
return {
|
|
589
|
+
likelyApplicable: false,
|
|
590
|
+
tableOrigin: 'form-report',
|
|
591
|
+
note: '业务表单(formreport):表名是中文显示名、非物理表名 ⇒ relate-fields-extract 的 ①ETL ②SQL视图 ③④EB ⑤⑥流程 六类判定全部不适用,该跳必然空转,**不要发起**',
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
return { likelyApplicable: false, tableOrigin: 'unknown', note: '非 EB / 非流程表,关联字段提取通常不适用;如确需先按表名形态(sv_ / uf_ / 系统表名)人工确认' };
|
|
595
|
+
}
|
|
596
|
+
export async function dsDescribe(input, host) {
|
|
597
|
+
const groupId = needArg(input, 'group');
|
|
598
|
+
const tableId = String(needArg(input, 'table'));
|
|
599
|
+
const sourceType = String(input.source_type || 'LOGIC');
|
|
600
|
+
const startedAt = Date.now();
|
|
601
|
+
const branches = await Promise.all([
|
|
602
|
+
(async () => {
|
|
603
|
+
try {
|
|
604
|
+
const form = fieldsForm(groupId, tableId, sourceType);
|
|
605
|
+
const appId = explicitAppId(input);
|
|
606
|
+
if (appId)
|
|
607
|
+
form.appId = appId;
|
|
608
|
+
const response = await host.request({
|
|
609
|
+
method: 'POST',
|
|
610
|
+
path: '/api/ebuilder/common/ds/fields',
|
|
611
|
+
multipart: form,
|
|
612
|
+
operation: 'ds.describe.fields',
|
|
613
|
+
});
|
|
614
|
+
return { key: 'fields', value: normalizeFieldsResponse(response) };
|
|
615
|
+
}
|
|
616
|
+
catch (error) {
|
|
617
|
+
return { key: 'fields', error: String(error?.message || error) };
|
|
618
|
+
}
|
|
619
|
+
})(),
|
|
620
|
+
(async () => {
|
|
621
|
+
const skillKey = input.skill || 'data-source-query';
|
|
622
|
+
try {
|
|
623
|
+
const response = await host.request({
|
|
624
|
+
method: 'GET',
|
|
625
|
+
path: '/api/dw/newetl/chatBi/skill/getChatDocsBySkillKey',
|
|
626
|
+
query: { skillKey, sourceType, sourceGroupId: groupId, sourceTableId: tableId },
|
|
627
|
+
operation: 'ds.describe.lexicon',
|
|
628
|
+
});
|
|
629
|
+
const data = response?.data;
|
|
630
|
+
const missing = !data || !Array.isArray(data.nouns);
|
|
631
|
+
return {
|
|
632
|
+
key: 'lexicon',
|
|
633
|
+
value: {
|
|
634
|
+
skillKey,
|
|
635
|
+
sourceType,
|
|
636
|
+
sourceGroupId: groupId,
|
|
637
|
+
sourceTableId: tableId,
|
|
638
|
+
noLexicon: missing,
|
|
639
|
+
count: missing ? 0 : data.nouns.length,
|
|
640
|
+
nouns: missing ? [] : data.nouns.map((n) => ({
|
|
641
|
+
keyword: n.keyword ?? null,
|
|
642
|
+
synonyms: n.synonyms ?? null,
|
|
643
|
+
wordExplain: n.wordExplain ?? null,
|
|
644
|
+
})),
|
|
645
|
+
note: missing
|
|
646
|
+
? `该数据集无词库(后端:${response?.msg || '未返回 nouns'})—— 四参数均取自本次调用,故为**确定结论**;按铁律如实说明『该数据集暂无名词解释』,不自动建库、不新增名词`
|
|
647
|
+
: '词库命中:须先把每条规则逐条映射到 --where / --fields / --group-by / --stat 并自检无遗漏,再生成查询',
|
|
648
|
+
},
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
catch (error) {
|
|
652
|
+
return { key: 'lexicon', error: String(error?.message || error) };
|
|
653
|
+
}
|
|
654
|
+
})(),
|
|
655
|
+
]);
|
|
656
|
+
const data = { groupId, groupLabel: groupLabel(groupId), tableId, sourceType, branches: branches.length };
|
|
657
|
+
const errors = [];
|
|
658
|
+
for (const branch of branches) {
|
|
659
|
+
if (branch.error) {
|
|
660
|
+
data[branch.key] = { error: branch.error };
|
|
661
|
+
errors.push({ branch: branch.key, error: branch.error });
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
data[branch.key] = branch.value;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
data.relatedFields = relatedHint(groupId, data.fields?.detailCount || 0);
|
|
668
|
+
data.channelHint = routeHint([{ groupId, serviceMark: groupMark(groupId) }]);
|
|
669
|
+
data.permissionNote = groupId === 'weaver-ebuilder-form-service'
|
|
670
|
+
? '该分组是 EB 建模表单:取数不再做权限前置校验,--app-id 直接取 ebdf_obj.app_id(obj_id = ebdf_obj.id = 数据源 tableId)'
|
|
671
|
+
: '非 EB 分组,数据源通道无需 appId';
|
|
672
|
+
data.elapsedMs = Date.now() - startedAt;
|
|
673
|
+
if (errors.length && input.require) {
|
|
674
|
+
throw dataValidationError('describe_failed', `describe 存在失败分支,--require 下不继续:${JSON.stringify(errors)}`, 7);
|
|
675
|
+
}
|
|
676
|
+
const fields = data.fields || {};
|
|
677
|
+
const lexicon = data.lexicon || {};
|
|
678
|
+
const lines = [`== describe ${groupId} / ${tableId} (${data.elapsedMs}ms,并发 ${branches.length} 路) ==`];
|
|
679
|
+
lines.push(fields.error ? `字段: 失败 ${fields.error}` : `字段: 主表 ${fields.mainCount} 个,明细 ${fields.detailCount} 个(表名 ${fields.tableName ?? '-'})`);
|
|
680
|
+
lines.push(lexicon.error ? `词库: 失败 ${lexicon.error}` : `词库: ${lexicon.noLexicon ? '该数据集无词库' : `命中 ${lexicon.count} 条(skill=${lexicon.skillKey})`}`);
|
|
681
|
+
lines.push(`关联字段: ${data.relatedFields.likelyApplicable ? `适用(${data.relatedFields.tableOrigin})` : `不适用(${data.relatedFields.tableOrigin})`} —— ${data.relatedFields.note}`);
|
|
682
|
+
lines.push(`通道提示: ${data.channelHint.channel} —— ${data.channelHint.desc}`);
|
|
683
|
+
lines.push(`权限: ${data.permissionNote}`);
|
|
684
|
+
return { data, text: lines.join('\n') };
|
|
685
|
+
}
|
|
686
|
+
export { DS_GROUPS, groupLabel, groupMark };
|