11import crypto from 'crypto' ;
2- import R from 'ramda' ;
32import { createQuery , compile , queryClass , PreAggregations , QueryFactory } from '@cubejs-backend/schema-compiler' ;
43import { v4 as uuidv4 , parse as uuidParse } from 'uuid' ;
54import { LRUCache } from 'lru-cache' ;
@@ -128,9 +127,9 @@ export class CompilerApi {
128127 async createQueryFactory ( compilers ) {
129128 const { cubeEvaluator } = compilers ;
130129
131- const cubeToQueryClass = R . fromPairs (
130+ const cubeToQueryClass = Object . fromEntries (
132131 await Promise . all (
133- cubeEvaluator . cubeNames ( ) . map ( async cube => {
132+ cubeEvaluator . cubeNames ( ) . map ( async ( cube ) => {
134133 const dataSource = cubeEvaluator . cubeFromPath ( cube ) . dataSource ?? 'default' ;
135134 const dbType = await this . getDbType ( dataSource ) ;
136135 const dialectClass = this . getDialectClass ( dataSource , dbType ) ;
@@ -146,7 +145,7 @@ export class CompilerApi {
146145 }
147146
148147 getDialectClass ( dataSource = 'default' , dbType ) {
149- return this . dialectClass && this . dialectClass ( { dataSource, dbType } ) ;
148+ return this . dialectClass ?. ( { dataSource, dbType } ) ;
150149 }
151150
152151 async getSqlGenerator ( query , dataSource ) {
@@ -192,8 +191,8 @@ export class CompilerApi {
192191 external : sqlGenerator . externalPreAggregationQuery ( ) ,
193192 sql : sqlGenerator . buildSqlAndParams ( exportAnnotatedSql ) ,
194193 lambdaQueries : sqlGenerator . buildLambdaQuery ( ) ,
195- timeDimensionAlias : sqlGenerator . timeDimensions [ 0 ] && sqlGenerator . timeDimensions [ 0 ] . unescapedAliasName ( ) ,
196- timeDimensionField : sqlGenerator . timeDimensions [ 0 ] && sqlGenerator . timeDimensions [ 0 ] . dimension ,
194+ timeDimensionAlias : sqlGenerator . timeDimensions [ 0 ] ? .unescapedAliasName ( ) ,
195+ timeDimensionField : sqlGenerator . timeDimensions [ 0 ] ? .dimension ,
197196 order : sqlGenerator . order ,
198197 cacheKeyQueries : sqlGenerator . cacheKeyQueries ( ) ,
199198 preAggregations : sqlGenerator . preAggregations . preAggregationsDescription ( ) ,
@@ -227,7 +226,7 @@ export class CompilerApi {
227226 }
228227
229228 roleMeetsConditions ( evaluatedConditions ) {
230- if ( evaluatedConditions && evaluatedConditions . length ) {
229+ if ( evaluatedConditions ? .length ) {
231230 return evaluatedConditions . reduce ( ( a , b ) => {
232231 if ( typeof b !== 'boolean' ) {
233232 throw new Error ( `Access policy condition must return boolean, got ${ JSON . stringify ( b ) } ` ) ;
0 commit comments