# `Alternera.Resource.Info`
[🔗](https://github.com/10e-ab/alternera-sdk/blob/v0.9.0/alternera_resource_sdk/lib/alternera/resource/info.ex#L1)

Reads a resource's `alternera_resource` section and its identity.

# `reference_key`

```elixir
@type reference_key() :: %{
  relationship: atom(),
  attribute: atom(),
  destination: module(),
  key: atom(),
  field: atom(),
  type: term(),
  constraints: keyword()
}
```

A reference named by its destination's lookup key (`Transformers.AddReferenceKeys`).

# `ui`

```elixir
@type ui() :: %{
  screen: module() | nil,
  form: module() | nil,
  cells: %{required(atom()) =&gt; module()},
  fields: %{required(atom()) =&gt; module()},
  panels: [Alternera.Resource.Extension.Panel.t()],
  actions: [Alternera.Resource.Extension.Action.t()],
  views: [Alternera.Resource.Extension.View.t()],
  workbench_items: [Alternera.Resource.Extension.Surface.t()]
}
```

What `ui/1` returns: the resource's own UI, by kind.

# `alternera_resource_cache`

```elixir
@spec alternera_resource_cache(dsl_or_extended :: module() | map()) ::
  {:ok, boolean() | keyword()} | :error
```

Caches pipeline and Lua lookups on each node: `true` (60 000 ms) or `[ttl_ms: n]` with n > 0. Off by default: every lookup reads the database.

# `alternera_resource_cache!`

```elixir
@spec alternera_resource_cache!(dsl_or_extended :: module() | map()) ::
  (boolean() | keyword()) | no_return()
```

Caches pipeline and Lua lookups on each node: `true` (60 000 ms) or `[ttl_ms: n]` with n > 0. Off by default: every lookup reads the database.

# `alternera_resource_description`

```elixir
@spec alternera_resource_description(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error
```

One sentence for lists and MCP.

# `alternera_resource_description!`

```elixir
@spec alternera_resource_description!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()
```

One sentence for lists and MCP.

# `alternera_resource_expose`

```elixir
@spec alternera_resource_expose(dsl_or_extended :: module() | map()) ::
  {:ok, mcp: [atom()], api: [atom()]} | :error
```

What the proxy exposes beyond its UI. Nothing is exposed unless listed.

# `alternera_resource_expose!`

```elixir
@spec alternera_resource_expose!(dsl_or_extended :: module() | map()) ::
  [mcp: [atom()], api: [atom()]] | no_return()
```

What the proxy exposes beyond its UI. Nothing is exposed unless listed.

# `alternera_resource_label`

```elixir
@spec alternera_resource_label(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error
```

Shown in navigation, lists and MCP.

# `alternera_resource_label!`

```elixir
@spec alternera_resource_label!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()
```

Shown in navigation, lists and MCP.

# `alternera_resource_list_fields`

```elixir
@spec alternera_resource_list_fields(dsl_or_extended :: module() | map()) ::
  {:ok, [atom()]} | :error
```

The public attributes shown as grid columns, in order.

# `alternera_resource_list_fields!`

```elixir
@spec alternera_resource_list_fields!(dsl_or_extended :: module() | map()) ::
  [atom()] | no_return()
```

The public attributes shown as grid columns, in order.

# `alternera_resource_lookup_key`

```elixir
@spec alternera_resource_lookup_key(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error
```

The attribute a pipeline lookup, Lua, a CSV upsert and select labels find a record by. An identity on it alone must make it unique per tenant.

# `alternera_resource_lookup_key!`

```elixir
@spec alternera_resource_lookup_key!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()
```

The attribute a pipeline lookup, Lua, a CSV upsert and select labels find a record by. An identity on it alone must make it unique per tenant.

# `alternera_resource_options`

```elixir
@spec alternera_resource_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) =&gt; any()
}
```

alternera_resource DSL options

Returns a map containing the and any configured or default values.

# `alternera_resource_read_only_actions`

```elixir
@spec alternera_resource_read_only_actions(dsl_or_extended :: module() | map()) ::
  {:ok, [atom()]} | :error
```

Generic actions that change nothing (a calculation, a lookup): any role in the tenant may run them, as it may read, and the API serves them as a GET. Any other generic action needs the role that writes.

# `alternera_resource_read_only_actions!`

```elixir
@spec alternera_resource_read_only_actions!(dsl_or_extended :: module() | map()) ::
  [atom()] | no_return()
```

Generic actions that change nothing (a calculation, a lookup): any role in the tenant may run them, as it may read, and the API serves them as a GET. Any other generic action needs the role that writes.

# `alternera_resource_screen`

```elixir
@spec alternera_resource_screen(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error
```

A LiveComponent shown in place of the generated page; the same as `ui`'s `screen`.

# `alternera_resource_screen!`

```elixir
@spec alternera_resource_screen!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()
```

A LiveComponent shown in place of the generated page; the same as `ui`'s `screen`.

# `alternera_resource_ui`

```elixir
@spec alternera_resource_ui(dsl_or_extended :: module() | map()) :: [struct()]
```

alternera_resource.ui DSL entities

# `alternera_resource_ui_form`

```elixir
@spec alternera_resource_ui_form(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error
```

A LiveComponent laying out the record form.

# `alternera_resource_ui_form!`

```elixir
@spec alternera_resource_ui_form!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()
```

A LiveComponent laying out the record form.

# `alternera_resource_ui_options`

```elixir
@spec alternera_resource_ui_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) =&gt; any()
}
```

alternera_resource.ui DSL options

Returns a map containing the and any configured or default values.

# `alternera_resource_ui_screen`

```elixir
@spec alternera_resource_ui_screen(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error
```

A LiveComponent shown in place of the generated page.

# `alternera_resource_ui_screen!`

```elixir
@spec alternera_resource_ui_screen!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()
```

A LiveComponent shown in place of the generated page.

# `cache`

```elixir
@spec cache(module() | map()) :: %{ttl_ms: pos_integer()} | nil
```

The lookup cache: `nil` when off, `%{ttl_ms: n}` when on (`cache true`
means 60 000 ms). A setting the contract refuses reads as `nil`.

# `description`

```elixir
@spec description(module() | map()) :: String.t() | nil
```

The one-sentence description, or `nil`.

# `expose_api`

```elixir
@spec expose_api(module() | map()) :: [atom()]
```

The exposed JSON:API routes.

# `expose_api_actions`

```elixir
@spec expose_api_actions(module() | map()) :: [atom()]
```

The generic actions in `expose api:`, each served as a route of its own.

# `expose_mcp`

```elixir
@spec expose_mcp(module() | map()) :: [atom()]
```

The action names exposed to the MCP tools.

# `expose_routes`

```elixir
@spec expose_routes(module() | map()) :: [atom()]
```

The JSON:API route kinds in `expose api:` (`:index`, `:get`, `:post`, `:patch`, `:delete`).

# `identity`

```elixir
@spec identity(module()) :: map()
```

`%{package_id, resource_id, table, schema}` as `use Alternera.Resource` set them.

# `label`

```elixir
@spec label(module() | map()) :: String.t() | nil
```

The display label.

# `list_fields`

```elixir
@spec list_fields(module() | map()) :: [atom()]
```

The grid columns, in order.

# `lookup_key`

```elixir
@spec lookup_key(module() | map()) :: atom() | nil
```

The lookup key attribute, or `nil`.

# `name`

```elixir
@spec name(module()) :: String.t()
```

The resource's full name, `"<package id>.<resource id>"`.

# `package_ui`

```elixir
@spec package_ui(module()) :: %{
  pages: [Alternera.Resource.Extension.Surface.t()],
  workbench_items: [Alternera.Resource.Extension.Surface.t()]
}
```

A package's own pages and Workbench items, from its domain's
`alternera_ui` section: `%{pages: [...], workbench_items: [...]}`.

# `read_only_actions`

```elixir
@spec read_only_actions(module() | map()) :: [atom()]
```

The generic actions that change nothing (`read_only_actions`).

# `reference_keys`

```elixir
@spec reference_keys(module()) :: [reference_key()]
```

The `belongs_to` references whose destination has a lookup key, each
with `field`, the calculation and argument (`<relationship>_<key>`) that
name the record by that key outside the proxy in place of `attribute`.

# `resource?`

```elixir
@spec resource?(module()) :: boolean()
```

Whether the module is a resource of a resource package.

# `screen`

```elixir
@spec screen(module() | map()) :: module() | nil
```

The LiveComponent replacing the generated page, or `nil`: `ui`'s `screen`,
else the section's own `screen` option.

# `tenant_attribute`

```elixir
@spec tenant_attribute() :: atom()
```

The attribute every resource is scoped by: `:tenant_id`.

# `ui`

```elixir
@spec ui(module() | map()) :: ui()
```

The resource's own UI, from `alternera_resource`'s `ui` section.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
