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,514 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { ehrConfirmationError, ehrPartialError, ehrValidationError, EhrCliError } from '../errors.js';
|
|
3
|
+
import { READ, SCHEMA_DATE, SCHEMA_ID, ehrSuccess, schemaOf, WRITE, } from './types.js';
|
|
4
|
+
import { assertEnum, assertEnumArray, compact, pickDefined, toIdList } from './shared.js';
|
|
5
|
+
const CONTINUATION_TTL_SECONDS = 600;
|
|
6
|
+
const CARD_TYPES = ['CHECKIN', 'CHECKOUT', 'LEAVE', 'RETURN', 'CHECKIN_AND_RETURN', 'CHECKOUT_AND_LEAVE'];
|
|
7
|
+
const APPEAL_TYPES = [
|
|
8
|
+
'leave',
|
|
9
|
+
'overTime',
|
|
10
|
+
'businessTrip',
|
|
11
|
+
'respLeave',
|
|
12
|
+
'manualSignFlow',
|
|
13
|
+
'outSide',
|
|
14
|
+
'processChange',
|
|
15
|
+
'reissueCard',
|
|
16
|
+
'schedulingShift',
|
|
17
|
+
'substitute',
|
|
18
|
+
];
|
|
19
|
+
const HANDLE_RESULTS = ['APPROVE', 'REJECT', 'INVALID'];
|
|
20
|
+
export const CARD_CHECK_NOTICE = [
|
|
21
|
+
'【考勤打卡说明】',
|
|
22
|
+
'- 若考勤打卡方式开启了“允许 PC 电脑端打卡”,可通过本技能进行签到、签退打卡;',
|
|
23
|
+
'- 若设置为只允许移动端打卡并开启了地图定位校验、WiFi 校验等,智能工具无法获取当前定位位置信息,无法完成考勤打卡,请使用 IM APP 移动端、移动端企业微信等移动端完成考勤打卡。',
|
|
24
|
+
].join('\n');
|
|
25
|
+
function fingerprint(value) {
|
|
26
|
+
return createHash('sha256').update(JSON.stringify(value ?? null)).digest('hex').slice(0, 32);
|
|
27
|
+
}
|
|
28
|
+
function requireConfirm(args, action) {
|
|
29
|
+
if (args.confirm !== true) {
|
|
30
|
+
throw ehrConfirmationError(action, { hint: '重新调用时传入 confirm=true 与 prepare 返回的 continuation' });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** 校验 continuation 与当前登录上下文一致,避免切换租户/账号后误执行写操作。 */
|
|
34
|
+
async function verifyLease(args, action, env) {
|
|
35
|
+
const lease = await env.continuation.verify(args.continuation, action);
|
|
36
|
+
const session = await env.host.getSession();
|
|
37
|
+
if (lease.baseUrl !== session.baseUrl || lease.profile !== session.profile || lease.userId !== session.userId) {
|
|
38
|
+
throw ehrValidationError('context_mismatch', '确认上下文已变化(租户或登录账号不同),请重新执行 prepare');
|
|
39
|
+
}
|
|
40
|
+
return lease;
|
|
41
|
+
}
|
|
42
|
+
function isNetworkError(error) {
|
|
43
|
+
return error instanceof EhrCliError && error.type === 'network';
|
|
44
|
+
}
|
|
45
|
+
const attendCardStatus = {
|
|
46
|
+
name: 'ehr.attend.card.status',
|
|
47
|
+
resource: 'attend',
|
|
48
|
+
method: 'card.status',
|
|
49
|
+
action: 'ehr.attend.card.status',
|
|
50
|
+
summary: '查询当前打卡按钮状态,返回 timecardStatus(CHECKIN 表示应打上班卡,CHECKOUT 表示应打下班卡)',
|
|
51
|
+
capability: 'attend',
|
|
52
|
+
risk: READ,
|
|
53
|
+
inputSchema: schemaOf({}),
|
|
54
|
+
handler: async (_args, { host }) => {
|
|
55
|
+
const response = await host.request({
|
|
56
|
+
method: 'POST',
|
|
57
|
+
path: '/api/attend/card/attendinfo/getAttendCheckButtonStatus',
|
|
58
|
+
body: {},
|
|
59
|
+
});
|
|
60
|
+
return ehrSuccess('ehr.attend.card.status', response?.data);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
// PC 端考勤打卡
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
const cardCheckSchema = {
|
|
67
|
+
type: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
enum: [...CARD_TYPES],
|
|
70
|
+
description: 'CHECKIN 上班签到 / CHECKOUT 下班签退 / LEAVE 外出 / RETURN 返回 / CHECKIN_AND_RETURN 上班+返回 / CHECKOUT_AND_LEAVE 下班+外出',
|
|
71
|
+
},
|
|
72
|
+
addTime: { type: 'string', pattern: '^\\d{14}$', description: '格式 yyyyMMddHHmmss,仅租户开启多时区时生效' },
|
|
73
|
+
};
|
|
74
|
+
const ehrAttendCardCheckPrepare = {
|
|
75
|
+
name: 'ehr.attend.card.check.prepare',
|
|
76
|
+
resource: 'attend',
|
|
77
|
+
method: 'card.check.prepare',
|
|
78
|
+
action: 'ehr.attend.card.check.prepare',
|
|
79
|
+
summary: '准备 PC 端考勤打卡:校验打卡类型并生成确认预览,不发送打卡请求',
|
|
80
|
+
capability: 'attend',
|
|
81
|
+
risk: WRITE,
|
|
82
|
+
requiresConfirmation: true,
|
|
83
|
+
inputSchema: schemaOf({ ...cardCheckSchema }, { required: ['type'] }),
|
|
84
|
+
handler: async (args, { host, continuation }) => {
|
|
85
|
+
const type = assertEnum(args.type, CARD_TYPES, 'type');
|
|
86
|
+
const session = await host.getSession();
|
|
87
|
+
if (!session.userId || !session.eteamsId || !session.tenantKey) {
|
|
88
|
+
throw ehrValidationError('card_sign_unavailable', '无法构造打卡凭证:当前登录态缺少 empId、ETEAMSID 或 tenantKey,请重新登录后重试');
|
|
89
|
+
}
|
|
90
|
+
const preview = {
|
|
91
|
+
type,
|
|
92
|
+
attendSource: 'pc',
|
|
93
|
+
addTime: args.addTime,
|
|
94
|
+
empId: session.userId,
|
|
95
|
+
profile: session.profile,
|
|
96
|
+
baseUrl: session.baseUrl,
|
|
97
|
+
notice: CARD_CHECK_NOTICE,
|
|
98
|
+
};
|
|
99
|
+
const token = await continuation.issue({
|
|
100
|
+
operation: 'ehr.attend.card.check.apply',
|
|
101
|
+
baseUrl: session.baseUrl,
|
|
102
|
+
profile: session.profile,
|
|
103
|
+
userId: session.userId,
|
|
104
|
+
payload: { type, addTime: args.addTime },
|
|
105
|
+
fingerprint: fingerprint(preview),
|
|
106
|
+
}, CONTINUATION_TTL_SECONDS * 1000);
|
|
107
|
+
return ehrSuccess('ehr.attend.card.check.prepare', {
|
|
108
|
+
status: 'AWAITING_CONFIRMATION',
|
|
109
|
+
preview,
|
|
110
|
+
continuation: token,
|
|
111
|
+
expiresInSeconds: CONTINUATION_TTL_SECONDS,
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
const ehrAttendCardCheckApply = {
|
|
116
|
+
name: 'ehr.attend.card.check.apply',
|
|
117
|
+
resource: 'attend',
|
|
118
|
+
method: 'card.check.apply',
|
|
119
|
+
action: 'ehr.attend.card.check.apply',
|
|
120
|
+
summary: '执行 PC 端考勤打卡;必须在用户明确确认后调用,且要求 prepare 返回的 continuation',
|
|
121
|
+
capability: 'attend',
|
|
122
|
+
risk: WRITE,
|
|
123
|
+
requiresConfirmation: true,
|
|
124
|
+
inputSchema: schemaOf({
|
|
125
|
+
...cardCheckSchema,
|
|
126
|
+
confirm: { const: true },
|
|
127
|
+
continuation: { type: 'string', minLength: 1 },
|
|
128
|
+
}, { required: ['type', 'confirm', 'continuation'] }),
|
|
129
|
+
handler: async (args, env) => {
|
|
130
|
+
requireConfirm(args, 'ehr.attend.card.check.apply');
|
|
131
|
+
const type = assertEnum(args.type, CARD_TYPES, 'type');
|
|
132
|
+
const lease = await verifyLease(args, 'ehr.attend.card.check.apply', env);
|
|
133
|
+
const payload = (lease.payload || {});
|
|
134
|
+
if (payload.type !== type) {
|
|
135
|
+
throw ehrValidationError('target_changed', '打卡类型与 prepare 时的快照不一致,请重新执行 prepare');
|
|
136
|
+
}
|
|
137
|
+
// 凭证在 apply 阶段按最新会话重新构造,避免 continuation 中携带可复用的签名材料。
|
|
138
|
+
const sign = await env.host.buildCardSign();
|
|
139
|
+
const session = await env.host.getSession();
|
|
140
|
+
const body = {
|
|
141
|
+
type,
|
|
142
|
+
sign,
|
|
143
|
+
// 必须显式声明 pc:否则服务端按 UA 判定来源,非浏览器 UA 会被判为非 PC 来源并在要求定位时直接失败。
|
|
144
|
+
attendSource: 'pc',
|
|
145
|
+
};
|
|
146
|
+
if (args.addTime !== undefined)
|
|
147
|
+
body.addTime = args.addTime;
|
|
148
|
+
let response;
|
|
149
|
+
try {
|
|
150
|
+
response = await env.host.request({
|
|
151
|
+
method: 'POST',
|
|
152
|
+
path: '/api/attend/card/attendinfo/check',
|
|
153
|
+
query: { ETEAMSID: session.eteamsId },
|
|
154
|
+
body,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
if (isNetworkError(error)) {
|
|
159
|
+
throw ehrPartialError('打卡请求发送后连接中断,是否打卡成功不确定,禁止自动重试,请通过 ehr.attend.card.status 或打卡记录复核', { attempted: { type } }, { stage: 'card.check' });
|
|
160
|
+
}
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
return ehrSuccess('ehr.attend.card.check.apply', {
|
|
164
|
+
status: 'COMPLETE',
|
|
165
|
+
result: response?.data,
|
|
166
|
+
message: response?.data?.message,
|
|
167
|
+
notice: CARD_CHECK_NOTICE,
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
// 创建申诉
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
const appealItemSchema = {
|
|
175
|
+
type: 'object',
|
|
176
|
+
additionalProperties: false,
|
|
177
|
+
properties: {
|
|
178
|
+
appealType: { type: 'string', enum: [...APPEAL_TYPES] },
|
|
179
|
+
checkin: { type: 'string', pattern: '^\\d{2}:\\d{2}$' },
|
|
180
|
+
checkout: { type: 'string', pattern: '^\\d{2}:\\d{2}$' },
|
|
181
|
+
vacation: { type: 'string' },
|
|
182
|
+
nextday: { type: 'boolean' },
|
|
183
|
+
},
|
|
184
|
+
required: ['appealType'],
|
|
185
|
+
};
|
|
186
|
+
const appealSaveSchema = {
|
|
187
|
+
attendDay: { type: 'string', pattern: '^\\d{8}$', description: '考勤日期,格式 yyyyMMdd,注意不是 yyyy-MM-dd' },
|
|
188
|
+
periodId: { oneOf: [{ type: 'integer' }, { type: 'string', minLength: 1 }] },
|
|
189
|
+
attendInfoKey: { type: 'string', minLength: 1 },
|
|
190
|
+
appeals: { type: 'array', items: appealItemSchema, minItems: 1 },
|
|
191
|
+
appealDesc: { type: 'string' },
|
|
192
|
+
timecardId: { oneOf: [{ type: 'integer' }, { type: 'string' }] },
|
|
193
|
+
attendStatus: { type: 'string' },
|
|
194
|
+
nextDayVal: { type: 'boolean' },
|
|
195
|
+
appealId: { type: 'string' },
|
|
196
|
+
userId: { oneOf: [{ type: 'integer', minimum: 1 }, { type: 'string', minLength: 1 }] },
|
|
197
|
+
};
|
|
198
|
+
function validateAppeals(value) {
|
|
199
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
200
|
+
throw ehrValidationError('appeals_required', 'appeals 必填且至少包含一项');
|
|
201
|
+
}
|
|
202
|
+
return value.map((item, index) => {
|
|
203
|
+
if (!item || typeof item !== 'object' || Array.isArray(item)) {
|
|
204
|
+
throw ehrValidationError('appeal_item_invalid', `appeals[${index}] 必须是对象`);
|
|
205
|
+
}
|
|
206
|
+
const record = item;
|
|
207
|
+
return {
|
|
208
|
+
appealType: assertEnum(record.appealType, APPEAL_TYPES, `appeals[${index}].appealType`),
|
|
209
|
+
...pickDefined(record, ['checkin', 'checkout', 'vacation', 'nextday']),
|
|
210
|
+
};
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
const ehrAttendAppealSavePrepare = {
|
|
214
|
+
name: 'ehr.attend.appeal.save.prepare',
|
|
215
|
+
resource: 'attend',
|
|
216
|
+
method: 'appeal.save.prepare',
|
|
217
|
+
action: 'ehr.attend.appeal.save.prepare',
|
|
218
|
+
summary: '准备创建考勤申诉:校验参数(传 userId 时先校验可申诉状态)并生成确认预览,不提交申诉',
|
|
219
|
+
capability: 'attend',
|
|
220
|
+
risk: WRITE,
|
|
221
|
+
requiresConfirmation: true,
|
|
222
|
+
inputSchema: schemaOf({ ...appealSaveSchema }, { required: ['attendDay', 'periodId', 'attendInfoKey', 'appeals'] }),
|
|
223
|
+
handler: async (args, { host, continuation }) => {
|
|
224
|
+
const appeals = validateAppeals(args.appeals);
|
|
225
|
+
let appealable;
|
|
226
|
+
let appealformIds;
|
|
227
|
+
if (args.userId !== undefined) {
|
|
228
|
+
const gate = await host.request({
|
|
229
|
+
method: 'GET',
|
|
230
|
+
path: '/api/attend/web/attendinfo/getAppealformId',
|
|
231
|
+
query: { userId: String(args.userId) },
|
|
232
|
+
});
|
|
233
|
+
const gateData = gate?.data || {};
|
|
234
|
+
appealable = gateData.stillShowAppeal === true;
|
|
235
|
+
appealformIds = gateData.appealformIds;
|
|
236
|
+
if (!appealable) {
|
|
237
|
+
throw ehrValidationError('appeal_not_allowed', '当前不可申诉(stillShowAppeal=false),不要继续提交申诉', {
|
|
238
|
+
appealformIds,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const preview = {
|
|
243
|
+
attendDay: args.attendDay,
|
|
244
|
+
periodId: String(args.periodId),
|
|
245
|
+
attendInfoKey: args.attendInfoKey,
|
|
246
|
+
appeals,
|
|
247
|
+
appealDesc: args.appealDesc,
|
|
248
|
+
timecardId: args.timecardId !== undefined ? String(args.timecardId) : undefined,
|
|
249
|
+
attendStatus: args.attendStatus,
|
|
250
|
+
nextDayVal: args.nextDayVal,
|
|
251
|
+
appealable,
|
|
252
|
+
};
|
|
253
|
+
const session = await host.getSession();
|
|
254
|
+
const token = await continuation.issue({
|
|
255
|
+
operation: 'ehr.attend.appeal.save.apply',
|
|
256
|
+
baseUrl: session.baseUrl,
|
|
257
|
+
profile: session.profile,
|
|
258
|
+
userId: session.userId,
|
|
259
|
+
payload: { ...preview },
|
|
260
|
+
fingerprint: fingerprint(preview),
|
|
261
|
+
}, CONTINUATION_TTL_SECONDS * 1000);
|
|
262
|
+
return ehrSuccess('ehr.attend.appeal.save.prepare', {
|
|
263
|
+
status: 'AWAITING_CONFIRMATION',
|
|
264
|
+
preview,
|
|
265
|
+
continuation: token,
|
|
266
|
+
expiresInSeconds: CONTINUATION_TTL_SECONDS,
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
const ehrAttendAppealSaveApply = {
|
|
271
|
+
name: 'ehr.attend.appeal.save.apply',
|
|
272
|
+
resource: 'attend',
|
|
273
|
+
method: 'appeal.save.apply',
|
|
274
|
+
action: 'ehr.attend.appeal.save.apply',
|
|
275
|
+
summary: '提交考勤申诉;会生成审批流程,必须在用户明确确认后调用',
|
|
276
|
+
capability: 'attend',
|
|
277
|
+
risk: WRITE,
|
|
278
|
+
requiresConfirmation: true,
|
|
279
|
+
inputSchema: schemaOf({
|
|
280
|
+
...appealSaveSchema,
|
|
281
|
+
userId: undefined,
|
|
282
|
+
confirm: { const: true },
|
|
283
|
+
continuation: { type: 'string', minLength: 1 },
|
|
284
|
+
}, { required: ['attendDay', 'periodId', 'attendInfoKey', 'appeals', 'confirm', 'continuation'] }),
|
|
285
|
+
handler: async (args, env) => {
|
|
286
|
+
requireConfirm(args, 'ehr.attend.appeal.save.apply');
|
|
287
|
+
const appeals = validateAppeals(args.appeals);
|
|
288
|
+
const lease = await verifyLease(args, 'ehr.attend.appeal.save.apply', env);
|
|
289
|
+
const payload = (lease.payload || {});
|
|
290
|
+
// 申诉目标一旦变化(日期/时段/理由),继续提交会写错对象,必须重新确认。
|
|
291
|
+
for (const key of ['attendDay', 'periodId', 'attendInfoKey', 'appealDesc']) {
|
|
292
|
+
if (String(payload[key] ?? '') !== String(args[key] ?? '')) {
|
|
293
|
+
throw ehrValidationError('target_changed', `申诉参数 ${key} 与 prepare 时的快照不一致,请重新执行 prepare`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const body = {
|
|
297
|
+
attendDay: args.attendDay,
|
|
298
|
+
periodId: String(args.periodId),
|
|
299
|
+
attendInfoKey: args.attendInfoKey,
|
|
300
|
+
appeals,
|
|
301
|
+
...pickDefined(args, ['appealDesc', 'attendStatus', 'nextDayVal', 'appealId']),
|
|
302
|
+
};
|
|
303
|
+
if (args.timecardId !== undefined)
|
|
304
|
+
body.timecardId = String(args.timecardId);
|
|
305
|
+
let response;
|
|
306
|
+
try {
|
|
307
|
+
response = await env.host.request({
|
|
308
|
+
method: 'POST',
|
|
309
|
+
path: '/api/attend/web/attendinfo/saveAttendAppealInfo',
|
|
310
|
+
body: compact(body),
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
if (isNetworkError(error)) {
|
|
315
|
+
throw ehrPartialError('申诉提交请求发送后连接中断,是否已提交不确定,禁止自动重试,请通过 ehr.attend.appeal.list 复核', { attempted: { attendDay: args.attendDay, periodId: args.periodId } }, { stage: 'appeal.save' });
|
|
316
|
+
}
|
|
317
|
+
throw error;
|
|
318
|
+
}
|
|
319
|
+
return ehrSuccess('ehr.attend.appeal.save.apply', {
|
|
320
|
+
status: 'COMPLETE',
|
|
321
|
+
result: response?.data,
|
|
322
|
+
verifyHint: '可通过 ehr.attend.appeal.list 回查申诉是否已生成',
|
|
323
|
+
});
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
// ---------------------------------------------------------------------------
|
|
327
|
+
// 处理申诉
|
|
328
|
+
// ---------------------------------------------------------------------------
|
|
329
|
+
const appealResultSchema = {
|
|
330
|
+
id: { type: 'string', pattern: '^\\d+$', description: '申诉记录 ID,来自 appeal.list' },
|
|
331
|
+
handleResult: { type: 'string', enum: [...HANDLE_RESULTS] },
|
|
332
|
+
suggestion: { type: 'string', maxLength: 500 },
|
|
333
|
+
};
|
|
334
|
+
const ehrAttendAppealResultPrepare = {
|
|
335
|
+
name: 'ehr.attend.appeal.result.prepare',
|
|
336
|
+
resource: 'attend',
|
|
337
|
+
method: 'appeal.result.prepare',
|
|
338
|
+
action: 'ehr.attend.appeal.result.prepare',
|
|
339
|
+
summary: '准备处理申诉(通过/退回/无效):生成确认预览,不提交处理',
|
|
340
|
+
capability: 'attend',
|
|
341
|
+
risk: WRITE,
|
|
342
|
+
requiresConfirmation: true,
|
|
343
|
+
inputSchema: schemaOf({ ...appealResultSchema }, { required: ['id', 'handleResult'] }),
|
|
344
|
+
handler: async (args, { host, continuation }) => {
|
|
345
|
+
const handleResult = assertEnum(args.handleResult, HANDLE_RESULTS, 'handleResult');
|
|
346
|
+
const preview = {
|
|
347
|
+
id: String(args.id),
|
|
348
|
+
handleResult,
|
|
349
|
+
suggestion: args.suggestion,
|
|
350
|
+
};
|
|
351
|
+
const session = await host.getSession();
|
|
352
|
+
const token = await continuation.issue({
|
|
353
|
+
operation: 'ehr.attend.appeal.result.apply',
|
|
354
|
+
baseUrl: session.baseUrl,
|
|
355
|
+
profile: session.profile,
|
|
356
|
+
userId: session.userId,
|
|
357
|
+
payload: preview,
|
|
358
|
+
fingerprint: fingerprint(preview),
|
|
359
|
+
}, CONTINUATION_TTL_SECONDS * 1000);
|
|
360
|
+
return ehrSuccess('ehr.attend.appeal.result.prepare', {
|
|
361
|
+
status: 'AWAITING_CONFIRMATION',
|
|
362
|
+
preview,
|
|
363
|
+
continuation: token,
|
|
364
|
+
expiresInSeconds: CONTINUATION_TTL_SECONDS,
|
|
365
|
+
});
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
const ehrAttendAppealResultApply = {
|
|
369
|
+
name: 'ehr.attend.appeal.result.apply',
|
|
370
|
+
resource: 'attend',
|
|
371
|
+
method: 'appeal.result.apply',
|
|
372
|
+
action: 'ehr.attend.appeal.result.apply',
|
|
373
|
+
summary: '提交申诉处理结果;不可逆转,必须在用户明确确认后调用',
|
|
374
|
+
capability: 'attend',
|
|
375
|
+
risk: WRITE,
|
|
376
|
+
requiresConfirmation: true,
|
|
377
|
+
inputSchema: schemaOf({ ...appealResultSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['id', 'handleResult', 'confirm', 'continuation'] }),
|
|
378
|
+
handler: async (args, env) => {
|
|
379
|
+
requireConfirm(args, 'ehr.attend.appeal.result.apply');
|
|
380
|
+
const handleResult = assertEnum(args.handleResult, HANDLE_RESULTS, 'handleResult');
|
|
381
|
+
const lease = await verifyLease(args, 'ehr.attend.appeal.result.apply', env);
|
|
382
|
+
const payload = (lease.payload || {});
|
|
383
|
+
if (String(payload.id ?? '') !== String(args.id) || payload.handleResult !== handleResult) {
|
|
384
|
+
throw ehrValidationError('target_changed', '申诉目标或处理结果与 prepare 时的快照不一致,请重新执行 prepare');
|
|
385
|
+
}
|
|
386
|
+
const body = {
|
|
387
|
+
id: Number(args.id),
|
|
388
|
+
handleResult,
|
|
389
|
+
};
|
|
390
|
+
if (args.suggestion !== undefined)
|
|
391
|
+
body.suggestion = args.suggestion;
|
|
392
|
+
let response;
|
|
393
|
+
try {
|
|
394
|
+
response = await env.host.request({
|
|
395
|
+
method: 'POST',
|
|
396
|
+
path: '/api/attend/web/appeal/updateResult',
|
|
397
|
+
body,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
catch (error) {
|
|
401
|
+
if (isNetworkError(error)) {
|
|
402
|
+
throw ehrPartialError('申诉处理请求发送后连接中断,是否已处理不确定,禁止自动重试,请通过 ehr.attend.appeal.list 复核', { attempted: { id: args.id, handleResult } }, { stage: 'appeal.result' });
|
|
403
|
+
}
|
|
404
|
+
throw error;
|
|
405
|
+
}
|
|
406
|
+
return ehrSuccess('ehr.attend.appeal.result.apply', {
|
|
407
|
+
status: 'COMPLETE',
|
|
408
|
+
result: response?.data,
|
|
409
|
+
verifyHint: '可通过 ehr.attend.appeal.list 回查处理结果',
|
|
410
|
+
});
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
// ---------------------------------------------------------------------------
|
|
414
|
+
// 报表重算
|
|
415
|
+
// ---------------------------------------------------------------------------
|
|
416
|
+
const recalcSchema = {
|
|
417
|
+
beginDate: SCHEMA_DATE,
|
|
418
|
+
endDate: SCHEMA_DATE,
|
|
419
|
+
onlyEmpIds: { type: 'array', items: SCHEMA_ID, description: '限定重算的人员 ID;不传则重算全部' },
|
|
420
|
+
};
|
|
421
|
+
const ehrAttendReportRecalcPrepare = {
|
|
422
|
+
name: 'ehr.attend.report.recalc.prepare',
|
|
423
|
+
resource: 'attend',
|
|
424
|
+
method: 'report.recalc.prepare',
|
|
425
|
+
action: 'ehr.attend.report.recalc.prepare',
|
|
426
|
+
summary: '准备考勤报表重算:校验日期范围与人员范围并生成确认预览,不触发重算',
|
|
427
|
+
capability: 'attend',
|
|
428
|
+
risk: WRITE,
|
|
429
|
+
requiresConfirmation: true,
|
|
430
|
+
inputSchema: schemaOf({ ...recalcSchema }, { required: ['beginDate', 'endDate'] }),
|
|
431
|
+
handler: async (args, { host, continuation }) => {
|
|
432
|
+
const { beginDate, endDate } = args;
|
|
433
|
+
if (beginDate > endDate) {
|
|
434
|
+
throw ehrValidationError('date_range_invalid', 'beginDate 不得晚于 endDate');
|
|
435
|
+
}
|
|
436
|
+
const onlyEmpIds = toIdList(args.onlyEmpIds, 'onlyEmpIds');
|
|
437
|
+
const preview = {
|
|
438
|
+
beginDate,
|
|
439
|
+
endDate,
|
|
440
|
+
onlyEmpIds,
|
|
441
|
+
scope: onlyEmpIds?.length ? `指定 ${onlyEmpIds.length} 人` : '全部人员',
|
|
442
|
+
};
|
|
443
|
+
const session = await host.getSession();
|
|
444
|
+
const token = await continuation.issue({
|
|
445
|
+
operation: 'ehr.attend.report.recalc.apply',
|
|
446
|
+
baseUrl: session.baseUrl,
|
|
447
|
+
profile: session.profile,
|
|
448
|
+
userId: session.userId,
|
|
449
|
+
payload: preview,
|
|
450
|
+
fingerprint: fingerprint(preview),
|
|
451
|
+
}, CONTINUATION_TTL_SECONDS * 1000);
|
|
452
|
+
return ehrSuccess('ehr.attend.report.recalc.prepare', {
|
|
453
|
+
status: 'AWAITING_CONFIRMATION',
|
|
454
|
+
preview,
|
|
455
|
+
continuation: token,
|
|
456
|
+
expiresInSeconds: CONTINUATION_TTL_SECONDS,
|
|
457
|
+
});
|
|
458
|
+
},
|
|
459
|
+
};
|
|
460
|
+
const ehrAttendReportRecalcApply = {
|
|
461
|
+
name: 'ehr.attend.report.recalc.apply',
|
|
462
|
+
resource: 'attend',
|
|
463
|
+
method: 'report.recalc.apply',
|
|
464
|
+
action: 'ehr.attend.report.recalc.apply',
|
|
465
|
+
summary: '触发考勤报表异步重算;会占用服务端资源且同一时刻仅允许一个任务,必须在用户明确确认后调用',
|
|
466
|
+
capability: 'attend',
|
|
467
|
+
risk: WRITE,
|
|
468
|
+
requiresConfirmation: true,
|
|
469
|
+
inputSchema: schemaOf({ ...recalcSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['beginDate', 'endDate', 'confirm', 'continuation'] }),
|
|
470
|
+
handler: async (args, env) => {
|
|
471
|
+
requireConfirm(args, 'ehr.attend.report.recalc.apply');
|
|
472
|
+
const lease = await verifyLease(args, 'ehr.attend.report.recalc.apply', env);
|
|
473
|
+
const payload = (lease.payload || {});
|
|
474
|
+
if (payload.beginDate !== args.beginDate || payload.endDate !== args.endDate) {
|
|
475
|
+
throw ehrValidationError('target_changed', '重算日期范围与 prepare 时的快照不一致,请重新执行 prepare');
|
|
476
|
+
}
|
|
477
|
+
const body = { beginDate: args.beginDate, endDate: args.endDate };
|
|
478
|
+
const onlyEmpIds = toIdList(args.onlyEmpIds, 'onlyEmpIds');
|
|
479
|
+
if (onlyEmpIds?.length)
|
|
480
|
+
body.onlyEmpIds = onlyEmpIds;
|
|
481
|
+
let response;
|
|
482
|
+
try {
|
|
483
|
+
response = await env.host.request({
|
|
484
|
+
method: 'POST',
|
|
485
|
+
path: '/api/attend/web/attendWorkTimeSummaryReport/recalcStatus',
|
|
486
|
+
body,
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
catch (error) {
|
|
490
|
+
if (isNetworkError(error)) {
|
|
491
|
+
throw ehrPartialError('重算请求发送后连接中断,任务是否已提交不确定,禁止自动重试;重算为异步任务,请稍后通过出勤报表复核', { attempted: { beginDate: args.beginDate, endDate: args.endDate } }, { stage: 'report.recalc' });
|
|
492
|
+
}
|
|
493
|
+
throw error;
|
|
494
|
+
}
|
|
495
|
+
return ehrSuccess('ehr.attend.report.recalc.apply', {
|
|
496
|
+
status: 'COMPLETE',
|
|
497
|
+
result: response?.data,
|
|
498
|
+
async: true,
|
|
499
|
+
verifyHint: '重算是异步任务,提交成功不代表计算完成;可通过 ehr.attend.report.get 复核',
|
|
500
|
+
});
|
|
501
|
+
},
|
|
502
|
+
};
|
|
503
|
+
export const attendWriteOperations = [
|
|
504
|
+
attendCardStatus,
|
|
505
|
+
ehrAttendCardCheckPrepare,
|
|
506
|
+
ehrAttendCardCheckApply,
|
|
507
|
+
ehrAttendAppealSavePrepare,
|
|
508
|
+
ehrAttendAppealSaveApply,
|
|
509
|
+
ehrAttendAppealResultPrepare,
|
|
510
|
+
ehrAttendAppealResultApply,
|
|
511
|
+
ehrAttendReportRecalcPrepare,
|
|
512
|
+
ehrAttendReportRecalcApply,
|
|
513
|
+
];
|
|
514
|
+
export { assertEnumArray };
|