The Ash domain of a resource package: one per package, and its id names the
package everywhere (the Postgres schema resources_<id>, the resource names
"<id>.<resource id>", the REST paths).
defmodule Finance.Resources do
use Alternera.Resource.Domain, id: "finance"
resources do
resource Finance.Currency
end
endOptions:
:id(required):^[a-z][a-z0-9_]{0,30}$, unique in a build.:sdk: the contract major the package is written against, the current one (Alternera.Resource.sdk_version/0) by default. The proxy refuses a package written against another.:docs: the package's page of the user guide, a Markdown file relative to the domain's source file. It is read at compile time and embedded, so the package carries it with no file at run time (__resource_package__/0'sdocs, nil without one). Its front matter needstitle,section: Resource packages,order,summaryandverified; the proxy appends a reference generated from the resources, and gates the page with the resources licence.:authorize: whether a call on the package's resources may skip their policies.:always(the default): every call is authorised, and a call that passesauthorize?: falseis refused withAsh.Error.Forbidden.DomainRequiresAuthorization, so the policies decide whoever calls, the package's own UI included.:by_default: Ash's default, a call is authorised unless it saysauthorize?: false, for a package whose own code does work on the system's behalf. Work for the system under:alwayspasses the system actor,%{system: true}, which the policy prefix lets through.
use expands to use Ash.Domain with AshJsonApi.Domain and
AshPaperTrail.Domain and defines __resource_package__/0. The version
resources are listed by Alternera.Resource.DomainExtension, not by
AshPaperTrail's include_versions? (see that module for why). A package's domain is never in the proxy's
ash_domains, so it does not ask to be.