@@ -1161,8 +1161,7 @@ class ApiGateway {
11611161 context : RequestContext ,
11621162 persistent = false ,
11631163 memberExpressions : boolean = false ,
1164- skipQueryRewrite : boolean = false ,
1165- ) : Promise < [ QueryType , NormalizedQuery [ ] ] > {
1164+ ) : Promise < [ QueryType , NormalizedQuery [ ] , NormalizedQuery [ ] ] > {
11661165 let query = this . parseQueryParam ( inputQuery ) ;
11671166
11681167 let queryType : QueryType = QueryTypeEnum . REGULAR_QUERY ;
@@ -1185,6 +1184,8 @@ class ApiGateway {
11851184 const startTime = new Date ( ) . getTime ( ) ;
11861185 const compilerApi = await this . getCompilerApi ( context ) ;
11871186
1187+ const normalizedQueriesPreRewrite : NormalizedQuery [ ] = queries . map ( ( currentQuery ) => normalizeQuery ( currentQuery , persistent ) ) ;
1188+
11881189 let normalizedQueries : NormalizedQuery [ ] = await Promise . all (
11891190 queries . map (
11901191 async ( currentQuery ) => {
@@ -1201,10 +1202,6 @@ class ApiGateway {
12011202
12021203 const normalizedQuery = normalizeQuery ( currentQuery , persistent ) ;
12031204
1204- if ( skipQueryRewrite ) {
1205- return normalizedQuery ;
1206- }
1207-
12081205 let evaluatedQuery = normalizedQuery ;
12091206
12101207 if ( hasExpressionsInQuery ) {
@@ -1263,7 +1260,7 @@ class ApiGateway {
12631260 }
12641261 }
12651262
1266- return [ queryType , normalizedQueries ] ;
1263+ return [ queryType , normalizedQueries , normalizedQueriesPreRewrite ] ;
12671264 }
12681265
12691266 public async sql ( {
@@ -1460,7 +1457,7 @@ class ApiGateway {
14601457 try {
14611458 await this . assertApiScope ( 'data' , context . securityContext ) ;
14621459
1463- const [ queryType , normalizedQueries ] = await this . getNormalizedQueries ( query , context , undefined , undefined , true ) ;
1460+ const [ queryType , _ , normalizedQueries ] = await this . getNormalizedQueries ( query , context , undefined , undefined ) ;
14641461
14651462 const sqlQueries = await Promise . all < any > (
14661463 normalizedQueries . map ( async ( normalizedQuery ) => ( await this . getCompilerApi ( context ) ) . getSql (
0 commit comments