Aurora. Uix. Integration. Ash. ContextParserDefaults
(Aurora UIX v0.1.4-rc.0)
Copy Markdown
Parsing functionality for Ash-based resource configurations.
Automatically detects and configures context-related functions for resources, such as listing, getting, creating, updating, and deleting elements. Infers function names based on context and schema module conventions using Ash resource naming conventions.
Key Features
- Automatic function discovery from Ash domains and resources
- Primary action detection with fallback to first available action
- Support for paginated and non-paginated read operations
- Function reference creation with action metadata
Key Constraints
- Currently only implements read-related actions (
:list_function,:list_function_paginated,:get_function) - Requires Ash domain and resource configuration
- Returns placeholder function when no valid action is found
- Functions are resolved from configured Ash resource or Ash domain
Implemented Options
:list_function- Function reference for reading all elements:list_function_paginated- Function reference for reading elements using pagination:get_function- Function reference for getting one element
Summary
Functions
Resolves default values for context-derived properties.
Functions
@spec option_value(map(), map(), keyword(), atom()) :: Aurora.Uix.Integration.Connector.t() | nil
Resolves default values for context-derived properties.
Discovers Ash actions from the domain and resource, selecting primary actions when available or falling back to the first available action.
Parameters
parsed_opts(map()) - Map containing resolved options with:sourceand:module.resource_config(map()) - Map with keys::context(module() | nil) - The Ash domain module.:schema(module() | nil) - The Ash resource module.
key(atom()) - The Aurora UIX action key (:list_function,:list_function_paginated,:get_function,:change_function,:create_function,:update_function,:delete_function,:new_function).
Returns
Connector.t() | nil - Returns %Connector{} struct with %CrudSpec{} if action
found, otherwise returns nil for unhandled keys.
Examples
iex> default_value(%{}, %{context: MyApp.Accounts, schema: MyApp.User}, :list_function)
%Connector{type: :ash, crud_spec: %CrudSpec{...}}
iex> default_value(%{}, %{context: nil, schema: MyApp.Post}, :get_function)
%Connector{type: :ash, crud_spec: %CrudSpec{...}}