Fork me on GitHub

Hi! Fantastic library, thank you @wilkerlucio! I'm stuck with collections of items and proper output string for resolver. Let's say I have a collection of items that returns comments for videos. They all have author id. How do I make the ::pc/output structure so I can join in queries on author_id? [[:comment/id :comment/text :comment/author_id]] doesn't work.


I imagine something like: ::pc/output [:comment/id :comment/text :comment/author-id]


but then you need resolvers to traverse from :comment/author-id to its data


Do I need a special indication that I return a collection of maps and not a single map?


🎉 32
pathom 12
👍 4

I got this error when trying to build an app with viz-connector: The required namespace "com.wsscode.async.processing" is not available, it was required by "com/wsscode/pathom/viz/ws_connector/impl/sente_cljs.cljs".


There is a small typo in docs:


To solve problem above I had to manually add [com.wsscode/async "1.0.4"] to my shadow-cljs.edn.


After that works like a charm! HUGE THANKS!


thanks, fixed!


also tip to foce async version, but I will make pathom use a more recent one as well, I guess its one conflicting on it:


Is there a straightforward way to get a pathom resolver to call another one? (I’m using it from Fulcro if that helps?)


@folcon can you give an example?


EG: I have a pathom resolver:

(pc/defresolver session-account-resolver [env _]
  {::pc/output [:account/name]}
  (let [session (get-session env)
        username (some-> session :account/name)]
    {:account/name username}))
Is there some way I can just:
{::pc/input  [:account/name]}
I’ve worked out that I can do this manually by doing:
(defmutation account-resolver [{:keys [parser] :as env} _] {} {:account/name (parser env [:account/name])})
Which gives me a manytomany channel, happy to work with this directly, but just wondering if there’s a helper function to do this? Or some other way to do this?


@folcon what is the input and output of the mutation account-resolver?


and how would you use it?


anyway, I don't find any problem with that approach of calling parser


Well what I’d like to do is this:

(pc/defresolver account-resolver [env opts]
  {::pc/input   [:account/name]
   ::pc/output [:account/info]}
  {:account/info (get-account-info (:account/name opts))})


And pathom works out, why yes I do know how to resolve :account/name, let me grab that and pass it in!


Was this not working? I have it working with a similar setup:

(pc/defresolver current-user-res [env _]
  {::pc/output [:app/current-user]}
  {:app/current-user (get-current-user env)})

;; pathom resolves the current user into the input params here

(pc/defresolver user-tasks-resolver [env {:keys [:app/current-user]}]
  {::pc/input  #{:app/current-user}
   ::pc/output [{:user/tasks [:task/id :task/description]}]}
  (pull [{:user/tasks [:task/id :task/description]}] current-user))
I don't think it's supported for mutations. for that i just invoke the helper (get-current-user) directly in the mutation.


Hmm, I was predominantly using it in mutations, I’ll see if there’s a difference in how they’re run…


why is it a mutation?


Sorry, that’s just me using it as an example, in this case it should be a resolver… But I’d like to be able to do it for mutations too =)…


This sort of thing is also really useful for things that are behind auth, so I can check, does the resolver for a session return a value? Ok, then grab the connected data associated with that account…


Checking =)…


Not quite that, I’ve done that before. In this case I’m trying to get pathom to get data that it knows about, as it has a resolver for it without me having to manually add the code that gets it into the mutation/resolver… Perhaps I should just try manually calling the built in parser function =)… Thanks for the help @myguidingstar!


you're welcome

Chris O’Donnell20:04:51

Another option could be to write a plug in that injects the necessary data into the environment so your resolver can pull it out from there. Don't know enough about your use case to know if that's viable.


Not really, I’m finding the solution of using the parser inline is sufficient =)… I did find a reference in the chat log that what I wanted to do is called nested inputs, apparently it’s something that may be supported in future, but not at present…

👍 4