Reads a resource's alternera_resource section and its identity.
Summary
Types
A reference named by its destination's lookup key (Transformers.AddReferenceKeys).
Functions
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.
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.
One sentence for lists and MCP.
One sentence for lists and MCP.
What the proxy exposes beyond its UI. Nothing is exposed unless listed.
What the proxy exposes beyond its UI. Nothing is exposed unless listed.
Shown in navigation, lists and MCP.
Shown in navigation, lists and MCP.
The public attributes shown as grid columns, in order.
The public attributes shown as grid columns, in order.
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.
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 DSL options
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.
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.
A LiveComponent shown in place of the generated page; the same as ui's screen.
A LiveComponent shown in place of the generated page; the same as ui's screen.
alternera_resource.ui DSL entities
A LiveComponent laying out the record form.
A LiveComponent laying out the record form.
alternera_resource.ui DSL options
A LiveComponent shown in place of the generated page.
A LiveComponent shown in place of the generated page.
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.
The one-sentence description, or nil.
The exposed JSON:API routes.
The generic actions in expose api:, each served as a route of its own.
The action names exposed to the MCP tools.
The JSON:API route kinds in expose api: (:index, :get, :post, :patch, :delete).
%{package_id, resource_id, table, schema} as use Alternera.Resource set them.
The display label.
The grid columns, in order.
The lookup key attribute, or nil.
The resource's full name, "<package id>.<resource id>".
A package's own pages and Workbench items, from its domain's
alternera_ui section: %{pages: [...], workbench_items: [...]}.
The generic actions that change nothing (read_only_actions).
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.
Whether the module is a resource of a resource package.
The LiveComponent replacing the generated page, or nil: ui's screen,
else the section's own screen option.
The attribute every resource is scoped by: :tenant_id.
The resource's own UI, from alternera_resource's ui section.
Types
@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).
@type ui() :: %{ screen: module() | nil, form: module() | nil, cells: %{required(atom()) => module()}, fields: %{required(atom()) => 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.
Functions
@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.
@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.
@spec alternera_resource_description(dsl_or_extended :: module() | map()) :: {:ok, String.t()} | :error
One sentence for lists and MCP.
@spec alternera_resource_description!(dsl_or_extended :: module() | map()) :: String.t() | no_return()
One sentence for lists and MCP.
@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.
@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.
Shown in navigation, lists and MCP.
Shown in navigation, lists and MCP.
@spec alternera_resource_list_fields(dsl_or_extended :: module() | map()) :: {:ok, [atom()]} | :error
The public attributes shown as grid columns, in order.
@spec alternera_resource_list_fields!(dsl_or_extended :: module() | map()) :: [atom()] | no_return()
The public attributes shown as grid columns, in order.
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.
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.
@spec alternera_resource_options(dsl_or_extended :: module() | map()) :: %{ required(atom()) => any() }
alternera_resource DSL options
Returns a map containing the and any configured or default values.
@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.
@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.
A LiveComponent shown in place of the generated page; the same as ui's screen.
A LiveComponent shown in place of the generated page; the same as ui's screen.
alternera_resource.ui DSL entities
A LiveComponent laying out the record form.
A LiveComponent laying out the record form.
@spec alternera_resource_ui_options(dsl_or_extended :: module() | map()) :: %{ required(atom()) => any() }
alternera_resource.ui DSL options
Returns a map containing the and any configured or default values.
A LiveComponent shown in place of the generated page.
A LiveComponent shown in place of the generated page.
@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.
The one-sentence description, or nil.
The exposed JSON:API routes.
The generic actions in expose api:, each served as a route of its own.
The action names exposed to the MCP tools.
The JSON:API route kinds in expose api: (:index, :get, :post, :patch, :delete).
%{package_id, resource_id, table, schema} as use Alternera.Resource set them.
The display label.
The grid columns, in order.
The lookup key attribute, or nil.
The resource's full name, "<package id>.<resource id>".
@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: [...]}.
The generic actions that change nothing (read_only_actions).
@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.
Whether the module is a resource of a resource package.
The LiveComponent replacing the generated page, or nil: ui's screen,
else the section's own screen option.
@spec tenant_attribute() :: atom()
The attribute every resource is scoped by: :tenant_id.
The resource's own UI, from alternera_resource's ui section.