MCPcopy Create free account
hub / github.com/simstudioai/sim / setJobResultKey

Function setJobResultKey

apps/sim/lib/table/jobs/service.ts:320–332  ·  view source on GitHub ↗
(
  tableId: string,
  jobId: string,
  resultKey: string
)

Source from the content-addressed store, hash-verified

318 * The download route reads it; the janitor deletes the file when the terminal job is pruned.
319 */
320export async function setJobResultKey(
321 tableId: string,
322 jobId: string,
323 resultKey: string
324): Promise<void> {
325 await db
326 .update(tableJobs)
327 .set({
328 payload: sql`coalesce(${tableJobs.payload}, '{}'::jsonb) || jsonb_build_object('resultKey', ${resultKey}::text)`,
329 updatedAt: new Date(),
330 })
331 .where(ownsActiveJob(tableId, jobId))
332}
333
334/** Shared WHERE for terminal transitions: this job run, and still in-flight (write-once). */
335function ownsActiveJob(tableId: string, jobId: string) {

Callers 1

runTableExportFunction · 0.90

Calls 2

ownsActiveJobFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected