@bufbuild/cel
Version:
A CEL evaluator for ECMAScript
49 lines (48 loc) • 1.52 kB
TypeScript
import { type ReflectList } from "@bufbuild/protobuf/reflect";
import type { CelInput, CelValue } from "./type.js";
declare const privateSymbol: unique symbol;
/**
* List is common abstraction for lists.
*/
export interface CelList extends Iterable<CelValue> {
/**
* The size of the list.
*/
readonly size: number;
/**
* Retrieves the item at the specified index, or undefined if the index
* is out of range.
*/
get(index: number): CelValue | undefined;
[Symbol.iterator](): IterableIterator<CelValue>;
values(): IterableIterator<CelValue>;
/**
* To prevent external implementations.
*/
[privateSymbol]: unknown;
}
/**
* Create a new list from a native array or a ReflectList.
*/
export declare function celList(arrayOrReflectList: readonly CelInput[] | ReflectList): CelList;
/**
* Returns a new List that has all the elements
* of the lists in order.
*/
export declare function celListConcat(...lists: CelList[]): ConcatList;
/**
* Returns true if the given value is a CelList.
*/
export declare function isCelList(v: unknown): v is CelList;
declare class ConcatList implements CelList {
private readonly _lists;
[privateSymbol]: {};
private readonly _size;
constructor(_lists: readonly CelList[]);
get size(): number;
get(index: number): CelValue | undefined;
values(): Generator<CelValue, void, any>;
[Symbol.iterator](): Generator<CelValue, void, any>;
}
export declare const EMPTY_LIST: CelList;
export {};