weaver-work-cli 0.1.1 → 0.1.4
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 +187 -76
- 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 +160 -55
- package/dist/internal/e10/auth/crypto.js +7 -22
- package/dist/internal/e10/auth/session.js +1 -1
- 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 +344 -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 +20 -0
- package/dist/shortcuts/invoice/host.js +99 -94
- package/dist/shortcuts/invoice/index.js +65 -61
- package/dist/shortcuts/invoice/manifest.js +222 -14
- package/dist/shortcuts/invoice/operations/browse-field.js +17 -0
- package/dist/shortcuts/invoice/operations/issuing.js +198 -0
- package/dist/shortcuts/invoice/operations/ocr-preview.js +6 -3
- 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 +271 -6
- package/dist/shortcuts/invoice/operations/validate-preview.js +1 -1
- 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/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/docs/SKILL.md +11 -7
- package/docs/_catalog.md +23 -5
- package/docs/agent-invoice.md +31 -10
- package/docs/agent-skill-install.md +211 -0
- 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 +66 -20
- package/docs/jiuchuanhui.md +131 -0
- package/docs/operation-manual.md +443 -0
- package/docs/plan.md +82 -0
- package/docs/wenshuding.md +129 -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 +13 -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/plan.md +17 -0
- package/skill-template/domains/qiyecheng.md +17 -0
- package/skill-template/domains/shared.md +9 -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/ziguanjia.md +21 -0
- package/skill-template/master-skill-template.md +12 -6
- package/skill-template/skill-template.md +40 -9
- package/skills/weaver-e10-calendar/SKILL.md +101 -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 +102 -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 +87 -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 +174 -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 +101 -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 +151 -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-plan/SKILL.md +139 -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 +118 -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 +86 -0
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +127 -0
- package/skills/weaver-e10-shared/references/json-output-contract.md +120 -0
- package/skills/weaver-e10-shared/references/weaver-e10-installation.md +110 -0
- package/skills/weaver-e10-skill-maker/SKILL.md +77 -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 +157 -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-e10-yepiaotong/references/invoice-agent-entry.md +47 -0
- 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-e10-yepiaotong/references/invoice-download.md +31 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +45 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-file-upload.md +15 -4
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +45 -0
- 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 +14 -4
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +58 -0
- 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 +10 -3
- 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-ziguanjia/SKILL.md +162 -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 -103
- package/skills/weaver-work-cli-invoice/references/invoice-agent-entry.md +0 -38
- package/skills/weaver-work-cli-invoice/references/invoice-disabled-capabilities.md +0 -26
- package/skills/weaver-work-cli-invoice/references/invoice-download.md +0 -22
- package/skills/weaver-work-cli-invoice/references/invoice-enterprise-list.md +0 -35
- package/skills/weaver-work-cli-invoice/references/invoice-import.md +0 -28
- package/skills/weaver-work-cli-invoice/references/invoice-personal-list.md +0 -47
- package/skills/weaver-work-cli-shared/SKILL.md +0 -53
- package/skills/weaver-work-cli-shared/references/e10-auth-and-session.md +0 -83
- package/skills/weaver-work-cli-shared/references/json-output-contract.md +0 -61
- package/skills/weaver-work-cli-shared/references/weaver-work-cli-installation.md +0 -61
- /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
|
@@ -20,10 +20,10 @@ const listProperties = {
|
|
|
20
20
|
total_end: { type: 'string', pattern: '^\\d+(\\.\\d{1,2})?$' },
|
|
21
21
|
attribute: { type: 'integer', enum: [0, 1, 2] },
|
|
22
22
|
sreim: {
|
|
23
|
-
type: '
|
|
24
|
-
enum: [0, 1, 2, 3, 4],
|
|
25
|
-
default: 3,
|
|
26
|
-
description: '
|
|
23
|
+
type: 'string',
|
|
24
|
+
enum: ['0', '1', '2', '3', '4'],
|
|
25
|
+
default: '3',
|
|
26
|
+
description: '报销状态筛选。默认不要传本字段,CLI 会使用 "3"=未报销发票;只有用户明确要求全部/报销中/已报销/不可报销时才传。取值:"0"=全部发票,"1"=发票报销中,"2"=报销完成,"3"=未报销发票,"4"=不可报销',
|
|
27
27
|
},
|
|
28
28
|
valids: { type: 'array', items: { type: 'integer', enum: [0, 1, 2, 3, 4, 5] } },
|
|
29
29
|
sources: { type: 'array', items: { type: 'integer' } },
|
|
@@ -43,21 +43,29 @@ const listProperties = {
|
|
|
43
43
|
required: ['sort_type', 'sort'],
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
|
-
bill_type: {
|
|
46
|
+
bill_type: {
|
|
47
|
+
type: 'integer',
|
|
48
|
+
enum: [0, 1],
|
|
49
|
+
default: 0,
|
|
50
|
+
description: '票据类型:0=发票,1=凭证。默认不要传本字段,CLI 会使用 0 查询发票;只有用户明确要求查凭证时才传 1。',
|
|
51
|
+
},
|
|
47
52
|
};
|
|
53
|
+
const positiveId = { type: 'string', pattern: '^[1-9]\\d*$' };
|
|
54
|
+
const positiveIdArray = { type: 'array', minItems: 1, maxItems: 100, items: positiveId };
|
|
55
|
+
const requestPayload = { type: 'object', minProperties: 1 };
|
|
48
56
|
export const invoiceOperations = [
|
|
49
57
|
{
|
|
50
58
|
name: 'invoice.list',
|
|
51
59
|
risk: 'read',
|
|
52
60
|
scope: 'personal',
|
|
53
|
-
fixed: { flag: 0, defaultSreim: 3 },
|
|
61
|
+
fixed: { flag: 0, defaultSreim: '3', defaultBillType: 0 },
|
|
54
62
|
inputSchema: { type: 'object', additionalProperties: false, properties: listProperties },
|
|
55
63
|
},
|
|
56
64
|
{
|
|
57
65
|
name: 'invoice.enterprise.list',
|
|
58
66
|
risk: 'read',
|
|
59
67
|
scope: 'enterprise',
|
|
60
|
-
fixed: { flag: 6, defaultSreim: 3 },
|
|
68
|
+
fixed: { flag: 6, defaultSreim: '3', defaultBillType: 0 },
|
|
61
69
|
inputSchema: { type: 'object', additionalProperties: false, properties: listProperties },
|
|
62
70
|
},
|
|
63
71
|
{
|
|
@@ -76,7 +84,7 @@ export const invoiceOperations = [
|
|
|
76
84
|
{
|
|
77
85
|
name: 'invoice.upload',
|
|
78
86
|
risk: 'external-artifact',
|
|
79
|
-
fixed: { ocr:
|
|
87
|
+
fixed: { ocr: 0 },
|
|
80
88
|
inputSchema: {
|
|
81
89
|
type: 'object',
|
|
82
90
|
additionalProperties: false,
|
|
@@ -106,7 +114,7 @@ export const invoiceOperations = [
|
|
|
106
114
|
{
|
|
107
115
|
name: 'invoice.validate.preview',
|
|
108
116
|
risk: 'external-read',
|
|
109
|
-
fixed: { flag: 100, is_save: 1, needLog:
|
|
117
|
+
fixed: { flag: 100, is_save: 1, needLog: true },
|
|
110
118
|
inputSchema: {
|
|
111
119
|
type: 'object',
|
|
112
120
|
additionalProperties: false,
|
|
@@ -125,8 +133,14 @@ export const invoiceOperations = [
|
|
|
125
133
|
additionalProperties: false,
|
|
126
134
|
properties: {
|
|
127
135
|
file: { type: 'string', minLength: 1 },
|
|
128
|
-
validate: {
|
|
129
|
-
|
|
136
|
+
validate: {
|
|
137
|
+
type: 'boolean',
|
|
138
|
+
description: '是否在导入时请求服务端查验。正常上传发票流程默认应传 true;只有用户明确要求跳过查验时才传 false。',
|
|
139
|
+
},
|
|
140
|
+
syncToOa: {
|
|
141
|
+
type: 'boolean',
|
|
142
|
+
description: '是否同步到 OA。validate=true 时必须为 true;正常导入推荐传 true。',
|
|
143
|
+
},
|
|
130
144
|
},
|
|
131
145
|
required: ['file', 'validate', 'syncToOa'],
|
|
132
146
|
},
|
|
@@ -258,6 +272,200 @@ export const invoiceOperations = [
|
|
|
258
272
|
required: ['continuation', 'confirm'],
|
|
259
273
|
},
|
|
260
274
|
},
|
|
275
|
+
{
|
|
276
|
+
name: 'invoice.browse-field.data',
|
|
277
|
+
risk: 'read',
|
|
278
|
+
fixed: { source: 'POST /api/inc/get', mask: 0, userFlag: '1', isDelFlag: '1' },
|
|
279
|
+
inputSchema: {
|
|
280
|
+
type: 'object',
|
|
281
|
+
additionalProperties: false,
|
|
282
|
+
properties: {
|
|
283
|
+
fid: positiveId,
|
|
284
|
+
fids: positiveIdArray,
|
|
285
|
+
detail: { type: 'object' },
|
|
286
|
+
},
|
|
287
|
+
oneOf: [{ required: ['fid'] }, { required: ['fids'] }, { required: ['detail'] }],
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: 'invoice.reim.file-ocr.preview',
|
|
292
|
+
risk: 'read-with-upload',
|
|
293
|
+
fixed: { path: '/api/inc/book/fileIdToInvoicesAndOcr' },
|
|
294
|
+
inputSchema: {
|
|
295
|
+
type: 'object',
|
|
296
|
+
additionalProperties: false,
|
|
297
|
+
properties: {
|
|
298
|
+
fileId: { type: 'string', pattern: '^[1-9]\\d*(,[1-9]\\d*)*$' },
|
|
299
|
+
fileIds: positiveIdArray,
|
|
300
|
+
},
|
|
301
|
+
oneOf: [{ required: ['fileId'] }, { required: ['fileIds'] }],
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: 'invoice.reim.requests.list',
|
|
306
|
+
risk: 'read',
|
|
307
|
+
fixed: { path: '/api/inc/book/getRequestListByTabId', defaultPageNo: 1, defaultPageSize: 20 },
|
|
308
|
+
inputSchema: {
|
|
309
|
+
type: 'object',
|
|
310
|
+
additionalProperties: false,
|
|
311
|
+
properties: {
|
|
312
|
+
pageNo: { type: 'integer', minimum: 1, maximum: 10000, default: 1 },
|
|
313
|
+
pageSize: { type: 'integer', minimum: 1, maximum: 200, default: 20 },
|
|
314
|
+
requestname: { type: 'string', minLength: 1 },
|
|
315
|
+
cusCreateDateStart: { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2}$' },
|
|
316
|
+
cusCreateDateEnd: { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2}$' },
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: 'invoice.reim.workflow.resolve',
|
|
322
|
+
risk: 'read',
|
|
323
|
+
fixed: { path: '/api/inc/book/getReimburseWorkflowByRequestIds' },
|
|
324
|
+
inputSchema: {
|
|
325
|
+
type: 'object',
|
|
326
|
+
additionalProperties: false,
|
|
327
|
+
properties: {
|
|
328
|
+
requestIds: { type: 'array', maxItems: 100, items: positiveId, default: [] },
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: 'invoice.reim.form.structure',
|
|
334
|
+
risk: 'read',
|
|
335
|
+
fixed: { path: '/api/inc/book/getFormStructure', defaultNodeId: '1' },
|
|
336
|
+
inputSchema: {
|
|
337
|
+
type: 'object',
|
|
338
|
+
additionalProperties: false,
|
|
339
|
+
properties: {
|
|
340
|
+
workflowId: positiveId,
|
|
341
|
+
nodeId: { type: 'string', minLength: 1, default: '1' },
|
|
342
|
+
},
|
|
343
|
+
required: ['workflowId'],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: 'invoice.reim.row-info',
|
|
348
|
+
risk: 'read',
|
|
349
|
+
fixed: { path: '/api/secondev/fna/expense/dataInfo/getRowInfo', sf_request_type: 'fetch' },
|
|
350
|
+
inputSchema: {
|
|
351
|
+
type: 'object',
|
|
352
|
+
additionalProperties: false,
|
|
353
|
+
properties: {
|
|
354
|
+
invoiceId: positiveId,
|
|
355
|
+
requestid: { type: 'string' },
|
|
356
|
+
cdzt: positiveId,
|
|
357
|
+
},
|
|
358
|
+
required: ['invoiceId'],
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
name: 'invoice.reim.employee-superiors',
|
|
363
|
+
risk: 'read',
|
|
364
|
+
fixed: { path: '/api/inc/book/getEmployeeSuperiors' },
|
|
365
|
+
inputSchema: {
|
|
366
|
+
type: 'object',
|
|
367
|
+
additionalProperties: false,
|
|
368
|
+
properties: {},
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
name: 'invoice.reim.field.search',
|
|
373
|
+
risk: 'read',
|
|
374
|
+
fixed: { path: '/api/government/formStructure/fieldRelateSearch', formModeType: 'wf', defaultNodeId: '100004140000000271' },
|
|
375
|
+
inputSchema: {
|
|
376
|
+
type: 'object',
|
|
377
|
+
additionalProperties: false,
|
|
378
|
+
properties: {
|
|
379
|
+
keywords: { type: 'string', minLength: 1 },
|
|
380
|
+
fieldId: positiveId,
|
|
381
|
+
workflowId: positiveId,
|
|
382
|
+
nodeId: { type: 'string', minLength: 1, default: '100004140000000271' },
|
|
383
|
+
},
|
|
384
|
+
required: ['keywords', 'fieldId', 'workflowId'],
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
name: 'invoice.reim.flow.create.prepare',
|
|
389
|
+
risk: 'read-before-write',
|
|
390
|
+
fixed: { path: '/api/inc/book/createFlowNew' },
|
|
391
|
+
inputSchema: {
|
|
392
|
+
type: 'object',
|
|
393
|
+
additionalProperties: false,
|
|
394
|
+
properties: { payload: requestPayload },
|
|
395
|
+
required: ['payload'],
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: 'invoice.reim.flow.create.apply',
|
|
400
|
+
risk: 'high-risk-write',
|
|
401
|
+
inputSchema: {
|
|
402
|
+
type: 'object',
|
|
403
|
+
additionalProperties: false,
|
|
404
|
+
properties: {
|
|
405
|
+
payload: requestPayload,
|
|
406
|
+
continuation: { type: 'string', minLength: 1 },
|
|
407
|
+
confirm: { const: true },
|
|
408
|
+
},
|
|
409
|
+
required: ['payload', 'continuation', 'confirm'],
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
name: 'invoice.reim.flow.update.prepare',
|
|
414
|
+
risk: 'read-before-write',
|
|
415
|
+
fixed: { path: '/api/inc/book/updateFlow' },
|
|
416
|
+
inputSchema: {
|
|
417
|
+
type: 'object',
|
|
418
|
+
additionalProperties: false,
|
|
419
|
+
properties: { payload: requestPayload },
|
|
420
|
+
required: ['payload'],
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: 'invoice.reim.flow.update.apply',
|
|
425
|
+
risk: 'high-risk-write',
|
|
426
|
+
inputSchema: {
|
|
427
|
+
type: 'object',
|
|
428
|
+
additionalProperties: false,
|
|
429
|
+
properties: {
|
|
430
|
+
payload: requestPayload,
|
|
431
|
+
continuation: { type: 'string', minLength: 1 },
|
|
432
|
+
confirm: { const: true },
|
|
433
|
+
},
|
|
434
|
+
required: ['payload', 'continuation', 'confirm'],
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
name: 'invoice.issuing.make.prepare',
|
|
439
|
+
risk: 'read-before-write',
|
|
440
|
+
fixed: {
|
|
441
|
+
path: '/api/inc/book/open/makeInvoice',
|
|
442
|
+
sellerName: '上海泛微网络科技股份有限公司',
|
|
443
|
+
taxNo: '9131000070322836XD',
|
|
444
|
+
},
|
|
445
|
+
inputSchema: {
|
|
446
|
+
type: 'object',
|
|
447
|
+
additionalProperties: false,
|
|
448
|
+
properties: {
|
|
449
|
+
mode: { type: 'string', enum: ['issue', 'ledger'] },
|
|
450
|
+
payload: requestPayload,
|
|
451
|
+
},
|
|
452
|
+
required: ['mode', 'payload'],
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
name: 'invoice.issuing.make.apply',
|
|
457
|
+
risk: 'high-risk-write',
|
|
458
|
+
inputSchema: {
|
|
459
|
+
type: 'object',
|
|
460
|
+
additionalProperties: false,
|
|
461
|
+
properties: {
|
|
462
|
+
payload: requestPayload,
|
|
463
|
+
continuation: { type: 'string', minLength: 1 },
|
|
464
|
+
confirm: { const: true },
|
|
465
|
+
},
|
|
466
|
+
required: ['payload', 'continuation', 'confirm'],
|
|
467
|
+
},
|
|
468
|
+
},
|
|
261
469
|
];
|
|
262
470
|
export const invoiceManifest = {
|
|
263
471
|
schemaVersion: 1,
|
|
@@ -271,15 +479,15 @@ export const invoiceManifest = {
|
|
|
271
479
|
withheldOperations: [
|
|
272
480
|
{
|
|
273
481
|
name: 'invoice.share',
|
|
274
|
-
reason: '
|
|
482
|
+
reason: '新增源资料给出 /api/inc/shareUsers 请求体,但仍缺少接收人 appid/cid/uid 的 CLI 解析来源和共享关系回查契约。',
|
|
275
483
|
},
|
|
276
484
|
{
|
|
277
485
|
name: 'invoice.transfer',
|
|
278
|
-
reason: '
|
|
486
|
+
reason: '新增源资料给出 /api/inc/transferFpyUser 请求体,但转让会改变发票持有人,仍缺少接收人侧归属回查契约。',
|
|
279
487
|
},
|
|
280
488
|
{
|
|
281
489
|
name: 'invoice.tag',
|
|
282
|
-
reason: '
|
|
490
|
+
reason: '新增源资料给出 /api/my/tag/common/batchAddEntityTag 请求体,但仍缺少标签定义查询、当前标签关系回查和移除/替换语义。',
|
|
283
491
|
},
|
|
284
492
|
],
|
|
285
493
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { asObject, browseFieldData, getDetailsByFids, normalizeFids, workflow, } from './shared.js';
|
|
2
|
+
export class InvoiceBrowseFieldDataOperation {
|
|
3
|
+
name = 'invoice.browse-field.data';
|
|
4
|
+
async execute(input, { host }) {
|
|
5
|
+
const detail = input.detail === undefined
|
|
6
|
+
? asObject(await getDetailsByFids(normalizeFids(input), host), 'detail')
|
|
7
|
+
: asObject(input.detail, 'detail');
|
|
8
|
+
const data = browseFieldData(detail);
|
|
9
|
+
return {
|
|
10
|
+
status: data.errors.length ? 'PARTIAL' : 'COMPLETE',
|
|
11
|
+
data: {
|
|
12
|
+
...data,
|
|
13
|
+
workflow: workflow('invoice.browse-field.data', data.errors.length ? 'PARTIAL' : 'COMPLETE'),
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { invoiceConfirmationError, invoicePartialError, invoiceValidationError, isInvoiceNetworkError } from '../errors.js';
|
|
2
|
+
import { asNonEmptyString, asObject, assertBusinessSuccess, objectFingerprint, sessionMatches, workflow, } from './shared.js';
|
|
3
|
+
const SELLER_TAX_NO = '9131000070322836XD';
|
|
4
|
+
const SELLER_NAME = '上海泛微网络科技股份有限公司';
|
|
5
|
+
const TAX_RATES = new Set([0, 0.01, 0.03, 0.05, 0.06, 0.09, 0.13]);
|
|
6
|
+
function optionalText(value, name) {
|
|
7
|
+
if (value === undefined || value === null || value === '')
|
|
8
|
+
return undefined;
|
|
9
|
+
return asNonEmptyString(value, name);
|
|
10
|
+
}
|
|
11
|
+
function money(value, name) {
|
|
12
|
+
if (typeof value === 'number') {
|
|
13
|
+
if (!Number.isFinite(value) || value < 0)
|
|
14
|
+
throw invoiceValidationError('input_invalid', `${name} 必须是非负金额`);
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
if (typeof value !== 'string' || !/^\d+(?:\.\d+)?$/u.test(value)) {
|
|
18
|
+
throw invoiceValidationError('input_invalid', `${name} 必须是非负金额`);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function taxRate(value, name) {
|
|
23
|
+
const parsed = typeof value === 'number' ? value : Number(value);
|
|
24
|
+
if (!Number.isFinite(parsed) || !TAX_RATES.has(parsed)) {
|
|
25
|
+
throw invoiceValidationError('input_invalid', `${name} 必须是合法税率:0、0.01、0.03、0.05、0.06、0.09 或 0.13`);
|
|
26
|
+
}
|
|
27
|
+
return typeof value === 'number' ? value : String(value);
|
|
28
|
+
}
|
|
29
|
+
function taxNo(value, name, { required = false } = {}) {
|
|
30
|
+
const text = optionalText(value, name);
|
|
31
|
+
if (text === undefined) {
|
|
32
|
+
if (required)
|
|
33
|
+
throw invoiceValidationError('input_invalid', `${name} 必填`);
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
if (!/^[0-9A-Z]{15,20}$/u.test(text)) {
|
|
37
|
+
throw invoiceValidationError('input_invalid', `${name} 必须是 15-20 位数字或大写字母`);
|
|
38
|
+
}
|
|
39
|
+
return text;
|
|
40
|
+
}
|
|
41
|
+
function normalizeMode(value) {
|
|
42
|
+
if (value !== 'issue' && value !== 'ledger') {
|
|
43
|
+
throw invoiceValidationError('input_invalid', 'mode 必须是 issue 或 ledger');
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function normalizeDetail(value, index) {
|
|
48
|
+
const detail = structuredClone(asObject(value, `payload.details[${index}]`));
|
|
49
|
+
detail.goodsName = asNonEmptyString(detail.goodsName, `payload.details[${index}].goodsName`);
|
|
50
|
+
detail.taxRate = taxRate(detail.taxRate, `payload.details[${index}].taxRate`);
|
|
51
|
+
detail.amount = money(detail.amount, `payload.details[${index}].amount`);
|
|
52
|
+
detail.amountWithTax = money(detail.amountWithTax, `payload.details[${index}].amountWithTax`);
|
|
53
|
+
if (detail.taxAmount !== undefined)
|
|
54
|
+
detail.taxAmount = money(detail.taxAmount, `payload.details[${index}].taxAmount`);
|
|
55
|
+
if (detail.revenueCode !== undefined && !/^\d{4,19}$/u.test(String(detail.revenueCode))) {
|
|
56
|
+
throw invoiceValidationError('input_invalid', `payload.details[${index}].revenueCode 必须是数字编码`);
|
|
57
|
+
}
|
|
58
|
+
for (const key of ['quantity', 'unitPrice', 'unit', 'specification']) {
|
|
59
|
+
if (detail[key] !== undefined && detail[key] !== null)
|
|
60
|
+
detail[key] = String(detail[key]);
|
|
61
|
+
}
|
|
62
|
+
return detail;
|
|
63
|
+
}
|
|
64
|
+
function normalizeMakeInvoicePayload(rawPayload, mode) {
|
|
65
|
+
const payload = structuredClone(asObject(rawPayload, 'payload'));
|
|
66
|
+
const purchaserName = asNonEmptyString(payload.purchaserName, 'payload.purchaserName');
|
|
67
|
+
const invoiceType = asNonEmptyString(payload.invoiceType, 'payload.invoiceType');
|
|
68
|
+
if (!['7', '8', '9', '10'].includes(invoiceType)) {
|
|
69
|
+
throw invoiceValidationError('input_invalid', 'payload.invoiceType 必须是 7、8、9 或 10');
|
|
70
|
+
}
|
|
71
|
+
const specialInvoice = invoiceType === '8' || invoiceType === '10';
|
|
72
|
+
const purchaserTaxNo = taxNo(payload.purchaserTaxNo, 'payload.purchaserTaxNo', { required: specialInvoice });
|
|
73
|
+
if (!Array.isArray(payload.details) || !payload.details.length) {
|
|
74
|
+
throw invoiceValidationError('input_invalid', 'payload.details 必须是非空数组');
|
|
75
|
+
}
|
|
76
|
+
const details = payload.details.map((item, index) => normalizeDetail(item, index));
|
|
77
|
+
const normalized = {
|
|
78
|
+
...payload,
|
|
79
|
+
taxNo: SELLER_TAX_NO,
|
|
80
|
+
sellerName: SELLER_NAME,
|
|
81
|
+
billingType: payload.billingType || '0',
|
|
82
|
+
invoiceType,
|
|
83
|
+
externalDocumentNo: asNonEmptyString(payload.externalDocumentNo, 'payload.externalDocumentNo'),
|
|
84
|
+
sourceType: payload.sourceType || '4',
|
|
85
|
+
asyncCallFlag: payload.asyncCallFlag || '1',
|
|
86
|
+
invoiceMethod: payload.invoiceMethod || '5',
|
|
87
|
+
taxSign: payload.taxSign || '1',
|
|
88
|
+
personLogo: payload.personLogo || (purchaserTaxNo ? '0' : '1'),
|
|
89
|
+
purchaserName,
|
|
90
|
+
details,
|
|
91
|
+
totalAmount: money(payload.totalAmount, 'payload.totalAmount'),
|
|
92
|
+
taxAmount: money(payload.taxAmount, 'payload.taxAmount'),
|
|
93
|
+
totalAmountWithTax: money(payload.totalAmountWithTax, 'payload.totalAmountWithTax'),
|
|
94
|
+
};
|
|
95
|
+
if (purchaserTaxNo !== undefined)
|
|
96
|
+
normalized.purchaserTaxNo = purchaserTaxNo;
|
|
97
|
+
for (const key of ['purchaserAddress', 'purchaserTel', 'purchaserBankName', 'purchaserBankAccount', 'remark', 'invoiceDate']) {
|
|
98
|
+
if (payload[key] !== undefined && payload[key] !== null)
|
|
99
|
+
normalized[key] = String(payload[key]);
|
|
100
|
+
}
|
|
101
|
+
if (mode === 'ledger')
|
|
102
|
+
normalized.operateType = '5';
|
|
103
|
+
else
|
|
104
|
+
delete normalized.operateType;
|
|
105
|
+
return normalized;
|
|
106
|
+
}
|
|
107
|
+
function makeInvoicePreview(payload, mode) {
|
|
108
|
+
return {
|
|
109
|
+
mode,
|
|
110
|
+
purchaserName: payload.purchaserName,
|
|
111
|
+
purchaserTaxNo: payload.purchaserTaxNo || '',
|
|
112
|
+
invoiceType: payload.invoiceType,
|
|
113
|
+
externalDocumentNo: payload.externalDocumentNo,
|
|
114
|
+
totalAmount: payload.totalAmount,
|
|
115
|
+
taxAmount: payload.taxAmount,
|
|
116
|
+
totalAmountWithTax: payload.totalAmountWithTax,
|
|
117
|
+
detailCount: Array.isArray(payload.details) ? payload.details.length : 0,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export class InvoiceIssuingMakePrepareOperation {
|
|
121
|
+
name = 'invoice.issuing.make.prepare';
|
|
122
|
+
async execute(input, { host, continuation }) {
|
|
123
|
+
const mode = normalizeMode(input.mode);
|
|
124
|
+
const payload = normalizeMakeInvoicePayload(input.payload, mode);
|
|
125
|
+
const session = await host.getSession();
|
|
126
|
+
const preview = makeInvoicePreview(payload, mode);
|
|
127
|
+
const continuationToken = await continuation.issue({
|
|
128
|
+
operation: 'invoice.issuing.make.apply',
|
|
129
|
+
workflow: workflow('invoice.issuing.make', 'AWAITING_CONFIRMATION'),
|
|
130
|
+
baseUrl: session.baseUrl,
|
|
131
|
+
profile: session.profile,
|
|
132
|
+
userId: session.userId,
|
|
133
|
+
mode,
|
|
134
|
+
fingerprint: objectFingerprint(payload),
|
|
135
|
+
preview,
|
|
136
|
+
});
|
|
137
|
+
return {
|
|
138
|
+
status: 'AWAITING_CONFIRMATION',
|
|
139
|
+
data: {
|
|
140
|
+
preview,
|
|
141
|
+
normalizedPayload: payload,
|
|
142
|
+
continuation: continuationToken,
|
|
143
|
+
expiresInSeconds: 600,
|
|
144
|
+
workflow: workflow('invoice.issuing.make', 'AWAITING_CONFIRMATION'),
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export class InvoiceIssuingMakeApplyOperation {
|
|
150
|
+
name = 'invoice.issuing.make.apply';
|
|
151
|
+
async execute(input, { host, continuation }) {
|
|
152
|
+
if (input.confirm !== true)
|
|
153
|
+
throw invoiceConfirmationError('invoice.issuing.make.apply', { hint: '重新调用时传入 confirm=true' });
|
|
154
|
+
const lease = await continuation.verify(input.continuation, 'invoice.issuing.make.apply');
|
|
155
|
+
const mode = normalizeMode(lease.mode);
|
|
156
|
+
const payload = normalizeMakeInvoicePayload(input.payload, mode);
|
|
157
|
+
if (typeof lease.fingerprint !== 'string')
|
|
158
|
+
throw invoiceValidationError('continuation_invalid', '开票 continuation 缺少 payload 指纹');
|
|
159
|
+
if (objectFingerprint(payload) !== lease.fingerprint)
|
|
160
|
+
throw invoiceValidationError('target_changed', '开票载荷与确认时不一致,请重新准备');
|
|
161
|
+
const session = await host.getSession();
|
|
162
|
+
if (!sessionMatches(lease, session))
|
|
163
|
+
throw invoiceValidationError('context_mismatch', '确认上下文已变化,请重新准备开票');
|
|
164
|
+
let result;
|
|
165
|
+
try {
|
|
166
|
+
result = await host.invoiceRequest({ path: '/api/inc/book/open/makeInvoice', method: 'POST', body: payload, operation: this.name, timeoutMs: 90_000 });
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
if (isInvoiceNetworkError(error)) {
|
|
170
|
+
throw invoicePartialError('开票请求发送后连接中断,结果不确定,禁止自动重试', {
|
|
171
|
+
preview: lease.preview,
|
|
172
|
+
workflow: workflow('invoice.issuing.make', 'EXECUTING'),
|
|
173
|
+
}, { stage: 'issuing-make' });
|
|
174
|
+
}
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
assertBusinessSuccess(result, 'issuing_make_failed', '开票或存台账失败');
|
|
178
|
+
const data = result?.data || {};
|
|
179
|
+
if (!data.serialNo && !data.orderNo && mode === 'issue') {
|
|
180
|
+
throw invoicePartialError('开票接口返回成功但缺少流水号,结果不确定', {
|
|
181
|
+
preview: lease.preview,
|
|
182
|
+
result,
|
|
183
|
+
workflow: workflow('invoice.issuing.make', 'VERIFYING'),
|
|
184
|
+
}, { stage: 'issuing-make-response' });
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
status: 'COMPLETE',
|
|
188
|
+
data: {
|
|
189
|
+
mode,
|
|
190
|
+
serialNo: data.serialNo,
|
|
191
|
+
orderNo: data.orderNo,
|
|
192
|
+
ledgerOnly: mode === 'ledger',
|
|
193
|
+
result,
|
|
194
|
+
workflow: workflow('invoice.issuing.make', 'COMPLETE'),
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InvoiceCliError, invoiceValidationError } from '../errors.js';
|
|
2
|
+
import { toErrorEnvelope } from '../../../core/errors.js';
|
|
2
3
|
import { previewOcr, uploadFromInput, uploadInvoiceFile, workflow } from './shared.js';
|
|
3
4
|
export class InvoiceOcrPreviewOperation {
|
|
4
5
|
name = 'invoice.ocr.preview';
|
|
@@ -10,16 +11,18 @@ export class InvoiceOcrPreviewOperation {
|
|
|
10
11
|
throw invoiceValidationError('input_ambiguous', 'upload 与 file/url 只能选择一种来源');
|
|
11
12
|
}
|
|
12
13
|
const suppliedUpload = uploadFromInput(input);
|
|
13
|
-
const upload = suppliedUpload || await uploadInvoiceFile(input, host);
|
|
14
|
+
const upload = suppliedUpload || await uploadInvoiceFile(input, host, { ocr: true });
|
|
14
15
|
let ocr;
|
|
15
16
|
try {
|
|
16
17
|
ocr = await previewOcr(upload, host);
|
|
17
18
|
}
|
|
18
19
|
catch (error) {
|
|
19
20
|
if (!suppliedUpload) {
|
|
20
|
-
|
|
21
|
+
const cause = toErrorEnvelope(error);
|
|
22
|
+
throw new InvoiceCliError('partial', 'artifact_uploaded', `文件已上传但 OCR 预览失败:${cause.message}`, {
|
|
23
|
+
code: cause.code,
|
|
21
24
|
partialData: { upload, workflow: workflow('invoice.ocr.preview', 'OCR_RUNNING') },
|
|
22
|
-
details: { stage: 'ocr' },
|
|
25
|
+
details: { stage: 'ocr', cause },
|
|
23
26
|
exitCode: 11,
|
|
24
27
|
});
|
|
25
28
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { invoiceValidationError } from '../errors.js';
|
|
2
2
|
import { invoiceOperations } from '../manifest.js';
|
|
3
3
|
import { InvoiceAddApplyOperation, InvoiceAddPrepareOperation } from './add.js';
|
|
4
|
+
import { InvoiceBrowseFieldDataOperation } from './browse-field.js';
|
|
4
5
|
import { InvoiceDeleteApplyOperation, InvoiceDeletePrepareOperation } from './delete.js';
|
|
5
6
|
import { InvoiceDownloadOperation } from './download.js';
|
|
6
7
|
import { InvoiceGetOperation } from './get.js';
|
|
7
8
|
import { InvoiceImportApplyOperation, InvoiceImportPrepareOperation } from './import.js';
|
|
9
|
+
import { InvoiceIssuingMakeApplyOperation, InvoiceIssuingMakePrepareOperation } from './issuing.js';
|
|
8
10
|
import { InvoiceListOperation } from './list.js';
|
|
9
11
|
import { InvoiceOcrPreviewOperation } from './ocr-preview.js';
|
|
12
|
+
import { InvoiceReimEmployeeSuperiorsOperation, InvoiceReimFieldSearchOperation, InvoiceReimFileOcrPreviewOperation, InvoiceReimFlowCreateApplyOperation, InvoiceReimFlowCreatePrepareOperation, InvoiceReimFlowUpdateApplyOperation, InvoiceReimFlowUpdatePrepareOperation, InvoiceReimFormStructureOperation, InvoiceReimRequestsListOperation, InvoiceReimRowInfoOperation, InvoiceReimWorkflowResolveOperation, } from './reim.js';
|
|
10
13
|
import { InvoiceUpdateApplyOperation, InvoiceUpdatePrepareOperation } from './update.js';
|
|
11
14
|
import { InvoiceUploadOperation } from './upload.js';
|
|
12
15
|
import { InvoiceValidatePreviewOperation } from './validate-preview.js';
|
|
@@ -28,6 +31,20 @@ function buildRegistry() {
|
|
|
28
31
|
new InvoiceDownloadOperation(),
|
|
29
32
|
new InvoiceDeletePrepareOperation(),
|
|
30
33
|
new InvoiceDeleteApplyOperation(),
|
|
34
|
+
new InvoiceBrowseFieldDataOperation(),
|
|
35
|
+
new InvoiceReimFileOcrPreviewOperation(),
|
|
36
|
+
new InvoiceReimRequestsListOperation(),
|
|
37
|
+
new InvoiceReimWorkflowResolveOperation(),
|
|
38
|
+
new InvoiceReimFormStructureOperation(),
|
|
39
|
+
new InvoiceReimRowInfoOperation(),
|
|
40
|
+
new InvoiceReimEmployeeSuperiorsOperation(),
|
|
41
|
+
new InvoiceReimFieldSearchOperation(),
|
|
42
|
+
new InvoiceReimFlowCreatePrepareOperation(),
|
|
43
|
+
new InvoiceReimFlowCreateApplyOperation(),
|
|
44
|
+
new InvoiceReimFlowUpdatePrepareOperation(),
|
|
45
|
+
new InvoiceReimFlowUpdateApplyOperation(),
|
|
46
|
+
new InvoiceIssuingMakePrepareOperation(),
|
|
47
|
+
new InvoiceIssuingMakeApplyOperation(),
|
|
31
48
|
];
|
|
32
49
|
for (const handler of handlers) {
|
|
33
50
|
if (registry.has(handler.name))
|