feat: add guarded BPM category and template workflow
Implement server-owned read-only sample checks, category publication, explicit order-version identity and durable PDF/archive/notification steps. Freeze category-bound templates and recipients for isolated scheduled delivery, and require human verification for unknown SMTP outcomes. Add order/batch views and local HTTP/browser/PDF/archive regression coverage. Fix Unicode Windows startup links found by full regression using IShellLinkW. Automatic processing and sending stay disabled; no service deployment. Validation: npm ci; npm test -- --test-concurrency=1 (242 pass, 1 optional ZCode skip, 0 fail); 31 syntax checks; scoped independent code review. Live BPM V13/SMB/163 acceptance remains pending.
This commit is contained in:
1 parent
6e795a99b7
commit
94fc985553
38 files changed
+1204
-131
No files matched your search
@@ -22,6 +22,8 @@ class BpmScanStore{
|
||||
fail(id,message){this.db.prepare('UPDATE runs SET status=?,finished_at=?,message=? WHERE id=?').run('error',new Date().toISOString(),message,id);this.prune();}
|
||||
prune(){this.db.exec("DELETE FROM runs WHERE status!='running' AND id NOT IN(SELECT id FROM runs ORDER BY started_at DESC,rowid DESC LIMIT 200)");}
|
||||
status(){return {config:this.config(),total:this.db.prepare('SELECT COUNT(*) n FROM arrivals').get().n,runs:this.db.prepare('SELECT id,connection_id AS connectionId,actor,started_at AS startedAt,finished_at AS finishedAt,status,seen,added,message FROM runs ORDER BY started_at DESC,rowid DESC LIMIT 30').all()};}
|
||||
getArrival(connectionId,source,taskId){const row=this.db.prepare('SELECT connection_id AS connectionId,value,first_seen AS firstSeenAt FROM arrivals WHERE connection_id=? AND source=? AND task_id=?').get(connectionId,source,taskId);if(!row)return null;const {value,...metadata}=row;return {...JSON.parse(value),...metadata};}
|
||||
recent({since='',limit=500}={}){return this.db.prepare('SELECT connection_id AS connectionId,value,first_seen AS firstSeenAt,last_seen AS lastSeenAt FROM arrivals WHERE first_seen>=? ORDER BY first_seen DESC,task_id LIMIT ?').all(since,limit).map(({value,...metadata})=>({...JSON.parse(value),...metadata}));}
|
||||
list({connectionId='',q='',before='',days=7}={}){
|
||||
if(typeof q!=='string'||q.length>200||typeof connectionId!=='string'||connectionId.length>200||typeof before!=='string'||(before&&!/^\d{4}-\d{2}-\d{2}$/.test(before))||!Number.isInteger(days)||days<1||days>31)throw invalid('查询条件无效。');
|
||||
const conditions=[],args=[];if(connectionId){conditions.push('connection_id=?');args.push(connectionId);}if(q){conditions.push("value LIKE ? ESCAPE '\\'");args.push('%'+q.replace(/[\\%_]/g,'\\$&')+'%');}
|
||||
|
||||
Reference in new issue
Block a user