|
@@ -18,53 +18,6 @@
|
|
|
(def general-attr-set
|
|
|
(into #{} (map first) general-attrs-schema-coll))
|
|
|
|
|
|
-(def data-from-ws-schema
|
|
|
- [:map {:closed true}
|
|
|
- [:req-id :string]
|
|
|
- [:t {:optional true} :int]
|
|
|
- [:t-before {:optional true} :int]
|
|
|
- [:affected-blocks {:optional true}
|
|
|
- [:map-of :string
|
|
|
- [:multi {:dispatch :op :decode/string #(update % :op keyword)}
|
|
|
- [:move
|
|
|
- (apply conj
|
|
|
- [:map {:closed true}
|
|
|
- [:op :keyword]
|
|
|
- [:self :string]
|
|
|
- [:parents [:sequential :string]]
|
|
|
- [:left :string]
|
|
|
- [:content {:optional true} :string]]
|
|
|
- general-attrs-schema-coll)]
|
|
|
- [:remove
|
|
|
- [:map {:closed true}
|
|
|
- [:op :keyword]
|
|
|
- [:block-uuid :string]]]
|
|
|
- [:update-attrs
|
|
|
- (apply conj
|
|
|
- [:map {:closed true}
|
|
|
- [:op :keyword]
|
|
|
- [:self :string]
|
|
|
- [:parents {:optional true} [:sequential :string]]
|
|
|
- [:left {:optional true} :string]
|
|
|
- [:content {:optional true} :string]]
|
|
|
- general-attrs-schema-coll)]
|
|
|
- [:update-page
|
|
|
- (apply conj
|
|
|
- [:map {:closed true}
|
|
|
- [:op :keyword]
|
|
|
- [:self :string]
|
|
|
- [:page-name :string]
|
|
|
- [:original-name :string]]
|
|
|
- general-attrs-schema-coll)]
|
|
|
- [:remove-page
|
|
|
- [:map {:closed true}
|
|
|
- [:op :keyword]
|
|
|
- [:block-uuid :string]]]]]]])
|
|
|
-(def data-from-ws-decoder (m/decoder data-from-ws-schema mt/string-transformer))
|
|
|
-(def data-from-ws-validator (m/validator data-from-ws-schema))
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
(def block-type-schema [:enum "property" "class" "whiteboard" "object" "hidden" "enum value"])
|
|
|
(def op-schema
|
|
|
[:multi {:dispatch first :decode/string #(update % 0 keyword)}
|
|
@@ -114,6 +67,56 @@
|
|
|
[:map
|
|
|
[:block-uuid :uuid]]]]])
|
|
|
|
|
|
+(def data-from-ws-schema
|
|
|
+ [:map
|
|
|
+ [:req-id :string]
|
|
|
+ [:t {:optional true} :int]
|
|
|
+ [:t-before {:optional true} :int]
|
|
|
+ [:failed-ops {:optional true} [:sequential op-schema]]
|
|
|
+ [:affected-blocks {:optional true}
|
|
|
+ [:map-of :string
|
|
|
+ [:multi {:dispatch :op :decode/string #(update % :op keyword)}
|
|
|
+ [:move
|
|
|
+ (apply conj
|
|
|
+ [:map {:closed true}
|
|
|
+ [:op :keyword]
|
|
|
+ [:self :string]
|
|
|
+ [:parents [:sequential :string]]
|
|
|
+ [:left :string]
|
|
|
+ [:content {:optional true} :string]]
|
|
|
+ general-attrs-schema-coll)]
|
|
|
+ [:remove
|
|
|
+ [:map {:closed true}
|
|
|
+ [:op :keyword]
|
|
|
+ [:block-uuid :string]]]
|
|
|
+ [:update-attrs
|
|
|
+ (apply conj
|
|
|
+ [:map {:closed true}
|
|
|
+ [:op :keyword]
|
|
|
+ [:self :string]
|
|
|
+ [:parents {:optional true} [:sequential :string]]
|
|
|
+ [:left {:optional true} :string]
|
|
|
+ [:content {:optional true} :string]]
|
|
|
+ general-attrs-schema-coll)]
|
|
|
+ [:update-page
|
|
|
+ (apply conj
|
|
|
+ [:map {:closed true}
|
|
|
+ [:op :keyword]
|
|
|
+ [:self :string]
|
|
|
+ [:page-name :string]
|
|
|
+ [:original-name :string]]
|
|
|
+ general-attrs-schema-coll)]
|
|
|
+ [:remove-page
|
|
|
+ [:map {:closed true}
|
|
|
+ [:op :keyword]
|
|
|
+ [:block-uuid :string]]]]]]])
|
|
|
+(def data-from-ws-decoder (m/decoder data-from-ws-schema mt/string-transformer))
|
|
|
+(def data-from-ws-validator (m/validator data-from-ws-schema))
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
(def data-to-ws-schema
|
|
|
(mu/closed-schema
|
|
|
[:multi {:dispatch :action}
|