import { DataFrame } from './DataFrame'; import { Expr, LiteralSymbol, OptionsStanza } from './AST'; import { DataPrimitive, DataType } from './DataPrimitive'; import { IDimension } from './Dimensions'; import { OptionScopes } from './OptionScopes'; /** * An interface for abstracting data sources as map of DataFrames */ export interface Frames { [dataSourceType: string]: DataFrame; } /** * Class with static methods used to execute DSL expressions */ export default class EncodingExecutor { executeOptions(optionsStanza: OptionsStanza, frames: Frames, themeFunc?: (themeKey: any) => any, bypassCloneDeepOptionScope?: boolean): Record; /** * o is what we are evaluating. If it is an array or an object that its parts are recursively * evaluated. Any DSL expressions encountered are evaluated. The scopes object is uses by the * DSL expression to resolve any identifiers. The scope object's 'local' scope is updated by * pushLocalScope as the eval method moves through the tree. The path array for a path "context.a.b.c" * will be ['context', 'a', 'b','c']. As eval moves through the tree, the scopes add the current * path its visited list. If the current path is found in the visited list, then a circular reference * error is thrown. * current 'path' in the * @param o * @param {OptionScopes} scopes * @param {string[]} path * @returns {any} */ eval(o: any, scopes: OptionScopes, path?: string[]): any; evalDsl(dsl: string, scopes: OptionScopes): IDimension; /** * Takes anything that can have DSL embedded in it, such as tree or array, and insures * that all DataPrimitive have been converted to their 'raw' equivalents * @param {object} o * @returns {any} */ static rawTree(o: Record): any; /** * Executes sequence of pipe delimited expressions that constitute a DSL * @param {Expr[]} pipeline * @param {OptionScopes} scopes * @param {DataPrimitive} origin * @param {ExecutedOptions} executedOptions * @returns {{location: string; val: Option | DataPrimitive}} */ execOptionsPipeline(pipeline: Expr[], scopes: OptionScopes, origin: DataPrimitive): IDimension; /** * Methods are either selector methods that built-ins such as * 'selectSeriesByPosition(...)",or they are formatter calls like 'rangeValue(...)' * @param {Method} expr * @param {DataPrimitive} subject * @param {Scopes} scopes * @param {string} metaName * @returns {DataPrimitive} */ private executeMethod; /** * Applies the Formatter to either metaData or value * @param {DataPrimitive} subject * @param {string} funcName * @param {ResolvedValue[]} args * @param {string} metaName */ private applyFormatter; /** * Sometimes when invoking a pipeline we may find degenerate pipelines like * '42' that simply set the metadata to a literal. Or, we may perhaps in * a value pipeline, we set the value to 'hello' after w perform selection * like "selectByPosition(0)|'hello'" * @param {DataPrimitive} subject * @param {LiteralSymbol} symbol */ applyLiteral(subject: DataPrimitive, symbol: LiteralSymbol): void; /** * reduces method call arguments (ParserSymbols) to actual values * @param {ParserSymbol[]} args * @param {Scopes} scopes * @returns {any[]} */ private args; /** * Returns either the literal value from the symbol, or a value from context. * Throws error if identifier not found in context. * @param {ParserSymbol} s * @param {object} context * @returns {any} */ private getArg; /** * Simple method to tell if the argument is an object or primitive. * @param opt * @returns {boolean} */ static isObject(opt: any): boolean; }