@@ -3,7 +3,7 @@ import * as cfn_diff from '@aws-cdk/cloudformation-diff';
33import type * as cxapi from '@aws-cdk/cx-api' ;
44import type { WaiterResult } from '@smithy/util-waiter' ;
55import * as chalk from 'chalk' ;
6- import type { ResourceChange } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/payloads' ;
6+ import type { AffectedResource , ResourceChange } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/payloads' ;
77import type { IMessageSpan , IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private' ;
88import { IO , SPAN } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private' ;
99import type { SDK , SdkProvider } from '../aws-auth' ;
@@ -157,7 +157,7 @@ async function hotswapDeployment(
157157 } ) ;
158158
159159 const stackChanges = cfn_diff . fullDiff ( currentTemplate . deployedRootTemplate , stack . template ) ;
160- const { hotswappableChanges , nonHotswappableChanges } = await classifyResourceChanges (
160+ const { hotswapOperations , nonHotswappableChanges } = await classifyResourceChanges (
161161 stackChanges ,
162162 evaluateCfnTemplate ,
163163 sdk ,
@@ -166,6 +166,8 @@ async function hotswapDeployment(
166166
167167 await logNonHotswappableChanges ( ioSpan , nonHotswappableChanges , hotswapMode ) ;
168168
169+ const hotswappableChanges = hotswapOperations . map ( o => o . change ) ;
170+
169171 // preserve classic hotswap behavior
170172 if ( hotswapMode === 'fall-back' ) {
171173 if ( nonHotswappableChanges . length > 0 ) {
@@ -179,7 +181,7 @@ async function hotswapDeployment(
179181 }
180182
181183 // apply the short-circuitable changes
182- await applyAllHotswappableChanges ( sdk , ioSpan , hotswappableChanges ) ;
184+ await applyAllHotswappableChanges ( sdk , ioSpan , hotswapOperations ) ;
183185
184186 return {
185187 stack,
@@ -225,7 +227,7 @@ async function classifyResourceChanges(
225227 sdk ,
226228 hotswapPropertyOverrides ,
227229 ) ;
228- hotswappableResources . push ( ...nestedHotswappableResources . hotswappableChanges ) ;
230+ hotswappableResources . push ( ...nestedHotswappableResources . hotswapOperations ) ;
229231 nonHotswappableResources . push ( ...nestedHotswappableResources . nonHotswappableChanges ) ;
230232
231233 continue ;
@@ -275,7 +277,7 @@ async function classifyResourceChanges(
275277 }
276278
277279 return {
278- hotswappableChanges : hotswappableResources ,
280+ hotswapOperations : hotswappableResources ,
279281 nonHotswappableChanges : nonHotswappableResources ,
280282 } ;
281283}
@@ -343,7 +345,7 @@ async function findNestedHotswappableChanges(
343345 const nestedStack = nestedStackTemplates [ logicalId ] ;
344346 if ( ! nestedStack . physicalName ) {
345347 return {
346- hotswappableChanges : [ ] ,
348+ hotswapOperations : [ ] ,
347349 nonHotswappableChanges : [
348350 {
349351 hotswappable : false ,
@@ -470,8 +472,10 @@ async function applyHotswappableChange(sdk: SDK, ioSpan: IMessageSpan<any>, hots
470472 const customUserAgent = `cdk-hotswap/success-${ hotswapOperation . service } ` ;
471473 sdk . appendCustomUserAgent ( customUserAgent ) ;
472474
473- for ( const name of hotswapOperation . resourceNames ) {
474- await ioSpan . notify ( IO . DEFAULT_TOOLKIT_INFO . msg ( format ( ` ${ ICON } %s` , chalk . bold ( name ) ) ) ) ;
475+ const resourceText = ( r : AffectedResource ) => r . description ?? `${ r . resourceType } : '${ r . physicalName ?? r . logicalId } ` ;
476+
477+ for ( const resource of hotswapOperation . change . resources ) {
478+ await ioSpan . notify ( IO . DEFAULT_TOOLKIT_INFO . msg ( format ( ` ${ ICON } %s` , chalk . bold ( resourceText ( resource ) ) ) ) ) ;
475479 }
476480
477481 // if the SDK call fails, an error will be thrown by the SDK
@@ -488,8 +492,8 @@ async function applyHotswappableChange(sdk: SDK, ioSpan: IMessageSpan<any>, hots
488492 throw e ;
489493 }
490494
491- for ( const name of hotswapOperation . resourceNames ) {
492- await ioSpan . notify ( IO . DEFAULT_TOOLKIT_INFO . msg ( format ( `${ ICON } %s %s` , chalk . bold ( name ) , chalk . green ( 'hotswapped!' ) ) ) ) ;
495+ for ( const resource of hotswapOperation . change . resources ) {
496+ await ioSpan . notify ( IO . DEFAULT_TOOLKIT_INFO . msg ( format ( `${ ICON } %s %s` , chalk . bold ( resourceText ( resource ) ) , chalk . green ( 'hotswapped!' ) ) ) ) ;
493497 }
494498
495499 sdk . removeCustomUserAgent ( customUserAgent ) ;
0 commit comments