feat: unify BPM health and guard session recovery with state machines
This commit is contained in:
1 parent
97e06328c3
commit
42d19c707d
23 files changed
+681
-90
No files matched your search
@@ -1,9 +1,10 @@
|
||||
// This router is called only after dashboard authentication and same-origin validation.
|
||||
const {connectionSnapshot}=require('../bpm/connection-status.cjs');
|
||||
async function workspaceApi({workspace,store,user,route,method,body,reply,bpmSessions,bpmMonitor,bpmLifecycle,orderRules}){
|
||||
if(!workspace)return false;
|
||||
const members=()=>store.users();
|
||||
if(route==='/api/workspace'||route.startsWith('/api/exceptions'))workspace.syncBusinessIssues?.(orderRules?.all('business-issues')||[],members());
|
||||
if(route==='/api/workspace' && method==='GET'){const snapshot=workspace.snapshot(members());snapshot.capabilities.remoteLogin=Boolean(bpmSessions);snapshot.connections=snapshot.connections.map(c=>({...c,health:bpmSessions?.health?.snapshot(c.id)||{},monitoring:bpmMonitor?.snapshot(c.id)||{status:c.status==='disabled'?'paused':'waiting'}}));reply(200,snapshot);return true;}
|
||||
if(route==='/api/workspace' && method==='GET'){const snapshot=workspace.snapshot(members());snapshot.capabilities.remoteLogin=Boolean(bpmSessions);snapshot.connections=snapshot.connections.map(c=>connectionSnapshot(c,{manager:bpmSessions,monitor:bpmMonitor}));reply(200,snapshot);return true;}
|
||||
if(method!=='POST')return false;
|
||||
if(route==='/api/calendar'){reply(200,workspace.saveCalendar(body,user));return true;}
|
||||
if(route==='/api/exceptions'){reply(201,workspace.createException(body,user,members()));return true;}
|
||||
|
||||
Reference in new issue
Block a user