feat(workflow): 新增 workflow link 免密直达命令并补齐 108 个官方节点模型

1. 工作流设计器免密直达命令 (workflow link / url / web):
   - 接入合思 EASO Realm 动态换取三段式 JWT 凭证;
   - 自动解析目标工作流所属企业、员工身份与自建应用平台名称;
   - 包含高特权安全警告、有效期限与一键点击直达链接;
   - 支持结构化 --json 输出。
2. 节点原子模型 108 个全量覆盖:
   - 新增 trigger.ts (18 触发器)、integration.ts (第三方与定制数据)、invoice-tmc.ts (发票与差旅)、requisition.ts (事项与易商卡);
   - 统一由 models/nodes/index.ts 导出并重新生成 specs/workflow-schema.json,实现官方 108 个节点 100% 强类型覆盖。
3. 质量与文档保障:
   - 补充 workflow link 单元测试并通过全量 968 项测试与 tsc 校验;
   - 更新 README 文档与 command-metadata 注册表。
This commit is contained in:
gitea committed 2026-11-03 10:55:51 +08:00
1 parent c620f9ccfb
commit f033c66147
16 files changed
+8716 -44

No files matched your search

+8037 -30
View File
File diff suppressed because it is too large. Load diff
+5 -2
View File
@@ -221,7 +221,8 @@ export const COMMAND_METADATA: Record<string, CliCommandMetadata> = {
"enum": "查询在线枚举字典(不可用时使用内置字典)",
"lint-script": "静态检查 JavaScript / MVEL 脚本",
"eval-script": "在本地沙箱中模拟执行脚本",
"webhook": "向工作流 Webhook 触发器发送测试数据 (别名: webhook-send)"
"webhook": "向工作流 Webhook 触发器发送测试数据 (别名: webhook-send)",
"link": "生成工作流设计器 (Piper) 免密直达链接 (包含特权警告)"
},
"options": [
"--flow=<单号> 指定测试单据",
@@ -274,7 +275,9 @@ export const COMMAND_METADATA: Record<string, CliCommandMetadata> = {
"dictionary": "enum",
"dict": "enum",
"webhook-send": "webhook",
"webhooks": "webhook"
"webhooks": "webhook",
"url": "link",
"web": "link"
},
flags: { ...flagList("all allow-prod allow-production auto-publish autoPublish compare detail diff empty errors f fail fail-on-alert failOnAlert failed failed-only failedOnly follow force force-write forceWrite full has-error hasError in-place inPlace includeDetail json none once publish snapshot v value-json valueJson verbose with-tasks withTasks timeline progress steps", "boolean"), ...flagList("a admin-key adminKey after app app-id appId b bill body c code code-file container count d data desc description display display-name displayName end-time endTime entity execution-logs field file filter flow flow-code flowCode from i id input input-file insert-after interval job job-id job1 job2 jobA jobB jobId json-file keyword l label limit log logs mapping mapping-file max-jobs maxJobs n name node node-id nodeId nodes output output-file outputFile p page page-size pageSize parent parent-id parentId password path payload pipeline pipeline-id pipelineId platform platform-id platformId pwd q query record s sample sample-id sampleId seconds set size sleep-time sleepTime snapshot1 snapshot2 snapshotA snapshotB source start-time startTime state state-file stateFile t target targetName targetPlatformId task taskType third-id thirdId timeout timeout-ms timeoutMs to trigger type types value workflowId", "value") }
},
+85
View File
@@ -2331,5 +2331,90 @@ describe("CLI - workflow list 轻量化与名称搜索", () => {
expect(data.workflows[0].pipelineName).toBe("待摊台账拆分计划");
expect(data.totalWorkflows).toBe(1);
});
it("workflow link 生成高特权免密直达链接并输出安全警告与自建应用信息", async () => {
const mockSessionClient = {
get: () => ({
json: async () => ({ id: "mock.jwt.token" }),
}),
};
spies.push(
spyOn(helpers, "createClientsForCorp").mockResolvedValue({
sessionClient: mockSessionClient,
} as any),
spyOn(platformServices, "listAllWorkflows").mockResolvedValue({
workflows: [
{
id: "wf_001",
pipelineName: "待摊台账拆分计划",
platformId: "app_platform_1",
platformName: "商机台账",
state: 1,
},
] as any,
errors: [],
})
);
const res = await handleWorkflowCommand(
{
area: "workflow",
action: "link",
args: ["wf_001"],
options: {},
raw: ["workflow", "link", "wf_001"],
},
mockRuntime
);
expect(res.exitCode).toBe(0);
expect(res.stdout).toContain("【高特权免密直达警告】");
expect(res.stdout).toContain("所属自建应用 : 商机台账 (app_platform_1)");
expect(res.stdout).toContain("目标工作流 : 待摊台账拆分计划 (wf_001)");
expect(res.stdout).toContain("https://piper.ekuaibao.com/#/workflow/wf_001?jwtToken=mock.jwt.token&$platformId=app_platform_1");
});
it("workflow link --json 返回结构化授权链接与警告信息", async () => {
const mockSessionClient = {
get: () => ({
json: async () => ({ id: "mock.jwt.token" }),
}),
};
spies.push(
spyOn(helpers, "createClientsForCorp").mockResolvedValue({
sessionClient: mockSessionClient,
} as any),
spyOn(platformServices, "listAllWorkflows").mockResolvedValue({
workflows: [
{
id: "wf_001",
pipelineName: "待摊台账拆分计划",
platformId: "app_platform_1",
platformName: "商机台账",
state: 1,
},
] as any,
errors: [],
})
);
const res = await handleWorkflowCommand(
{
area: "workflow",
action: "link",
args: ["wf_001"],
options: { json: true },
raw: ["workflow", "link", "wf_001", "--json"],
},
{ ...mockRuntime, jsonMode: true }
);
expect(res.exitCode).toBe(0);
const data = JSON.parse(res.stdout);
expect(data.pipelineId).toBe("wf_001");
expect(data.platformName).toBe("商机台账");
expect(data.jwtToken).toBe("mock.jwt.token");
expect(data.warning).toContain("特权");
});
});
@@ -15,6 +15,7 @@
| [analyze.ts](./analyze.ts)、[check.ts](./check.ts)、[diff.ts](./diff.ts) | 静态分析、健康检查与配置/执行差异 |
| [script.ts](./script.ts)、[test.ts](./test.ts) | 脚本校验、求值与工作流测试 |
| [tail.ts](./tail.ts)、[webhook.ts](./webhook.ts)、[enum.ts](./enum.ts) | 执行监听、Webhook 与业务枚举 |
| [link.ts](./link.ts) | 工作流设计器 (Piper) 免密直达链接签发与高特权安全警告 |
## 保存和执行契约
+6 -1
View File
@@ -16,6 +16,7 @@ import { handleWorkflowTailCommand } from "./tail.js";
import { handleWorkflowLintScript, handleWorkflowEvalScript } from "./script.js";
import { handleWorkflowEnum } from "./enum.js";
import { handleWebhookCommand } from "./webhook.js";
import { handleWorkflowLink } from "./link.js";
export async function handleWorkflowCommand(
parsed: CliParsedArgs,
@@ -121,10 +122,14 @@ export async function handleWorkflowCommand(
case "webhook-send":
case "webhooks":
return handleWebhookCommand(parsed, runtime);
case "link":
case "url":
case "web":
return handleWorkflowLink(parsed, runtime);
default:
return {
stdout: "",
stderr: `未知 workflow 子命令: ${action}。支持: list, get, find, analyze, toggle, publish, patch, save, refresh-chooses, history, logs, job, diff, diff-job, check, test, copy, create, delete, node, tail, lint-script, eval-script, enum, webhook\n`,
stderr: `未知 workflow 子命令: ${action}。支持: list, get, find, analyze, toggle, publish, patch, save, refresh-chooses, history, logs, job, diff, diff-job, check, test, copy, create, delete, node, tail, lint-script, eval-script, enum, webhook, link\n`,
exitCode: 1,
};
}
+135
View File
@@ -0,0 +1,135 @@
import { stringOption } from "../../parser.js";
import { printJson } from "../../printer.js";
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
import { createClientsForCorp } from "../../helpers.js";
import { listAllWorkflows } from "../../../domains/platform/workflow/services.js";
// ── 工作流设计器 (Piper) 免密直达链接签发 ────────────────────────────────────
export async function handleWorkflowLink(
parsed: CliParsedArgs,
runtime: CliRuntime
): Promise<CliResult> {
const corp = runtime.selectedCorp!;
const pipelineId =
parsed.args[0] ||
stringOption(parsed.options, ["id", "pipelineId", "workflowId", "pipeline"]);
if (!pipelineId) {
return {
stdout: "",
stderr: [
"请提供工作流 ID: hose-use workflow link <pipelineId> [选项]",
"",
"常用选项:",
" --corp=<corpId> 指定企业 (默认当前企业)",
" --platform-id=<platformId> 指定所属自建应用 ID (可选,默认自动识别)",
" --json 输出结构化 JSON 格式",
"",
"示例:",
" hose-use workflow link 881196955148578838",
].join("\n") + "\n",
exitCode: 1,
};
}
const clients = await createClientsForCorp(corp);
// 1. 查询工作流元数据及所属自建应用平台信息
let platformId = stringOption(parsed.options, ["platform-id", "platformId", "app-id", "appId"]);
let platformName = "";
let pipelineName = "";
let workflowState: number | undefined;
try {
const all = await listAllWorkflows(clients, { page: 1, pageSize: 100 });
const match = all.workflows.find((w) => w.id === pipelineId);
if (match) {
pipelineName = match.pipelineName || "";
platformId = platformId || match.platformId || "";
platformName = match.platformName || "";
workflowState = match.state;
}
} catch {
// 容错降级
}
platformId = platformId || corp.corpId || corp.id;
// 2. 向 EASO Realm 申请专属 3 段式 JWT 授权凭据
let jwt = "";
try {
const jwtRes = await clients.sessionClient.get("api/engine/realm/$EASO/actions/jwt", {
searchParams: { corpId: corp.corpId || corp.id },
}).json<{ id: string }>();
jwt = jwtRes.id;
} catch (err) {
const errMsg = err instanceof Error ? err.message : String(err);
return {
stdout: "",
stderr: `获取 EASO JWT 授权凭据失败: ${errMsg}\n请确认当前会话是否有效或重新登录。\n`,
exitCode: 1,
};
}
const directUrl = `https://piper.ekuaibao.com/#/workflow/${pipelineId}?jwtToken=${jwt}&$platformId=${encodeURIComponent(platformId)}`;
if (runtime.jsonMode) {
const output = {
pipelineId,
pipelineName: pipelineName || pipelineId,
corpId: corp.corpId || corp.id,
corpName: corp.name,
env: corp.env || (corp.isTest ? "test" : "prod"),
staffId: corp.staffId,
staffName: corp.staffName || corp.staffId,
platformId,
platformName: platformName || "自建应用",
state: workflowState,
jwtToken: jwt,
url: directUrl,
warning: "⚠️ 该直达链接具备以当前员工身份免密直接访问和修改工作流的最高特权,严禁外泄!",
};
return {
stdout: printJson(output, runtime.outputOptions),
stderr: "",
exitCode: 0,
};
}
const envTag = corp.isTest ? "🧪 测试环境" : "🚨 生产环境";
const stateText =
workflowState === 1
? "🟢 启用中 (state=1)"
: workflowState === 0
? "⚪ 停用/草稿 (state=0)"
: "未知";
const lines = [
"⚠️ 【高特权免密直达警告】(HIGH PRIVILEGE DIRECT ACCESS WARNING)",
" ----------------------------------------------------------------------",
" • 该链接包含有效 3 段式 EASO JWT 授权凭证,在浏览器中打开即直接以当前员工身份进入!",
" • 具有对该工作流的所有节点配置、代码脚本、版本发布及运行实例的完全编辑/删除/调试权限!",
" • 严禁将该链接发送到群聊、公开工单或不受信渠道;使用完毕后请及时关闭会话标签页。",
" ----------------------------------------------------------------------",
"",
"====== 合思工作流设计器 (Piper) 免密直达链接 ======",
` 企业名称 : ${corp.name} (${corp.corpId || corp.id}) [${envTag}]`,
` 操作人身份 : ${corp.staffName || "未指定姓名"} (${corp.staffId})`,
` 所属自建应用 : ${platformName ? `${platformName} (${platformId})` : platformId}`,
` 目标工作流 : ${pipelineName ? `${pipelineName} (${pipelineId})` : pipelineId}`,
` 当前流程状态 : ${stateText}`,
" 凭证有效时长 : 约 2 小时 (由合思 EASO Realm 动态颁发)",
"",
" 直达链接:",
` ${directUrl}`,
"",
`Markdown 直达: [打开「${platformName || "工作流"}」设计器 (${pipelineName || pipelineId} - ${corp.staffName || "免密"})](${directUrl})`,
];
return {
stdout: `${lines.join("\n")}\n`,
stderr: "",
exitCode: 0,
};
}
@@ -11,9 +11,10 @@
| [delay.ts](./delay.ts) | 动态延迟等待节点(`task-dynamic-delay` / `sleepTime`) |
| [code.ts](./code.ts) | 脚本代码节点(MVEL `code` / JavaScript `code-js2`) |
| [webhook.ts](./webhook.ts) | Webhook 外部触发器节点(`sampleId` / `urlPath`) |
| [trigger.ts](./trigger.ts) | 工作流官方触发器全家桶(`clock`、`start`、单据与台账变更触发器等 18 类) |
| [stop.ts](./stop.ts) | 终止流程控制节点(`stop`) |
| [flow.ts](./flow.ts) | 单据操作节点(`flow-detail` 查询详情 / `flow-create-task` 创建单据 / `flow-update-task` / `recalculate-the-approval-flow`) |
| [datalink.ts](./datalink.ts) | 数据连接台账与转换节点(`ekuaibao-datalink-filter`、`create` 与 `data-convert`) |
| [flow.ts](./flow.ts) | 单据操作节点(`flow-detail` 查询详情 / `flow-create-task` 创建单据 / `flow-update-task` / `recalculate-the-approval-flow` 等) |
| [datalink.ts](./datalink.ts) | 数据连接台账与转换节点(`ekuaibao-datalink-filter`、`create`、`edit` 与 `data-convert`) |
| [condition.ts](./condition.ts) | 条件分支控制节点工厂(`createConditionTaskSchema`) |
| [every.ts](./every.ts) | 依次执行循环控制节点工厂(`createEveryTaskSchema`) |
| [control.ts](./control.ts) | 流程控制节点工厂(`if`、`loop`、`while`、`amortization`、`apportion`) |
@@ -21,6 +22,9 @@
| [ai.ts](./ai.ts) | AI 智能匹配、提取与大模型节点(`ai-classification`、`ai-extraction`、`ai-attachment`、`ekb-ai`、`dify` 等) |
| [org.ts](./org.ts) | 组织架构人员与部门节点(`ekuaibao-staff-filter`、`ekuaibao-staff-detail`、`staff-create`、`department-create` 等) |
| [utility.ts](./utility.ts) | 基础通用工具节点(`excel` 导出表格、`aggregation` 分类汇总、`flow-format`、`task-log` 流程日志、`dmn` 等) |
| [integration.ts](./integration.ts) | 第三方系统集成与定制数据节点(NetSuite、纷享销客、易桥、天润工单、招商银行等) |
| [invoice-tmc.ts](./invoice-tmc.ts) | 发票验真巡检与差旅/TMC行程数据节点(`invoice-verification`、`invoice-inspector` 等) |
| [requisition.ts](./requisition.ts) | 申请事项与易商卡/随手记节点(`ekuaibao-requision-detail`、`ekuaibao-ecard-fee-filter` 等) |
| [unknown.ts](./unknown.ts) | 兜底节点模型(未知节点类型全透传) |
| [index.ts](./index.ts) | 实例化递归容器节点、聚合统一 `WorkflowTaskSchema` 并集中导出 |
@@ -10,10 +10,18 @@ export const CodeTaskSchema = BaseTaskSchema.extend({
export const CodeJs2TaskSchema = BaseTaskSchema.extend({
type: z.literal("code-js2"),
code: z.string(),
code: z.string().optional(),
mapping: z.array(z.object({ key: z.string(), value: z.string() })).optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export const CodeJsTaskSchema = BaseTaskSchema.extend({
type: z.literal("code-js"),
code: z.string().optional(),
mapping: z.array(z.object({ key: z.string(), value: z.string() })).optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export type CodeTask = z.infer<typeof CodeTaskSchema>;
export type CodeJs2Task = z.infer<typeof CodeJs2TaskSchema>;
export type CodeJsTask = z.infer<typeof CodeJsTaskSchema>;
@@ -24,20 +24,32 @@ export const EkuaibaoDatalinkCreateTaskSchema = BaseTaskSchema.extend({
fields: z.array(FieldMappingSchema),
filters: z.array(z.any()),
combineFilters: FilterGroupSchema,
onError: OnErrorSchema.optional(),
}).passthrough();
export const EkuaibaoDatalinkEditTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-datalink-edit"),
mode: z.string().optional(),
entityId: z.string().optional(),
fields: z.array(FieldMappingSchema).optional(),
filters: z.array(z.any()).optional(),
combineFilters: FilterGroupSchema.optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export const DataConvertTaskSchema = BaseTaskSchema.extend({
type: z.literal("data-convert"),
mode: z.string(),
path: z.array(z.string()),
fields: z.array(z.object({ key: z.string(), value: z.string() })),
mode: z.string().optional(),
path: z.array(z.string()).optional(),
fields: z.array(z.object({ key: z.string(), value: z.string() })).optional(),
onError: OnErrorSchema.optional(),
subType: z.string(),
itemType: z.string(),
targetType: z.string(),
feeFormType: z.string(),
subType: z.string().optional(),
itemType: z.string().optional(),
targetType: z.string().optional(),
feeFormType: z.string().optional(),
}).passthrough();
export type EkuaibaoDatalinkFilterTask = z.infer<typeof EkuaibaoDatalinkFilterTaskSchema>;
export type EkuaibaoDatalinkCreateTask = z.infer<typeof EkuaibaoDatalinkCreateTaskSchema>;
export type EkuaibaoDatalinkEditTask = z.infer<typeof EkuaibaoDatalinkEditTaskSchema>;
export type DataConvertTask = z.infer<typeof DataConvertTaskSchema>;
@@ -43,8 +43,35 @@ export const FlowListTaskSchema = BaseTaskSchema.extend({
onError: OnErrorSchema.optional(),
}).passthrough();
export const FlowDetailVersionedTaskSchema = BaseTaskSchema.extend({
type: z.literal("flow-detail-versioned"),
specificationId: z.string().optional(),
flowCode: z.string().optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export const FlowSampleListTaskSchema = BaseTaskSchema.extend({
type: z.literal("flow-sample-list"),
specificationId: z.string().optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export const EbotApprovalFlowTaskSchema = BaseTaskSchema.extend({
type: z.literal("ebot-approval-flow"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const RiskTaskSchema = BaseTaskSchema.extend({
type: z.literal("risk"),
onError: OnErrorSchema.optional(),
}).passthrough();
export type FlowDetailTask = z.infer<typeof FlowDetailTaskSchema>;
export type FlowCreateTask = z.infer<typeof FlowCreateTaskSchema>;
export type FlowUpdateTask = z.infer<typeof FlowUpdateTaskSchema>;
export type RecalculateApprovalFlowTask = z.infer<typeof RecalculateApprovalFlowTaskSchema>;
export type FlowListTask = z.infer<typeof FlowListTaskSchema>;
export type FlowDetailVersionedTask = z.infer<typeof FlowDetailVersionedTaskSchema>;
export type FlowSampleListTask = z.infer<typeof FlowSampleListTaskSchema>;
export type EbotApprovalFlowTask = z.infer<typeof EbotApprovalFlowTaskSchema>;
export type RiskTask = z.infer<typeof RiskTaskSchema>;
@@ -10,6 +10,25 @@ import {
createApportionTaskSchema,
} from "./control.js";
import { WebhookTaskSchema } from "./webhook.js";
import {
ClockTriggerTaskSchema,
StartTriggerTaskSchema,
FlowChangeTriggerTaskSchema,
EkuaibaoFlowformTriggerTaskSchema,
EkuaibaoDatalinkCreateTriggerTaskSchema,
EkuaibaoDatalinkChangeTriggerTaskSchema,
EkuaibaoDatalinkTimeTriggerTaskSchema,
DatalinkButtonTriggerTaskSchema,
FxiaokeTriggerTaskSchema,
XrxsTriggerTaskSchema,
EkuaibaoTmcDatalinkCreateTriggerTaskSchema,
EkuaibaoTmcDatalinkChangeTriggerTaskSchema,
EkuaibaoTmcDatalinkTimeTriggerTaskSchema,
EkuaibaoEbotTriggerTaskSchema,
OtherEventTriggerTaskSchema,
HabTriggerTaskSchema,
EkuaibaoRequisitionTriggerTaskSchema,
} from "./trigger.js";
import { StopTaskSchema } from "./stop.js";
import { HttpTaskSchema } from "./http.js";
import {
@@ -18,11 +37,16 @@ import {
FlowUpdateTaskSchema,
RecalculateApprovalFlowTaskSchema,
FlowListTaskSchema,
FlowDetailVersionedTaskSchema,
FlowSampleListTaskSchema,
EbotApprovalFlowTaskSchema,
RiskTaskSchema,
} from "./flow.js";
import { CodeTaskSchema, CodeJs2TaskSchema } from "./code.js";
import { CodeTaskSchema, CodeJs2TaskSchema, CodeJsTaskSchema } from "./code.js";
import {
EkuaibaoDatalinkFilterTaskSchema,
EkuaibaoDatalinkCreateTaskSchema,
EkuaibaoDatalinkEditTaskSchema,
DataConvertTaskSchema,
} from "./datalink.js";
import { DynamicDelayTaskSchema } from "./delay.js";
@@ -57,6 +81,7 @@ import {
EkuaibaoDepartmentUpdateTaskSchema,
FeishuDepartmentFilterTaskSchema,
WecomDepartmentTaskSchema,
TaskDynamicDingAttendanceTaskSchema,
SearchStaffByRoleTaskSchema,
RoleUpdateTaskSchema,
} from "./org.js";
@@ -74,6 +99,35 @@ import {
UiNotificationTaskSchema,
OutputTaskSchema,
} from "./utility.js";
import {
EBridgeMapDataTaskSchema,
EBridgeAuthTaskSchema,
FxiaokeAuthTaskSchema,
FxiaokeListTaskSchema,
NetsuiteSyncTaskSchema,
NetsuiteCreateTaskSchema,
NetsuiteDeleteTaskSchema,
TrSelectTaskSchema,
TrCommentTaskSchema,
TrDetailTaskSchema,
TaskZsTaskSchema,
EscapeTaskSchema,
HlDetailTaskSchema,
HlTaskSchema,
MappingDetailTaskSchema,
} from "./integration.js";
import {
InvoiceVerificationTaskSchema,
EkuaibaoInvoiceInspectorTaskSchema,
EkuaibaoInvoiceDatalinkFilterTaskSchema,
EkuaibaoTmcDatalinkFilterTaskSchema,
} from "./invoice-tmc.js";
import {
EkuaibaoRequisitionDetailTaskSchema,
EkuaibaoEcardFeeFilterTaskSchema,
EkuaibaoEcardRequisitionFilterTaskSchema,
EkuaibaoEcardFeeDetailFilterTaskSchema,
} from "./requisition.js";
import { UnknownTaskSchema } from "./unknown.js";
// 导出所有基础与分类模型
@@ -82,6 +136,7 @@ export * from "./http.js";
export * from "./delay.js";
export * from "./code.js";
export * from "./webhook.js";
export * from "./trigger.js";
export * from "./stop.js";
export * from "./flow.js";
export * from "./datalink.js";
@@ -92,6 +147,9 @@ export * from "./message.js";
export * from "./ai.js";
export * from "./org.js";
export * from "./utility.js";
export * from "./integration.js";
export * from "./invoice-tmc.js";
export * from "./requisition.js";
export * from "./unknown.js";
// 递归容器节点 Schema 实例化
@@ -106,6 +164,23 @@ export const ApportionTaskSchema: z.ZodType<WorkflowTask> = createApportionTaskS
// 统一任务节点联合 Schema
export const WorkflowTaskSchema: z.ZodType<WorkflowTask> = z.union([
WebhookTaskSchema,
ClockTriggerTaskSchema,
StartTriggerTaskSchema,
FlowChangeTriggerTaskSchema,
EkuaibaoFlowformTriggerTaskSchema,
EkuaibaoDatalinkCreateTriggerTaskSchema,
EkuaibaoDatalinkChangeTriggerTaskSchema,
EkuaibaoDatalinkTimeTriggerTaskSchema,
DatalinkButtonTriggerTaskSchema,
FxiaokeTriggerTaskSchema,
XrxsTriggerTaskSchema,
EkuaibaoTmcDatalinkCreateTriggerTaskSchema,
EkuaibaoTmcDatalinkChangeTriggerTaskSchema,
EkuaibaoTmcDatalinkTimeTriggerTaskSchema,
EkuaibaoEbotTriggerTaskSchema,
OtherEventTriggerTaskSchema,
HabTriggerTaskSchema,
EkuaibaoRequisitionTriggerTaskSchema,
ConditionTaskSchema,
EveryTaskSchema,
IfTaskSchema,
@@ -120,10 +195,16 @@ export const WorkflowTaskSchema: z.ZodType<WorkflowTask> = z.union([
FlowUpdateTaskSchema,
RecalculateApprovalFlowTaskSchema,
FlowListTaskSchema,
FlowDetailVersionedTaskSchema,
FlowSampleListTaskSchema,
EbotApprovalFlowTaskSchema,
RiskTaskSchema,
CodeTaskSchema,
CodeJs2TaskSchema,
CodeJsTaskSchema,
EkuaibaoDatalinkFilterTaskSchema,
EkuaibaoDatalinkCreateTaskSchema,
EkuaibaoDatalinkEditTaskSchema,
DataConvertTaskSchema,
DynamicDelayTaskSchema,
MessageDingtalkTaskSchema,
@@ -152,6 +233,7 @@ export const WorkflowTaskSchema: z.ZodType<WorkflowTask> = z.union([
EkuaibaoDepartmentUpdateTaskSchema,
FeishuDepartmentFilterTaskSchema,
WecomDepartmentTaskSchema,
TaskDynamicDingAttendanceTaskSchema,
SearchStaffByRoleTaskSchema,
RoleUpdateTaskSchema,
ExcelTaskSchema,
@@ -166,5 +248,28 @@ export const WorkflowTaskSchema: z.ZodType<WorkflowTask> = z.union([
UiDialogTaskSchema,
UiNotificationTaskSchema,
OutputTaskSchema,
EBridgeMapDataTaskSchema,
EBridgeAuthTaskSchema,
FxiaokeAuthTaskSchema,
FxiaokeListTaskSchema,
NetsuiteSyncTaskSchema,
NetsuiteCreateTaskSchema,
NetsuiteDeleteTaskSchema,
TrSelectTaskSchema,
TrCommentTaskSchema,
TrDetailTaskSchema,
TaskZsTaskSchema,
EscapeTaskSchema,
HlDetailTaskSchema,
HlTaskSchema,
MappingDetailTaskSchema,
InvoiceVerificationTaskSchema,
EkuaibaoInvoiceInspectorTaskSchema,
EkuaibaoInvoiceDatalinkFilterTaskSchema,
EkuaibaoTmcDatalinkFilterTaskSchema,
EkuaibaoRequisitionDetailTaskSchema,
EkuaibaoEcardFeeFilterTaskSchema,
EkuaibaoEcardRequisitionFilterTaskSchema,
EkuaibaoEcardFeeDetailFilterTaskSchema,
UnknownTaskSchema,
]);
@@ -0,0 +1,95 @@
import { z } from "zod";
import { BaseTaskSchema, OnErrorSchema } from "./common.js";
// ── 第三方系统集成与定制数据节点 ─────────────────────────────────────────────
export const EBridgeMapDataTaskSchema = BaseTaskSchema.extend({
type: z.literal("eBridge-mapData"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const EBridgeAuthTaskSchema = BaseTaskSchema.extend({
type: z.literal("ebridge-auth"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const FxiaokeAuthTaskSchema = BaseTaskSchema.extend({
type: z.literal("fxiaoke-auth"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const FxiaokeListTaskSchema = BaseTaskSchema.extend({
type: z.literal("fxiaoke-list"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const NetsuiteSyncTaskSchema = BaseTaskSchema.extend({
type: z.literal("netsuite-sync"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const NetsuiteCreateTaskSchema = BaseTaskSchema.extend({
type: z.literal("netsuite-create"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const NetsuiteDeleteTaskSchema = BaseTaskSchema.extend({
type: z.literal("netsuite-delete"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const TrSelectTaskSchema = BaseTaskSchema.extend({
type: z.literal("tr-select"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const TrCommentTaskSchema = BaseTaskSchema.extend({
type: z.literal("tr-comment"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const TrDetailTaskSchema = BaseTaskSchema.extend({
type: z.literal("tr-detail"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const TaskZsTaskSchema = BaseTaskSchema.extend({
type: z.literal("task-zs"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const EscapeTaskSchema = BaseTaskSchema.extend({
type: z.literal("escape"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const HlDetailTaskSchema = BaseTaskSchema.extend({
type: z.literal("hl-detail"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const HlTaskSchema = BaseTaskSchema.extend({
type: z.literal("hl"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const MappingDetailTaskSchema = BaseTaskSchema.extend({
type: z.literal("mapping-detail"),
onError: OnErrorSchema.optional(),
}).passthrough();
export type EBridgeMapDataTask = z.infer<typeof EBridgeMapDataTaskSchema>;
export type EBridgeAuthTask = z.infer<typeof EBridgeAuthTaskSchema>;
export type FxiaokeAuthTask = z.infer<typeof FxiaokeAuthTaskSchema>;
export type FxiaokeListTask = z.infer<typeof FxiaokeListTaskSchema>;
export type NetsuiteSyncTask = z.infer<typeof NetsuiteSyncTaskSchema>;
export type NetsuiteCreateTask = z.infer<typeof NetsuiteCreateTaskSchema>;
export type NetsuiteDeleteTask = z.infer<typeof NetsuiteDeleteTaskSchema>;
export type TrSelectTask = z.infer<typeof TrSelectTaskSchema>;
export type TrCommentTask = z.infer<typeof TrCommentTaskSchema>;
export type TrDetailTask = z.infer<typeof TrDetailTaskSchema>;
export type TaskZsTask = z.infer<typeof TaskZsTaskSchema>;
export type EscapeTask = z.infer<typeof EscapeTaskSchema>;
export type HlDetailTask = z.infer<typeof HlDetailTaskSchema>;
export type HlTask = z.infer<typeof HlTaskSchema>;
export type MappingDetailTask = z.infer<typeof MappingDetailTaskSchema>;
@@ -0,0 +1,31 @@
import { z } from "zod";
import { BaseTaskSchema, OnErrorSchema } from "./common.js";
// ── 发票验真巡检与差旅/TMC行程节点 ──────────────────────────────────────────
export const InvoiceVerificationTaskSchema = BaseTaskSchema.extend({
type: z.literal("invoice-verification"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const EkuaibaoInvoiceInspectorTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-invoice-inspector"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const EkuaibaoInvoiceDatalinkFilterTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-invoice-datalink-filter"),
combineFilters: z.any().optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export const EkuaibaoTmcDatalinkFilterTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-tmc-datalink-filter"),
combineFilters: z.any().optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export type InvoiceVerificationTask = z.infer<typeof InvoiceVerificationTaskSchema>;
export type EkuaibaoInvoiceInspectorTask = z.infer<typeof EkuaibaoInvoiceInspectorTaskSchema>;
export type EkuaibaoInvoiceDatalinkFilterTask = z.infer<typeof EkuaibaoInvoiceDatalinkFilterTaskSchema>;
export type EkuaibaoTmcDatalinkFilterTask = z.infer<typeof EkuaibaoTmcDatalinkFilterTaskSchema>;
@@ -58,6 +58,11 @@ export const WecomDepartmentTaskSchema = BaseTaskSchema.extend({
onError: OnErrorSchema.optional(),
}).passthrough();
export const TaskDynamicDingAttendanceTaskSchema = BaseTaskSchema.extend({
type: z.literal("task-dynamic-ding-attendance"),
onError: OnErrorSchema.optional(),
}).passthrough();
export const SearchStaffByRoleTaskSchema = BaseTaskSchema.extend({
type: z.literal("search-staff-by-role"),
roleId: z.string().optional(),
@@ -78,5 +83,6 @@ export type EkuaibaoDepartmentDetailTask = z.infer<typeof EkuaibaoDepartmentDeta
export type EkuaibaoDepartmentUpdateTask = z.infer<typeof EkuaibaoDepartmentUpdateTaskSchema>;
export type FeishuDepartmentFilterTask = z.infer<typeof FeishuDepartmentFilterTaskSchema>;
export type WecomDepartmentTask = z.infer<typeof WecomDepartmentTaskSchema>;
export type TaskDynamicDingAttendanceTask = z.infer<typeof TaskDynamicDingAttendanceTaskSchema>;
export type SearchStaffByRoleTask = z.infer<typeof SearchStaffByRoleTaskSchema>;
export type RoleUpdateTask = z.infer<typeof RoleUpdateTaskSchema>;
@@ -0,0 +1,34 @@
import { z } from "zod";
import { BaseTaskSchema, OnErrorSchema } from "./common.js";
// ── 申请事项与易商卡/随手记节点 ──────────────────────────────────────────────
export const EkuaibaoRequisitionDetailTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-requision-detail"),
specificationId: z.string().optional(),
requisitionId: z.string().optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export const EkuaibaoEcardFeeFilterTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-ecard-fee-filter"),
combineFilters: z.any().optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export const EkuaibaoEcardRequisitionFilterTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-ecard-requisition-filter"),
combineFilters: z.any().optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export const EkuaibaoEcardFeeDetailFilterTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-ecard-fee-detail-filter"),
combineFilters: z.any().optional(),
onError: OnErrorSchema.optional(),
}).passthrough();
export type EkuaibaoRequisitionDetailTask = z.infer<typeof EkuaibaoRequisitionDetailTaskSchema>;
export type EkuaibaoEcardFeeFilterTask = z.infer<typeof EkuaibaoEcardFeeFilterTaskSchema>;
export type EkuaibaoEcardRequisitionFilterTask = z.infer<typeof EkuaibaoEcardRequisitionFilterTaskSchema>;
export type EkuaibaoEcardFeeDetailFilterTask = z.infer<typeof EkuaibaoEcardFeeDetailFilterTaskSchema>;
@@ -0,0 +1,114 @@
import { z } from "zod";
import { BaseTaskSchema } from "./common.js";
// ── 工作流触发器节点 (全量官方 18 类触发器) ───────────────────────────────────
export const ClockTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("clock"),
mode: z.string().optional(),
triggerDateTime: z.string().optional(),
cron: z.string().optional(),
timezone: z.string().optional(),
}).passthrough();
export const StartTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("start"),
cron: z.string().optional(),
mode: z.string().optional(),
}).passthrough();
export const FlowChangeTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("flow-change-trigger"),
specificationId: z.string().optional(),
dateField: z.string().optional(),
advanceDays: z.number().optional(),
}).passthrough();
export const EkuaibaoFlowformTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-flowform-trigger"),
specificationId: z.string().optional(),
flowState: z.string().optional(),
event: z.string().optional(),
}).passthrough();
export const EkuaibaoDatalinkCreateTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-datalink-create-trigger"),
datalinkModelId: z.string().optional(),
}).passthrough();
export const EkuaibaoDatalinkChangeTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-datalink-change-trigger"),
datalinkModelId: z.string().optional(),
}).passthrough();
export const EkuaibaoDatalinkTimeTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-datalink-time-trigger"),
datalinkModelId: z.string().optional(),
dateField: z.string().optional(),
}).passthrough();
export const DatalinkButtonTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("datalink-button-trigger"),
datalinkModelId: z.string().optional(),
buttonCode: z.string().optional(),
}).passthrough();
export const FxiaokeTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("fxiaoke-trigger"),
objectDescribeApiName: z.string().optional(),
}).passthrough();
export const XrxsTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("xrxs-trigger"),
event: z.string().optional(),
}).passthrough();
export const EkuaibaoTmcDatalinkCreateTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-tmc-datalink-create-trigger"),
}).passthrough();
export const EkuaibaoTmcDatalinkChangeTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-tmc-datalink-change-trigger"),
}).passthrough();
export const EkuaibaoTmcDatalinkTimeTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-tmc-datalink-time-trigger"),
}).passthrough();
export const EkuaibaoEbotTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-ebot-trigger"),
botId: z.string().optional(),
}).passthrough();
export const OtherEventTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("other-event-trigger"),
eventType: z.string().optional(),
}).passthrough();
export const HabTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("hab-trigger-task"),
appCode: z.string().optional(),
}).passthrough();
export const EkuaibaoRequisitionTriggerTaskSchema = BaseTaskSchema.extend({
type: z.literal("ekuaibao-requisition-trigger"),
specificationId: z.string().optional(),
}).passthrough();
export type ClockTriggerTask = z.infer<typeof ClockTriggerTaskSchema>;
export type StartTriggerTask = z.infer<typeof StartTriggerTaskSchema>;
export type FlowChangeTriggerTask = z.infer<typeof FlowChangeTriggerTaskSchema>;
export type EkuaibaoFlowformTriggerTask = z.infer<typeof EkuaibaoFlowformTriggerTaskSchema>;
export type EkuaibaoDatalinkCreateTriggerTask = z.infer<typeof EkuaibaoDatalinkCreateTriggerTaskSchema>;
export type EkuaibaoDatalinkChangeTriggerTask = z.infer<typeof EkuaibaoDatalinkChangeTriggerTaskSchema>;
export type EkuaibaoDatalinkTimeTriggerTask = z.infer<typeof EkuaibaoDatalinkTimeTriggerTaskSchema>;
export type DatalinkButtonTriggerTask = z.infer<typeof DatalinkButtonTriggerTaskSchema>;
export type FxiaokeTriggerTask = z.infer<typeof FxiaokeTriggerTaskSchema>;
export type XrxsTriggerTask = z.infer<typeof XrxsTriggerTaskSchema>;
export type EkuaibaoTmcDatalinkCreateTriggerTask = z.infer<typeof EkuaibaoTmcDatalinkCreateTriggerTaskSchema>;
export type EkuaibaoTmcDatalinkChangeTriggerTask = z.infer<typeof EkuaibaoTmcDatalinkChangeTriggerTaskSchema>;
export type EkuaibaoTmcDatalinkTimeTriggerTask = z.infer<typeof EkuaibaoTmcDatalinkTimeTriggerTaskSchema>;
export type EkuaibaoEbotTriggerTask = z.infer<typeof EkuaibaoEbotTriggerTaskSchema>;
export type OtherEventTriggerTask = z.infer<typeof OtherEventTriggerTaskSchema>;
export type HabTriggerTask = z.infer<typeof HabTriggerTaskSchema>;
export type EkuaibaoRequisitionTriggerTask = z.infer<typeof EkuaibaoRequisitionTriggerTaskSchema>;