UNPKG

@bufbuild/cel

Version:

A CEL evaluator for ECMAScript

39 lines (38 loc) 1.62 kB
import { type ReflectMap } from "@bufbuild/protobuf/reflect"; import { type CelUint } from "./uint.js"; import type { CelInput, CelValue } from "./type.js"; declare const privateSymbol: unique symbol; /** * A common abstraction for maps. */ export interface CelMap extends ReadonlyMap<bigint | string | boolean | CelUint, CelValue> { [privateSymbol]: unknown; /** * Retrieves the item associated with the specified key, or undefined. * * Maps never contain entries with a double key, but they support access to int or uint keys with int, uint, or double values. * * See https://github.com/google/cel-spec/blob/v0.24.0/doc/langdef.md#numbers * See https://github.com/google/cel-spec/wiki/proposal-210 */ get(key: bigint | string | boolean | CelUint | number): CelValue | undefined; /** * Indicates if the map has the specified key. * * Maps never contain entries with a double key, but they support access to int or uint keys with int, uint, or double values. * * See https://github.com/google/cel-spec/blob/v0.24.0/doc/langdef.md#numbers * See https://github.com/google/cel-spec/wiki/proposal-210 */ has(key: bigint | string | boolean | CelUint | number): boolean; } /** * Create a new map from a native map or a ReflectMap. */ export declare function celMap(mapOrReflectMap: ReadonlyMap<bigint | string | boolean | CelUint, CelInput> | ReflectMap): CelMap; /** * Returns true if the given value is a CelMap. */ export declare function isCelMap(v: unknown): v is CelMap; export declare const EMPTY_MAP: CelMap; export {};