import { Query } from 'compassql/build/src/query/query' ; import { isWildcard , SHORT_WILDCARD } from 'compassql/build/src/wildcard' ; import { QueryCreator } from './base' ; import { makeWildcard } from './common' ; export const alternativeEncodings = { type : 'alternativeEncodings' , title : 'Alternative Encodings' , filterSpecifiedView : true , createQuery ( query ) { const { spec } = query ; const { mark , encodings } = spec ; return { spec : { ... query . spec , mark : makeWildcard ( mark ) , encodings : encodings . map ( encQ => { if ( isWildcard ( encQ . channel ) ) { return encQ ; } return { ... encQ , channel : SHORT_WILDCARD } ; } ) } , groupBy : 'encoding' , orderBy : [ 'fieldOrder' , 'aggregationQuality' , 'effectiveness' ] , chooseBy : [ 'aggregationQuality' , 'effectiveness' ] } ; } } ;