feat: complete workflow recovery and safe administration

This commit is contained in:
abaishu0730 committed 2026-10-21 12:30:11 +08:00
1 parent 1148aa6f14
commit 69583e8c33
46 files changed
+756 -120

No files matched your search

+1
View File
@@ -6,6 +6,7 @@ class BpmConnectionLifecycle{
async invoke(method,id){try{await this.manager?.[method]?.(id);}catch(error){fail('BPM 连接操作未完成,请刷新状态后重试。',[409,503].includes(error.status)?error.status:502);}}
change(id,enabled,input,user){return this.run(id,async()=>{
if(user.role!=='admin')fail('仅管理员可以启用或停用连接。',403);
if(enabled&&this.pendingCleanup?.hasConnection(id))fail('连接交接清理尚未完成,请刷新管理页面重试后再启用。',503);
if(typeof enabled!=='boolean'||!input||Object.keys(input).some(k=>k!=='version')||!Number.isInteger(input.version)||input.version<0)fail('请提供当前连接版本。',400);
const current=this.workspace.getConnection(id);
if((current.status!=='disabled')!==enabled&&(current.version||0)!==input.version)fail('连接状态已变化,请刷新后重试。',409);