Add readonly todo and archive providers and retire legacy writes

This commit is contained in:
abaishu0730 committed 2026-10-19 12:43:03 +08:00
1 parent 37b4a156c9
commit 5c7ce76f5d
12 files changed
+187 -25

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
'use strict';
const {BpmListClient,normalizeArrival}=require('./list-client.cjs');
// Observed portal sources: Yiez/workflow/worklist/Worklist.js and
// Skyworth/ToDoV2/panel/WorklistV4Panel.js (8.30x.014). Inform lists are excluded.
const TODO_SOURCES=[['portal-v8','bpm/worklist'],['portal-v4','skyworth/todo/v2/workflow/get_process_of_work_v4']];
function normalizeTodo(raw,source){
const row=normalizeArrival(raw,source);
if(!['string','number'].includes(typeof raw.processInstanceId)||!String(raw.processInstanceId))throw Object.assign(new Error('待办缺少流程实例标识。'),{status:502});
return {source:'todo',portalSource:source,taskId:row.taskId,instanceId:String(raw.processInstanceId),revision:raw.revision??0,processName:row.processName,nodeName:row.activityName,receivedAt:row.arrivedAt,serialNum:row.serialNum,title:row.subject,processVersion:String(raw.processVersion??''),detailUrl:source==='portal-v4'&&typeof raw.executionPointerId==='string'?raw.executionPointerId:undefined};
}
class BpmTodoClient extends BpmListClient{constructor(options={}){super({...options,sources:TODO_SOURCES,normalize:normalizeTodo});}}
module.exports={BpmTodoClient,normalizeTodo,TODO_SOURCES};