🪻 distributed transcription service thistle.dunkirk.sh
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: fix transcript saving tests

dunkirk.sh 59f82f0d 94b32b21

verified
+47
+4
src/lib/transcript-storage.test.ts
··· 2 2 import { 3 3 getTranscriptVTT, 4 4 saveTranscriptVTT, 5 + hasTranscript, 6 + saveTranscript, 7 + getTranscript, 8 + deleteTranscript, 5 9 } from "./transcript-storage"; 6 10 7 11 test("transcript storage", async () => {
+43
src/lib/transcript-storage.ts
··· 50 50 return null; 51 51 } 52 52 } 53 + 54 + /** 55 + * Compatibility wrappers using VTT as the canonical format 56 + */ 57 + export async function hasTranscript(transcriptionId: string): Promise<boolean> { 58 + const safeId = validateTranscriptionId(transcriptionId); 59 + const filePath = `${TRANSCRIPTS_DIR}/${safeId}.vtt`; 60 + try { 61 + // Try reading the file; if it exists return true 62 + await Bun.file(filePath).text(); 63 + return true; 64 + } catch { 65 + return false; 66 + } 67 + } 68 + 69 + export async function saveTranscript( 70 + transcriptionId: string, 71 + content: string, 72 + ): Promise<void> { 73 + // Store transcripts as VTT files to keep a single canonical format 74 + return saveTranscriptVTT(transcriptionId, content); 75 + } 76 + 77 + export async function getTranscript( 78 + transcriptionId: string, 79 + ): Promise<string | null> { 80 + // Read VTT content as the transcript text 81 + return getTranscriptVTT(transcriptionId); 82 + } 83 + 84 + export async function deleteTranscript(transcriptionId: string): Promise<void> { 85 + const safeId = validateTranscriptionId(transcriptionId); 86 + const filePath = `${TRANSCRIPTS_DIR}/${safeId}.vtt`; 87 + try { 88 + const fs = await import("node:fs"); 89 + if (fs.existsSync(filePath)) { 90 + fs.unlinkSync(filePath); 91 + } 92 + } catch { 93 + // Ignore errors 94 + } 95 + }