feat(workflow): 补齐可用节点原子模型定义与静态门禁已知类型识别
1. 节点原子模型与 Schema 补齐: - 在 src/domains/platform/workflow/models/nodes/ 下新增 ai.ts, control.ts, message.ts, org.ts, utility.ts; - 补齐 flow-update-task、recalculate-the-approval-flow、flow-list、message-dingtalk、excel、ai-classification 等 30+ 节点强类型 Schema; - 统一导出并重现生成 specs/workflow-schema.json。 2. 静态分析门禁已知节点对齐: - 引入 isKnownGrayNodeType 使得静态分析器全面识别 108 官方灰度节点清单; - 消除 recalculate-the-approval-flow、flow-update-task 等官方已知节点的误报 UNKNOWN_TASK_TYPE 警告。 3. 文档与规范同步: - 更新 src/domains/platform/workflow/models/nodes/README.nodes.md 文件职责表; - 通过 check-readme、全量 966 单测及 tsc 零报错校验。
This commit is contained in:
1 parent
6a06c53566
commit
74234f3ed1
10 files changed
+9629
-261
No files matched your search
+9105
-252
File diff suppressed because it is too large.
Load diff
@@ -10,6 +10,7 @@ import type {
|
||||
WorkflowFormSpecComponentLike,
|
||||
AnalyzeWorkflowOptions,
|
||||
} from "./types.js";
|
||||
import { isKnownGrayNodeType } from "../nodes/gray-nodes-catalog.js";
|
||||
|
||||
const KNOWN_TYPES = new Set([
|
||||
"webhook",
|
||||
@@ -442,7 +443,7 @@ export function analyzeWorkflow(
|
||||
message: `${task.type} 控制节点没有子节点`,
|
||||
});
|
||||
}
|
||||
if (!KNOWN_TYPES.has(task.type)) {
|
||||
if (!KNOWN_TYPES.has(task.type) && !isKnownGrayNodeType(task.type)) {
|
||||
addDiagnostic(diagnostics, {
|
||||
severity: "warning",
|
||||
code: "UNKNOWN_TASK_TYPE",
|
||||
|
||||
@@ -12,10 +12,15 @@
|
||||
| [code.ts](./code.ts) | 脚本代码节点(MVEL `code` / JavaScript `code-js2`) |
|
||||
| [webhook.ts](./webhook.ts) | Webhook 外部触发器节点(`sampleId` / `urlPath`) |
|
||||
| [stop.ts](./stop.ts) | 终止流程控制节点(`stop`) |
|
||||
| [flow.ts](./flow.ts) | 单据操作节点(`flow-detail` 查询详情 / `flow-create-task` 创建单据) |
|
||||
| [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`) |
|
||||
| [condition.ts](./condition.ts) | 条件分支控制节点工厂(`createConditionTaskSchema`) |
|
||||
| [every.ts](./every.ts) | 依次执行循环控制节点工厂(`createEveryTaskSchema`) |
|
||||
| [control.ts](./control.ts) | 流程控制节点工厂(`if`、`loop`、`while`、`amortization`、`apportion`) |
|
||||
| [message.ts](./message.ts) | 消息与通知节点(`message-dingtalk`、`message-feishu`、`email`、`message`、`message-internet`、`message-outnet`、`oa`) |
|
||||
| [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` 等) |
|
||||
| [unknown.ts](./unknown.ts) | 兜底节点模型(未知节点类型全透传) |
|
||||
| [index.ts](./index.ts) | 实例化递归容器节点、聚合统一 `WorkflowTaskSchema` 并集中导出 |
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import { z } from "zod";
|
||||
import { BaseTaskSchema, OnErrorSchema } from "./common.js";
|
||||
|
||||
// ── AI 相关节点 (分类、提取、理解与大模型对接) ──────────────────────────────────
|
||||
|
||||
export const AiClassificationTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ai-classification"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const AiExtractionTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ai-extraction"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const AiAttachmentTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ai-attachment"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const EkbAiTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ekb-ai"),
|
||||
model: z.string().optional(),
|
||||
prompt: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const EkbMinimaxTextTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ekb-minimax-text"),
|
||||
prompt: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const EkbMinimaxPhotoTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ekb-minimax-photo"),
|
||||
imageUrl: z.string().optional(),
|
||||
prompt: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const EkbAiPdfTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ekb-ai-pdf"),
|
||||
attachmentUrl: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const EkbAiUrlTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ekb-ai-url"),
|
||||
url: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const DifyTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("dify"),
|
||||
apiKey: z.string().optional(),
|
||||
inputs: z.record(z.string(), z.any()).optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export type AiClassificationTask = z.infer<typeof AiClassificationTaskSchema>;
|
||||
export type AiExtractionTask = z.infer<typeof AiExtractionTaskSchema>;
|
||||
export type AiAttachmentTask = z.infer<typeof AiAttachmentTaskSchema>;
|
||||
export type EkbAiTask = z.infer<typeof EkbAiTaskSchema>;
|
||||
export type EkbMinimaxTextTask = z.infer<typeof EkbMinimaxTextTaskSchema>;
|
||||
export type EkbMinimaxPhotoTask = z.infer<typeof EkbMinimaxPhotoTaskSchema>;
|
||||
export type EkbAiPdfTask = z.infer<typeof EkbAiPdfTaskSchema>;
|
||||
export type EkbAiUrlTask = z.infer<typeof EkbAiUrlTaskSchema>;
|
||||
export type DifyTask = z.infer<typeof DifyTaskSchema>;
|
||||
@@ -0,0 +1,61 @@
|
||||
import { z } from "zod";
|
||||
import { BaseTaskSchema, type WorkflowTask } from "./common.js";
|
||||
|
||||
// ── 流程控制节点 (if, loop, while, amortization, apportion) ───────────────────
|
||||
|
||||
export function createIfTaskSchema(
|
||||
getTaskSchema: () => z.ZodType<WorkflowTask>
|
||||
): z.ZodType<WorkflowTask> {
|
||||
return BaseTaskSchema.extend({
|
||||
type: z.literal("if"),
|
||||
tasksMaxLevel: z.number().optional(),
|
||||
combineFilters: z.any().optional(),
|
||||
conditions: z.any().optional(),
|
||||
tasks: z.lazy(() => z.array(getTaskSchema())).optional(),
|
||||
}).passthrough();
|
||||
}
|
||||
|
||||
export function createLoopTaskSchema(
|
||||
getTaskSchema: () => z.ZodType<WorkflowTask>
|
||||
): z.ZodType<WorkflowTask> {
|
||||
return BaseTaskSchema.extend({
|
||||
type: z.literal("loop"),
|
||||
list: z.any().optional(),
|
||||
batchSize: z.number().optional(),
|
||||
tasksMaxLevel: z.number().optional(),
|
||||
tasks: z.lazy(() => z.array(getTaskSchema())).optional(),
|
||||
}).passthrough();
|
||||
}
|
||||
|
||||
export function createWhileTaskSchema(
|
||||
getTaskSchema: () => z.ZodType<WorkflowTask>
|
||||
): z.ZodType<WorkflowTask> {
|
||||
return BaseTaskSchema.extend({
|
||||
type: z.literal("while"),
|
||||
combineFilters: z.any().optional(),
|
||||
conditions: z.any().optional(),
|
||||
maxLoop: z.number().optional(),
|
||||
tasksMaxLevel: z.number().optional(),
|
||||
tasks: z.lazy(() => z.array(getTaskSchema())).optional(),
|
||||
}).passthrough();
|
||||
}
|
||||
|
||||
export function createAmortizationTaskSchema(
|
||||
getTaskSchema: () => z.ZodType<WorkflowTask>
|
||||
): z.ZodType<WorkflowTask> {
|
||||
return BaseTaskSchema.extend({
|
||||
type: z.literal("amortization"),
|
||||
tasksMaxLevel: z.number().optional(),
|
||||
tasks: z.lazy(() => z.array(getTaskSchema())).optional(),
|
||||
}).passthrough();
|
||||
}
|
||||
|
||||
export function createApportionTaskSchema(
|
||||
getTaskSchema: () => z.ZodType<WorkflowTask>
|
||||
): z.ZodType<WorkflowTask> {
|
||||
return BaseTaskSchema.extend({
|
||||
type: z.literal("apportion"),
|
||||
tasksMaxLevel: z.number().optional(),
|
||||
tasks: z.lazy(() => z.array(getTaskSchema())).optional(),
|
||||
}).passthrough();
|
||||
}
|
||||
@@ -15,12 +15,36 @@ export const FlowDetailTaskSchema = BaseTaskSchema.extend({
|
||||
|
||||
export const FlowCreateTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("flow-create-task"),
|
||||
specificationId: z.string(),
|
||||
formState: z.string(),
|
||||
form: z.record(z.string(), z.string()),
|
||||
details: z.record(z.string(), z.any()),
|
||||
specificationId: z.string().optional(),
|
||||
formState: z.string().optional(),
|
||||
form: z.record(z.string(), z.any()).optional(),
|
||||
details: z.record(z.string(), z.any()).optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const FlowUpdateTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("flow-update-task"),
|
||||
specificationId: z.string().optional(),
|
||||
formState: z.string().optional(),
|
||||
form: z.record(z.string(), z.any()).optional(),
|
||||
details: z.record(z.string(), z.any()).optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const RecalculateApprovalFlowTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("recalculate-the-approval-flow"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const FlowListTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("flow-list"),
|
||||
specificationId: z.string().optional(),
|
||||
combineFilters: z.any().optional(),
|
||||
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>;
|
||||
@@ -2,10 +2,23 @@ import { z } from "zod";
|
||||
import type { WorkflowTask } from "./common.js";
|
||||
import { createConditionTaskSchema } from "./condition.js";
|
||||
import { createEveryTaskSchema } from "./every.js";
|
||||
import {
|
||||
createIfTaskSchema,
|
||||
createLoopTaskSchema,
|
||||
createWhileTaskSchema,
|
||||
createAmortizationTaskSchema,
|
||||
createApportionTaskSchema,
|
||||
} from "./control.js";
|
||||
import { WebhookTaskSchema } from "./webhook.js";
|
||||
import { StopTaskSchema } from "./stop.js";
|
||||
import { HttpTaskSchema } from "./http.js";
|
||||
import { FlowDetailTaskSchema, FlowCreateTaskSchema } from "./flow.js";
|
||||
import {
|
||||
FlowDetailTaskSchema,
|
||||
FlowCreateTaskSchema,
|
||||
FlowUpdateTaskSchema,
|
||||
RecalculateApprovalFlowTaskSchema,
|
||||
FlowListTaskSchema,
|
||||
} from "./flow.js";
|
||||
import { CodeTaskSchema, CodeJs2TaskSchema } from "./code.js";
|
||||
import {
|
||||
EkuaibaoDatalinkFilterTaskSchema,
|
||||
@@ -13,9 +26,57 @@ import {
|
||||
DataConvertTaskSchema,
|
||||
} from "./datalink.js";
|
||||
import { DynamicDelayTaskSchema } from "./delay.js";
|
||||
import {
|
||||
MessageDingtalkTaskSchema,
|
||||
MessageFeishuTaskSchema,
|
||||
FeishuSendMsgTaskSchema,
|
||||
MessageSmsTaskSchema,
|
||||
EmailTaskSchema,
|
||||
MessageInternetTaskSchema,
|
||||
MessageOutnetTaskSchema,
|
||||
OaReminderTaskSchema,
|
||||
} from "./message.js";
|
||||
import {
|
||||
AiClassificationTaskSchema,
|
||||
AiExtractionTaskSchema,
|
||||
AiAttachmentTaskSchema,
|
||||
EkbAiTaskSchema,
|
||||
EkbMinimaxTextTaskSchema,
|
||||
EkbMinimaxPhotoTaskSchema,
|
||||
EkbAiPdfTaskSchema,
|
||||
EkbAiUrlTaskSchema,
|
||||
DifyTaskSchema,
|
||||
} from "./ai.js";
|
||||
import {
|
||||
EkuaibaoStaffFilterTaskSchema,
|
||||
EkuaibaoStaffDetailTaskSchema,
|
||||
StaffCreateTaskSchema,
|
||||
DepartmentCreateTaskSchema,
|
||||
DepartmentFilterTaskSchema,
|
||||
EkuaibaoDepartmentDetailTaskSchema,
|
||||
EkuaibaoDepartmentUpdateTaskSchema,
|
||||
FeishuDepartmentFilterTaskSchema,
|
||||
WecomDepartmentTaskSchema,
|
||||
SearchStaffByRoleTaskSchema,
|
||||
RoleUpdateTaskSchema,
|
||||
} from "./org.js";
|
||||
import {
|
||||
ExcelTaskSchema,
|
||||
AggregationTaskSchema,
|
||||
FlowFormatTaskSchema,
|
||||
TaskLogTaskSchema,
|
||||
TaskDynamicTestTaskSchema,
|
||||
TaskOpenapiTaskSchema,
|
||||
ContextTaskSchema,
|
||||
DmnTaskSchema,
|
||||
MappingTaskSchema,
|
||||
UiDialogTaskSchema,
|
||||
UiNotificationTaskSchema,
|
||||
OutputTaskSchema,
|
||||
} from "./utility.js";
|
||||
import { UnknownTaskSchema } from "./unknown.js";
|
||||
|
||||
// 导出所有基础与通用类型
|
||||
// 导出所有基础与分类模型
|
||||
export * from "./common.js";
|
||||
export * from "./http.js";
|
||||
export * from "./delay.js";
|
||||
@@ -26,26 +87,84 @@ export * from "./flow.js";
|
||||
export * from "./datalink.js";
|
||||
export * from "./condition.js";
|
||||
export * from "./every.js";
|
||||
export * from "./control.js";
|
||||
export * from "./message.js";
|
||||
export * from "./ai.js";
|
||||
export * from "./org.js";
|
||||
export * from "./utility.js";
|
||||
export * from "./unknown.js";
|
||||
|
||||
// 递归容器节点 Schema 实例化
|
||||
export const ConditionTaskSchema: z.ZodType<WorkflowTask> = createConditionTaskSchema(() => WorkflowTaskSchema);
|
||||
export const EveryTaskSchema: z.ZodType<WorkflowTask> = createEveryTaskSchema(() => WorkflowTaskSchema);
|
||||
export const IfTaskSchema: z.ZodType<WorkflowTask> = createIfTaskSchema(() => WorkflowTaskSchema);
|
||||
export const LoopTaskSchema: z.ZodType<WorkflowTask> = createLoopTaskSchema(() => WorkflowTaskSchema);
|
||||
export const WhileTaskSchema: z.ZodType<WorkflowTask> = createWhileTaskSchema(() => WorkflowTaskSchema);
|
||||
export const AmortizationTaskSchema: z.ZodType<WorkflowTask> = createAmortizationTaskSchema(() => WorkflowTaskSchema);
|
||||
export const ApportionTaskSchema: z.ZodType<WorkflowTask> = createApportionTaskSchema(() => WorkflowTaskSchema);
|
||||
|
||||
// 统一任务节点联合 Schema
|
||||
export const WorkflowTaskSchema: z.ZodType<WorkflowTask> = z.union([
|
||||
WebhookTaskSchema,
|
||||
ConditionTaskSchema,
|
||||
EveryTaskSchema,
|
||||
IfTaskSchema,
|
||||
LoopTaskSchema,
|
||||
WhileTaskSchema,
|
||||
AmortizationTaskSchema,
|
||||
ApportionTaskSchema,
|
||||
StopTaskSchema,
|
||||
HttpTaskSchema,
|
||||
FlowDetailTaskSchema,
|
||||
FlowCreateTaskSchema,
|
||||
FlowUpdateTaskSchema,
|
||||
RecalculateApprovalFlowTaskSchema,
|
||||
FlowListTaskSchema,
|
||||
CodeTaskSchema,
|
||||
CodeJs2TaskSchema,
|
||||
EkuaibaoDatalinkFilterTaskSchema,
|
||||
EkuaibaoDatalinkCreateTaskSchema,
|
||||
DataConvertTaskSchema,
|
||||
FlowCreateTaskSchema,
|
||||
DynamicDelayTaskSchema,
|
||||
MessageDingtalkTaskSchema,
|
||||
MessageFeishuTaskSchema,
|
||||
FeishuSendMsgTaskSchema,
|
||||
MessageSmsTaskSchema,
|
||||
EmailTaskSchema,
|
||||
MessageInternetTaskSchema,
|
||||
MessageOutnetTaskSchema,
|
||||
OaReminderTaskSchema,
|
||||
AiClassificationTaskSchema,
|
||||
AiExtractionTaskSchema,
|
||||
AiAttachmentTaskSchema,
|
||||
EkbAiTaskSchema,
|
||||
EkbMinimaxTextTaskSchema,
|
||||
EkbMinimaxPhotoTaskSchema,
|
||||
EkbAiPdfTaskSchema,
|
||||
EkbAiUrlTaskSchema,
|
||||
DifyTaskSchema,
|
||||
EkuaibaoStaffFilterTaskSchema,
|
||||
EkuaibaoStaffDetailTaskSchema,
|
||||
StaffCreateTaskSchema,
|
||||
DepartmentCreateTaskSchema,
|
||||
DepartmentFilterTaskSchema,
|
||||
EkuaibaoDepartmentDetailTaskSchema,
|
||||
EkuaibaoDepartmentUpdateTaskSchema,
|
||||
FeishuDepartmentFilterTaskSchema,
|
||||
WecomDepartmentTaskSchema,
|
||||
SearchStaffByRoleTaskSchema,
|
||||
RoleUpdateTaskSchema,
|
||||
ExcelTaskSchema,
|
||||
AggregationTaskSchema,
|
||||
FlowFormatTaskSchema,
|
||||
TaskLogTaskSchema,
|
||||
TaskDynamicTestTaskSchema,
|
||||
TaskOpenapiTaskSchema,
|
||||
ContextTaskSchema,
|
||||
DmnTaskSchema,
|
||||
MappingTaskSchema,
|
||||
UiDialogTaskSchema,
|
||||
UiNotificationTaskSchema,
|
||||
OutputTaskSchema,
|
||||
UnknownTaskSchema,
|
||||
]);
|
||||
@@ -0,0 +1,75 @@
|
||||
import { z } from "zod";
|
||||
import { BaseTaskSchema, OnErrorSchema } from "./common.js";
|
||||
|
||||
// ── 消息通知相关节点 ──────────────────────────────────────────────────────────
|
||||
|
||||
export const MessageDingtalkTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("message-dingtalk"),
|
||||
receiverType: z.string().optional(),
|
||||
receivers: z.array(z.any()).optional(),
|
||||
content: z.string().optional(),
|
||||
title: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const MessageFeishuTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("message-feishu"),
|
||||
receiverType: z.string().optional(),
|
||||
receivers: z.array(z.any()).optional(),
|
||||
content: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const FeishuSendMsgTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("feishu-sendMsg"),
|
||||
receiverType: z.string().optional(),
|
||||
receivers: z.array(z.any()).optional(),
|
||||
content: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const MessageSmsTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("message"),
|
||||
receivers: z.array(z.any()).optional(),
|
||||
content: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const EmailTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("email"),
|
||||
receivers: z.array(z.any()).optional(),
|
||||
title: z.string().optional(),
|
||||
content: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const MessageInternetTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("message-internet"),
|
||||
receivers: z.array(z.any()).optional(),
|
||||
title: z.string().optional(),
|
||||
content: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const MessageOutnetTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("message-outnet"),
|
||||
receivers: z.array(z.any()).optional(),
|
||||
content: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const OaReminderTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("oa"),
|
||||
receivers: z.array(z.any()).optional(),
|
||||
content: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export type MessageDingtalkTask = z.infer<typeof MessageDingtalkTaskSchema>;
|
||||
export type MessageFeishuTask = z.infer<typeof MessageFeishuTaskSchema>;
|
||||
export type FeishuSendMsgTask = z.infer<typeof FeishuSendMsgTaskSchema>;
|
||||
export type MessageSmsTask = z.infer<typeof MessageSmsTaskSchema>;
|
||||
export type EmailTask = z.infer<typeof EmailTaskSchema>;
|
||||
export type MessageInternetTask = z.infer<typeof MessageInternetTaskSchema>;
|
||||
export type MessageOutnetTask = z.infer<typeof MessageOutnetTaskSchema>;
|
||||
export type OaReminderTask = z.infer<typeof OaReminderTaskSchema>;
|
||||
@@ -0,0 +1,82 @@
|
||||
import { z } from "zod";
|
||||
import { BaseTaskSchema, OnErrorSchema } from "./common.js";
|
||||
|
||||
// ── 组织架构与人员/部门节点 ───────────────────────────────────────────────────
|
||||
|
||||
export const EkuaibaoStaffFilterTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ekuaibao-staff-filter"),
|
||||
combineFilters: z.any().optional(),
|
||||
filters: z.array(z.any()).optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const EkuaibaoStaffDetailTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ekuaibao-staff-detail"),
|
||||
staffId: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const StaffCreateTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("staff-create"),
|
||||
form: z.record(z.string(), z.any()).optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const DepartmentCreateTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("department-create"),
|
||||
form: z.record(z.string(), z.any()).optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const DepartmentFilterTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("department-filter"),
|
||||
combineFilters: z.any().optional(),
|
||||
filters: z.array(z.any()).optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const EkuaibaoDepartmentDetailTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ekuaibao-department-detail"),
|
||||
departmentId: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const EkuaibaoDepartmentUpdateTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ekuaibao-department-update"),
|
||||
departmentId: z.string().optional(),
|
||||
form: z.record(z.string(), z.any()).optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const FeishuDepartmentFilterTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("feishu-department-filter"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const WecomDepartmentTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("wecom-department"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const SearchStaffByRoleTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("search-staff-by-role"),
|
||||
roleId: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const RoleUpdateTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("role-update"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export type EkuaibaoStaffFilterTask = z.infer<typeof EkuaibaoStaffFilterTaskSchema>;
|
||||
export type EkuaibaoStaffDetailTask = z.infer<typeof EkuaibaoStaffDetailTaskSchema>;
|
||||
export type StaffCreateTask = z.infer<typeof StaffCreateTaskSchema>;
|
||||
export type DepartmentCreateTask = z.infer<typeof DepartmentCreateTaskSchema>;
|
||||
export type DepartmentFilterTask = z.infer<typeof DepartmentFilterTaskSchema>;
|
||||
export type EkuaibaoDepartmentDetailTask = z.infer<typeof EkuaibaoDepartmentDetailTaskSchema>;
|
||||
export type EkuaibaoDepartmentUpdateTask = z.infer<typeof EkuaibaoDepartmentUpdateTaskSchema>;
|
||||
export type FeishuDepartmentFilterTask = z.infer<typeof FeishuDepartmentFilterTaskSchema>;
|
||||
export type WecomDepartmentTask = z.infer<typeof WecomDepartmentTaskSchema>;
|
||||
export type SearchStaffByRoleTask = z.infer<typeof SearchStaffByRoleTaskSchema>;
|
||||
export type RoleUpdateTask = z.infer<typeof RoleUpdateTaskSchema>;
|
||||
@@ -0,0 +1,80 @@
|
||||
import { z } from "zod";
|
||||
import { BaseTaskSchema, OnErrorSchema } from "./common.js";
|
||||
|
||||
// ── 基础通用/工具类节点 ────────────────────────────────────────────────────────
|
||||
|
||||
export const ExcelTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("excel"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const AggregationTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("aggregation"),
|
||||
list: z.any().optional(),
|
||||
groupBy: z.any().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const FlowFormatTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("flow-format"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const TaskLogTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("task-log"),
|
||||
message: z.string().optional(),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const TaskDynamicTestTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("task-dynamic-test"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const TaskOpenapiTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("task-openapi"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const ContextTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("context"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const DmnTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("dmn"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const MappingTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("mapping"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const UiDialogTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ui-dialog"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const UiNotificationTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("ui-notification"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export const OutputTaskSchema = BaseTaskSchema.extend({
|
||||
type: z.literal("output"),
|
||||
onError: OnErrorSchema.optional(),
|
||||
}).passthrough();
|
||||
|
||||
export type ExcelTask = z.infer<typeof ExcelTaskSchema>;
|
||||
export type AggregationTask = z.infer<typeof AggregationTaskSchema>;
|
||||
export type FlowFormatTask = z.infer<typeof FlowFormatTaskSchema>;
|
||||
export type TaskLogTask = z.infer<typeof TaskLogTaskSchema>;
|
||||
export type TaskDynamicTestTask = z.infer<typeof TaskDynamicTestTaskSchema>;
|
||||
export type TaskOpenapiTask = z.infer<typeof TaskOpenapiTaskSchema>;
|
||||
export type ContextTask = z.infer<typeof ContextTaskSchema>;
|
||||
export type DmnTask = z.infer<typeof DmnTaskSchema>;
|
||||
export type MappingTask = z.infer<typeof MappingTaskSchema>;
|
||||
export type UiDialogTask = z.infer<typeof UiDialogTaskSchema>;
|
||||
export type UiNotificationTask = z.infer<typeof UiNotificationTaskSchema>;
|
||||
export type OutputTask = z.infer<typeof OutputTaskSchema>;
|
||||
Reference in new issue
Block a user