feat: process BPM notification tasks with verified readonly forms
This commit is contained in:
1 parent
94fc985553
commit
a9d050d87a
28 files changed
+879
-34
No files matched your search
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
const {contracts}=require('./bpm-form-contracts.json');
|
||||
const fail=message=>{throw Object.assign(new Error(message),{status:409});};
|
||||
|
||||
// These contracts associate a sampled full form path with list metadata. They
|
||||
// never classify an order or establish a history sample as a current arrival.
|
||||
function resolveFormIdentity(identity,{processName,listProcessVersion}){
|
||||
const path=decodeURIComponent(identity.url.pathname);
|
||||
const candidates=contracts.filter(contract=>contract.path===path);
|
||||
const formName=identity.processName,formVersion=identity.processVersion||null;
|
||||
if(candidates.length){
|
||||
const process=candidates.filter(contract=>contract.processName===processName);
|
||||
if(!process.length)fail('列表流程与已核验的完整表单路径不一致。');
|
||||
if(!listProcessVersion||!process.some(contract=>contract.listVersion===String(listProcessVersion)))fail('列表流程版本与已核验的表单契约不一致。');
|
||||
return {processName,processVersion:formVersion||'list:'+listProcessVersion+'|form:'+path,formName,formVersion,formPath:path,formMatchSource:'verified-form-contract'};
|
||||
}
|
||||
// Preserve the original strict same-name, explicitly versioned contract.
|
||||
// Aliases and forms without a V-number always require a verified full path.
|
||||
if(!formVersion||!processName||processName!==formName)fail('列表流程与详情表单不一致,或完整表单路径尚未核验。');
|
||||
return {processName,processVersion:formVersion,formName,formVersion,formPath:path,formMatchSource:'exact-versioned-form-name'};
|
||||
}
|
||||
module.exports={resolveFormIdentity};
|
||||
Reference in new issue
Block a user