import { celFunc as bufCelFunc, celMethod as bufCelMethod, run as bufCelRun, CelScalar, isCelError, isCelList, isCelMap, isCelUint, listType, objectType, type CelFunc as CelFuncType, type CelInput, type CelValue } from '@bufbuild/cel'; import { strings as stringsExt } from '@bufbuild/cel/ext'; import { timestampDate, timestampFromDate, timestampMs, timestampNow, TimestampSchema } from '@bufbuild/protobuf/wkt'; import type { SignalBindingJson } from '../proto/index.js'; /** Evaluate with own-property JSON records, retaining Buf CEL's error contract. */ declare const celRun: typeof bufCelRun; declare const celFunc: typeof bufCelFunc; declare const celMethod: typeof bufCelMethod; /** Convert a JSON value matching a JTD schema into CEL input values. */ export declare function jtdJsonToCelInput(value: unknown, input: unknown): unknown; /** Generate a JSON/JTD sample and convert it for CEL evaluation. */ export declare function fuzzJTDForCel(input: unknown): CelInput; /** * Format a timestamp using a pattern string. * * Supported patterns: * - YYYY - 4-digit year * - YY - 2-digit year * - MM - month (01-12) * - DD - day (01-31) * - HH - hours (00-23) * - mm - minutes (00-59) * - ss - seconds (00-59) */ export declare function formatDateWithPattern(timestamp: Date, pattern: string): string; /** Union of all custom CelFunc definitions across all plugins. */ export declare const CUSTOM_FUNCS: CelFuncType[]; /** Ready-to-use options: strings extension + all custom funcs. */ export declare const celOptions: { funcs: CelFuncType[]; }; /** Convert CEL types to native JS (CelList→array, CelMap→object, bigint→number). */ export declare function celToNative(value: CelValue): unknown; export type { CelFuncType, CelInput, CelValue }; export { celRun, isCelError, celFunc, celMethod, CelScalar, objectType, listType, isCelList, isCelMap, isCelUint }; export { stringsExt, timestampDate, timestampFromDate, timestampMs, timestampNow, TimestampSchema }; export { fuzzJTD } from '../signals/index.js'; export interface CelVariable { name: string; schema: unknown; optional?: boolean; } export interface AccessPath { variableName: string; path: string[]; fullPath: string; } export interface OptionalityInfo { segmentIndex: number; propertyName: string; isSignalOptional: boolean; } export interface ValidationError { message: string; path?: string; isOptionalAccess?: boolean; } export type ValidationResult = { valid: true; } | { valid: false; errors: ValidationError[]; }; /** * Extract all access paths for known variables from a CEL expression. * Handles both dot notation (var.a.b) and bracket notation (var["a"]). */ export declare function extractAccessPaths(expression: string, variableNames: string[]): AccessPath[]; /** Find which segments in the path are optional according to the schema. */ export declare function findOptionalSegments(path: string[], input: unknown, isSignalOptional: boolean): OptionalityInfo[]; /** Generate test permutations for validating optional property access. */ export declare function generateTestPermutations(variables: CelVariable[], accessedPaths: AccessPath[]): { bindings: Record; description: string; unsetPath?: string; }[]; /** * Evaluate a CEL expression with given bindings and return the result. * Generic version — callers provide their own binding context. */ export declare function evaluateExpression(expression: string, bindings: Record): { result: unknown; error?: never; } | { result?: never; error: string; }; /** * Validate a CEL expression with exhaustive testing of optional properties. * Each CelVariable becomes a top-level binding in the CEL environment. */ export declare function validateCelExpression(expression: string, variables: CelVariable[]): ValidationResult; /** Quick validation that only checks syntax, without optional property testing. */ export declare function validateCelExpressionSyntax(expression: string, variables: CelVariable[]): ValidationResult; export declare const CEL_LANGUAGE_ID = "cel"; export interface FuncDescriptor { name: string; detail: string; documentation: string; params: string[]; } export interface MethodDescriptor extends FuncDescriptor { receiverType: string; } /** All global function descriptors (union of all plugins). */ export declare const GLOBAL_FUNCTIONS: FuncDescriptor[]; /** All method descriptors (deduplicated union of all plugins). */ export declare const CEL_METHODS: MethodDescriptor[]; /** Lookup table: function name → descriptors (for hover/signature help). */ export declare const CEL_DESCRIPTORS: Map; export interface InputVariable { name: string; label?: string; schema?: unknown; } /** Update the available input variables for Monaco autocompletion. */ export declare function setInputVariables(inputs: InputVariable[]): void; /** * Register CEL language with Monaco editor. * Takes a monaco instance as parameter — no monaco import needed. */ export declare function registerCelLanguage(monaco: any): void; export interface CelPropertyNode { detail: string; children: Record; } export type CelSymbolTree = Record; /** Build symbol tree from signal bindings (JTD schemas → property tree). */ export declare function generateCelSymbolTree(bindings: SignalBindingJson[]): CelSymbolTree; /** Build symbol tree from translation dictionaries. */ export declare function generateTranslationsSymbolTree(translations: Record>): CelPropertyNode; /** Dot-path parsing for inputs.* and t.* */ export declare function parseDotPath(textBefore: string): string[] | null; /** Resolve a node in the symbol tree by walking segments. */ export declare function resolveNode(tree: CelSymbolTree, segments: string[], tNode?: CelPropertyNode): CelPropertyNode | null; export interface LambdaBinding { varName: string; collectionSegments: string[]; } /** * Extract lambda variable bindings from CEL macro calls in the text. * e.g. `inputs.items.map(item, ...)` → [{ varName: "item", collectionSegments: ["inputs", "items"] }] */ export declare function extractLambdaBindings(text: string): LambdaBinding[]; /** Parse any trailing dot-path from text (not restricted to inputs.*). */ export declare function parseGeneralDotPath(textBefore: string): string[] | null; /** Resolve a dot-path that may start with a lambda variable. */ export declare function resolveWithLambdas(tree: CelSymbolTree, segments: string[], lambdaBindings: LambdaBinding[], tNode?: CelPropertyNode): CelPropertyNode | null; /** Extract the full dot-chain path containing the hovered word. */ export declare function extractHoverSegments(lineText: string, wordStartCol: number, word: string): string[]; //# sourceMappingURL=index.d.ts.map