Commit graph

54 commits

Author SHA1 Message Date
7feb71666a
feat(Reactor.Dsl.Flunk): Add a special step type which always fails. (#125)
This is especially useful for switch branches which should never be reached.
2024-09-16 09:48:56 +12:00
379df605c9
fix: Reactor.run!/4 should not return an :ok tuple. 2024-08-12 17:03:27 +12:00
e8ac9a1d90
feat(map): Add the ability to map over elements of a collection inside a reactor. (#123)
* feat(map): Add the ability to map over elements of a collection inside a reactor.

* improvement: throw a more helpful error when a step returns an invalid result.

* fix: automatically pass extra arguments from the map step to nested steps.

They can't be referred to directly because they may be added to the graph
at runtime, and may depend on steps which have been completed and their
results discarded because they have no dependents at that time.

* fix: spurious test failures seemingly caused by `Mimic`.
2024-07-18 21:56:46 +12:00
ebb1374906
improvement: add mix reactor.install (#124) 2024-07-10 20:15:43 +12:00
0747673a31
fix: inability to store composed reactors at compile time. 2024-05-25 15:07:58 +12:00
9410f7d37a
fix: Missing __identifier__ field in compose DSL struct. 2024-05-24 21:43:53 +12:00
220227d459
fix: initialisation issue with middlewares.
So yeah, apparently `function_exported?/3` doesn't ensure that the module in question is actually loaded.
2024-05-08 19:16:48 +12:00
76234423ea
fix(RunStepError): pass entire step struct instead of just name when raising. 2024-03-21 10:42:18 +13:00
dfc56a871c
improvement: Add template guards. 2024-03-19 10:42:12 +13:00
181017a884
chore(deps): Update to splode v0.2.0. (#101) 2024-03-19 10:26:42 +13:00
7032155f97
docs: Add option schemas to public API functions and improve docs. (#99) 2024-03-18 14:21:50 +13:00
27a01e7862
improvement!: Use Splode for managing errors. (#97) 2024-03-18 13:05:09 +13:00
eac0b668c9
fix: Don't assume UndefinedFunctionError means the module is not a Reactor. 2024-03-02 12:04:05 +13:00
eeb9614271
chore(deps): Update Spark v2.0.1. 2024-03-02 11:32:01 +13:00
37b9eda48e
feat: Add telemetry middleware. (#93)
* improvement: don't incur compile-time dependencies on middleware.

* feat: Add a middleware which emits telemetry events about Reactor.
2024-02-29 09:23:51 +13:00
ee72c64af9
fix: incorrect function arity for Group.after_fun DSL. 2024-02-27 11:00:09 +13:00
01fddd19b0
improvement!: Remove hooks and replace with middleware behaviour. (#90)
* improvement!: Remove hooks and replace with middleware behaviour.

* improvement(Middleware): Add `get_process_context/0` and `set_process_context/1` middleware hooks.

* improvement: Add step event callback to middleware.
2024-02-26 16:20:54 +13:00
387b8f875a
fix: callback spec for Reactor.Step.async?/1. 2024-02-15 14:19:07 +13:00
bd518f3040
perf: Don't iterate the entire graph every time through the loop. (#88) 2024-02-15 14:09:18 +13:00
769825874e
improvement: Move can?/2 and async?/1 into Reactor.Step behaviour. (#87)
Makes it a little bit easier for steps to define their own capabilities at runtime.
2024-02-15 10:55:09 +13:00
012d40e887
improvement: Add ability for steps to decide at runtime whether they should be run asyncronously. (#84) 2024-02-08 12:32:43 +13:00
9aa26b9f3b
feat: Add lifecycle hooks to Reactor (#83)
This will allow user code and extensions to add hook functions to run when the reactor starts, stops, fails, etc.
2024-02-08 11:09:35 +13:00
James Harton
4a57a92ba5
fix: don't deadlock when lots of async reactors are sharing a concurrency pool. (#36) 2023-09-28 11:08:47 +13:00
Zach Daniel
b8fbc672e7
docs: update hexdocs with new spark dsl tools (#59) 2023-09-27 16:23:55 +13:00
James Harton
ab84252311
fix: weird issue with aliases sometimes not being expanded in generated reactors. (#58) 2023-09-26 15:51:53 +13:00
James Harton
f67173b76f
feat: Add collect step entity. (#53)
This change introduces the `collect` step entity to the DSL. It is simply a wrapper around `Reactor.Step.ReturnAllArguments`, but provides the convenience of being able to group together arguments into a single structure for passing into other steps.
2023-09-11 11:58:29 +12:00
f58e8370e3
improvement(Template): Abstract template type so that it can be used by extensions. 2023-09-06 11:59:53 +12:00
f8e5292f3d
fix: Allow reactor DSL section to be patched. 2023-09-04 12:31:57 +12:00
445a3278d1
fix(Reactor): fix call to use Spark.Dsl. 2023-09-01 14:24:18 +12:00
James Harton
252d01ea22
improvement(Dsl): Extract DSL entities into their target modules. (#50)
This helps with reuse in extensions.
2023-09-01 13:44:34 +12:00
9a2738f98b
chore: update to Erlang 26 and Elixir 1.15.5. 2023-09-01 13:24:12 +12:00
James Harton
a9dd4c5c22
fix: Don't swallow errors when a step runs out of retries. (#41)
When a step runs out of retry attempts we either use the error supplied, or synthesise a new one.
2023-07-27 13:26:54 +12:00
James Harton
aa670a4a64
improvement: Add wait_for DSL. (#39) 2023-07-25 10:50:01 +12:00
James Harton
dd75458c76
improvement: Add "subpaths" to templates. (#31) 2023-07-12 07:36:06 +12:00
James Harton
be35183998
improvement(Step.Debug): Add debug step and DSL. (#30) 2023-07-11 12:04:01 +12:00
James Harton
4224aeb23c
improvement(Step.Switch): Add switch DSL and step type. (#29) 2023-07-11 07:20:51 +12:00
James Harton
efc7cb4a91
improvement: Add group DSL entity and Reactor.Step.Group. (#27) 2023-07-04 09:37:53 +12:00
65b302c891
chore: Add doctor. 2023-06-23 15:19:46 +12:00
James Harton
b985126894
improvement(Reactor.Executor): track concurrent process usage across multiple reactors. (#26) 2023-06-23 12:29:27 +12:00
James Harton
749e399c02
feat(Step.Around): Add ability to wrap a function around a group of steps. (#24) 2023-06-23 09:09:42 +12:00
027cf03fb8
perf(Dsl): Build and pre-plan DSL reactors. 2023-06-20 14:09:09 +12:00
e2ac25b69e
perf(Builder): build transformation steps as synchronous. 2023-06-20 13:40:43 +12:00
85bd7b77a2
fix(Executor): don't double-iterate the graph each time through the loop. 2023-06-20 13:34:49 +12:00
James Harton
611bf314f0
improvement: Support timeout and async? Reactor options. (#20) 2023-06-16 16:16:40 +12:00
James Harton
614e6725e2
improvement: Invert DSL entity building. (#19)
Instead of defining how to do it in `Reactor.Info` for all entities present and future, we use a protocol which entities must implement.  This allows us to support dynamically patched entities in the future without having to change core code.
2023-06-16 15:28:00 +12:00
James Harton
8f0248857a
improvement: Allow entire step behaviour to be defined in the DSL. (#18) 2023-06-16 14:39:29 +12:00
1af160c6b3 improvement: Add ability to compose reactors. 2023-06-15 14:57:32 +12:00
James Harton
8450554c41
improvement(Builder): rename internally generated steps to start with :__reactor__. (#10) 2023-06-08 13:25:11 +12:00
James Harton
b23e5ef688
improvement: Add step-wide argument transforms. (#9)
* improvement: Add step-wide argument transforms.

* docs: add more entity documentation.
2023-06-08 11:40:02 +12:00
1442cabeb4
fix(Reactor.Argument): Remove spurious is_atom constraint on Argument.from_input/2..3. 2023-05-15 17:10:53 +12:00