| 505 | } |
| 506 | } |
| 507 | const runGroups = async (adapter: ORMAdapter<S>): Promise<void> => { |
| 508 | if (!adapter.upsertMany) { |
| 509 | // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: a transaction adapter must mirror the base adapter's upsertMany support |
| 510 | throw new Error("[FumaDB] Transaction adapter does not support upsertMany."); |
| 511 | } |
| 512 | for (const group of groups) { |
| 513 | await adapter.upsertMany(table, { |
| 514 | target: targetColumns, |
| 515 | update: updateColumns, |
| 516 | values: group.values, |
| 517 | where: group.where, |
| 518 | }); |
| 519 | } |
| 520 | }; |
| 521 | |
| 522 | // A single group is one adapter call, which is as atomic as the |
| 523 | // engine allows. Multiple predicate groups are separate adapter |