On the packaging scriptlets page (https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/), the text and the table indicate that the argument passed to the scriptlets ($1) is always 0 for %pretrans and %posttrans.
However, this was changed in rpm 4.12.0: https://github.com/rpm-software-management/rpm/commit/ab069ec876639d46d12dd76dad54fd8fb762e43d
With this change, I believe the new behavior as follows, but I have not tested all these cases:
%pretrans - Install: $1 = 1, Upgrade $1 = 2
%posttrans - Install: $1 = 1, Upgrade $1 = 1
The old behavior should still perhaps be noted though, since packages may need to target or work with older versions.
Commit 8c089ff fixes this issue
to comment on this ticket.