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
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { archiveValidationError } from '../errors.js';
|
|
2
|
+
import { READ, WRITE, archiveSuccess, schemaOf, } from './types.js';
|
|
3
|
+
import { unwrapData } from './shared.js';
|
|
4
|
+
import { assertLeaseTarget, issueLease, verifyLease } from './confirm.js';
|
|
5
|
+
const BORROW_CAR_APPLY = 'archive.flow.borrow-car.apply';
|
|
6
|
+
const SEARCH_APPLY = 'archive.flow.search.apply';
|
|
7
|
+
const RENEW_APPLY = 'archive.flow.renew.apply';
|
|
8
|
+
const ARC_ID_PATTERN = /^\d+_\d+$/;
|
|
9
|
+
const NUMERIC_PATTERN = /^\d+$/;
|
|
10
|
+
function requireArcIds(value, field) {
|
|
11
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
12
|
+
throw archiveValidationError('arc_ids_required', `${field} 必填且至少一项`);
|
|
13
|
+
}
|
|
14
|
+
return value.map((item, index) => {
|
|
15
|
+
const text = String(item ?? '').trim();
|
|
16
|
+
if (!ARC_ID_PATTERN.test(text)) {
|
|
17
|
+
throw archiveValidationError('arc_id_invalid', `${field}[${index}] 必须是 {档案ID}_{表单ID} 格式`);
|
|
18
|
+
}
|
|
19
|
+
return text;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function requireIdList(value, field) {
|
|
23
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
24
|
+
throw archiveValidationError('id_list_required', `${field} 必填且至少一项`);
|
|
25
|
+
}
|
|
26
|
+
return value.map((item, index) => {
|
|
27
|
+
const text = String(item ?? '').trim();
|
|
28
|
+
if (!NUMERIC_PATTERN.test(text)) {
|
|
29
|
+
throw archiveValidationError('id_list_invalid', `${field}[${index}] 必须是数字 ID`);
|
|
30
|
+
}
|
|
31
|
+
return text;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** 借阅流程绑定检查:data 为空表示未绑定。 */
|
|
35
|
+
async function fetchWorkflowId(host) {
|
|
36
|
+
const response = await host.request({
|
|
37
|
+
method: 'GET',
|
|
38
|
+
path: '/api/archive/core/archiveSet/getSetValue',
|
|
39
|
+
query: { keyname: 'borrow_flow_check' },
|
|
40
|
+
});
|
|
41
|
+
const workflowId = String(unwrapData(response) ?? '').trim();
|
|
42
|
+
if (!workflowId) {
|
|
43
|
+
throw archiveValidationError('borrow_flow_unbound', '未绑定借阅流程,请联系管理员在档案设置中绑定借阅流程后再发起借阅');
|
|
44
|
+
}
|
|
45
|
+
return workflowId;
|
|
46
|
+
}
|
|
47
|
+
async function addCache(host, value, logFlag) {
|
|
48
|
+
const body = { key: 'arcActionIds', value, time: '86400' };
|
|
49
|
+
if (logFlag)
|
|
50
|
+
body.logFlag = logFlag;
|
|
51
|
+
const response = await host.request({ method: 'POST', path: '/api/archive/core/form/addCache', body });
|
|
52
|
+
const data = (unwrapData(response) ?? {});
|
|
53
|
+
const index = String(data.index ?? '').trim();
|
|
54
|
+
if (!index) {
|
|
55
|
+
throw archiveValidationError('cache_index_missing', '参数缓存失败,未取到缓存索引');
|
|
56
|
+
}
|
|
57
|
+
return index;
|
|
58
|
+
}
|
|
59
|
+
function buildFlowUrl(baseUrl, workflowId, params) {
|
|
60
|
+
const root = baseUrl.replace(/\/+$/, '');
|
|
61
|
+
const search = new URLSearchParams(params).toString();
|
|
62
|
+
return `${root}/sp/workflow/flowpage/fullCreate/${workflowId}?${search}`;
|
|
63
|
+
}
|
|
64
|
+
function flowResult(action, baseUrl, workflowId, params, extra = {}) {
|
|
65
|
+
return archiveSuccess(action, {
|
|
66
|
+
...extra,
|
|
67
|
+
workflowId,
|
|
68
|
+
url: buildFlowUrl(baseUrl, workflowId, params),
|
|
69
|
+
params,
|
|
70
|
+
hint: 'CLI 不自动打开浏览器,请在浏览器中打开该 URL 完成后续填写与提交',
|
|
71
|
+
}, { wrote: true });
|
|
72
|
+
}
|
|
73
|
+
const flowBorrowCarPrepare = {
|
|
74
|
+
name: 'archive.flow.borrow-car.prepare',
|
|
75
|
+
resource: 'flow',
|
|
76
|
+
method: 'borrow-car',
|
|
77
|
+
action: 'archive.flow.borrow-car.prepare',
|
|
78
|
+
summary: '从借阅车发起借阅:检查流程绑定并生成确认票据(不写数据)',
|
|
79
|
+
capability: 'archive',
|
|
80
|
+
risk: READ,
|
|
81
|
+
inputSchema: schemaOf({
|
|
82
|
+
arcIds: { type: 'array', items: { type: 'string' }, description: '档案标识数组,元素为 {档案ID}_{表单ID}' },
|
|
83
|
+
carIds: { type: 'array', items: { type: 'string' }, description: '借阅车记录 ID 数组,与 arcIds 一一对应' },
|
|
84
|
+
}, { required: ['arcIds', 'carIds'], description: '从借阅车发起借阅' }),
|
|
85
|
+
handler: async (args, env) => {
|
|
86
|
+
const arcIds = requireArcIds(args.arcIds, 'arcIds');
|
|
87
|
+
const carIds = requireIdList(args.carIds, 'carIds');
|
|
88
|
+
if (arcIds.length !== carIds.length) {
|
|
89
|
+
throw archiveValidationError('id_count_mismatch', 'arcIds 与 carIds 数量必须一致');
|
|
90
|
+
}
|
|
91
|
+
const workflowId = await fetchWorkflowId(env.host);
|
|
92
|
+
const { continuation, expiresInMs } = await issueLease(env, BORROW_CAR_APPLY, { workflowId, arcIds, carIds });
|
|
93
|
+
return archiveSuccess('archive.flow.borrow-car.prepare', {
|
|
94
|
+
preview: { workflowId, count: arcIds.length, arcIds, carIds },
|
|
95
|
+
hint: '确认后调用 archive.flow.borrow-car.apply(CLI:archive flow borrow-car-apply --continuation <token> --yes)',
|
|
96
|
+
continuation,
|
|
97
|
+
}, { requiresConfirmation: true, expiresInMs });
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
const flowBorrowCarApply = {
|
|
101
|
+
name: BORROW_CAR_APPLY,
|
|
102
|
+
resource: 'flow',
|
|
103
|
+
method: 'borrow-car',
|
|
104
|
+
action: BORROW_CAR_APPLY,
|
|
105
|
+
summary: '从借阅车发起借阅(写操作):缓存档案与借阅车参数,返回借阅流程创建页 URL',
|
|
106
|
+
capability: 'archive',
|
|
107
|
+
risk: WRITE,
|
|
108
|
+
requiresConfirmation: true,
|
|
109
|
+
inputSchema: schemaOf({
|
|
110
|
+
continuation: { type: 'string', description: 'prepare 返回的确认票据' },
|
|
111
|
+
confirm: { type: 'boolean', description: '必须为 true(CLI --yes)' },
|
|
112
|
+
}, { required: ['continuation', 'confirm'], description: '从借阅车发起借阅' }),
|
|
113
|
+
handler: async (args, env) => {
|
|
114
|
+
const lease = await verifyLease(args, BORROW_CAR_APPLY, env);
|
|
115
|
+
const workflowId = String(lease.workflowId ?? '');
|
|
116
|
+
const arcIds = Array.isArray(lease.arcIds) ? lease.arcIds.map(String) : [];
|
|
117
|
+
const carIds = Array.isArray(lease.carIds) ? lease.carIds.map(String) : [];
|
|
118
|
+
if (!workflowId || arcIds.length === 0 || arcIds.length !== carIds.length) {
|
|
119
|
+
throw archiveValidationError('continuation_payload_invalid', '确认票据缺少 workflowId / arcIds / carIds');
|
|
120
|
+
}
|
|
121
|
+
const arcIndex = await addCache(env.host, arcIds.join(','), 'borrowCart');
|
|
122
|
+
const carIndex = await addCache(env.host, carIds.join(','), 'borrowCart');
|
|
123
|
+
const session = await env.host.getSession();
|
|
124
|
+
return flowResult(BORROW_CAR_APPLY, session.baseUrl, workflowId, {
|
|
125
|
+
workflowId,
|
|
126
|
+
isCreate: '1',
|
|
127
|
+
isAddIdentify: '1',
|
|
128
|
+
isBorrow: '1',
|
|
129
|
+
arcDataId: `arcCache_${arcIndex}`,
|
|
130
|
+
arcBorrowCarIds: `arcCache_${carIndex}`,
|
|
131
|
+
}, { mode: 'borrowCar', count: arcIds.length, caches: { arcDataId: arcIndex, arcBorrowCarIds: carIndex } });
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
const flowSearchPrepare = {
|
|
135
|
+
name: 'archive.flow.search.prepare',
|
|
136
|
+
resource: 'flow',
|
|
137
|
+
method: 'search',
|
|
138
|
+
action: 'archive.flow.search.prepare',
|
|
139
|
+
summary: '从全文检索结果直接发起借阅:检查流程绑定并生成确认票据(不写数据)',
|
|
140
|
+
capability: 'archive',
|
|
141
|
+
risk: READ,
|
|
142
|
+
inputSchema: schemaOf({ arcIds: { type: 'array', items: { type: 'string' }, description: '档案标识数组,元素为 {档案ID}_{表单ID}' } }, { required: ['arcIds'], description: '从检索结果发起借阅' }),
|
|
143
|
+
handler: async (args, env) => {
|
|
144
|
+
const arcIds = requireArcIds(args.arcIds, 'arcIds');
|
|
145
|
+
const workflowId = await fetchWorkflowId(env.host);
|
|
146
|
+
const { continuation, expiresInMs } = await issueLease(env, SEARCH_APPLY, { workflowId, arcIds });
|
|
147
|
+
return archiveSuccess('archive.flow.search.prepare', {
|
|
148
|
+
preview: { workflowId, count: arcIds.length, arcIds },
|
|
149
|
+
hint: '确认后调用 archive.flow.search.apply(CLI:archive flow search-apply --continuation <token> --yes)',
|
|
150
|
+
continuation,
|
|
151
|
+
}, { requiresConfirmation: true, expiresInMs });
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
const flowSearchApply = {
|
|
155
|
+
name: SEARCH_APPLY,
|
|
156
|
+
resource: 'flow',
|
|
157
|
+
method: 'search',
|
|
158
|
+
action: SEARCH_APPLY,
|
|
159
|
+
summary: '从全文检索结果直接发起借阅(写操作):只缓存档案参数,返回借阅流程创建页 URL',
|
|
160
|
+
capability: 'archive',
|
|
161
|
+
risk: WRITE,
|
|
162
|
+
requiresConfirmation: true,
|
|
163
|
+
inputSchema: schemaOf({
|
|
164
|
+
continuation: { type: 'string', description: 'prepare 返回的确认票据' },
|
|
165
|
+
confirm: { type: 'boolean', description: '必须为 true(CLI --yes)' },
|
|
166
|
+
}, { required: ['continuation', 'confirm'], description: '从检索结果发起借阅' }),
|
|
167
|
+
handler: async (args, env) => {
|
|
168
|
+
const lease = await verifyLease(args, SEARCH_APPLY, env);
|
|
169
|
+
const workflowId = String(lease.workflowId ?? '');
|
|
170
|
+
const arcIds = Array.isArray(lease.arcIds) ? lease.arcIds.map(String) : [];
|
|
171
|
+
if (!workflowId || arcIds.length === 0) {
|
|
172
|
+
throw archiveValidationError('continuation_payload_invalid', '确认票据缺少 workflowId / arcIds');
|
|
173
|
+
}
|
|
174
|
+
const arcIndex = await addCache(env.host, arcIds.join(','));
|
|
175
|
+
const session = await env.host.getSession();
|
|
176
|
+
return flowResult(SEARCH_APPLY, session.baseUrl, workflowId, {
|
|
177
|
+
workflowId,
|
|
178
|
+
isCreate: '1',
|
|
179
|
+
isAddIdentify: '1',
|
|
180
|
+
isBorrow: '1',
|
|
181
|
+
arcDataId: `arcCache_${arcIndex}`,
|
|
182
|
+
}, { mode: 'search', count: arcIds.length, caches: { arcDataId: arcIndex } });
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
const flowRenewPrepare = {
|
|
186
|
+
name: 'archive.flow.renew.prepare',
|
|
187
|
+
resource: 'flow',
|
|
188
|
+
method: 'renew',
|
|
189
|
+
action: 'archive.flow.renew.prepare',
|
|
190
|
+
summary: '借阅单续借:检查流程绑定并生成确认票据(不写数据)',
|
|
191
|
+
capability: 'archive',
|
|
192
|
+
risk: READ,
|
|
193
|
+
inputSchema: schemaOf({ dataId: { type: 'string', pattern: '^\\d+$', description: '借阅单主表数据 ID' } }, { required: ['dataId'], description: '借阅单续借' }),
|
|
194
|
+
handler: async (args, env) => {
|
|
195
|
+
const dataId = String(args.dataId ?? '').trim();
|
|
196
|
+
if (!NUMERIC_PATTERN.test(dataId)) {
|
|
197
|
+
throw archiveValidationError('data_id_invalid', 'dataId 必填且为数字 ID');
|
|
198
|
+
}
|
|
199
|
+
const workflowId = await fetchWorkflowId(env.host);
|
|
200
|
+
const { continuation, expiresInMs } = await issueLease(env, RENEW_APPLY, { workflowId, dataId });
|
|
201
|
+
return archiveSuccess('archive.flow.renew.prepare', {
|
|
202
|
+
preview: { workflowId, dataId },
|
|
203
|
+
hint: '确认后调用 archive.flow.renew.apply(CLI:archive flow renew-apply --continuation <token> --yes)',
|
|
204
|
+
continuation,
|
|
205
|
+
}, { requiresConfirmation: true, expiresInMs });
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
const flowRenewApply = {
|
|
209
|
+
name: RENEW_APPLY,
|
|
210
|
+
resource: 'flow',
|
|
211
|
+
method: 'renew',
|
|
212
|
+
action: RENEW_APPLY,
|
|
213
|
+
summary: '借阅单续借(写操作):返回续借流程创建页 URL(不调用 addCache)',
|
|
214
|
+
capability: 'archive',
|
|
215
|
+
risk: WRITE,
|
|
216
|
+
requiresConfirmation: true,
|
|
217
|
+
inputSchema: schemaOf({
|
|
218
|
+
continuation: { type: 'string', description: 'prepare 返回的确认票据' },
|
|
219
|
+
confirm: { type: 'boolean', description: '必须为 true(CLI --yes)' },
|
|
220
|
+
}, { required: ['continuation', 'confirm'], description: '借阅单续借' }),
|
|
221
|
+
handler: async (args, env) => {
|
|
222
|
+
const lease = await verifyLease(args, RENEW_APPLY, env);
|
|
223
|
+
const workflowId = String(lease.workflowId ?? '');
|
|
224
|
+
const dataId = String(lease.dataId ?? '').trim();
|
|
225
|
+
if (!workflowId || !NUMERIC_PATTERN.test(dataId)) {
|
|
226
|
+
throw archiveValidationError('continuation_payload_invalid', '确认票据缺少 workflowId / dataId');
|
|
227
|
+
}
|
|
228
|
+
assertLeaseTarget(lease, args, ['dataId'], RENEW_APPLY);
|
|
229
|
+
const session = await env.host.getSession();
|
|
230
|
+
return flowResult(RENEW_APPLY, session.baseUrl, workflowId, { workflowId, isCreate: '1', arcDataId: dataId, isReNew: '1' }, { mode: 'renew', dataId });
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
export const flowUrlOperations = [
|
|
234
|
+
flowBorrowCarPrepare,
|
|
235
|
+
flowBorrowCarApply,
|
|
236
|
+
flowSearchPrepare,
|
|
237
|
+
flowSearchApply,
|
|
238
|
+
flowRenewPrepare,
|
|
239
|
+
flowRenewApply,
|
|
240
|
+
];
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { archiveValidationError } from '../errors.js';
|
|
2
|
+
import { READ, archiveSuccess, schemaOf, } from './types.js';
|
|
3
|
+
import { assertEnum, compact, unwrapData } from './shared.js';
|
|
4
|
+
/**
|
|
5
|
+
* 档案库(收集库/管理库)全宗列表。getFonds 返回的全宗 id 同时是
|
|
6
|
+
* getTree(fondsId)、上传 saveFile(fonds_code) 等后续链路的前置输入,
|
|
7
|
+
* 因此必须暴露出来供 Agent 复用。
|
|
8
|
+
*/
|
|
9
|
+
const fondsList = {
|
|
10
|
+
name: 'archive.fonds.list',
|
|
11
|
+
resource: 'fonds',
|
|
12
|
+
method: 'list',
|
|
13
|
+
action: 'archive.fonds.list',
|
|
14
|
+
summary: '获取当前账号有权限的全宗列表(收集库/管理库);全宗 ID 供 getTree、预归档上传等后续链路复用',
|
|
15
|
+
capability: 'fonds',
|
|
16
|
+
risk: READ,
|
|
17
|
+
inputSchema: schemaOf({
|
|
18
|
+
menuSign: { type: 'string', enum: ['collectLib', 'manageLib'], description: '收集库/管理库,默认 collectLib' },
|
|
19
|
+
needControl: { type: 'boolean', description: '是否按当前用户权限过滤全宗,默认 true' },
|
|
20
|
+
}, { description: '查询档案全宗列表' }),
|
|
21
|
+
handler: async (args, { host }) => {
|
|
22
|
+
const menuSign = assertEnum(args.menuSign ?? 'collectLib', ['collectLib', 'manageLib'], 'menuSign');
|
|
23
|
+
const needControl = args.needControl === undefined ? true : Boolean(args.needControl);
|
|
24
|
+
const response = await host.request({
|
|
25
|
+
method: 'POST',
|
|
26
|
+
path: '/api/archive/core/archivetree/getFonds',
|
|
27
|
+
body: compact({
|
|
28
|
+
treeType: '1',
|
|
29
|
+
menuSign,
|
|
30
|
+
needControl,
|
|
31
|
+
extraData: false,
|
|
32
|
+
extraSign: '0',
|
|
33
|
+
logFlag: menuSign,
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
const data = unwrapData(response);
|
|
37
|
+
const rows = Array.isArray(data) ? data : [];
|
|
38
|
+
return archiveSuccess('archive.fonds.list', rows.map((item) => ({
|
|
39
|
+
id: item.id,
|
|
40
|
+
fonds_name: item.fonds_name,
|
|
41
|
+
fonds_code: item.fonds_code,
|
|
42
|
+
easy_name: item.easy_name ?? '',
|
|
43
|
+
classification: item.classification,
|
|
44
|
+
is_use: item.is_use,
|
|
45
|
+
fonds_parent: item.fonds_parent,
|
|
46
|
+
own_company: item.own_company,
|
|
47
|
+
})), { count: rows.length, menuSign });
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
/** 预归档电子文件库节点筛选:id 下划线前后一致(appId_metaId 或 appId_appId)。 */
|
|
51
|
+
function isEfileLibNode(item) {
|
|
52
|
+
const id = typeof item?.id === 'string' ? item.id : '';
|
|
53
|
+
if (!id || !id.includes('_'))
|
|
54
|
+
return false;
|
|
55
|
+
const [left, right] = id.split('_');
|
|
56
|
+
return Boolean(left && left === right);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 预归档树(getTree treeType=4)。主要目的是从返回节点中筛选出电子文件库节点
|
|
60
|
+
* (id 格式 {appId}_{metaId}/{appId}_{appId}),其 id 即 saveFile 的 treeId。
|
|
61
|
+
*/
|
|
62
|
+
const prelibTree = {
|
|
63
|
+
name: 'archive.prelib.tree',
|
|
64
|
+
resource: 'prelib',
|
|
65
|
+
method: 'tree',
|
|
66
|
+
action: 'archive.prelib.tree',
|
|
67
|
+
summary: '获取当前账号的预归档树节点,并识别电子文件库节点(id 形如 {appId}_{appId});电子文件库节点 id 即预归档上传 saveFile 的 treeId',
|
|
68
|
+
capability: 'fonds',
|
|
69
|
+
risk: READ,
|
|
70
|
+
inputSchema: schemaOf({}, { description: '查询预归档树(默认按当前用户权限)' }),
|
|
71
|
+
handler: async (_args, { host }) => {
|
|
72
|
+
const response = await host.request({
|
|
73
|
+
method: 'POST',
|
|
74
|
+
path: '/api/archive/core/archivetree/getTree',
|
|
75
|
+
body: {
|
|
76
|
+
treeType: '4',
|
|
77
|
+
menuSign: 'preLib',
|
|
78
|
+
logFlag: 'preLib',
|
|
79
|
+
needControl: true,
|
|
80
|
+
needSysn: true,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
const data = unwrapData(response);
|
|
84
|
+
if (!Array.isArray(data)) {
|
|
85
|
+
throw archiveValidationError('tree_invalid', 'getTree 返回异常:data 不是数组');
|
|
86
|
+
}
|
|
87
|
+
const nodes = data;
|
|
88
|
+
const efileLibraries = nodes.filter(isEfileLibNode).map((item) => ({ id: item.id, content: item.content }));
|
|
89
|
+
return archiveSuccess('archive.prelib.tree', efileLibraries, {
|
|
90
|
+
count: efileLibraries.length,
|
|
91
|
+
hint: '节点 id 下划线前后一致即为电子文件库 treeId,用于预归档上传',
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
export const fondsOperations = [fondsList, prelibTree];
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { archiveValidationError } from '../errors.js';
|
|
3
|
+
import { unwrapData } from './shared.js';
|
|
4
|
+
/**
|
|
5
|
+
* 借阅车 / 借阅单列表的 ebuilder 回退链路。
|
|
6
|
+
*
|
|
7
|
+
* 优先链路是自定义接口(getFormDataList/myBorrowCar、getFormDataList/myBorrowList),
|
|
8
|
+
* 自定义接口不可用时才走这里:
|
|
9
|
+
* 1. getPageUrl(一条请求拿到 appId + 默认视图 ID)
|
|
10
|
+
* 2. getPageUrl 不可用才回退 getAppIds → getObjsByTag → getViewlist
|
|
11
|
+
* 3. getListDatas(passid/cid = 表单对象 ID,listId = 视图 ID)
|
|
12
|
+
*/
|
|
13
|
+
export const ARCHIVE_APP_TAG = 'archive_wsd';
|
|
14
|
+
export const BORROW_CAR_TAG = 'uf_arc_borrow_car';
|
|
15
|
+
export const BORROWING_TAG = 'uf_arc_borrowing';
|
|
16
|
+
function asRecordArray(value) {
|
|
17
|
+
return Array.isArray(value) ? value.filter((item) => item && typeof item === 'object') : [];
|
|
18
|
+
}
|
|
19
|
+
function firstText(value) {
|
|
20
|
+
if (typeof value === 'string')
|
|
21
|
+
return value.trim();
|
|
22
|
+
if (typeof value === 'number')
|
|
23
|
+
return String(value);
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
async function fetchAppId(host) {
|
|
27
|
+
const response = await host.request({
|
|
28
|
+
method: 'GET',
|
|
29
|
+
path: '/api/bs/ebuilder/app/tags/getAppIds',
|
|
30
|
+
query: { tag: ARCHIVE_APP_TAG },
|
|
31
|
+
});
|
|
32
|
+
const data = unwrapData(response);
|
|
33
|
+
const first = Array.isArray(data) ? data[0] : undefined;
|
|
34
|
+
const appId = firstText(first && typeof first === 'object' ? first.id : first);
|
|
35
|
+
if (!appId)
|
|
36
|
+
throw archiveValidationError('app_id_missing', `未取到档案应用 ID(tag=${ARCHIVE_APP_TAG})`);
|
|
37
|
+
return appId;
|
|
38
|
+
}
|
|
39
|
+
async function fetchObjId(host, tag, appId) {
|
|
40
|
+
const response = await host.request({
|
|
41
|
+
method: 'GET',
|
|
42
|
+
path: '/api/ebuilder/form/obj/getObjsByTag',
|
|
43
|
+
query: { tag, appId },
|
|
44
|
+
});
|
|
45
|
+
const data = unwrapData(response);
|
|
46
|
+
const first = Array.isArray(data) ? data[0] : undefined;
|
|
47
|
+
const objId = firstText(first && typeof first === 'object' ? first.id : undefined);
|
|
48
|
+
if (!objId)
|
|
49
|
+
throw archiveValidationError('form_obj_missing', `未取到表单对象 ID(tag=${tag})`);
|
|
50
|
+
return objId;
|
|
51
|
+
}
|
|
52
|
+
function viewIdFromUrl(url) {
|
|
53
|
+
if (typeof url !== 'string')
|
|
54
|
+
return undefined;
|
|
55
|
+
const matched = url.match(/\/(\d+)\s*$/u);
|
|
56
|
+
return matched?.[1];
|
|
57
|
+
}
|
|
58
|
+
async function fetchViewId(host, objId, appId, viewMode) {
|
|
59
|
+
const response = await host.request({
|
|
60
|
+
method: 'GET',
|
|
61
|
+
path: `/api/ebuilder/form/fs/viewlist/getViewlist/${objId}`,
|
|
62
|
+
query: { apid: appId, tpaid: objId },
|
|
63
|
+
});
|
|
64
|
+
const data = unwrapData(response);
|
|
65
|
+
const views = asRecordArray(data?.tableView?.detail);
|
|
66
|
+
if (views.length === 0)
|
|
67
|
+
throw archiveValidationError('view_missing', '未取到列表视图配置');
|
|
68
|
+
if (viewMode === 'myBorrow') {
|
|
69
|
+
const matched = views.find((view) => String(view.name ?? '') === '我的借阅');
|
|
70
|
+
if (!matched)
|
|
71
|
+
throw archiveValidationError('view_missing', '未找到「我的借阅」视图,无法回退查询借阅单列表');
|
|
72
|
+
return firstText(matched.id);
|
|
73
|
+
}
|
|
74
|
+
const defaultView = views.find((view) => String(view.isDefault ?? '') === '1') ?? views[0];
|
|
75
|
+
return firstText(defaultView.id);
|
|
76
|
+
}
|
|
77
|
+
export async function resolveArchiveListTarget(host, options) {
|
|
78
|
+
const viewMode = options.viewMode ?? 'default';
|
|
79
|
+
let appId = '';
|
|
80
|
+
let viewId;
|
|
81
|
+
try {
|
|
82
|
+
const response = await host.request({
|
|
83
|
+
method: 'POST',
|
|
84
|
+
path: '/api/archive/core/form/getPageUrl',
|
|
85
|
+
query: { terminalType: 'pc', type: '1', sign: options.sign },
|
|
86
|
+
});
|
|
87
|
+
const data = unwrapData(response);
|
|
88
|
+
appId = firstText(data?.appId);
|
|
89
|
+
viewId = viewIdFromUrl(data?.url);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// getPageUrl 不可用时回退三步链路
|
|
93
|
+
}
|
|
94
|
+
if (!appId)
|
|
95
|
+
appId = await fetchAppId(host);
|
|
96
|
+
const objId = await fetchObjId(host, options.sign, appId);
|
|
97
|
+
if (!viewId) {
|
|
98
|
+
return { appId, objId, viewId: await fetchViewId(host, objId, appId, viewMode), viewSource: 'getViewlist' };
|
|
99
|
+
}
|
|
100
|
+
return { appId, objId, viewId, viewSource: 'getPageUrl' };
|
|
101
|
+
}
|
|
102
|
+
export async function fetchArchiveListDatas(host, target, pageNo, logFlag) {
|
|
103
|
+
const current = Number.isInteger(pageNo) && pageNo > 0 ? pageNo : 1;
|
|
104
|
+
const body = {
|
|
105
|
+
current,
|
|
106
|
+
listId: target.viewId,
|
|
107
|
+
searchParamData: { searchType: '2', type: 'and', commonSearchFields: {}, groupFields: {} },
|
|
108
|
+
requiredMatch: 1,
|
|
109
|
+
tableuid: randomBytes(16).toString('hex'),
|
|
110
|
+
mapResult: '1',
|
|
111
|
+
recheckQuery: '1',
|
|
112
|
+
isFollow: 0,
|
|
113
|
+
isShareToMe: 0,
|
|
114
|
+
filterCondition: {},
|
|
115
|
+
browser: 'Chrome',
|
|
116
|
+
};
|
|
117
|
+
if (logFlag)
|
|
118
|
+
body.logFlag = logFlag;
|
|
119
|
+
const response = await host.request({
|
|
120
|
+
method: 'POST',
|
|
121
|
+
path: '/api/ebuilder/form/list/getListDatas',
|
|
122
|
+
query: { passid: target.objId, cid: target.objId },
|
|
123
|
+
body,
|
|
124
|
+
});
|
|
125
|
+
const data = unwrapData(response);
|
|
126
|
+
const pageSize = data?.pageSize === undefined ? undefined : Number(data.pageSize);
|
|
127
|
+
const total = data?.total === undefined ? undefined : Number(data.total);
|
|
128
|
+
return {
|
|
129
|
+
columns: asRecordArray(data?.columns),
|
|
130
|
+
rows: asRecordArray(data?.data),
|
|
131
|
+
displayRows: asRecordArray(data?.displayData),
|
|
132
|
+
pageNo: Number(data?.current ?? current),
|
|
133
|
+
...(pageSize === undefined ? {} : { pageSize }),
|
|
134
|
+
// getPageUrl 视图下 total 可能为 0,但 data 数组仍有完整数据,因此只作参考
|
|
135
|
+
...(total === undefined ? {} : { total }),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { archiveValidationError } from '../errors.js';
|
|
2
|
+
import { fondsOperations } from './fonds.js';
|
|
3
|
+
import { archiveInfoOperations } from './archive-info.js';
|
|
4
|
+
import { searchOperations } from './search.js';
|
|
5
|
+
import { borrowCarOperations } from './borrow-car.js';
|
|
6
|
+
import { borrowListOperations } from './borrow-list.js';
|
|
7
|
+
import { downloadOperations } from './download.js';
|
|
8
|
+
import { flowUrlOperations } from './flow-url.js';
|
|
9
|
+
import { uploadOperations } from './upload.js';
|
|
10
|
+
function buildRegistry() {
|
|
11
|
+
const registry = new Map();
|
|
12
|
+
const definitions = [
|
|
13
|
+
...fondsOperations,
|
|
14
|
+
...archiveInfoOperations,
|
|
15
|
+
...searchOperations,
|
|
16
|
+
...borrowCarOperations,
|
|
17
|
+
...borrowListOperations,
|
|
18
|
+
...downloadOperations,
|
|
19
|
+
...flowUrlOperations,
|
|
20
|
+
...uploadOperations,
|
|
21
|
+
];
|
|
22
|
+
for (const definition of definitions) {
|
|
23
|
+
if (registry.has(definition.name)) {
|
|
24
|
+
throw new Error(`duplicate archive operation: ${definition.name}`);
|
|
25
|
+
}
|
|
26
|
+
registry.set(definition.name, definition);
|
|
27
|
+
}
|
|
28
|
+
return registry;
|
|
29
|
+
}
|
|
30
|
+
const archiveOperationRegistry = buildRegistry();
|
|
31
|
+
export function archiveOperationDefinitions() {
|
|
32
|
+
return [...archiveOperationRegistry.values()];
|
|
33
|
+
}
|
|
34
|
+
export function getArchiveOperation(operation) {
|
|
35
|
+
const definition = archiveOperationRegistry.get(operation);
|
|
36
|
+
if (!definition) {
|
|
37
|
+
throw archiveValidationError('operation_unknown', `文书定档案不支持操作:${operation}`);
|
|
38
|
+
}
|
|
39
|
+
return definition;
|
|
40
|
+
}
|
|
41
|
+
export function hasArchiveOperation(operation) {
|
|
42
|
+
return archiveOperationRegistry.has(operation);
|
|
43
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { archiveValidationError } from '../errors.js';
|
|
2
|
+
import { toSearchRowView } from '../render/search-view.js';
|
|
3
|
+
import { READ, archiveSuccess, schemaOf, } from './types.js';
|
|
4
|
+
import { requireText, unwrapData } from './shared.js';
|
|
5
|
+
const EBDATA_PREFIX = 'EBDATA_OBJID';
|
|
6
|
+
function parseFormId(module) {
|
|
7
|
+
const text = typeof module === 'string' ? module : '';
|
|
8
|
+
if (!text.startsWith(EBDATA_PREFIX))
|
|
9
|
+
return undefined;
|
|
10
|
+
const id = text.slice(EBDATA_PREFIX.length);
|
|
11
|
+
return /^\d+$/.test(id) ? id : undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 档案全文检索(可借档案)。搜索结果行中的 dataId(id)与 formId(module 去前缀)
|
|
15
|
+
* 是「加入借阅车/发起借阅」的输入,Agent 应按行复用,不要要求用户背诵内部 ID。
|
|
16
|
+
*/
|
|
17
|
+
const searchRun = {
|
|
18
|
+
name: 'archive.search.run',
|
|
19
|
+
resource: 'search',
|
|
20
|
+
method: 'run',
|
|
21
|
+
action: 'archive.search.run',
|
|
22
|
+
summary: '按关键词全文检索档案(可借档案列表),支持分页;每行除原始字段外会附带 level/fonds/category/dateLabel/dateValue/viewPath 展示字段,结果行的 id 与 formId 用于加入借阅车、发起借阅或拼接 archiveView 链接',
|
|
23
|
+
capability: 'search',
|
|
24
|
+
risk: READ,
|
|
25
|
+
inputSchema: schemaOf({
|
|
26
|
+
key: { type: 'string', minLength: 1, description: '搜索关键词(必填)' },
|
|
27
|
+
pageNo: { type: 'integer', minimum: 0, description: '页码,从 0 开始,默认 0' },
|
|
28
|
+
pageSize: { type: 'integer', minimum: 1, maximum: 100, description: '每页条数,默认 10' },
|
|
29
|
+
type1: { type: 'string', description: '检索范围一级分类,缺省 0=全部范围' },
|
|
30
|
+
type2: { type: 'string', description: '检索范围二级分类,缺省 0=全部范围' },
|
|
31
|
+
}, { required: ['key'], description: '全文检索档案(缺省在全部范围内检索)' }),
|
|
32
|
+
handler: async (args, { host }) => {
|
|
33
|
+
const key = requireText(args.key, 'key');
|
|
34
|
+
const pageNo = args.pageNo === undefined ? 0 : Number(args.pageNo);
|
|
35
|
+
const pageSize = args.pageSize === undefined ? 10 : Number(args.pageSize);
|
|
36
|
+
// 检索范围不传时按「全部」处理(type1/type2=0),否则全文检索会 0 命中。
|
|
37
|
+
const body = { key, pageNo, pageSize, type1: '0', type2: '0' };
|
|
38
|
+
if (args.type1 !== undefined)
|
|
39
|
+
body.type1 = String(args.type1);
|
|
40
|
+
if (args.type2 !== undefined)
|
|
41
|
+
body.type2 = String(args.type2);
|
|
42
|
+
const response = await host.request({
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: '/api/archive/core/fullSearch/searchByModule',
|
|
45
|
+
body,
|
|
46
|
+
});
|
|
47
|
+
const data = unwrapData(response);
|
|
48
|
+
if (!data || typeof data !== 'object') {
|
|
49
|
+
throw archiveValidationError('search_invalid', '全文检索返回异常:data 缺失');
|
|
50
|
+
}
|
|
51
|
+
const result = data;
|
|
52
|
+
const rows = Array.isArray(result.archiveResult) ? result.archiveResult : [];
|
|
53
|
+
return archiveSuccess('archive.search.run', rows.map((item) => {
|
|
54
|
+
const row = {
|
|
55
|
+
id: item.id,
|
|
56
|
+
formId: parseFormId(item.module) ?? parseFormId(item.showModule) ?? undefined,
|
|
57
|
+
title: String(item.title ?? ''),
|
|
58
|
+
content: item.content ?? '',
|
|
59
|
+
highLightContent: item.highLightContent ?? '',
|
|
60
|
+
module: item.module,
|
|
61
|
+
footInfo: item.footInfo,
|
|
62
|
+
headList: item.archiveMess?.headList ?? [],
|
|
63
|
+
footList: item.archiveMess?.footList ?? [],
|
|
64
|
+
createTime: item.createTime ?? '',
|
|
65
|
+
};
|
|
66
|
+
// 派生标准展示字段:层级/全宗/分类/日期/可打开链接(原字段保留不动)。
|
|
67
|
+
const view = toSearchRowView(row);
|
|
68
|
+
return {
|
|
69
|
+
...row,
|
|
70
|
+
...(row.title ? {} : view.title ? { title: view.title } : {}),
|
|
71
|
+
level: view.level,
|
|
72
|
+
fonds: view.fonds,
|
|
73
|
+
category: view.category,
|
|
74
|
+
dateLabel: view.dateLabel,
|
|
75
|
+
dateValue: view.dateValue,
|
|
76
|
+
viewPath: view.viewPath,
|
|
77
|
+
};
|
|
78
|
+
}), {
|
|
79
|
+
pageNo: result.pageNo ?? pageNo,
|
|
80
|
+
pageSize: result.pageSize ?? pageSize,
|
|
81
|
+
total: result.total ?? 0,
|
|
82
|
+
totalPage: result.totalPage ?? 0,
|
|
83
|
+
hasNext: Boolean(result.hasNext),
|
|
84
|
+
keyword: result.keyword ?? key,
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
export const searchOperations = [searchRun];
|