(
sessionId: string,
repair: RuntimeLedgerRepair,
source: 'compatibility' | 'import',
)
| 5455 | } |
| 5456 | |
| 5457 | private async ensureTranscriptLedger( |
| 5458 | sessionId: string, |
| 5459 | repair: RuntimeLedgerRepair, |
| 5460 | source: 'compatibility' | 'import', |
| 5461 | ): Promise<void> { |
| 5462 | if (this.preparedTranscriptLedgers.has(sessionId)) return; |
| 5463 | const header = await this.deps.store.readHeader(sessionId); |
| 5464 | if (header.transcriptLedgerVersion === 0 && source !== 'import') { |
| 5465 | throw new Error('Imported Session history is still being prepared'); |
| 5466 | } |
| 5467 | if (header.transcriptLedgerVersion !== 1) { |
| 5468 | await repair.materializeTranscriptLedger(header); |
| 5469 | await this.updateHeader(sessionId, { transcriptLedgerVersion: 1 }); |
| 5470 | } |
| 5471 | this.preparedTranscriptLedgers.add(sessionId); |
| 5472 | } |
| 5473 | |
| 5474 | private async prepareConversationRuntimeLedgerClone( |
| 5475 | sourceSessionId: string, |
no test coverage detected