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

Function dispatchAfterBatchInsert

apps/sim/lib/table/rows/service.ts:321–341  ·  view source on GitHub ↗
(
  table: TableDefinition,
  result: TableRow[],
  requestId: string,
  actorUserId?: string | null
)

Source from the content-addressed store, hash-verified

319 * no rows and no-op.
320 */
321export function dispatchAfterBatchInsert(
322 table: TableDefinition,
323 result: TableRow[],
324 requestId: string,
325 actorUserId?: string | null
326): void {
327 void fireTableTrigger(table.id, table.name, 'insert', result, null, table.schema, requestId)
328 // Scope to the newly-inserted row ids so the dispatcher doesn't walk every
329 // row in the table. After the sidecar migration, all existing rows have
330 // zero entries → `mode:'new'`'s `NOT EXISTS` filter would otherwise include
331 // them, dispatching workflows on every row in a populated table.
332 void runWorkflowColumn({
333 tableId: table.id,
334 workspaceId: table.workspaceId,
335 rowIds: result.map((r) => r.id),
336 mode: 'new',
337 isManualRun: false,
338 requestId,
339 triggeredByUserId: actorUserId,
340 }).catch((err) => logger.error(`[${requestId}] auto-dispatch (batchInsertRows) failed:`, err))
341}
342
343/**
344 * Replaces all rows in a table with a new set of rows. Deletes existing rows

Callers 2

route.tsFile · 0.90
batchInsertRowsFunction · 0.85

Calls 3

fireTableTriggerFunction · 0.90
runWorkflowColumnFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected