| 30 | function buildDeps(requestId: string): IncrementalImportDeps { |
| 31 | return { |
| 32 | openDatabase(sessionId: string, readonly?: boolean) { |
| 33 | const dbPath = getDbPath(sessionId) |
| 34 | if (!fs.existsSync(dbPath)) { |
| 35 | throw new Error(`Session database not found: ${sessionId}`) |
| 36 | } |
| 37 | const db = new Database(dbPath, { readonly }) |
| 38 | db.pragma('journal_mode = WAL') |
| 39 | if (!readonly) db.pragma('synchronous = NORMAL') |
| 40 | return new BetterSqliteAdapter(db) |
| 41 | }, |
| 42 | onProgress(progress) { |
| 43 | sendProgress(requestId, progress) |
| 44 | }, |