forked from ChaiHao/BPOS-MVP
M5(1/3): process 的 domain —— 闭合校验、四策略解析、状态聚合
- checkClosure:七类违规(边未映射 / 必填未齐 / 类型冲突 / 孤立节点 / 网关不平衡 / 汇合来源不明 / 容忍分支被必填依赖)+ 活动未安装 + 岗位不存在; 不闭合不得发布 —— 画布即时校验与后端裁决同源 - resolveOwner:四策略封闭(指定人 / 岗位唯一人 / 轮值 / 来源跟随); 岗上多人退轮值,并列按 staffId 稳定排序 —— 解析必须确定性 - aggregateWorkflowState:聚合投影,流程层不另设状态机;计量对象是节点实例, XOR 未选分支不入集合,改道/容忍/升审批已消化即不入异常 - nextInstanceNumber:流级重做重开新实例,不复活旧任务 325 个测试通过,门禁五道全绿 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
co-authored by
Claude Opus 5
parent
3c974d2860
commit
a919d2e961
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* module: process —— 对外类型(编码规范 §10.1;语义出处 OS 03)。
|
||||
*
|
||||
* 流程层:流程包定义与版本、**边映射闭合校验**、工作流实例
|
||||
* (网关 / 审批点 / 失败走向 / 负责人四策略 / 聚合)。
|
||||
*
|
||||
* M5 进行中:domain 已落(闭合校验 / 四策略解析 / 状态聚合),
|
||||
* 用例与 Mastra 工作流编译随后(编码规范 §6.1)。
|
||||
*/
|
||||
import type { ClosureReport, ClosureViolation, OwnerSpec, ProcessPackage, WorkflowState } from '@contracts';
|
||||
import type { ActivityContractFace, ClosureInput } from './internal/domain/closure.ts';
|
||||
import type { Candidate, NodeInstance, ResolveContext, Resolution } from './internal/domain/owner-resolution.ts';
|
||||
|
||||
export type {
|
||||
ActivityContractFace,
|
||||
Candidate,
|
||||
ClosureInput,
|
||||
ClosureReport,
|
||||
ClosureViolation,
|
||||
NodeInstance,
|
||||
OwnerSpec,
|
||||
ProcessPackage,
|
||||
ResolveContext,
|
||||
Resolution,
|
||||
WorkflowState,
|
||||
};
|
||||
|
||||
export class NotPublishableError extends Error {
|
||||
constructor(readonly report: ClosureReport) {
|
||||
super(`流程包不闭合,不得发布:${report.violations.map((v) => v.message).join('; ')}`);
|
||||
this.name = 'NotPublishableError';
|
||||
}
|
||||
}
|
||||
|
||||
export class PositionVacantError extends Error {
|
||||
constructor(readonly position: string) {
|
||||
super(`岗位空缺,无法解析负责人:${position} —— 按节点失败走向处置,或转治理台待指派`);
|
||||
this.name = 'PositionVacantError';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user