(tableId: string)
| 308 | } |
| 309 | |
| 310 | export async function listActiveDispatches(tableId: string): Promise<DispatchRow[]> { |
| 311 | const rows = await db |
| 312 | .select() |
| 313 | .from(tableRunDispatches) |
| 314 | .where( |
| 315 | and( |
| 316 | eq(tableRunDispatches.tableId, tableId), |
| 317 | inArray(tableRunDispatches.status, [...ACTIVE_DISPATCH_STATUSES]) |
| 318 | ) |
| 319 | ) |
| 320 | return rows.map((row) => ({ |
| 321 | id: row.id, |
| 322 | tableId: row.tableId, |
| 323 | workspaceId: row.workspaceId, |
| 324 | requestId: row.requestId, |
| 325 | mode: row.mode as DispatchMode, |
| 326 | scope: row.scope as DispatchScope, |
| 327 | status: row.status as DispatchStatus, |
| 328 | cursor: row.cursor, |
| 329 | limit: (row.limit as DispatchLimit | null) ?? null, |
| 330 | processedCount: row.processedCount, |
| 331 | isManualRun: row.isManualRun, |
| 332 | triggeredByUserId: row.triggeredByUserId, |
| 333 | requestedAt: row.requestedAt, |
| 334 | })) |
| 335 | } |
| 336 | |
| 337 | export async function readDispatch(dispatchId: string): Promise<DispatchRow | null> { |
| 338 | const [row] = await db |
no test coverage detected