diff --git a/src/main/frontend/db/model.cljs b/src/main/frontend/db/model.cljs index b447a5857..f3592559e 100644 --- a/src/main/frontend/db/model.cljs +++ b/src/main/frontend/db/model.cljs @@ -79,11 +79,6 @@ (def hidden-page? ldb/hidden-page?) -(defn get-pages - [repo] - (let [db (conn/get-db repo)] - (ldb/get-pages db))) - (defn get-all-pages [repo] (->> @@ -406,12 +401,6 @@ independent of format as format specific heading characters are stripped" f)) form)) -(defn sort-page-random-blocks - "Blocks could be non consecutive." - [blocks] - (let [db (conn/get-db)] - (ldb/sort-page-random-blocks db blocks))) - ;; Diverged of get-sorted-page-block-ids (defn get-sorted-page-block-ids-and-levels "page-name: the page name, original name @@ -517,10 +506,6 @@ independent of format as format specific heading characters are stripped" (when-not (:block/name parent) parent))))) -(defn get-non-consecutive-blocks - [blocks] - (ldb/get-non-consecutive-blocks (conn/get-db) blocks)) - (defn get-page-blocks-no-cache ([page] (get-page-blocks-no-cache (state/get-current-repo) page nil)) diff --git a/src/main/frontend/db/outliner.cljs b/src/main/frontend/db/outliner.cljs deleted file mode 100644 index b20675f17..000000000 --- a/src/main/frontend/db/outliner.cljs +++ /dev/null @@ -1,17 +0,0 @@ -(ns frontend.db.outliner - "Db related fns for the outliner module" - (:require [datascript.core :as d])) - -(defn get-by-id - [conn id] - (try - (d/pull @conn '[*] id) - (catch :default _e nil))) - -;; key [:block/children parent-id] - -(def get-by-parent-id - '[:find (pull ?a [*]) - :in $ ?id - :where - [?a :block/parent ?id]]) diff --git a/src/main/frontend/format/block.cljs b/src/main/frontend/format/block.cljs index b6f1508c7..e38d11594 100644 --- a/src/main/frontend/format/block.cljs +++ b/src/main/frontend/format/block.cljs @@ -14,8 +14,7 @@ [lambdaisland.glogi :as log] [datascript.core :as d] [logseq.db.frontend.property :as db-property] - [frontend.format.mldoc :as mldoc] - [frontend.worker.mldoc :as worker-mldoc])) + [frontend.format.mldoc :as mldoc])) (defn- update-extracted-block-properties "Updates DB graph blocks to ensure that built-in properties are using uuids @@ -71,13 +70,6 @@ and handles unexpected failure." ([original-page-name with-id? with-timestamp?] (gp-block/page-name->map original-page-name with-id? (db/get-db (state/get-current-repo)) with-timestamp? (state/get-date-formatter)))) -(defn extract-refs-from-text - [text] - (worker-mldoc/extract-refs-from-text (state/get-current-repo) - (db/get-db (state/get-current-repo)) - text - (state/get-date-formatter))) - (defn- normalize-as-percentage [block] (some->> block diff --git a/src/main/frontend/handler/property/util.cljs b/src/main/frontend/handler/property/util.cljs index c3f868094..1917ab42d 100644 --- a/src/main/frontend/handler/property/util.cljs +++ b/src/main/frontend/handler/property/util.cljs @@ -2,11 +2,9 @@ "Utility fns for properties that are for both file and db graphs. Some fns like lookup and get-property were written to easily be backwards compatible with file graphs" - (:require [frontend.config :as config] - [frontend.state :as state] + (:require [frontend.state :as state] [logseq.common.util :as common-util] [frontend.db :as db] - [frontend.util :as util] [logseq.db.frontend.property :as db-property])) (defn lookup diff --git a/src/main/frontend/handler/repo.cljs b/src/main/frontend/handler/repo.cljs index 9a1cb1ea6..48746910b 100644 --- a/src/main/frontend/handler/repo.cljs +++ b/src/main/frontend/handler/repo.cljs @@ -36,7 +36,6 @@ [frontend.mobile.util :as mobile-util] [medley.core :as medley] [logseq.common.path :as path] - [logseq.common.config :as common-config] [frontend.db.listener :as db-listener] [frontend.db.rtc.op-mem-layer :as op-mem-layer])) diff --git a/src/main/frontend/modules/outliner/datascript.cljs b/src/main/frontend/modules/outliner/datascript.cljs index 5ed831693..73cf7618c 100644 --- a/src/main/frontend/modules/outliner/datascript.cljs +++ b/src/main/frontend/modules/outliner/datascript.cljs @@ -26,10 +26,6 @@ v))) x))))) -(defn get-tx-id - [tx-report] - (get-in tx-report [:tempids :db/current-tx])) - (defn update-refs-and-macros "When a block is deleted, refs are updated and macros associated with the block are deleted" [txs db repo opts set-state-fn] diff --git a/src/main/frontend/persist_db/browser.cljs b/src/main/frontend/persist_db/browser.cljs index e0d6d58e7..6ea1048db 100644 --- a/src/main/frontend/persist_db/browser.cljs +++ b/src/main/frontend/persist_db/browser.cljs @@ -13,8 +13,7 @@ [electron.ipc :as ipc] [frontend.modules.outliner.pipeline :as pipeline] [clojure.edn :as edn] - [frontend.handler.worker :as worker-handler] - [frontend.db :as db])) + [frontend.handler.worker :as worker-handler])) (defonce *sqlite (atom nil)) diff --git a/src/main/frontend/util.cljc b/src/main/frontend/util.cljc index 8840ec646..171a6d5fa 100644 --- a/src/main/frontend/util.cljc +++ b/src/main/frontend/util.cljc @@ -1149,8 +1149,6 @@ #?(:cljs (def remove-first worker-util/remove-first)) -(def pprint clojure.pprint/pprint) - #?(:cljs (defn backward-kill-word [input] diff --git a/src/main/frontend/worker/db/fix.cljs b/src/main/frontend/worker/db/fix.cljs index f294b857a..8ca17afd3 100644 --- a/src/main/frontend/worker/db/fix.cljs +++ b/src/main/frontend/worker/db/fix.cljs @@ -5,7 +5,6 @@ 2. For any block, its children should be connected by :block/left (no broken chain, no circle, no left to self)." (:require [datascript.core :as d] [cljs.pprint :as pprint] - [frontend.handler.notification :as notification] [logseq.db :as ldb] [frontend.worker.util :as util])) diff --git a/src/test/frontend/db/outliner_test.cljs b/src/test/frontend/db/outliner_test.cljs deleted file mode 100644 index 167cfd660..000000000 --- a/src/test/frontend/db/outliner_test.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns frontend.db.outliner-test - (:require [cljs.test :refer [deftest is use-fixtures]] - [datascript.core :as d] - [frontend.core-test :as core-test] - [logseq.db :as db] - [frontend.test.fixtures :as fixtures])) - -(use-fixtures :each fixtures/reset-db) - -(deftest test-get-by-id - (let [conn (core-test/get-current-conn) - block-id "1" - data [{:block/uuid block-id}] - _ (d/transact! conn data) - result (db/get-by-id conn [:block/uuid block-id])] - (is (= block-id (:block/uuid result))))) - -(deftest test-get-by-parent-id - (let [conn (core-test/get-current-conn) - data [{:block/uuid "1"} - {:block/uuid "2" - :block/parent [:block/uuid "1"] - :block/left [:block/uuid "1"]} - {:block/uuid "3" - :block/parent [:block/uuid "1"] - :block/left [:block/uuid "2"]}] - _ (d/transact! conn data) - r (d/q db/get-by-parent-id @conn [:block/uuid "1"]) - result (flatten r)] - (is (= ["2" "3"] (mapv :block/uuid result))))) diff --git a/src/test/frontend/format/mldoc_test.cljs b/src/test/frontend/format/mldoc_test.cljs index 64dbbe319..b3192c663 100644 --- a/src/test/frontend/format/mldoc_test.cljs +++ b/src/test/frontend/format/mldoc_test.cljs @@ -1,10 +1,11 @@ (ns frontend.format.mldoc-test - (:require [frontend.format.mldoc :as mldoc] - [cljs.test :refer [deftest testing are]])) + (:require [frontend.worker.mldoc :as worker-mldoc] + [cljs.test :refer [deftest testing are]] + [frontend.test.helper :as test-helper])) (deftest test-extract-plain (testing "normalize date values" - (are [x y] (= (mldoc/extract-plain x) y) + (are [x y] (= (worker-mldoc/extract-plain test-helper/test-db x) y) "foo #book #[[nice test]]" "foo"