///
import vm from 'vm';
import { LRUCache } from 'lru-cache';
import { FileContent, SchemaFileRepository } from '@cubejs-backend/shared';
import { NativeInstance, PythonCtx } from '@cubejs-backend/native';
import { ErrorReporter, ErrorReporterOptions } from './ErrorReporter';
import { CubeSymbols } from './CubeSymbols';
import { ViewCompilationGate } from './ViewCompilationGate';
import { TranspilerInterface } from './transpilers';
import { CompilerInterface } from './PrepareCompiler';
import { YamlCompiler } from './YamlCompiler';
import { CubeDictionary } from './CubeDictionary';
import { CompilerCache } from './CompilerCache';
export type DataSchemaCompilerOptions = {
compilerCache: CompilerCache;
omitErrors?: boolean;
extensions?: Record;
filesToCompile?: string[];
nativeInstance: NativeInstance;
cubeFactory: Function;
cubeDictionary: CubeDictionary;
cubeOnlySymbols: CubeSymbols;
cubeAndViewSymbols: CubeSymbols;
cubeCompilers?: CompilerInterface[];
contextCompilers?: CompilerInterface[];
viewGroupCompilers?: CompilerInterface[];
metaCompilers?: CompilerInterface[];
transpilers?: TranspilerInterface[];
viewCompilers?: CompilerInterface[];
viewCompilationGate: ViewCompilationGate;
cubeNameCompilers?: CompilerInterface[];
preTranspileCubeCompilers?: CompilerInterface[];
yamlCompiler: YamlCompiler;
errorReport?: ErrorReporterOptions;
compilerId?: string;
standalone?: boolean;
compileContext?: any;
allowNodeRequire?: boolean;
compiledScriptCache: LRUCache;
compiledYamlCache: LRUCache;
compiledJinjaCache: LRUCache;
};
export type TranspileOptions = {
cubeNames?: string[];
cubeSymbols?: Record>;
contextSymbols?: Record;
transpilerNames?: string[];
compilerId?: string;
stage?: 0 | 1 | 2 | 3;
jinjaUsed?: boolean;
jinjaMacrosFingerprint?: string;
};
export type CompileStage = 0 | 1 | 2 | 3;
export type CompileContext = any;
export declare class DataSchemaCompiler {
private readonly repository;
private readonly cubeCompilers;
private readonly contextCompilers;
private readonly viewGroupCompilers;
private readonly metaCompilers;
private readonly transpilers;
private readonly viewCompilers;
private readonly preTranspileCubeCompilers;
private readonly viewCompilationGate;
private readonly cubeNameCompilers;
private readonly extensions;
private readonly cubeDictionary;
private readonly cubeOnlySymbols;
private readonly cubeAndViewSymbols;
private readonly cubeFactory;
private readonly filesToCompile;
private readonly omitErrors;
private readonly allowNodeRequire;
private readonly compilerCache;
private readonly compileContext;
private errorReportOptions;
private errorsReporter;
private readonly standalone;
private readonly nativeInstance;
private readonly yamlCompiler;
private pythonContext;
private workerPool;
private readonly compilerId;
private readonly compiledScriptCache;
private readonly compiledYamlCache;
private readonly compiledJinjaCache;
private compileV8ContextCache;
compilePromise: any;
private currentQuery;
constructor(repository: SchemaFileRepository, options: DataSchemaCompilerOptions);
compileObjects(compileServices: CompilerInterface[], objects: any, errorsReport: ErrorReporter): Promise;
protected loadPythonContext(files: FileContent[], nsFileName: string): Promise;
protected doCompile(): Promise;
compile(): any;
private loadJinjaTemplates;
/**
* Macro files are hidden dependencies of any cube file that imports them —
* minijinja resolves `{% import %}` lazily against its template store, so
* the per-file Jinja render cache must be invalidated when *any* macro file
* changes. Hashing all macro files together rather than tracking per-cube
* imports keeps the implementation simple at the cost of over-invalidating
* when macro edits happen (which is rare). CUB-2357.
*/
private static computeJinjaMacrosFingerprint;
private prepareTranspileSymbols;
private transpileFile;
private transpileJsFilesNativeBulk;
private transpileYamlFilesNativeBulk;
private transpileJsFile;
private transpileYamlFile;
private transpileJinjaFile;
withQuery(query: any, fn: any): any;
contextQuery(): any;
private compileCubeFiles;
throwIfAnyErrors(): void;
private compileFile;
private getJsScript;
compileJsFile(file: FileContent, errorsReport: ErrorReporter, { doSyntaxCheck }?: {
doSyntaxCheck: boolean;
}): void;
private cloneCompileContextWithGetterAlias;
private standaloneCompileContextProxy;
private resolveModuleFile;
private readModuleFile;
private isWhiteListedPackage;
}
//# sourceMappingURL=DataSchemaCompiler.d.ts.map