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

Function latestJobForTable

apps/sim/lib/table/jobs/service.ts:94–105  ·  view source on GitHub ↗
(
  tableId: string,
  executor: DbOrTx = db
)

Source from the content-addressed store, hash-verified

92 * and SSE consumer derive from these fields.
93 */
94export async function latestJobForTable(
95 tableId: string,
96 executor: DbOrTx = db
97): Promise<DerivedJobFields> {
98 const [row] = await executor
99 .select(JOB_PROJECTION)
100 .from(tableJobs)
101 .where(and(eq(tableJobs.tableId, tableId), ne(tableJobs.type, 'export')))
102 .orderBy(desc(tableJobs.startedAt))
103 .limit(1)
104 return mapJobRow(row)
105}
106
107/** Latest non-export job per table for a batch of ids, via `DISTINCT ON (table_id)`. */
108export async function latestJobsForTables(

Callers 1

getTableByIdFunction · 0.90

Calls 2

mapJobRowFunction · 0.85
eqFunction · 0.50

Tested by

no test coverage detected