* Parse a stored last-started marker, rebuilding it from validated fields so a * stale or wrong-shaped Redis value can never reach API consumers.
(raw: string | undefined)
| 166 | * stale or wrong-shaped Redis value can never reach API consumers. |
| 167 | */ |
| 168 | function parseStartedMarker(raw: string | undefined): ExecutionLastStartedBlock | undefined { |
| 169 | const v = safeJsonParse(raw) |
| 170 | if (!isRecord(v)) return undefined |
| 171 | const { blockId, blockName, blockType, startedAt } = v |
| 172 | if ( |
| 173 | typeof blockId === 'string' && |
| 174 | typeof blockName === 'string' && |
| 175 | typeof blockType === 'string' && |
| 176 | typeof startedAt === 'string' |
| 177 | ) { |
| 178 | return { blockId, blockName, blockType, startedAt } |
| 179 | } |
| 180 | return undefined |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Parse a stored last-completed marker, rebuilding it from validated fields so a |
no test coverage detected