@@ -54,7 +54,7 @@ export interface HotswapOperation {
5454 readonly apply : ( sdk : SDK ) => Promise < void > ;
5555}
5656
57- export interface NonHotswappableChange {
57+ export interface RejectedChange {
5858 readonly hotswappable : false ;
5959 readonly resourceType : string ;
6060 readonly rejectedChanges : Array < string > ;
@@ -77,11 +77,11 @@ export interface NonHotswappableChange {
7777 readonly hotswapOnlyVisible ?: boolean ;
7878}
7979
80- export type ChangeHotswapResult = Array < HotswapOperation | NonHotswappableChange > ;
80+ export type HotswapChange = HotswapOperation | RejectedChange ;
8181
8282export interface ClassifiedResourceChanges {
8383 hotswapOperations : HotswapOperation [ ] ;
84- nonHotswappableChanges : NonHotswappableChange [ ] ;
84+ nonHotswappableChanges : RejectedChange [ ] ;
8585}
8686
8787export enum HotswapMode {
@@ -101,8 +101,6 @@ export enum HotswapMode {
101101 FULL_DEPLOYMENT = 'full-deployment' ,
102102}
103103
104- type Exclude = { [ key : string ] : Exclude | true } ;
105-
106104/**
107105 * Represents configuration property overrides for hotswap deployments
108106 */
@@ -149,54 +147,17 @@ export class EcsHotswapProperties {
149147 }
150148}
151149
152- /**
153- * This function transforms all keys (recursively) in the provided `val` object.
154- *
155- * @param val The object whose keys need to be transformed.
156- * @param transform The function that will be applied to each key.
157- * @param exclude The keys that will not be transformed and copied to output directly
158- * @returns A new object with the same values as `val`, but with all keys transformed according to `transform`.
159- */
160- export function transformObjectKeys ( val : any , transform : ( str : string ) => string , exclude : Exclude = { } ) : any {
161- if ( val == null || typeof val !== 'object' ) {
162- return val ;
163- }
164- if ( Array . isArray ( val ) ) {
165- // For arrays we just pass parent's exclude object directly
166- // since it makes no sense to specify different exclude options for each array element
167- return val . map ( ( input : any ) => transformObjectKeys ( input , transform , exclude ) ) ;
168- }
169- const ret : { [ k : string ] : any } = { } ;
170- for ( const [ k , v ] of Object . entries ( val ) ) {
171- const childExclude = exclude [ k ] ;
172- if ( childExclude === true ) {
173- // we don't transform this object if the key is specified in exclude
174- ret [ transform ( k ) ] = v ;
175- } else {
176- ret [ transform ( k ) ] = transformObjectKeys ( v , transform , childExclude ) ;
177- }
178- }
179- return ret ;
180- }
181-
182- /**
183- * This function lower cases the first character of the string provided.
184- */
185- export function lowerCaseFirstCharacter ( str : string ) : string {
186- return str . length > 0 ? `${ str [ 0 ] . toLowerCase ( ) } ${ str . slice ( 1 ) } ` : str ;
187- }
188-
189150type PropDiffs = Record < string , PropertyDifference < any > > ;
190151
191- export class ClassifiedChanges {
152+ class ClassifiedChanges {
192153 public constructor (
193154 public readonly change : ResourceChange ,
194155 public readonly hotswappableProps : PropDiffs ,
195156 public readonly nonHotswappableProps : PropDiffs ,
196157 ) {
197158 }
198159
199- public reportNonHotswappablePropertyChanges ( ret : ChangeHotswapResult ) : void {
160+ public reportNonHotswappablePropertyChanges ( ret : HotswapChange [ ] ) : void {
200161 const nonHotswappablePropNames = Object . keys ( this . nonHotswappableProps ) ;
201162 if ( nonHotswappablePropNames . length > 0 ) {
202163 const tagOnlyChange = nonHotswappablePropNames . length === 1 && nonHotswappablePropNames [ 0 ] === 'Tags' ;
@@ -234,7 +195,7 @@ export function classifyChanges(xs: ResourceChange, hotswappablePropNames: strin
234195}
235196
236197export function reportNonHotswappableChange (
237- ret : ChangeHotswapResult ,
198+ ret : HotswapChange [ ] ,
238199 change : ResourceChange ,
239200 reason : NonHotswappableReason ,
240201 nonHotswappableProps ?: PropDiffs ,
@@ -256,7 +217,7 @@ export function reportNonHotswappableResource(
256217 change : ResourceChange ,
257218 reason : NonHotswappableReason ,
258219 description ?: string ,
259- ) : ChangeHotswapResult {
220+ ) : HotswapChange [ ] {
260221 return [
261222 {
262223 hotswappable : false ,
0 commit comments