File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 3.0.1
4+
5+ January 7, 20201
6+
7+ 1 . ` getFlattenedFields ` did not properly handle the alias for an aggregate function within an aggregate query. (#131 )
8+
39## 3.0.0
410
511October 14, 2020
Original file line number Diff line number Diff line change @@ -192,6 +192,10 @@ export function getFlattenedFields(
192192 return param ;
193193 } ) ;
194194
195+ if ( field . alias && ( field . isAggregateFn || isAggregateResult ) ) {
196+ return field . alias ;
197+ }
198+
195199 if ( field . alias ) {
196200 const firstParam = params [ 0 ] ;
197201 // Include the full path and replace the field with the alias
Original file line number Diff line number Diff line change @@ -414,4 +414,32 @@ export const testCases: FlattenedObjTestCase[] = [
414414 } ,
415415 } ,
416416 } ,
417+ {
418+ testCase : 13 ,
419+ expectedFields : [ 'AccountId' , 'AcctCreatedDate' ] ,
420+ query : {
421+ fields : [
422+ {
423+ type : 'Field' ,
424+ field : 'AccountId' ,
425+ } ,
426+ {
427+ type : 'FieldFunctionExpression' ,
428+ functionName : 'MAX' ,
429+ parameters : [ 'Account.CreatedDate' ] ,
430+ isAggregateFn : true ,
431+ rawValue : 'MAX(Account.CreatedDate)' ,
432+ alias : 'AcctCreatedDate' ,
433+ } ,
434+ ] ,
435+ sObject : 'Contact' ,
436+ groupBy : {
437+ field : [ 'AccountId' ] ,
438+ } ,
439+ } ,
440+ sfdcObj : {
441+ AccountId : '0016g00000ETu0HAAT' ,
442+ AcctCreatedDate : '2020-02-28T03:00:31.000+0000' ,
443+ } ,
444+ } ,
417445] ;
You can’t perform that action at this time.
0 commit comments