( state: ConsoleStore, workflowId: string, nextEntries: ConsoleEntry[] )
| 181 | } |
| 182 | |
| 183 | function replaceWorkflowEntries( |
| 184 | state: ConsoleStore, |
| 185 | workflowId: string, |
| 186 | nextEntries: ConsoleEntry[] |
| 187 | ): Pick<ConsoleStore, 'workflowEntries' | 'entryIdsByBlockExecution' | 'entryLocationById'> { |
| 188 | const workflowEntries = cloneWorkflowEntries(state.workflowEntries) |
| 189 | const entryIdsByBlockExecution = { ...state.entryIdsByBlockExecution } |
| 190 | const entryLocationById = { ...state.entryLocationById } |
| 191 | const previousEntries = workflowEntries[workflowId] ?? EMPTY_CONSOLE_ENTRIES |
| 192 | |
| 193 | removeWorkflowIndexes(workflowId, previousEntries, entryIdsByBlockExecution, entryLocationById) |
| 194 | |
| 195 | if (nextEntries.length === 0) { |
| 196 | delete workflowEntries[workflowId] |
| 197 | } else { |
| 198 | workflowEntries[workflowId] = nextEntries |
| 199 | indexWorkflowEntries(workflowId, nextEntries, entryIdsByBlockExecution, entryLocationById) |
| 200 | } |
| 201 | |
| 202 | return { workflowEntries, entryIdsByBlockExecution, entryLocationById } |
| 203 | } |
| 204 | |
| 205 | function appendWorkflowEntry( |
| 206 | state: ConsoleStore, |
no test coverage detected