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' ;
@@ -114,9 +113,9 @@ export class CompilerApi {
114113 async createQueryFactory ( compilers ) {
115114 const { cubeEvaluator } = compilers ;
116115
117- const cubeToQueryClass = R . fromPairs (
116+ const cubeToQueryClass = Object . fromEntries (
118117 await Promise . all (
119- cubeEvaluator . cubeNames ( ) . map ( async cube => {
118+ cubeEvaluator . cubeNames ( ) . map ( async ( cube ) => {
120119 const dataSource = cubeEvaluator . cubeFromPath ( cube ) . dataSource ?? 'default' ;
121120 const dbType = await this . getDbType ( dataSource ) ;
122121 const dialectClass = this . getDialectClass ( dataSource , dbType ) ;
@@ -132,7 +131,7 @@ export class CompilerApi {
132131 }
133132
134133 getDialectClass ( dataSource = 'default' , dbType ) {
135- return this . dialectClass && this . dialectClass ( { dataSource, dbType } ) ;
134+ return this . dialectClass ?. ( { dataSource, dbType } ) ;
136135 }
137136
138137 async getSqlGenerator ( query , dataSource ) {
@@ -178,8 +177,8 @@ export class CompilerApi {
178177 external : sqlGenerator . externalPreAggregationQuery ( ) ,
179178 sql : sqlGenerator . buildSqlAndParams ( exportAnnotatedSql ) ,
180179 lambdaQueries : sqlGenerator . buildLambdaQuery ( ) ,
181- timeDimensionAlias : sqlGenerator . timeDimensions [ 0 ] && sqlGenerator . timeDimensions [ 0 ] . unescapedAliasName ( ) ,
182- timeDimensionField : sqlGenerator . timeDimensions [ 0 ] && sqlGenerator . timeDimensions [ 0 ] . dimension ,
180+ timeDimensionAlias : sqlGenerator . timeDimensions [ 0 ] ? .unescapedAliasName ( ) ,
181+ timeDimensionField : sqlGenerator . timeDimensions [ 0 ] ? .dimension ,
183182 order : sqlGenerator . order ,
184183 cacheKeyQueries : sqlGenerator . cacheKeyQueries ( ) ,
185184 preAggregations : sqlGenerator . preAggregations . preAggregationsDescription ( ) ,
@@ -213,7 +212,7 @@ export class CompilerApi {
213212 }
214213
215214 roleMeetsConditions ( evaluatedConditions ) {
216- if ( evaluatedConditions && evaluatedConditions . length ) {
215+ if ( evaluatedConditions ? .length ) {
217216 return evaluatedConditions . reduce ( ( a , b ) => {
218217 if ( typeof b !== 'boolean' ) {
219218 throw new Error ( `Access policy condition must return boolean, got ${ JSON . stringify ( b ) } ` ) ;
0 commit comments