Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 35s
27 lines
914 B
Plaintext
27 lines
914 B
Plaintext
;; next/genesis/projections/actor-state.sx
|
|
;;
|
|
;; Per-actor live state: publicKeys (with history per design §9.6),
|
|
;; profile fields (preferredUsername, summary, ...), follower/
|
|
;; following counts. Powers the actor doc endpoint and the
|
|
;; time-aware signature verification in envelope:verify_signature/2.
|
|
|
|
(DefineProjection
|
|
:name "actor-state"
|
|
:doc "Actor-id -> {publicKeys, profile, followers, following}.\n Updated by Create{Person|Service|Group}, Update (key\n rotation, profile edits), Move (federation migration)."
|
|
:initial-state {}
|
|
:fold (fn
|
|
(state act)
|
|
(let
|
|
((aid (-> act :actor)) (t (-> act :type)))
|
|
(cond
|
|
(= t "Create")
|
|
(assoc state aid (or (-> act :object) {}))
|
|
(= t "Update")
|
|
(assoc
|
|
state
|
|
aid
|
|
(merge
|
|
(or (get state aid) {})
|
|
(or (-> act :patch) {})))
|
|
:else state))))
|