@samatawy/rules
    Preparing search index...

    Interface FunctionDefinition

    Definition of a custom function that can be used in rules and expressions.

    interface FunctionDefinition {
        name: string;
        hint?: string;
        annotations?: Annotations;
        disabled?: boolean;
        parameters: NamedParameter[];
        lines?: ExecutableAction[];
        expression: Expression;
    }
    Index

    Properties

    name: string

    The name of the function, which is used to identify it in expressions and function calls. This should be unique across all defined functions in a workspace to avoid conflicts.

    hint?: string

    An optional hint or description for the function, which can provide additional information about its purpose or usage. This is primarily for documentation and user guidance when working with the function in rules and expressions.

    annotations?: Annotations

    Optional annotations for the function, which can include any additional metadata or information that may be relevant for the function's behavior, usage, or categorization. Annotations can be used to provide extra context or instructions for how the function should be used or interpreted in rules and expressions.

    disabled?: boolean

    Indicates whether the function is disabled. Disabled functions are not executable and cannot be called in rules or expressions. This allows users to define functions that are still being developed or debugged without causing execution failures in the workspace.

    parameters: NamedParameter[]

    The expected parameters for the function, defined as an array of named parameters. Each parameter includes its expected type and whether it is optional. This is used for type checking and validation of function arguments when the function is called in rules and expressions. Functions that expect a parameter array (e.g., sum, avg, concat) can indicate this in their definition and will have their parameters validated accordingly. For functions that expect a parameter array, the parameters defined here represent the expected type of each element in the array. For example, a function that expects an array of numbers would have a single parameter with type 'number' and expectsParameterArray() returning true.

    If defined in a block, the lines of the function represent the sequence of executable actions that define the function's behavior. This allows for complex function definitions that involve multiple steps and operations, rather than just a single expression.

    expression: Expression

    The return expression of the function, which defines how the return value is computed based on the input parameters. This can be the body of the function or the last line if defined in a block.