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.
Summary
Functions
Checks if any value in the list is not nil.
Returns the default if value is nil, otherwise returns the value.
Extracts a nested entity from a list or single value. Spark stores nested entities as lists.
Filters entities by struct type.
Finds a single entity of the given type at the specified path.
Gets the full domain config for a resource module.
Gets entities from the DSL state at the given path, always returning a list.
Gets an option from the DSL state at the given path.
Checks if a module has a specific Spark extension.
Safely gets the domain module for a resource.
Safely gets the MishkaGervaz domain config from a domain module.
Sets an option in the DSL state at the given path.
Functions
Checks if any value in the list is not nil.
Returns the default if value is nil, otherwise returns the value.
Extracts a nested entity from a list or single value. Spark stores nested entities as lists.
Filters entities by struct type.
@spec find_entity(Spark.Dsl.t(), [atom()], module()) :: struct() | nil
Finds a single entity of the given type at the specified path.
Gets the full domain config for a resource module.
@spec get_entities(Spark.Dsl.t(), [atom()]) :: [struct()]
Gets entities from the DSL state at the given path, always returning a list.
@spec get_opt(Spark.Dsl.t(), [atom()], atom(), term()) :: term()
Gets an option from the DSL state at the given path.
Checks if a module has a specific Spark extension.
Safely gets the domain module for a resource.
Safely gets the MishkaGervaz domain config from a domain module.
@spec set_opt(Spark.Dsl.t(), [atom()], atom(), term()) :: Spark.Dsl.t()
Sets an option in the DSL state at the given path.