Moves a saga from from to to and applies patch, only if it is still in from. Returns
false and changes nothing if it already moved on, so two sweeps can't both advance it.
Optionaloptions: CallOptionsGrabs up to limit due sagas, each locked so concurrent sweeps take different ones. Only
RESERVED and SUBMITTED rows are candidates: a row still REQUESTED means its opening
transaction crashed partway, and the sweep skips it on purpose.
Optionaloptions: CallOptionsSets the saga FAILED and records reason, whatever state it held — no compare-and-set, and
no posting. This is the operator door (exposed over the HTTP store adapter); the payout
sweep fails a saga via advance paired with the reserve-release posting in one transaction.
An unknown id changes nothing.
Optionaloptions: CallOptionsIf more than one saga ever carried this provider reference, the newest updatedAt wins.
Optionaloptions: CallOptionsThe max updatedAt over all of the user's sagas in any state, enforcing
config.payoutMinIntervalMs. updatedAt only advances, so the max never undershoots the
latest request; null when the user has no sagas, so a first request is always allowed.
Optionaloptions: CallOptionsEvery saga newest updatedAt first; ties on updatedAt break by id descending.
states narrows to exactly those states (an empty list yields nothing); the SQL engines
push the filter down.
Optionaloptions: CallOptions & {Optionaloptions: CallOptionsUpserts by saga.id. Called inside requestPayout's transaction with the reserve posting,
so an open saga without its reserve never survives.
Optionaloptions: CallOptions
Tracks each multi-step payout (a "saga") as it moves through its states. A background sweep picks up sagas that are due and pushes each one to its next state.