@samatawy/rules
    Preparing search index...

    Class FunctionRegistry

    FunctionRegistry is responsible for storing and managing function definitions within the working context. It allows adding, retrieving, and checking for the existence of function definitions. This registry is used during rule evaluation to resolve function calls and validate their usage against defined function signatures.

    Index

    Constructors

    Properties

    options: Partial<WorkspaceOptions>

    Methods

    • Check if a function with the given name exists in the registry.

      Parameters

      • name: string

        The name of the function to check.

      Returns boolean

      True if the function exists, false otherwise.

    • Retrieve all function definitions that have a specific annotation and optional value.

      Parameters

      • annotation: string

        The annotation to filter functions by.

      • Optionalvalue: any

        The optional value of the annotation to match.

      Returns Record<string, FunctionDefinition>

      A record of function definitions that match the annotation and value, keyed by their names.

    • Perform type checking on all function definitions in the registry using the provided type checker. This method iterates through each function definition, checks its types against the type checker, and returns an array of validation results.

      N.B. Disabled functions are skipped during type checking, as they are not intended to be used in rule evaluation and may contain incomplete or invalid definitions.

      Parameters

      • checker: TypeChecker

        The type checker to use for validating function definitions.

      Returns ValidationResult[]

      An array of validation results for each function definition.