# `MishkaGervaz.Table.Transformers.Helpers`
[🔗](https://github.com/mishka-group/mishka_gervaz/blob/v0.0.1-alpha.3/lib/mishka_gervaz/table/transformers/_helpers.ex#L1)

Shared helper functions for MishkaGervaz transformers.

These functions are used across both table and form transformers to
reduce duplication and provide consistent DSL state manipulation.

Imported by `MishkaGervaz.Table.Transformers.{MergeDefaults,
ResolveColumns, BuildDomainConfig, BuildRuntimeConfig}` and
`MishkaGervaz.Form.Transformers.{MergeDefaults, ResolveFields,
BuildDomainConfig, BuildRuntimeConfig}`.

See `MishkaGervaz.Form.Web.State.Helpers` and
`MishkaGervaz.Form.Web.DataLoader.Helpers` for the runtime-side
equivalent helpers.

# `any_set?`

```elixir
@spec any_set?([term()]) :: boolean()
```

Checks if any value in the list is not nil.

# `default_if_nil`

```elixir
@spec default_if_nil(term(), term()) :: term()
```

Returns the default if value is nil, otherwise returns the value.

# `extract_nested_entity`

```elixir
@spec extract_nested_entity(list() | struct() | nil, module()) :: struct() | nil
```

Extracts a nested entity from a list or single value.
Spark stores nested entities as lists.

# `filter_by_type`

```elixir
@spec filter_by_type([struct()], module()) :: [struct()]
```

Filters entities by struct type.

# `find_entity`

```elixir
@spec find_entity(Spark.Dsl.t(), [atom()], module()) :: struct() | nil
```

Finds a single entity of the given type at the specified path.

# `get_domain_config`

```elixir
@spec get_domain_config(module()) :: map() | nil
```

Gets the full domain config for a resource module.

# `get_entities`

```elixir
@spec get_entities(Spark.Dsl.t(), [atom()]) :: [struct()]
```

Gets entities from the DSL state at the given path, always returning a list.

# `get_opt`

```elixir
@spec get_opt(Spark.Dsl.t(), [atom()], atom(), term()) :: term()
```

Gets an option from the DSL state at the given path.

# `has_extension?`

```elixir
@spec has_extension?(module(), module()) :: boolean()
```

Checks if a module has a specific Spark extension.

# `safe_domain`

```elixir
@spec safe_domain(module()) :: {:ok, module()} | :error
```

Safely gets the domain module for a resource.

# `safe_domain_config`

```elixir
@spec safe_domain_config(module()) :: map() | nil
```

Safely gets the MishkaGervaz domain config from a domain module.

# `set_opt`

```elixir
@spec set_opt(Spark.Dsl.t(), [atom()], atom(), term()) :: Spark.Dsl.t()
```

Sets an option in the DSL state at the given path.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
