the plugins are so much nicer to write in pathom 3!
probably should be you, I don't know enough about best practices :)
thanks 🙂 what change you found made it nicer in your opinion?
it's much shorter, for one.
(def mulog-trace-plugin - {::pc/wrap-resolve - (fn [resolver] - (fn [env input] - (u/trace (-> env ::pc/resolver-data ::pc/sym keyword) - [] - (resolver env input)))) - ::p/wrap-mutate - (fn [mutate] - (fn [env k params] - (let [out (mutate env k params)] - (cond-> out - (:action out) - (update :action - (fn [action] - (fn [] - (u/trace (keyword k) - [] - (action)))))))))})
vs(defplugin mulog-trace-plugin {::pcr/wrap-resolve (fn [resolver] (fn [env node] (u/trace (-> node ::pco/op-name str) [] (resolver env node)))) ::pcr/wrap-mutate (fn [mutation] (fn [env ast] (u/trace (-> ast :key str) [] (mutation env ast))))})
it generally just feels much smoother to work with operations directly, as you can call them like functions and mutations/resolvers seem to share more structure than in p2
more fun to work with means I actually write plugins. for example, I think pc/transform is not in p3 but it was really easy to just write a custom plugin to replace it
in general I think a lot of small changes added up to make p3 feel much more streamlined
thank you very much for the feedback 🙏
yeah, mutation plugins were a real pain in the ass in Pathom 2
just one thing to note though, what you get in the plugin isn't the resolver, neighter the mutation
its the functions that wrap their call inside the runner
if you want to access the actual resolver or mutation, you must use the node
on resolver, and ast
+ index
in the mutation
yeah, I figured out something like this: (get-in env [::pci/index-mutations (:key ast) :config])
not sure if it's mentioned in the docs
no, if you like to add PR is welcome, or I can put in a todo list here