withTransaction<T>(work: TransactionWork<T>,unnamed 1?: { invalidateCaches?: boolean; },): 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. Settings writers that synchronize their own cache can explicitly preserve the loaded snapshot.
work: TransactionWork<T>
Promise<T>