fed-sx-m1: Step 4b-proj — 7 bootstrap projections + manifest update + 9 new parse tests (31 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 35s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 35s
This commit is contained in:
26
next/genesis/projections/actor-state.sx
Normal file
26
next/genesis/projections/actor-state.sx
Normal file
@@ -0,0 +1,26 @@
|
||||
;; 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))))
|
||||
Reference in New Issue
Block a user