🔥 Remove usage of public usage of sm/define funcion

This commit is contained in:
Andrey Antukh 2024-09-10 17:34:21 +02:00 committed by Alonso Torres
parent cdcff62232
commit b882b9e283
17 changed files with 216 additions and 244 deletions

View file

@ -24,24 +24,27 @@
;; --- Messages Handling
(def ^:private
schema:message
(sm/define
[:map {:title "WorkerMessage"}
[:sender-id ::sm/uuid]
[:payload
[:map
[:cmd :keyword]]]
[:buffer? {:optional true} :boolean]]))
(def ^:private schema:message
[:map {:title "WorkerMessage"}
[:sender-id ::sm/uuid]
[:payload
[:map
[:cmd :keyword]]]
[:buffer? {:optional true} :boolean]])
(def ^:private check-message!
(sm/check-fn schema:message))
(def buffer (rx/subject))
(defn- handle-message
"Process the message and returns to the client"
[{:keys [sender-id payload transfer] :as message}]
(dm/assert!
"expected valid message"
(sm/check! schema:message message))
(check-message! message))
(letfn [(post [msg]
(let [msg (-> msg (assoc :reply-to sender-id) (wm/encode))]
(.postMessage js/self msg)))