API Reference ash_typescript v#0.18.2

Copy Markdown View Source

Modules

Main code generation module for TypeScript types and schemas from Ash resources.

Generates TypeScript filter types for Ash resources.

Shared helper functions for code generation.

Resolves relative import paths between generated TypeScript files and generates namespace re-export content.

Coordinates multi-file TypeScript code generation with full cross-file deduplication.

Generates TypeScript schemas for Ash resources.

Shared logic for schema generation across all validation library targets.

Behaviour defining the output-format interface for schema generators.

Generates a shared validation schema file for any SchemaFormatter implementation.

Generates the shared TypeScript types file (ash_types.ts).

Generates TypeScript sort field as const arrays and derived union types for Ash resources.

Generates TypeScript type aliases for Ash types (e.g., UUID, Decimal, DateTime, etc.).

Discovers RPC-configured resources and builds configuration warnings.

Maps Ash types to TypeScript types using unified type-driven dispatch.

Generates TypeScript utility types for field selection and type inference.

Generates Valibot validation schemas for Ash resources and actions.

Generates Zod validation schemas for Ash resources and actions.

Formats an error map for client consumption.

Handles field name formatting for input parameters, output fields, and TypeScript generation.

Utility functions for string manipulation and transformations.

Standalone Spark DSL module for building a unified app-wide Ash.Info.Manifest.

Thin accessor module for reading ash_typescript-owned data persisted under custom.ash_typescript on Ash.Info.Manifest structs.

Walks a freshly generated %Ash.Info.Manifest{} once and populates custom.ash_typescript on every struct that carries ash_typescript-owned data

Spark transformer that builds a unified %Ash.Info.Manifest{} from all domains' RPC configurations and persists it on the DSL state.

Runs after BuildManifest and decorates the persisted %Ash.Info.Manifest{} with ash_typescript-specific metadata.

Walks the persisted %Ash.Info.Manifest{} and validates that field names in every RPC entrypoint's argument types and :action return types are TypeScript-safe.

Verifies that every identity referenced by an update/destroy RPC action exists on its resource.

Compile-time check that every type reachable from the manifest can be mapped to a TypeScript type.

Verifies that metadata field names in RPC actions are valid TypeScript identifiers and don't conflict with existing resource field names.

Validates the structural consistency of typescript_rpc configuration against the generated manifest.

Emits compile-time warnings for likely-misconfigured RPC setups.

Verifies that every typed query's fields selection references valid, public fields on its resource.

Verifies that every action's input fields map to unique TypeScript client names.

Shared helpers for validating identifiers that need to round-trip through TypeScript codegen. Used by every verifier that flags resource/action/field names producing awkward camelCase output.

Spark DSL extension for configuring TypeScript generation on Ash resources.

Provides introspection functions for AshTypescript.Resource configuration.

Verifies that resource field names are valid for TypeScript generation.

Verifies that field names in map, keyword, and tuple type constraints are valid for TypeScript.

Verifies that field_names configuration is valid.

Checks that all resources using AshTypescript.Resource have unique type_name values.

Generates TypeScript code for interacting with Ash resources via Rpc.

Renders Channel-specific TypeScript functions (handler-based, Phoenix channels).

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

Renders HTTP-specific TypeScript functions (Promise-based, fetch).

Generates JSDoc comments for RPC functions.

Builds TypeScript type definitions for RPC function results and configurations.

Generates TypeScript typed query types and field constants.

Single source of truth for the generated function and type names derived from an RPC action name.

Provides helper functions for analyzing Ash actions.

Builds TypeScript configuration field definitions for RPC functions.

Builds TypeScript payload field definitions for RPC function implementations.

Generates a machine-readable JSON manifest of all RPC actions.

Generates a Markdown manifest of all RPC actions for discoverability.

Collects RPC configuration from domains including resources, actions, and typed queries.

Generates TypeScript input types for RPC actions.

Generates TypeScript metadata types for RPC actions.

Generates TypeScript pagination result types for RPC actions.

Generates restricted resource schemas based on allowed_loads/denied_loads options.

Generates TypeScript result types for RPC actions.

Generates static TypeScript code that doesn't depend on specific resources.

Default error handler for RPC operations.

Protocol for extracting minimal information from exceptions for RPC responses.

Comprehensive error handling and message generation for the new RPC pipeline.

Behaviour for custom RPC error handlers.

Central error processing module for RPC operations.

Unified field extraction for different data structures.

Handles preprocessing of requested fields, converting map keys to atoms while preserving field name strings for later reverse mapping lookup.

Unified field selection processor using type-driven recursive dispatch.

Field validation helpers for the FieldSelector module.

Provides introspection functions for AshTypescript.Rpc configuration.

Formats input data from client format to internal format.

Enforcement of an RPC action's allowed_loads / denied_loads options.

Formats output data from internal format to client format.

Implements the four-stage pipeline

Request data structure for the new RPC pipeline.

Processes requested fields for Ash resources, determining which fields should be selected vs loaded, and building extraction templates for result processing.

Struct representing a resource's RPC configuration.

Extracts requested fields from RPC results using type-driven dispatch.

Struct representing an RPC action configuration.

Struct representing a typed query configuration.

Generates validation error schemas for TypeScript RPC clients.

Unified value formatting for RPC input/output.

Core type introspection and classification for Ash types.

Standalone Spark DSL for typed Phoenix channel event subscriptions from Ash PubSub publications.

Generates TypeScript types and functions for typed channel event subscriptions.

Spark DSL extension for defining typed Phoenix channel event subscriptions.

Represents an Ash resource whose publications are subscribed to.

Represents a declared channel event subscription.

Provides introspection functions for AshTypescript.TypedChannel configuration and for the Ash.Notifier.PubSub publications typed channels reference.

Compile-time injection of Phoenix channel event interception for typed channels.

Formats typed channel payloads at the websocket boundary.

Verifies that typed channel configurations are valid.

Standalone Spark DSL for defining typed controller routes.

Entry point for TypeScript path helper code generation.

Discovers all TypedController modules from application configuration.

Generates TypeScript functions for typed controller routes.

Introspects a Phoenix Router to match routes to generated controllers.

Generates static TypeScript code for typed controller routes.

Spark DSL extension for defining typed controller routes.

Struct representing a route configuration.

Struct representing a route argument configuration.

Provides introspection functions for AshTypescript.TypedController configuration.

Handles request lifecycle for typed controller routes.

Behaviour for typed controller route handlers.

Validates and folds each route argument's constraints against the argument type's constraint schema, exactly like Ash does for resource attributes and action arguments.

Spark transformer that generates a Phoenix controller module at compile time.

Verifies that typed controller configurations are valid.

Re-runs per-module Spark verifiers for the AshTypescript Resource and Rpc extensions. Spark emits warnings (rather than raising) when a verifier fails; during codegen we want to promote those warnings to hard errors. This module iterates the configured verifiers for each module and aggregates failures.

Mix Tasks

Generates TypeScript types for Ash Rpc-calls.

Installs AshTypescript into a project. Should be called with mix igniter.install ash_typescript