pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
markaddleman 2020-12-13T03:09:30.481100Z

also, https://pathom3.wsscode.com/docs/smart-maps/#error-modes

markaddleman 2020-12-13T05:02:01.481800Z

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

2020-12-13T16:55:22.483100Z

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"})])

wilkerlucio 2020-12-14T09:32:28.487600Z

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

2020-12-15T05:13:12.488200Z

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?

yenda 2020-12-13T17:14:04.484100Z

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

wilkerlucio 2020-12-14T10:06:41.487800Z

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

wilkerlucio 2020-12-14T10:07:02.488Z

::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]

wilkerlucio 2020-12-13T17:54:22.484700Z

the parameter seems out of place in the query

wilkerlucio 2020-12-13T17:54:51.484900Z

try like this:

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

wilkerlucio 2020-12-13T17:56:28.485100Z

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

yenda 2020-12-13T21:22:58.485700Z

@wilkerlucio

::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]