Fork me on GitHub
#pathom
<
2020-12-13
>
markaddleman05:12:01

Is there an equivalent of ::psm/error-mode-loud for eql?

bbss16:12:22

in pathom3 are params different from eql? Here I'd expect :param to be available in the resolver.

(edn-query-language.core/query->ast
 ['({[:thing/id #uuid "c5aa81d4-13cf-491d-ac83-3646c9e0bc0b"]
     [:thing/attr]} {:param "param for thing"})])

;; => {:type :root, :children [{:type :join, :dispatch-key :thing/id, :key [:thing/id #uuid "c5aa81d4-13cf-491d-ac83-3646c9e0bc0b"], :query [:thing/attr], :children [{:type :prop, :dispatch-key :thing/attr, :key :thing/attr}], :params {:param "param for thing"}, :meta {:line 251, :column 4}}]}

(pco/defresolver resolver-using-param [env _]
  {::pco/input [:thing/id]
   ::pco/output [:thing/attr]
   ::pco/params [:param]}
  {:thing/attr (str "attr with " (:param (pco/params env)))})

(resolver-using-param
 {}
 ['({[:thing/id #uuid "c5aa81d4-13cf-491d-ac83-3646c9e0bc0b"]
     [:thing/attr]} {:param "param for thing"})])

wilkerlucio17:12:22

the parameter seems out of place in the query

wilkerlucio17:12:51

try like this:

(edn-query-language.core/query->ast
 ['{[:thing/id #uuid "c5aa81d4-13cf-491d-ac83-3646c9e0bc0b"]
     [(:thing/attr {:param "param for thing"})]}])

bbss03:12:27

Ok thanks. That is how a load with extra :params option from fulcro gave it, is it a bug there?

bbss04:12:29

Anyway got it to work with that, used :update-query to add the param. Thanks again!

wilkerlucio09:12:28

not a bug per-see, but an error in expectation, but its such a common one that I'm considering a way to give an easy fix, I see a lot of people doing plugins that just move the params forward everywhere, I think that's overkill, but I also think it could be something like "forward ident params", to move just params from idents to the first level of things

bbss05:12:12

That might be a nice extension, but if that somehow pollutes the params idea maybe a "global params" thing in the env would be better. That's what :params means in this case I think?

yenda17:12:04

I tried updating from pathm 2.3.0 alpha 10 to 21 and I got a validation error in one of my resolver. it's responding to a union query and used to work fine so I don't understand the error. This is what it prints:

[{:follows-threshold [:notification/type :notification/timestamp :notification/text], :follow [:notification/type :notification/timestamp :user/id], :comment [:notification/type :notification/timestamp :comment/text :user/id :video/id], :comment-reply [:notification/type :notification/timestamp :comment/text :user/id :video/id], :like [:notification/type :notification/timestamp :user/id :video/id :video/deleted?], :video-uploaded [:notification/type :notification/timestamp :notification/text :video/id], :views-threshold [:notification/type :notification/timestamp :notification/text :video/id], :likes-threshold [:notification/type :notification/timestamp :notification/text :video/id]}] - failed: keyword? in: [:com.wsscode.pathom.connect/output 1] at: [:com.wsscode.pathom.connect/output :attribute-list :plain] spec: :edn-query-language.core/property
[{:follows-threshold [:notification/type :notification/timestamp :notification/text], :follow [:notification/type :notification/timestamp :user/id], :comment [:notification/type :notification/timestamp :comment/text :user/id :video/id], :comment-reply [:notification/type :notification/timestamp :comment/text :user/id :video/id], :like [:notification/type :notification/timestamp :user/id :video/id :video/deleted?], :video-uploaded [:notification/type :notification/timestamp :notification/text :video/id], :views-threshold [:notification/type :notification/timestamp :notification/text :video/id], :likes-threshold [:notification/type :notification/timestamp :notification/text :video/id]}] - failed: map? in: [:com.wsscode.pathom.connect/output 1] at: [:com.wsscode.pathom.connect/output :attribute-list :composed] spec: :com.wsscode.pathom.connect/out-attribute
[:pagination/edges [{:follows-threshold [:notification/type :notification/timestamp :notification/text], :follow [:notification/type :notification/timestamp :user/id], :comment [:notification/type :notification/timestamp :comment/text :user/id :video/id], :comment-reply [:notification/type :notification/timestamp :comment/text :user/id :video/id], :like [:notification/type :notification/timestamp :user/id :video/id :video/deleted?], :video-uploaded [:notification/type :notification/timestamp :notification/text :video/id], :views-threshold [:notification/type :notification/timestamp :notification/text :video/id], :likes-threshold [:notification/type :notification/timestamp :notification/text :video/id]}] :pagination/has-prev? :pagination/has-next? :pagination/first-cursor :pagination/last-cursor] - failed: map? in: [:com.wsscode.pathom.connect/output] at: [:com.wsscode.pathom.connect/output :union] spec: :com.wsscode.pathom.connect/output

wilkerlucio17:12:28

I can't understand from this, can you send the resolver output that's failing?

yenda21:12:58

@U066U8JQJ

::pc/output [:pagination/edges [{:follows-threshold [:notification/type
                                                        :notification/timestamp
                                                        :notification/text]
                                    :follow [:notification/type
                                             :notification/timestamp
                                             :user/id]
                                    :comment [:notification/type
                                              :notification/timestamp
                                              :comment/text
                                              :user/id
                                              :video/id]
                                    :comment-reply [:notification/type
                                                    :notification/timestamp
                                                    :comment/text
                                                    :user/id
                                                    :video/id]
                                    :like [:notification/type
                                           :notification/timestamp
                                           :user/id
                                           :video/id
                                           :video/deleted?]
                                    :video-uploaded [:notification/type
                                                     :notification/timestamp
                                                     :notification/text
                                                     :video/id]
                                    :views-threshold [:notification/type
                                                      :notification/timestamp
                                                      :notification/text
                                                      :video/id]
                                    :likes-threshold [:notification/type
                                                      :notification/timestamp
                                                      :notification/text
                                                      :video/id]}]
                :pagination/has-prev?
                :pagination/has-next?
                :pagination/first-cursor
                :pagination/last-cursor]

wilkerlucio10:12:41

@U0DB715GU this union is malformed, for unions you should put the {} right after the join, without the [], as:

wilkerlucio10:12:02

::pc/output [:pagination/edges {:follows-threshold [:notification/type
                                                    :notification/timestamp
                                                    :notification/text]
                                :follow            [:notification/type
                                                    :notification/timestamp
                                                    :user/id]
                                :comment           [:notification/type
                                                    :notification/timestamp
                                                    :comment/text
                                                    :user/id
                                                    :video/id]
                                :comment-reply     [:notification/type
                                                    :notification/timestamp
                                                    :comment/text
                                                    :user/id
                                                    :video/id]
                                :like              [:notification/type
                                                    :notification/timestamp
                                                    :user/id
                                                    :video/id
                                                    :video/deleted?]
                                :video-uploaded    [:notification/type
                                                    :notification/timestamp
                                                    :notification/text
                                                    :video/id]
                                :views-threshold   [:notification/type
                                                    :notification/timestamp
                                                    :notification/text
                                                    :video/id]
                                :likes-threshold   [:notification/type
                                                    :notification/timestamp
                                                    :notification/text
                                                    :video/id]}
             :pagination/has-prev?
             :pagination/has-next?
             :pagination/first-cursor
             :pagination/last-cursor]