AshTypescript.Rpc.Codegen.FunctionGenerators.FunctionCore (ash_typescript v0.17.2)

Copy Markdown View Source

Builds the common "shape" of RPC functions, independent of transport.

This module extracts all the shared logic between HTTP and Channel function generation, returning a structured map that renderers use to emit transport-specific TypeScript.

The core philosophy is: "What to generate" (business logic) is separate from "How to format it" (presentation/transport-specific rendering).

Summary

Functions

Builds the execution function shape for both HTTP and Channel transports.

Builds the validation function shape for both HTTP and Channel transports.

Functions

build_execution_function_shape(resource, action, rpc_action, rpc_action_name, opts \\ [])

Builds the execution function shape for both HTTP and Channel transports.

Returns a map containing:

  • Basic metadata (resource, action, names, context)
  • Field selection info (has_fields, fields_generic)
  • Config fields (common to both transports)
  • Pagination info
  • Metadata info

The renderer can then add transport-specific fields and formatting.

build_validation_function_shape(resource, action, rpc_action, rpc_action_name, opts \\ [])

Builds the validation function shape for both HTTP and Channel transports.

Validation functions are simpler - they don't have field selection, pagination, etc. They just validate input and return validation errors.