@@ -14,6 +14,7 @@ import {
14
14
DeployResult ,
15
15
FileResponse ,
16
16
FileResponseFailure ,
17
+ FileResponseSuccess ,
17
18
MetadataResolver ,
18
19
SourceComponent ,
19
20
VirtualTreeContainer ,
@@ -23,7 +24,7 @@ import { ensureArray } from '@salesforce/kit';
23
24
import { Ux } from '@salesforce/sf-plugins-core' ;
24
25
import { ResultFormatter , ResultFormatterOptions } from '../resultFormatter.js' ;
25
26
26
- Messages . importMessagesDirectoryFromMetaUrl ( import . meta. url )
27
+ Messages . importMessagesDirectoryFromMetaUrl ( import . meta. url ) ;
27
28
const messages = Messages . loadMessages ( '@salesforce/plugin-source' , 'push' ) ;
28
29
29
30
export type PushResponse = {
@@ -132,33 +133,32 @@ export class PushResultFormatter extends ResultFormatter {
132
133
}
133
134
// "content" property of the bundles as a string
134
135
const contentFilePathFromDeployedBundles = this . componentsFromFilenames (
135
- // the .filter(isString) should ensure only strings are present, but TS isn't finding that
136
- bundlesDeployed . map ( ( fileResponse ) => fileResponse . filePath as string )
136
+ bundlesDeployed . map ( ( fileResponse ) => fileResponse . filePath ) . filter ( isString )
137
137
)
138
138
. map ( ( c ) => c . content )
139
139
. filter ( isString ) ;
140
140
141
141
// there may be deletes not represented in the file responses (if bundle type)
142
142
const resolver = new MetadataResolver ( undefined , VirtualTreeContainer . fromFilePaths ( this . deletes ) ) ;
143
- return (
144
- this . deletes
145
- . map ( ( filePath ) => {
146
- const cmp = this . resolveComponentsOrWarn ( filePath , resolver ) [ 0 ] ;
147
- if (
148
- cmp . type . strategies ?. adapter === 'bundle' &&
149
- contentFilePathFromDeployedBundles . includes ( pathResolve ( cmp . content ?? '' ) )
150
- ) {
151
- return {
152
- state : ComponentStatus . Deleted ,
153
- fullName : cmp . fullName ,
154
- type : cmp . type . name ,
155
- filePath ,
156
- } as FileResponse ;
157
- }
158
- } )
159
- . filter ( ( fileResponse ) => fileResponse )
160
- // we can be sure there's no undefined responses because of the filter above
161
- . concat ( withoutUnchanged ) as FileResponse [ ]
143
+
144
+ return withoutUnchanged . concat (
145
+ this . deletes . flatMap ( ( filePath ) =>
146
+ this . resolveComponentsOrWarn ( filePath , resolver )
147
+ . filter (
148
+ ( cmp ) =>
149
+ cmp . type . strategies ?. adapter === 'bundle' &&
150
+ contentFilePathFromDeployedBundles . includes ( pathResolve ( cmp . content ?? '' ) )
151
+ )
152
+ . map (
153
+ ( cmp ) =>
154
+ ( {
155
+ state : ComponentStatus . Deleted ,
156
+ fullName : cmp . fullName ,
157
+ type : cmp . type . name ,
158
+ filePath ,
159
+ } satisfies FileResponseSuccess )
160
+ )
161
+ )
162
162
) ;
163
163
}
164
164
0 commit comments