pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
fjolne 2021-03-30T09:18:36.085400Z

hi, i've been playing with p3 recently and found a weird behaviour on nested inputs resolvers: they mess up indicies in some way, both not working by themselves and making other resolvers invisible. here's a repro: http://nextjournal.com/fjolne/pathom3-nested-input-issue

fjolne 2021-03-30T09:20:14.086900Z

i tried looking through pathom viz snapshots, but the logs did't make much sense: some existing relationships are marked as unreachable when I add nested inputs resolver

roklenarcic 2021-03-30T10:34:46.088500Z

Has anyone tried to expose a bunch of resolvers as a GraphQL interface? I see examples where GraphQL is called by pathom, but never the other way around… It could be useful when you need to expose it to other frameworks/languages

2021-03-30T10:41:36.088600Z

@roklenarcic For pathom2 there is https://github.com/denisidoro/graffiti for pathom3 there is still nothing available yet, there is an open discussion with ideas to achieve something similar https://github.com/wilkerlucio/pathom3/discussions/18

roklenarcic 2021-03-30T12:34:45.089Z

Interesting… thanks

fjolne 2021-03-30T18:02:54.090600Z

also got a problem with p3 batch resolvers, created issues for both: https://github.com/wilkerlucio/pathom3/issues/29 , https://github.com/wilkerlucio/pathom3/issues/30

wilkerlucio 2021-03-30T20:29:42.090900Z

awesome, thanks, I'll have a look as soon as possible

dehli 2021-03-30T20:49:34.091700Z

is there anything special needed to get batch resolvers working with the parallel parser in pathom2? i’m running into some issues when i follow the docs here: https://blog.wsscode.com/pathom/v2/pathom/2.2.0/connect/resolvers.html#_n1_queries_and_batch_resolvers.

dehli 2021-03-31T12:04:23.093100Z

After digging into this more it seems to be due to there being two resolvers that can get to the same key. With batch it keeps spitting out insufficient resolver output (referencing the resolver that shouldn’t be used) and without batch, pathom can appropriately get to the right resolver.

dehli 2021-03-31T12:17:17.093300Z

what’s strange is my basic query is below. The first one appropriately returns :user/id however the second one has the insufficient resolver output which must be for :user.session/started-at since it takes as input :session/id and :user/id.

;; Works with batch and non-batch
[{[:user/id "foo"]
  [{:user/staff 
    [:user/id]}]}]

;; Doesn't work with batch, works with non-batch
[{[:user/id "foo"]
  [{:user/staff 
    [:user/id
     {(:>/session {:session/id "bar"})
      [:user.session/started-at]}]}]}]

wilkerlucio 2021-03-30T20:59:38.092Z

nothing special about parallel parser there, what issue you are facing?

dehli 2021-03-30T21:07:59.092200Z

Hmmm, I’ll keep digging. A query i have that normally takes ~20s (without batch) ends up having a lot of Insufficient resolver output in the response. The basic resolver shape looks like this (which works when I have batch? false )

(if (sequential? input#)
  (->> input#
       (mapv get-fn#)
       promesa.core/all
       cljs.core.async.interop/<p!
       (mapv out-fn#))

  (->> (get-fn# input#)
       cljs.core.async.interop/<p!
       out-fn#))

wilkerlucio 2021-03-30T21:21:34.092500Z

note this may be an error in your batch output

wilkerlucio 2021-03-30T21:21:54.092700Z

it must match exactly the input in number of items and order, otherwise you will have broken results

dehli 2021-03-30T21:29:18.092900Z

thanks! that’s a helpful tip!