Fork me on GitHub
#pathom
<
2019-12-11
>
thosmos10:12:53

I’m attempting to make a single-input resolver to handle a pull-like query based on an ident like this: [{[:agency/id "123"] [:db/id :agency/Active :agency/Name ,,, {:agency/Projects [:db/id :project/Name ,,,]}]}] I’m needing the query and the list of keys, but the problem is that the :query key is missing from the AST and only the first query key is mentioned in the AST: {:type :prop, :dispatch-key :db/id, :key :db/id} What’s the right way to do this? The resolver returns everything if I just blindly do a [*] wildcard pull, but I’d rather shape it for the actual query

wilkerlucio10:12:16

@thosmos resolvers are triggered during attribute processing, that's the reason you get the single :db/id, to look back you can use ::p/parent-query from env, I guess that's the one you are looking for

wilkerlucio10:12:25

@mitchelkuijpers yup, you can use those like that 👍

👍 4
thosmos18:12:27

@wilkerlucio thanks I missed that when I looked at the env keys!

thosmos19:12:25

What’s doing the sub-select of the AST before handing it to the resolver? I ask because to me these two queries are effectively the same context but the second just narrows the scope down to one result: [{:agencies [:db/id ,,,]}] [{[:agency/id 1][:db/id ,,,]}] In other words, how I think about it, :agencies and [:agency/id 1] are the root keys in these two similar queries, and as I’m attempting to resolve these, I would expect the :agency/id to be in the the root node of the AST with all of its first level query attributes as its children. In order to get this, would I modify the reader?