(row: Record<string, unknown>)
| 68 | } |
| 69 | |
| 70 | function parseRow(row: Record<string, unknown>): AgentRun { |
| 71 | const percent = row.percent; |
| 72 | return { |
| 73 | id: String(row.id), |
| 74 | owner: String(row.owner), |
| 75 | title: String(row.title), |
| 76 | step: row.step == null ? undefined : String(row.step), |
| 77 | percent: percent == null ? null : Number(percent), |
| 78 | status: String(row.status) as ProgressStatus, |
| 79 | metadata: row.metadata |
| 80 | ? safeJsonParse<Record<string, unknown> | undefined>( |
| 81 | row.metadata, |
| 82 | undefined, |
| 83 | ) |
| 84 | : undefined, |
| 85 | startedAt: new Date(Number(row.started_at)).toISOString(), |
| 86 | updatedAt: new Date(Number(row.updated_at)).toISOString(), |
| 87 | completedAt: |
| 88 | row.completed_at == null |
| 89 | ? null |
| 90 | : new Date(Number(row.completed_at)).toISOString(), |
| 91 | }; |
| 92 | } |
| 93 | |
| 94 | export async function insertRun(input: StartRunInput): Promise<AgentRun> { |
| 95 | await ensureTable(); |
no test coverage detected