* Process a stream and emit events through handlers
(stream: AsyncIterable<any>)
| 470 | * Process a stream and emit events through handlers |
| 471 | */ |
| 472 | async process(stream: AsyncIterable<any>): Promise<ProcessorResult> { |
| 473 | // Reset stream state (but keep messages) |
| 474 | this.resetStreamState() |
| 475 | |
| 476 | // Start recording if enabled |
| 477 | if (this.recordingEnabled) { |
| 478 | this.startRecording() |
| 479 | } |
| 480 | |
| 481 | // Process each chunk |
| 482 | for await (const chunk of stream) { |
| 483 | this.processChunk(chunk) |
| 484 | } |
| 485 | |
| 486 | // Stream ended - finalize everything |
| 487 | this.finalizeStream() |
| 488 | |
| 489 | // Finalize recording |
| 490 | if (this.recording) { |
| 491 | this.recording.result = this.getResult() |
| 492 | } |
| 493 | |
| 494 | return this.getResult() |
| 495 | } |
| 496 | |
| 497 | /** |
| 498 | * Process a single chunk from the stream. |
no test coverage detected