From bb703620f212b643723f94854c23af7f94ce34d7 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Thu, 29 Oct 2026 16:01:21 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=95=B4=E7=90=86=E5=90=88=E6=80=9D?= =?UTF-8?q?=E5=86=85=E9=83=A8=E6=8E=A5=E5=8F=A3=E8=A7=84=E8=8C=83=E5=B9=B6?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=8E=86=E5=8F=B2=E8=BF=81=E7=A7=BB=E6=B8=85?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将未跟踪的 specs/hose 改名为 specs/hose-close-api,纳入接口清单、维护说明和五份 JSON Schema,同步 Schema 标识及文档引用。 删除 README 的已迁移功能历史清单,补充 specs 的含义和新目录入口。临时抓包完整保留在本地并由 Git 忽略,避免提交租户业务资料。 验证:bun test(892 通过、0 失败)、bun run check、git diff --check;五份 Schema、17 个内部引用及相关文档链接校验通过。 --- .gitignore | 3 + README.md | 29 +-- .../2026-10-28-local-progress-integration.md | 2 +- specs/hose-close-api/README.md | 100 ++++++++++ specs/hose-close-api/endpoints.md | 185 ++++++++++++++++++ .../schemas/form-specification.schema.json | 136 +++++++++++++ .../schemas/workflow-chooses.schema.json | 49 +++++ .../schemas/workflow-detail.schema.json | 104 ++++++++++ .../workflow-job-execution.schema.json | 116 +++++++++++ .../schemas/workflow-snapshot.schema.json | 46 +++++ 10 files changed, 741 insertions(+), 29 deletions(-) create mode 100644 specs/hose-close-api/README.md create mode 100644 specs/hose-close-api/endpoints.md create mode 100644 specs/hose-close-api/schemas/form-specification.schema.json create mode 100644 specs/hose-close-api/schemas/workflow-chooses.schema.json create mode 100644 specs/hose-close-api/schemas/workflow-detail.schema.json create mode 100644 specs/hose-close-api/schemas/workflow-job-execution.schema.json create mode 100644 specs/hose-close-api/schemas/workflow-snapshot.schema.json diff --git a/.gitignore b/.gitignore index 9c047f2..b4c185b 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,6 @@ exports/ # Local drafts for repo-gh & AI Agents .drafts/* !.drafts/.gitkeep + +# Local API captures may contain tenant business data +/specs/hose-close-api/_tmp-captured/ diff --git a/README.md b/README.md index 5887177..2454f92 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ hose-use mcp # 启动 MCP Server (默认暴露 | `.agents/` | 本仓库的开发规则与技能发现配置,见 [.agents/README.md](./.agents/README.md);与产品分发用的 `skills/` 职责不同。 | | `.github/` | CI 与 Release 工作流,负责校验、构建和发布。 | | `.zcode-plugin/` | 受版本管理的 [IDE 插件清单](./.zcode-plugin/plugin.json),声明 Skill 路径、MCP 配置与用户开关。 | -| `specs/` | API 与工作流规范:`openapi/` 是包装层 YAML 源文件,`openapi.json` 是其打包结果,`openapi.raw.json` 是独立的下游接口规范,`workflow-schema.json` 是从 Zod 导出的工作流结构。生成入口见下文。 | +| `specs/` | specifications(规范)的缩写,存放 API 与工作流规范:`openapi/` 是包装层 YAML 源文件,`openapi.json` 是其打包结果,`openapi.raw.json` 是独立的下游接口规范,`workflow-schema.json` 是从 Zod 导出的工作流结构。[hose-close-api/](./specs/hose-close-api/README.md) 保存从代码整理的合思内部接口清单与 Schema;本地临时抓包不纳入 Git。生成入口见下文。 | | `dist/`(本地) | 全部是已忽略的构建输出:`mcp/server.js` 是 [.mcp.json](./.mcp.json) 引用的插件 bundle,`bin/` 保存独立二进制与发布归档。可重新构建,不随 Git 分发;删除后再次加载源码插件前须先构建。详见 [构建与分发说明](./src/packaging/README.packaging.md)。 | | `docs/` | 跨模块参考与审阅记录。`modules/platform.md` 及部分域 README 仍含旧多工具 MCP 描述和旧代码路径,当前架构以 [AGENTS.md](./AGENTS.md) 与实现为准;`reviews/` 保留历史审阅及验证证据。 | | `enterprises/` | 仅跟踪配置示例与 [目录说明](./enterprises/README.md)。实际企业配置默认放在 `~/.config/hose-use/enterprises/`,仓库内其他企业 JSON 被忽略。 | @@ -177,33 +177,6 @@ src/ 详细导航:[CLI](./src/cli/README.cli.md)、[Core](./src/core/README.core.md)、[业务域](./src/domains/README.domains.md)、[HTTP](./src/http/README.http.md)、[构建与分发](./src/packaging/README.packaging.md)。 -## 已迁移功能 - -以下为历史能力迁移清单,括号中保留旧工具标识;当前命令见上方 CLI 速查,MCP 统一通过 `hose_cli` 调用。 - -### Platform -- [x] 自建应用列表 (`platform_list`) -- [x] EASO 四步认证 -- [x] Piper 三步认证 -- [x] 工作流列表 (`platform_workflow_list`) -- [x] 工作流统计 (`platform_workflow_stats`) -- [x] 工作流配额 (`platform_workflow_charge`) -- [x] 工作流详情 (`platform_workflow_detail`) -- [x] 工作流启停 (`platform_workflow_toggle`) -- [x] 工作流运行任务 (`platform_workflow_jobs`) -- [x] 工作流 DSL 配置 (`platform_workflow_dsl`) -- [x] 企业员工列表 (`platform_workflow_staffs`) -- [x] 工作流 Webhook (`platform_workflow_webhook`) -- [x] 工作流采样数据 (`platform_workflow_sample`) -- [x] 跨应用汇总工作流 (`platform_workflow_list_all`) -- [x] 按节点类型递归查找工作流 (`platform_workflow_find_by_task`) -- [x] 工作流节点 JSON Schema 约束 - -### Core -- [x] 多企业切换 -- [x] Token 自动刷新(内存 + 持久化) -- [x] 动态域名配置 - ## 废弃功能 - [ ] HAB 智能审核(Agent/Rule)— 业务废弃 - [ ] AI 审批配置 — 业务废弃 diff --git a/docs/reviews/2026-10-28-local-progress-integration.md b/docs/reviews/2026-10-28-local-progress-integration.md index a37a1b0..43c6033 100644 --- a/docs/reviews/2026-10-28-local-progress-integration.md +++ b/docs/reviews/2026-10-28-local-progress-integration.md @@ -33,7 +33,7 @@ ## 保留与未覆盖 - 原 `fix/review-20261023` 分支和 c758 工作区保留;本次选择性整合,因此原提交不会因本次 PR 自动成为主分支祖先。 -- 主目录 `specs/hose/` 中的接口盘点、schema 及临时抓包作为待整理资料保留。文档自行标注部分接口未进行一对一抓包校验,临时请求/响应不作为本次修复的发布资产;`.mimosa/` 属于工具会话状态及快照,不作为功能源码提交。 +- 主目录 `specs/hose/`(现已迁移至 [`specs/hose-close-api/`](../../specs/hose-close-api/README.md))中的接口盘点、schema 及临时抓包作为待整理资料保留。文档自行标注部分接口未进行一对一抓包校验,临时请求/响应不作为本次修复的发布资产;`.mimosa/` 属于工具会话状态及快照,不作为功能源码提交。 - 不回退已合并的工作流、MVEL、发票取消与插件分发修复;不重新跟踪 `dist/`,不打版本 tag,不发布新版。 - 本地校验不替代服务端完整业务校验;真实模板兼容性、核销关联复制的服务端限制和业务写入端到端验证仍需独立测试。无重试写入或自动修改业务输入。 - 重点复查:复制保留核销关联并计算净支付的业务选择,以及以前可直接复制/提交的错误表单现在会在本地被拒绝。规格读取失败也会阻止复制或送审。 diff --git a/specs/hose-close-api/README.md b/specs/hose-close-api/README.md new file mode 100644 index 0000000..d344930 --- /dev/null +++ b/specs/hose-close-api/README.md @@ -0,0 +1,100 @@ +# 合思内部接口规范(hose-close-api) + +本目录只做一件事:**从当前代码契约中盘点已经在用的合思/易快报接口**,记录 method、path、域名、请求参数/body、响应结构和来源。 + +- Git 管理本目录的接口清单、JSON Schema 和维护说明。`hose-close-api` 以网页内部接口及相关认证链路为主,也记录代码使用的 OpenAPI。 +- `_tmp-captured/` 只保留在本地,已被 Git 忽略;其中可能含租户模板、工作流与业务 ID,不随仓库分发。文中的抓包引用是本地验证线索,新克隆中可能不存在。 +- 本包不是官方 OpenAPI。`code-derived` 表示只从 `src/` 推导,没有 1:1 抓包验证。 +- 历史参考:`specs/openapi.raw.json`(未修改)。其中部分响应包装写法已过时,不能直接当契约使用。 + +## 目录结构 + +```text +specs/hose-close-api/ +├── README.md # 本文件:范围、来源、约定、覆盖统计 +├── endpoints.md # 按域分组的正式接口清单(66 个代码接口 + 8 个 legacy 参考) +├── schemas/ # 代码契约对应的 JSON Schema +│ ├── form-specification.schema.json +│ ├── workflow-detail.schema.json +│ ├── workflow-snapshot.schema.json +│ ├── workflow-chooses.schema.json +│ └── workflow-job-execution.schema.json +└── _tmp-captured/ # 本地临时抓包,Git 忽略,不随仓库分发 +``` + +> `_tmp-captured/` 中的付款单模板保存、工作流保存/chooses/快照、Job 执行和最新页面请求清单是本地临时资料;本次整理保留其内容,仅迁移目录位置。 + +## 覆盖统计 + +以下为 2026-10-28 整理快照,来源行号用于定位当时实现,后续代码变动可能使行号偏移。 + +| 域 | 代码接口数 | 主要来源 | +|---|---:|---| +| auth / corps | 19 | `src/core/auth/login.ts`、`openapi-v1.ts`、`link-import.ts`、`src/core/http/*` | +| platform / workflow | 30 | `src/domains/platform/api.ts` | +| bill / specifications | 5 | `src/domains/bill/api.ts`、`templates.ts`、`src/domains/feetype/api.ts` | +| assist-platform | 12 | `src/domains/assist-platform/api.ts` | +| **合计** | **66** | | + +另有 8 个仅存在于 `specs/openapi.raw.json` 的历史接口,作为 legacy 参考单列,不计入 66 个代码接口。 + +## 来源 + +- `src/domains/platform/api.ts` + `src/domains/platform/types.ts` +- `src/domains/bill/api.ts` + `src/domains/bill/types.ts` + `src/domains/bill/templates.ts` +- `src/domains/feetype/api.ts` +- `src/domains/assist-platform/api.ts` +- `src/core/auth/login.ts`、`src/core/auth/openapi-v1.ts`、`src/core/auth/link-import.ts` +- `src/core/http/openapi-client.ts`、`unity-client.ts`、`script-engine-client.ts`、`assist-platform-client.ts`、`session-client.ts` +- 历史参考:`specs/openapi.raw.json` + +## 域名约定 + +| 代号 | 基地址 | 用途 | +|---|---|---| +| `BC` | `https://business-center.ekuaibao.com` | 账号登录、企业列表、企业切换、换发 hose token | +| `IDP` | `https://idp.hosecloud.com` | 用授权码换主站 access_token | +| `EKB` | `https://app.ekuaibao.com`(按企业集群可能是 `wx2` 等) | 主站业务、模板、OpenAPI、自建应用列表 | +| `EASO` | `https://unity.ekuaibao.com` | EASO 平台、协助平台网关 | +| `PIPER` | `https://piper.ekuaibao.com` | 工作流(pipeline)与 Job 执行 | +| `ASSIST` | `https://unity.ekuaibao.com/api` | 协助平台客户端前缀 | +| `GW` | `https://d9jxeccs5j.sealosgzg.site` | 灰度节点开通网关(非合思域名) | + +## 响应包装约定 + +- **Piper / EASO 业务接口**:常见 `{ "code": 200, "msg": "...", "data": ... }`。`code` 是数字;`src/domains/platform/api.ts` 把非 200 的 `code` 当错误。 +- **主站列表接口**:常见裸 `{ "items": [...] }`、`{ "value": ... }` 或直接数组。 +- **快照接口**:`inputs` / `outputs` 在响应里是 JSON 编码字符串,不是数组;`WorkflowSnapshotSchema` 兼容字符串和数组。 +- **Job 执行接口**:`/execution`、`/execution/level/failed` 的 `data` 可能是数组,也可能是 `{number,size,totalPages,totalItems,items}` 分页对象。 +- **协助平台**:`assist-platform-client.ts` 使用 `prefix: "https://unity.ekuaibao.com/api"`;代码中部分 path 又以 `api/` 开头,ky 会直接拼接。`endpoints.md` 保留代码字面量,实际 URL 以运行时为准。 + +## 关键字段约定 + +单据模板组件的字段 key 是 **`field`**,不是 `key`/`name`。代码侧 `src/domains/bill/types.ts` 的 `FormSpecificationComponentSchema` 也以 `field` 为准。 + +```json +{ + "field": "u_单据编号", + "label": "关联发票核销单号", + "type": "text", + "optional": true, + "maxLength": 140 +} +``` + +本次抓包确认:付款单模板新增字段的 `field` 是 `u_单据编号`,`label` 是 `关联发票核销单号`。相关原始请求见本地 `_tmp-captured/`。 + +## 维护方式 + +1. 只从实际代码调用点新增或修正正式接口;不要凭截图或推测补字段。 +2. 每个条目在 `endpoints.md` 标注 `src/...:line` 来源。 +3. 响应结构优先引用 `schemas/`;没有 schema 的写关键字段和包装形态。 +4. 新抓包先放本地 `_tmp-captured/`;核实后只将接口契约与匿名示例提升为正式条目,不直接提交租户数据。 +5. 不提交凭证、Cookie、token、企业名、员工姓名、手机号。 + +## 已知缺口 + +- 代码中没有 `PUT /api/form/v2/specifications/{id}/$false`(模板保存)、`POST /api/form/v2/specifications/search/all`、`GET /api/form/v2/specificationGroups`、`GET /api/form/v2/requisition/expenseLink/{id}`、`POST /api/v1/requisition/autoAssociate/config/list`;这些只出现在本次抓包,见 `_tmp-captured/`。 +- 代码中没有 assist-platform 的抓包,全部按代码契约记录。 +- 主站响应包装存在 `items` / `value` / 裸对象多种形态,部分接口未做 1:1 抓包校验。 +- `specs/openapi.raw.json` 中 `code` 写成 `"SUCCESS"` 等旧格式,与当前代码按数字判断不一致,仅作历史参考。 diff --git a/specs/hose-close-api/endpoints.md b/specs/hose-close-api/endpoints.md new file mode 100644 index 0000000..98889b1 --- /dev/null +++ b/specs/hose-close-api/endpoints.md @@ -0,0 +1,185 @@ +# 正式接口清单 + +只收录当前代码契约中存在的接口。域名代号见 [README.md](./README.md)。`来源` 精确到文件与行号;`抓包` 中的“否”表示本包没有 1:1 原始抓包,不代表接口不可用。 + +- 代码接口:66 个 +- legacy 参考:8 个(仅存在于 `specs/openapi.raw.json`,不计入 66) +- 抓包参考:本地 `_tmp-captured/`,Git 忽略,不随仓库分发;来源与覆盖统计见 [README](./README.md) + +## 1. auth / corps(19) + +| # | Method | Path | 请求 | 响应 | 来源 | 抓包 | +|---|---|---|---|---|---|---| +| A01 | GET | `BC /cloud-auth/public/auth/public-key` | 无 | `{data:{base64}}` | `src/core/auth/login.ts:47` | 否 | +| A02 | POST | `BC /cloud-auth/public/auth/login-by-password` | `{deviceType,username,password}`;password 为 RSA 加密密文 | `{data:,errorCode?,errorMessage?}` | `src/core/auth/login.ts:104` | 否 | +| A03 | POST | `BC /cloud-auth/public/auth/send-verification-code` | `{bizType:"LOGIN",account:"86-",channelType:"SMS",...captchaParams}` | `{data:{codeId},errorCode?,errorMessage?}` | `src/core/auth/login.ts:139` | 否 | +| A04 | POST | `BC /cloud-auth/public/auth/login-by-code` | `{username,code,codeId,deviceType}` | `{data:,errorCode?,errorMessage?}` | `src/core/auth/login.ts:162` | 否 | +| A05 | GET | `BC /cloud-auth/public/auth/list-corporations` | Header `cloud-auth-token` | `{data:{items:[CorporationItem],externalItems:[]},errorCode?,errorMessage?}`;Item 字段见下 | `src/core/auth/login.ts:242` | 否 | +| A06 | POST | `BC /cloud-auth/public/auth/switch-corporation` | Header `cloud-auth-token`;body `{corporationId,userId,cluster}` | `{data:{accessToken:},errorCode?,errorMessage?}` | `src/core/auth/login.ts:269` | 否 | +| A07 | POST | `IDP /api/idp/public/oauth2/token` | `{clientId:"whispered-app",grantType:"authorization_code",code:,withIdToken:false}` | `{access_token,token_type,expires_in,refresh_token?,id_token?}` | `src/core/auth/login.ts:288` | 否 | +| A08 | GET | `BC /auth/oauth2/grant/ekb/accessToken` | Query `{corpId,ekbAccessToken,environment}` | `{data:}` | `src/core/http/unity-client.ts:70` | 否 | +| A09 | GET | `EKB /api/engine/realm/$UNITY/actions/jwt` | Query `{corpId}`;Headers `accesstoken`、`corpid`、`staffid` | `{id?,value?}`,取 `id` 或 `value` 作为 UNITY JWT | `src/core/http/unity-client.ts:91`、`src/core/auth/link-import.ts:262` | 否 | +| A10 | GET | `EKB /api/engine/realm/$EASO/actions/jwt` | 同 A09 | `{id?,value?}`,取 `id` 或 `value` 作为 EASO JWT | `src/core/http/script-engine-client.ts:68` | 否 | +| A11 | GET | `EASO /api/realms/EASO` | Query `{corpId}`;Headers `Authorization: Bearer `、可选 `hoseaccesstoken` | `{value:{accessToken}}` | `src/core/http/unity-client.ts:119` | 否 | +| A12 | GET | `EKB /api/account/v2/session` | Headers `accesstoken`、`corpid`、可选 `staffid` | `{value:{id,userId,loginStaffId,corporationId,platform,isAssistPlatform,isShortTermToken,assistId,operationUserId,operationUserName,privilege,deviceType,loginAccountType,loginTime,expTime}}` | `src/core/auth/link-import.ts:329` | 否 | +| A13 | POST | `EKB /api/openapi/v1/auth/getAccessToken` | `{appKey,appSecurity}` | `{value:{accessToken,corporationId,expireTime,errorCode?,errorMessage?}}`;也兼容顶层 `accessToken`/`token` | `src/core/auth/openapi-v1.ts:133` | 否 | +| A14 | POST | `EKB /api/openapi/v1.1/provisional/getProvisionalAuth` | Query `{accessToken}`;body `{uid,pageType:"home",expireDate}` | `{value:{message:}}`,从 URL 的 `accessToken` 参数取临时会话 token | `src/core/auth/openapi-v1.ts:199` | 否 | +| A15 | GET | `EKB /api/innerapi/v1/key` | Query `{corpId}`;Headers `accesstoken`、`corpid`、`staffid` | `{items:[{id,name,appKey,appSecurity}]}` | `src/core/auth/openapi-v1.ts:240` | 否 | +| A16 | GET | `EKB /api/openapi/v1/roleDefGroups` | Query `{accessToken}` | `{items:[{id,name,enName,roleDefs:[{id,name,enName,sourceType,sourceTypeValue}]}]}` | `src/core/auth/openapi-v1.ts:388` | 否 | +| A17 | GET | `EKB /api/openapi/v1/roledefs/${roledefId}` | Query `{accessToken,staffBy,pathType:"name"}` | `{value:{id,name,count,contents:[{staffs:[]}]}}` | `src/core/auth/openapi-v1.ts:434` | 否 | +| A18 | POST | `EKB /api/openapi/v1/staffs/getStaffIds` | Query `{accessToken}`;body `{type:"STAFFID",conditionIds:[...]}` | `{items:[StaffDetail]}` | `src/core/auth/openapi-v1.ts:473` | 否 | +| A19 | POST | `EKB /api/openapi/v2/auth/token` | `{appKey,appSecurity}` | `{value}` 或 `{token}` 或 `{accessToken}` | `src/core/http/openapi-client.ts:50` | 否 | + +`CorporationItem` 代码字段(`src/core/auth/types.ts:37`): + +```text +corporationId, corporationName, corporationEnName?, cluster, clientId?, +staffId, userId, sourceChannel?, baseUrl?, external?, needAuth? +``` + +## 2. platform / workflow(30) + +工作流接口通过 Piper 客户端调用(`src/core/http/script-engine-client.ts`): +`Authorization: Bearer `、`platformid: `、可选 `hoseaccesstoken`。 +`listPlatforms` 例外,它走主站 `ekbClient`。 + +| # | Method | Path | 请求 | 响应 | 来源 | 抓包 | +|---|---|---|---|---|---|---| +| P01 | GET | `EKB /api/v2/datalink/platform/search` | Query `{scope:"enable",corpId}` | `{items:[Platform]}` | `src/domains/platform/api.ts:82`、`src/domains/datalink/api.ts:55` | 否 | +| P02 | GET | `PIPER /api/easo/pipelines/logs` | Query `{platformId,number,pageSize}` | `{code,msg,data:{pipelineNum,runningNum,allRunCount,errorCount,number,size,totalPages,totalItems,pipelineList:[Workflow]}}` | `src/domains/platform/api.ts:98` | legacy | +| P03 | GET | `PIPER /api/easo/stats` | Query `{platformId}` | `{code,msg,data:{total,completed,failed,started,pipelineOpenCount,pipelineCloseCount,pipelineAllCount}}` | `src/domains/platform/api.ts:112` | 否 | +| P04 | GET | `PIPER /api/easo/charge` | 无 | `{code,msg,data:{corporationId,status,orderType,total,used,remaining}}` | `src/domains/platform/api.ts:121` | 否 | +| P05 | GET | `PIPER /api/easo/pipelines/{pipelineId}` | 无 | `{code,msg,data:WorkflowDetail}`;结构见 `schemas/workflow-detail.schema.json` | `src/domains/platform/api.ts:131` | legacy | +| P06 | PUT | `PIPER /api/easo/pipelines/{id}` | body 为完整 `WorkflowDetail`;Web 保存会带 `inputs:[{key:"$platformId",value:}]` | `{code:200,msg:"修改成功",data:WorkflowDetail}`;响应 `data` 不含 `inputs` | `src/domains/platform/api.ts:141`、`src/domains/platform/services.ts:68` | 见 `_tmp-captured` | +| P07 | PUT | `PIPER /api/easo/pipelines/{id}/chooses` | 无 body | `{code,msg,data:[{key,label,displayName,choose}]}`;`choose` 为递归选择器树 | `src/domains/platform/api.ts:155`、`services.ts:79` | 见 `_tmp-captured` | +| P08 | PUT | `PIPER /api/easo/pipelines/{id}/copy` | body 为 `WorkflowDetail`(复制后的详情) | `{code,msg,data:WorkflowDetail}` | `src/domains/platform/api.ts:163` | 否 | +| P09 | POST | `PIPER /api/easo/pipelines` | body 为工作流对象 | `{code,msg,data:WorkflowDetail}` | `src/domains/platform/api.ts:173` | 否 | +| P10 | DELETE | `PIPER /api/easo/pipelines/{id}` | 无 | 读取并丢弃响应文本;代码视为成功 | `src/domains/platform/api.ts:183` | 否 | +| P11 | GET | `PIPER /api/easo/pipelines/{id}/snapshots` | Query `{number,pageSize}` | `{code,msg,data:{number,size,totalPages,totalItems,items:[WorkflowSnapshot]}}` | `src/domains/platform/api.ts:194` | 否 | +| P12 | GET | `PIPER /api/easo/pipelines/snapshot/{snapshotId}` | 无 | `{code,msg,data:WorkflowSnapshot}`;`inputs`/`outputs` 为 JSON 字符串 | `src/domains/platform/api.ts:207` | 见 `_tmp-captured` | +| P13 | GET | `PIPER /api/easo/snapshots/{snapshotId}` | 无 | 同 P12;P12 失败后的 fallback | `src/domains/platform/api.ts:208` | 否 | +| P14 | GET | `PIPER /api/easo/pipelines/{pipelineId}/snapshots/{snapshotId}` | 无 | 同 P12;P12/P13 失败后的 fallback | `src/domains/platform/api.ts:209` | 否 | +| P15 | GET | `PIPER /api/easo/pipelines/{id}/log` | Query `{state,number,pageSize,startTime?,endTime?}` | `{code,msg,data:{number,size,totalPages,totalItems,items,jobList,executeCount,successCount,errorCount}}` | `src/domains/platform/api.ts:234` | 否 | +| P16 | PUT | `PIPER /api/easo/pipelines/state/{pipelineId}` | Query `{state:"0"|"1"}` | 2xx 即成功;响应体忽略 | `src/domains/platform/api.ts:253` | legacy | +| P17 | GET | `PIPER /api/easo/jobs/running` | Query `{pipelineId,runType:"DEBUG"|"PROD"}` | `{code,msg,data:WorkflowJob|WorkflowJob[]}` | `src/domains/platform/api.ts:266` | legacy | +| P18 | GET | `PIPER /api/easo/jobs/{jobId}` | 无 | `{code,msg,data:JobDetail}`;Job 字段见 `schemas/workflow-job-execution.schema.json` | `src/domains/platform/api.ts:285` | 见 `_tmp-captured`(CLI 聚合) | +| P19 | GET | `PIPER /api/easo/jobs/{jobId}/execution` | Query `{number,pageSize}` | `{code,msg,data:TaskExecution[]|ExecutionPage}` | `src/domains/platform/api.ts:294` | 见 `_tmp-captured`(CLI 聚合) | +| P20 | GET | `PIPER /api/easo/jobs/{jobId}/execution/level/failed` | 无 | `{code,msg,data:ExecutionPage|TaskExecution[]}` | `src/domains/platform/api.ts:311` | 见 `_tmp-captured`(CLI 聚合) | +| P21 | GET | `PIPER /api/easo/jobs/{jobId}/execution/level` | Query `{parentId,number,pageSize}` | `{code,msg,data:ExecutionPage}` | `src/domains/platform/api.ts:333` | 否 | +| P22 | GET | `PIPER /api/easo/executions/{executionId}/logs` | 无 | `{code,msg,data:ExecutionLog[]|{items:[ExecutionLog]}}` | `src/domains/platform/api.ts:347` | 否 | +| P23 | GET | `PIPER /api/easo/dsl/all` | 无 | `{data:NodeDef[]}` 或 `{data:{action:[],control:[],trigger:[]}}`;NodeDef 见下 | `src/domains/platform/api.ts:363`、`:381` | legacy | +| P24 | GET | `PIPER /api/easo/common/staffs` | Query `{external:"true"|"false"}` | `{code,msg,data:[{id,name,email?,department?}]}` | `src/domains/platform/api.ts:400` | legacy | +| P25 | GET | `PIPER /api/webhook/{pipelineId}` | 无 | `{code,msg,data:{id,pipelineId,url,active}}` | `src/domains/platform/api.ts:412` | legacy | +| P26 | POST | `PIPER /api/easo/pipelines/{id}/sampleData` | 无 body(`sampleWorkflowData`)或 `{type:"webhook"}`(`getWorkflowSampleData`) | 无 body 时:采样对象;带 type 时:`{records:[{id,corporationId?,pipelineId?,taskName?,actived?,dataJson,createTime,updateTime?}],total?,size?,current?}` | `src/domains/platform/api.ts:422`、`:472` | legacy | +| P27 | POST | `PIPER /api/easo/pipelines/{id}/debugSource` | `{number,pageSize,keywords?}` | `{code,msg,data:{type,total,items:[{id,title,flowState}],fields:[{key,label}],label}}` | `src/domains/platform/api.ts:433` | 否 | +| P28 | POST | `PIPER /api/easo/jobs` | `{pipelineId,inputs:{id,data?,$autoPublish},dataLimit}` | `{code,msg,data:|{id}|{jobId}}` | `src/domains/platform/api.ts:448` | 否 | +| P29 | POST | `PIPER /api/easo/dsl/condition/select/EKB_ENUM` | Query `{thirdId}`;body `{}` 或 `{$platformId}` | `{code,msg,data:[{label,code,name?}]}` | `src/domains/platform/api.ts:486` | 否 | +| P30 | POST | `GW /hose-workflow-node` | `{token,corpId,nodes:"a,b,c",baseUrl?}` | `{success,saved:[],skipped:[],msg?}` | `src/domains/platform/api.ts:511` | 否 | + +`Platform` 代码字段(`src/domains/platform/types.ts:5`): + +```text +id, name, nameSpell, enName?, code, corporationId, active, type, groupType, +platformType, source, adminIds, desc?, importMethod, createTime, updateTime +``` + +`Workflow` 列表项(`types.ts:231`): + +```text +id, pipelineName, state, runningCount, errorCount, updateTime, updateUser?, +tasks[], desc?, customDesc? +``` + +`NodeDef`(`types.ts:467`): + +```text +id?, name, type, groupName?, icon?, iconColor?, remark?, platform?, version?, $json? +``` + +## 3. bill / specifications(5) + +| # | Method | Path | 请求 | 响应 | 来源 | 抓包 | +|---|---|---|---|---|---|---| +| B01 | GET | `EKB /api/form/v2/specifications/[{specificationId}]` | Query `{corpId,_t}`;Headers `cache-control:no-cache`、`pragma:no-cache`;ID 会剥离末尾 `:` | `{items:[Spec]}` 或 `{value:Spec}` 或裸 `Spec`,代码取第一个/第一个值;Spec 见 `schemas/form-specification.schema.json` | `src/domains/bill/api.ts:609` | 见 `_tmp-captured`(响应载荷) | +| B02 | GET | `EKB /api/form/v2/specificationGroups/withSpecificationVersioned` | Query `{corpId,_t}`;Headers no-cache | `{items:[{name,active?,specifications:[{id,originalId?,name,type?,active?}]}]}` 或 `{value:{items:[...]}}` | `src/domains/bill/templates.ts:105` | 见 `_tmp-captured`(请求清单) | +| B03 | GET | `EKB /api/form/v2/specifications/feeType/[{id}]` | Query `{id,corpId}` | `{items:[FeeTypeSpecificationItem]}`;代码取 `items[0]` | `src/domains/feetype/api.ts:112` | 否 | +| B04 | GET | `EKB /api/form/v2/specifications/default/$feeType_expense` | Query `{type:"feeType_expense",corpId}` | `{components:[FeeTypeComponent]}` | `src/domains/feetype/api.ts:141` | 否 | +| B05 | GET | `EKB /api/form/v2/specifications/default/$feeType_requisition` | Query `{type:"feeType_requisition",corpId}` | `{components:[FeeTypeComponent]}` | `src/domains/feetype/api.ts:161` | 否 | + +### 模板组件字段 + +组件使用 `field` 作为 key(`src/domains/bill/types.ts:42`): + +```json +{ + "field": "u_单据编号", + "label": "关联发票核销单号", + "type": "text", + "optional": true, + "maxLength": 140 +} +``` + +`FormSpecificationComponentSchema` 还包含: + +```text +id?, name?, field?, label, type, optional, editable, hidden, isLinkageAssignment, +assignmentRule?, priorityList?/priority?, entityId?/referenceData?, dimensionId? +``` + +## 4. assist-platform(12) + +客户端前缀:`https://unity.ekuaibao.com/api`;Headers `token`、`content-type: application/json;charset=UTF-8`、可选 Cookie `hose-access-token`。 +下表 Path 保留代码字面量。部分 path 以 `api/` 开头,ky 会与前缀直接拼接,实际 URL 以运行时为准。 + +| # | Method | Path | 请求 | 响应 | 来源 | 抓包 | +|---|---|---|---|---|---|---| +| S01 | POST | `ASSIST corporation/search` | `{limit:{start,count},filterBy?}`;filterBy 形如 `(id == "x" \|\| name.containsIgnoreCase("x"))` | `{count,items:[AssistPlatformCorporation]}` | `src/domains/assist-platform/api.ts:54` | 否 | +| S02 | GET | `ASSIST corporation/${corpId}/getCorporationDetail` | 无 | `{items:[CorporationDetail]}` | `src/domains/assist-platform/api.ts:84` | 否 | +| S03 | POST | `ASSIST assistPlatform/${corpId}/search` | `{query:{}}` | `{items:[Ticket]}` | `src/domains/assist-platform/api.ts:115` | 否 | +| S04 | POST | `ASSIST assistPlatform/getStaff` | `{corporationId,name}` | `{total?,items:[Staff]}` | `src/domains/assist-platform/api.ts:172` | 否 | +| S05 | POST | `ASSIST assistPlatform/getToken` | `{ticketId,corporationId,isAdmin,staffId?}` | `{value:{token,loginUrl,baseUrl?}}` | `src/domains/assist-platform/api.ts:233` | 否 | +| S06 | POST | `ASSIST assistPlatform/create` | `{corporationId,applyMessage,assistTime}` | `{value:{id,corporationId,applyMessage,assistTime,userName?,responsibleUserName?,status}}` | `src/domains/assist-platform/api.ts:293` | 否 | +| S07 | PUT | `ASSIST api/assistPlatform/${ticketId}/updateStatus` | Query `{corpId}`;body `{id,status}` | `{value:{id,corporationId,status,active,startTime,endTime,applyMessage,userName?,responsibleUserName?}}` | `src/domains/assist-platform/api.ts:359` | 否 | +| S08 | POST | `ASSIST assistPlatform/transfer` | `{assistId,recipient,remarks}` | `{errorCode?,errorMessage?,value?}` | `src/domains/assist-platform/api.ts:567` | 否 | +| S09 | POST | `ASSIST userRole/search` | `{filterBy:"(active==true)",orderBy:[{value:"createTime",order:"DESC"}],limit:{start:0,count:1000},select:"userId(id, name,code),roleIds(id, name),`...`",permissions:[...]}` | `{items:[{id,userId:{id,name,code?},roleIds:[{id,name}]}]}` | `src/domains/assist-platform/api.ts:507` | 否 | +| S10 | GET | `ASSIST api/v1/organization/staffs/me` | Query `{corpId}` | `{value:{staff:{...},permissions:[string]}}` | `src/domains/assist-platform/api.ts:411` | 否 | +| S11 | GET | `ASSIST api/v1/organization/staffs/${staffId}/roles` | Query `{corpId}` | `{items:[{roleDefId?,roleDefName?,roleDefCode?}]}` | `src/domains/assist-platform/api.ts:440` | 否 | +| S12 | GET | `ASSIST api/v1/organization/departments/${deptId}` | Query `{corpId}` | `{value:{name}}` | `src/domains/assist-platform/api.ts:479` | 否 | + +工单字段兼容:代码同时读 `id/ticketId/authCode`、`applicant/applyUserName/userName`、`principal/operationUserName/responsibleUserName`、`state/status`、`matter/applyMessage`、`duration/hours/assistTime`(`src/domains/assist-platform/api.ts:120`)。 + +## 5. legacy 参考(8,不计入 66) + +以下只存在于 `specs/openapi.raw.json`,当前 `src/` 未调用;字段可能过时,仅供对照。 + +| # | Method | Path | 请求 | 响应 | +|---|---|---|---|---| +| L01 | POST | `EKB /api/common/security/getPublicKey` | 无 | `{value:{publicKey,modulus,exponent}}` | +| L02 | POST | `EKB /api/common/login/verifyPhone` | `{phone,password,countryCode?}` | `{value:{accessToken,user:{id,name,phone}}}` | +| L03 | GET | `EKB /api/common/user/corporations` | 无 | `{items:[CorporationItem]}` | +| L04 | POST | `EKB /api/common/user/corporations/{corpId}/switch` | 路径 `corpId` | `{value:{activeCorpId,staffId}}` | +| L05 | POST | `EKB /api/open/oauth2/auth` | 无 | `{code}` | +| L06 | POST | `EKB /api/open/oauth2/token` | `{code,appKey,appSecret,grant_type}` | `{access_token,refresh_token,expires_in}` | +| L07 | GET | `EKB /api/open/oauth2/user_info` | 无 | `{openId,corpId,name}` | +| L08 | POST | `EKB /api/open/oauth2/token/refresh` | `{refresh_token,grant_type}` | `{access_token,refresh_token,expires_in}` | + +## 6. 代码未覆盖、仅在抓包中出现的接口 + +这些不在 66 个正式代码接口内,原始格式由主智能体放在 `_tmp-captured/`: + +| Method | Path | 说明 | +|---|---|---| +| PUT | `EKB /api/form/v2/specifications/{specificationId}/$false` | 付款单模板保存;组件用 `field=u_单据编号`、`label=关联发票核销单号` | +| POST | `EKB /api/form/v2/specifications/search/all` | 模板搜索 | +| GET | `EKB /api/form/v2/specificationGroups` | 模板分组列表 | +| GET | `EKB /api/form/v2/requisition/expenseLink/{id}` | 关联单据/发票入口 | +| POST | `EKB /api/v1/requisition/autoAssociate/config/list` | 单据自动关联配置 | + +## 7. 未抓包 / 缺失 + +- 66 个代码接口中,只有 P06、P07、P12、P18、P19、P20 和 B01/B02 有本次抓包参考;其余为 code-derived。 +- 新建工作流 `POST /pipelines`、复制 `PUT /copy`、删除 `DELETE`、启停 `PUT /state`、`debugSource`、`sampleData`、`POST /jobs`、`EKL_ENUM` 均无原始抓包。 +- `GET /pipelines/{id}`、`/pipelines/logs`、`/snapshots`、`/log`、`/dsl/all` 等只在 `specs/openapi.raw.json` 有历史抓包,未做 1:1 复核。 +- assist-platform 12 个接口全部无抓包。 +- auth 19 个代码接口全部无抓包;legacy 8 个只有历史参考。 diff --git a/specs/hose-close-api/schemas/form-specification.schema.json b/specs/hose-close-api/schemas/form-specification.schema.json new file mode 100644 index 0000000..afb7020 --- /dev/null +++ b/specs/hose-close-api/schemas/form-specification.schema.json @@ -0,0 +1,136 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://hose-use.local/specs/hose-close-api/schemas/form-specification.schema.json", + "title": "Form specification", + "description": "单据模板(specification)对象。以 src/domains/bill/types.ts 的 FormSpecificationSchema 为主,结合 _tmp-captured 中的响应载荷校准。字段 key 统一使用 field。", + "x-source": [ + "code-derived: src/domains/bill/types.ts:42", + "reference: _tmp-captured/raw/GET-api-form-v2-specifications-id-payment.json", + "reference: _tmp-captured/raw/GET-api-form-v2-specifications-id-invoice.json" + ], + "type": "object", + "required": ["id", "name", "type", "components"], + "properties": { + "id": { "type": "string" }, + "name": { "type": "string", "description": "模板名称,例如 付款单 / 发票核销单。" }, + "enName": { "type": "string" }, + "type": { "type": "string", "description": "单据类型,例如 expense、requisition。", "examples": ["expense", "requisition"] }, + "active": { "type": "boolean" }, + "systemPreset": { "type": "boolean" }, + "specificationGroupId": { "type": "string" }, + "appId": { "type": "string" }, + "color": { "type": "string" }, + "icon": { "type": "string" }, + "visibility": { "$ref": "#/$defs/Visibility" }, + "state": { "type": "string", "description": "抓包观察值:PUBLISHED。" }, + "configs": { + "type": "array", + "description": "按 ability 区分的模板能力配置。", + "items": { + "type": "object", + "required": ["ability"], + "properties": { "ability": { "type": "string" } }, + "additionalProperties": true + } + }, + "components": { + "type": "array", + "description": "模板字段组件列表。field 是字段 key,不是 key/name。", + "items": { "$ref": "#/$defs/Component" } + }, + "rules": { "type": "array", "items": { "type": "object" } }, + "pri": { "type": "number" }, + "mustUpdateTemplate": { "type": "boolean" }, + "description": { "type": "string" }, + "budgetPermitAllowEdit": { "type": "boolean" }, + "forbidSubmit": { "type": "boolean" }, + "usageMode": { "type": "string" }, + "pipeline": { "type": "number" }, + "grayver": { "type": "string" }, + "dbVersion": { "type": "number" }, + "threadId": { "type": "string" }, + "version": { "type": "number" }, + "createTime": { "type": "number", "description": "毫秒时间戳。" }, + "updateTime": { "type": "number", "description": "毫秒时间戳。" }, + "nameSpell": { "type": "string" }, + "code": { "type": "string" }, + "corporationId": { "type": "string" }, + "sourceCorporationId": { "type": ["string", "null"] }, + "dataCorporationId": { "type": ["string", "null"] }, + "editorId": { "type": "string" }, + "flowPlanConfigId": { "type": ["string", "null"] }, + "warnings": { "type": "array", "items": { "type": "string" } } + }, + "additionalProperties": true, + "$defs": { + "Component": { + "type": "object", + "description": "模板字段组件。示例:{\"field\":\"u_单据编号\",\"label\":\"关联发票核销单号\",\"type\":\"text\",\"optional\":true,\"maxLength\":140}。separator 类型没有 field。", + "required": ["type"], + "properties": { + "field": { "type": "string", "description": "字段 key,例如 u_单据编号、u_所属供应商、title、details。不是 key,也不是 name。" }, + "label": { "type": "string" }, + "cnLabel": { "type": "string" }, + "enLabel": { "type": ["string", "null"] }, + "type": { + "type": "string", + "description": "组件类型。观察值:text、textarea、select、date、money、dataLink、payeeInfo、details、requisitionDetails、separator。", + "examples": ["text", "textarea", "select", "date", "money", "dataLink", "payeeInfo", "details", "requisitionDetails", "separator"] + }, + "optional": { "type": "boolean" }, + "editable": { "type": "boolean" }, + "readonly": { "type": "boolean" }, + "hidden": { "type": "boolean" }, + "hide": { "type": "boolean" }, + "isLinkageAssignment": { "type": "boolean" }, + "assignmentRule": { "type": ["string", "null"] }, + "priority": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { "type": "string" }, + "value": { "type": "number" } + }, + "additionalProperties": true + } + }, + "defaultValue": { "type": "object", "additionalProperties": true }, + "placeholder": { "type": "string" }, + "cnPlaceholder": { "type": ["string", "null"] }, + "enPlaceholder": { "type": ["string", "null"] }, + "maxLength": { "type": "number" }, + "minLength": { "type": "number" }, + "showInDetails": { "type": "boolean" }, + "selectRange": { "type": "string" }, + "multiple": { "type": "boolean" }, + "dependence": { "type": ["object", "null"] }, + "onlyBelongDepartment": { "type": "boolean" }, + "allowExternalStaff": { "type": "boolean" }, + "inheritedFieldDependency": { "type": "boolean" }, + "hideVisibility": { "$ref": "#/$defs/Visibility" }, + "hideBlacklistVisibility": { "$ref": "#/$defs/Visibility" }, + "configs": { "type": "array", "items": { "type": "object" } }, + "referenceData": { "type": "string", "description": "dataLink 引用的业务对象实体 ID。" }, + "filterId": { "type": ["string", "null"] }, + "subTypeId": { "type": ["string", "null"] }, + "isMcFiled": { "type": "boolean" }, + "defaultField": { "type": "boolean" }, + "copyable": { "type": "boolean" }, + "exceedConfigs": { "type": ["object", "null"] } + }, + "additionalProperties": true + }, + "Visibility": { + "type": "object", + "properties": { + "fullVisible": { "type": "boolean" }, + "staffs": { "type": "array", "items": { "type": "string" } }, + "roles": { "type": "array", "items": { "type": "string" } }, + "departments": { "type": "array", "items": { "type": "string" } }, + "departmentsIncludeChildren": { "type": "boolean" } + }, + "additionalProperties": true + } + } +} diff --git a/specs/hose-close-api/schemas/workflow-chooses.schema.json b/specs/hose-close-api/schemas/workflow-chooses.schema.json new file mode 100644 index 0000000..181bc02 --- /dev/null +++ b/specs/hose-close-api/schemas/workflow-chooses.schema.json @@ -0,0 +1,49 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://hose-use.local/specs/hose-close-api/schemas/workflow-chooses.schema.json", + "title": "Workflow chooses response", + "description": "PUT /api/easo/pipelines/{id}/chooses 的响应 data。请求无 body;服务端按当前 pipeline 每个任务节点重新生成 choose 选择器树。", + "x-source": [ + "code-derived: src/domains/platform/api.ts:151", + "reference: _tmp-captured/raw/PUT-api-easo-pipelines-id-chooses.json" + ], + "type": "array", + "items": { + "type": "object", + "required": ["key", "label", "choose"], + "properties": { + "key": { "type": "string", "description": "任务节点 name。" }, + "label": { "type": "string", "description": "节点类型显示名。" }, + "displayName": { "type": ["string", "null"] }, + "choose": { "$ref": "#/$defs/ChooseNode" } + }, + "additionalProperties": true + }, + "$defs": { + "ChooseNode": { + "type": "object", + "description": "选择器节点。可以是空对象 {}。", + "properties": { + "tags": { "type": "array", "items": { "type": "string" } }, + "items": { "type": "array", "items": { "$ref": "#/$defs/ChooseItem" } }, + "rawType": { "type": "string" }, + "type": { "type": "string" } + }, + "additionalProperties": true + }, + "ChooseItem": { + "type": "object", + "required": ["label", "code"], + "properties": { + "label": { "type": "string" }, + "code": { "type": "string", "description": "字段路径/表达式,例如 $status、$this、0、E_xxx_name、yyyy-MM-dd。" }, + "rawType": { "type": "string" }, + "type": { "type": "string" }, + "thirdId": { "type": "string" }, + "extra": { "type": "string" }, + "subChoose": { "$ref": "#/$defs/ChooseNode" } + }, + "additionalProperties": true + } + } +} diff --git a/specs/hose-close-api/schemas/workflow-detail.schema.json b/specs/hose-close-api/schemas/workflow-detail.schema.json new file mode 100644 index 0000000..8b5cea4 --- /dev/null +++ b/specs/hose-close-api/schemas/workflow-detail.schema.json @@ -0,0 +1,104 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://hose-use.local/specs/hose-close-api/schemas/workflow-detail.schema.json", + "title": "Workflow detail (EASO/Piper pipeline)", + "description": "工作流详情。GET /api/easo/pipelines/{id} 与 PUT /api/easo/pipelines/{id} 使用。PUT 请求体带 inputs,抓包中的响应 data 不返回 inputs。", + "x-source": [ + "code-derived: src/domains/platform/types.ts:273 (WorkflowDetailSchema)", + "reference: _tmp-captured/raw/PUT-api-easo-pipelines-id.json" + ], + "type": "object", + "required": ["id", "tasks"], + "properties": { + "id": { "type": "string" }, + "label": { "type": "string", "description": "工作流名称。" }, + "desc": { "type": ["string", "null"] }, + "customDesc": { "type": ["string", "null"] }, + "state": { "type": "number", "description": "0 停用,1 启用。" }, + "debugState": { "type": "number" }, + "runTimes": { "type": "number" }, + "errorTimes": { "type": "number" }, + "staffName": { "type": ["string", "null"] }, + "updateTime": { "type": "string" }, + "updateUser": { "type": ["string", "null"] }, + "dataLimit": { "type": "number" }, + "version": { "type": "string", "description": "产品版本号,例如 26.10.1。" }, + "source": { "type": "number" }, + "queueJobs": { "type": "boolean" }, + "tasksVersion": { "type": "number", "description": "任务版本号,保存节点时递增。" }, + "platformId": { "type": "string", "description": "copy 等场景可能出现。" }, + "tasks": { "type": "array", "items": { "$ref": "#/$defs/Task" } }, + "alarm": { + "oneOf": [ + { "$ref": "#/$defs/Alarm" }, + { "type": "string", "description": "Zod 兼容 JSON 字符串。" }, + { "type": "null" } + ] + }, + "inputs": { + "type": "array", + "description": "PUT 请求体中出现,例如 [{key:'$platformId',value:''}]。", + "items": { "$ref": "#/$defs/KeyValue" } + }, + "$snapshot": { + "type": "array", + "description": "文本/表达式内嵌选择器快照补丁,value 是 JSON 字符串。", + "items": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { "type": "string" }, + "value": { "type": "string" } + }, + "additionalProperties": true + } + } + }, + "additionalProperties": true, + "$defs": { + "KeyValue": { + "type": "object", + "required": ["key"], + "properties": { + "key": { "type": "string" }, + "value": {} + }, + "additionalProperties": true + }, + "Alarm": { + "type": "object", + "properties": { + "alarmUser": { "type": "array", "items": {} }, + "alarmType": { "type": "array", "items": { "type": "string" } }, + "active": { "type": "boolean" }, + "alarmScope": { "type": "string" } + }, + "additionalProperties": true + }, + "Task": { + "type": "object", + "description": "递归任务节点。未列出的类型专属字段按 additionalProperties 保留。", + "required": ["name", "type", "label", "groupName", "orderIndex", "levelIndex", "status"], + "properties": { + "name": { "type": "string", "description": "节点唯一名,例如 trigger_1、action_rv232l。" }, + "type": { + "type": "string", + "description": "节点类型。代码覆盖:clock、condition、every、stop、http、flow-detail、code、code-js2、ekuaibao-datalink-filter、ekuaibao-datalink-create、data-convert、flow-create-task、task-dynamic-delay、webhook 等。" + }, + "label": { "type": "string" }, + "displayName": { "type": "string" }, + "desc": { "type": ["string", "null"] }, + "groupName": { "type": "string", "description": "trigger / action / control。" }, + "orderIndex": { "type": "number" }, + "levelIndex": { "type": "array", "items": { "type": "number" } }, + "status": { "type": "string" }, + "tasks": { + "type": "array", + "description": "condition/every 等控制节点的子节点。", + "items": { "$ref": "#/$defs/Task" } + } + }, + "additionalProperties": true + } + } +} diff --git a/specs/hose-close-api/schemas/workflow-job-execution.schema.json b/specs/hose-close-api/schemas/workflow-job-execution.schema.json new file mode 100644 index 0000000..0c46ab0 --- /dev/null +++ b/specs/hose-close-api/schemas/workflow-job-execution.schema.json @@ -0,0 +1,116 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://hose-use.local/specs/hose-close-api/schemas/workflow-job-execution.schema.json", + "title": "Workflow job execution", + "description": "Piper 任务实例与节点执行数据。/execution 与 /execution/level/failed 的 data 可能是数组,也可能是分页对象 {number,size,totalPages,totalItems,items}。", + "x-source": [ + "code-derived: src/domains/platform/types.ts:360", + "reference: _tmp-captured/raw/GET-api-easo-jobs-id-execution.json", + "reference: _tmp-captured/raw/GET-api-easo-jobs-id-execution-completed.json" + ], + "type": "object", + "properties": { + "job": { "$ref": "#/$defs/Job" }, + "executionTree": { "type": "array", "items": { "$ref": "#/$defs/TaskExecution" } }, + "failedExecutions": { "type": "array", "items": { "$ref": "#/$defs/TaskExecution" } }, + "workflow": { "type": "object", "additionalProperties": true }, + "conditionDiagnoses": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, + "timeline": { "type": "array", "items": { "type": "object", "additionalProperties": true } } + }, + "additionalProperties": true, + "$defs": { + "Job": { + "type": "object", + "required": ["id", "pipelineId", "status"], + "properties": { + "id": { "type": "string" }, + "pipelineId": { "type": "string" }, + "label": { "type": "string" }, + "status": { "type": "string", "description": "例如 FAILED、COMPLETED。" }, + "runType": { "type": "string", "description": "DEBUG / PROD。" }, + "startTime": { "type": ["number", "string", "null"] }, + "endTime": { "type": ["number", "string", "null"] }, + "createTime": { "type": ["number", "string", "null"] }, + "inputs": { "type": "object", "additionalProperties": true }, + "outputs": { "type": "object", "additionalProperties": true }, + "corporationId": { "type": "string" }, + "currentTask": { "type": "number" }, + "priority": { "type": "number" }, + "webhooks": { "type": "array", "items": {} }, + "parentTaskExecutionId": { "type": ["string", "null"] }, + "isQueuedJob": { "type": "boolean" }, + "initialQueuedJobsAhead": { "type": "number" } + }, + "additionalProperties": true + }, + "TaskExecution": { + "type": "object", + "description": "单个节点的一次执行。不同节点类型会带各自配置字段,未列出字段按 additionalProperties 保留。", + "required": ["id", "jobId", "pipelineId", "name", "type", "status"], + "properties": { + "id": { "type": "string" }, + "parentId": { "type": ["string", "null"] }, + "jobId": { "type": "string" }, + "pipelineId": { "type": "string" }, + "name": { "type": "string" }, + "displayName": { "type": ["string", "null"] }, + "label": { "type": ["string", "null"] }, + "type": { "type": "string" }, + "orderIndex": { "type": "number" }, + "levelIndex": { "type": "array", "items": { "type": "number" } }, + "status": { "type": "string" }, + "executionTime": { "type": "number" }, + "startTime": { "type": ["number", "string", "null"] }, + "endTime": { "type": ["number", "string", "null"] }, + "createTime": { "type": ["number", "string", "null"] }, + "currentLoopPath": { "type": ["string", "null"] }, + "output": { "type": ["object", "array", "string", "number", "boolean", "null"] }, + "error": { "$ref": "#/$defs/ExecutionError" }, + "form": { "type": ["object", "array", "null"] }, + "details": { "type": ["object", "null"] }, + "executionLogs": { "type": "array", "items": {} } + }, + "additionalProperties": true + }, + "ExecutionError": { + "type": "object", + "required": ["message", "stackTrace"], + "properties": { + "message": { "type": "string" }, + "stackTrace": { "type": "array", "items": { "type": "string" } } + }, + "additionalProperties": true + }, + "ExecutionPage": { + "type": "object", + "required": ["items"], + "properties": { + "number": { "type": "number" }, + "size": { "type": "number" }, + "totalPages": { "type": "number" }, + "totalItems": { "type": "number" }, + "items": { + "type": "array", + "items": { + "oneOf": [ + { "$ref": "#/$defs/TaskExecution" }, + { "type": "array", "items": { "$ref": "#/$defs/TaskExecution" } } + ] + } + } + }, + "additionalProperties": true + }, + "ExecutionLog": { + "type": "object", + "required": ["message"], + "properties": { + "id": { "type": ["string", "number"] }, + "level": { "type": "string" }, + "message": { "type": "string" }, + "createAt": { "type": ["string", "number"] } + }, + "additionalProperties": true + } + } +} diff --git a/specs/hose-close-api/schemas/workflow-snapshot.schema.json b/specs/hose-close-api/schemas/workflow-snapshot.schema.json new file mode 100644 index 0000000..0301817 --- /dev/null +++ b/specs/hose-close-api/schemas/workflow-snapshot.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://hose-use.local/specs/hose-close-api/schemas/workflow-snapshot.schema.json", + "title": "Workflow snapshot", + "description": "工作流快照。前端使用 GET /api/easo/pipelines/snapshot/{snapshotId};代码还兼容 /api/easo/snapshots/{id} 与 /api/easo/pipelines/{pipelineId}/snapshots/{id}。", + "x-source": [ + "code-derived: src/domains/platform/types.ts:307 (WorkflowSnapshotSchema)", + "reference: _tmp-captured/raw/GET-api-easo-pipelines-snapshot-id.json" + ], + "type": "object", + "required": ["id", "pipelineId"], + "properties": { + "id": { "type": "string" }, + "pipelineId": { "type": "string" }, + "corporationId": { "type": "string" }, + "platformId": { "type": "string" }, + "triggerKey": { "type": "string", "description": "触发类型,例如 clock。" }, + "label": { "type": "string" }, + "tasks": { + "type": ["array", "null"], + "description": "快照时刻的任务节点树,结构同 WorkflowDetail.tasks。", + "items": { "type": "object", "additionalProperties": true } + }, + "inputs": { + "oneOf": [ + { "type": "string", "description": "JSON 编码字符串。" }, + { "type": "array", "items": {} } + ] + }, + "outputs": { + "oneOf": [ + { "type": "string", "description": "JSON 编码字符串。" }, + { "type": "array", "items": {} } + ] + }, + "retry": { "type": "number" }, + "state": { "type": "number" }, + "debugState": { "type": "number" }, + "staffId": { "type": ["string", "null"] }, + "staffName": { "type": ["string", "null"] }, + "createTime": { "type": "string" }, + "updateTime": { "type": "string" }, + "version": { "type": "string" } + }, + "additionalProperties": true +}