@agentix-e/spel-ts - v1.2.2
    Preparing search index...

    Interface SpelEvaluator

    SpelEvaluator — abstract interface for SpEL parsing and validation.

    Defined in spel-ts as the canonical source of truth. Consumers (nl2spel, spel-editor, CLI tools) program against this interface without depending on any specific implementation.

    spel-ts provides a built-in implementation: SpelEvaluatorAdapter.

    interface SpelEvaluator {
        evaluate?(expression: string, context: Record<string, unknown>): unknown;
        extractReferences?(expression: string): SpelReference[];
        format?(expression: string, options?: FormatOptions): string;
        getCompletions?(
            expression: string,
            position: number,
            contextSchema?: ContextSchema,
        ): CompletionItem[];
        getContextSchema(): ContextSchema | Promise<ContextSchema | null> | null;
        parse(expression: string): ParseResult | Promise<ParseResult>;
        validateContext?(
            expression: string,
            contextSchema: ContextSchema,
        ): ContextValidationResult;
    }

    Implemented by

    Index
    • Evaluate an expression with given runtime context. Optional — used for semantic validation and test evaluation.

      Parameters

      • expression: string
      • context: Record<string, unknown>

      Returns unknown

    • Extract all structured references from an expression (variables, root properties, beans, types, functions). Returns references even for syntactically invalid expressions via heuristic fallback.

      Parameters

      • expression: string

      Returns SpelReference[]

    • Get completion suggestions at a given cursor position. Returns context-aware suggestions when contextSchema is provided, otherwise returns static keyword/operator completions.

      Parameters

      • expression: string
      • position: number
      • OptionalcontextSchema: ContextSchema

      Returns CompletionItem[]