kibana/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinition.md

2.9 KiB

Home > kibana-plugin-plugins-expressions-server > ExpressionFunctionDefinition

ExpressionFunctionDefinition interface

ExpressionFunctionDefinition is the interface plugins have to implement to register a function in expressions plugin.

Signature:

export interface ExpressionFunctionDefinition<Name extends string, Input, Arguments extends Record<string, any>, Output, Context extends ExecutionContext = ExecutionContext> extends PersistableStateDefinition<ExpressionAstFunction['arguments']> 

Properties

Property Type Description
aliases string[] What is this?
args {
[key in keyof Arguments]: ArgumentType<Arguments[key]>;
}
Specification of arguments that function supports. This list will also be used for autocomplete functionality when your function is being edited.
context {
types: AnyExpressionFunctionDefinition['inputTypes'];
}
disabled boolean if set to true function will be disabled (but its migrate function will still be available)
help string Help text displayed in the Expression editor. This text should be internationalized.
inputTypes Array<TypeToString<Input>> List of allowed type names for input value of this function. If this property is set the input of function will be cast to the first possible type in this list. If this property is missing the input will be provided to the function as-is.
name Name The name of the function, as will be used in expression.
type TypeToString<UnwrapPromiseOrReturn<Output>> Name of type of value this function outputs.

Methods

Method Description
fn(input, args, context) The actual implementation of the function.