|
28 | 28 | [clojure.string :as string] |
29 | 29 | [logseq.graph-validator.state :as state] |
30 | 30 | [logseq.graph-parser.property :as gp-property] |
31 | | - [logseq.graph-parser.util.page-ref :as page-ref] |
32 | | - [logseq.graph-parser.util :as gp-util] |
33 | | - [logseq.db.rules :as rules] |
| 31 | + [logseq.common.util.page-ref :as page-ref] |
| 32 | + [logseq.common.util :as common-util] |
| 33 | + [logseq.db.file-based.rules :as file-rules] |
34 | 34 | [datascript.core :as d] |
35 | 35 | [clojure.edn :as edn] |
36 | 36 | ["path" :as path] |
|
100 | 100 | "Get all property entities from :properties" |
101 | 101 | [db] |
102 | 102 | (d/q |
103 | | - '[:find (pull ?b [:block/content :block/original-name :block/properties]) ?p |
| 103 | + '[:find (pull ?b [:block/content :block/title :block/properties]) ?p |
104 | 104 | :in $ |
105 | 105 | :where |
106 | 106 | [?b :block/properties ?p] |
|
134 | 134 | [] |
135 | 135 | (->> (d/q '[:find (pull ?b [*]) |
136 | 136 | :in $ % |
137 | | - :where [?b :block/original-name] |
| 137 | + :where [?b :block/title] |
138 | 138 | (has-page-property ?b :type)] |
139 | 139 | @state/db-conn |
140 | | - (vals rules/query-dsl-rules)) |
| 140 | + [(:has-page-property file-rules/query-dsl-rules)]) |
141 | 141 | (map first))) |
142 | 142 |
|
143 | 143 | ;; Macro fns |
|
181 | 181 | {:Integer int? |
182 | 182 | :String string? |
183 | 183 | :Boolean boolean? |
184 | | - :Uri gp-util/url? |
| 184 | + :Uri common-util/url? |
185 | 185 | ;; TODO: Make this configurable |
186 | 186 | :Date #(re-matches #"\d{2}-\d{2}-\d{4}" %) |
187 | 187 | :Time #(re-matches #"\d\d?:\d\d" %) |
|
217 | 217 | (let [all-things (get-all-page-things) |
218 | 218 | children-maps (->> all-things |
219 | 219 | (filter #(= "Class" (first (get-in % [:block/properties :type])))) |
220 | | - (map #(vector (:block/original-name %) (first (get-in % [:block/properties :parent])))) |
| 220 | + (map #(vector (:block/title %) (first (get-in % [:block/properties :parent])))) |
221 | 221 | (into {})) |
222 | 222 | range-properties (->> all-things |
223 | 223 | (filter #(= "Property" (first (get-in % [:block/properties :type])))) |
|
255 | 255 | (let [all-things (get-all-page-things) |
256 | 256 | children-maps (->> all-things |
257 | 257 | (filter #(= "Class" (first (get-in % [:block/properties :type])))) |
258 | | - (map #(vector (:block/original-name %) (first (get-in % [:block/properties :parent])))) |
| 258 | + (map #(vector (:block/title %) (first (get-in % [:block/properties :parent])))) |
259 | 259 | (into {})) |
260 | 260 | range-properties (->> all-things |
261 | 261 | (filter #(= "Property" (first (get-in % [:block/properties :type])))) |
|
270 | 270 | page-classes (->> all-things |
271 | 271 | (mapcat (fn [b] |
272 | 272 | (map #(vector % (first (get-in b [:block/properties :type]))) |
273 | | - (into [(:block/original-name b)] |
| 273 | + (into [(:block/title b)] |
274 | 274 | (get-in b [:block/properties :alias]))))) |
275 | 275 | (into {}))] |
276 | 276 | (doseq [[property ranges] range-properties] |
|
299 | 299 | props))) |
300 | 300 | (reduce (fn [m [prop ent]] |
301 | 301 | (assoc-in m |
302 | | - [prop (select-keys ent [:block/content :block/original-name])] |
| 302 | + [prop (select-keys ent [:block/content :block/title])] |
303 | 303 | ;; later: Support multiple types |
304 | 304 | (first (:types ent)))) |
305 | 305 | {})) |
306 | 306 | _ (println "Validating domains for" (count domain-properties) "properties") |
307 | 307 | children-maps (->> all-things |
308 | 308 | (filter #(= "Class" (first (get-in % [:block/properties :type])))) |
309 | | - (map #(vector (:block/original-name %) (first (get-in % [:block/properties :parent])))) |
| 309 | + (map #(vector (:block/title %) (first (get-in % [:block/properties :parent])))) |
310 | 310 | (into {}))] |
311 | 311 | (doseq [[property domains] domain-properties] |
312 | 312 | (validate-property-domains property domains (property-ents property) children-maps)))) |
|
317 | 317 | :in $ % |
318 | 318 | :where (page-property ?b :type "Property")] |
319 | 319 | @state/db-conn |
320 | | - (vals rules/query-dsl-rules)) |
| 320 | + [(:page-property file-rules/query-dsl-rules)]) |
321 | 321 | (map first) |
322 | 322 | (map #(assoc (:block/properties %) :block/name (:block/name %))))) |
323 | 323 |
|
|
0 commit comments