@@ -38,6 +38,7 @@ import {
3838import { extract } from './retrieveExtract' ;
3939import { getPackageOptions } from './retrieveExtract' ;
4040import { MetadataApiRetrieveOptions } from './types' ;
41+ import { isWebAppBundle } from './utils' ;
4142
4243Messages . importMessagesDirectory ( __dirname ) ;
4344const messages = Messages . loadMessages ( '@salesforce/source-deploy-retrieve' , 'sdr' ) ;
@@ -101,28 +102,27 @@ export class RetrieveResult implements MetadataTransferResult {
101102
102103 // construct successes
103104 for ( const retrievedComponent of this . components . getSourceComponents ( ) ) {
104- const { fullName, type, xml, content } = retrievedComponent ;
105+ const { fullName, type, xml } = retrievedComponent ;
105106 const baseResponse = {
106107 fullName,
107108 type : type . name ,
108109 state : this . localComponents . has ( retrievedComponent ) ? ComponentStatus . Changed : ComponentStatus . Created ,
109110 } as const ;
110111
111112 // Special handling for web_app bundles - they need to walk content and report individual files
112- const isWebAppBundle = type . name === 'DigitalExperienceBundle' && fullName . startsWith ( 'web_app/' ) && content ;
113-
114- if ( isWebAppBundle ) {
115- const walkedPaths = retrievedComponent . walkContent ( ) ;
113+ if ( isWebAppBundle ( retrievedComponent ) ) {
116114 // Add the bundle directory itself
117- this . fileResponses . push ( { ... baseResponse , filePath : content } satisfies FileResponseSuccess ) ;
118- // Add each file with its specific path
119- for ( const filePath of walkedPaths ) {
120- this . fileResponses . push ( { ... baseResponse , filePath } satisfies FileResponseSuccess ) ;
121- }
115+ this . fileResponses . push (
116+ ... [ retrievedComponent . content , ... retrievedComponent . walkContent ( ) ] . map (
117+ ( filePath ) => ( { ... baseResponse , filePath } satisfies FileResponseSuccess )
118+ )
119+ ) ;
122120 } else if ( ! type . children || Object . values ( type . children . types ) . some ( ( t ) => t . unaddressableWithoutParent ) ) {
123- for ( const filePath of retrievedComponent . walkContent ( ) ) {
124- this . fileResponses . push ( { ...baseResponse , filePath } satisfies FileResponseSuccess ) ;
125- }
121+ this . fileResponses . push (
122+ ...retrievedComponent
123+ . walkContent ( )
124+ . map ( ( filePath ) => ( { ...baseResponse , filePath } satisfies FileResponseSuccess ) )
125+ ) ;
126126 }
127127
128128 if ( xml ) {
0 commit comments