;; next/genesis/projections/define-registry.sx ;; ;; The meta-projection: folds Create{Define*{...}} activities into ;; the kernel registry. Resolves the chicken-and-egg circle — ;; bootstrap.erl populates the registry directly at startup from ;; the genesis bundle, and from then on define-registry's fold ;; keeps it current as new Define* activities arrive. Per design §5. (DefineProjection :name "define-registry" :doc "Maps {kind, name} -> definition entry. Folded from\n Create{DefineActivity|DefineObject|DefineProjection|\n DefineValidator|DefineCodec|DefineSigSuite|...}. Kind is\n derived from the inner :object :type tag." :initial-state {} :fold (fn (state act) (let ((obj (-> act :object)) (otype (-> act :object :type))) (cond (= (-> act :type) "Create") (cond (= otype "DefineActivity") (assoc-in state (list :activity-types (-> obj :name)) obj) (= otype "DefineObject") (assoc-in state (list :object-types (-> obj :name)) obj) (= otype "DefineProjection") (assoc-in state (list :projections (-> obj :name)) obj) (= otype "DefineValidator") (assoc-in state (list :validators (-> obj :name)) obj) (= otype "DefineCodec") (assoc-in state (list :codecs (-> obj :name)) obj) (= otype "DefineSigSuite") (assoc-in state (list :sig-suites (-> obj :name)) obj) :else state) :else state))))