AshTypescript.Rpc.Info (ash_typescript v0.17.2)

Copy Markdown View Source

Provides introspection functions for AshTypescript.Rpc configuration.

This module generates helper functions to access RPC configuration defined in domains using the AshTypescript.Rpc DSL extension.

Summary

Functions

Gets the mapped metadata field name for an RPC action.

Gets the original metadata field name from a mapped name for an RPC action.

typescript_rpc DSL entities

An MFA or module that implements error handling for RPC operations.

An MFA or module that implements error handling for RPC operations.

Default namespace (filename) for all resources in this domain.

Default namespace (filename) for all resources in this domain.

typescript_rpc DSL options

Whether to show detailed information for raised exceptions.

Functions

get_mapped_metadata_field_name(arg1, field_name)

Gets the mapped metadata field name for an RPC action.

If a metadata_field_names mapping is defined for the field in the RPC action, returns the mapped name. Otherwise returns the original field name.

Parameters

  • rpc_action - The RpcAction struct
  • field_name - The metadata field name (atom)

Returns

The mapped field name (atom) or the original field name if no mapping exists.

get_original_metadata_field_name(arg1, mapped_field_name)

Gets the original metadata field name from a mapped name for an RPC action.

This is the reverse operation of get_mapped_metadata_field_name. If a metadata_field_names mapping exists where the value matches the provided name, returns the original key. Otherwise returns the provided name unchanged.

Parameters

  • rpc_action - The RpcAction struct
  • mapped_field_name - The mapped metadata field name (atom)

Returns

The original field name (atom) or the provided name if no reverse mapping exists.

Examples

# With metadata_field_names: [is_valid?: :isValid, field_1: :field1]
get_original_metadata_field_name(rpc_action, :isValid) #=> :is_valid?
get_original_metadata_field_name(rpc_action, :field1) #=> :field_1
get_original_metadata_field_name(rpc_action, :other) #=> :other

typescript_rpc(dsl_or_extended)

@spec typescript_rpc(dsl_or_extended :: module() | map()) :: [struct()]

typescript_rpc DSL entities

typescript_rpc_error_handler(dsl_or_extended)

@spec typescript_rpc_error_handler(dsl_or_extended :: module() | map()) ::
  {:ok, mfa() | :module} | :error

An MFA or module that implements error handling for RPC operations.

typescript_rpc_error_handler!(dsl_or_extended)

@spec typescript_rpc_error_handler!(dsl_or_extended :: module() | map()) ::
  (mfa() | :module) | no_return()

An MFA or module that implements error handling for RPC operations.

typescript_rpc_namespace(dsl_or_extended)

@spec typescript_rpc_namespace(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

Default namespace (filename) for all resources in this domain.

typescript_rpc_namespace!(dsl_or_extended)

@spec typescript_rpc_namespace!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

Default namespace (filename) for all resources in this domain.

typescript_rpc_options(dsl_or_extended)

@spec typescript_rpc_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

typescript_rpc DSL options

Returns a map containing the and any configured or default values.

typescript_rpc_show_raised_errors?(dsl_or_extended)

@spec typescript_rpc_show_raised_errors?(dsl_or_extended :: module() | map()) ::
  boolean()

Whether to show detailed information for raised exceptions.