import { CacheMode } from '@cubejs-backend/shared'; import { NativeQueryResultRef, ResultWrapper } from './ResultWrapper'; export * from './ResultWrapper'; export interface BaseMeta { protocol: string; apiType: string; appName?: string; } export interface LoadRequestMeta extends BaseMeta { changeUser?: string; } export interface Request { id: string; meta: Meta; } export interface CheckAuthResponse { securityContext: any; } export interface CheckSQLAuthResponse { password: string | null; superuser: boolean; securityContext: any; skipPasswordCheck?: boolean; } export interface ContextToApiScopesPayload { securityContext: any; } export type ContextToApiScopesResponse = string[]; export interface CheckAuthPayloadRequestMeta extends BaseMeta { } export interface CheckAuthPayload { request: Request; token: string; } export interface CheckSQLAuthPayload { request: Request; user: string | null; password: string | null; } export interface SessionContext { user: string | null; superuser: boolean; securityContext: any; } export interface LoadPayload { request: Request; session: SessionContext; query: any; } export interface SqlPayload { request: Request; session: SessionContext; query: any; memberToAlias: Record; expressionParams: string[]; } export interface SqlApiLoadPayload { request: Request; session: SessionContext; query: any; queryKey: any; sqlQuery: any; streaming: boolean; cacheMode: CacheMode; } export interface LogLoadEventPayload { request: Request; session: SessionContext; event: string; properties: any; } export interface MetaPayload { request: Request; session: SessionContext; onlyCompilerId?: boolean; } export interface CanSwitchUserPayload { session: SessionContext; user: string; } export type SQLInterfaceOptions = { pgPort?: number; contextToApiScopes: (payload: ContextToApiScopesPayload) => ContextToApiScopesResponse | Promise; checkAuth: (payload: CheckAuthPayload) => CheckAuthResponse | Promise; checkSqlAuth: (payload: CheckSQLAuthPayload) => CheckSQLAuthResponse | Promise; sql: (payload: SqlPayload) => unknown | Promise; meta: (payload: MetaPayload) => unknown | Promise; stream: (payload: LoadPayload) => unknown | Promise; sqlApiLoad: (payload: SqlApiLoadPayload) => unknown | Promise; logLoadEvent: (payload: LogLoadEventPayload) => unknown | Promise; sqlGenerators: (paramsJson: string) => unknown | Promise; canSwitchUserForSession: (payload: CanSwitchUserPayload) => unknown | Promise; gatewayPort?: number; }; export interface TransformConfig { fileName: string; fileContent: string; transpilers: string[]; compilerId: string; jinjaUsed?: boolean; metaData?: { cubeNames: string[]; cubeSymbols: Record>; contextSymbols: Record; stage: 0 | 1 | 2 | 3; }; } export interface TransformResponse { code: string; errors: string[]; warnings: string[]; } export type DBResponsePrimitive = null | boolean | number | string; export type Sql4SqlOk = { sql: string; values: Array; }; export type Sql4SqlError = { error: string; }; export type Sql4SqlCommon = { query_type: { regular: boolean; post_processing: boolean; pushdown: boolean; }; }; export type Sql4SqlResponse = Sql4SqlCommon & (Sql4SqlOk | Sql4SqlError); export type QueryConvertResponse = { status: string; query: any; error?: string; }; export declare function loadNative(): any; type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace'; export declare const setupLogger: (logger: (extra: any) => unknown, logLevel: LogLevel, prodLogger?: boolean) => void; export declare const resetLogger: (logLevel: LogLevel) => void; export declare const isFallbackBuild: () => boolean; export type SqlInterfaceInstance = { __typename: 'sqlinterfaceinstance'; }; export declare const registerInterface: (options: SQLInterfaceOptions) => Promise; export type ShutdownMode = 'fast' | 'semifast' | 'smart'; export declare const shutdownInterface: (instance: SqlInterfaceInstance, shutdownMode: ShutdownMode) => Promise; export declare const execSql: (instance: SqlInterfaceInstance, sqlQuery: string, stream: any, securityContext?: any, cacheMode?: CacheMode, timezone?: string, throwContinueWait?: boolean, requestId?: string) => Promise; export declare const sql4sql: (instance: SqlInterfaceInstance, sqlQuery: string, disablePostProcessing: boolean, securityContext?: unknown) => Promise; export declare const rest4sql: (instance: SqlInterfaceInstance, sqlQuery: string, securityContext?: unknown) => Promise; export declare const buildSqlAndParams: (cubeEvaluator: any) => any[]; export type ResultRow = Record; export declare const parseCubestoreResultMessage: (message: ArrayBuffer) => Promise; export declare const getCubestoreResult: (ref: NativeQueryResultRef) => ResultRow[]; /** * Transform and prepare single query final result data that is sent to the client. * * @param transformDataObj Data needed to transform raw query results * @param rows Raw data received from the source DB via driver or reference to a native CubeStore response result * @param resultData Final query result structure without actual data * @return {Promise} ArrayBuffer with json-serialized data which should be directly sent to the client */ export declare const getFinalQueryResult: (transformDataObj: Object, rows: any, resultData: Object) => Promise; /** * Transform and prepare multiple query final results data into a single response structure. * * @param transformDataArr Array of data needed to transform raw query results * @param rows Array of raw data received from the source DB via driver or reference to native CubeStore response results * @param responseData Final combined query result structure without actual data * @return {Promise} ArrayBuffer with json-serialized data which should be directly sent to the client */ export declare const getFinalQueryResultMulti: (transformDataArr: Object[], rows: any[], responseData: Object) => Promise; export declare const transpileJs: (transpileRequests: TransformConfig[]) => Promise; export declare const transpileYaml: (transpileRequests: TransformConfig[]) => Promise; export interface PyConfiguration { repositoryFactory?: (ctx: unknown) => Promise; logger?: (msg: string, params: Record) => void; checkAuth?: (req: unknown, authorization: string) => Promise<{ 'security_context'?: unknown; }>; extendContext?: (req: unknown) => Promise; queryRewrite?: (query: unknown, ctx: unknown) => Promise; contextToApiScopes?: () => Promise; scheduledRefreshContexts?: (ctx: unknown) => Promise; scheduledRefreshTimeZones?: (ctx: unknown) => Promise; contextToRoles?: (ctx: unknown) => Promise; contextToGroups?: (ctx: unknown) => Promise; } export declare const pythonLoadConfig: (content: string, options: { fileName: string; }) => Promise; export type PythonCtx = { __type: 'PythonCtx'; } & { filters: Record; functions: Record; variables: Record; }; export type JinjaEngineOptions = { debugInfo?: boolean; filters: Record; workers: number; }; export interface JinjaEngine { loadTemplate(templateName: string, templateContent: string): void; renderTemplate(templateName: string, context: unknown, pythonContext: Record | null): Promise; } export declare class NativeInstance { protected native: any | null; protected getNative(): any; newJinjaEngine(options: JinjaEngineOptions): JinjaEngine; loadPythonContext(fileName: string, content: unknown): Promise; } //# sourceMappingURL=index.d.ts.map