MCPcopy Index your code
hub / github.com/simstudioai/sim / parseCompletedMarker

Function parseCompletedMarker

apps/sim/lib/logs/execution/progress-markers.ts:187–201  ·  view source on GitHub ↗

* Parse a stored last-completed marker, rebuilding it from validated fields so a * stale or wrong-shaped Redis value can never reach API consumers.

(raw: string | undefined)

Source from the content-addressed store, hash-verified

185 * stale or wrong-shaped Redis value can never reach API consumers.
186 */
187function parseCompletedMarker(raw: string | undefined): ExecutionLastCompletedBlock | undefined {
188 const v = safeJsonParse(raw)
189 if (!isRecord(v)) return undefined
190 const { blockId, blockName, blockType, endedAt, success } = v
191 if (
192 typeof blockId === 'string' &&
193 typeof blockName === 'string' &&
194 typeof blockType === 'string' &&
195 typeof endedAt === 'string' &&
196 typeof success === 'boolean'
197 ) {
198 return { blockId, blockName, blockType, endedAt, success }
199 }
200 return undefined
201}
202
203/**
204 * Read both markers for an execution. Returns an empty object when Redis is

Callers 1

getProgressMarkersFunction · 0.85

Calls 2

safeJsonParseFunction · 0.85
isRecordFunction · 0.70

Tested by

no test coverage detected