Using this special query, we can find that only eight namespaces can be used in the advanced query runtime, including 'clojure.core 'clojure.set 'clojure.edn 'clojure.repl 'clojure.string 'clojure.walk 'clojure.template
.
I think it may be possible to add more function without break the safety. e.g the js/Date
or the js/console.log
. Parsing date is a common task and js function is handy to such task.
By the way, It is better to describe which functions the user can use in the advanced query document.
type:: demo
#+BEGIN_QUERY
{
:title "find"
:view (fn [r] [:div.flex.flex-wrap.gap-4
(for [ns (all-ns)]
[:div [
[:h2 (str ns)]
[:div.grid.grid-cols-4.gap-4 (for
[name (keys (ns-publics ns))]
[:a {:href (str "https://clojuredocs.org/" (str ns) "/" (str name) ) } (str name)])
]
]]
)]
)
:query [
:find (pull ?b [*])
:where
[?b :block/properties ?p ]
[(get ?p :type) ?t]
[(= ?t "demo")]
]
}
#+END_QUERY