feat: add guarded order workflow state

This commit is contained in:
abaishu0730 committed 2026-10-22 11:34:59 +08:00
1 parent 9854d2d5c2
commit 6e795a99b7
8 files changed
+250 -5

No files matched your search

+3 -1
View File
@@ -6,6 +6,7 @@ const {mailApi}=require('./mail-api.cjs');
const {bpmScanApi}=require('./bpm-scan-api.cjs');
const {storageApi}=require('./storage-api.cjs');
const {notificationApi}=require('./notification-api.cjs');
const {orderWorkflowApi}=require('./order-workflow-api.cjs');
const {assistantApi}=require('./assistant-api.cjs');
const {respondToPing}=require('./service-ping.cjs');
const {previewAsset,PREVIEW_CSP}=require('./storage-preview-assets.cjs');
@@ -13,7 +14,7 @@ const {SessionStore,SESSION_MS}=require('./dashboard-sessions.cjs');
const isLoopback=address=>['127.0.0.1','::1','::ffff:127.0.0.1'].includes(address);
const publicJob=({path:ignored,...job})=>({...job,downloadable:job.status==='success'});
function createDashboard({store,outputDir,workspace,previewUserId,bpmSessions,mail,scanner,storage,notifications,assistant,health,watchdog,trustedProxy=false}) {
function createDashboard({store,outputDir,workspace,previewUserId,bpmSessions,mail,scanner,storage,notifications,workflow,assistant,health,watchdog,trustedProxy=false}) {
const sessions=new SessionStore(path.dirname(store.file));const failures=new Map();
const sessionCookieName=previewUserId?'order_preview_session':'order_session';
const sessionCookiePattern=new RegExp('(?:^|;\\s*)'+sessionCookieName+'=([a-f0-9]{64})(?:;|$)');
@@ -103,6 +104,7 @@ function createDashboard({store,outputDir,workspace,previewUserId,bpmSessions,ma
if(await bpmScanApi({scanner,workspace,user,sessionId:token,url,route,method:request.method,body,reply}))return;
if(await storageApi({storage,workspace,user,url,route,method:request.method,body,request,response,reply,trustedProxy}))return;
if(await notificationApi({notifications,workspace,user,route,method:request.method,body,reply}))return;
if(await orderWorkflowApi({workflow,user,route,method:request.method,body,reply}))return;
if(await assistantApi({assistant,workspace,user,sessionId:token,route,method:request.method,body,request,reply,trustedProxy}))return;
if(workspaceApi({workspace,store,user,route,method:request.method,body,reply,bpmSessions}))return;
if(route==='/api/overview' && request.method==='GET') {