Implements the four-stage pipeline:
- parse_request/3 - Parse and validate input with fail-fast
- execute_ash_action/1 - Execute Ash operations
- filter_result_fields/2 - Apply field selection
- format_output/2 - Format for client consumption
Action shape
Stage 1 resolves the action by reading from the configured manifest's action
lookup, so every downstream stage receives %Ash.Info.Manifest.Action{}.
Consumers should rely on:
action.inputs— unified arguments + accepted attributes, each carrying a resolved%Ash.Info.Manifest.Type{}(no separate:constraintsfield; constraints are folded into the resolved type).action.returns—%Ash.Info.Manifest.Type{}ornil.action.pagination—%Ash.Info.Manifest.Pagination{}(uses:countable?, not:countable).action.metadata— list of%Ash.Info.Manifest.Metadata{}whose:typeis already resolved.
Raw-Ash fields (arguments, accept, constraints, allow_nil_input,
require_attributes) are NOT present. Use
AshTypescript.Rpc.Codegen.Helpers.ActionIntrospection.get_action!/2 for
manifest lookups in runtime code paths instead of Ash.Resource.Info.action/2.
Summary
Functions
Stage 2: Execute Ash action using the parsed request.
Looks up the manifest entrypoint for a typed query by name.
Stage 4: Format output for client consumption.
Stage 4: Format output for client consumption with type awareness.
Stage 1: Parse and validate request.
Stage 3: Filter result fields using the extraction template.
Functions
@spec execute_ash_action(AshTypescript.Rpc.Request.t()) :: {:ok, term()} | {:error, term()}
Stage 2: Execute Ash action using the parsed request.
Builds the appropriate Ash query/changeset and executes it. Returns the raw Ash result for further processing.
Looks up the manifest entrypoint for a typed query by name.
Returns the %Ash.Info.Manifest.Entrypoint{} or nil. Public because
Rpc.run_typed_query/4 needs the same lookup to read the query's fields
before delegating to run_action/3.
Stage 4: Format output for client consumption.
Applies output field formatting and final response structure.
The error clause handles failures raised before a %Request{} exists (action
discovery, identity resolution, parameter validation); errors are formatted the
same way as in format_output/2 so both paths agree on the response shape. The
fallback clause formats bare data with no response envelope.
Stage 4: Format output for client consumption with type awareness.
Applies type-aware output field formatting and final response structure.
@spec parse_request(atom(), Plug.Conn.t() | Phoenix.Socket.t(), map(), keyword()) :: {:ok, AshTypescript.Rpc.Request.t()} | {:error, term()}
Stage 1: Parse and validate request.
Converts raw request parameters into a structured Request with validated fields. Fails fast on any invalid input - no permissive modes.
@spec process_result(term(), AshTypescript.Rpc.Request.t()) :: {:ok, term()} | {:error, term()}
Stage 3: Filter result fields using the extraction template.
Applies field selection to the Ash result using the pre-computed template. Performance-optimized single-pass filtering. For unconstrained maps, returns the normalized result directly. Handles metadata extraction for both read and mutation actions. If the extraction template is empty for mutation actions (create/update), returns empty data.