weaver-work-cli 0.1.2 → 0.1.5
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 +176 -78
- package/dist/cmd/setup/index.js +5 -5
- package/dist/cmd/skills/index.js +1 -1
- package/dist/core/hooks.js +7 -0
- package/dist/index.js +0 -0
- package/dist/internal/e10/auth/commands.js +159 -54
- package/dist/internal/e10/auth/xiaoe.js +268 -0
- package/dist/internal/e10/context.js +16 -2
- package/dist/internal/e10/index.js +1 -0
- package/dist/internal/e10/request-runtime.js +345 -0
- package/dist/internal/skills/install.js +48 -6
- package/dist/internal/skills/reader.js +27 -0
- package/dist/shortcuts/archive/continuation.js +70 -0
- package/dist/shortcuts/archive/errors.js +53 -0
- package/dist/shortcuts/archive/host.js +197 -0
- package/dist/shortcuts/archive/index.js +363 -0
- package/dist/shortcuts/archive/manifest.js +45 -0
- package/dist/shortcuts/archive/operations/archive-info.js +55 -0
- package/dist/shortcuts/archive/operations/borrow-car.js +146 -0
- package/dist/shortcuts/archive/operations/borrow-list.js +200 -0
- package/dist/shortcuts/archive/operations/confirm.js +46 -0
- package/dist/shortcuts/archive/operations/download.js +238 -0
- package/dist/shortcuts/archive/operations/flow-url.js +240 -0
- package/dist/shortcuts/archive/operations/fonds.js +95 -0
- package/dist/shortcuts/archive/operations/getPageUrl.js +137 -0
- package/dist/shortcuts/archive/operations/registry.js +43 -0
- package/dist/shortcuts/archive/operations/search.js +88 -0
- package/dist/shortcuts/archive/operations/shared.js +120 -0
- package/dist/shortcuts/archive/operations/types.js +23 -0
- package/dist/shortcuts/archive/operations/upload.js +182 -0
- package/dist/shortcuts/archive/operations.js +13 -0
- package/dist/shortcuts/archive/render/search-format.js +276 -0
- package/dist/shortcuts/archive/render/search-view.js +125 -0
- package/dist/shortcuts/asset/continuation.js +70 -0
- package/dist/shortcuts/asset/errors.js +67 -0
- package/dist/shortcuts/asset/host.js +438 -0
- package/dist/shortcuts/asset/index.js +255 -0
- package/dist/shortcuts/asset/manifest.js +471 -0
- package/dist/shortcuts/asset/operations/query.js +249 -0
- package/dist/shortcuts/asset/operations/registry.js +85 -0
- package/dist/shortcuts/asset/operations/shared.js +100 -0
- package/dist/shortcuts/asset/operations/type-cache.js +49 -0
- package/dist/shortcuts/asset/operations/types.js +1 -0
- package/dist/shortcuts/asset/operations/viewlink.js +117 -0
- package/dist/shortcuts/asset/operations/write.js +435 -0
- package/dist/shortcuts/asset/operations.js +9 -0
- package/dist/shortcuts/calendar/continuation.js +70 -0
- package/dist/shortcuts/calendar/errors.js +53 -0
- package/dist/shortcuts/calendar/host.js +148 -0
- package/dist/shortcuts/calendar/index.js +125 -0
- package/dist/shortcuts/calendar/manifest.js +26 -0
- package/dist/shortcuts/calendar/operations/read.js +259 -0
- package/dist/shortcuts/calendar/operations/registry.js +31 -0
- package/dist/shortcuts/calendar/operations/shared.js +132 -0
- package/dist/shortcuts/calendar/operations/types.js +25 -0
- package/dist/shortcuts/calendar/operations/write.js +439 -0
- package/dist/shortcuts/calendar/operations.js +8 -0
- package/dist/shortcuts/ehr/continuation.js +70 -0
- package/dist/shortcuts/ehr/errors.js +53 -0
- package/dist/shortcuts/ehr/host.js +213 -0
- package/dist/shortcuts/ehr/index.js +205 -0
- package/dist/shortcuts/ehr/manifest.js +47 -0
- package/dist/shortcuts/ehr/operations/attend-read.js +373 -0
- package/dist/shortcuts/ehr/operations/attend-write.js +514 -0
- package/dist/shortcuts/ehr/operations/hr-contact.js +363 -0
- package/dist/shortcuts/ehr/operations/hr-ds.js +298 -0
- package/dist/shortcuts/ehr/operations/hr-report.js +386 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +1629 -0
- package/dist/shortcuts/ehr/operations/recruit.js +803 -0
- package/dist/shortcuts/ehr/operations/registry.js +43 -0
- package/dist/shortcuts/ehr/operations/salary.js +319 -0
- package/dist/shortcuts/ehr/operations/shared.js +246 -0
- package/dist/shortcuts/ehr/operations/types.js +25 -0
- package/dist/shortcuts/ehr/operations.js +25 -0
- package/dist/shortcuts/esb/continuation.js +70 -0
- package/dist/shortcuts/esb/errors.js +65 -0
- package/dist/shortcuts/esb/host.js +187 -0
- package/dist/shortcuts/esb/index.js +112 -0
- package/dist/shortcuts/esb/manifest.js +91 -0
- package/dist/shortcuts/esb/operations/input-format.js +31 -0
- package/dist/shortcuts/esb/operations/registry.js +48 -0
- package/dist/shortcuts/esb/operations/shared.js +152 -0
- package/dist/shortcuts/esb/operations/trigger.js +76 -0
- package/dist/shortcuts/esb/operations/types.js +21 -0
- package/dist/shortcuts/esb/operations.js +15 -0
- package/dist/shortcuts/fna/continuation.js +70 -0
- package/dist/shortcuts/fna/errors.js +59 -0
- package/dist/shortcuts/fna/host.js +146 -0
- package/dist/shortcuts/fna/index.js +111 -0
- package/dist/shortcuts/fna/manifest.js +41 -0
- package/dist/shortcuts/fna/operations/budget.js +124 -0
- package/dist/shortcuts/fna/operations/expense-center.js +148 -0
- package/dist/shortcuts/fna/operations/invoice-writeoff.js +212 -0
- package/dist/shortcuts/fna/operations/loan.js +195 -0
- package/dist/shortcuts/fna/operations/registry.js +35 -0
- package/dist/shortcuts/fna/operations/shared.js +210 -0
- package/dist/shortcuts/fna/operations/types.js +25 -0
- package/dist/shortcuts/fna/operations.js +19 -0
- package/dist/shortcuts/hrm/errors.js +38 -0
- package/dist/shortcuts/hrm/host.js +156 -0
- package/dist/shortcuts/hrm/index.js +111 -0
- package/dist/shortcuts/hrm/manifest.js +32 -0
- package/dist/shortcuts/hrm/operations/employee.js +338 -0
- package/dist/shortcuts/hrm/operations/org.js +110 -0
- package/dist/shortcuts/hrm/operations/position.js +176 -0
- package/dist/shortcuts/hrm/operations/registry.js +33 -0
- package/dist/shortcuts/hrm/operations/shared.js +143 -0
- package/dist/shortcuts/hrm/operations/types.js +23 -0
- package/dist/shortcuts/hrm/operations.js +19 -0
- package/dist/shortcuts/index.js +24 -0
- package/dist/shortcuts/invoice/host.js +99 -94
- package/dist/shortcuts/invoice/index.js +58 -59
- package/dist/shortcuts/invoice/manifest.js +200 -3
- package/dist/shortcuts/invoice/operations/browse-field.js +17 -0
- package/dist/shortcuts/invoice/operations/issuing.js +198 -0
- package/dist/shortcuts/invoice/operations/registry.js +17 -0
- package/dist/shortcuts/invoice/operations/reim.js +401 -0
- package/dist/shortcuts/invoice/operations/shared.js +247 -0
- package/dist/shortcuts/jiuchuanhui/cache.js +441 -0
- package/dist/shortcuts/jiuchuanhui/continuation.js +70 -0
- package/dist/shortcuts/jiuchuanhui/errors.js +59 -0
- package/dist/shortcuts/jiuchuanhui/host.js +159 -0
- package/dist/shortcuts/jiuchuanhui/index.js +109 -0
- package/dist/shortcuts/jiuchuanhui/manifest.js +469 -0
- package/dist/shortcuts/jiuchuanhui/operations/datajson.js +214 -0
- package/dist/shortcuts/jiuchuanhui/operations/esb.js +157 -0
- package/dist/shortcuts/jiuchuanhui/operations/generic.js +146 -0
- package/dist/shortcuts/jiuchuanhui/operations/registry.js +133 -0
- package/dist/shortcuts/jiuchuanhui/operations/shared.js +158 -0
- package/dist/shortcuts/jiuchuanhui/operations/types.js +1 -0
- package/dist/shortcuts/jiuchuanhui/operations.js +8 -0
- package/dist/shortcuts/mail/continuation.js +70 -0
- package/dist/shortcuts/mail/errors.js +53 -0
- package/dist/shortcuts/mail/host.js +182 -0
- package/dist/shortcuts/mail/index.js +519 -0
- package/dist/shortcuts/mail/manifest.js +38 -0
- package/dist/shortcuts/mail/operations/mail-blacklist.js +79 -0
- package/dist/shortcuts/mail/operations/mail-contacts.js +195 -0
- package/dist/shortcuts/mail/operations/mail-manage.js +335 -0
- package/dist/shortcuts/mail/operations/mail-read.js +508 -0
- package/dist/shortcuts/mail/operations/mail-send.js +474 -0
- package/dist/shortcuts/mail/operations/mail-sign.js +203 -0
- package/dist/shortcuts/mail/operations/mail-template.js +170 -0
- package/dist/shortcuts/mail/operations/registry.js +41 -0
- package/dist/shortcuts/mail/operations/shared.js +64 -0
- package/dist/shortcuts/mail/operations/types.js +27 -0
- package/dist/shortcuts/mail/operations.js +19 -0
- package/dist/shortcuts/meeting/continuation.js +70 -0
- package/dist/shortcuts/meeting/errors.js +63 -0
- package/dist/shortcuts/meeting/host.js +167 -0
- package/dist/shortcuts/meeting/index.js +123 -0
- package/dist/shortcuts/meeting/manifest.js +64 -0
- package/dist/shortcuts/meeting/operations/catalogs.js +58 -0
- package/dist/shortcuts/meeting/operations/change.js +242 -0
- package/dist/shortcuts/meeting/operations/conflicts.js +142 -0
- package/dist/shortcuts/meeting/operations/create.js +349 -0
- package/dist/shortcuts/meeting/operations/env.js +191 -0
- package/dist/shortcuts/meeting/operations/lifecycle.js +139 -0
- package/dist/shortcuts/meeting/operations/meetings.js +73 -0
- package/dist/shortcuts/meeting/operations/receipts.js +195 -0
- package/dist/shortcuts/meeting/operations/registry.js +47 -0
- package/dist/shortcuts/meeting/operations/rooms.js +132 -0
- package/dist/shortcuts/meeting/operations/shared.js +112 -0
- package/dist/shortcuts/meeting/operations/signs.js +41 -0
- package/dist/shortcuts/meeting/operations/types.js +25 -0
- package/dist/shortcuts/meeting/operations.js +19 -0
- package/dist/shortcuts/plan/continuation.js +70 -0
- package/dist/shortcuts/plan/errors.js +70 -0
- package/dist/shortcuts/plan/host.js +180 -0
- package/dist/shortcuts/plan/index.js +150 -0
- package/dist/shortcuts/plan/manifest.js +53 -0
- package/dist/shortcuts/plan/operations/link.js +256 -0
- package/dist/shortcuts/plan/operations/read.js +259 -0
- package/dist/shortcuts/plan/operations/registry.js +33 -0
- package/dist/shortcuts/plan/operations/shared.js +246 -0
- package/dist/shortcuts/plan/operations/types.js +49 -0
- package/dist/shortcuts/plan/operations/version.js +49 -0
- package/dist/shortcuts/plan/operations/write.js +710 -0
- package/dist/shortcuts/plan/operations.js +8 -0
- package/dist/shortcuts/yimiaoban/continuation.js +70 -0
- package/dist/shortcuts/yimiaoban/errors.js +61 -0
- package/dist/shortcuts/yimiaoban/host.js +469 -0
- package/dist/shortcuts/yimiaoban/index.js +271 -0
- package/dist/shortcuts/yimiaoban/manifest.js +28 -0
- package/dist/shortcuts/yimiaoban/operations/file-user.js +288 -0
- package/dist/shortcuts/yimiaoban/operations/group-read.js +477 -0
- package/dist/shortcuts/yimiaoban/operations/group-write.js +591 -0
- package/dist/shortcuts/yimiaoban/operations/msg-parse.js +429 -0
- package/dist/shortcuts/yimiaoban/operations/msg-sync.js +519 -0
- package/dist/shortcuts/yimiaoban/operations/msg-write.js +593 -0
- package/dist/shortcuts/yimiaoban/operations/person.js +102 -0
- package/dist/shortcuts/yimiaoban/operations/registry.js +38 -0
- package/dist/shortcuts/yimiaoban/operations/session.js +437 -0
- package/dist/shortcuts/yimiaoban/operations/shared.js +236 -0
- package/dist/shortcuts/yimiaoban/operations/types.js +27 -0
- package/dist/shortcuts/yimiaoban/operations/write-util.js +78 -0
- package/dist/shortcuts/yimiaoban/operations.js +8 -0
- package/docs/SKILL.md +11 -7
- package/docs/_catalog.md +28 -5
- package/docs/agent-invoice.md +19 -9
- package/docs/agent-skill-install.md +141 -22
- package/docs/calendar.md +87 -0
- package/docs/e10-auth.md +28 -9
- package/docs/ehr.md +186 -0
- package/docs/esb.md +64 -0
- package/docs/fna.md +72 -0
- package/docs/hrm.md +89 -0
- package/docs/invoice.md +61 -20
- package/docs/jiuchuanhui.md +131 -0
- package/docs/meeting.md +48 -0
- package/docs/operation-manual.md +443 -0
- package/docs/plan.md +82 -0
- package/docs/wenshuding.md +129 -0
- package/docs/yimiaoban.md +86 -0
- package/docs/ziguanjia.md +89 -0
- package/package.json +4 -4
- package/scripts/package-skill.mjs +127 -34
- package/scripts/postbuild.mjs +13 -0
- package/skill-template/business-info.json +16 -2
- package/skill-template/domains/calendar.md +15 -0
- package/skill-template/domains/esb.md +13 -0
- package/skill-template/domains/hrm.md +16 -0
- package/skill-template/domains/jiuchuanhui.md +23 -0
- package/skill-template/domains/jucailin.md +22 -0
- package/skill-template/domains/mail.md +21 -0
- package/skill-template/domains/meeting.md +3 -0
- package/skill-template/domains/plan.md +17 -0
- package/skill-template/domains/qiyecheng.md +17 -0
- package/skill-template/domains/shared.md +5 -3
- package/skill-template/domains/skill-maker.md +10 -0
- package/skill-template/domains/wenshuding.md +22 -0
- package/skill-template/domains/{invoice.md → yepiaotong.md} +4 -0
- package/skill-template/domains/yimiaoban.md +21 -0
- package/skill-template/domains/ziguanjia.md +21 -0
- package/skill-template/master-skill-template.md +12 -6
- package/skill-template/skill-template.md +26 -10
- package/skills/weaver-e10-calendar/SKILL.md +102 -0
- package/skills/weaver-e10-calendar/product.json +8 -0
- package/skills/weaver-e10-calendar/references/calendar-app-check.md +65 -0
- package/skills/weaver-e10-calendar/references/calendar-dict.md +55 -0
- package/skills/weaver-e10-calendar/references/calendar-query.md +70 -0
- package/skills/weaver-e10-calendar/references/calendar-write.md +97 -0
- package/skills/weaver-e10-calendar/references/source-manifest.json +54 -0
- package/skills/weaver-e10-esb/SKILL.md +103 -0
- package/skills/weaver-e10-esb/product.json +8 -0
- package/skills/weaver-e10-esb/references/input-format.md +52 -0
- package/skills/weaver-e10-esb/references/source-manifest.json +242 -0
- package/skills/weaver-e10-esb/references/trigger.md +99 -0
- package/skills/weaver-e10-hrm/SKILL.md +88 -0
- package/skills/weaver-e10-hrm/product.json +8 -0
- package/skills/weaver-e10-hrm/references/employee.md +109 -0
- package/skills/weaver-e10-hrm/references/org.md +95 -0
- package/skills/weaver-e10-hrm/references/position.md +95 -0
- package/skills/weaver-e10-hrm/references/source-manifest.json +121 -0
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +175 -0
- package/skills/weaver-e10-jiuchuanhui/product.json +8 -0
- package/skills/weaver-e10-jiuchuanhui/references/cache.md +110 -0
- package/skills/weaver-e10-jiuchuanhui/references/clue.md +61 -0
- package/skills/weaver-e10-jiuchuanhui/references/contact-plan.md +56 -0
- package/skills/weaver-e10-jiuchuanhui/references/contact-records.md +48 -0
- package/skills/weaver-e10-jiuchuanhui/references/contact.md +56 -0
- package/skills/weaver-e10-jiuchuanhui/references/customer.md +69 -0
- package/skills/weaver-e10-jiuchuanhui/references/disabled-capabilities.md +24 -0
- package/skills/weaver-e10-jiuchuanhui/references/discovery-config.md +60 -0
- package/skills/weaver-e10-jiuchuanhui/references/general-helpers.md +59 -0
- package/skills/weaver-e10-jiuchuanhui/references/jiuchuanhui-entry.md +60 -0
- package/skills/weaver-e10-jiuchuanhui/references/sale.md +72 -0
- package/skills/weaver-e10-jiuchuanhui/references/source-manifest.json +2632 -0
- package/skills/weaver-e10-jucailin/SKILL.md +102 -0
- package/skills/weaver-e10-jucailin/product.json +8 -0
- package/skills/weaver-e10-jucailin/references/attend-read.md +73 -0
- package/skills/weaver-e10-jucailin/references/attend-write.md +82 -0
- package/skills/weaver-e10-jucailin/references/hr-contact.md +92 -0
- package/skills/weaver-e10-jucailin/references/hr-datasource.md +104 -0
- package/skills/weaver-e10-jucailin/references/hr-report.md +76 -0
- package/skills/weaver-e10-jucailin/references/recruit-read.md +76 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +70 -0
- package/skills/weaver-e10-jucailin/references/safety-boundaries.md +35 -0
- package/skills/weaver-e10-jucailin/references/salary.md +110 -0
- package/skills/weaver-e10-jucailin/references/source-manifest.json +152 -0
- package/skills/weaver-e10-mail/SKILL.md +152 -0
- package/skills/weaver-e10-mail/product.json +8 -0
- package/skills/weaver-e10-mail/references/mail-agent-entry.md +47 -0
- package/skills/weaver-e10-mail/references/mail-attachment.md +30 -0
- package/skills/weaver-e10-mail/references/mail-blacklist.md +27 -0
- package/skills/weaver-e10-mail/references/mail-contacts.md +33 -0
- package/skills/weaver-e10-mail/references/mail-manage.md +44 -0
- package/skills/weaver-e10-mail/references/mail-read.md +76 -0
- package/skills/weaver-e10-mail/references/mail-send.md +43 -0
- package/skills/weaver-e10-mail/references/mail-sign.md +33 -0
- package/skills/weaver-e10-mail/references/mail-template.md +31 -0
- package/skills/weaver-e10-mail/references/safety-boundaries.md +32 -0
- package/skills/weaver-e10-meeting/SKILL.md +106 -0
- package/skills/weaver-e10-meeting/product.json +8 -0
- package/skills/weaver-e10-meeting/references/meeting-change.md +67 -0
- package/skills/weaver-e10-meeting/references/meeting-create.md +52 -0
- package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +57 -0
- package/skills/weaver-e10-meeting/references/meeting-queries.md +61 -0
- package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +48 -0
- package/skills/weaver-e10-meeting/references/meeting-update.md +7 -0
- package/skills/weaver-e10-meeting/references/source-manifest.json +50 -0
- package/skills/weaver-e10-plan/SKILL.md +140 -0
- package/skills/weaver-e10-plan/product.json +8 -0
- package/skills/weaver-e10-plan/references/plan-collect-and-compose.md +123 -0
- package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +138 -0
- package/skills/weaver-e10-plan/references/plan-report-query.md +154 -0
- package/skills/weaver-e10-plan/references/plan-report-remind.md +104 -0
- package/skills/weaver-e10-plan/references/plan-report-write.md +162 -0
- package/skills/weaver-e10-plan/references/source-manifest.json +858 -0
- package/skills/weaver-e10-qiyecheng/SKILL.md +119 -0
- package/skills/weaver-e10-qiyecheng/product.json +8 -0
- package/skills/weaver-e10-qiyecheng/references/budget.md +65 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +56 -0
- package/skills/weaver-e10-qiyecheng/references/expense-center.md +51 -0
- package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +57 -0
- package/skills/weaver-e10-qiyecheng/references/loan-management.md +59 -0
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +698 -0
- package/skills/weaver-e10-shared/SKILL.md +90 -0
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +127 -0
- package/skills/{weaver-work-cli-shared → weaver-e10-shared}/references/json-output-contract.md +34 -0
- package/skills/weaver-e10-shared/references/weaver-e10-installation.md +110 -0
- package/skills/weaver-e10-skill-maker/SKILL.md +78 -0
- package/skills/weaver-e10-skill-maker/product.json +8 -0
- package/skills/weaver-e10-skill-maker/references/business-skill-generation.md +124 -0
- package/skills/weaver-e10-skill-maker/references/detector-validation.md +101 -0
- package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +230 -0
- package/skills/weaver-e10-skill-maker/references/post-generation-install.md +105 -0
- package/skills/weaver-e10-skill-maker/references/source-update-detection.md +261 -0
- package/skills/weaver-e10-skill-maker/references/weaver-skill-style.md +141 -0
- package/skills/weaver-e10-wenshuding/SKILL.md +158 -0
- package/skills/weaver-e10-wenshuding/product.json +8 -0
- package/skills/weaver-e10-wenshuding/references/archive-agent-entry.md +63 -0
- package/skills/weaver-e10-wenshuding/references/archive-borrow-car.md +52 -0
- package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +52 -0
- package/skills/weaver-e10-wenshuding/references/archive-disabled-capabilities.md +22 -0
- package/skills/weaver-e10-wenshuding/references/archive-download.md +48 -0
- package/skills/weaver-e10-wenshuding/references/archive-flow.md +46 -0
- package/skills/weaver-e10-wenshuding/references/archive-fonds.md +34 -0
- package/skills/weaver-e10-wenshuding/references/archive-info.md +33 -0
- package/skills/weaver-e10-wenshuding/references/archive-search.md +52 -0
- package/skills/weaver-e10-wenshuding/references/archive-upload.md +41 -0
- package/skills/weaver-e10-wenshuding/references/source-manifest.json +517 -0
- package/skills/weaver-e10-yepiaotong/SKILL.md +184 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-add.md +1 -1
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-agent-entry.md +16 -9
- package/skills/weaver-e10-yepiaotong/references/invoice-browse-field-data.md +204 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-delete.md +1 -1
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-detail.md +13 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +28 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-download.md +9 -2
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-enterprise-list.md +12 -4
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-file-upload.md +9 -2
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-import.md +16 -7
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +120 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-field-rules.md +161 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing.md +99 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-ocr-preview.md +12 -4
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-personal-list.md +12 -4
- package/skills/weaver-e10-yepiaotong/references/invoice-red.md +261 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +97 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-update.md +1 -1
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-validation-preview.md +9 -2
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +1340 -0
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +845 -0
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +94 -0
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +449 -0
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +266 -0
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +494 -0
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +1103 -0
- package/skills/weaver-e10-yimiaoban/SKILL.md +104 -0
- package/skills/weaver-e10-yimiaoban/product.json +8 -0
- package/skills/weaver-e10-yimiaoban/references/ding-write.md +68 -0
- package/skills/weaver-e10-yimiaoban/references/error-codes.md +85 -0
- package/skills/weaver-e10-yimiaoban/references/field-resolution.md +46 -0
- package/skills/weaver-e10-yimiaoban/references/file-user-i18n.md +54 -0
- package/skills/weaver-e10-yimiaoban/references/group-read.md +55 -0
- package/skills/weaver-e10-yimiaoban/references/group-write.md +72 -0
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +59 -0
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +64 -0
- package/skills/weaver-e10-yimiaoban/references/person.md +44 -0
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +61 -0
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +47 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +485 -0
- package/skills/weaver-e10-ziguanjia/SKILL.md +163 -0
- package/skills/weaver-e10-ziguanjia/product.json +8 -0
- package/skills/weaver-e10-ziguanjia/references/source-manifest.json +147 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +65 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-create.md +45 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-depre.md +48 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-disabled-capabilities.md +22 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-purch.md +57 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-query.md +62 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-repair.md +83 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-resolve.md +49 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-return.md +70 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-update.md +45 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-use.md +60 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-viewlink.md +81 -0
- package/skills/weaver-work-cli-invoice/SKILL.md +0 -122
- package/skills/weaver-work-cli-invoice/references/invoice-disabled-capabilities.md +0 -26
- package/skills/weaver-work-cli-shared/SKILL.md +0 -63
- package/skills/weaver-work-cli-shared/references/e10-auth-and-session.md +0 -90
- package/skills/weaver-work-cli-shared/references/weaver-work-cli-installation.md +0 -73
- /package/skills/{weaver-work-cli-shared → weaver-e10-shared}/references/high-risk-write.md +0 -0
- /package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/product.json +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { requireE10Session } from '../../internal/e10/context.js';
|
|
2
|
+
import { getActiveProfile } from '../../internal/e10/auth/session.js';
|
|
3
|
+
import { E10ApiError, createE10RequestRuntime } from '../../internal/e10/request-runtime.js';
|
|
4
|
+
import { HrmCliError, hrmAuthError, hrmNetworkError, hrmValidationError } from './errors.js';
|
|
5
|
+
function inferProfile(ctx) {
|
|
6
|
+
const options = ctx.getGlobalOptions();
|
|
7
|
+
return options.profile || getActiveProfile();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* HRM 接口统一 WeaResult 响应契约:code=200 成功;403 未开启开关 / 400 参数错误 /
|
|
11
|
+
* 404 不存在即使 HTTP 200 也视为业务失败。
|
|
12
|
+
*/
|
|
13
|
+
export function isBusinessSuccess(value) {
|
|
14
|
+
if (!value || typeof value !== 'object')
|
|
15
|
+
return false;
|
|
16
|
+
if (value.code !== undefined && value.code !== null)
|
|
17
|
+
return Number(value.code) === 200;
|
|
18
|
+
if (typeof value.status === 'boolean')
|
|
19
|
+
return value.status;
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
export function businessMessage(value) {
|
|
23
|
+
if (!value || typeof value !== 'object')
|
|
24
|
+
return '泛微接口返回业务失败';
|
|
25
|
+
const candidates = [value.msg, value.message, value.data?.message];
|
|
26
|
+
for (const item of candidates) {
|
|
27
|
+
if (typeof item === 'string' && item.trim())
|
|
28
|
+
return item;
|
|
29
|
+
}
|
|
30
|
+
return '泛微接口返回业务失败';
|
|
31
|
+
}
|
|
32
|
+
function businessCode(value) {
|
|
33
|
+
if (!value || typeof value !== 'object')
|
|
34
|
+
return undefined;
|
|
35
|
+
const code = value.code ?? value.status;
|
|
36
|
+
if (typeof code === 'string' || typeof code === 'number')
|
|
37
|
+
return code;
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
function assertPath(requestPath) {
|
|
41
|
+
if (typeof requestPath !== 'string' || !requestPath.startsWith('/') || requestPath.startsWith('//')) {
|
|
42
|
+
throw hrmValidationError('path_invalid', '请求路径必须是相对绝对路径');
|
|
43
|
+
}
|
|
44
|
+
if (/^https?:/i.test(requestPath) || /[\r\n]/.test(requestPath) || requestPath.includes('/../')) {
|
|
45
|
+
throw hrmValidationError('path_invalid', '请求路径不允许跨域或路径逃逸');
|
|
46
|
+
}
|
|
47
|
+
if (!requestPath.startsWith('/api/')) {
|
|
48
|
+
throw hrmValidationError('path_not_allowed', '组织管理只能调用 /api/ 路径');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function omitEmptyQueryValues(query) {
|
|
52
|
+
if (!query)
|
|
53
|
+
return undefined;
|
|
54
|
+
return Object.fromEntries(Object.entries(query).filter(([, value]) => value !== '' && value !== undefined));
|
|
55
|
+
}
|
|
56
|
+
function mapRuntimeNetworkError(error) {
|
|
57
|
+
if (error instanceof E10ApiError && error.type === 'network') {
|
|
58
|
+
throw hrmNetworkError(error.subtype, error.message, {
|
|
59
|
+
retryable: error.retryable,
|
|
60
|
+
details: error.details,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
export function createHrmHost(ctx, dependencies = {}) {
|
|
66
|
+
let e10Session = null;
|
|
67
|
+
let sessionContext = null;
|
|
68
|
+
const requireSession = dependencies.requireSession || requireE10Session;
|
|
69
|
+
async function ensureSession() {
|
|
70
|
+
if (!e10Session) {
|
|
71
|
+
e10Session = await requireSession(ctx);
|
|
72
|
+
sessionContext = {
|
|
73
|
+
baseUrl: e10Session.getBaseUrl(),
|
|
74
|
+
profile: inferProfile(ctx),
|
|
75
|
+
userId: e10Session.userId,
|
|
76
|
+
tenantKey: e10Session.tenantKey,
|
|
77
|
+
eteamsId: e10Session.eteamsId,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return e10Session;
|
|
81
|
+
}
|
|
82
|
+
async function getSession() {
|
|
83
|
+
await ensureSession();
|
|
84
|
+
return sessionContext;
|
|
85
|
+
}
|
|
86
|
+
async function runtime() {
|
|
87
|
+
return createE10RequestRuntime(ctx, await ensureSession(), {
|
|
88
|
+
interceptors: dependencies.interceptors,
|
|
89
|
+
fetch: dependencies.fetch,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async function request(request) {
|
|
93
|
+
const { method, path, query, body, operation, headers: extraHeaders = {}, timeoutMs = 30_000 } = request;
|
|
94
|
+
assertPath(path);
|
|
95
|
+
// HRM 接口必须带 HRM 页面上下文(Referer),否则网关长时间无响应(实测防坑 2026-08)。
|
|
96
|
+
// 默认 /hrm/main;orgCard/positionCard 等场景由 operation 通过 headers 覆盖。
|
|
97
|
+
const session = await getSession();
|
|
98
|
+
const referer = extraHeaders.Referer || `${session.baseUrl}/hrm/main`;
|
|
99
|
+
const resolvedMethod = method || (body === undefined ? 'GET' : 'POST');
|
|
100
|
+
let response;
|
|
101
|
+
try {
|
|
102
|
+
response = await (await runtime()).requestJson({
|
|
103
|
+
module: 'hrm',
|
|
104
|
+
operation,
|
|
105
|
+
method: resolvedMethod,
|
|
106
|
+
path,
|
|
107
|
+
query: omitEmptyQueryValues(query),
|
|
108
|
+
body,
|
|
109
|
+
headers: { 'X-Requested-With': 'XMLHttpRequest', Referer: referer, ...extraHeaders },
|
|
110
|
+
timeoutMs,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
mapRuntimeNetworkError(error);
|
|
115
|
+
}
|
|
116
|
+
if (response.status === 401 || response.status === 302) {
|
|
117
|
+
throw hrmAuthError('session_expired', 'E10 登录态已失效,请先向用户确认 E10 登录域名,再运行 weaver-work-cli auth login --base-url <域名> 完成登录', { httpStatus: response.status });
|
|
118
|
+
}
|
|
119
|
+
if (response.parseError) {
|
|
120
|
+
if (response.status < 200 || response.status >= 300) {
|
|
121
|
+
throw new HrmCliError('api', 'http_error', `泛微接口 HTTP ${response.status}`, {
|
|
122
|
+
code: response.status,
|
|
123
|
+
details: { status: response.status },
|
|
124
|
+
exitCode: 1,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
throw hrmNetworkError('protocol', `接口返回不是合法 JSON(HTTP ${response.status})`, { retryable: false });
|
|
128
|
+
}
|
|
129
|
+
if (response.status < 200 || response.status >= 300) {
|
|
130
|
+
throw new HrmCliError('api', 'http_error', `泛微接口 HTTP ${response.status}`, {
|
|
131
|
+
code: response.status,
|
|
132
|
+
details: { status: response.status, message: businessMessage(response.value) },
|
|
133
|
+
exitCode: 1,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (!isBusinessSuccess(response.value)) {
|
|
137
|
+
const code = businessCode(response.value);
|
|
138
|
+
const message = businessMessage(response.value);
|
|
139
|
+
// 403 = AI 开放接口 / HRM 读权限未开启,提示明确处置而非盲目重试。
|
|
140
|
+
if (code === 403) {
|
|
141
|
+
throw new HrmCliError('api', 'permission_denied', message || '当前租户未开启组织管理读接口,请联系管理员开启后再试', {
|
|
142
|
+
code,
|
|
143
|
+
details: { code, message },
|
|
144
|
+
exitCode: 1,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
throw new HrmCliError('api', 'business_error', message, {
|
|
148
|
+
code,
|
|
149
|
+
details: { code, message },
|
|
150
|
+
exitCode: 1,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return response.value;
|
|
154
|
+
}
|
|
155
|
+
return { request, getSession };
|
|
156
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
|
|
3
|
+
import { createHrmHost } from './host.js';
|
|
4
|
+
import { hrmManifest } from './manifest.js';
|
|
5
|
+
import { executeHrmOperation } from './operations.js';
|
|
6
|
+
import { hrmValidationError } from './errors.js';
|
|
7
|
+
function asOptions(value) {
|
|
8
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
9
|
+
}
|
|
10
|
+
async function readStdin() {
|
|
11
|
+
const chunks = [];
|
|
12
|
+
for await (const chunk of process.stdin) {
|
|
13
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
14
|
+
}
|
|
15
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Windows PowerShell 的管道与 Set-Content -Encoding utf8 会在内容前写入 UTF-8 BOM,
|
|
19
|
+
* 且可能重复写入多次;JSON.parse 不接受前导 BOM,必须先剥离。
|
|
20
|
+
*/
|
|
21
|
+
function stripBom(value) {
|
|
22
|
+
return value.replace(/^\uFEFF+/, '');
|
|
23
|
+
}
|
|
24
|
+
export async function inputFrom(options, extra = {}) {
|
|
25
|
+
const opts = asOptions(options);
|
|
26
|
+
let input = {};
|
|
27
|
+
if (opts.input && opts.inputJson) {
|
|
28
|
+
throw hrmValidationError('input_conflict', '不能同时传 --input 和 --input-json');
|
|
29
|
+
}
|
|
30
|
+
if (opts.inputJson) {
|
|
31
|
+
input = parseJsonInput(String(opts.inputJson), '--input-json');
|
|
32
|
+
}
|
|
33
|
+
if (opts.input) {
|
|
34
|
+
let raw;
|
|
35
|
+
try {
|
|
36
|
+
raw = stripBom(opts.input === '-' ? await readStdin() : await readFile(String(opts.input), 'utf8'));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
throw hrmValidationError('input_unreadable', `无法读取 --input:${String(opts.input)}`);
|
|
40
|
+
}
|
|
41
|
+
input = parseJsonInput(raw, '--input');
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
...input,
|
|
45
|
+
...Object.fromEntries(Object.entries(extra).filter(([, value]) => value !== undefined && value !== '')),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function parseJsonInput(raw, label) {
|
|
49
|
+
try {
|
|
50
|
+
const parsed = JSON.parse(stripBom(raw));
|
|
51
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
52
|
+
throw new Error('input must be an object');
|
|
53
|
+
}
|
|
54
|
+
return parsed;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw hrmValidationError('input_invalid', `${label} 不是合法 JSON 对象`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export function successEnvelope(operation, result) {
|
|
61
|
+
return {
|
|
62
|
+
schemaVersion: 1,
|
|
63
|
+
ok: true,
|
|
64
|
+
operation,
|
|
65
|
+
data: result.data === undefined ? null : result.data,
|
|
66
|
+
...(result.meta ? { meta: result.meta } : {}),
|
|
67
|
+
warnings: [],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function failureEnvelope(error) {
|
|
71
|
+
const structured = error;
|
|
72
|
+
return {
|
|
73
|
+
schemaVersion: 1,
|
|
74
|
+
ok: false,
|
|
75
|
+
error: toErrorEnvelope(error),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async function executeAndPrint(ctx, operation, input) {
|
|
79
|
+
try {
|
|
80
|
+
const result = await executeHrmOperation(operation, input, {
|
|
81
|
+
ctx,
|
|
82
|
+
host: createHrmHost(ctx),
|
|
83
|
+
});
|
|
84
|
+
ctx.output.write(successEnvelope(operation, result), { json: true });
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.error(JSON.stringify(failureEnvelope(error), null, 2));
|
|
88
|
+
process.exitCode = isCliError(error) ? error.exitCode : ExitCode.GeneralError;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export const hrmShortcut = {
|
|
92
|
+
name: 'hrm',
|
|
93
|
+
description: '泛微E10组织管理(员工/组织/岗位查询)CLI',
|
|
94
|
+
category: 'shortcut',
|
|
95
|
+
register({ program, action }) {
|
|
96
|
+
const hrm = program.command('hrm').description('泛微E10组织管理(员工查询/组织架构/岗位查询)');
|
|
97
|
+
hrm.command('schema')
|
|
98
|
+
.description('Print hrm operation manifest for agents')
|
|
99
|
+
.action(action((ctx) => {
|
|
100
|
+
ctx.output.write(hrmManifest, { json: true });
|
|
101
|
+
}));
|
|
102
|
+
hrm.command('run')
|
|
103
|
+
.description('Run an hrm operation with JSON input')
|
|
104
|
+
.argument('<operation>', 'operation name, e.g. hrm.employee.query')
|
|
105
|
+
.option('--input <path>', 'JSON input file, or - for stdin')
|
|
106
|
+
.option('--input-json <json>', 'inline JSON input object')
|
|
107
|
+
.action(action(async (ctx, operation, options) => {
|
|
108
|
+
await executeAndPrint(ctx, String(operation), await inputFrom(options));
|
|
109
|
+
}));
|
|
110
|
+
},
|
|
111
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { hrmOperationDefinitions } from './operations/registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* 代理商查询(containsDls=true)禁用边界:仅泛微自用系统域名支持(自用域名白名单),
|
|
4
|
+
* 客户/其他环境禁止触发。未实现,不得编造或绕过。
|
|
5
|
+
*/
|
|
6
|
+
const DLS_WITHHELD = ['hrm.employee.dls'];
|
|
7
|
+
function buildOperations() {
|
|
8
|
+
return hrmOperationDefinitions().map((definition) => ({
|
|
9
|
+
name: definition.name,
|
|
10
|
+
resource: definition.resource,
|
|
11
|
+
summary: definition.summary,
|
|
12
|
+
risk: definition.risk,
|
|
13
|
+
inputSchema: definition.inputSchema,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
export const hrmManifest = {
|
|
17
|
+
schemaVersion: 1,
|
|
18
|
+
name: 'hrm',
|
|
19
|
+
title: '泛微E10组织管理(员工/组织/岗位查询)',
|
|
20
|
+
version: '0.1.0',
|
|
21
|
+
host: 'e10-hrm',
|
|
22
|
+
status: 'builtin',
|
|
23
|
+
sourceSkill: 'weaver-e10-hrm',
|
|
24
|
+
capabilities: ['employee', 'org', 'position'],
|
|
25
|
+
operations: buildOperations(),
|
|
26
|
+
withheldOperations: [
|
|
27
|
+
...DLS_WITHHELD.map((name) => ({
|
|
28
|
+
name,
|
|
29
|
+
reason: '代理商查询(containsDls=true)仅泛微自用系统域名支持(自用域名白名单),客户/其他环境禁止触发;未实现,不得编造或绕过。',
|
|
30
|
+
})),
|
|
31
|
+
],
|
|
32
|
+
};
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { hrmValidationError } from '../errors.js';
|
|
2
|
+
import { READ, SCHEMA_ID, SCHEMA_ID_LIST, SCHEMA_PAGE, hrmSuccess, schemaOf, } from './types.js';
|
|
3
|
+
import { browserBaseBody, inferEmployeeField, orgLink, personLink, resolveDepartmentIdByName, toNumber, toPositiveInt, toStringIdList, } from './shared.js';
|
|
4
|
+
const EMPLOYEE_STATUS = ['normal', '6'];
|
|
5
|
+
const SUBORDINATE_SCOPE = ['direct', 'indirect', 'all'];
|
|
6
|
+
const SUBORDINATE_BYID_SCOPE = ['direct', 'indirect'];
|
|
7
|
+
/** 手机号脱敏:3 位前缀 + **** + 末 4 位(与 hrm-cli.mjs 一致)。 */
|
|
8
|
+
function maskPhone(p) {
|
|
9
|
+
const s = p ? String(p) : '';
|
|
10
|
+
return (s && s.length >= 7) ? s.slice(0, 3) + '****' + s.slice(-4) : s;
|
|
11
|
+
}
|
|
12
|
+
/** 列表接口行 → 精简人员行(附人员卡片 link + 部门卡片 deptLink)。 */
|
|
13
|
+
function formatMember(r, baseUrl) {
|
|
14
|
+
const deptId = r.departmentId != null && r.departmentId !== '' ? String(r.departmentId) : '';
|
|
15
|
+
return {
|
|
16
|
+
name: r.name,
|
|
17
|
+
id: r.id,
|
|
18
|
+
userid: r.userid,
|
|
19
|
+
cid: r.cid,
|
|
20
|
+
department: r.department,
|
|
21
|
+
departmentId: deptId,
|
|
22
|
+
position: r.position,
|
|
23
|
+
mobile: maskPhone(r.mobile),
|
|
24
|
+
statusCode: r.statusCode,
|
|
25
|
+
link: personLink(baseUrl, r.id),
|
|
26
|
+
deptLink: deptId ? orgLink(baseUrl, deptId) : '',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** 批量详情行 → 精简人员行。 */
|
|
30
|
+
function formatBatch(u, baseUrl) {
|
|
31
|
+
const deptId = u.departmentId != null && u.departmentId !== '' ? String(u.departmentId) : '';
|
|
32
|
+
return {
|
|
33
|
+
name: u.name,
|
|
34
|
+
id: u.id,
|
|
35
|
+
jobNum: u.jobNum,
|
|
36
|
+
department: u.department,
|
|
37
|
+
departmentId: deptId,
|
|
38
|
+
subCompany: u.subCompany,
|
|
39
|
+
position: u.position,
|
|
40
|
+
mobile: maskPhone(u.mobile),
|
|
41
|
+
imCid: u.imCid,
|
|
42
|
+
link: personLink(baseUrl, u.id),
|
|
43
|
+
deptLink: deptId ? orgLink(baseUrl, deptId) : '',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** 员工浏览收敛条件解析:显式字段优先,其次 keyword 自动推断;空条件抛 empty_condition。 */
|
|
47
|
+
function resolveEmployeeCondition(args) {
|
|
48
|
+
const explicit = ['email', 'mobile', 'job_num', 'username'].find((k) => {
|
|
49
|
+
const v = args[k];
|
|
50
|
+
return v !== undefined && v !== null && String(v).trim() !== '';
|
|
51
|
+
});
|
|
52
|
+
if (explicit)
|
|
53
|
+
return { field: explicit, value: String(args[explicit]).trim() };
|
|
54
|
+
const keyword = args.keyword === undefined ? '' : String(args.keyword).trim();
|
|
55
|
+
if (!keyword) {
|
|
56
|
+
throw hrmValidationError('empty_condition', '员工查询必须携带至少一个收敛条件:keyword(自动推断)或 username/job_num/mobile/email 之一');
|
|
57
|
+
}
|
|
58
|
+
const inferred = inferEmployeeField(keyword);
|
|
59
|
+
return { field: inferred.key, value: inferred.value };
|
|
60
|
+
}
|
|
61
|
+
/** 员工浏览 / 下属查询的 formDatas 组织键空算子占位。 */
|
|
62
|
+
function memberFormDatasBase() {
|
|
63
|
+
return {
|
|
64
|
+
subcompany: [{ subcompanyOpt: 'in' }],
|
|
65
|
+
department: [{ departmentOpt: 'in' }],
|
|
66
|
+
role: [{ roleOpt: 'in' }],
|
|
67
|
+
position: [{ positionOpt: 'in' }],
|
|
68
|
+
superior: [{ superiorOpt: 'in' }],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const employeeQuery = {
|
|
72
|
+
name: 'hrm.employee.query',
|
|
73
|
+
resource: 'employee',
|
|
74
|
+
method: 'employee.query',
|
|
75
|
+
action: 'hrm.employee.query',
|
|
76
|
+
summary: '按工号/姓名/手机/邮箱(keyword 自动推断或显式字段)查询员工;默认在职,status 传 ["6"] 查离职',
|
|
77
|
+
risk: READ,
|
|
78
|
+
inputSchema: schemaOf({
|
|
79
|
+
keyword: { type: 'string', description: '查询关键词,自动推断:含 @→邮箱;11 位纯数字→手机;纯数字或字母开头含数字→工号;其余→姓名(模糊)' },
|
|
80
|
+
username: { type: 'string', description: '姓名(模糊匹配)' },
|
|
81
|
+
job_num: { type: 'string', description: '工号(模糊匹配)' },
|
|
82
|
+
mobile: { type: 'string', description: '手机号(模糊匹配)' },
|
|
83
|
+
email: { type: 'string', description: '邮箱(模糊匹配)' },
|
|
84
|
+
status: { type: 'array', items: { type: 'string', enum: [...EMPLOYEE_STATUS] }, description: '默认 ["normal"] 在职;["6"] 离职。不能单独作为收敛条件' },
|
|
85
|
+
...SCHEMA_PAGE,
|
|
86
|
+
}),
|
|
87
|
+
handler: async (args, { host }) => {
|
|
88
|
+
const { field, value } = resolveEmployeeCondition(args);
|
|
89
|
+
const status = Array.isArray(args.status) && args.status.length > 0 ? args.status : ['normal'];
|
|
90
|
+
const statusText = status.map((s) => {
|
|
91
|
+
const text = String(s);
|
|
92
|
+
if (!EMPLOYEE_STATUS.includes(text)) {
|
|
93
|
+
throw hrmValidationError('enum_invalid', `status 取值必须是 ${EMPLOYEE_STATUS.join(' / ')} 之一`);
|
|
94
|
+
}
|
|
95
|
+
return text;
|
|
96
|
+
});
|
|
97
|
+
const formDatas = {
|
|
98
|
+
...memberFormDatasBase(),
|
|
99
|
+
status: [{ statusSelect: statusText }],
|
|
100
|
+
[field]: [{ [`${field}Opt`]: 'in', [`${field}Input`]: value }],
|
|
101
|
+
};
|
|
102
|
+
const body = {
|
|
103
|
+
...browserBaseBody(),
|
|
104
|
+
cmd: 'all',
|
|
105
|
+
formDatas,
|
|
106
|
+
quickSearchDatas: {},
|
|
107
|
+
type: 'and',
|
|
108
|
+
containsNoneAccount: false,
|
|
109
|
+
containsPartTimeEmployee: false,
|
|
110
|
+
containsDls: false,
|
|
111
|
+
};
|
|
112
|
+
const current = toPositiveInt(args.current, 'current');
|
|
113
|
+
const pageSize = toNumber(args.pageSize, 'pageSize');
|
|
114
|
+
if (current !== undefined)
|
|
115
|
+
body.current = current;
|
|
116
|
+
if (pageSize !== undefined)
|
|
117
|
+
body.pageSize = pageSize;
|
|
118
|
+
const session = await host.getSession();
|
|
119
|
+
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
120
|
+
const countResp = await host.request({ method: 'POST', path: '/api/hrm/common/browser/count/resource', body });
|
|
121
|
+
const dataResp = await host.request({ method: 'POST', path: '/api/hrm/common/browser/data/resource', body });
|
|
122
|
+
const total = Number(countResp?.data?.total ?? 0);
|
|
123
|
+
const rawRows = dataResp?.data?.data ?? [];
|
|
124
|
+
const rows = rawRows.map((r) => formatMember(r, baseUrl));
|
|
125
|
+
const lookingNormal = statusText.includes('normal');
|
|
126
|
+
const hint = lookingNormal && rows.length === 0
|
|
127
|
+
? `在职员工未查到「${value}」;若为离职人员,请用 status=["6"] 再查`
|
|
128
|
+
: undefined;
|
|
129
|
+
return hrmSuccess('hrm.employee.query', {
|
|
130
|
+
rows,
|
|
131
|
+
total,
|
|
132
|
+
...(hint ? { hint } : {}),
|
|
133
|
+
}, { current: current ?? 1, pageSize: pageSize ?? 200 });
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
const employeeBatch = {
|
|
137
|
+
name: 'hrm.employee.batch',
|
|
138
|
+
resource: 'employee',
|
|
139
|
+
method: 'employee.batch',
|
|
140
|
+
action: 'hrm.employee.batch',
|
|
141
|
+
summary: '按人员 id 列表批量查询精简详情(每批 ≤100 自动分批,不含部门/岗位/上级名称)',
|
|
142
|
+
risk: READ,
|
|
143
|
+
inputSchema: schemaOf({
|
|
144
|
+
ids: { ...SCHEMA_ID_LIST, description: '人员 id 列表(长整型按字符串)' },
|
|
145
|
+
}, { required: ['ids'] }),
|
|
146
|
+
handler: async (args, { host }) => {
|
|
147
|
+
const ids = toStringIdList(args.ids, 'ids');
|
|
148
|
+
if (!ids || ids.length === 0) {
|
|
149
|
+
throw hrmValidationError('ids_required', 'ids 必填且不能为空');
|
|
150
|
+
}
|
|
151
|
+
const session = await host.getSession();
|
|
152
|
+
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
153
|
+
const collected = [];
|
|
154
|
+
for (let i = 0; i < ids.length; i += 100) {
|
|
155
|
+
const resp = await host.request({
|
|
156
|
+
method: 'POST',
|
|
157
|
+
path: '/api/hrm/common/getEmployeeByIds',
|
|
158
|
+
body: { userIdList: ids.slice(i, i + 100), externalIdList: [] },
|
|
159
|
+
headers: { devtype: '5' },
|
|
160
|
+
});
|
|
161
|
+
const userList = resp?.data?.userList ?? [];
|
|
162
|
+
collected.push(...userList);
|
|
163
|
+
}
|
|
164
|
+
const rows = collected.map((r) => formatBatch(r, baseUrl));
|
|
165
|
+
return hrmSuccess('hrm.employee.batch', { rows, total: rows.length });
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
const employeeDetail = {
|
|
169
|
+
name: 'hrm.employee.detail',
|
|
170
|
+
resource: 'employee',
|
|
171
|
+
method: 'employee.detail',
|
|
172
|
+
action: 'hrm.employee.detail',
|
|
173
|
+
summary: '按人员 id 取资料名片(头像/是否管理员/管理者类型/在线状态);不含姓名/工号/部门/手机',
|
|
174
|
+
risk: READ,
|
|
175
|
+
inputSchema: schemaOf({ id: SCHEMA_ID }, { required: ['id'] }),
|
|
176
|
+
handler: async (args, { host }) => {
|
|
177
|
+
const id = String(args.id).trim();
|
|
178
|
+
if (!id)
|
|
179
|
+
throw hrmValidationError('id_required', 'id 必填');
|
|
180
|
+
const resp = await host.request({ method: 'GET', path: '/api/hrm/profile/get', query: { id } });
|
|
181
|
+
const data = resp?.data ?? {};
|
|
182
|
+
const session = await host.getSession();
|
|
183
|
+
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
184
|
+
return hrmSuccess('hrm.employee.detail', { ...data, link: personLink(baseUrl, id) });
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
const subordinateMine = {
|
|
188
|
+
name: 'hrm.subordinate.mine',
|
|
189
|
+
resource: 'employee',
|
|
190
|
+
method: 'subordinate.mine',
|
|
191
|
+
action: 'hrm.subordinate.mine',
|
|
192
|
+
summary: '查当前登录人的下属(all 所有/direct 直接/indirect 间接),基于当前会话身份',
|
|
193
|
+
risk: READ,
|
|
194
|
+
inputSchema: schemaOf({
|
|
195
|
+
scope: { type: 'string', enum: [...SUBORDINATE_SCOPE], description: '默认 all;direct 直接 / indirect 间接 / all 所有' },
|
|
196
|
+
...SCHEMA_PAGE,
|
|
197
|
+
}),
|
|
198
|
+
handler: async (args, { host }) => {
|
|
199
|
+
const scope = args.scope === undefined ? 'all' : String(args.scope);
|
|
200
|
+
const subSelected = { direct: 'directSubordinate', indirect: 'indirectSubordinate', all: 'allSubordinate' }[scope] ?? 'allSubordinate';
|
|
201
|
+
const body = {
|
|
202
|
+
...browserBaseBody(),
|
|
203
|
+
cmd: 'mySubordinate',
|
|
204
|
+
subSelected,
|
|
205
|
+
companyId: '1',
|
|
206
|
+
formDatas: {},
|
|
207
|
+
quickSearchDatas: {},
|
|
208
|
+
type: 'and',
|
|
209
|
+
containsNoneAccount: true,
|
|
210
|
+
containsPartTimeEmployee: false,
|
|
211
|
+
};
|
|
212
|
+
const current = toPositiveInt(args.current, 'current');
|
|
213
|
+
const pageSize = toNumber(args.pageSize, 'pageSize');
|
|
214
|
+
if (current !== undefined)
|
|
215
|
+
body.current = current;
|
|
216
|
+
if (pageSize !== undefined)
|
|
217
|
+
body.pageSize = pageSize;
|
|
218
|
+
const session = await host.getSession();
|
|
219
|
+
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
220
|
+
const countResp = await host.request({ method: 'POST', path: '/api/hrm/common/browser/count/resource', body });
|
|
221
|
+
const dataResp = await host.request({ method: 'POST', path: '/api/hrm/common/browser/data/resource', body });
|
|
222
|
+
const total = Number(countResp?.data?.total ?? 0);
|
|
223
|
+
const rawRows = dataResp?.data?.data ?? [];
|
|
224
|
+
const rows = rawRows.map((r) => formatMember(r, baseUrl));
|
|
225
|
+
return hrmSuccess('hrm.subordinate.mine', { rows, total, scope }, { current: current ?? 1, pageSize: pageSize ?? 200 });
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
const subordinateById = {
|
|
229
|
+
name: 'hrm.subordinate.by-id',
|
|
230
|
+
resource: 'employee',
|
|
231
|
+
method: 'subordinate.by-id',
|
|
232
|
+
action: 'hrm.subordinate.by-id',
|
|
233
|
+
summary: '按目标人员 id 查其直接/间接下属(无需切换会话);所有下属 = direct + indirect 两次并集',
|
|
234
|
+
risk: READ,
|
|
235
|
+
inputSchema: schemaOf({
|
|
236
|
+
id: SCHEMA_ID,
|
|
237
|
+
scope: { type: 'string', enum: [...SUBORDINATE_BYID_SCOPE], description: '默认 direct;direct 直接 / indirect 间接' },
|
|
238
|
+
pageNo: SCHEMA_ID,
|
|
239
|
+
pageSize: SCHEMA_ID,
|
|
240
|
+
}, { required: ['id'] }),
|
|
241
|
+
handler: async (args, { host }) => {
|
|
242
|
+
const id = String(args.id).trim();
|
|
243
|
+
if (!id)
|
|
244
|
+
throw hrmValidationError('id_required', 'id 必填');
|
|
245
|
+
const scope = args.scope === undefined ? 'direct' : String(args.scope);
|
|
246
|
+
const path = scope === 'indirect'
|
|
247
|
+
? `/api/bs/hrm/user/myIndirectSubordinates/${id}`
|
|
248
|
+
: `/api/bs/hrm/user/myDirectSubordinates/${id}`;
|
|
249
|
+
const pageNo = toPositiveInt(args.pageNo, 'pageNo') ?? 1;
|
|
250
|
+
const pageSize = toNumber(args.pageSize, 'pageSize') ?? 10;
|
|
251
|
+
const session = await host.getSession();
|
|
252
|
+
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
253
|
+
const resp = await host.request({
|
|
254
|
+
method: 'GET',
|
|
255
|
+
path,
|
|
256
|
+
query: { id, pageNo, pageSize, virtualId: '', isMobile: 'false' },
|
|
257
|
+
headers: { Referer: `${baseUrl}/hrm/addressbook/department` },
|
|
258
|
+
});
|
|
259
|
+
const page = resp?.data?.page ?? {};
|
|
260
|
+
const rawRows = Array.isArray(page.result) ? page.result : [];
|
|
261
|
+
const rows = rawRows.map((r) => ({
|
|
262
|
+
id: r.id ?? r.employeeId,
|
|
263
|
+
name: r.name ?? r.username,
|
|
264
|
+
pinyin: r.pinyin,
|
|
265
|
+
telephone: r.telephone,
|
|
266
|
+
sex: r.sex,
|
|
267
|
+
personnelStatus: r.personnelStatus,
|
|
268
|
+
department: r.department,
|
|
269
|
+
position: r.position,
|
|
270
|
+
superior: r.superior,
|
|
271
|
+
link: personLink(baseUrl, r.id ?? r.employeeId),
|
|
272
|
+
}));
|
|
273
|
+
return hrmSuccess('hrm.subordinate.by-id', {
|
|
274
|
+
rows,
|
|
275
|
+
total: Number(page.totalCount ?? rows.length),
|
|
276
|
+
scope,
|
|
277
|
+
page: {
|
|
278
|
+
pageNo,
|
|
279
|
+
pageSize,
|
|
280
|
+
hasNext: page.hasNext ?? false,
|
|
281
|
+
totalPages: page.totalPages ?? 1,
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
const deptMembers = {
|
|
287
|
+
name: 'hrm.dept.members',
|
|
288
|
+
resource: 'employee',
|
|
289
|
+
method: 'dept.members',
|
|
290
|
+
action: 'hrm.dept.members',
|
|
291
|
+
summary: '查某部门/分部下的直接成员(部门名或 id;部门名需唯一,重名改用 id)',
|
|
292
|
+
risk: READ,
|
|
293
|
+
inputSchema: schemaOf({
|
|
294
|
+
dept: { type: 'string', description: '部门/分部名称(需唯一)或组织节点 id' },
|
|
295
|
+
...SCHEMA_PAGE,
|
|
296
|
+
}, { required: ['dept'] }),
|
|
297
|
+
handler: async (args, { host }) => {
|
|
298
|
+
const raw = args.dept === undefined ? '' : String(args.dept).trim();
|
|
299
|
+
if (!raw)
|
|
300
|
+
throw hrmValidationError('dept_required', 'dept 必填');
|
|
301
|
+
// 纯数字视为组织 id,否则按部门名称精确定位(重名报 dept_ambiguous)。
|
|
302
|
+
const deptId = /^\d+$/.test(raw) ? raw : String((await resolveDepartmentIdByName(host, raw)).id);
|
|
303
|
+
const body = {
|
|
304
|
+
...browserBaseBody(),
|
|
305
|
+
secretLevel: '',
|
|
306
|
+
cmd: 'teams',
|
|
307
|
+
leftTreeSelectedId: deptId,
|
|
308
|
+
formDatas: {
|
|
309
|
+
username: [{ usernameOpt: 'in' }],
|
|
310
|
+
status: [{ statusSelect: ['normal'] }],
|
|
311
|
+
subcompany: [{ subcompanyOpt: 'in' }],
|
|
312
|
+
department: [{ departmentOpt: 'in' }],
|
|
313
|
+
role: [{ roleOpt: 'in' }],
|
|
314
|
+
position: [{ positionOpt: 'in' }],
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
const current = toPositiveInt(args.current, 'current');
|
|
318
|
+
const pageSize = toNumber(args.pageSize, 'pageSize') ?? 200;
|
|
319
|
+
if (current !== undefined)
|
|
320
|
+
body.current = current;
|
|
321
|
+
if (pageSize !== undefined)
|
|
322
|
+
body.pageSize = pageSize;
|
|
323
|
+
const resp = await host.request({ method: 'POST', path: '/api/mail/base/common/browser/data/resource', body });
|
|
324
|
+
const rawRows = resp?.data?.data ?? [];
|
|
325
|
+
const session = await host.getSession();
|
|
326
|
+
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
327
|
+
const rows = rawRows.map((r) => formatMember(r, baseUrl));
|
|
328
|
+
return hrmSuccess('hrm.dept.members', { dept: { id: deptId }, rows, total: rows.length }, { current: current ?? 1, pageSize: pageSize ?? 200 });
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
export const hrmEmployeeOperations = [
|
|
332
|
+
employeeQuery,
|
|
333
|
+
employeeBatch,
|
|
334
|
+
employeeDetail,
|
|
335
|
+
subordinateMine,
|
|
336
|
+
subordinateById,
|
|
337
|
+
deptMembers,
|
|
338
|
+
];
|