;; next/genesis/projections/by-object.sx ;; ;; Index of activities that reference each :object CID. Maps ;; object-CID to the list of activity CIDs that target it ;; (Update / Delete / Announce / etc.). Used for "show me ;; everything that happened to X" queries. (DefineProjection :name "by-object" :doc "Object CID -> list of activity CIDs that target it." :initial-state {} :fold (fn (state act) (let ((obj-cid (-> act :object)) (cid (-> act :cid))) (if (string? obj-cid) (assoc state obj-cid (append (or (get state obj-cid) (list)) (list cid))) state))))