Releases: dry-rb/dry-transaction
Releases · dry-rb/dry-transaction
v0.16.0
v0.15.0
v0.14.0
v0.13.3
Fixed
- Fix deprecation warning on Ruby 3.0 when there are empty hash-like args (via #137) (@bestwebua)
v0.13.2
v0.13.1
0.13.0
0.13.0 / 2018-06-13
Changed
- Internal step operations (steps backed by instance methods) can now be replaced via constructor arguments. Using instance methods to wrap external step operations now only works if the step is defined using the
with:option (timriley in #109)
0.11.0
Added
- Around steps, which allow control of the execution of subsequently called steps. If you know how middleware works in rack or how around callbacks can be used in RSpec, it's the same. A typical example of usage would be for DB transactions (now first class support!) or controlling side effects: rolling back the changes, cleaning garbage produced by a failed transaction, etc. See a more detailed explanation of how this works in the PR (flash-gordon in #85)
- Broadcast when a step has started by sending the event
step_called(mihairadulescu in #82) - Add new step
checkthat returnsSuccessorFailurebase on conditions (semenovDL in #84) - Support for transaction steps without input values (GustavoCaso and timriley in #69)
Changed
- [BREAKING] Steps no longer broadcast events with their step name followed by
_successor_failure. Now, more generic names are used for the broadcast events. Before each step runs, astepevent is broadcast, with the step name and its arguments. After a step runs, astep_succeededorstep_failedevent is broadcast, also with the step name, the arguments and the return value (GustavoCaso in #83) - [BREAKING] Pub/sub support is now handled using dry-events instead of wisper. Subscriber objects should now respond to
#on_step,#on_step_succeeded, or#on_step_failedto receive broadcast events (GustavoCaso in #90) - [BREAKING] The step adapter API has been changed in order to support around steps, although, the changes are not significant. Previously, an adapter received a
stepand a list of arguments for calling the operation. The list was passed as*argsthen you were needed to callcall_operationonstepand provide the list. From now on an adapter gets anoperation, itsoptions, andargs(without*).operationis an ordinary callable object so a typical call is as simple asoperaiton.(*args), that's it. If you want to turn your adapter into an around-like one you need to add&blockparameter to the list ofcallarguments (e.g.def call(operation, options, args, &block)).blockis responsible for calling the subsequent steps thus you can check or transform the return value and make some decisions based on it. Note capturing the block in the list of arguments is mandatory, a simpleyieldwon't work, there are reasons, believe us. Check out the sources ofaround.rbfor reference, it's dead simple (flash-gordon in #85) - Usages of the
Eithermonad was updated withResultand its constructors. See the changes indry-monadsfor more details (flash-gordon in #81) - Minimal Ruby version is 2.2 (flash-gordon in #72)