Wayfinder.Processor.Route (Wayfinder Ex v0.1.5)

View Source

Represents a simplified Phoenix route for TypeScript generation.

Summary

Functions

Converts a raw %Phoenix.Router.Route{} into a %Wayfinder.Route{}.

Generate a JS-safe method name for controller actions

Types

param_spec()

@type param_spec() :: %{name: String.t(), optional: boolean(), glob: boolean()}

params_by_method()

@type params_by_method() :: %{required(String.t()) => [param_spec()]}

phoenix_route_opts()

@type phoenix_route_opts() :: %{
  controller_parts: [String.t()],
  controller_name_action: String.t()
}

t()

@type t() :: %Wayfinder.Processor.Route{
  action: atom(),
  alias: String.t(),
  all_params: [param_spec()],
  controller: module(),
  file: String.t() | nil,
  line: pos_integer() | nil,
  methods: [String.t()],
  original_action: atom(),
  params_by_method: params_by_method(),
  path: String.t()
}

Functions

from_phoenix_route(map, opts)

@spec from_phoenix_route(Phoenix.Router.Route.t(), phoenix_route_opts()) :: t()

Converts a raw %Phoenix.Router.Route{} into a %Wayfinder.Route{}.

js_method(route)

@spec js_method(t()) :: String.t()

Generate a JS-safe method name for controller actions

normalize_verbs(verb)