From 12de72064ee6926cf985919a7ea5df0d0a51df0a Mon Sep 17 00:00:00 2001 From: rcmerci Date: Sun, 25 Jan 2026 16:50:02 +0800 Subject: [PATCH] update code according to remove file-based PR --- deps/cli/src/logseq/cli/common/mcp/tools.cljs | 8 ------ src/main/frontend/worker/db_core.cljs | 26 +++++++------------ 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/deps/cli/src/logseq/cli/common/mcp/tools.cljs b/deps/cli/src/logseq/cli/common/mcp/tools.cljs index c9c84b9200..8b75fff3d5 100644 --- a/deps/cli/src/logseq/cli/common/mcp/tools.cljs +++ b/deps/cli/src/logseq/cli/common/mcp/tools.cljs @@ -16,11 +16,6 @@ [malli.core :as m] [malli.error :as me])) -(defn- ensure-db-graph - [db] - (when-not (ldb/db-based-graph? db) - (throw (ex-info "This tool must be called on a DB graph" {})))) - (defn- minimal-list-item [e] (cond-> {:db/id (:db/id e) @@ -32,7 +27,6 @@ (defn list-properties "Main fn for ListProperties tool" [db {:keys [expand include-built-in] :as options}] - (ensure-db-graph db) (let [include-built-in? (if (contains? options :include-built-in) include-built-in true)] (->> (d/datoms db :avet :block/tags :logseq.class/Property) (map #(d/entity db (:e %))) @@ -57,7 +51,6 @@ (defn list-tags "Main fn for ListTags tool" [db {:keys [expand include-built-in] :as options}] - (ensure-db-graph db) (let [include-built-in? (if (contains? options :include-built-in) include-built-in true)] (->> (d/datoms db :avet :block/tags :logseq.class/Tag) (map #(d/entity db (:e %))) @@ -123,7 +116,6 @@ (defn list-pages "Main fn for ListPages tool" [db {:keys [expand include-hidden include-journal journal-only created-after updated-after] :as options}] - (ensure-db-graph db) (let [include-hidden? (boolean include-hidden) include-journal? (if (contains? options :include-journal) include-journal true) journal-only? (boolean journal-only) diff --git a/src/main/frontend/worker/db_core.cljs b/src/main/frontend/worker/db_core.cljs index 21feec84fe..911024e033 100644 --- a/src/main/frontend/worker/db_core.cljs +++ b/src/main/frontend/worker/db_core.cljs @@ -38,7 +38,6 @@ [logseq.common.util :as common-util] [logseq.db :as ldb] [logseq.db.common.entity-plus :as entity-plus] - [logseq.db.common.entity-util :as common-entity-util] [logseq.db.common.initial-data :as common-initial-data] [logseq.db.common.order :as db-order] [logseq.db.common.reference :as db-reference] @@ -54,7 +53,9 @@ [logseq.outliner.op :as outliner-op] [me.tonsky.persistent-sorted-set :as set :refer [BTSet]] [missionary.core :as m] - [promesa.core :as p])) + [promesa.core :as p] + [logseq.db.frontend.schema :as db-schema] + [logseq.db.frontend.entity-util :as entity-util])) (defonce *sqlite worker-state/*sqlite) (defonce *sqlite-conns worker-state/*sqlite-conns) @@ -301,12 +302,9 @@ (when-not @*publishing? (common-sqlite/create-kvs-table! client-ops-db)) (rtc-debug-log/create-tables! debug-log-db) (search/create-tables-and-triggers! search-db) - (ldb/register-transact-pipeline-fn! - (fn [tx-report] - (worker-pipeline/transact-pipeline repo tx-report))) - (let [schema (ldb/get-schema repo) - conn (common-sqlite/get-storage-conn storage schema) - _ (db-fix/check-and-fix-schema! repo conn) + (ldb/register-transact-pipeline-fn! worker-pipeline/transact-pipeline) + (let [conn (common-sqlite/get-storage-conn storage db-schema/schema) + _ (db-fix/check-and-fix-schema! conn) _ (when datoms (let [eid->datoms (group-by :e datoms) {properties true non-properties false} (group-by @@ -526,8 +524,7 @@ tx-data) _ (when context (worker-state/set-context! context)) tx-meta' (cond-> tx-meta - (and (not (:whiteboard/transact? tx-meta)) - (not (:rtc-download-graph? tx-meta))) ; delay writes to the disk + (not (:rtc-download-graph? tx-meta)) ; delay writes to the disk (assoc :skip-store? true) true @@ -691,15 +688,10 @@ (when-let [conn (worker-state/get-datascript-conn repo)] (worker-export/get-debug-datoms conn))) -(def-thread-api :thread-api/export-get-all-pages - [repo] - (when-let [conn (worker-state/get-datascript-conn repo)] - (worker-export/get-all-pages repo @conn))) - (def-thread-api :thread-api/export-get-all-page->content [repo options] (when-let [conn (worker-state/get-datascript-conn repo)] - (worker-export/get-all-page->content repo @conn options))) + (worker-export/get-all-page->content @conn options))) (def-thread-api :thread-api/validate-db [repo] @@ -742,7 +734,7 @@ [repo class-id] (let [db @(worker-state/get-datascript-conn repo)] (->> (db-class/get-class-objects db class-id) - (map common-entity-util/entity->map)))) + (map entity-util/entity->map)))) (def-thread-api :thread-api/get-property-values [repo {:keys [property-ident] :as option}]