File tree Expand file tree Collapse file tree 3 files changed +13
-30
lines changed
cli/src/logseq/cli/commands Expand file tree Collapse file tree 3 files changed +13
-30
lines changed Original file line number Diff line number Diff line change 1919 (->> (map (fn [e] (dissoc e :db/id )) ent-maps) explainer not-empty))]
2020 (let [ent-errors
2121 (->> (db-validate/group-errors-by-entity db ent-maps (:errors explanation))
22- (map #(-> ( dissoc % :errors-by-type )
23- ( update :errors (fn [errs]
24- ; ; errs looks like: {178 {:logseq.property/hide? ["disallowed key"]}}
25- ; ; map is indexed by :in which is unused since all errors are for the same map
26- (->> (me/humanize {:errors errs})
27- vals
28- (apply merge-with into) ))))))]
22+ (map #(update % :errors
23+ (fn [errs]
24+ ; ; errs looks like: {178 {:logseq.property/hide? ["disallowed key"]}}
25+ ; ; map is indexed by :in which is unused since all errors are for the same map
26+ (->> (me/humanize {:errors errs})
27+ vals
28+ (apply merge-with into))))))]
2929 (println " Found" (count ent-errors)
3030 (if (= 1 (count ent-errors)) " entity" " entities" )
3131 " with errors:" )
Original file line number Diff line number Diff line change 2626 verbose
2727 (pprint/pprint ent-errors)
2828 humanize
29- (pprint/pprint (map #(-> (dissoc % :errors-by-type )
30- (update :errors (fn [errs]
31- (->> (me/humanize {:errors errs})
32- vals
33- (apply merge-with into)))))
29+ (pprint/pprint (map #(update % :errors (fn [errs]
30+ (->> (me/humanize {:errors errs})
31+ vals
32+ (apply merge-with into))))
3433 ent-errors))
3534 :else
3635 (pprint/pprint (map :entity ent-errors))))
Original file line number Diff line number Diff line change 7777 (fn [id] (select-keys (d/entity db id)
7878 [:block/name :block/tags :db/id :block/created-at ]))))
7979 :dispatch-key (->> (dissoc ent :db/id ) (db-malli-schema/entity-dispatch-key db))
80- :errors errors'
81- ; ; Group by type to reduce verbosity
82- ; ; TODO: Move/remove this to another fn if unused
83- :errors-by-type
84- (->> (group-by :type errors')
85- (map (fn [[type' type-errors]]
86- [type'
87- {:in-value-distinct (->> type-errors
88- (map #(select-keys % [:in :value ]))
89- distinct
90- vec)
91- :schema-distinct (->> (map :schema type-errors)
92- (map m/form)
93- distinct
94- vec)}]))
95- (into {}))})))))
80+ :errors errors'})))))
9681
9782(defn validate-db!
9883 " Validates all the entities of the given db using :eavt datoms. Returns a map
11297 (cond-> {:datom-count (count datoms)
11398 :entities ent-maps*}
11499 (some? errors)
115- (assoc :errors (map #(-> (dissoc % :errors-by-type )
116- (update :errors (fn [errs] (me/humanize {:errors errs}))))
100+ (assoc :errors (map #(update % :errors (fn [errs] (me/humanize {:errors errs})))
117101 (group-errors-by-entity db ent-maps errors))))))
118102
119103(defn graph-counts
You can’t perform that action at this time.
0 commit comments