feat: F023 signal-to-match pipeline & shadow market decision flow
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import type { PipelineState, AuditTrailEntry, GateType } from '../domain/signalPipeline'
|
||||
|
||||
export interface ISignalPipelineProvider {
|
||||
getPipelineState(signalId: string): Promise<PipelineState | null>
|
||||
evaluateGate(signalId: string, gateType: GateType): Promise<PipelineState>
|
||||
getAuditTrail(signalId: string): Promise<AuditTrailEntry[]>
|
||||
publishToFutureAvailability(signalId: string): Promise<PipelineState>
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import type { ISignalPipelineProvider } from './ISignalPipelineProvider'
|
||||
import type { PipelineState } from '../domain/signalPipeline'
|
||||
import { GateStatus, PipelineStage } from '../domain/signalPipeline'
|
||||
import type { GateType } from '../domain/signalPipeline'
|
||||
import { MOCK_PIPELINE_STATES, MOCK_AUDIT_TRAILS } from '../mock-data/signalPipelines'
|
||||
|
||||
let states: PipelineState[] = [...MOCK_PIPELINE_STATES]
|
||||
|
||||
export const MockupSignalPipelineProvider: ISignalPipelineProvider = {
|
||||
async getPipelineState(signalId) {
|
||||
return states.find(s => s.signalId === signalId) ?? null
|
||||
},
|
||||
async evaluateGate(signalId, gateType) {
|
||||
const idx = states.findIndex(s => s.signalId === signalId)
|
||||
if (idx === -1) throw new Error(`Pipeline state for ${signalId} not found`)
|
||||
// Demo: mark gate as re-evaluated (no real logic change)
|
||||
const updated: PipelineState = {
|
||||
...states[idx],
|
||||
gates: {
|
||||
...states[idx].gates,
|
||||
[gateType]: {
|
||||
...states[idx].gates[gateType as GateType],
|
||||
evaluatedAt: new Date().toISOString(),
|
||||
},
|
||||
},
|
||||
}
|
||||
states[idx] = updated
|
||||
return updated
|
||||
},
|
||||
async getAuditTrail(signalId) {
|
||||
return MOCK_AUDIT_TRAILS.filter(e => e.signalId === signalId)
|
||||
.sort((a, b) => b.timestamp.localeCompare(a.timestamp))
|
||||
},
|
||||
async publishToFutureAvailability(signalId) {
|
||||
const idx = states.findIndex(s => s.signalId === signalId)
|
||||
if (idx === -1) throw new Error(`Pipeline state for ${signalId} not found`)
|
||||
const now = new Date().toISOString()
|
||||
states[idx] = {
|
||||
...states[idx],
|
||||
publishedToFutureAvailability: true,
|
||||
publishedAt: now,
|
||||
currentStage: PipelineStage.STAGE_6_MATCHABLE_RESULT,
|
||||
gates: {
|
||||
...states[idx].gates,
|
||||
FEED_ELIGIBILITY_GATE: {
|
||||
...states[idx].gates.FEED_ELIGIBILITY_GATE,
|
||||
status: GateStatus.PASSED,
|
||||
reason: 'Signal manuell in Future Availability publiziert.',
|
||||
evaluatedAt: now,
|
||||
checks: [{ label: 'Manuell publiziert', passed: true, value: 'Ja' }],
|
||||
},
|
||||
},
|
||||
overallEligible: true,
|
||||
}
|
||||
return states[idx]
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user