forked from ChaiHao/BPOS-MVP
用户要的是运行时机制:新建 + 编辑,存下去就生效,旧任务走完旧版本, 新任务调用时才加载新编排。所以「草稿 → 发布」两态整套去掉。 ## 闸从「发布」挪到「保存」 `savePackage` 现在先跑闭合校验,不闭合抛 `NotClosedError`(路由 412 带报告)—— **一个字节都不落库**。存进来的每一版都能起单,所以不需要「已发布」这个标记。 `publish` 用例、路由、`publishPackage` 存储方法一并删掉。 实测:把进 A6 的边映射清空后保存 → 412,逐条点名「边 e-g3-a6 未完成载荷映射; 节点「报价议价」的必填字段未映射:rows」。 ## 保存恒新增版本号,服务端说了算 这不是可选项,是「旧任务走完旧版本」的前提:工作流按 (包id, 版本) 去读定义, 就地覆盖 v1 就等于改掉所有在途 v1 任务正在读的编排 —— 它们会中途换了规则却毫不知情。 版本号由用例层算(当前最大 + 1),**不采信入参**。实测:入参故意填 version: 999, 落的是 v2。store 层因此改成**只插不改**:撞键宁可让唯一约束报错,也不静默覆盖。 起单取版从「最新已发布」改为「最新一版」(retired 除外);触发器的 requiredInputs 同口径。 实测:改完描述存成 v2 后,新起的单用 v2,早先那单仍挂 v1。 ## 迁移:旧状态值不归一就是一读就炸 状态枚举从 draft/published/retired 收成 active/retired。列上和 definition 这个 jsonb 里 各存着一份 state,两处都要改 —— 不改,`processPackageSchema.parse` 读一行就抛。 这不是开发期小麻烦,任何已部署实例都会中招。加了迁移 0012。 ## 界面:恒为 0 的假指标撤掉,不换个说法留着 - 编排面板:「已发布/草稿」芯片 → 「生效中/历史版本」(真正的区别是哪一版会被新起单取到); 发布按钮撤掉,保存按钮改成「保存并生效(存为 vN)」并在确认卡里说清影响面 - 历史版本只读,但就地指路:「去 v(N-1) 改(生效中)」,不让人自己找 - 蓝图面:「草稿 N · 未闭合 M」两个计数在新机制下**结构上恒为 0**(不闭合存不进来), 换成「共 N 个版本,保存即生效」 - 驾驶舱:「未闭合草稿」卡整张撤掉 —— 同理恒为 0。天然的第三张是「死路」 (route-dead-end 事件),但那需要一条按事件类型聚合的路由,没有之前不摆(同死信卡的规矩) ## 顺手修:种子的幂等判断本来是坏的 比对用 `JSON.stringify` 认键序,而 jsonb 从 PG 读回来键是重排过的 —— 永远判不等, 每播一次种就多存一版一模一样的定义(实测一口气堆到 v3)。改成递归按键名排序后比对。 连播三次,只第一次存。 ## 契约变更(破坏性,一步到位) `publish` 删除、`NotPublishableError` → `NotClosedError`、`publishable` → `closed`、 状态枚举收窄。按规矩破坏性变更该走三步弃用 —— 这里一步改完,因为: ① depcruise 反查下游全在仓内(374 模块无违规),同批改完; ② 要弃用的是一个**产品决定不再存在**的机制,留弃用窗口没有意义。 CONTRACT.md 已同步,快照单独说明。 typecheck ✓ lint ✓ depcruise 374 模块 ✓ 495 测试 ✓ Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
603 lines
24 KiB
TypeScript
603 lines
24 KiB
TypeScript
/**
|
|
* 流程包 DSL 与触发器配置(编码规范 §8.1;语义出处 OS 03)。
|
|
*
|
|
* 流程包 = 调用接口 + 两种活动(声明)+ 审批点 + 两种网关;工作流 = 其运行时实例。
|
|
* 触发器与流程包**平级**:不入流程包结构、不随流程包版本,配置独立存放。
|
|
*
|
|
* 编排铁律:**连线即映射,画图即校验,不闭合不得发布** —— 存在未完成边、未满足必填
|
|
* 或类型冲突的流程包可存草稿、不得发布。校验算法在 `process` 的 domain,本文件只定形状。
|
|
*/
|
|
import { z } from 'zod';
|
|
export declare const OWNER_STRATEGIES: readonly ["assigned", "sole", "rotation", "follow-source"];
|
|
export declare const ownerStrategySchema: z.ZodEnum<{
|
|
assigned: "assigned";
|
|
sole: "sole";
|
|
rotation: "rotation";
|
|
"follow-source": "follow-source";
|
|
}>;
|
|
export type OwnerStrategy = z.infer<typeof ownerStrategySchema>;
|
|
export declare const OWNER_STRATEGY_LABEL: Readonly<Record<OwnerStrategy, string>>;
|
|
export declare const ownerSpecSchema: z.ZodObject<{
|
|
position: z.ZodString;
|
|
strategy: z.ZodDefault<z.ZodEnum<{
|
|
assigned: "assigned";
|
|
sole: "sole";
|
|
rotation: "rotation";
|
|
"follow-source": "follow-source";
|
|
}>>;
|
|
staffId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
|
|
}, z.core.$strip>;
|
|
export type OwnerSpec = z.infer<typeof ownerSpecSchema>;
|
|
/**
|
|
* 映射来源四类:上游输出口载荷字段 / 流程变量 / 起单载荷 / 常量;
|
|
* 允许 S-FEEL 表达式做转换(与触发器字段映射同一形式)。
|
|
*/
|
|
export declare const mappingSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
from: z.ZodLiteral<"output-port">;
|
|
port: z.ZodString;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"workflow-var">;
|
|
name: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"initiation">;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"constant">;
|
|
value: z.ZodUnknown;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"expression">;
|
|
sfeel: z.ZodString;
|
|
}, z.core.$strip>], "from">;
|
|
export type MappingSource = z.infer<typeof mappingSourceSchema>;
|
|
export declare const fieldMappingSchema: z.ZodObject<{
|
|
target: z.ZodString;
|
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
from: z.ZodLiteral<"output-port">;
|
|
port: z.ZodString;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"workflow-var">;
|
|
name: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"initiation">;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"constant">;
|
|
value: z.ZodUnknown;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"expression">;
|
|
sfeel: z.ZodString;
|
|
}, z.core.$strip>], "from">;
|
|
}, z.core.$strip>;
|
|
export type FieldMapping = z.infer<typeof fieldMappingSchema>;
|
|
export declare const edgeSchema: z.ZodObject<{
|
|
id: z.ZodString;
|
|
from: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
to: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
condition: z.ZodOptional<z.ZodString>;
|
|
mapping: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
target: z.ZodString;
|
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
from: z.ZodLiteral<"output-port">;
|
|
port: z.ZodString;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"workflow-var">;
|
|
name: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"initiation">;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"constant">;
|
|
value: z.ZodUnknown;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"expression">;
|
|
sfeel: z.ZodString;
|
|
}, z.core.$strip>], "from">;
|
|
}, z.core.$strip>>>;
|
|
label: z.ZodOptional<z.ZodString>;
|
|
tone: z.ZodOptional<z.ZodEnum<{
|
|
ok: "ok";
|
|
bad: "bad";
|
|
}>>;
|
|
reopen: z.ZodDefault<z.ZodBoolean>;
|
|
}, z.core.$strip>;
|
|
export type Edge = z.infer<typeof edgeSchema>;
|
|
export declare const failureDispositionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
kind: z.ZodLiteral<"terminate">;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"reroute">;
|
|
edgeId: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"escalate">;
|
|
approvalNodeId: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"tolerate">;
|
|
}, z.core.$strip>], "kind">;
|
|
export type FailureDisposition = z.infer<typeof failureDispositionSchema>;
|
|
export declare const FAILURE_DISPOSITION_LABEL: Readonly<Record<FailureDisposition['kind'], string>>;
|
|
export declare const nudgeLadderSchema: z.ZodObject<{
|
|
deadline: z.ZodString;
|
|
steps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
after: z.ZodString;
|
|
action: z.ZodEnum<{
|
|
nudge: "nudge";
|
|
escalate: "escalate";
|
|
}>;
|
|
}, z.core.$strip>>>;
|
|
}, z.core.$strip>;
|
|
export type NudgeLadder = z.infer<typeof nudgeLadderSchema>;
|
|
export declare const GATEWAY_KINDS: readonly ["parallel", "exclusive"];
|
|
export declare const gatewayKindSchema: z.ZodEnum<{
|
|
parallel: "parallel";
|
|
exclusive: "exclusive";
|
|
}>;
|
|
export type GatewayKind = z.infer<typeof gatewayKindSchema>;
|
|
export declare const GATEWAY_KIND_LABEL: Readonly<Record<GatewayKind, string>>;
|
|
export declare const processNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
kind: z.ZodLiteral<"start">;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"end">;
|
|
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"activity">;
|
|
activityId: z.core.$ZodBranded<z.ZodString, "ActivityId", "out">;
|
|
in: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
out: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
activityVersion: z.ZodOptional<z.ZodString>;
|
|
owner: z.ZodObject<{
|
|
position: z.ZodString;
|
|
strategy: z.ZodDefault<z.ZodEnum<{
|
|
assigned: "assigned";
|
|
sole: "sole";
|
|
rotation: "rotation";
|
|
"follow-source": "follow-source";
|
|
}>>;
|
|
staffId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
|
|
}, z.core.$strip>;
|
|
failure: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
kind: z.ZodLiteral<"terminate">;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"reroute">;
|
|
edgeId: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"escalate">;
|
|
approvalNodeId: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"tolerate">;
|
|
}, z.core.$strip>], "kind">>;
|
|
message: z.ZodOptional<z.ZodString>;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"approval">;
|
|
approver: z.ZodObject<{
|
|
position: z.ZodString;
|
|
strategy: z.ZodDefault<z.ZodEnum<{
|
|
assigned: "assigned";
|
|
sole: "sole";
|
|
rotation: "rotation";
|
|
"follow-source": "follow-source";
|
|
}>>;
|
|
staffId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
|
|
}, z.core.$strip>;
|
|
reject: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
kind: z.ZodLiteral<"reopen">;
|
|
nodeId: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
mapping: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
target: z.ZodString;
|
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
from: z.ZodLiteral<"output-port">;
|
|
port: z.ZodString;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"workflow-var">;
|
|
name: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"initiation">;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"constant">;
|
|
value: z.ZodUnknown;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"expression">;
|
|
sfeel: z.ZodString;
|
|
}, z.core.$strip>], "from">;
|
|
}, z.core.$strip>>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"terminate">;
|
|
}, z.core.$strip>], "kind">;
|
|
nudge: z.ZodOptional<z.ZodObject<{
|
|
deadline: z.ZodString;
|
|
steps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
after: z.ZodString;
|
|
action: z.ZodEnum<{
|
|
nudge: "nudge";
|
|
escalate: "escalate";
|
|
}>;
|
|
}, z.core.$strip>>>;
|
|
}, z.core.$strip>>;
|
|
message: z.ZodOptional<z.ZodString>;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"gateway">;
|
|
gateway: z.ZodEnum<{
|
|
parallel: "parallel";
|
|
exclusive: "exclusive";
|
|
}>;
|
|
mode: z.ZodEnum<{
|
|
join: "join";
|
|
fork: "fork";
|
|
}>;
|
|
basis: z.ZodOptional<z.ZodString>;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>], "kind">;
|
|
export type ProcessNode = z.infer<typeof processNodeSchema>;
|
|
export declare const callInterfaceSchema: z.ZodObject<{
|
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
output: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
}, z.core.$strip>;
|
|
export type CallInterface = z.infer<typeof callInterfaceSchema>;
|
|
/**
|
|
* 流程包状态 —— **没有草稿态,也没有发布态**。
|
|
*
|
|
* 「严格检查 + 保存生效」:保存时跑闭合校验,不闭合直接拒存;存下来的就是生效的。
|
|
* 生效与否由**运行时**决定 —— 新工作流起单时取最新版,在途的按启动时快照的版本跑完。
|
|
* 所以不需要「已发布」这个标记:能存进来的版本都能起单。
|
|
*
|
|
* 保存**恒产生新版本号**(服务端算):工作流按 (包id, 版本) 读定义,
|
|
* 就地覆盖会改掉在途任务正在读的东西 —— 那正是「旧任务走完旧版本」要防的。
|
|
* `retired` 留给「这一版不再可起单」,起单时拒。
|
|
*/
|
|
export declare const PROCESS_PACKAGE_STATES: readonly ["active", "retired"];
|
|
export declare const processPackageStateSchema: z.ZodEnum<{
|
|
active: "active";
|
|
retired: "retired";
|
|
}>;
|
|
export type ProcessPackageState = z.infer<typeof processPackageStateSchema>;
|
|
export declare const processPackageSchema: z.ZodObject<{
|
|
id: z.core.$ZodBranded<z.ZodString, "ProcessPackageId", "out">;
|
|
name: z.ZodString;
|
|
version: z.ZodNumber;
|
|
state: z.ZodEnum<{
|
|
active: "active";
|
|
retired: "retired";
|
|
}>;
|
|
callInterface: z.ZodObject<{
|
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
output: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
}, z.core.$strip>;
|
|
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
kind: z.ZodLiteral<"start">;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"end">;
|
|
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"activity">;
|
|
activityId: z.core.$ZodBranded<z.ZodString, "ActivityId", "out">;
|
|
in: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
out: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
activityVersion: z.ZodOptional<z.ZodString>;
|
|
owner: z.ZodObject<{
|
|
position: z.ZodString;
|
|
strategy: z.ZodDefault<z.ZodEnum<{
|
|
assigned: "assigned";
|
|
sole: "sole";
|
|
rotation: "rotation";
|
|
"follow-source": "follow-source";
|
|
}>>;
|
|
staffId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
|
|
}, z.core.$strip>;
|
|
failure: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
kind: z.ZodLiteral<"terminate">;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"reroute">;
|
|
edgeId: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"escalate">;
|
|
approvalNodeId: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"tolerate">;
|
|
}, z.core.$strip>], "kind">>;
|
|
message: z.ZodOptional<z.ZodString>;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"approval">;
|
|
approver: z.ZodObject<{
|
|
position: z.ZodString;
|
|
strategy: z.ZodDefault<z.ZodEnum<{
|
|
assigned: "assigned";
|
|
sole: "sole";
|
|
rotation: "rotation";
|
|
"follow-source": "follow-source";
|
|
}>>;
|
|
staffId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
|
|
}, z.core.$strip>;
|
|
reject: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
kind: z.ZodLiteral<"reopen">;
|
|
nodeId: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
mapping: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
target: z.ZodString;
|
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
from: z.ZodLiteral<"output-port">;
|
|
port: z.ZodString;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"workflow-var">;
|
|
name: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"initiation">;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"constant">;
|
|
value: z.ZodUnknown;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"expression">;
|
|
sfeel: z.ZodString;
|
|
}, z.core.$strip>], "from">;
|
|
}, z.core.$strip>>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"terminate">;
|
|
}, z.core.$strip>], "kind">;
|
|
nudge: z.ZodOptional<z.ZodObject<{
|
|
deadline: z.ZodString;
|
|
steps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
after: z.ZodString;
|
|
action: z.ZodEnum<{
|
|
nudge: "nudge";
|
|
escalate: "escalate";
|
|
}>;
|
|
}, z.core.$strip>>>;
|
|
}, z.core.$strip>>;
|
|
message: z.ZodOptional<z.ZodString>;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"gateway">;
|
|
gateway: z.ZodEnum<{
|
|
parallel: "parallel";
|
|
exclusive: "exclusive";
|
|
}>;
|
|
mode: z.ZodEnum<{
|
|
join: "join";
|
|
fork: "fork";
|
|
}>;
|
|
basis: z.ZodOptional<z.ZodString>;
|
|
id: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
label: z.ZodString;
|
|
sub: z.ZodOptional<z.ZodString>;
|
|
layout: z.ZodOptional<z.ZodObject<{
|
|
row: z.ZodNumber;
|
|
col: z.ZodNumber;
|
|
x: z.ZodOptional<z.ZodNumber>;
|
|
y: z.ZodOptional<z.ZodNumber>;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>], "kind">>;
|
|
edges: z.ZodArray<z.ZodObject<{
|
|
id: z.ZodString;
|
|
from: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
to: z.core.$ZodBranded<z.ZodString, "NodeId", "out">;
|
|
condition: z.ZodOptional<z.ZodString>;
|
|
mapping: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
target: z.ZodString;
|
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
from: z.ZodLiteral<"output-port">;
|
|
port: z.ZodString;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"workflow-var">;
|
|
name: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"initiation">;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"constant">;
|
|
value: z.ZodUnknown;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"expression">;
|
|
sfeel: z.ZodString;
|
|
}, z.core.$strip>], "from">;
|
|
}, z.core.$strip>>>;
|
|
label: z.ZodOptional<z.ZodString>;
|
|
tone: z.ZodOptional<z.ZodEnum<{
|
|
ok: "ok";
|
|
bad: "bad";
|
|
}>>;
|
|
reopen: z.ZodDefault<z.ZodBoolean>;
|
|
}, z.core.$strip>>;
|
|
variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
name: z.ZodString;
|
|
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
}, z.core.$strip>>>;
|
|
description: z.ZodOptional<z.ZodString>;
|
|
diagram: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
}, z.core.$strip>;
|
|
export type ProcessPackage = z.infer<typeof processPackageSchema>;
|
|
export declare const CLOSURE_VIOLATION_KINDS: readonly ["edge-unmapped", "required-unmapped", "type-conflict", "dangling-node", "gateway-unbalanced", "join-ambiguous-source", "tolerate-required-dependency", "unknown-activity", "missing-owner-position"];
|
|
export declare const closureViolationKindSchema: z.ZodEnum<{
|
|
"edge-unmapped": "edge-unmapped";
|
|
"required-unmapped": "required-unmapped";
|
|
"type-conflict": "type-conflict";
|
|
"dangling-node": "dangling-node";
|
|
"gateway-unbalanced": "gateway-unbalanced";
|
|
"join-ambiguous-source": "join-ambiguous-source";
|
|
"tolerate-required-dependency": "tolerate-required-dependency";
|
|
"unknown-activity": "unknown-activity";
|
|
"missing-owner-position": "missing-owner-position";
|
|
}>;
|
|
export type ClosureViolationKind = z.infer<typeof closureViolationKindSchema>;
|
|
export declare const closureViolationSchema: z.ZodObject<{
|
|
kind: z.ZodEnum<{
|
|
"edge-unmapped": "edge-unmapped";
|
|
"required-unmapped": "required-unmapped";
|
|
"type-conflict": "type-conflict";
|
|
"dangling-node": "dangling-node";
|
|
"gateway-unbalanced": "gateway-unbalanced";
|
|
"join-ambiguous-source": "join-ambiguous-source";
|
|
"tolerate-required-dependency": "tolerate-required-dependency";
|
|
"unknown-activity": "unknown-activity";
|
|
"missing-owner-position": "missing-owner-position";
|
|
}>;
|
|
nodeId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "NodeId", "out">>;
|
|
edgeId: z.ZodOptional<z.ZodString>;
|
|
field: z.ZodOptional<z.ZodString>;
|
|
message: z.ZodString;
|
|
}, z.core.$strip>;
|
|
export type ClosureViolation = z.infer<typeof closureViolationSchema>;
|
|
export declare const closureReportSchema: z.ZodObject<{
|
|
closed: z.ZodBoolean;
|
|
violations: z.ZodArray<z.ZodObject<{
|
|
kind: z.ZodEnum<{
|
|
"edge-unmapped": "edge-unmapped";
|
|
"required-unmapped": "required-unmapped";
|
|
"type-conflict": "type-conflict";
|
|
"dangling-node": "dangling-node";
|
|
"gateway-unbalanced": "gateway-unbalanced";
|
|
"join-ambiguous-source": "join-ambiguous-source";
|
|
"tolerate-required-dependency": "tolerate-required-dependency";
|
|
"unknown-activity": "unknown-activity";
|
|
"missing-owner-position": "missing-owner-position";
|
|
}>;
|
|
nodeId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "NodeId", "out">>;
|
|
edgeId: z.ZodOptional<z.ZodString>;
|
|
field: z.ZodOptional<z.ZodString>;
|
|
message: z.ZodString;
|
|
}, z.core.$strip>>;
|
|
}, z.core.$strip>;
|
|
export type ClosureReport = z.infer<typeof closureReportSchema>;
|
|
export declare const TRIGGER_KINDS: readonly ["periodic", "event", "registration"];
|
|
export declare const triggerKindSchema: z.ZodEnum<{
|
|
periodic: "periodic";
|
|
event: "event";
|
|
registration: "registration";
|
|
}>;
|
|
export type TriggerKind = z.infer<typeof triggerKindSchema>;
|
|
export declare const TRIGGER_KIND_LABEL: Readonly<Record<TriggerKind, string>>;
|
|
export declare const triggerConfigSchema: z.ZodObject<{
|
|
id: z.core.$ZodBranded<z.ZodString, "TriggerId", "out">;
|
|
name: z.ZodString;
|
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
processPackageId: z.core.$ZodBranded<z.ZodString, "ProcessPackageId", "out">;
|
|
mapping: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
target: z.ZodString;
|
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
from: z.ZodLiteral<"output-port">;
|
|
port: z.ZodString;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"workflow-var">;
|
|
name: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"initiation">;
|
|
path: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"constant">;
|
|
value: z.ZodUnknown;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
from: z.ZodLiteral<"expression">;
|
|
sfeel: z.ZodString;
|
|
}, z.core.$strip>], "from">;
|
|
}, z.core.$strip>>>;
|
|
spec: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
kind: z.ZodLiteral<"periodic-calendar">;
|
|
calendar: z.ZodString;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"periodic-data">;
|
|
domain: z.ZodString;
|
|
object: z.ZodString;
|
|
dateField: z.ZodString;
|
|
offset: z.ZodString;
|
|
filter: z.ZodOptional<z.ZodString>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"event">;
|
|
rule: z.ZodString;
|
|
eventType: z.ZodDefault<z.ZodEnum<{
|
|
human: "human";
|
|
data: "data";
|
|
time: "time";
|
|
control: "control";
|
|
}>>;
|
|
}, z.core.$strip>, z.ZodObject<{
|
|
kind: z.ZodLiteral<"registration">;
|
|
formHint: z.ZodOptional<z.ZodString>;
|
|
}, z.core.$strip>], "kind">;
|
|
}, z.core.$strip>;
|
|
export type TriggerConfig = z.infer<typeof triggerConfigSchema>;
|
|
/** 四个判别值 → 三类分类学(OS 3.1) */
|
|
export declare function triggerKindOf(spec: TriggerConfig['spec']): TriggerKind;
|