refactor: 将应用数据与工作流统一归入应用平台子模块
建立 applications 的应用模型和查询出口,保留基础及详情投影差异。 下沉 DataLink,将工作流模型、API、编排及执行上下文归回 workflow。 同步 CLI、SDK、生成脚本、测试和活跃文档引用,公开命令与 SDK 名称保持兼容。 验证:943 项测试、类型和版本检查通过;三份生成规范字节一致,README 审计通过。
This commit is contained in:
1 parent
edf300b808
commit
4e03c9bcd7
107 files changed
+423
-496
No files matched your search
@@ -39,7 +39,7 @@ CLI (src/cli.ts) / AI PRO (src/aipro-cli.ts) / MCP (src/server.ts) / HTTP (src/h
|
||||
- `server.ts` 只做单工具 MCP 协议适配(`hose_cli` 委托 `src/cli/runner.ts`)
|
||||
- `src/cli/registry.ts` 作为顶层命令、别名与常驻属性的唯一声明式注册表
|
||||
- 业务编排统一放在 `domains/*/tools.ts` 或 `domains/*/services.ts`
|
||||
- `domains/*/api.ts` 只负责 HTTP 请求和响应校验,严禁被入口层直接导入
|
||||
- `domains/**/api.ts` 只负责 HTTP 请求和响应校验,严禁被入口层直接导入
|
||||
- `core/` 严格保持基础设施窄白名单(`auth/`, `cache/`, `config/`, `db/`, `errors.ts`, `http/`),构建产物与 Skill 分发统一置于 `src/packaging/`
|
||||
- 所有本地 SQLite 持久化(审批引擎、多级缓存、事件轮询去重、工作流错误指纹)统一收敛至 `core/db/` 并通过版本迁移管理
|
||||
|
||||
@@ -65,7 +65,7 @@ CLI (src/cli.ts) / AI PRO (src/aipro-cli.ts) / MCP (src/server.ts) / HTTP (src/h
|
||||
|
||||
同步更新顺序:
|
||||
|
||||
1. `domains/*/api.ts` — 传输层
|
||||
1. `domains/**/api.ts` — 传输层
|
||||
2. `domains/*/tools.ts` / `services.ts` — 业务编排层
|
||||
3. `cli/commands/*` & `cli/registry.ts` — CLI 命令层
|
||||
4. 对应目录下的 `README*.md`
|
||||
@@ -77,14 +77,14 @@ CLI (src/cli.ts) / AI PRO (src/aipro-cli.ts) / MCP (src/server.ts) / HTTP (src/h
|
||||
|
||||
| 禁止方向 | 说明 |
|
||||
|---|---|
|
||||
| `(cli/** \| http/** \| server.ts \| cli.ts \| aipro-cli.ts) -> domains/*/api.ts` | 任何入口层不得绕过 `tools.ts`/`services.ts` 直接调用 API 传输层 |
|
||||
| `(cli/** \| http/** \| server.ts \| cli.ts \| aipro-cli.ts) -> domains/**/api.ts` | 任何入口层不得绕过 `tools.ts`/`services.ts` 直接调用 API 传输层 |
|
||||
| `domains/** -> (cli/** \| http/** \| server.ts \| cli.ts \| aipro-cli.ts)` | 域层必须保持纯 SDK 零 UI/入口绑定 |
|
||||
| `core/** -> (domains/** \| cli/** \| http/** \| server.ts \| cli.ts \| aipro-cli.ts)` | Core 基础设施层严禁向上反向依赖业务域或入口层 |
|
||||
|
||||
正确路径:
|
||||
|
||||
- `entrypoints -> cli/registry.ts -> cli/commands/* -> domains/*/(tools|services).ts -> domains/*/api.ts -> core/http/*`
|
||||
- `domains/*/(tools|services).ts -> core/{auth,cache,config,db,errors,http}`
|
||||
- `entrypoints -> cli/registry.ts -> cli/commands/* -> domains/**/(tools|services).ts -> domains/**/api.ts -> core/http/*`
|
||||
- `domains/**/(tools|services).ts -> core/{auth,cache,config,db,errors,http}`
|
||||
|
||||
## 异常规则
|
||||
|
||||
|
||||
@@ -126,11 +126,11 @@ hose-use mcp # 启动 MCP Server (默认暴露
|
||||
| `src/` | CLI、SDK、MCP、HTTP 与基础设施源码,分层见下方架构及各层 README。 |
|
||||
| `scripts/` | 按构建、发布、规范生成、开发维护和仓库检查分组,见 [脚本说明](./scripts/README.scripts.md);常用入口见 [package.json](./package.json) 的 `scripts`。 |
|
||||
| `skills/hose-use/` | 随产品分发的 [操作技能源码](./skills/hose-use/SKILL.md),由 `src/packaging/` 内嵌并安装到 `~/.agents/skills/hose-use`。 |
|
||||
| `.agents/` | 本仓库的开发规则与技能发现配置,见 [.agents/README.md](./.agents/README.md);与产品分发用的 `skills/` 职责不同。 |
|
||||
| `.agents/` | 本仓库的开发规则与技能发现配置,见 [.agents/README.md](.agents/README.md);与产品分发用的 `skills/` 职责不同。 |
|
||||
| `.github/` | CI 与 Release 工作流,负责校验、构建和发布。 |
|
||||
| `.zcode-plugin/` | 受版本管理的 [IDE 插件清单](./.zcode-plugin/plugin.json),声明 Skill 路径、MCP 配置与用户开关。 |
|
||||
| `.zcode-plugin/` | 受版本管理的 [IDE 插件清单](.zcode-plugin/plugin.json),声明 Skill 路径、MCP 配置与用户开关。 |
|
||||
| `specs/` | specifications(规范)的缩写,存放 API 与工作流规范:`hose-open-api/` 是 hose-use 包装层对外 API 的 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)。 |
|
||||
| `dist/`(本地) | 全部是已忽略的构建输出:`mcp/server.js` 是 [.mcp.json](.mcp.json) 引用的插件 bundle,`bin/` 保存独立二进制与发布归档。可重新构建,不随 Git 分发;删除后再次加载源码插件前须先构建。详见 [构建与分发说明](./src/packaging/README.packaging.md)。 |
|
||||
| `docs/` | 跨模块参考与审阅记录;Platform 模块说明和各域 README 提供当前 CLI 与服务导航,架构总纲见 [AGENTS.md](./AGENTS.md);`reviews/` 保留历史审阅及验证证据。 |
|
||||
| `enterprises/` | 仅跟踪配置示例与 [目录说明](./enterprises/README.md)。实际企业配置默认放在 `~/.config/hose-use/enterprises/`,仓库内其他企业 JSON 被忽略。 |
|
||||
| `.git/` 或 `.git` 文件 | Git 元数据;独立工作树中通常是指向共享仓库的文件。 |
|
||||
@@ -141,15 +141,15 @@ hose-use mcp # 启动 MCP Server (默认暴露
|
||||
根目录文件的职责:
|
||||
|
||||
- [AGENTS.md](./AGENTS.md) 是项目开发规则总入口;`CLAUDE.md → AGENTS.md` 是兼容软链接,共享同一份内容。
|
||||
- [package.json](./package.json)、`bun.lock` 与 [tsconfig.json](./tsconfig.json) 分别管理项目入口和命令、锁定依赖、配置 TypeScript;[.env.example](./.env.example) 是环境变量示例。
|
||||
- [.mcp.json](./.mcp.json) 声明插件 MCP 启动方式,与 `.zcode-plugin/plugin.json` 配套;[.gitignore](./.gitignore) 声明本地数据与产物的忽略边界。
|
||||
- [package.json](./package.json)、`bun.lock` 与 [tsconfig.json](./tsconfig.json) 分别管理项目入口和命令、锁定依赖、配置 TypeScript;[.env.example](.env.example) 是环境变量示例。
|
||||
- [.mcp.json](.mcp.json) 声明插件 MCP 启动方式,与 `.zcode-plugin/plugin.json` 配套;[.gitignore](.gitignore) 声明本地数据与产物的忽略边界。
|
||||
- `ROADMAP.local.md` 等 `*.local.md` 是已忽略的本地笔记,不是构建依赖或正式文档入口;`.DS_Store` 是已忽略的 macOS Finder 元数据,可清理。
|
||||
|
||||
规范生成关系与命令:
|
||||
|
||||
- `specs/hose-open-api/**/*.yaml` → `specs/openapi.json`:`bun run openapi:bundle`。
|
||||
- `scripts/generate/generate-raw-openapi.ts` → `specs/openapi.raw.json`:`bun run openapi:generate-raw`;与包装层规范描述不同接口,不是备份副本。
|
||||
- `src/domains/platform/types.ts` → `specs/workflow-schema.json`:`bun run export:workflow-schema`。
|
||||
- `src/domains/platform/workflow/types.ts` → `specs/workflow-schema.json`:`bun run export:workflow-schema`。
|
||||
|
||||
两份 OpenAPI JSON 都由 [内嵌分发层](./src/packaging/README.packaging.md) 直接导入并随 Git 提交;修改规范应更新对应源文件并重新生成,避免只改生成结果。
|
||||
|
||||
|
||||
@@ -2,20 +2,13 @@
|
||||
|
||||
## 整体架构
|
||||
|
||||
Platform 与 DataLink 是共享 CLI、MCP、HTTP 和脚本集成的业务域。MCP 仅注册 `hose_cli`,入口统一经 `runCli` 分发;业务域不注册协议工具。代码位于:
|
||||
应用平台统一包含 applications、datalink 和 workflow 子模块,共享 CLI、MCP、HTTP 和脚本集成。MCP 仅注册 `hose_cli`,入口统一经 `runCli` 分发;业务域不注册协议工具。代码位于:
|
||||
|
||||
```text
|
||||
src/domains/platform/
|
||||
├── types.ts # Zod schema 与类型定义
|
||||
├── api.ts # HTTP 传输层(EKB / EASO / Piper 接口封装)
|
||||
├── services.ts # 业务编排与服务门面
|
||||
└── workflow/ # 节点、脚本、分析、草稿状态、监听与告警
|
||||
|
||||
src/domains/datalink/
|
||||
├── types.ts # 应用、业务对象、字段、记录与权限模型
|
||||
├── api.ts # DataLink HTTP 接口封装
|
||||
├── services.ts # 应用/对象解析与过滤辅助
|
||||
└── fields.ts # 读写共用的唯一字段解析
|
||||
├── applications/ # 应用元数据、基础/详情模型和目标解析
|
||||
├── datalink/ # 对象、字段、记录与台账审计
|
||||
└── workflow/ # 工作流模型、传输、编排与执行能力
|
||||
|
||||
src/cli/commands/ # 参数解析与展示,经域 services 调用业务
|
||||
src/server.ts # 单工具 hose_cli -> runCli
|
||||
@@ -66,11 +59,11 @@ MCP 调用方式统一为 `hose_cli` 的 `command` 参数传入下列命令。
|
||||
| `workflow check` | 扫描错误管道并持久化去重提醒 | EKB + Piper + 本地 |
|
||||
| `workflow toggle/publish` | 切换启停状态 | Piper |
|
||||
|
||||
统计、配额、DSL、员工与采样等底层能力由 `src/domains/platform/services.ts` 暴露,不存在同名的独立 MCP 工具。完整命令语义见 [Workflow 说明](../../src/domains/platform/workflow/README.workflow.md) 和 [DataLink 说明](../../src/domains/datalink/README.datalink.md)。
|
||||
统计、配额、DSL、员工与采样等底层能力由 `src/domains/platform/workflow/services.ts` 暴露,不存在同名的独立 MCP 工具。完整命令语义见 [Workflow 说明](../../src/domains/platform/workflow/README.workflow.md) 和 [DataLink 说明](../../src/domains/platform/datalink/README.datalink.md)。
|
||||
|
||||
## 服务层聚合能力
|
||||
|
||||
`src/domains/platform/services.ts` 提供聚合服务函数:
|
||||
`src/domains/platform/workflow/services.ts` 提供工作流服务出口,跨应用查询通过 applications 服务取得应用:
|
||||
|
||||
| 函数 | 说明 |
|
||||
|---|---|
|
||||
@@ -83,7 +76,7 @@ MCP 调用方式统一为 `hose_cli` 的 `command` 参数传入下列命令。
|
||||
|
||||
## 工作流 JSON Schema
|
||||
|
||||
`src/domains/platform/types.ts` 定义了递归、按节点类型区分的 Zod schema:
|
||||
`src/domains/platform/workflow/types.ts` 定义了递归、按节点类型区分的 Zod schema:
|
||||
|
||||
- `WorkflowTaskSchema`:按节点类型区分并递归建模,覆盖 `webhook`、`condition`、`every`、`stop`、`http`、`flow-detail`、`code`、`code-js2`、`ekuaibao-datalink-filter`、`ekuaibao-datalink-create`、`data-convert`、`flow-create-task` 以及兜底 `unknown`。
|
||||
- 控制节点(`condition` / `every`)支持递归嵌套 `tasks`。
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
| [2026-10-30 Schema 导出修复](./2026-10-30-workflow-schema-export-fix.md) | 告警字段导出视图与生成文件同步 |
|
||||
| [2026-10-30 README 校验器](./2026-10-30-readme-checker.md) | 权重规则、首次审计与文档缺口 |
|
||||
|
||||
[2026-10-25 证据目录](./2026-10-25-codex-review-evidence/) 保留当次日志,日志中的旧路径和历史错误不随目录迁移改写。
|
||||
[2026-10-25 证据目录](./2026-10-25-codex-review-evidence) 保留当次日志,日志中的旧路径和历史错误不随目录迁移改写。
|
||||
|
||||
## 新增记录约定
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
| 位置 | 职责与文件 |
|
||||
|---|---|
|
||||
| [build/](./build/) | 二进制、MCP bundle、插件归档构建,产物验证及插件冒烟测试 |
|
||||
| [release/](./release/) | 版本更新、一致性检查、发布 Tag 校验及发布流程测试 |
|
||||
| [generate/](./generate/) | 包装层 OpenAPI 打包、原生下游规范生成、工作流 Schema 导出 |
|
||||
| [dev/](./dev/) | 本地开发安装覆盖、环境检查与清理规划,及对应测试 |
|
||||
| [checks/](./checks/) | README 覆盖与命名校验、SDK README 示例编译测试 |
|
||||
| [build/](./build) | 二进制、MCP bundle、插件归档构建,产物验证及插件冒烟测试 |
|
||||
| [release/](./release) | 版本更新、一致性检查、发布 Tag 校验及发布流程测试 |
|
||||
| [generate/](./generate) | 包装层 OpenAPI 打包、原生下游规范生成、工作流 Schema 导出 |
|
||||
| [dev/](./dev) | 本地开发安装覆盖、环境检查与清理规划,及对应测试 |
|
||||
| [checks/](./checks) | README 覆盖与命名校验、SDK README 示例编译测试 |
|
||||
| [install.sh](./install.sh) | 公开安装入口,路径保持稳定;安装测试保留在同级 |
|
||||
|
||||
对应脚本的测试与脚本放在同一个目录,统一由 `bun test` 发现。生成文件写入 `specs/`,构建输出写入 Git 忽略的 `dist/`。
|
||||
|
||||
@@ -5,7 +5,7 @@ import ts from "typescript";
|
||||
|
||||
test("DataLink 公共 SDK 的 README 示例与实际导出一同编译", () => {
|
||||
const root = resolve(import.meta.dir, "../..");
|
||||
const readme = readFileSync(resolve(root, "src/domains/datalink/README.datalink.md"), "utf8");
|
||||
const readme = readFileSync(resolve(root, "src/domains/platform/datalink/README.datalink.md"), "utf8");
|
||||
const code = readme.split("## 公共 SDK")[1]?.match(/```typescript\n([\s\S]*?)\n```/)?.[1];
|
||||
expect(code).toBeDefined();
|
||||
const file = resolve(root, "src/__sdk-readme-example__.ts");
|
||||
|
||||
@@ -3,7 +3,7 @@ import { spawnSync } from "node:child_process";
|
||||
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { WorkflowDetailSchema } from "../../src/domains/platform/types.js";
|
||||
import { WorkflowDetailSchema } from "../../src/domains/platform/workflow/types.js";
|
||||
|
||||
test("工作流 Schema 导出可重现,保留归一化输出与有效递归引用", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "hose-workflow-schema-"));
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
WorkflowDetailSchema,
|
||||
WorkflowTaskSchema,
|
||||
WorkflowSchema,
|
||||
} from "../../src/domains/platform/types.js";
|
||||
} from "../../src/domains/platform/workflow/types.js";
|
||||
|
||||
const OUTPUT_DIR = join(process.cwd(), "specs");
|
||||
const OUTPUT_FILE = join(OUTPUT_DIR, "workflow-schema.json");
|
||||
|
||||
+54
-54
@@ -83,7 +83,7 @@ metadata:
|
||||
17. **循环筛选与付款明细映射**:
|
||||
- 原生 `every` 的筛选字段物理键与右值选择器是两种结构:左侧保留 `feeTypeId`,右侧固定费用类型需保留前端 `value()` 描述符的真实 `key` 和 `label`;裸 ID 运行成功不代表设计器正常显示;
|
||||
- 金额来源、费用类型与明细对应关系须按用户确认的业务规则和实际字段元数据确定;创单引用循环聚合结果,空明细不得继续创单或回写成功;
|
||||
- 回读用户手工保存的 JSON 时,同时检查 `batch` / `batchSize`;并行配置会改变执行方式,不得当作显示修复自动覆盖。完整结构、金额类型与空列表兼容方案见 [references/workflow.md §20](references/workflow.md#20-原生循环筛选选择器与费用明细)。
|
||||
- 回读用户手工保存的 JSON 时,同时检查 `batch` / `batchSize`;并行配置会改变执行方式,不得当作显示修复自动覆盖。完整结构、金额类型与空列表兼容方案见 [references/workflow.md §20](./references/workflow.md#20-原生循环筛选选择器与费用明细)。
|
||||
|
||||
---
|
||||
|
||||
@@ -91,59 +91,59 @@ metadata:
|
||||
|
||||
| 用户意图 / 场景 | 推荐命令 | 深入参考文档 |
|
||||
|---|---|---|
|
||||
| 全局运行上下文 / 身份诊断 / 免读源码自省 | `hose-use context [--json]`, `hose-use status` | [references/auth.md](references/auth.md) |
|
||||
| AI PRO 审批仲裁网关状态与当前连接企业 | `hose-aipro status [--json]`, `hose-use aipro status` | [references/approval.md](references/approval.md) |
|
||||
| AI PRO 规则场景库与审核要点清单 | `hose-aipro scopes`, `hose-aipro points <索引>` | [references/approval.md](references/approval.md) |
|
||||
| AI PRO 确定性审批仲裁全流程 (核验/仲裁) | `hose-aipro bind`, `hose-aipro review`, `hose-aipro decide` | [references/approval.md](references/approval.md) |
|
||||
| 本地 AI 审批规约与规则增删改查 | `hose-use rule scopes`, `hose-use rule add --dry-run/--yes`, `hose-use rule list` | [references/approval.md](references/approval.md) |
|
||||
| 首次登录 / 账密认证 / Token过期 / 多账号 | `hose-use auth login`, `hose-use auth status`, `hose-use auth refresh` | [references/auth.md](references/auth.md) |
|
||||
| 生成企业合思 Web 免密登录直达链接 (`thirdparty.html`) | `hose-use corps link [企业ID|名称]`, `hose-use auth hose-link` | [references/auth.md](references/auth.md) |
|
||||
| 第三方免密/协助链接一键导入(自动提取持久化密钥) | `hose-use corps add-link <url> --yes`, `hose-use corps elevate [企业ID] --yes` | [references/auth.md](references/auth.md) |
|
||||
| 合思协助平台(Unity 运营平台)扫码登录/租户全量库/工单/指定身份直通/权限转交 | `hose-use assist-platform login/search/detail/tickets/staff/apply/enter/transfer` | [references/assist-platform.md](references/assist-platform.md) |
|
||||
| OpenAPI 密钥持久化接入 / 从链接提取密钥 | `hose-use corps add-persistent`, `hose-use corps extract-keys <url>` | [references/auth.md](references/auth.md) |
|
||||
| 代客协助凭证导入 / 探针连通性诊断 | `hose-use auth import`, `hose-use probe` | [references/auth.md](references/auth.md) |
|
||||
| 企业租户切换 / 查看当前企业 | `hose-use corps list`, `hose-use corps switch <id>` | [references/auth.md](references/auth.md) |
|
||||
| 报销单据检索 / 费用明细下钻 / 中文字典 | `hose-use bill list [--since=7d] [--code=<单号>]`, `hose-use bill get <单号|ID> [--risk]` | [references/bill.md](references/bill.md) |
|
||||
| 单据审批动作(同意/驳回/转交/加签/评论) | `hose-use bill approve|reject|transfer|add-node|comment <单号|ID> --yes` | [references/bill.md](references/bill.md) |
|
||||
| 单据审批历史 / 当前节点 / 后续流程 | `hose-use bill flow <单号|ID>` | [references/bill.md](references/bill.md) |
|
||||
| 单据风控预警 / 预算状态 / 发票风险 | `hose-use bill risk <单号|ID>` | [references/bill.md](references/bill.md) |
|
||||
| 单据引用 ID 二级解析(人员/部门/费用类型) | `hose-use bill refs <单号|ID>` | [references/bill.md](references/bill.md) |
|
||||
| 单据关联关系 / 冲借款与前置申请追溯 | `hose-use bill relations <单号|ID>` | [references/bill.md](references/bill.md) |
|
||||
| 单据预算状态 / 超预算与占用信息 | `hose-use bill budget <单号|ID>` | [references/bill.md](references/bill.md) |
|
||||
| 单据附件 / 发票原件标准列表 | `hose-use bill attachments <单号|ID>` | [references/bill.md](references/bill.md) |
|
||||
| 单据附件下载 | `hose-use bill download <单号|ID> --output-dir <目录>` | [references/bill.md](references/bill.md) |
|
||||
| 系统/自定义档案维度与档案项 | `hose-use dimension list`, `hose-use dimension items <维度>` | [references/dimension.md](references/dimension.md) |
|
||||
| 费用类型全生命周期与表单规格 (增删查改/停启用/移动/字段) | `hose-use feetype list`, `hose-use feetype create`, `hose-use feetype get <ID>` | [references/feetype.md](references/feetype.md) |
|
||||
| 企业角色、角色组与角色成员 | `hose-use role list`, `hose-use role groups`, `hose-use role members <角色>` | [references/role.md](references/role.md) |
|
||||
| 角色权限只读快照 | `hose-use permission get` | [references/role.md](references/role.md) |
|
||||
| 单据 Web 详情直达链接生成 | `hose-use bill link <单号|ID>` | [references/bill.md](references/bill.md) |
|
||||
| 单据实体模型与字段元数据查询 / 单据模板联动规格 | `hose-use bill schema`, `hose-use bill spec <specificationId>` | [references/bill.md](references/bill.md) |
|
||||
| 草稿字段一致性校验(金额/币种/发票总额/明细草稿状态) | `hose-use bill validate <单号|ID>` | [references/bill.md](references/bill.md) |
|
||||
| 单据模板列表(默认仅启用,与页面快速新建同源) | `hose-use bill templates [--all] [--keyword=...]` | [references/bill.md](references/bill.md) |
|
||||
| 按模板创建单据草稿(不提交) | `hose-use bill create --template <模板ID> [--title] [--amount] [--reason] --yes` | [references/bill.md](references/bill.md) |
|
||||
| 提交单据送审 | `hose-use bill submit <单号|ID> [--approver=<员工>] --yes` | [references/bill.md](references/bill.md) |
|
||||
| 复制单据为新草稿(清空发票绑定,不提交) | `hose-use bill copy <单号|ID> [--title=...] [--drop-attachments] --yes` | [references/bill.md](references/bill.md) |
|
||||
| 删除草稿单据(仅 draft 状态) | `hose-use bill delete <单号|ID> --yes` | [references/bill.md](references/bill.md) |
|
||||
| 企业通讯录检索 / 员工档案 / 防爆保护 | `hose-use contact search`, `hose-use contact list`, `hose-use contact get` | [references/contact.md](references/contact.md) |
|
||||
| 待办中心 / 已审批 / 我发起的 / 审批记录 / 抄送 | `hose-use task todo`, `hose-use task submitted`, `hose-use task records`, `hose-use task cc` | [references/task.md](references/task.md) |
|
||||
| 应用管理 (桌面端工作台开通的用车/套件/制度/自建前台应用) | `hose-use app list [--keyword]`, `hose-use app get <应用>` | [references/workflow.md](references/workflow.md) |
|
||||
| 自建应用与数据模型 (开放平台业务对象/字段定义/全量记录/健康度体检) | `hose-use platform list`, `hose-use platform entities <应用>`, `hose-use platform records <应用> <对象> --all`, `hose-use platform audit <应用> <对象>` | [references/workflow.md](references/workflow.md) |
|
||||
| 自建应用单条/批量记录安全操作 (详情/停启用/安全合并编辑/批量补丁/台账重算) | `hose-use platform record <get|toggle|edit|batch-edit|recompute>` | [references/workflow.md](references/workflow.md) |
|
||||
| 跨自建应用工作流聚合检索与节点扫描 | `hose-use workflow list`, `hose-use workflow find --task=code-js2` | [references/workflow.md](references/workflow.md) |
|
||||
| 桌面端全站主导航与一级模块树 | `hose-use menu list`, `hose-use menu tree` | [references/workflow.md](references/workflow.md) |
|
||||
| 模糊搜索已保存的企业与员工信息 | `hose-use corps search <关键词>` | [references/auth.md](references/auth.md) |
|
||||
| 特定任务节点扫描 (如脚本/Webhook) | `hose-use workflow find --task=code-js2` | [references/workflow.md](references/workflow.md) |
|
||||
| 工作流详情、节点草稿修改、草稿保存、版本历史、运行日志、单次运行排障、发布与开通切换 | `hose-use workflow get`, `hose-use workflow job <jobId>`, `hose-use workflow patch`, `hose-use workflow save`, `hose-use workflow publish`, `hose-use workflow history`, `hose-use workflow logs`, `hose-use workflow toggle` | [references/workflow.md](references/workflow.md) |
|
||||
| 工作流节点树、代码依赖与静态门禁诊断(硬门禁/软建议/权限/DataLink公式) | `hose-use workflow analyze <pipelineId> [--fail]` | [references/workflow.md](references/workflow.md) |
|
||||
| 企业已开通工作流节点字典探针与灰度开通 | `hose-use workflow nodes [--all]`, `hose-use workflow nodes grant <type...>` | [references/workflow.md](references/workflow.md) |
|
||||
| 工作流错误管道扫描与本地去重提醒 | `hose-use workflow check [--fail-on-alert]` | [references/workflow.md](references/workflow.md) |
|
||||
| 企业 OpenAPI 接入密钥(默认脱敏) | `hose-use keys [--json]`, `hose-use openapi keys`, `hose-use store keys` | [references/store.md](references/store.md) |
|
||||
| 企业已购应用 / 应用商店探查 | `hose-use store list / search / get` | [references/store.md](references/store.md) |
|
||||
| 常驻守护进程管理 / 后台运行 | `hose-use service start`, `hose-use service status` | [references/service.md](references/service.md) |
|
||||
| 待办/消息事件轮询与去重 | `hose-use service poll --corp=<id>` | [references/service.md](references/service.md) |
|
||||
| 启动本地 HTTP 服务 / 打开可视化交互文档 | `hose-use http --port=8888` (访问 `/docs`) | [references/service.md](references/service.md) |
|
||||
| CLI 同进程执行网关 / REST 接口调用 | `POST /api/cli`, `GET /v1/corps` | [references/service.md](references/service.md) |
|
||||
| 导出标准 OpenAPI 3.1.0 JSON 规范 | `hose-use openapi`, `hose-use openapi --raw` | [references/service.md](references/service.md) |
|
||||
| 全局运行上下文 / 身份诊断 / 免读源码自省 | `hose-use context [--json]`, `hose-use status` | [references/auth.md](./references/auth.md) |
|
||||
| AI PRO 审批仲裁网关状态与当前连接企业 | `hose-aipro status [--json]`, `hose-use aipro status` | [references/approval.md](./references/approval.md) |
|
||||
| AI PRO 规则场景库与审核要点清单 | `hose-aipro scopes`, `hose-aipro points <索引>` | [references/approval.md](./references/approval.md) |
|
||||
| AI PRO 确定性审批仲裁全流程 (核验/仲裁) | `hose-aipro bind`, `hose-aipro review`, `hose-aipro decide` | [references/approval.md](./references/approval.md) |
|
||||
| 本地 AI 审批规约与规则增删改查 | `hose-use rule scopes`, `hose-use rule add --dry-run/--yes`, `hose-use rule list` | [references/approval.md](./references/approval.md) |
|
||||
| 首次登录 / 账密认证 / Token过期 / 多账号 | `hose-use auth login`, `hose-use auth status`, `hose-use auth refresh` | [references/auth.md](./references/auth.md) |
|
||||
| 生成企业合思 Web 免密登录直达链接 (`thirdparty.html`) | `hose-use corps link [企业ID|名称]`, `hose-use auth hose-link` | [references/auth.md](./references/auth.md) |
|
||||
| 第三方免密/协助链接一键导入(自动提取持久化密钥) | `hose-use corps add-link <url> --yes`, `hose-use corps elevate [企业ID] --yes` | [references/auth.md](./references/auth.md) |
|
||||
| 合思协助平台(Unity 运营平台)扫码登录/租户全量库/工单/指定身份直通/权限转交 | `hose-use assist-platform login/search/detail/tickets/staff/apply/enter/transfer` | [references/assist-platform.md](./references/assist-platform.md) |
|
||||
| OpenAPI 密钥持久化接入 / 从链接提取密钥 | `hose-use corps add-persistent`, `hose-use corps extract-keys <url>` | [references/auth.md](./references/auth.md) |
|
||||
| 代客协助凭证导入 / 探针连通性诊断 | `hose-use auth import`, `hose-use probe` | [references/auth.md](./references/auth.md) |
|
||||
| 企业租户切换 / 查看当前企业 | `hose-use corps list`, `hose-use corps switch <id>` | [references/auth.md](./references/auth.md) |
|
||||
| 报销单据检索 / 费用明细下钻 / 中文字典 | `hose-use bill list [--since=7d] [--code=<单号>]`, `hose-use bill get <单号|ID> [--risk]` | [references/bill.md](./references/bill.md) |
|
||||
| 单据审批动作(同意/驳回/转交/加签/评论) | `hose-use bill approve|reject|transfer|add-node|comment <单号|ID> --yes` | [references/bill.md](./references/bill.md) |
|
||||
| 单据审批历史 / 当前节点 / 后续流程 | `hose-use bill flow <单号|ID>` | [references/bill.md](./references/bill.md) |
|
||||
| 单据风控预警 / 预算状态 / 发票风险 | `hose-use bill risk <单号|ID>` | [references/bill.md](./references/bill.md) |
|
||||
| 单据引用 ID 二级解析(人员/部门/费用类型) | `hose-use bill refs <单号|ID>` | [references/bill.md](./references/bill.md) |
|
||||
| 单据关联关系 / 冲借款与前置申请追溯 | `hose-use bill relations <单号|ID>` | [references/bill.md](./references/bill.md) |
|
||||
| 单据预算状态 / 超预算与占用信息 | `hose-use bill budget <单号|ID>` | [references/bill.md](./references/bill.md) |
|
||||
| 单据附件 / 发票原件标准列表 | `hose-use bill attachments <单号|ID>` | [references/bill.md](./references/bill.md) |
|
||||
| 单据附件下载 | `hose-use bill download <单号|ID> --output-dir <目录>` | [references/bill.md](./references/bill.md) |
|
||||
| 系统/自定义档案维度与档案项 | `hose-use dimension list`, `hose-use dimension items <维度>` | [references/dimension.md](./references/dimension.md) |
|
||||
| 费用类型全生命周期与表单规格 (增删查改/停启用/移动/字段) | `hose-use feetype list`, `hose-use feetype create`, `hose-use feetype get <ID>` | [references/feetype.md](./references/feetype.md) |
|
||||
| 企业角色、角色组与角色成员 | `hose-use role list`, `hose-use role groups`, `hose-use role members <角色>` | [references/role.md](./references/role.md) |
|
||||
| 角色权限只读快照 | `hose-use permission get` | [references/role.md](./references/role.md) |
|
||||
| 单据 Web 详情直达链接生成 | `hose-use bill link <单号|ID>` | [references/bill.md](./references/bill.md) |
|
||||
| 单据实体模型与字段元数据查询 / 单据模板联动规格 | `hose-use bill schema`, `hose-use bill spec <specificationId>` | [references/bill.md](./references/bill.md) |
|
||||
| 草稿字段一致性校验(金额/币种/发票总额/明细草稿状态) | `hose-use bill validate <单号|ID>` | [references/bill.md](./references/bill.md) |
|
||||
| 单据模板列表(默认仅启用,与页面快速新建同源) | `hose-use bill templates [--all] [--keyword=...]` | [references/bill.md](./references/bill.md) |
|
||||
| 按模板创建单据草稿(不提交) | `hose-use bill create --template <模板ID> [--title] [--amount] [--reason] --yes` | [references/bill.md](./references/bill.md) |
|
||||
| 提交单据送审 | `hose-use bill submit <单号|ID> [--approver=<员工>] --yes` | [references/bill.md](./references/bill.md) |
|
||||
| 复制单据为新草稿(清空发票绑定,不提交) | `hose-use bill copy <单号|ID> [--title=...] [--drop-attachments] --yes` | [references/bill.md](./references/bill.md) |
|
||||
| 删除草稿单据(仅 draft 状态) | `hose-use bill delete <单号|ID> --yes` | [references/bill.md](./references/bill.md) |
|
||||
| 企业通讯录检索 / 员工档案 / 防爆保护 | `hose-use contact search`, `hose-use contact list`, `hose-use contact get` | [references/contact.md](./references/contact.md) |
|
||||
| 待办中心 / 已审批 / 我发起的 / 审批记录 / 抄送 | `hose-use task todo`, `hose-use task submitted`, `hose-use task records`, `hose-use task cc` | [references/task.md](./references/task.md) |
|
||||
| 应用管理 (桌面端工作台开通的用车/套件/制度/自建前台应用) | `hose-use app list [--keyword]`, `hose-use app get <应用>` | [references/workflow.md](./references/workflow.md) |
|
||||
| 自建应用与数据模型 (开放平台业务对象/字段定义/全量记录/健康度体检) | `hose-use platform list`, `hose-use platform entities <应用>`, `hose-use platform records <应用> <对象> --all`, `hose-use platform audit <应用> <对象>` | [references/workflow.md](./references/workflow.md) |
|
||||
| 自建应用单条/批量记录安全操作 (详情/停启用/安全合并编辑/批量补丁/台账重算) | `hose-use platform record <get|toggle|edit|batch-edit|recompute>` | [references/workflow.md](./references/workflow.md) |
|
||||
| 跨自建应用工作流聚合检索与节点扫描 | `hose-use workflow list`, `hose-use workflow find --task=code-js2` | [references/workflow.md](./references/workflow.md) |
|
||||
| 桌面端全站主导航与一级模块树 | `hose-use menu list`, `hose-use menu tree` | [references/workflow.md](./references/workflow.md) |
|
||||
| 模糊搜索已保存的企业与员工信息 | `hose-use corps search <关键词>` | [references/auth.md](./references/auth.md) |
|
||||
| 特定任务节点扫描 (如脚本/Webhook) | `hose-use workflow find --task=code-js2` | [references/workflow.md](./references/workflow.md) |
|
||||
| 工作流详情、节点草稿修改、草稿保存、版本历史、运行日志、单次运行排障、发布与开通切换 | `hose-use workflow get`, `hose-use workflow job <jobId>`, `hose-use workflow patch`, `hose-use workflow save`, `hose-use workflow publish`, `hose-use workflow history`, `hose-use workflow logs`, `hose-use workflow toggle` | [references/workflow.md](./references/workflow.md) |
|
||||
| 工作流节点树、代码依赖与静态门禁诊断(硬门禁/软建议/权限/DataLink公式) | `hose-use workflow analyze <pipelineId> [--fail]` | [references/workflow.md](./references/workflow.md) |
|
||||
| 企业已开通工作流节点字典探针与灰度开通 | `hose-use workflow nodes [--all]`, `hose-use workflow nodes grant <type...>` | [references/workflow.md](./references/workflow.md) |
|
||||
| 工作流错误管道扫描与本地去重提醒 | `hose-use workflow check [--fail-on-alert]` | [references/workflow.md](./references/workflow.md) |
|
||||
| 企业 OpenAPI 接入密钥(默认脱敏) | `hose-use keys [--json]`, `hose-use openapi keys`, `hose-use store keys` | [references/store.md](./references/store.md) |
|
||||
| 企业已购应用 / 应用商店探查 | `hose-use store list / search / get` | [references/store.md](./references/store.md) |
|
||||
| 常驻守护进程管理 / 后台运行 | `hose-use service start`, `hose-use service status` | [references/service.md](./references/service.md) |
|
||||
| 待办/消息事件轮询与去重 | `hose-use service poll --corp=<id>` | [references/service.md](./references/service.md) |
|
||||
| 启动本地 HTTP 服务 / 打开可视化交互文档 | `hose-use http --port=8888` (访问 `/docs`) | [references/service.md](./references/service.md) |
|
||||
| CLI 同进程执行网关 / REST 接口调用 | `POST /api/cli`, `GET /v1/corps` | [references/service.md](./references/service.md) |
|
||||
| 导出标准 OpenAPI 3.1.0 JSON 规范 | `hose-use openapi`, `hose-use openapi --raw` | [references/service.md](./references/service.md) |
|
||||
| 一键自动自更新 / 查看版本发布日志 | `hose-use update`, `hose-use update --changelog` | `hose-use update --help` |
|
||||
|
||||
---
|
||||
|
||||
@@ -9,7 +9,7 @@ description: |
|
||||
|
||||
批量开通合思工作流节点。
|
||||
|
||||
节点名称与 type 对照见 [灰度节点清单](references/gray-nodes.md)。 **`nodes` 参数填清单中的 `type` 列值(如 `code`、`risk`),不是中文名。** 遇到同名节点或用户只提供模糊名称时,先根据 type 核对并向用户确认。
|
||||
节点名称与 type 对照见 [灰度节点清单](./references/gray-nodes.md)。 **`nodes` 参数填清单中的 `type` 列值(如 `code`、`risk`),不是中文名。** 遇到同名节点或用户只提供模糊名称时,先根据 type 核对并向用户确认。
|
||||
|
||||
## 参数提取
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ specs/hose-close-api/
|
||||
| 域 | 代码接口数 | 主要来源 |
|
||||
|---|---:|---|
|
||||
| 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` |
|
||||
| platform / workflow | 30 | `src/domains/platform/workflow/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** | |
|
||||
@@ -40,7 +40,7 @@ specs/hose-close-api/
|
||||
|
||||
## 来源
|
||||
|
||||
- `src/domains/platform/api.ts` + `src/domains/platform/types.ts`
|
||||
- `src/domains/platform/workflow/api.ts` + `src/domains/platform/workflow/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`
|
||||
@@ -62,7 +62,7 @@ specs/hose-close-api/
|
||||
|
||||
## 响应包装约定
|
||||
|
||||
- **Piper / EASO 业务接口**:常见 `{ "code": 200, "msg": "...", "data": ... }`。`code` 是数字;`src/domains/platform/api.ts` 把非 200 的 `code` 当错误。
|
||||
- **Piper / EASO 业务接口**:常见 `{ "code": 200, "msg": "...", "data": ... }`。`code` 是数字;`src/domains/platform/workflow/api.ts` 把非 200 的 `code` 当错误。
|
||||
- **主站列表接口**:常见裸 `{ "items": [...] }`、`{ "value": ... }` 或直接数组。
|
||||
- **快照接口**:`inputs` / `outputs` 在响应里是 JSON 编码字符串,不是数组;`WorkflowSnapshotSchema` 兼容字符串和数组。
|
||||
- **Job 执行接口**:`/execution`、`/execution/level/failed` 的 `data` 可能是数组,也可能是 `{number,size,totalPages,totalItems,items}` 分页对象。
|
||||
|
||||
@@ -45,38 +45,38 @@ staffId, userId, sourceChannel?, baseUrl?, external?, needAuth?
|
||||
|
||||
| # | 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:<platformId>}]` | `{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:<jobId>|{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` | 否 |
|
||||
| P01 | GET | `EKB /api/v2/datalink/platform/search` | Query `{scope:"enable",corpId}` | `{items:[Platform]}` | `src/domains/platform/workflow/api.ts:82`、`src/domains/platform/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/workflow/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/workflow/api.ts:112` | 否 |
|
||||
| P04 | GET | `PIPER /api/easo/charge` | 无 | `{code,msg,data:{corporationId,status,orderType,total,used,remaining}}` | `src/domains/platform/workflow/api.ts:121` | 否 |
|
||||
| P05 | GET | `PIPER /api/easo/pipelines/{pipelineId}` | 无 | `{code,msg,data:WorkflowDetail}`;结构见 `schemas/workflow-detail.schema.json` | `src/domains/platform/workflow/api.ts:131` | legacy |
|
||||
| P06 | PUT | `PIPER /api/easo/pipelines/{id}` | body 为完整 `WorkflowDetail`;Web 保存会带 `inputs:[{key:"$platformId",value:<platformId>}]` | `{code:200,msg:"修改成功",data:WorkflowDetail}`;响应 `data` 不含 `inputs` | `src/domains/platform/workflow/api.ts:141`、`src/domains/platform/workflow/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/workflow/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/workflow/api.ts:163` | 否 |
|
||||
| P09 | POST | `PIPER /api/easo/pipelines` | body 为工作流对象 | `{code,msg,data:WorkflowDetail}` | `src/domains/platform/workflow/api.ts:173` | 否 |
|
||||
| P10 | DELETE | `PIPER /api/easo/pipelines/{id}` | 无 | 读取并丢弃响应文本;代码视为成功 | `src/domains/platform/workflow/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/workflow/api.ts:194` | 否 |
|
||||
| P12 | GET | `PIPER /api/easo/pipelines/snapshot/{snapshotId}` | 无 | `{code,msg,data:WorkflowSnapshot}`;`inputs`/`outputs` 为 JSON 字符串 | `src/domains/platform/workflow/api.ts:207` | 见 `_tmp-captured` |
|
||||
| P13 | GET | `PIPER /api/easo/snapshots/{snapshotId}` | 无 | 同 P12;P12 失败后的 fallback | `src/domains/platform/workflow/api.ts:208` | 否 |
|
||||
| P14 | GET | `PIPER /api/easo/pipelines/{pipelineId}/snapshots/{snapshotId}` | 无 | 同 P12;P12/P13 失败后的 fallback | `src/domains/platform/workflow/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/workflow/api.ts:234` | 否 |
|
||||
| P16 | PUT | `PIPER /api/easo/pipelines/state/{pipelineId}` | Query `{state:"0"|"1"}` | 2xx 即成功;响应体忽略 | `src/domains/platform/workflow/api.ts:253` | legacy |
|
||||
| P17 | GET | `PIPER /api/easo/jobs/running` | Query `{pipelineId,runType:"DEBUG"|"PROD"}` | `{code,msg,data:WorkflowJob|WorkflowJob[]}` | `src/domains/platform/workflow/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/workflow/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/workflow/api.ts:294` | 见 `_tmp-captured`(CLI 聚合) |
|
||||
| P20 | GET | `PIPER /api/easo/jobs/{jobId}/execution/level/failed` | 无 | `{code,msg,data:ExecutionPage|TaskExecution[]}` | `src/domains/platform/workflow/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/workflow/api.ts:333` | 否 |
|
||||
| P22 | GET | `PIPER /api/easo/executions/{executionId}/logs` | 无 | `{code,msg,data:ExecutionLog[]|{items:[ExecutionLog]}}` | `src/domains/platform/workflow/api.ts:347` | 否 |
|
||||
| P23 | GET | `PIPER /api/easo/dsl/all` | 无 | `{data:NodeDef[]}` 或 `{data:{action:[],control:[],trigger:[]}}`;NodeDef 见下 | `src/domains/platform/workflow/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/workflow/api.ts:400` | legacy |
|
||||
| P25 | GET | `PIPER /api/webhook/{pipelineId}` | 无 | `{code,msg,data:{id,pipelineId,url,active}}` | `src/domains/platform/workflow/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/workflow/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/workflow/api.ts:433` | 否 |
|
||||
| P28 | POST | `PIPER /api/easo/jobs` | `{pipelineId,inputs:{id,data?,$autoPublish},dataLimit}` | `{code,msg,data:<jobId>|{id}|{jobId}}` | `src/domains/platform/workflow/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/workflow/api.ts:486` | 否 |
|
||||
| P30 | POST | `GW /hose-workflow-node` | `{token,corpId,nodes:"a,b,c",baseUrl?}` | `{success,saved:[],skipped:[],msg?}` | `src/domains/platform/workflow/api.ts:511` | 否 |
|
||||
|
||||
`Platform` 代码字段(`src/domains/platform/types.ts:5`):
|
||||
`Platform` 代码字段(`src/domains/platform/workflow/types.ts:5`):
|
||||
|
||||
```text
|
||||
id, name, nameSpell, enName?, code, corporationId, active, type, groupType,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"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",
|
||||
"code-derived: src/domains/platform/workflow/api.ts:151",
|
||||
"reference: _tmp-captured/raw/PUT-api-easo-pipelines-id-chooses.json"
|
||||
],
|
||||
"type": "array",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"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)",
|
||||
"code-derived: src/domains/platform/workflow/types.ts:273 (WorkflowDetailSchema)",
|
||||
"reference: _tmp-captured/raw/PUT-api-easo-pipelines-id.json"
|
||||
],
|
||||
"type": "object",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"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",
|
||||
"code-derived: src/domains/platform/workflow/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"
|
||||
],
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"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)",
|
||||
"code-derived: src/domains/platform/workflow/types.ts:307 (WorkflowSnapshotSchema)",
|
||||
"reference: _tmp-captured/raw/GET-api-easo-pipelines-snapshot-id.json"
|
||||
],
|
||||
"type": "object",
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
| [workflow/](./workflow/README.workflow.md) | 工作流配置、节点、分析、调试与监听 |
|
||||
| [corps/](./corps/README.corps.md) | 企业名录、身份、凭证导入和切换 |
|
||||
| [assist-platform/](./assist-platform/README.assist-platform.md) | 协助平台登录、工单与代客身份 |
|
||||
| [platform/](./platform/) | 自建应用及业务对象命令 |
|
||||
| [aipro/](./aipro/) | AI PRO 会话、规则与状态处理 |
|
||||
| [update/](./update/) | 更新检查与执行 |
|
||||
| [platform/](./platform) | 自建应用及业务对象命令 |
|
||||
| [aipro/](./aipro) | AI PRO 会话、规则与状态处理 |
|
||||
| [update/](./update) | 更新检查与执行 |
|
||||
| `auth.ts`、`context.ts`、`config.ts`、`probe.ts` | 认证、当前上下文、配置与诊断 |
|
||||
| `contact.ts`、`dimension.ts`、`feetype.ts`、`role.ts`、`permission.ts` | 员工、档案、费用类型及权限相关业务 |
|
||||
| `task.ts`、`message.ts`、`store.ts`、`keys.ts` | 待办、消息、应用中心与密钥 |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { fetchWorkbenchAppsList } from "../../domains/menu/tools.js";
|
||||
import { getPlatform } from "../../domains/datalink/services.js";
|
||||
import { getPlatform } from "../../domains/platform/applications/services.js";
|
||||
import { createClientsForCorp } from "../helpers.js";
|
||||
import { stringOption, booleanOption } from "../parser.js";
|
||||
import { printJson, printTable } from "../printer.js";
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import * as servicesApplications from "../../domains/platform/applications/services.js";
|
||||
import * as apiApplications from "../../domains/platform/applications/api.js";
|
||||
import { describe, expect, it, spyOn, afterEach } from "bun:test";
|
||||
import { handlePlatformCommand } from "./platform/index.js";
|
||||
import * as api from "../../domains/datalink/api.js";
|
||||
import * as services from "../../domains/datalink/services.js";
|
||||
import * as api from "../../domains/platform/datalink/api.js";
|
||||
import * as services from "../../domains/platform/datalink/services.js";
|
||||
import * as helpers from "../helpers.js";
|
||||
import type { CliRuntime } from "../types.js";
|
||||
import type { CorpConfig } from "../../core/config/types.js";
|
||||
@@ -75,7 +77,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("records 正确解析嵌套 dataLink 的停启用状态和更新时间", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
spies.push(spyOn(api, "searchEntityRecords").mockResolvedValue({
|
||||
total: 2,
|
||||
@@ -107,7 +109,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("record get 获取记录详情", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
spies.push(spyOn(api, "getRecordDetail").mockResolvedValue({
|
||||
dataLink: {
|
||||
@@ -134,7 +136,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("record toggle 切换停启用状态", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
const toggleSpy = spyOn(api, "toggleRecordState").mockResolvedValue({ recordId: "r-1", active: true });
|
||||
spies.push(toggleSpy);
|
||||
@@ -151,7 +153,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("record edit 编辑字段", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
const editSpy = spyOn(api, "editRecord").mockResolvedValue({ id: "r-1" } as any);
|
||||
spies.push(editSpy);
|
||||
@@ -182,7 +184,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("record recompute 触发台账重算", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
const recomputeSpy = spyOn(api, "recomputeRecordLedger").mockResolvedValue({ id: "ok" });
|
||||
spies.push(recomputeSpy);
|
||||
@@ -210,7 +212,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
},
|
||||
})
|
||||
);
|
||||
spies.push(spyOn(api, "listPlatforms").mockResolvedValue([mockPlatform] as any));
|
||||
spies.push(spyOn(apiApplications, "listPlatforms").mockResolvedValue([mockPlatform] as any));
|
||||
spies.push(spyOn(api, "listPlatformEntities").mockResolvedValue([mockEntity] as any));
|
||||
|
||||
const res = await handlePlatformCommand(
|
||||
@@ -225,7 +227,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("record batch-edit --dry-run 生成安全合并预览且不发送真实写请求", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
spies.push(
|
||||
spyOn(api, "getRecordDetail").mockResolvedValue({
|
||||
@@ -258,7 +260,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("platform records 支持 --sum 数学核算与 --group-by 分组统计", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue({
|
||||
...mockEntity,
|
||||
fields: [
|
||||
@@ -301,7 +303,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("platform audit 支持 --check-continuous 与 --expect 基线离群诊断", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue({
|
||||
...mockEntity,
|
||||
fields: [
|
||||
@@ -344,7 +346,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("platform update 支持 --where 声明式筛选与 --set 原地修改(含 --dry-run 与 --yes)", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue({
|
||||
...mockEntity,
|
||||
fields: [
|
||||
@@ -408,7 +410,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("platform records 支持 --stats 画像统计(计算状态、重名与编码聚类)", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
spies.push(
|
||||
spyOn(api, "searchEntityRecords").mockResolvedValue({
|
||||
@@ -463,7 +465,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("platform records 支持 --ndjson 流式逐行下发与 --flat 归一化", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
spies.push(
|
||||
spyOn(api, "searchEntityRecords").mockResolvedValue({
|
||||
@@ -516,7 +518,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("platform records --all 拒绝直接全量输出,要求分页或流式文件", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
await expect(
|
||||
handlePlatformCommand(
|
||||
@@ -528,7 +530,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("rejects malformed batch predicates before fetching all records or calling the writer", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
const fetch = spyOn(services, "fetchAllEntityRecords").mockResolvedValue({ data: [], total: 0 } as any);
|
||||
const write = spyOn(services, "batchSafeEditRecords").mockResolvedValue([]);
|
||||
@@ -540,7 +542,7 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
it("platform gen-props 生成 MVEL 和 JS 格式的字段模板", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(servicesApplications, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue({
|
||||
id: "E_contract",
|
||||
name: "合同",
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import {
|
||||
getImportResult,
|
||||
listImportJobs,
|
||||
listAllPlatforms,
|
||||
listPlatformEntities,
|
||||
listPlatforms,
|
||||
} from "../../../domains/datalink/services.js";
|
||||
import { getImportResult, listImportJobs, listPlatformEntities } from "../../../domains/platform/datalink/services.js";
|
||||
import { listAllPlatforms, listPlatforms } from "../../../domains/platform/applications/services.js";
|
||||
import { createClientsForCorp } from "../../helpers.js";
|
||||
import { booleanOption, stringOption } from "../../parser.js";
|
||||
import { printJson, printTable } from "../../printer.js";
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
toggleRecordState,
|
||||
type BatchEditTargetItem,
|
||||
type SafeRecordEditOptions,
|
||||
} from "../../../domains/datalink/services.js";
|
||||
} from "../../../domains/platform/datalink/services.js";
|
||||
import { createClientsForCorp } from "../../helpers.js";
|
||||
import { booleanOption, numberOption, stringOption } from "../../parser.js";
|
||||
import { printJson, printTable } from "../../printer.js";
|
||||
|
||||
@@ -12,9 +12,9 @@ import {
|
||||
parseExpectClause,
|
||||
searchEntityRecords,
|
||||
selectRecordFields,
|
||||
} from "../../../domains/datalink/services.js";
|
||||
import type { DatalinkRecord } from "../../../domains/datalink/types.js";
|
||||
import type { LedgerContinuityReport } from "../../../domains/datalink/types.js";
|
||||
} from "../../../domains/platform/datalink/services.js";
|
||||
import type { DatalinkRecord } from "../../../domains/platform/datalink/types.js";
|
||||
import type { LedgerContinuityReport } from "../../../domains/platform/datalink/types.js";
|
||||
import { booleanOption, numberOption, stringOption } from "../../parser.js";
|
||||
import { printJson, printTable, printKeyValue, redactSensitiveText } from "../../printer.js";
|
||||
import { usageError } from "../../errors.js";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { resolveEntity, resolvePlatform } from "../../../domains/datalink/services.js";
|
||||
import { resolveEntity } from "../../../domains/platform/datalink/services.js";
|
||||
import { resolvePlatform } from "../../../domains/platform/applications/services.js";
|
||||
import { createClientsForCorp } from "../../helpers.js";
|
||||
import type { CliParsedArgs, CliRuntime } from "../../types.js";
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as apiApplications from "../../domains/platform/applications/services.js";
|
||||
import { canRefreshCorpAccessToken, hasOpenApiPersistentCredentials } from "../../core/auth/login.js";
|
||||
import { createSessionClient, getEasoClient } from "../../core/http/index.js";
|
||||
import * as api from "../../domains/platform/services.js";
|
||||
import * as api from "../../domains/platform/workflow/services.js";
|
||||
import { printJson, printKeyValue, formatSourceLabel, formatExpiresAt, formatCorpEnvLabel } from "../printer.js";
|
||||
import type { CliParsedArgs, CliResult, CliRuntime } from "../types.js";
|
||||
|
||||
@@ -93,7 +94,7 @@ export async function handleProbeCommand(
|
||||
let platforms: any[] = [];
|
||||
if (sessionClient) {
|
||||
try {
|
||||
platforms = await api.listPlatforms(sessionClient, currentCorp.credentials.corpId);
|
||||
platforms = await apiApplications.listBasicPlatforms(sessionClient, currentCorp.credentials.corpId);
|
||||
results.platformAccess = {
|
||||
status: "ok",
|
||||
totalPlatforms: platforms.length,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, it, spyOn } from "bun:test";
|
||||
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import * as services from "../../domains/platform/services.js";
|
||||
import * as services from "../../domains/platform/workflow/services.js";
|
||||
import * as billApi from "../../domains/bill/api.js";
|
||||
import * as cache from "../../core/cache/index.js";
|
||||
import * as session from "../../core/http/session-client.js";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { afterEach, describe, expect, it, spyOn } from "bun:test";
|
||||
import { handleWorkflowTest } from "./workflow/test.js";
|
||||
import * as shared from "./workflow/shared.js";
|
||||
import * as services from "../../domains/platform/services.js";
|
||||
import * as services from "../../domains/platform/workflow/services.js";
|
||||
import type { CliParsedArgs, CliRuntime } from "../types.js";
|
||||
import type { WorkflowTestReport } from "../../domains/platform/types.js";
|
||||
import type { WorkflowTestReport } from "../../domains/platform/workflow/types.js";
|
||||
|
||||
const runtime = {
|
||||
selectedCorp: { id: "mock-corp", name: "Mock测试企业", env: "test", isTest: true } as any,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect, spyOn, test } from "bun:test";
|
||||
import { parseArgs } from "../parser.js";
|
||||
import { handleWorkflowCommand } from "./workflow/index.js";
|
||||
import * as services from "../../domains/platform/services.js";
|
||||
import * as services from "../../domains/platform/workflow/services.js";
|
||||
|
||||
test("node grant previews without a gateway call and requires explicit confirmation", async () => {
|
||||
const runtime = { selectedCorp: { id: "corp", credentials: { corpId: "corp" } }, jsonMode: true } as any;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect, spyOn, test } from "bun:test";
|
||||
import { handleWorkflowCommand } from "./workflow/index.js";
|
||||
import { parseArgs } from "../parser.js";
|
||||
import * as services from "../../domains/platform/services.js";
|
||||
import * as services from "../../domains/platform/workflow/services.js";
|
||||
test("failed grants retain gateway details and never report success", async () => {
|
||||
const grant = spyOn(services, "grantWorkflowNodes").mockResolvedValue({ success: false, saved: [], skipped: [], rawMessage: "permission denied" });
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it, spyOn, afterEach } from "bun:test";
|
||||
import { handleWorkflowCommand } from "./workflow/index.js";
|
||||
import * as services from "../../domains/platform/services.js";
|
||||
import * as api from "../../domains/platform/api.js";
|
||||
import * as services from "../../domains/platform/workflow/services.js";
|
||||
import * as api from "../../domains/platform/workflow/api.js";
|
||||
import * as helpers from "../helpers.js";
|
||||
import type { CliRuntime } from "../types.js";
|
||||
import type { CorpConfig } from "../../core/config/types.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it, spyOn, afterEach } from "bun:test";
|
||||
import { handleWorkflowCommand } from "./workflow/index.js";
|
||||
import * as helpers from "../helpers.js";
|
||||
import * as platformServices from "../../domains/platform/services.js";
|
||||
import * as platformServices from "../../domains/platform/workflow/services.js";
|
||||
import type { CliRuntime } from "../types.js";
|
||||
import type { CorpConfig } from "../../core/config/types.js";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getWorkflowDetail, getWorkflowAvailableNodes } from "../../../domains/platform/services.js";
|
||||
import { getWorkflowDetail, getWorkflowAvailableNodes } from "../../../domains/platform/workflow/services.js";
|
||||
import {
|
||||
analyzeWorkflow,
|
||||
extractWorkflowSpecificationIds,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { listAllWorkflows, listWorkflowLogs } from "../../../domains/platform/services.js";
|
||||
import { listAllWorkflows, listWorkflowLogs } from "../../../domains/platform/workflow/services.js";
|
||||
import { WorkflowAlertStore } from "../../../domains/platform/workflow/alert/index.js";
|
||||
import { stringOption, numberOption, booleanOption } from "../../parser.js";
|
||||
import { createClientsForCorp, createPiperClientForCorp } from "../../helpers.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { copyWorkflow, getWorkflowDetail } from "../../../domains/platform/services.js";
|
||||
import { copyWorkflow, getWorkflowDetail } from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption } from "../../parser.js";
|
||||
import { printJson, printKeyValue } from "../../printer.js";
|
||||
import { isDryRun, mutationPreview, requireMutationConfirmation } from "../../mutation.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createWorkflow } from "../../../domains/platform/services.js";
|
||||
import { createWorkflow } from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption } from "../../parser.js";
|
||||
import { printJson, printKeyValue } from "../../printer.js";
|
||||
import { isDryRun, mutationPreview, requireMutationConfirmation } from "../../mutation.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { deleteWorkflow, getWorkflowDetail } from "../../../domains/platform/services.js";
|
||||
import { deleteWorkflow, getWorkflowDetail } from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption } from "../../parser.js";
|
||||
import { printJson } from "../../printer.js";
|
||||
import { isDryRun, mutationPreview, requireMutationConfirmation } from "../../mutation.js";
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
getJob,
|
||||
getJobExecutionTree,
|
||||
getWorkflowSnapshot,
|
||||
} from "../../../domains/platform/services.js";
|
||||
} from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption } from "../../parser.js";
|
||||
import { printJson, printTable } from "../../printer.js";
|
||||
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { EkbError } from "../../../core/errors.js";
|
||||
import { getWorkflowDetail, listAllWorkflows, refreshWorkflowChooses, updateWorkflow } from "../../../domains/platform/services.js";
|
||||
import { getWorkflowDetail, listAllWorkflows, refreshWorkflowChooses, updateWorkflow } from "../../../domains/platform/workflow/services.js";
|
||||
import { WorkflowSavePartialError } from "../../../domains/platform/workflow/save-error.js";
|
||||
import { WorkflowDetailSchema } from "../../../domains/platform/types.js";
|
||||
import { WorkflowDetailSchema } from "../../../domains/platform/workflow/types.js";
|
||||
import {
|
||||
applyWorkflowPathPatch,
|
||||
beginWorkflowSave,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
resolveWorkflowEnumOptions,
|
||||
SYSTEM_WORKFLOW_ACTION_ENUMS,
|
||||
} from "../../../domains/platform/services.js";
|
||||
} from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption } from "../../parser.js";
|
||||
import { printJson, printTable, printKeyValue } from "../../printer.js";
|
||||
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getWorkflowDetail, listWorkflowLogs, listWorkflowSnapshots } from "../../../domains/platform/services.js";
|
||||
import { getWorkflowDetail, listWorkflowLogs, listWorkflowSnapshots } from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption, numberOption, booleanOption } from "../../parser.js";
|
||||
import { printJson, printTable, printKeyValue } from "../../printer.js";
|
||||
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
import {
|
||||
extractFailureExecutions,
|
||||
findExecutionNode,
|
||||
flattenExecutionTree,
|
||||
getExecutionLogs,
|
||||
getJob,
|
||||
getJobExecutionLevel,
|
||||
getJobExecutionTree,
|
||||
getJobFailedExecutions,
|
||||
getWorkflowDetail,
|
||||
isTaskExecutionFailed,
|
||||
listPlatforms,
|
||||
explainConditionBranches,
|
||||
} from "../../../domains/platform/services.js";
|
||||
import type { WorkflowTaskExecution } from "../../../domains/platform/types.js";
|
||||
import { extractFailureExecutions, findExecutionNode, flattenExecutionTree, getExecutionLogs, getJob, getJobExecutionLevel, getJobExecutionTree, getJobFailedExecutions, getWorkflowDetail, isTaskExecutionFailed, explainConditionBranches } from "../../../domains/platform/workflow/services.js";
|
||||
import { listBasicPlatforms as listPlatforms } from "../../../domains/platform/applications/services.js";
|
||||
import type { WorkflowTaskExecution } from "../../../domains/platform/workflow/types.js";
|
||||
import { stringOption, numberOption, booleanOption } from "../../parser.js";
|
||||
import { createClientsForCorp, createPiperClientForCorp } from "../../helpers.js";
|
||||
import { printJson, printTable, printKeyValue } from "../../printer.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { toggleWorkflow } from "../../../domains/platform/services.js";
|
||||
import { toggleWorkflow } from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption } from "../../parser.js";
|
||||
import { printJson } from "../../printer.js";
|
||||
import { isDryRun, mutationPreview, requireMutationConfirmation } from "../../mutation.js";
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
findWorkflowsByTaskType,
|
||||
getWorkflowDetail,
|
||||
listAllWorkflows,
|
||||
} from "../../../domains/platform/services.js";
|
||||
} from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption, numberOption, booleanOption } from "../../parser.js";
|
||||
import { createClientsForCorp } from "../../helpers.js";
|
||||
import { printJson, printTable, printKeyValue } from "../../printer.js";
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
applyNodeMapping,
|
||||
getWorkflowAvailableNodes,
|
||||
grantWorkflowNodes,
|
||||
} from "../../../domains/platform/services.js";
|
||||
} from "../../../domains/platform/workflow/services.js";
|
||||
import {
|
||||
GRAY_NODES_CATALOG,
|
||||
findGrayNode,
|
||||
|
||||
@@ -8,7 +8,7 @@ import { parseArgs } from "../../parser.js";
|
||||
import { cliErrorResult } from "../../runner.js";
|
||||
import { normalizeCliArgs, tokenizeCommand } from "../../../server.js";
|
||||
import { handleWorkflowCommand } from "./index.js";
|
||||
import { WorkflowDetailSchema } from "../../../domains/platform/types.js";
|
||||
import { WorkflowDetailSchema } from "../../../domains/platform/workflow/types.js";
|
||||
import { WorkflowSavePartialError } from "../../../domains/platform/workflow/save-error.js";
|
||||
import type { CliRuntime } from "../../types.js";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
|
||||
import { parseArgs } from "../../parser.js";
|
||||
import { handleWorkflowLintScript, handleWorkflowEvalScript } from "./script.js";
|
||||
import * as shared from "./shared.js";
|
||||
import * as services from "../../../domains/platform/services.js";
|
||||
import * as services from "../../../domains/platform/workflow/services.js";
|
||||
|
||||
test("all local and remote script JSON branches return reports and honor output files", async () => {
|
||||
const client = spyOn(shared, "createWorkflowDetailClient").mockResolvedValue({ client: {} } as any);
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
lintMvelCode,
|
||||
executeJavaScriptSandbox,
|
||||
executeMvelSandbox,
|
||||
} from "../../../domains/platform/services.js";
|
||||
} from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption, booleanOption } from "../../parser.js";
|
||||
import { printJson, printKeyValue } from "../../printer.js";
|
||||
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { flattenExecutionTree, listAllWorkflows } from "../../../domains/platform/services.js";
|
||||
import { flattenExecutionTree, listAllWorkflows } from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption } from "../../parser.js";
|
||||
import { createClientsForCorp, createPiperClientForCorp } from "../../helpers.js";
|
||||
import type { CliParsedArgs, CliRuntime } from "../../types.js";
|
||||
@@ -31,7 +31,7 @@ export async function createWorkflowDetailClient(
|
||||
if (!platformId) {
|
||||
try {
|
||||
const corpId = runtime.selectedCorp!.corpId || runtime.selectedCorp!.id;
|
||||
const { listPlatforms } = await import("../../../domains/platform/services.js");
|
||||
const { listBasicPlatforms: listPlatforms } = await import("../../../domains/platform/applications/services.js");
|
||||
const platforms = await listPlatforms(clients.ekbClient, corpId);
|
||||
const firstActive = platforms.find((p) => p.active) ?? platforms[0];
|
||||
platformId = firstActive?.id;
|
||||
@@ -58,7 +58,7 @@ export async function createJobPiperClient(
|
||||
const clients = await createClientsForCorp(corp);
|
||||
try {
|
||||
const corpId = corp.corpId || corp.id;
|
||||
const { listPlatforms } = await import("../../../domains/platform/services.js");
|
||||
const { listBasicPlatforms: listPlatforms } = await import("../../../domains/platform/applications/services.js");
|
||||
const platforms = await listPlatforms(clients.ekbClient, corpId);
|
||||
const firstActive = platforms.find((p) => p.active) ?? platforms[0];
|
||||
if (firstActive?.id) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { extractCodeNodeSummaries } from "./shared.js";
|
||||
import { flattenExecutionTree } from "../../../domains/platform/services.js";
|
||||
import { flattenExecutionTree } from "../../../domains/platform/workflow/services.js";
|
||||
|
||||
test("test and job summaries retain nested execution containers and repeated loop executions", () => {
|
||||
const tree = [{ id: "loop", type: "every", children: [
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
watchWorkflowPipeline,
|
||||
formatWatchEvent,
|
||||
type WorkflowWatchEvent,
|
||||
} from "../../../domains/platform/services.js";
|
||||
} from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption, numberOption, booleanOption } from "../../parser.js";
|
||||
import { printJson } from "../../printer.js";
|
||||
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
getWorkflowSampleData,
|
||||
runWorkflowDebugTest,
|
||||
type WorkflowTriggerCategory,
|
||||
} from "../../../domains/platform/services.js";
|
||||
} from "../../../domains/platform/workflow/services.js";
|
||||
import { stringOption, booleanOption, numberOption } from "../../parser.js";
|
||||
import { printJson, printTable, printKeyValue } from "../../printer.js";
|
||||
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it, spyOn, afterEach } from "bun:test";
|
||||
import { handleWebhookCommand } from "./webhook.js";
|
||||
import * as shared from "./shared.js";
|
||||
import * as services from "../../../domains/platform/services.js";
|
||||
import * as services from "../../../domains/platform/workflow/services.js";
|
||||
import type { CliParsedArgs, CliRuntime } from "../../types.js";
|
||||
|
||||
function createMockRuntime(overrides: Partial<CliRuntime> = {}): CliRuntime {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import ky from "ky";
|
||||
import { getWorkflowDetail } from "../../../domains/platform/services.js";
|
||||
import { getWorkflowDetail } from "../../../domains/platform/workflow/services.js";
|
||||
import { getBillByCodeOrId } from "../../../domains/bill/tools.js";
|
||||
import { stringOption } from "../../parser.js";
|
||||
import { printJson, printKeyValue } from "../../printer.js";
|
||||
|
||||
@@ -9,7 +9,7 @@ import { createServer, HOSE_CLI_TOOL_NAME } from "../server.js";
|
||||
import { startHttpServer } from "../http/server.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
import * as shared from "./commands/platform/shared.js";
|
||||
import * as records from "../domains/datalink/services.js";
|
||||
import * as records from "../domains/platform/datalink/services.js";
|
||||
|
||||
describe("NDJSON output destinations across CLI, MCP and HTTP", () => {
|
||||
const spies: Array<{ mockRestore(): void }> = [];
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
## 依赖与身份边界
|
||||
|
||||
Session 续期可使用主账号或企业持久化 OpenAPI 凭证;HTTP 客户端负责请求时的认证衔接,见 [http/](../http/README.http.md)。企业配置结构与加载由 [config/](../config/) 管理,通用数据库由 [db/](../db/) 管理。
|
||||
Session 续期可使用主账号或企业持久化 OpenAPI 凭证;HTTP 客户端负责请求时的认证衔接,见 [http/](../http/README.http.md)。企业配置结构与加载由 [config/](../config) 管理,通用数据库由 [db/](../db) 管理。
|
||||
|
||||
不要混用不同企业、账号或子域的 Token。凭证变更和导入需要同步处理相关 Token 缓存失效,不能只替换内存对象。路径由各 store 的解析函数及 `HOSE_*` 环境变量控制,测试使用临时文件与企业目录,不接触个人真实凭证。
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -20,4 +20,4 @@
|
||||
|
||||
`clear(namespace)` 可限定命名空间;无参数清空缓存。`resetGlobalCache` 会清空已有实例并重置单例,隔离测试应使用临时数据库,不能把它当作只清内存的操作。
|
||||
|
||||
[cache.test.ts](./cache.test.ts) 覆盖 TTL、命名空间、持久化协同与并发行为。新增持久化表仍由 [core/db](../db/) 的迁移管理,不在缓存构造函数中另建私有数据库体系。
|
||||
[cache.test.ts](./cache.test.ts) 覆盖 TTL、命名空间、持久化协同与并发行为。新增持久化表仍由 [core/db](../db) 的迁移管理,不在缓存构造函数中另建私有数据库体系。
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
本目录按业务域组织代码,每个域独立负责自己的传输层(`api.ts`)、业务编排层(`tools.ts` / `services.ts`)和模型层(`types.ts`)。
|
||||
|
||||
## 当前域(共 15 个)
|
||||
## 当前域(共 14 个)
|
||||
|
||||
| 域 | 内部形态 | 说明 | 详细文档 |
|
||||
|---|---|---|---|
|
||||
| `platform/` | `api / services / workflow/{analysis,branch,nodes,script,state,watch,alert} / types` | 自建应用(DataLink Platform)与工作流(EASO/Piper)、静态分析、草稿乐观锁状态机与错误指纹告警 | [README.platform.md](./platform/README.platform.md) |
|
||||
| `datalink/` | `api / services / fields / types` | 自建应用下的业务对象、字段、记录检索、安全合并编辑(Read-Modify-Write)、台账体检与导入状态 | [README.datalink.md](./datalink/README.datalink.md) |
|
||||
| `platform/` | `applications / datalink / workflow` | 自建应用平台:应用元数据、业务对象与记录、工作流配置与执行 | [README.platform.md](./platform/README.platform.md) |
|
||||
| `bill/` | `api / tools / create / copy / submit / templates / write / draft-validation / translator / types` | 费控单据、报销单、发票、审批流时间线、风控扫描与 Markdown 智能转译器 | [README.bill.md](./bill/README.bill.md) |
|
||||
| `approval/` | `index / gateway / parser / repository / service / db / types` | AI PRO 智能审批引擎(DSL 规则解析、确定性安全网关、要点核验与 `core/db` 会话持久化) | [README.approval.md](./approval/README.approval.md) |
|
||||
| `assist-platform/` | `api / services / types` | 合思协助平台(Unity 运营中心)多租户检索、工单匹配、指定代客员工免密直通与落盘提权 | [README.assist-platform.md](./assist-platform/README.assist-platform.md) |
|
||||
@@ -29,12 +28,12 @@
|
||||
- `tools.ts`:纯函数式业务编排,供 CLI 命令(`src/cli/commands/*`)调用
|
||||
- `types.ts`:Zod schema 与类型定义
|
||||
2. **扩展复合形态**(有明确职责拆分理由):
|
||||
- `platform/` 与 `datalink/`:使用 `services.ts` 提供跨应用聚合、台账健康度审计、批量安全编辑与对 `api.ts` 的服务级门面封装
|
||||
- `platform/` 的 applications、datalink 与 workflow 子模块:使用 `services.ts` 提供跨应用聚合、台账健康度审计、批量安全编辑与对 `api.ts` 的服务级门面封装
|
||||
- `bill/`:独立拆分 `translator.ts` 负责复杂单据/审批流到结构化 Markdown 的纯函数转译
|
||||
- `approval/`:采用 `parser.ts`(DSL 解析)+ `gateway.ts`(确定性仲裁门禁)+ `repository.ts`(基于 `core/db` 的数据访问)+ `service.ts`(业务编排)
|
||||
- `events/`:组合 `task/` 与 `message/` 域的 `tools.ts` 实现轮询(`poller.ts`),并通过 `store.ts` 落盘至 `core/db`
|
||||
- `assist-platform/`:使用 `services.ts` 封装合思运营平台多租户检索、工单匹配、指定代客员工定位、免密直通换票及与租户存储的联动落盘提权
|
||||
3. **边界与异常约束**(由 `src/cli/architecture-boundaries.test.ts` 强制校验):
|
||||
- 任何入口层(`src/cli/**`, `src/http/**`, `src/server.ts`, `src/cli.ts`, `src/aipro-cli.ts`)严禁直接导入 `domains/*/api.ts`
|
||||
- 任何入口层(`src/cli/**`, `src/http/**`, `src/server.ts`, `src/cli.ts`, `src/aipro-cli.ts`)严禁直接导入 `domains/**/api.ts`
|
||||
- `domains/*` 严禁反向导入 `cli/`、`http/` 或顶层入口文件
|
||||
- `domains/*` 统一抛出 `EkbError` 子类(定义在 `src/core/errors.ts`)
|
||||
@@ -1,39 +1,17 @@
|
||||
# Platform 域说明
|
||||
# 自建应用平台(platform)
|
||||
|
||||
Platform 域负责工作流(EASO/Piper)以及自建应用容器的兼容能力。自建应用下的业务对象、字段、记录和权限查询统一放在 [DataLink 域](../datalink/README.datalink.md)。
|
||||
本域以自建应用为共同业务根,包含应用元数据、业务对象数据与工作流三个子模块。CLI 命令按使用场景组织,源码归属按业务职责组织。
|
||||
|
||||
## 代码结构
|
||||
| 子模块 | 所有权 | 入口 |
|
||||
|---|---|---|
|
||||
| applications | 应用基础/详情模型、列表、全量列表、名称解析及应用级权限元数据 | [README.applications.md](./applications/README.applications.md) |
|
||||
| datalink | 业务对象、字段、记录、导入、数据编辑与台账审计 | [README.datalink.md](./datalink/README.datalink.md) |
|
||||
| workflow | 工作流模型、传输、配置保存、节点、执行、诊断与监听 | [README.workflow.md](./workflow/README.workflow.md) |
|
||||
|
||||
```text
|
||||
src/domains/platform/
|
||||
├── types.ts # Zod schema 与类型定义(含 Job 执行树、失败节点、节点日志、枚举类型)
|
||||
├── api.ts # HTTP 传输层(含 unwrap 空安全校验、Piper Job 端点与 EKB_ENUM 字典拉取)
|
||||
├── services.ts # 门面聚合与对外服务导出(含 resolveWorkflowEnumOptions 混合架构)
|
||||
├── workflow/ # 工作流体系子域(高内聚分层架构)
|
||||
│ ├── index.ts # 工作流能力统合导出
|
||||
│ ├── enums.ts # 单据审批事件触发器标准系统枚举(18 项内置字典与翻译器)
|
||||
│ ├── watch/ # 实时任务监听、TaskExecutionTracker 状态机与日志流 (tracker, engine, formatter)
|
||||
│ ├── nodes/ # 声明式节点树编排、树形索引定位、插入追加与重排 (tree, locator, mutations)
|
||||
│ ├── script/ # 脚本 AST 语法校验、上游依赖扫描与隔离沙箱仿真引擎 (lint, scanner, sandbox)
|
||||
│ ├── branch/ # 条件分支与规则解释诊断引擎 (explain, types)
|
||||
│ ├── analysis/ # 工作流静态吞错、审批状态死锁过滤与联动覆盖巡检 (analyzer, types)
|
||||
│ ├── state/ # 草稿版本状态机与发布乐观锁保护
|
||||
│ └── alert/ # 错误指纹告警与 SQLite 本地持久化
|
||||
└── execution-context.ts # 执行树与节点输出上下文辅助
|
||||
```
|
||||
## 依赖与入口
|
||||
|
||||
## 工作流使用与诊断
|
||||
applications 不依赖另外两个模块;DataLink 可使用应用模型和服务,不能依赖工作流;工作流跨应用查询通过 applications 服务获取应用。跨子模块调用使用 services,不直接导入其他子模块的 api。共享认证和数据库仍使用 core。
|
||||
|
||||
CLI 命令、触发器分类、生产调试风险、节点与脚本校验、实时监听以及诊断结果契约,统一见 [Workflow 说明](./workflow/README.workflow.md)。
|
||||
各子模块拥有自己的 api、services 与 types。platform 根目录只保留总览,不保留混合的 api/services/types 门面。内部私有源码路径已经调整,公共 `hose-use/sdk` 名称和 CLI 命令继续保持兼容。
|
||||
|
||||
## 模块边界
|
||||
|
||||
- `workflow/{analysis,branch,nodes,script,state,watch,alert}/index.ts` 是各能力的目录出口;内部引用直接指向所属目录,不再保留根目录的一行转发文件。
|
||||
- 单元测试与对应实现放在同一目录;分层测试检查已移除路径,保留正常的模块出口文件。
|
||||
- MVEL 校验先识别字符串、转义及行/块注释,再检查有效代码中的括号、return 和节点引用;这属于轻量静态检查,不是完整的 MVEL 编译器。JavaScript 校验仍检查函数体语法,不执行脚本。
|
||||
|
||||
## 详细文档
|
||||
|
||||
接口职责、认证链路与 CLI 能力导航见(MCP 统一使用 `hose_cli`):
|
||||
|
||||
[docs/modules/platform.md](../../../docs/modules/platform.md)
|
||||
具体 CLI 与认证链路见 [模块说明](../../../docs/modules/platform.md),强制导入规则见 [架构边界测试](../../cli/architecture-boundaries.test.ts)。
|
||||
@@ -0,0 +1,16 @@
|
||||
# 自建应用元数据(applications)
|
||||
|
||||
本模块拥有应用基础模型、详情模型、应用级权限元数据及目标解析。业务对象与工作流分别由 [DataLink](../datalink/README.datalink.md) 和 [Workflow](../workflow/README.workflow.md) 管理。
|
||||
|
||||
| 文件 | 职责 |
|
||||
|---|---|
|
||||
| [api.ts](./api.ts) | 应用 HTTP 请求和响应投影,共用启用应用列表请求 |
|
||||
| [types.ts](./types.ts) | PlatformSchema、应用详情与公开兼容类型 DatalinkPlatformDetail |
|
||||
| [services.ts](./services.ts) | 基础/详情列表、全量列表、详情与唯一目标解析出口 |
|
||||
| [application-contract.test.ts](./application-contract.test.ts) | 迁移前后两种投影、缺省与包装兼容回归 |
|
||||
|
||||
`listBasicPlatforms` 保留原工作流基础投影:剥离未建模字段,缺少 items 时拒绝。`listPlatforms` 保留详情投影:保留扩展字段、清洗 admin 信息、兼容空列表。两者共用请求实现,不强行混同既有错误及空值行为。
|
||||
|
||||
`listAllPlatforms` 与 `getPlatform` 保留原有全量及详情契约;当前全量列表原始数组仍被归为空列表,这属于已锁定的既有兼容行为,本轮不借迁移改变。`resolvePlatform` 按 ID、名称或编码做不区分大小写的精确匹配,再读取详情。
|
||||
|
||||
CLI 的 platform/app 详情及公共 SDK 的原函数名继续可用。不得从本模块反向依赖 DataLink 或工作流,不在应用模型中复制节点或记录结构。
|
||||
@@ -0,0 +1,74 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { PlatformSchema, DatalinkPlatformDetailSchema, type DatalinkPlatformDetail } from "./types.js";
|
||||
|
||||
function asRecord(value: unknown): Record<string, any> {
|
||||
return value !== null && typeof value === "object" && !Array.isArray(value) ? value as Record<string, any> : {};
|
||||
}
|
||||
|
||||
async function fetchEnabledPlatforms(client: KyInstance, corpId: string): Promise<unknown> {
|
||||
const response = await client.get("api/v2/datalink/platform/search", { searchParams: { scope: "enable", corpId } });
|
||||
return response.json();
|
||||
}
|
||||
|
||||
/** 工作流使用的基础投影:保留缺少 items 时拒绝的既有契约。 */
|
||||
export async function listBasicPlatforms(client: KyInstance, corpId: string) {
|
||||
const json = await fetchEnabledPlatforms(client, corpId) as { items: unknown[] };
|
||||
return z.array(PlatformSchema).parse(json.items);
|
||||
}
|
||||
|
||||
function sanitizePlatformDetail(value: unknown): Record<string, unknown> {
|
||||
const platform = asRecord(value);
|
||||
const admin = Array.isArray(platform.admin)
|
||||
? platform.admin.map((item) => {
|
||||
const staff = asRecord(item);
|
||||
return {
|
||||
id: staff.id,
|
||||
name: staff.name,
|
||||
code: staff.code,
|
||||
active: staff.active,
|
||||
};
|
||||
})
|
||||
: platform.admin;
|
||||
return { ...platform, admin };
|
||||
}
|
||||
|
||||
/** 列出当前企业可见的启用自建应用。 */
|
||||
export async function listPlatforms(client: KyInstance, corpId: string) {
|
||||
const json = asRecord(await fetchEnabledPlatforms(client, corpId));
|
||||
const items = Array.isArray(json.items) ? json.items.map(sanitizePlatformDetail) : [];
|
||||
return z.array(DatalinkPlatformDetailSchema).parse(items);
|
||||
}
|
||||
|
||||
/** 列出当前企业全量自建应用与模板平台(包含 HAB 模板与全部自建应用)。 */
|
||||
export async function listAllPlatforms(client: KyInstance, corpId: string) {
|
||||
const response = await client.get("api/v2/datalink/platform", {
|
||||
searchParams: { corpId },
|
||||
});
|
||||
const json = asRecord(await response.json());
|
||||
const rawList = Array.isArray(json) ? json : Array.isArray(json.items) ? json.items : [];
|
||||
const items = rawList.map(sanitizePlatformDetail);
|
||||
return z.array(DatalinkPlatformDetailSchema).parse(items);
|
||||
}
|
||||
|
||||
/** 获取单个应用详情以及应用级人员/角色/部门权限。 */
|
||||
export async function getPlatform(
|
||||
client: KyInstance,
|
||||
corpId: string,
|
||||
platformId: string
|
||||
): Promise<DatalinkPlatformDetail> {
|
||||
const normalizedId = platformId.startsWith("$") ? platformId : `$${platformId}`;
|
||||
const bareId = platformId.startsWith("$") ? platformId.slice(1) : platformId;
|
||||
const response = await client.get(`api/v2/datalink/platform/${normalizedId}`, {
|
||||
// 前端实际使用两个 join,并且详情接口要求同时传 id。
|
||||
searchParams: new URLSearchParams([
|
||||
["id", bareId],
|
||||
["join", "icon.fileId,fileId,/v1/attachment/attachments"],
|
||||
["corpId", corpId],
|
||||
["join", "adminIds,admin,/v1/organization/staffs"],
|
||||
]),
|
||||
});
|
||||
const json = asRecord(await response.json());
|
||||
return DatalinkPlatformDetailSchema.parse(sanitizePlatformDetail(json.value ?? json.data ?? json));
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import type { KyInstance } from "ky";
|
||||
import { listPlatforms as listBasic } from "./api.js";
|
||||
import { listPlatforms as listDetailed, listAllPlatforms, getPlatform } from "../datalink/api.js";
|
||||
import { listBasicPlatforms as listBasic } from "./api.js";
|
||||
import { listPlatforms as listDetailed, listAllPlatforms, getPlatform } from "./api.js";
|
||||
|
||||
function client(body: unknown) {
|
||||
const calls: Array<{ path: string; options: any }> = [];
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { KyInstance } from "ky";
|
||||
import * as api from "./api.js";
|
||||
import type { DatalinkPlatformDetail } from "./types.js";
|
||||
|
||||
export function listBasicPlatforms(...args: Parameters<typeof api.listBasicPlatforms>) { return api.listBasicPlatforms(...args); }
|
||||
export function listPlatforms(...args: Parameters<typeof api.listPlatforms>) { return api.listPlatforms(...args); }
|
||||
export function listAllPlatforms(...args: Parameters<typeof api.listAllPlatforms>) { return api.listAllPlatforms(...args); }
|
||||
export function getPlatform(...args: Parameters<typeof api.getPlatform>) { return api.getPlatform(...args); }
|
||||
|
||||
function matches(value: unknown, target: string): boolean {
|
||||
return typeof value === "string" && value.toLowerCase() === target.toLowerCase();
|
||||
}
|
||||
|
||||
export async function resolvePlatform(
|
||||
client: KyInstance,
|
||||
corpId: string,
|
||||
target: string
|
||||
): Promise<DatalinkPlatformDetail | undefined> {
|
||||
const platforms = await api.listPlatforms(client, corpId);
|
||||
const found = platforms.find((platform) =>
|
||||
[platform.id, platform.name, platform.code].some((value) => matches(value, target))
|
||||
);
|
||||
return found ? api.getPlatform(client, corpId, found.id) : undefined;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { z } from "zod";
|
||||
|
||||
// ── 自建应用(DataLink Platform)─────────────────────────────
|
||||
|
||||
export const PlatformSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
nameSpell: z.string().default(""),
|
||||
enName: z.string().nullable().optional(),
|
||||
code: z.string().default(""),
|
||||
corporationId: z.string(),
|
||||
active: z.boolean().default(true),
|
||||
type: z.string().default(""),
|
||||
groupType: z.string().default(""),
|
||||
platformType: z.string().default(""),
|
||||
source: z.string().default(""),
|
||||
adminIds: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
desc: z.string().nullable().optional(),
|
||||
importMethod: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
createTime: z.number().default(0),
|
||||
updateTime: z.number().default(0),
|
||||
});
|
||||
|
||||
export const DatalinkPlatformDetailSchema = PlatformSchema.passthrough().extend({
|
||||
staffIds: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
roleIds: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
departmentIds: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
departmentsIncludeChildren: z.boolean().nullish().transform((value) => value ?? false),
|
||||
});
|
||||
|
||||
export type Platform = z.infer<typeof PlatformSchema>;
|
||||
export type DatalinkPlatformDetail = z.infer<typeof DatalinkPlatformDetailSchema>;
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
# DataLink 域说明
|
||||
|
||||
DataLink 域负责跨企业查询当前账号可见的自建应用、业务对象、字段定义、业务记录、权限快照和导入状态。
|
||||
DataLink 是应用平台的数据子模块,负责业务对象、字段定义、业务记录、对象级权限快照和导入状态。应用列表、详情与名称解析由 [applications](../applications/README.applications.md) 拥有;公共 SDK 保留原调用名称。
|
||||
|
||||
## 代码结构
|
||||
|
||||
```text
|
||||
src/domains/datalink/
|
||||
src/domains/platform/datalink/
|
||||
├── types.ts # 应用详情、对象字段、记录分页与权限模型
|
||||
├── api.ts # DataLink HTTP 传输层
|
||||
├── services.ts # 应用/对象名称解析与查询表达式辅助、SDK 门面
|
||||
@@ -3,12 +3,10 @@ import type { KyInstance } from "ky";
|
||||
import { resolveDatalinkField } from "./fields.js";
|
||||
import {
|
||||
DatalinkEntitySchema,
|
||||
DatalinkPlatformDetailSchema,
|
||||
enrichDatalinkField,
|
||||
type DatalinkEntity,
|
||||
type DatalinkField,
|
||||
type DatalinkImportJob,
|
||||
type DatalinkPlatformDetail,
|
||||
type DatalinkRecord,
|
||||
type DatalinkRecordDetail,
|
||||
type DatalinkRecordEditPayload,
|
||||
@@ -35,64 +33,6 @@ function parseEntity(value: unknown): DatalinkEntity {
|
||||
};
|
||||
}
|
||||
|
||||
function sanitizePlatformDetail(value: unknown): Record<string, unknown> {
|
||||
const platform = asRecord(value);
|
||||
const admin = Array.isArray(platform.admin)
|
||||
? platform.admin.map((item) => {
|
||||
const staff = asRecord(item);
|
||||
return {
|
||||
id: staff.id,
|
||||
name: staff.name,
|
||||
code: staff.code,
|
||||
active: staff.active,
|
||||
};
|
||||
})
|
||||
: platform.admin;
|
||||
return { ...platform, admin };
|
||||
}
|
||||
|
||||
/** 列出当前企业可见的启用自建应用。 */
|
||||
export async function listPlatforms(client: KyInstance, corpId: string) {
|
||||
const response = await client.get("api/v2/datalink/platform/search", {
|
||||
searchParams: { scope: "enable", corpId },
|
||||
});
|
||||
const json = asRecord(await response.json());
|
||||
const items = Array.isArray(json.items) ? json.items.map(sanitizePlatformDetail) : [];
|
||||
return z.array(DatalinkPlatformDetailSchema).parse(items);
|
||||
}
|
||||
|
||||
/** 列出当前企业全量自建应用与模板平台(包含 HAB 模板与全部自建应用)。 */
|
||||
export async function listAllPlatforms(client: KyInstance, corpId: string) {
|
||||
const response = await client.get("api/v2/datalink/platform", {
|
||||
searchParams: { corpId },
|
||||
});
|
||||
const json = asRecord(await response.json());
|
||||
const rawList = Array.isArray(json) ? json : Array.isArray(json.items) ? json.items : [];
|
||||
const items = rawList.map(sanitizePlatformDetail);
|
||||
return z.array(DatalinkPlatformDetailSchema).parse(items);
|
||||
}
|
||||
|
||||
/** 获取单个应用详情以及应用级人员/角色/部门权限。 */
|
||||
export async function getPlatform(
|
||||
client: KyInstance,
|
||||
corpId: string,
|
||||
platformId: string
|
||||
): Promise<DatalinkPlatformDetail> {
|
||||
const normalizedId = platformId.startsWith("$") ? platformId : `$${platformId}`;
|
||||
const bareId = platformId.startsWith("$") ? platformId.slice(1) : platformId;
|
||||
const response = await client.get(`api/v2/datalink/platform/${normalizedId}`, {
|
||||
// 前端实际使用两个 join,并且详情接口要求同时传 id。
|
||||
searchParams: new URLSearchParams([
|
||||
["id", bareId],
|
||||
["join", "icon.fileId,fileId,/v1/attachment/attachments"],
|
||||
["corpId", corpId],
|
||||
["join", "adminIds,admin,/v1/organization/staffs"],
|
||||
]),
|
||||
});
|
||||
const json = asRecord(await response.json());
|
||||
return DatalinkPlatformDetailSchema.parse(sanitizePlatformDetail(json.value ?? json.data ?? json));
|
||||
}
|
||||
|
||||
/** 获取应用下的业务对象目录及完整字段定义。 */
|
||||
export async function listPlatformEntities(
|
||||
client: KyInstance,
|
||||
+2
-11
@@ -1,15 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import {
|
||||
buildSafeRecordEditPayload,
|
||||
editRecord,
|
||||
getPlatform,
|
||||
getRecordDetail,
|
||||
listPlatformEntities,
|
||||
listPlatforms,
|
||||
recomputeRecordLedger,
|
||||
searchEntityRecords,
|
||||
toggleRecordState,
|
||||
} from "./api.js";
|
||||
import { buildSafeRecordEditPayload, editRecord, getRecordDetail, listPlatformEntities, recomputeRecordLedger, searchEntityRecords, toggleRecordState } from "./api.js";
|
||||
import { getPlatform, listPlatforms } from "../applications/api.js";
|
||||
import {
|
||||
aggregateRecordFields,
|
||||
auditEntityRecords,
|
||||
File renamed without changes.
@@ -1,4 +1,4 @@
|
||||
import { ValidationError } from "../../core/errors.js";
|
||||
import { ValidationError } from "../../../core/errors.js";
|
||||
import type { DatalinkField } from "./types.js";
|
||||
|
||||
/** 物理键优先;标签和模糊匹配必须指向唯一物理字段。未知字段由调用方决定是否透传。 */
|
||||
@@ -1,37 +1,12 @@
|
||||
import type { KyInstance } from "ky";
|
||||
import * as api from "./api.js";
|
||||
import { ValidationError } from "../../core/errors.js";
|
||||
import { ValidationError } from "../../../core/errors.js";
|
||||
import { resolveDatalinkField } from "./fields.js";
|
||||
import type {
|
||||
DatalinkEntity,
|
||||
DatalinkField,
|
||||
DatalinkPlatformDetail,
|
||||
DatalinkRecord,
|
||||
DatalinkRecordEditPayload,
|
||||
DatalinkRecordPage,
|
||||
AggregateFieldStats,
|
||||
GroupAggregateResult,
|
||||
LedgerAggregateReport,
|
||||
ContinuityIssue,
|
||||
LedgerContinuityReport,
|
||||
NormalizedDatalinkRecord,
|
||||
DatalinkRecordStats,
|
||||
} from "./types.js";
|
||||
import type { DatalinkEntity, DatalinkField, DatalinkRecord, DatalinkRecordEditPayload, DatalinkRecordPage, AggregateFieldStats, GroupAggregateResult, LedgerAggregateReport, ContinuityIssue, LedgerContinuityReport, NormalizedDatalinkRecord, DatalinkRecordStats } from "./types.js";
|
||||
import type { DatalinkPlatformDetail } from "../applications/types.js";
|
||||
|
||||
export type { SafeRecordEditOptions } from "./api.js";
|
||||
|
||||
export function listPlatforms(...args: Parameters<typeof api.listPlatforms>) {
|
||||
return api.listPlatforms(...args);
|
||||
}
|
||||
|
||||
export function listAllPlatforms(...args: Parameters<typeof api.listAllPlatforms>) {
|
||||
return api.listAllPlatforms(...args);
|
||||
}
|
||||
|
||||
export function getPlatform(...args: Parameters<typeof api.getPlatform>) {
|
||||
return api.getPlatform(...args);
|
||||
}
|
||||
|
||||
export function listPlatformEntities(...args: Parameters<typeof api.listPlatformEntities>) {
|
||||
return api.listPlatformEntities(...args);
|
||||
}
|
||||
@@ -80,18 +55,6 @@ function matches(value: unknown, target: string): boolean {
|
||||
return typeof value === "string" && value.toLowerCase() === target.toLowerCase();
|
||||
}
|
||||
|
||||
export async function resolvePlatform(
|
||||
client: KyInstance,
|
||||
corpId: string,
|
||||
target: string
|
||||
): Promise<DatalinkPlatformDetail | undefined> {
|
||||
const platforms = await api.listPlatforms(client, corpId);
|
||||
const found = platforms.find((platform) =>
|
||||
[platform.id, platform.name, platform.code].some((value) => matches(value, target))
|
||||
);
|
||||
return found ? api.getPlatform(client, corpId, found.id) : undefined;
|
||||
}
|
||||
|
||||
export async function resolveEntity(
|
||||
client: KyInstance,
|
||||
corpId: string,
|
||||
@@ -133,7 +96,7 @@ export function formatServerFieldExpr(
|
||||
if (resolved?.type === "money") {
|
||||
const moneyPath = `${serverPath}.standard`;
|
||||
const num = Number(rawVal);
|
||||
const withDec = !Number.isNaN(num) && !rawVal.includes(".") ? `${rawVal}.00` : rawVal;
|
||||
const withDec = !Number.isNaN(num) && !rawVal.includes("../../datalink") ? `${rawVal}.00` : rawVal;
|
||||
if (op === "=" || op === "==") {
|
||||
if (withDec !== rawVal) {
|
||||
return `(${moneyPath}=="${escaped}"||${moneyPath}=="${withDec}")`;
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { PlatformSchema } from "../platform/types.js";
|
||||
import type { DatalinkPlatformDetail } from "../applications/types.js";
|
||||
|
||||
const NullableBoolean = z.boolean().nullable().optional();
|
||||
|
||||
@@ -68,13 +68,6 @@ export const DatalinkEntitySchema = z
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const DatalinkPlatformDetailSchema = PlatformSchema.passthrough().extend({
|
||||
staffIds: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
roleIds: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
departmentIds: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
departmentsIncludeChildren: z.boolean().nullish().transform((value) => value ?? false),
|
||||
});
|
||||
|
||||
export interface DatalinkRecordQuery {
|
||||
start?: number;
|
||||
count?: number;
|
||||
@@ -114,7 +107,7 @@ export interface DatalinkImportJob {
|
||||
|
||||
export type DatalinkField = z.infer<typeof DatalinkFieldSchema>;
|
||||
export type DatalinkEntity = z.infer<typeof DatalinkEntitySchema>;
|
||||
export type DatalinkPlatformDetail = z.infer<typeof DatalinkPlatformDetailSchema>;
|
||||
export type { DatalinkPlatformDetail } from "../applications/types.js";
|
||||
|
||||
export interface DatalinkPermissionSnapshot {
|
||||
platform: DatalinkPlatformDetail;
|
||||
@@ -1,3 +1,5 @@
|
||||
> 本模块归属自建应用平台;工作流模型、传输与编排现位于同级 `types.ts`、`api.ts`、`services.ts`,跨应用查询使用 applications 服务。上级入口见 [Platform 总览](../README.platform.md)。
|
||||
|
||||
# Workflow 工作流模块
|
||||
|
||||
Platform 域下工作流能力的命令、协议与诊断契约。总体边界见 [Platform 概览](../README.platform.md)。
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { WorkflowDetail, WorkflowTask } from "../../types.js";
|
||||
import type { WorkflowDetail, WorkflowTask } from "../types.js";
|
||||
import type {
|
||||
WorkflowAnalysis,
|
||||
WorkflowAstNode,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import type { WorkflowDetail, WorkflowTask } from "../../types.js";
|
||||
import type { WorkflowDetail, WorkflowTask } from "../types.js";
|
||||
import { analyzeWorkflow } from "./analyzer.js";
|
||||
|
||||
const selector = (key: unknown, label?: unknown) => `@{value('${JSON.stringify({ key, label })}')}`;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { analyzeWorkflow } from "./index.js";
|
||||
import { PlatformSchema } from "../../types.js";
|
||||
import { PlatformSchema } from "../../applications/types.js";
|
||||
|
||||
describe("Workflow static analysis", () => {
|
||||
it("accepts nullable app center metadata", () => {
|
||||
|
||||
File renamed without changes.
@@ -1,8 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import ky, { KyInstance } from "ky";
|
||||
import { AuthenticationError, BusinessError, EkbApiError } from "../../core/errors.js";
|
||||
import { AuthenticationError, BusinessError, EkbApiError } from "../../../core/errors.js";
|
||||
import {
|
||||
PlatformSchema,
|
||||
WorkflowPageSchema,
|
||||
WorkflowStatsSchema,
|
||||
WorkflowChargeSchema,
|
||||
@@ -87,19 +86,6 @@ async function ok(response: Response): Promise<{ success: boolean }> {
|
||||
return { success: response.status === 200 };
|
||||
}
|
||||
|
||||
// ── 自建应用 ──────────────────────────────────────────────────────────────────
|
||||
|
||||
export async function listPlatforms(
|
||||
client: KyInstance,
|
||||
corpId: string
|
||||
): Promise<import("./types.js").Platform[]> {
|
||||
const response = await client.get("api/v2/datalink/platform/search", {
|
||||
searchParams: { scope: "enable", corpId },
|
||||
});
|
||||
const json = (await response.json()) as { items: unknown[] };
|
||||
return z.array(PlatformSchema).parse(json.items);
|
||||
}
|
||||
|
||||
// ── 工作流(EASO)─────────────────────────────────────────────────────────────
|
||||
// 注意:EASO 客户端已自动注入 corpId,无需再传
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { WorkflowTaskExecution } from "../../types.js";
|
||||
import { indexExecutionContexts } from "../../execution-context.js";
|
||||
import type { WorkflowTaskExecution } from "../types.js";
|
||||
import { indexExecutionContexts } from "../execution-context.js";
|
||||
import type { ConditionBranchExplanation, ConditionRuleExplanation } from "./types.js";
|
||||
|
||||
export const OP_MAP: Record<string, string> = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { explainConditionBranches } from "./index.js";
|
||||
import type { WorkflowTaskExecution } from "../../types.js";
|
||||
import type { WorkflowTaskExecution } from "../types.js";
|
||||
|
||||
describe("Workflow Condition Branch Diagnosis", () => {
|
||||
const choose = (property = "value") => `@{choose('${JSON.stringify({ key: "source", properties: [{ key: property }] })}')}`;
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
isWorkflowActionCode,
|
||||
matchWorkflowAction,
|
||||
resolveWorkflowEnumOptions,
|
||||
} from "../services.js";
|
||||
} from "./services.js";
|
||||
import { analyzeWorkflow } from "./analysis/index.js";
|
||||
|
||||
describe("Workflow Action Enums & Diagnostics", () => {
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -12,7 +12,7 @@ import {
|
||||
displayNameLength,
|
||||
isDisplayNameTooLong,
|
||||
} from "./index.js";
|
||||
import type { WorkflowDetail, WorkflowTask } from "../../types.js";
|
||||
import type { WorkflowDetail, WorkflowTask } from "../types.js";
|
||||
|
||||
const mockWorkflow: WorkflowDetail = {
|
||||
id: "wf_test_100",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { WorkflowTask } from "../../types.js";
|
||||
import type { WorkflowTask } from "../types.js";
|
||||
import type { LocatedWorkflowTask } from "./types.js";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { WorkflowDetail, WorkflowTask } from "../../types.js";
|
||||
import type { WorkflowDetail, WorkflowTask } from "../types.js";
|
||||
import { NotFoundError, ValidationError } from "../../../../core/errors.js";
|
||||
import { findWorkflowTask } from "./locator.js";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { WorkflowTask } from "../../types.js";
|
||||
import type { WorkflowTask } from "../types.js";
|
||||
import type { FlattenedWorkflowTask } from "./types.js";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { WorkflowTask } from "../../types.js";
|
||||
import type { WorkflowTask } from "../types.js";
|
||||
|
||||
export interface FlattenedWorkflowTask {
|
||||
task: WorkflowTask;
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import type { KyInstance } from "ky";
|
||||
import { z } from "zod";
|
||||
import { AuthenticationError, EkbApiError } from "../../core/errors.js";
|
||||
import { classifyCliError } from "../../cli/errors.js";
|
||||
import { AuthenticationError, EkbApiError } from "../../../core/errors.js";
|
||||
import { classifyCliError } from "../../../cli/errors.js";
|
||||
import { listRunningJobs, unwrap } from "./api.js";
|
||||
import { watchWorkflowPipeline } from "./workflow/watch/pipeline-watcher.js";
|
||||
import { watchWorkflowPipeline } from "./watch/pipeline-watcher.js";
|
||||
|
||||
const responding = (body: unknown) => ({ get: async () => Response.json(body) }) as unknown as KyInstance;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EkbError } from "../../../core/errors.js";
|
||||
import type { WorkflowDetail } from "../types.js";
|
||||
import type { WorkflowDetail } from "./types.js";
|
||||
|
||||
/** 主保存已经提交,后续元数据刷新失败。调用方必须保留已保存版本。 */
|
||||
export class WorkflowSavePartialError extends EkbError {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
executeJavaScriptSandbox,
|
||||
executeMvelSandbox,
|
||||
} from "./index.js";
|
||||
import type { WorkflowDetail } from "../../types.js";
|
||||
import type { WorkflowDetail } from "../types.js";
|
||||
|
||||
describe("workflow-script - 本地静态语法校验与沙箱仿真引擎", () => {
|
||||
describe("hasReturnStatement", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { WorkflowTask } from "../../types.js";
|
||||
import type { WorkflowTask } from "../types.js";
|
||||
import type { ScriptIssue } from "./types.js";
|
||||
import { hasMvelFinalExpression } from "./mvel-subset.js";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { WorkflowDetail, WorkflowTask } from "../../types.js";
|
||||
import type { WorkflowDetail, WorkflowTask } from "../types.js";
|
||||
import type { NodeScriptLintReport, WorkflowScriptLintReport, ScriptIssue } from "./types.js";
|
||||
import { lintJavaScriptCode } from "./lint-js.js";
|
||||
import { lintMvelCode, collectAllWorkflowNodeNames } from "./lint-mvel.js";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { listBasicPlatforms } from "../applications/services.js";
|
||||
import { KyInstance } from "ky";
|
||||
import { CorpConfig } from "../../core/config/types.js";
|
||||
import { WorkflowSavePartialError } from "./workflow/save-error.js";
|
||||
import { CorpConfig } from "../../../core/config/types.js";
|
||||
import { WorkflowSavePartialError } from "./save-error.js";
|
||||
import * as api from "./api.js";
|
||||
import { PermissionError, ValidationError } from "../../core/errors.js";
|
||||
import { explainConditionBranches } from "./workflow/branch/index.js";
|
||||
import { PermissionError, ValidationError } from "../../../core/errors.js";
|
||||
import { explainConditionBranches } from "./branch/index.js";
|
||||
import { indexExecutionContexts } from "./execution-context.js";
|
||||
import {
|
||||
Platform,
|
||||
WorkflowSummary,
|
||||
WorkflowListAllError,
|
||||
WorkflowTask,
|
||||
@@ -21,16 +21,12 @@ import {
|
||||
NodeExecutionDiff,
|
||||
} from "./types.js";
|
||||
|
||||
export interface PlatformClients {
|
||||
export interface WorkflowClients {
|
||||
corp: CorpConfig;
|
||||
ekbClient: KyInstance;
|
||||
easoClient: KyInstance;
|
||||
}
|
||||
|
||||
export function listPlatforms(...args: Parameters<typeof api.listPlatforms>) {
|
||||
return api.listPlatforms(...args);
|
||||
}
|
||||
|
||||
export function listWorkflows(...args: Parameters<typeof api.listWorkflows>) {
|
||||
return api.listWorkflows(...args);
|
||||
}
|
||||
@@ -309,14 +305,14 @@ export interface ListAllWorkflowsResult {
|
||||
}
|
||||
|
||||
export async function listAllWorkflows(
|
||||
clients: PlatformClients,
|
||||
clients: WorkflowClients,
|
||||
options: ListAllWorkflowsOptions = {}
|
||||
): Promise<ListAllWorkflowsResult> {
|
||||
const { ekbClient, easoClient, corp } = clients;
|
||||
const page = options.page ?? 1;
|
||||
const pageSize = options.pageSize ?? 20;
|
||||
|
||||
const platforms = await api.listPlatforms(ekbClient, corp.credentials.corpId);
|
||||
const platforms = await listBasicPlatforms(ekbClient, corp.credentials.corpId);
|
||||
const enabledPlatforms = platforms.filter((p) => p.active !== false);
|
||||
|
||||
const workflows: WorkflowSummary[] = [];
|
||||
@@ -381,7 +377,7 @@ export interface FindWorkflowsByTaskTypeResult {
|
||||
}
|
||||
|
||||
export async function findWorkflowsByTaskType(
|
||||
clients: PlatformClients,
|
||||
clients: WorkflowClients,
|
||||
taskType: string,
|
||||
options: FindWorkflowsByTaskTypeOptions = {}
|
||||
): Promise<FindWorkflowsByTaskTypeResult> {
|
||||
@@ -967,7 +963,7 @@ export {
|
||||
explainConditionBranches,
|
||||
type ConditionBranchExplanation,
|
||||
type ConditionRuleExplanation,
|
||||
} from "./workflow/branch/index.js";
|
||||
} from "./branch/index.js";
|
||||
|
||||
export {
|
||||
classifyWorkflowTrigger,
|
||||
@@ -1009,7 +1005,7 @@ export async function resolveWorkflowEnumOptions(
|
||||
}
|
||||
|
||||
if (thirdId.toLowerCase() === "action") {
|
||||
const { SYSTEM_WORKFLOW_ACTION_ENUMS } = await import("./workflow/enums.js");
|
||||
const { SYSTEM_WORKFLOW_ACTION_ENUMS } = await import("./enums.js");
|
||||
return SYSTEM_WORKFLOW_ACTION_ENUMS.map((item) => ({
|
||||
code: item.code,
|
||||
label: item.label,
|
||||
@@ -1066,7 +1062,7 @@ export async function grantWorkflowNodes(
|
||||
}
|
||||
|
||||
// 2. 节点清洗与归一化(将可能传入的中文名映射为标准的 node type)
|
||||
const { findGrayNode } = await import("./workflow/nodes/gray-nodes-catalog.js");
|
||||
const { findGrayNode } = await import("./nodes/gray-nodes-catalog.js");
|
||||
const normalizedNodes = options.nodes.map((node) => {
|
||||
const matched = findGrayNode(node);
|
||||
return matched ? matched.type : node.trim();
|
||||
@@ -1091,4 +1087,4 @@ export async function grantWorkflowNodes(
|
||||
return result;
|
||||
}
|
||||
|
||||
export * from "./workflow/index.js";
|
||||
export * from "./index.js";
|
||||
File renamed without changes.
@@ -8,8 +8,8 @@ import {
|
||||
hasWorkflowVersionConflict,
|
||||
patchWorkflowDraft,
|
||||
} from "./index.js";
|
||||
import { WorkflowDetailSchema } from "../../types.js";
|
||||
import type { WorkflowDetail } from "../../types.js";
|
||||
import { WorkflowDetailSchema } from "../types.js";
|
||||
import type { WorkflowDetail } from "../types.js";
|
||||
import {
|
||||
getExecutionLogs,
|
||||
getJob,
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
listWorkflowSnapshots,
|
||||
listWorkflowLogs,
|
||||
toggleWorkflow,
|
||||
} from "../../api.js";
|
||||
} from "../api.js";
|
||||
import {
|
||||
extractFailureExecutions,
|
||||
findExecutionNode,
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
isTaskExecutionFailed,
|
||||
updateWorkflow,
|
||||
sanitizeWorkflowSnapshot,
|
||||
} from "../../services.js";
|
||||
} from "../services.js";
|
||||
import { AuthenticationError, EkbApiError } from "../../../../core/errors.js";
|
||||
import { WorkflowAlertStore } from "../alert/index.js";
|
||||
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NotFoundError, ValidationError } from "../../../../core/errors.js";
|
||||
import type { WorkflowDetail } from "../../types.js";
|
||||
import type { WorkflowDetail } from "../types.js";
|
||||
|
||||
export type WorkflowDraftStatus = "clean" | "dirty" | "saving" | "saved" | "partial" | "failed";
|
||||
|
||||
|
||||
File renamed without changes.
@@ -1,26 +1,5 @@
|
||||
import { z } from "zod";
|
||||
|
||||
// ── 自建应用(DataLink Platform)─────────────────────────────
|
||||
|
||||
export const PlatformSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
nameSpell: z.string().default(""),
|
||||
enName: z.string().nullable().optional(),
|
||||
code: z.string().default(""),
|
||||
corporationId: z.string(),
|
||||
active: z.boolean().default(true),
|
||||
type: z.string().default(""),
|
||||
groupType: z.string().default(""),
|
||||
platformType: z.string().default(""),
|
||||
source: z.string().default(""),
|
||||
adminIds: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
desc: z.string().nullable().optional(),
|
||||
importMethod: z.array(z.string()).nullish().transform((value) => value ?? []),
|
||||
createTime: z.number().default(0),
|
||||
updateTime: z.number().default(0),
|
||||
});
|
||||
|
||||
// ── 工作流任务节点(递归、按类型区分)─────────────────────────────────────────
|
||||
|
||||
export const BaseTaskSchema = z.object({
|
||||
@@ -561,7 +540,6 @@ export const WorkflowWithMatchesSchema = WorkflowSummarySchema.extend({
|
||||
|
||||
// ── 类型导出 ──────────────────────────────────────────────────────────────────
|
||||
|
||||
export type Platform = z.infer<typeof PlatformSchema>;
|
||||
export type FilterGroup = z.infer<typeof FilterGroupSchema>;
|
||||
export type WorkflowState = z.infer<typeof WorkflowStateSchema>;
|
||||
export type Workflow = z.infer<typeof WorkflowSchema>;
|
||||
@@ -727,7 +705,7 @@ export interface WorkflowTestReport {
|
||||
triggerLabel?: string;
|
||||
executionTree: WorkflowTaskExecution[];
|
||||
failedExecutions: WorkflowTaskExecution[];
|
||||
conditionDiagnoses: import("./workflow/branch/index.js").ConditionBranchExplanation[];
|
||||
conditionDiagnoses: import("./branch/index.js").ConditionBranchExplanation[];
|
||||
}
|
||||
|
||||
// ── 触发器元类型分类与智能路径路由 ───────────────────────────────────────────────
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { WorkflowJobDetail, WorkflowTaskExecution } from "../../types.js";
|
||||
import type { WorkflowJobDetail, WorkflowTaskExecution } from "../types.js";
|
||||
|
||||
export const TERMINAL_STATES = new Set(["COMPLETED", "FAILED", "STOP", "STOPPED", "CANCELLED", "CANCELED"]);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
watchWorkflowPipeline,
|
||||
type WorkflowWatchEvent,
|
||||
} from "./index.js";
|
||||
import type { WorkflowTaskExecution } from "../../types.js";
|
||||
import type { WorkflowTaskExecution } from "../types.js";
|
||||
|
||||
describe("workflow-watch - 实时监控与日志流跟踪引擎", () => {
|
||||
describe("TaskExecutionTracker", () => {
|
||||
|
||||
Loaded 100 of 107 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user