import { VariableValue } from '@perses-dev/spec'; /** * Option for a variable with label and value */ export type VariableOption = { label: string; value: string; }; /** * State of a variable including its current value, options, and loading state */ export type VariableState = { value: VariableValue; options?: VariableOption[]; loading: boolean; error?: Error; /** * If a local variable is overriding an external variable, local var will have the flag ``overriding=true``. */ overriding?: boolean; /** * If a local variable is overriding an external variable, external var will have the flag ``overridden=true``. */ overridden?: boolean; defaultValue?: VariableValue; }; /** * Map of variable names to their states */ export type VariableStateMap = Record; /** * Supported interpolation formats for variable values */ export declare enum InterpolationFormat { CSV = "csv", DISTRIBUTED = "distributed", DOUBLEQUOTE = "doublequote", GLOB = "glob", JSON = "json", LUCENE = "lucene", PERCENTENCODE = "percentencode", PIPE = "pipe", PROMETHEUS = "prometheus", RAW = "raw", REGEX = "regex", SINGLEQUOTE = "singlequote", SQLSTRING = "sqlstring", TEXT = "text", QUERYPARAM = "queryparam" } /** * Interpolate an array of values with a specific format */ export declare function interpolate(values: string[], name: string, format: InterpolationFormat): string; /** * Replace a single variable in text with its value */ export declare function replaceVariable(text: string, varName: string, variableValue: VariableValue, varFormat?: InterpolationFormat): string; /** * Returns a list of variables */ export declare function parseVariables(text: string): string[]; /** * Returns a map of variable names and its format. If no format is specified, it will be undefined. */ export declare function parseVariablesAndFormat(text: string): Map; /** * Replace all variables in text with their values from the variable state map */ export declare function replaceVariables(text: string, variableState: VariableStateMap): string; //# sourceMappingURL=variable-interpolation.d.ts.map