|
@@ -1,6 +1,7 @@
|
|
|
(ns frontend.worker.rtc.client
|
|
(ns frontend.worker.rtc.client
|
|
|
"Fns about push local updates"
|
|
"Fns about push local updates"
|
|
|
(:require [clojure.set :as set]
|
|
(:require [clojure.set :as set]
|
|
|
|
|
+ [clojure.string :as string]
|
|
|
[datascript.core :as d]
|
|
[datascript.core :as d]
|
|
|
[frontend.common.missionary-util :as c.m]
|
|
[frontend.common.missionary-util :as c.m]
|
|
|
[frontend.worker.rtc.const :as rtc-const]
|
|
[frontend.worker.rtc.const :as rtc-const]
|
|
@@ -111,15 +112,18 @@
|
|
|
[schema-av-coll other-av-coll]))
|
|
[schema-av-coll other-av-coll]))
|
|
|
|
|
|
|
|
(defn- schema-av-coll->update-schema-op
|
|
(defn- schema-av-coll->update-schema-op
|
|
|
- [block-uuid schema-av-coll]
|
|
|
|
|
- (when (seq schema-av-coll)
|
|
|
|
|
- [:update-schema
|
|
|
|
|
- (select-keys
|
|
|
|
|
- (->> schema-av-coll
|
|
|
|
|
- (sort-by (fn [[_a _v t _add?]] t))
|
|
|
|
|
- (keep (fn [[a v _t add?]] (when add? [a (ldb/read-transit-str v)])))
|
|
|
|
|
- (apply conj {:block-uuid block-uuid}))
|
|
|
|
|
- [:block-uuid :db/cardinality :db/valueType :db/index])]))
|
|
|
|
|
|
|
+ [block-uuid db-ident schema-av-coll]
|
|
|
|
|
+ (when (and (seq schema-av-coll) db-ident)
|
|
|
|
|
+ (let [db-ident-ns (namespace db-ident)]
|
|
|
|
|
+ (when (and (string/ends-with? db-ident-ns ".property")
|
|
|
|
|
+ (not= db-ident-ns "logseq.property"))
|
|
|
|
|
+ [:update-schema
|
|
|
|
|
+ (select-keys
|
|
|
|
|
+ (->> schema-av-coll
|
|
|
|
|
+ (sort-by (fn [[_a _v t _add?]] t))
|
|
|
|
|
+ (keep (fn [[a v _t add?]] (when add? [a (ldb/read-transit-str v)])))
|
|
|
|
|
+ (apply conj {:block-uuid block-uuid :db/ident db-ident}))
|
|
|
|
|
+ [:block-uuid :db/ident :db/cardinality :db/valueType :db/index])]))))
|
|
|
|
|
|
|
|
(defmethod local-block-ops->remote-ops-aux :update-op
|
|
(defmethod local-block-ops->remote-ops-aux :update-op
|
|
|
[_ & {:keys [db block update-op left-uuid parent-uuid *remote-ops *depend-on-block-uuid-set]}]
|
|
[_ & {:keys [db block update-op left-uuid parent-uuid *remote-ops *depend-on-block-uuid-set]}]
|
|
@@ -129,7 +133,7 @@
|
|
|
(remove-redundant-av db)
|
|
(remove-redundant-av db)
|
|
|
(remove-non-exist-ref-av db))
|
|
(remove-non-exist-ref-av db))
|
|
|
[schema-av-coll other-av-coll] (group-by-schema-attrs av-coll)
|
|
[schema-av-coll other-av-coll] (group-by-schema-attrs av-coll)
|
|
|
- update-schema-op (schema-av-coll->update-schema-op block-uuid schema-av-coll)
|
|
|
|
|
|
|
+ update-schema-op (schema-av-coll->update-schema-op block-uuid (:db/ident block) schema-av-coll)
|
|
|
depend-on-block-uuids (keep (fn [[_a v]] (when (uuid? v) v)) other-av-coll)]
|
|
depend-on-block-uuids (keep (fn [[_a v]] (when (uuid? v) v)) other-av-coll)]
|
|
|
(swap! *remote-ops conj
|
|
(swap! *remote-ops conj
|
|
|
[:update {:block-uuid block-uuid
|
|
[:update {:block-uuid block-uuid
|