pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
nivekuil 2021-02-13T00:44:57.255100Z

nice! thanks for the example, didn't know about p/do

wilkerlucio 2021-02-13T00:47:09.255300Z

glad to help, also check p/let, I find that super useful

nivekuil 2021-02-13T01:51:22.255500Z

I think the last commit has a regression: ast only has the value map of`:params` in it. maybe this should be ast on this line? https://github.com/wilkerlucio/pathom3/blob/1da7457bf65dbcd57cc9a7e98bc7eeee7bf6705b/src/main/com/wsscode/pathom3/connect/runner/async.cljc#L348

nivekuil 2021-02-13T01:52:32.255800Z

e.g.

::pcr/wrap-mutate    (fn [mutation]      (fn [env {:keys [key] :as ast}]        (log/info ast)        ...))
ast there is equivalent to the old (get ast :params), so key is nil

wilkerlucio 2021-02-13T03:07:13.256Z

oh, sorry, you are right, this was because I also wanted to enable the user to override the output, and for that I changed the place of invocation of it, fixing it now

markaddleman 2021-02-13T20:04:48.257900Z

I'd like to ensure that all all resolver inputs are smart-maps. I have written this plugin:

(p.plugin/defplugin as-smart-map {::pcr/wrap-resolve (fn [resolve]
                                                       (fn [env node]
                                                         (p.ent-tree/swap-entity! env (fn [m] (if (psm/smart-map? m)
                                                                                                m
                                                                                                (psm/smart-map env m))))
                                                         (resolve env node)))})
When this plugin is activated, retrieving data from the smart-map results in a StackOverflowException. What am I doing wrong?

markaddleman 2021-02-14T14:01:18.258900Z

Thanks for the feedback. I ended up adding the required parameters to the resolver's input. At first, it seemed a little weird because it wasn't the resolver directly that required the parameter but a downstream function which, in another context, was obtaining its parameters from a smart-map.

markaddleman 2021-02-14T14:03:04.259100Z

Right now, I'm leaning towards your opinion: Wrapping a resolver's input as a smart-map is a bad idea.

wilkerlucio 2021-02-14T14:41:01.259300Z

in case the distance between input and the calling part starts get apart, one thing to consider is if there aren't more resolvers in between that could add clarity to the process

markaddleman 2021-02-14T16:56:58.259500Z

I don't understand this. How would I place a resolver between a resolver implementation and a downstream function?

wilkerlucio 2021-02-14T17:00:36.259700Z

this is hard to explain without a concrete example, can you give a quick version of how you doing this, where the input is farther from the resolver call?