Fork me on GitHub
#pathom
<
2020-03-13
>
myguidingstar14:03:02

@alex.sheluchin for now you still need to set up parser like in walkable's documentation. Walkable was created before pathom connect. With the new dynamic resolver feature coming in pathom 2.3.0-alpha4, integration with pathom connect is possible - I'll try to make connect version of walkable soon, hopefully next week

sheluchin23:03:42

@U0E2YV1UZ thank you. I think my use case is simple enough to stick with what's available, I was just trying to understand the correct pattern to use. I'll be looking forward to making use of the Connect support once that does come around.

otwieracz17:03:05

I've got a case where :note/objects can have :text-object/text property or :tag-link/tag property: :note/objects [:text-object/text :tag-link/tag]} but with this syntax I am getting a lot of :com.wsscode.pathom.core/not-found

otwieracz17:03:25

What's the correct approach here?

kszabo17:03:43

it’s perfectly fine for entities to have fewer attributes than requested

kszabo17:03:10

alternatively if these represent different entities altogether, then use union queries: https://wilkerlucio.github.io/pathom/#_union_queries

otwieracz18:03:16

Oh, unions might be great!

otwieracz18:03:47

::p/plugins [(pc/connect-plugin {::pc/register [(resolvers/resolvers)
                                                             (mutations/mutations)]})
                          p/elide-special-outputs-plugin
                          p/error-handler-plugin
                          ]}))

otwieracz18:03:59

Just like that, and this should get rid of any :com.wsscode.pathom.core/not-found?

👍 4
otwieracz18:03:28

hmm... let me try

otwieracz18:03:30

(once again)

otwieracz18:03:43

Maybe something isn't using new definition

otwieracz18:03:48

Yay, it works! Thank you!

otwieracz19:03:35

Are there any facilities to deal with complex EQL queries? When I need to ask for deeply nested, complex structure - it quickly becomes difficult to manage.

yenda20:03:37

@slawek098 you make a queries namespace and you write functions that build your queries

yenda20:03:24

queries are basically clojure datastructure so nothing easier than that

yenda20:03:39

for the mutations use the list function so you can pass arguments

yenda20:03:18

(defn login
  [{:user/keys [username email password]}]
  {(list 'login (cond-> {:user/password password}
                  email (assoc :user/email email)
                  username (assoc :user/username username)))
   [{:auth/tokens [:access-token
                   :expires-in
                   :offline-token
                   :id-token]}
    {:auth/user [:user/id
                 :user/username
                 :user/name
                 :user/photo
                 (user-stuff {})]}
    (search-things {:limit 3})]})

yenda20:03:38

for instance here's a login function that calls the login mutation, but also a bunch of other stuff including parametrized queries to get after the user is logged in (for that I modify the env of the parser and add the authed user after succesful login)