diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index 340aa8b3e5..e203dc0adc 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -164,6 +164,7 @@ frontend.worker.state worker-state frontend.worker.util worker-util lambdaisland.glogi log + logseq.api.db-based db-based-api logseq.cli.common.graph cli-common-graph logseq.cli.common.export.common cli-export-common logseq.cli.common.export.text cli-export-text diff --git a/scripts/src/logseq/tasks/dev/db_and_file_graphs.clj b/scripts/src/logseq/tasks/dev/db_and_file_graphs.clj index 3148faeb38..d4689a6859 100644 --- a/scripts/src/logseq/tasks/dev/db_and_file_graphs.clj +++ b/scripts/src/logseq/tasks/dev/db_and_file_graphs.clj @@ -28,6 +28,7 @@ "Namespaces or parent namespaces _only_ for file graphs" (mapv escape-shell-regex ["logseq.graph-parser.db" "logseq.graph-parser.property" "logseq.graph-parser.extract" + "logseq.api.file-based" "frontend.handler.file-based" "frontend.handler.file-sync" "frontend.db.file-based" "frontend.util.file-based" @@ -65,6 +66,7 @@ "src/main/frontend/components/query/view.cljs" "src/main/frontend/inference_worker" "src/main/logseq/api/db_based.cljs" + "src/main/logseq/api/db_based" "src/electron/electron/db.cljs" "src/main/mobile"])) diff --git a/src/main/logseq/api.cljs b/src/main/logseq/api.cljs index de0669bf22..1aa9868292 100644 --- a/src/main/logseq/api.cljs +++ b/src/main/logseq/api.cljs @@ -7,16 +7,12 @@ [frontend.handler.plugin :as plugin-handler] [frontend.handler.search :as search-handler] [frontend.loader :as loader] - [frontend.handler.ui :as ui-handler] - [logseq.sdk.utils :as sdk-utils] - [logseq.cli.common.mcp.tools :as cli-common-mcp-tools] - [frontend.modules.outliner.op :as outliner-op] - [frontend.modules.outliner.ui :as ui-outliner-tx] [frontend.modules.layout.core] [frontend.state :as state] [logseq.api.app :as api-app] [logseq.api.db :as api-db] [logseq.api.db-based :as db-based-api] + [logseq.api.db-based.cli :as cli-based-api] [logseq.api.editor :as api-editor] [logseq.api.file-based :as file-based-api] [logseq.api.plugin :as api-plugin] @@ -25,6 +21,7 @@ [logseq.sdk.experiments] [logseq.sdk.git] [logseq.sdk.ui :as sdk-ui] + [logseq.sdk.utils :as sdk-utils] [promesa.core :as p])) ;; Alert: All apis shouldn't invoke any reactive queries @@ -138,51 +135,6 @@ (def ^:export update_block api-editor/update_block) (def ^:export upsert_block_property api-editor/upsert_block_property) -;; Internal CLI API -;; TODO: Use transit for internal APIs -(defn ^:export list_tags - [options] - (p/let [resp (state/clj options :keywordize-keys true))] - (clj->js resp))) - -(defn ^:export list_properties - [options] - (p/let [resp (state/clj options :keywordize-keys true))] - (clj->js resp))) - -(defn ^:export list_pages - [options] - (p/let [resp (state/clj options :keywordize-keys true))] - (clj->js resp))) - -(defn ^:export get_page_data - "Like get_page_blocks_tree but for MCP tools" - [page-title] - (p/let [resp (state/js resp) - #js {:error (str "Page " (pr-str page-title) " not found")}))) - -(defn ^:export upsert_nodes - "Given a list of MCP operations, batch imports with resulting EDN data" - [operations options*] - (p/let [ops (js->clj operations :keywordize-keys true) - {:keys [dry-run] :as options} (js->clj options* :keywordize-keys true) - edn-data (state/clj options :keywordize-keys true))] + (clj->js resp))) + +(defn list-properties + [options] + (p/let [resp (state/clj options :keywordize-keys true))] + (clj->js resp))) + +(defn list-pages + [options] + (p/let [resp (state/clj options :keywordize-keys true))] + (clj->js resp))) + +(defn get-page-data + "Like get_page_blocks_tree but for MCP tools" + [page-title] + (p/let [resp (state/js resp) + #js {:error (str "Page " (pr-str page-title) " not found")}))) + +(defn upsert-nodes + "Given a list of MCP operations, batch imports with resulting EDN data" + [operations options*] + (p/let [ops (js->clj operations :keywordize-keys true) + {:keys [dry-run] :as options} (js->clj options* :keywordize-keys true) + edn-data (state/