pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
wilkerlucio 2021-04-19T01:38:22.177700Z

nothing native, but you can create a helper around that receives a single attr

๐Ÿ‘ 1
wilkerlucio 2021-04-19T02:44:04.178Z

๐Ÿ‘ 6
JAtkins 2021-04-19T14:49:21.201100Z

This is AWESOME! Iโ€™ve been thinking about this + the visualization style for a long time, and itโ€™s really neat seeing it actually used somewhere. Makes me even more interested in working on tooling to simplify these kinds of tools :)

๐Ÿ™‚ 1
markaddleman 2021-04-19T02:49:48.178100Z

Thanks for the update!

๐Ÿ™ 1
Matheus Moreira 2021-04-19T09:41:24.200400Z

Hello! Recently I started playing with Pathom 2 and now I have a situation where I have 3 resolvers that produce the same output (:tournament/full-name) but require different inputs and I would like to give them some kind of priority or an order by which they should be tried. Is it possible to do it?

wilkerlucio 2021-04-20T23:04:54.204200Z

gotcha

wilkerlucio 2021-04-20T23:06:13.204400Z

modeling wise, I think of this as first having 3 different attributes, one for each name path, the important part is just to be able to talk about them as different things

wilkerlucio 2021-04-20T23:06:39.204600Z

them, another resolver can ask for the 3 of them, and decide the order based on the available options

wilkerlucio 2021-04-20T23:09:15.204800Z

in Pathom 3 you can use a resolver with 3 optional inputs and make the choice there, in Pathom 2, since there are no optional inputs, what you can do is make a resolver that depends the most broad of the options (the case most easy to access, so it just enough for the engine to trigger it), and inside of the resolver you can call the parser to fetch the other 2 options

wilkerlucio 2021-04-20T23:11:17.205Z

something like:

(pc/defresolver select-name 
  [{:keys [parser] :as env} {:keys [name-opt1]}]
  {::pc/output [:name-choice]}
  (let [{:keys [name-opt2 name-opt3]}
        (parser env [:name-opt2 :name-opt3])]
    {:name-choice
     (or name-opt3
         name-opt2
         name-opt1)}))

Matheus Moreira 2021-04-21T15:27:59.214200Z

Ah, nice! Iโ€™ll try to implement it in my code base. By the way, good to know that you are in the Clojure Brasil group. ๐Ÿ™‚

2021-04-19T14:41:15.200800Z

Pathom 3 has support for resolver prioritization https://pathom3.wsscode.com/docs/resolvers#prioritization not sure if available on pathom2.

Matheus Moreira 2021-04-19T15:14:04.201400Z

Thanks, Iโ€™ll take a look.

wilkerlucio 2021-04-19T16:37:38.201600Z

there is a way to do that in Pathom 2, you can set on the env the key ::pc/sort-plan, in this case you must provide your own function to sort the plans, you can find the default impl here: https://github.com/wilkerlucio/pathom/blob/master/src/com/wsscode/pathom/connect.cljc#L621 that said, its usually not trivial to get a specific resolver order from that, thatโ€™s why in Pathom 3 it was made different

1
Matheus Moreira 2021-04-19T18:53:18.202Z

In my case I have a tournament and its full name property can be resolved by 3 different resolvers depending on which relationship the tournament has with one of organizer, series, and season. Tournament full name is only the tournament name if it is connected to a organizer; tournament + series names if connected to a series; tournament + series + season names if connected to season ( organizer 1:n series 1:n season). I would like to define the order as prioritizing tournament-season, then tournament-series, then tournament-organizer resolvers.