AshTypescript.Helpers (ash_typescript v0.17.3)

Copy Markdown View Source

Utility functions for string manipulation and transformations.

Summary

Functions

Formats a field name using the configured output field formatter.

Formats a value for embedding in generated TypeScript code.

Helper functions for commonly used calculation and field selection field names. These ensure consistency across all args/fields-related type generation.

Helper functions for commonly used error field names. These ensure consistency across all error-related type generation.

Helper functions for commonly used config interface field names. These ensure consistency across all RPC config-related type generation.

Helper function for pagination page field name.

Helper functions for commonly used pagination field names. These ensure consistency across all pagination-related type generation.

Functions

camel_to_snake_case(camel)

format_output_field(field_name)

Formats a field name using the configured output field formatter.

format_ts_value(value)

Formats a value for embedding in generated TypeScript code.

Accepts either:

  • A string: Returns the string as a quoted literal for direct embedding
  • A tuple {:runtime_expr, "expression"}: Returns the expression as-is for runtime evaluation

Examples

iex> format_ts_value("/rpc/run")
""/rpc/run""

iex> format_ts_value({:runtime_expr, "AppConfig.getEndpoint()"})
"AppConfig.getEndpoint()"

formatted_after_field()

formatted_args_field()

Helper functions for commonly used calculation and field selection field names. These ensure consistency across all args/fields-related type generation.

formatted_before_field()

formatted_channel_field()

formatted_count_field()

formatted_custom_fetch_field()

formatted_data_field()

formatted_error_details_field()

formatted_error_fields_field()

formatted_error_handler_field()

formatted_error_message_field()

formatted_error_path_field()

formatted_error_short_message_field()

formatted_error_type_field()

Helper functions for commonly used error field names. These ensure consistency across all error-related type generation.

Matches the error structure defined in AshTypescript.Rpc.Error protocol.

formatted_error_vars_field()

formatted_errors_field()

formatted_fetch_options_field()

formatted_fields_field()

formatted_filter_field()

formatted_has_more_field()

formatted_headers_field()

formatted_hook_ctx_field()

formatted_identity_field()

formatted_input_field()

Helper functions for commonly used config interface field names. These ensure consistency across all RPC config-related type generation.

formatted_limit_field()

formatted_metadata_fields_field()

formatted_next_page_field()

formatted_offset_field()

formatted_page_field()

Helper function for pagination page field name.

formatted_previous_page_field()

formatted_result_handler_field()

formatted_results_field()

Helper functions for commonly used pagination field names. These ensure consistency across all pagination-related type generation.

formatted_sort_field()

formatted_success_field()

formatted_tenant_field()

formatted_timeout_field()

formatted_timeout_handler_field()

pascal_to_snake_case(pascal)

snake_to_camel_case(snake)

snake_to_pascal_case(snake)