@@ -10,7 +10,7 @@ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
1010const messages = Messages . loadMessages ( 'plugin-analytics-connected-objects' , 'connected-objects.upsert' ) ;
1111const common = Messages . loadMessages ( 'plugin-analytics-connected-objects' , 'common' ) ;
1212
13- export interface ConnectedObjectUpsertResult {
13+ export type ConnectedObjectUpsertResult = {
1414 [ key : string ] : string | boolean | string [ ] | number | undefined ;
1515 objectName : string ;
1616 connectorName : string ;
@@ -185,24 +185,25 @@ export default class ConnectedObjectsUpsert extends SfCommand<ConnectedObjectUps
185185 }
186186
187187 private printConnectionUpgradeResult ( records : ConnectedObjectUpsertResult [ ] , verbose : boolean ) : void {
188- this . table (
189- records ,
190- {
191- objectName : { header : 'OBJECT' } ,
192- connectorName : { header : 'CONNECTOR' } ,
193- isNEW : {
194- header : 'OPERATION' ,
195- get : ( data ) : string => ( data . isNew ? 'Create' : 'Update' ) ,
196- } ,
197- fieldsCount : { header : 'FIELDSCOUNT' } ,
198- fields : {
199- header : 'FIELDS' ,
200- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
201- get : ( data ) : string => PrinterHelper . printFieldsMultiline ( data . fields ! , 60 ) ,
202- extended : ! verbose ,
203- } ,
204- } ,
205- { title : 'Changed connected-objects' }
206- ) ;
188+ const columns = [
189+ { key : 'objectName' , name : 'OBJECT' } ,
190+ { key : 'connectorName' , name : 'CONNECTOR' } ,
191+ { key : 'operation' , name : 'OPERATION' } ,
192+ { key : 'fieldsCount' , name : 'FIELDSCOUNT' } ,
193+ { key : 'fields' , name : 'FIELDS' }
194+ ] ;
195+ for ( const record of records ) {
196+ record . operation = record . isNew ? 'Created' : 'Updated' ;
197+ }
198+ if ( verbose ) {
199+ columns . push ( { key : 'connectorName' , name : 'CONNECTOR' } ) ;
200+ for ( const record of records ) {
201+ record . fieldDetails = PrinterHelper . printFieldsMultiline ( record . fields ! , 60 ) ;
202+ }
203+ }
204+ this . table ( {
205+ data : records ,
206+ columns
207+ } ) ;
207208 }
208209}
0 commit comments