import { Bento } from '../../Bento'; import { VariableSource } from '../../interfaces'; export declare class VariableManager { private readonly bento; private readonly variables; private readonly validators; private readonly sources; constructor(bento: Bento); /** * Check if a given variable exists * @param name name of variable * * @returns boolean */ hasVariable(name: string): boolean; /** * Fetch a value for a given variable name * @param name name of variable * @param def default value * * @returns variable value */ getVariable(name: string, def?: T): T; /** * Get Key/Value Object of all variables * * @returns Object of Key/Value pairs */ getVariables(): { [key: string]: any; }; /** * Update a given variables value * @param name name of variable * @param value new value * @param source specify variable source (optional) */ setVariable(name: string, value: T, source?: VariableSource): void; /** * Fully removes all traces of a variable from bento * @param name name of variable */ deleteVariable(name: string): void; /** * Checks if a given variable source exists * @param name Variable name * * @returns boolean */ hasSource(name: string): boolean; /** * Fetches a variable source for a given variable name * @param name Variable name * * @returns variable source */ getSource(name: string): VariableSource; /** * Sets source information for a given variable name * @param name Variable name * @param source VariableSource */ setSource(name: string, source: VariableSource): void; /** * Remove source information for a given variable name * @param name Variable name */ private deleteSource; /** * Add a new validator into Bento * @param name validator name * @param validator validator function */ addValidator(name: string, validator: (value: any, ...args: Array) => boolean): void; /** * Remove validator from Bento * @param name validator name */ removeValidator(name: string): void; /** * Run a validator * @param name validator name * @param value validator value * @param args array of args to be passed * * @returns validator result */ runValidator(name: string, value: any, ...args: Array): boolean; }