Browse Source

fix: api.custom_query

Tienson Qin 3 years ago
parent
commit
05da02659a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/main/logseq/api.cljs

+ 5 - 1
src/main/logseq/api.cljs

@@ -713,7 +713,11 @@
             result (apply d/q query db resolved-inputs)]
         (clj->js result)))))
 
-(def ^:export custom_query db/custom-query)
+(defn ^:export custom_query
+  [query-string]
+  (let [result (let [query (cljs.reader/read-string query-map-or-string)]
+                 (db/custom-query {:query query}))]
+    (bean/->js (normalize-keyword-for-json (flatten @result)))))
 
 (defn ^:export download_graph_db
   []