@bufbuild/cel
Version:
A CEL evaluator for ECMAScript
31 lines (30 loc) • 938 B
TypeScript
import type { Registry } from "@bufbuild/protobuf";
import type { Interpretable } from "./planner.js";
/**
* Context available in the evaluation phase.
*/
export interface EvalContext {
/**
* The protobuf registry.
*/
readonly registry: Registry;
}
/**
* Sets the EvalContext for the current execution scope.
*/
export declare function setEvalContext(context: EvalContext): () => EvalContext | undefined;
/**
* Gets the current EvalContext.
*
* Throws an error if there isn't one.
*/
export declare function getEvalContext(): EvalContext;
/**
* Returns an Interpretable that sets the context for the given call.
*/
export declare function withEvalContext(context: EvalContext, next: Interpretable): Interpretable;
/**
* Returns a message descriptor with the matching type name
* from the evaluation context.
*/
export declare function getMsgDesc(typeName: string): import("@bufbuild/protobuf").DescMessage;