This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-31
Channels
- # adventofcode (15)
- # announcements (3)
- # babashka (38)
- # beginners (121)
- # calva (29)
- # cider (21)
- # circleci (1)
- # clojure (177)
- # clojure-europe (7)
- # clojure-france (2)
- # clojure-nl (7)
- # clojure-spec (3)
- # clojure-switzerland (5)
- # clojure-uk (4)
- # clojurescript (10)
- # code-reviews (1)
- # conjure (19)
- # deps-new (2)
- # emacs (5)
- # fulcro (52)
- # graalvm (13)
- # kaocha (1)
- # malli (1)
- # off-topic (6)
- # pathom (5)
- # re-frame (17)
- # reagent (14)
- # remote-jobs (1)
- # rewrite-clj (5)
- # robots (1)
- # shadow-cljs (13)
- # sql (38)
- # tools-deps (16)
- # xtdb (99)
Is there a nice way to prevent user for querying some keywords? Say I have a resolver with input = #{:user/id}
and output [:user/profile-photo]
and use it internally, when resolving say :user/username -> :user/id -> :user/profile-photo
, but I don't want to let a user issue queries based on :user/id
, they should only be aware of :user/username
. Right now I am doing a prewalk
over the transaction in a p/pre-process-parser-plugin
and replacing all occurrences of the keyword with :forbidden
, is there a better solution?
(letfn [(cleanup-query [query allowed-key?]
(->> query
eql/query->ast
(eql/transduce-children (filter (comp allowed-key? :dispatch-key)))
eql/ast->query))]
(cleanup-query [:a
{:b [:c]}
{[:d 1] [:e]}
'(f {:g :h})
'{(i {:j :k}) [:l]}]
#{:a :b :c :d :e 'f 'i :l}))
https://github.com/souenzzo/eql-style-guide/issues/4
I usually do that in my http/middleware stack.I feel like I'm missing something obvious; maybe someone can help. I have this resolver:
(pc/defresolver grocery-item-listing [_ _]
{::pc/input #{}
::pc/output [{:grocery-items [:item/id :item/name :item/position :item/completed-at]}]}
(go {:grocery-items [{:item/id 1
:item/name "Apples"
:item/position 1
:item/completed-at nil}
{:item/id 2
:item/name "Oranges"
:item/position 2
:item/completed-at nil}]}))
This query returns the expected two items:
(let-chan [result (parser {} [{:grocery-items [:item/id :item/name]}])]
(js/console.log {:result result}))
But if I try to make the same query nested inside an ident, I get :com.wsscode.pathom.core/not-found
:
(let-chan [result (parser {} [{[:component/id :grocery-list]
[{:grocery-items [:item/id :item/name]}]}])]
(js/console.log {:result result}))
I thought making a query a join nested inside an ident just added the ident attribute as an input.Oh, maybe I'm missing a reader to make that happen
Yep, added pc/open-ident-reader
to my list of readers and it works as expected.