withTransaction<T>(work: TransactionWork<T>): Promise<T>
Use this rather than a plain batch only when a multi-step write needs logic between steps, such as create → check capacity → finalize, where a zero-row guard must abort and undo everything.
Concurrent calls serialise on the shared connection. A retry re-runs work
on a fresh transaction, so work must be safe to run twice.
Cache invalidations fire once the commit succeeds.
work: TransactionWork<T>
Promise<T>