Allowlisted Elixir functions exposed to FEEL evaluation.
Registries are constructed by trusted application code. FEEL and DMN model text can invoke registered names, but cannot resolve modules, functions, or atoms itself.
Summary
Functions
Adds the external-function registry DSL to a module.
Registers an allowlisted host function in a registry module.
Invokes a registered function after applying its boundary conversions.
Creates a registry, optionally from {name, callable, options} entries.
Adds or replaces one allowlisted function.
Converts a registry value or registry module into a FEEL evaluation context.
Types
@type boundary_type() ::
:feel | :number | :integer | :float | :string | :char | :boolean
@type entry() :: %{ callable: callable(), parameters: [boundary_type() | {:varargs, boundary_type()}], returns: boundary_type() }
Functions
Adds the external-function registry DSL to a module.
use Boxic.FEEL.ExternalFunctions
Registers an allowlisted host function in a registry module.
external "maximum", {MyApp.Math, :maximum},
parameters: [:number, :number],
returns: :number
@spec invoke(t(), String.t(), [term()]) :: {:ok, term()} | {:error, Boxic.FEEL.Error.t()}
Invokes a registered function after applying its boundary conversions.
Boxic.FEEL.ExternalFunctions.invoke(registry, "maximum", [
Decimal.new("1"),
Decimal.new("2")
])
Creates a registry, optionally from {name, callable, options} entries.
Boxic.FEEL.ExternalFunctions.new([
{"maximum", {MyApp.Math, :maximum}, parameters: [:number, :number]}
])
Adds or replaces one allowlisted function.
Boxic.FEEL.ExternalFunctions.register(
registry,
"maximum",
{MyApp.Math, :maximum},
parameters: [:number, :number],
returns: :number
)
Converts a registry value or registry module into a FEEL evaluation context.
context = Boxic.FEEL.ExternalFunctions.to_context(MyApp.DecisionFunctions)