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.
Compatibility adapter that merges a registry into a FEEL 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
)
Compatibility adapter that merges a registry into a FEEL context.
New code should pass external_functions: to Boxic.FEEL.evaluate/3.