Thin accessor module for reading ash_typescript-owned data persisted under
custom.ash_typescript on Ash.Info.Manifest structs.
Decoration is done by AshTypescript.Manifest.Decorator after
Ash.Info.Manifest.Generator.generate/1. Runtime callers should prefer these
accessors over walking Spark DSL state — the manifest carries pre-computed
lookups that are O(1) map reads.
All accessors return nil (or sensible empty defaults) when the struct has
no ash_typescript decoration, so callers can pattern-match on nil.
Summary
Types
The decoration map persisted under custom.ash_typescript on the
%Manifest.Action{} carried by an RPC/typed-query entrypoint (and thus present
in action_lookup). Only actions exposed as entrypoints are decorated — those
are the only ones the runtime pipeline ever looks up.
The decoration map persisted under custom.ash_typescript on a
%Manifest.Entrypoint{}.
The decoration map persisted under custom.ash_typescript on a
%Manifest.Resource{} (including embedded resources nested under a %Manifest.Type{}).
The decoration map persisted under custom.ash_typescript on a
%Manifest.Type{} for NewTypes/TypedStructs that export
typescript_field_names/0.
Functions
Returns the precomputed %{client_name => internal_atom} input map for a
decorated action under formatter (one of the built-in formatters), or nil
when the action isn't decorated or formatter isn't a precomputed built-in
(caller should compute live).
Returns the precomputed %{internal_atom => %Manifest.Type{}} input field-type
map for a decorated action, or nil when the action isn't decorated.
Returns the precomputed return-type classification for a decorated action
(the result of ActionIntrospection.action_returns_field_selectable_type?/1),
or nil when the action isn't decorated (caller should compute live).
Returns the argument-name mapping (%{arg_atom => client_string}) for a
particular action on the resource, or an empty map.
Returns the :ash_typescript decoration map for any struct that carries a
custom field, or nil if no decoration is present.
Returns the precomputed bulk-authorization strategy (:error or :filter)
for a decorated resource, or nil when the resource isn't decorated (caller
should fall back to a live Ash.DataLayer.data_layer_can?/2 check).
Returns the domain module that owns this entrypoint, or nil.
Returns the precomputed exposed metadata field atoms for an entrypoint, or [].
Returns the forward field_name_mappings map (atom => client_string) for
a decorated resource, or an empty map.
Whether client filtering is enabled for this entrypoint. Defaults to true.
Returns the pre-formatted client name for a field under a built-in formatter,
or nil if the resource isn't decorated, the field isn't tracked, or the
formatter isn't one of :camel_case / :snake_case / :pascal_case.
Returns the load restriction tag for an entrypoint. Defaults to :none.
Looks up the mapped client name for an action argument atom. Returns nil
if no mapping is registered.
Looks up the mapped client name for an internal field atom, or returns nil
if there is no mapping.
Returns the metadata field-name mapping (atom => client_string) for the
entrypoint's RPC action, or an empty map.
Looks up the original Elixir argument atom for a client-side argument name.
Returns nil if no mapping is registered.
Looks up the original Elixir atom for a client-side field name. Returns nil
if no mapping is registered.
Returns the pagination capability of a many-cardinality relationship's
effective read action, derived at decoration time. :none for undecorated
relationships (to-one, or destination not an RPC resource).
Returns the effective read action name for a decorated many-cardinality
relationship (the relationship's configured read_action, falling back to
the destination's primary read action). nil when undecorated.
Resolves a resource module atom to its decorated %Manifest.Resource{}.
Returns the resource_config DSL struct for this entrypoint, or nil.
Returns the reverse mapping (client_string => atom) for a decorated resource.
Returns the reverse metadata mapping (client_string => atom), or empty.
Returns the reverse mapping (client_string => atom) for a decorated type.
Returns the RPC action DSL struct stashed on the entrypoint, or nil if the
entrypoint isn't an RPC-action entrypoint (e.g., a typed-query-only entry).
Whether client sorting is enabled for this entrypoint. Defaults to true.
Returns the forward field_name_mappings map for a decorated type.
Returns {forward, reverse} field-name maps for a decorated type, or nil
when the type carries no ash_typescript decoration.
Returns the precomputed TypeScript type name for a decorated resource or
type struct, or nil when undecorated / not applicable.
Returns the typed-query DSL struct stashed on the entrypoint, or nil.
Returns true if the resource struct was decorated by ash_typescript
(i.e., the underlying module has the AshTypescript.Resource extension).
Types
@type action_custom() :: %{ optional(:return_classification) => {:ok, atom(), term()} | {:error, atom()}, optional(:input_expected_keys) => %{ required(atom()) => %{required(String.t()) => atom()} }, optional(:input_field_types) => %{ required(atom()) => Ash.Info.Manifest.Type.t() } }
The decoration map persisted under custom.ash_typescript on the
%Manifest.Action{} carried by an RPC/typed-query entrypoint (and thus present
in action_lookup). Only actions exposed as entrypoints are decorated — those
are the only ones the runtime pipeline ever looks up.
@type entrypoint_custom() :: %{ optional(:rpc_action) => term(), optional(:typed_query) => term(), optional(:domain) => atom(), optional(:resource_config) => term(), optional(:metadata_field_mappings) => %{required(atom()) => String.t()}, optional(:reverse_metadata_field_mappings) => %{ required(String.t()) => atom() }, optional(:exposed_metadata_fields) => [atom()], optional(:load_restrictions) => {:allow, list()} | {:deny, list()} | :none, optional(:filtering_enabled?) => boolean(), optional(:sorting_enabled?) => boolean() }
The decoration map persisted under custom.ash_typescript on a
%Manifest.Entrypoint{}.
@type resource_custom() :: %{ optional(:field_name_mappings) => %{required(atom()) => String.t()}, optional(:reverse_field_name_mappings) => %{required(String.t()) => atom()}, optional(:argument_name_mappings) => %{ required(atom()) => %{required(atom()) => String.t()} }, optional(:reverse_argument_name_mappings) => %{ required(atom()) => %{required(String.t()) => atom()} }, optional(:formatted_field_names) => %{ required({atom(), atom()}) => String.t() }, optional(:type_name) => String.t() | nil, optional(:authorize_bulk_strategy) => :error | :filter }
The decoration map persisted under custom.ash_typescript on a
%Manifest.Resource{} (including embedded resources nested under a %Manifest.Type{}).
@type type_custom() :: %{ optional(:field_name_mappings) => %{required(atom()) => String.t()}, optional(:reverse_field_name_mappings) => %{required(String.t()) => atom()}, optional(:type_name) => String.t() | nil }
The decoration map persisted under custom.ash_typescript on a
%Manifest.Type{} for NewTypes/TypedStructs that export
typescript_field_names/0.
Functions
@spec action_input_expected_keys(Ash.Info.Manifest.Action.t() | nil, atom() | tuple()) :: %{required(String.t()) => atom()} | nil
Returns the precomputed %{client_name => internal_atom} input map for a
decorated action under formatter (one of the built-in formatters), or nil
when the action isn't decorated or formatter isn't a precomputed built-in
(caller should compute live).
@spec action_input_field_types(Ash.Info.Manifest.Action.t() | nil) :: %{required(atom()) => Ash.Info.Manifest.Type.t()} | nil
Returns the precomputed %{internal_atom => %Manifest.Type{}} input field-type
map for a decorated action, or nil when the action isn't decorated.
@spec action_return_classification(Ash.Info.Manifest.Action.t() | nil) :: {:ok, atom(), term()} | {:error, atom()} | nil
Returns the precomputed return-type classification for a decorated action
(the result of ActionIntrospection.action_returns_field_selectable_type?/1),
or nil when the action isn't decorated (caller should compute live).
@spec argument_name_mappings_for_action(Ash.Info.Manifest.Resource.t() | nil, atom()) :: %{ required(atom()) => String.t() }
Returns the argument-name mapping (%{arg_atom => client_string}) for a
particular action on the resource, or an empty map.
Returns the :ash_typescript decoration map for any struct that carries a
custom field, or nil if no decoration is present.
@spec authorize_bulk_strategy(Ash.Info.Manifest.Resource.t() | nil) :: :error | :filter | nil
Returns the precomputed bulk-authorization strategy (:error or :filter)
for a decorated resource, or nil when the resource isn't decorated (caller
should fall back to a live Ash.DataLayer.data_layer_can?/2 check).
@spec entrypoint_domain(Ash.Info.Manifest.Entrypoint.t() | nil) :: atom() | nil
Returns the domain module that owns this entrypoint, or nil.
@spec exposed_metadata_fields(Ash.Info.Manifest.Entrypoint.t() | nil) :: [atom()]
Returns the precomputed exposed metadata field atoms for an entrypoint, or [].
@spec field_name_mappings(Ash.Info.Manifest.Resource.t() | nil) :: %{ required(atom()) => String.t() }
Returns the forward field_name_mappings map (atom => client_string) for
a decorated resource, or an empty map.
@spec filtering_enabled?(Ash.Info.Manifest.Entrypoint.t() | nil) :: boolean()
Whether client filtering is enabled for this entrypoint. Defaults to true.
@spec formatted_field_name(Ash.Info.Manifest.Resource.t() | nil, atom(), atom()) :: String.t() | nil
Returns the pre-formatted client name for a field under a built-in formatter,
or nil if the resource isn't decorated, the field isn't tracked, or the
formatter isn't one of :camel_case / :snake_case / :pascal_case.
@spec load_restrictions(Ash.Info.Manifest.Entrypoint.t() | nil) :: {:allow, list()} | {:deny, list()} | :none
Returns the load restriction tag for an entrypoint. Defaults to :none.
@spec mapped_argument_name(Ash.Info.Manifest.Resource.t() | nil, atom(), atom()) :: String.t() | nil
Looks up the mapped client name for an action argument atom. Returns nil
if no mapping is registered.
@spec mapped_field_name(Ash.Info.Manifest.Resource.t() | nil, atom()) :: String.t() | nil
Looks up the mapped client name for an internal field atom, or returns nil
if there is no mapping.
@spec metadata_field_mappings(Ash.Info.Manifest.Entrypoint.t() | nil) :: %{ required(atom()) => String.t() }
Returns the metadata field-name mapping (atom => client_string) for the
entrypoint's RPC action, or an empty map.
@spec original_argument_name( Ash.Info.Manifest.Resource.t() | nil, atom(), String.t() | atom() ) :: atom() | nil
Looks up the original Elixir argument atom for a client-side argument name.
Returns nil if no mapping is registered.
Accepts atom or string for client_name.
@spec original_field_name(Ash.Info.Manifest.Resource.t() | nil, String.t() | atom()) :: atom() | nil
Looks up the original Elixir atom for a client-side field name. Returns nil
if no mapping is registered.
Accepts atom or string for client_name (atom is converted via Atom.to_string/1).
@spec relationship_pagination(Ash.Info.Manifest.Relationship.t() | nil) :: :offset | :keyset | :mixed | :none
Returns the pagination capability of a many-cardinality relationship's
effective read action, derived at decoration time. :none for undecorated
relationships (to-one, or destination not an RPC resource).
@spec relationship_read_action(Ash.Info.Manifest.Relationship.t() | nil) :: atom() | nil
Returns the effective read action name for a decorated many-cardinality
relationship (the relationship's configured read_action, falling back to
the destination's primary read action). nil when undecorated.
@spec resolve_resource(atom() | term(), module() | nil) :: Ash.Info.Manifest.Resource.t() | nil
Resolves a resource module atom to its decorated %Manifest.Resource{}.
Checks the domain resource lookup first, then falls back to the embedded
resource carried on a kind: :embedded_resource entry in the type lookup
(embedded resources are not present in resource_lookup). Returns nil
when the module is not in the manifest.
Accepts an optional manifest module so callers operating on a scoped
manifest (e.g. verifiers running against inline domains via
AshTypescript.Manifest.verify_for_domains/1) resolve against that
manifest instead of the globally configured one. nil uses the
configured manifest.
@spec resource_config(Ash.Info.Manifest.Entrypoint.t() | nil) :: term() | nil
Returns the resource_config DSL struct for this entrypoint, or nil.
@spec reverse_field_name_mappings(Ash.Info.Manifest.Resource.t() | nil) :: %{ required(String.t()) => atom() }
Returns the reverse mapping (client_string => atom) for a decorated resource.
@spec reverse_metadata_field_mappings(Ash.Info.Manifest.Entrypoint.t() | nil) :: %{ required(String.t()) => atom() }
Returns the reverse metadata mapping (client_string => atom), or empty.
@spec reverse_type_field_name_mappings(Ash.Info.Manifest.Type.t() | nil) :: %{ required(String.t()) => atom() }
Returns the reverse mapping (client_string => atom) for a decorated type.
@spec rpc_action(Ash.Info.Manifest.Entrypoint.t() | nil) :: term() | nil
Returns the RPC action DSL struct stashed on the entrypoint, or nil if the
entrypoint isn't an RPC-action entrypoint (e.g., a typed-query-only entry).
@spec sorting_enabled?(Ash.Info.Manifest.Entrypoint.t() | nil) :: boolean()
Whether client sorting is enabled for this entrypoint. Defaults to true.
@spec type_field_name_mappings(Ash.Info.Manifest.Type.t() | nil) :: %{ required(atom()) => String.t() }
Returns the forward field_name_mappings map for a decorated type.
@spec type_field_name_mappings_pair(Ash.Info.Manifest.Type.t() | nil) :: {%{required(atom()) => String.t()}, %{required(String.t()) => atom()}} | nil
Returns {forward, reverse} field-name maps for a decorated type, or nil
when the type carries no ash_typescript decoration.
Unlike type_field_name_mappings/1 (which returns %{} for both the
decorated-but-empty and undecorated cases), this distinguishes "not decorated"
as nil so callers can fall back to resolving the decorated type from the type
lookup or to live reflection.
@spec type_name(Ash.Info.Manifest.Resource.t() | Ash.Info.Manifest.Type.t() | nil) :: String.t() | nil
Returns the precomputed TypeScript type name for a decorated resource or
type struct, or nil when undecorated / not applicable.
@spec typed_query(Ash.Info.Manifest.Entrypoint.t() | nil) :: term() | nil
Returns the typed-query DSL struct stashed on the entrypoint, or nil.
@spec typescript_resource?(Ash.Info.Manifest.Resource.t() | nil) :: boolean()
Returns true if the resource struct was decorated by ash_typescript
(i.e., the underlying module has the AshTypescript.Resource extension).