kibana/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastfunctionbuilder.md
2020-09-30 09:10:28 +02:00

3.5 KiB

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

ExpressionAstFunctionBuilder interface

Signature:

export interface ExpressionAstFunctionBuilder<FnDef extends AnyExpressionFunctionDefinition = AnyExpressionFunctionDefinition> 

Properties

Property Type Description
addArgument <A extends FunctionArgName<FnDef>>(name: A, value: FunctionArgs<FnDef>[A] | ExpressionAstExpressionBuilder) => this Adds an additional argument to the function. For multi-args, this should be called once for each new arg. Note that TS will not enforce whether multi-args are available, so only use this to update an existing arg if you are certain it is a multi-arg.
arguments FunctionBuilderArguments<FnDef> Object of all args currently added to the function. This is structured similarly to ExpressionAstFunction['arguments'], however any subexpressions are returned as expression builder instances instead of expression ASTs.
getArgument <A extends FunctionArgName<FnDef>>(name: A) => Array<FunctionArgs<FnDef>[A] | ExpressionAstExpressionBuilder> | undefined Retrieves an existing argument by name. Useful when you want to retrieve the current array of args and add something to it before calling replaceArgument. Any subexpression arguments will be returned as expression builder instances.
name InferFunctionDefinition<FnDef>['name'] Name of this expression function.
removeArgument <A extends OptionalKeys<FunctionArgs<FnDef>>>(name: A) => this Removes an (optional) argument from the function.TypeScript will enforce that you only remove optional arguments. For manipulating required args, use replaceArgument.
replaceArgument <A extends FunctionArgName<FnDef>>(name: A, value: Array<FunctionArgs<FnDef>[A] | ExpressionAstExpressionBuilder>) => this Overwrites an existing argument with a new value. In order to support multi-args, the value given must always be an array.
toAst () => ExpressionAstFunction Converts function to an AST. ExpressionAstFunction
toString () => string Converts function to an expression string. string
type 'expression_function_builder' Used to identify expression function builder objects.