(
row:
| {
id: string
type: string
status: string
rowsProcessed: number
error: string | null
payload: unknown
}
| undefined
)
| 50 | } |
| 51 | |
| 52 | function mapJobRow( |
| 53 | row: |
| 54 | | { |
| 55 | id: string |
| 56 | type: string |
| 57 | status: string |
| 58 | rowsProcessed: number |
| 59 | error: string | null |
| 60 | payload: unknown |
| 61 | } |
| 62 | | undefined |
| 63 | ): DerivedJobFields { |
| 64 | if (!row) return EMPTY_JOB_FIELDS |
| 65 | const doomedCount = |
| 66 | row.type === 'delete' && row.status === 'running' |
| 67 | ? ((row.payload as TableDeleteJobPayload | null)?.doomedCount ?? 0) |
| 68 | : 0 |
| 69 | return { |
| 70 | jobStatus: row.status as TableDefinition['jobStatus'], |
| 71 | jobId: row.id, |
| 72 | jobType: row.type as TableDefinition['jobType'], |
| 73 | jobError: row.error, |
| 74 | jobRowsProcessed: row.rowsProcessed, |
| 75 | pendingDeleteRemaining: Math.max(0, doomedCount - row.rowsProcessed), |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | const JOB_PROJECTION = { |
| 80 | id: tableJobs.id, |
no outgoing calls
no test coverage detected