(
db: import('node:sqlite').DatabaseSync,
sessionId: string,
shellRunId: string,
)
| 112 | } |
| 113 | |
| 114 | function readSqliteShellRun( |
| 115 | db: import('node:sqlite').DatabaseSync, |
| 116 | sessionId: string, |
| 117 | shellRunId: string, |
| 118 | ): ShellRunRecord { |
| 119 | const row = db |
| 120 | .prepare(` |
| 121 | SELECT record_json |
| 122 | FROM core_shell_runs |
| 123 | WHERE session_id = ? AND shell_run_id = ? |
| 124 | `) |
| 125 | .get(sessionId, shellRunId) as { record_json?: unknown } | undefined; |
| 126 | if (!row) throw shellRunNotFoundError(shellRunId); |
| 127 | if (typeof row.record_json !== 'string') throw new Error('Invalid SQLite ShellRun row'); |
| 128 | return normalizeShellRunRecord(JSON.parse(row.record_json), sessionId, shellRunId); |
| 129 | } |
| 130 | |
| 131 | function sanitizeJson(_key: string, value: unknown): unknown { |
| 132 | return value === undefined ? undefined : value; |
no test coverage detected