( table: TableDefinition, result: TableRow[], requestId: string, actorUserId?: string | null )
| 319 | * no rows and no-op. |
| 320 | */ |
| 321 | export 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 |
no test coverage detected