MCPcopy Index your code
hub / github.com/simstudioai/sim / mapJobRow

Function mapJobRow

apps/sim/lib/table/jobs/service.ts:52–77  ·  view source on GitHub ↗
(
  row:
    | {
        id: string
        type: string
        status: string
        rowsProcessed: number
        error: string | null
        payload: unknown
      }
    | undefined
)

Source from the content-addressed store, hash-verified

50}
51
52function 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
79const JOB_PROJECTION = {
80 id: tableJobs.id,

Callers 2

latestJobForTableFunction · 0.85
latestJobsForTablesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected