Athanor.Registry (Athanor v0.1.0-beta.1)

Copy Markdown View Source

Open registry mapping a node's type string to its component module.

Configuration

config :athanor,
  components: [MyApp.Components.Foo, MyApp.Components.Bar],
  fallback_resolver: {MyApp.LegacyResolver, :resolve_type}

:components is a list of modules that implement Athanor.Component. Lookup matches node["type"] against each module's metadata().type.

:fallback_resolver is an optional {module, function} tuple. When a type is not found in :components, the resolver is called as module.function(type_string) and may return a module or nil. This lets a consumer app keep its existing component dispatch wired in during a gradual migration.

Both keys are read at call time via Application.get_env/2, so test setup can swap them per scenario.

Summary

Functions

Return the configured list of component modules.

Return a flat list of metadata/0 maps for every registered Athanor component. Convenient for editor palettes and similar UI surfaces that want to iterate components by display info.

Return the module registered for type, or nil.

Return the metadata for the module registered for type, or nil.

Functions

all()

Return the configured list of component modules.

components_metadata()

Return a flat list of metadata/0 maps for every registered Athanor component. Convenient for editor palettes and similar UI surfaces that want to iterate components by display info.

lookup(type)

Return the module registered for type, or nil.

metadata_for(type)

Return the metadata for the module registered for type, or nil.