fix: remove most file graph uses in deps

except for graph-parser and publish deps

- Removed most mentions of 'repo' in deps, which cleaned up a lot related
  to export cli and worker
- Removed db-based-graph? checks in deps except for unknown use
  in entity-plus?
- Removing db-based-graph? checks resulted in deleting unused file graph
  code paths e.g. get-pid
- Removed file graph handling in cli list command
- Remove file-based-graph? checks from deps
This commit is contained in:
Gabriel Horner
2026-01-13 13:16:26 -05:00
parent 37af8f690e
commit 173898240e
51 changed files with 227 additions and 382 deletions

View File

@@ -16,6 +16,7 @@
[logseq.db.common.order :as db-order]
[logseq.db.frontend.class :as db-class]
[logseq.db.frontend.entity-util :as entity-util]
[logseq.db.common.entity-plus :as entity-plus]
[logseq.graph-parser.mldoc :as gp-mldoc]
[logseq.graph-parser.property :as gp-property]
[logseq.graph-parser.text :as text]
@@ -305,21 +306,28 @@
;; Hack to detect export as some fns are too deeply nested to be refactored to get explicit option
(def *export-to-db-graph? (atom false))
(defn- get-page
"Similar to get-page but only for file graphs"
[db page-name]
(when (and db (string? page-name))
(d/entity db
(first (sort (map :e (entity-util/get-pages-by-name db page-name)))))))
(defn- page-name-string->map
[original-page-name db date-formatter
{:keys [with-timestamp? page-uuid from-page class? skip-existing-page-check?]}]
(let [db-based? (ldb/db-based-graph? db)
(let [db-based? (entity-plus/db-based-graph? db)
original-page-name (common-util/remove-boundary-slashes original-page-name)
[original-page-name' page-name journal-day] (convert-page-if-journal original-page-name date-formatter {:export-to-db-graph? @*export-to-db-graph?})
namespace? (and (or (not db-based?) @*export-to-db-graph?)
(not (boolean (text/get-nested-page-name original-page-name')))
(text/namespace-page? original-page-name'))
page-entity (when (and db (not skip-existing-page-check?))
(if class?
(if (and class? db-based?)
(some->> (ldb/page-exists? db original-page-name' #{:logseq.class/Tag})
first
(d/entity db))
(ldb/get-page db original-page-name')))
(get-page db original-page-name')))
original-page-name' (or from-page (:block/title page-entity) original-page-name')
page (merge
{:block/name page-name
@@ -384,7 +392,7 @@
& {:keys [page-uuid class?] :as options}]
(when-not (and db (common-util/uuid-string? original-page-name)
(not (page-entity? (d/entity db [:block/uuid (uuid original-page-name)]))))
(let [db-based? (ldb/db-based-graph? db)
(let [db-based? (entity-plus/db-based-graph? db)
original-page-name (cond-> (string/trim original-page-name)
db-based?
sanitize-hashtag-name)
@@ -463,7 +471,7 @@
(defn- with-page-refs-and-tags
[{:keys [title body tags refs marker priority] :as block} db date-formatter {:keys [structured-tags]
:or {structured-tags #{}}}]
(let [db-based? (and (ldb/db-based-graph? db) (not @*export-to-db-graph?))
(let [db-based? (and (entity-plus/db-based-graph? db) (not @*export-to-db-graph?))
refs (->> (concat tags refs (when-not db-based? [marker priority]))
(remove string/blank?)
(distinct))

View File

@@ -22,7 +22,6 @@
[logseq.common.uuid :as common-uuid]
[logseq.db :as ldb]
[logseq.db.common.order :as db-order]
[logseq.db.common.property-util :as db-property-util]
[logseq.db.frontend.asset :as db-asset]
[logseq.db.frontend.class :as db-class]
[logseq.db.frontend.content :as db-content]
@@ -452,11 +451,22 @@
(when (and prev-type (not= prev-type prop-type))
{:type {:from prev-type :to prop-type}})))
(defn- get-file-pid
"Gets file graph property id given the db graph ident"
[db-ident]
;; Map of unique cases where the db graph keyword name is different than the file graph id
(let [unique-file-ids {:logseq.property/order-list-type :logseq.order-list-type
:logseq.property.tldraw/page :logseq.tldraw.page
:logseq.property.tldraw/shape :logseq.tldraw.shape
:logseq.property/publishing-public? :public}]
(or (get unique-file-ids db-ident)
(keyword (name db-ident)))))
(def built-in-property-file-to-db-idents
"Map of built-in property file ids to their db graph idents"
(->> (keys db-property/built-in-properties)
(map (fn [k]
[(db-property-util/get-file-pid k) k]))
[(get-file-pid k) k]))
(into {})))
(def all-built-in-property-file-ids

View File

@@ -169,6 +169,11 @@
([repo content format]
(->edn content (get-default-config repo format))))
(defn ->db-edn
"Wrapper around ->edn for DB graphs"
[content format]
(->edn "logseq_db_repo_stub" content format))
(defn inline->edn
[text config]
(try

View File

@@ -1,7 +1,5 @@
(ns logseq.graph-parser.whiteboard
"Whiteboard related parser utilities"
(:require [logseq.db.common.property-util :as db-property-util]
[logseq.db.sqlite.util :as sqlite-util]))
"Whiteboard related parser utilities")
(defn block->shape [block]
(get-in block [:block/properties :logseq.tldraw.shape]))
@@ -73,18 +71,4 @@
(with-whiteboard-content shape)))
(when (nil? (:block/parent block)) {:block/parent page-id})
(when (nil? (:block/format block)) {:block/format :markdown}) ;; TODO: read from config
{:block/page page-id})))
(defn shape->block [repo shape page-id]
(let [block-uuid (if (uuid? (:id shape)) (:id shape) (uuid (:id shape)))
properties {(db-property-util/get-pid repo :logseq.property/ls-type) :whiteboard-shape
(db-property-util/get-pid repo :logseq.property.tldraw/shape) shape}
block {:block/uuid block-uuid
:block/title ""
:block/page page-id
:block/parent page-id}
block' (if (sqlite-util/db-based-graph? repo)
(merge block properties)
(assoc block :block/properties properties))
additional-props (with-whiteboard-block-props block' page-id)]
(merge block' additional-props)))
{:block/page page-id})))