AshTui.Introspection (AshTui v0.3.1)

Copy Markdown View Source

Loads Ash domain and resource metadata into a navigable data structure.

All data comes from Ash's compile-time introspection API. No database connection is needed — this reads the shape of an app, not its data.

Summary

Functions

Creates introspection data from a pre-built list of domain info maps.

Loads all Ash domains and their resources for the given OTP app.

Functions

from_data(domains)

@spec from_data([map()]) :: [AshTui.Introspection.DomainInfo.t()]

Creates introspection data from a pre-built list of domain info maps.

Useful for testing without requiring a real Ash application.

Examples

iex> [domain] = AshTui.Introspection.from_data([
...>   %{
...>     name: MyApp.Accounts,
...>     resources: [
...>       %{
...>         name: MyApp.Accounts.User,
...>         attributes: [%{name: :id, type: :uuid, primary_key?: true}],
...>         actions: [%{name: :read, type: :read, primary?: true}],
...>         relationships: []
...>       }
...>     ]
...>   }
...> ])
iex> domain.name
MyApp.Accounts
iex> [resource] = domain.resources
iex> resource.name
MyApp.Accounts.User
iex> resource.primary_key
[:id]

load(otp_app)

Loads all Ash domains and their resources for the given OTP app.

Returns a list of DomainInfo structs, each containing its resources with fully loaded attributes, actions, and relationships.