import { QueryResultValidator } from '../../query-tree'; export declare class JSCodeBuildingContext { private boundValues; private variableBindings; private preExecInjectedVariablesMap; private nextIndexPerLabel; indentationLevel: number; private static getBoundValueName; private static DEFAULT_LABEL; private static getSafeLabel; private static getVarName; bindValue(value: any): string; getOrAddVariable(token: JSVariable): string; getBoundValueMap(): { [name: string]: unknown; }; getPreExecInjectedVariablesMap(): Map; } export declare abstract class JSFragment { toString(): string; toColoredString(): string; getCode(): { code: string; boundValues: { [name: string]: unknown; }; usedResultVariables: Map; }; isEmpty(): boolean; abstract toStringWithContext(context: JSCodeBuildingContext): string; abstract toColoredStringWithContext(context: JSCodeBuildingContext): string; abstract getCodeWithContext(context: JSCodeBuildingContext): string; } export declare class JSCodeFragment extends JSFragment { readonly JS: string; constructor(JS: string); isEmpty(): boolean; toStringWithContext(context: JSCodeBuildingContext): string; toColoredStringWithContext(context: JSCodeBuildingContext): string; getCodeWithContext(context: JSCodeBuildingContext): string; } export declare class JSVariable extends JSFragment { readonly label?: string | undefined; constructor(label?: string | undefined); getCodeWithContext(context: JSCodeBuildingContext): string; toStringWithContext(context: JSCodeBuildingContext): string; toColoredStringWithContext(context: JSCodeBuildingContext): string; } export declare class JSQueryResultVariable extends JSVariable { getCodeWithContext(context: JSCodeBuildingContext): string; } export declare class JSBoundValue extends JSFragment { readonly value: any; constructor(value: any); toStringWithContext(context: JSCodeBuildingContext): string; toColoredStringWithContext(): string; getCodeWithContext(context: JSCodeBuildingContext): string; } export declare class JSCompoundFragment extends JSFragment { readonly fragments: ReadonlyArray; constructor(fragments: ReadonlyArray); isEmpty(): boolean; toStringWithContext(context: JSCodeBuildingContext): string; toColoredStringWithContext(context: JSCodeBuildingContext): string; getCodeWithContext(context: JSCodeBuildingContext): string; } export declare class JSIndentationFragment extends JSFragment { readonly fragment: JSFragment; constructor(fragment: JSFragment); isEmpty(): boolean; toStringWithContext(context: JSCodeBuildingContext): string; toColoredStringWithContext(context: JSCodeBuildingContext): string; getCodeWithContext(context: JSCodeBuildingContext): string; } export declare function js(strings: ReadonlyArray, ...values: (JSFragment | string | number | boolean)[]): JSFragment; export declare namespace js { function join(fragments: ReadonlyArray, separator: JSFragment): JSFragment; function code(code: string): JSFragment; function lines(...fragments: ReadonlyArray): JSFragment; function indent(fragment: JSFragment): JSIndentationFragment; function variable(label?: string): JSFragment; function value(value: any): JSBoundValue; function queryResultVariable(label?: string): JSQueryResultVariable; function collection(name: string): JSFragment; function identifier(name: string): JSFragment; /** * Should be used when fairly certain that string can't be malicious * * As the string is json-encoded, it *should* be fine in any case, but still, user-supplied strings in queries are scary */ function string(str: string): JSFragment; function integer(number: number): JSFragment; function isSafeIdentifier(str: string): false | RegExpMatchArray | null; } /** * A node in an JS transaction tree * * This is an intermediate representation in the process of converting a query tree to an JS transaction. The * transaction tree's root is the root query. Children of a transaction node are the direct preExec queries of a query. * Thus, the query tree is reduced to WithPreExecQueryNodes as nodes, all other kinds of nodes are already processed * into JSFragments. */ export declare class JSCompoundQuery extends JSFragment { readonly preExecQueries: ReadonlyArray; readonly jsQuery: JSFragment; readonly resultVar: JSQueryResultVariable | undefined; readonly resultValidator: QueryResultValidator | undefined; constructor(preExecQueries: ReadonlyArray, jsQuery: JSFragment, resultVar: JSQueryResultVariable | undefined, resultValidator: QueryResultValidator | undefined); /** * Gets the linear JS transaction for this transaction tree * * The returned transaction steps are to be executed sequentially. */ getExecutableQueries(): ReadonlyArray; private getExecutableQueriesRecursive; toStringWithContext(context: JSCodeBuildingContext): string; toColoredStringWithContext(context: JSCodeBuildingContext): string; getCodeWithContext(context: JSCodeBuildingContext): string; } /** * A step in an JS transaction */ export declare class JSExecutableQuery { readonly code: string; readonly boundValues: { [p: string]: any; }; readonly usedPreExecResultNames: { [p: string]: string; }; readonly resultName?: string | undefined; readonly resultValidator?: { [name: string]: any; } | undefined; constructor(code: string, boundValues: { [p: string]: any; }, usedPreExecResultNames: { [p: string]: string; }, resultName?: string | undefined, resultValidator?: { [name: string]: any; } | undefined); }