@yogthos want me to take a stab at a function to generate all paths that would need to fire from a given transaction?
Yeah it sounds reasonable to me, @scot-brown thoughts?
While the transformation of the changeset would work as expected in your example, I would rather handle the triggered paths without transforming the transaction. It should just be a pure function from the changeset to the modified paths, which is then used by the effects.
And events.
But, yes. Only need the modified paths.
@mafcocinco I've added the pre/post functionality on the dev branch, here's what it looks like https://github.com/domino-clj/domino/blob/dev/test/domino/core_test.cljc#L109
ended up going with ring middleware style for now, but we can play around with it if anybody has better ideas
the pre/post functions are closures that accept the event handler as their argument, and the inner pre function matches the handler arity accepting the context, inputs, and outputs while the post function simply accepts the result returned by the handler
it seems pretty flexible since the wrapper has access to all the information the handler has, and it can short circuit by returning a nil, since a nil return from an event handler is treated as no change
also made sure that pre/post conditions attached to parent path segments are considered
:thumbsup_all:
@yogthos do you envision the pre
and post
handlers being the entry point for validation (`spec` or whatever) or do you think validation will be a more fundamental/explicit piece of the schema?
I was talking to Tommi to see if we could use malli to generate the schema, so that's one potential approach, but attaching validation to pre/post handlers seems like a good approach as well
I don't think we'd want to be too opinionated here, and just highlight different options
agreed.
mostly just provide the mechanism(s) by which validation could be injected.
On a related note, I'm almost finished with changes to work related software that depends on 0.2.0
of domino
. Do you have an ETA on pushing to Clojars?
Pretty soon -- we just need to update the docs. Hopefully tonight if I find time, if not, within next few days
Sounds good. Let me know if I can help. Would like to deploy with 0.2.0
dependency tomorrow.
:thumbsup:
I can push out a new version to clojars tonight, and we can update the docs this week
thanks!
0.2.0 is up on clojars 🙂