(executionId: string, afterEventId: number)
| 402 | } |
| 403 | |
| 404 | function readMemoryEvents(executionId: string, afterEventId: number): ExecutionEventsReadResult { |
| 405 | pruneExpiredMemoryStreams() |
| 406 | const stream = memoryExecutionStreams.get(executionId) |
| 407 | if (!stream) return { status: 'ok', events: [] } |
| 408 | const earliestEventId = stream.meta?.earliestEventId |
| 409 | if ( |
| 410 | isReplayBeforeAvailableEvents(afterEventId, earliestEventId, stream.meta?.replayStartEventId) |
| 411 | ) { |
| 412 | return { status: 'pruned', earliestEventId } |
| 413 | } |
| 414 | return { |
| 415 | status: 'ok', |
| 416 | events: stream.events.filter((entry) => entry.eventId > afterEventId), |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | function createMemoryExecutionEventWriter( |
| 421 | executionId: string, |
no test coverage detected