@@ -29,7 +29,6 @@ import {
2929}  from  '../../types' 
3030import  {  BUILD_TYPE ,  EMPTY_CHANGE_SUMMARY ,  MESSAGE_SEVERITY  }  from  '../../consts' 
3131import  {  convertToSlug ,  takeIfDefined  }  from  '../../utils' 
32- import  {  normalizePath  }  from  '../../utils/builder' 
3332
3433export  const  totalChanges  =  ( changeSummary ?: ChangeSummary ) : number  =>  { 
3534  return  changeSummary 
@@ -97,50 +96,31 @@ export function getOperationsHashMapByApiType(
9796  const  resolvedHashMap  =  {  ...operationTypes . find ( ( {  apiType : type  } )  =>  type  ===  currentApiType ) ?. operations  ||  { }  } 
9897  const  {  buildType,  currentGroup,  previousGroup }  =  ctx . config 
9998
100-   // Handle prefix group changelog case 
101-   if  ( buildType  ===  BUILD_TYPE . PREFIX_GROUPS_CHANGELOG )  { 
102-     if  ( ! currentGroup  ||  ! previousGroup )  { 
103-       ctx . notifications . push ( { 
104-         severity : MESSAGE_SEVERITY . Warning , 
105-         message : `Build type is prefix group changelog, but one of the groups is not provided: currentGroup=${ currentGroup }  , previousGroup=${ previousGroup }  ` , 
106-       } ) 
107-       return  resolvedHashMap 
108-     } 
109- 
110-     const  groupSlug  =  convertToSlug ( areOperationsFromCurrentVersion  ? currentGroup  : previousGroup ) 
111-     const  newHashMap : ResolvedVersionOperationsHashMap  =  { } 
112- 
113-     // Process each operation 
114-     for  ( const  [ operationId ,  dataHash ]  of  Object . entries ( resolvedHashMap ) )  { 
115-       if  ( operationId . startsWith ( groupSlug ) )  { 
116-         const  changedOperationId  =  operationId . substring ( groupSlug . length ) 
117-         newHashMap [ changedOperationId ]  =  dataHash 
118-         operationIdentityMap [ changedOperationId ]  =  operationId 
119-       } 
120-     } 
99+   if  ( buildType  !==  BUILD_TYPE . PREFIX_GROUPS_CHANGELOG )  { 
100+     return  resolvedHashMap 
101+   } 
121102
122-     return  newHashMap 
103+   if  ( ! currentGroup  ||  ! previousGroup )  { 
104+     ctx . notifications . push ( { 
105+       severity : MESSAGE_SEVERITY . Warning , 
106+       message : `Build type is prefix group changelog, but one of the groups is not provided: currentGroup=${ currentGroup }  , previousGroup=${ previousGroup }  ` , 
107+     } ) 
108+     return  resolvedHashMap 
123109  } 
124110
125-   // Handle path parameter normalization case 
126-   const  newHashMap : ResolvedVersionOperationsHashMap  =  { } 
127111  for  ( const  [ operationId ,  dataHash ]  of  Object . entries ( resolvedHashMap ) )  { 
128-     // Get operation metadata to normalize the path 
129-     const  operation  =  operationTypes . find ( ( {  apiType : type  } )  =>  type  ===  currentApiType ) 
130-       ?. operations_metadata ?. [ operationId ] 
131-     
132-     if  ( operation ?. path  &&  operation ?. method )  { 
133-       const  normalizedPath  =  normalizePath ( operation . path ) 
134-       const  normalizedId  =  `${ operation . method . toLowerCase ( ) }  -${ normalizedPath }  ` 
135-       newHashMap [ normalizedId ]  =  dataHash 
136-       operationIdentityMap [ normalizedId ]  =  operationId 
137-     }  else  { 
138-       newHashMap [ operationId ]  =  dataHash 
139-       operationIdentityMap [ operationId ]  =  operationId 
112+     Reflect . deleteProperty ( resolvedHashMap ,  operationId ) 
113+ 
114+     const  groupSlug  =  convertToSlug ( areOperationsFromCurrentVersion  ? currentGroup  : previousGroup ) 
115+ 
116+     if  ( operationId . startsWith ( groupSlug ) )  { 
117+       const  changedOperationId  =  operationId . substring ( groupSlug . length ) 
118+       resolvedHashMap [ changedOperationId ]  =  dataHash 
119+       operationIdentityMap [ changedOperationId ]  =  operationId 
140120    } 
141121  } 
142122
143-   return  newHashMap 
123+   return  resolvedHashMap 
144124} 
145125
146126export  function  getOperationMetadata ( operation : ResolvedOperation ) : OperationChangesMetadata  { 
@@ -162,26 +142,3 @@ export function takeSubstringIf(condition: boolean, value: string, startIndex: n
162142
163143  return  value . substring ( startIndex ) 
164144} 
165- 
166- /** 
167-  * Normalizes a path by replacing path parameters with a placeholder 
168-  * regardless of the parameter name 
169-  * e.g. /users/{userId}/posts/{postId} -> /users/{param}/posts/{param} 
170-  */ 
171- export  function  normalizePath ( path : string ) : string  { 
172-   return  path . replace ( / \{ [ ^ } ] + \} / g,  '{param}' ) 
173- } 
174- 
175- /** 
176-  * Gets a normalized operation identifier that is resilient to path parameter renaming 
177-  */ 
178- export  function  getNormalizedOperationId ( operationId : string ,  metadata ?: {  path ?: string ,  method ?: string  } ) : string  { 
179-   // If no path/method metadata, return original ID 
180-   if  ( ! metadata ?. path  ||  ! metadata ?. method )  { 
181-     return  operationId 
182-   } 
183- 
184-   // Create normalized ID from method and normalized path using existing normalizePath utility 
185-   const  normalizedPath  =  normalizePath ( metadata . path ) 
186-   return  `${ metadata . method . toLowerCase ( ) }  -${ normalizedPath }  ` 
187- } 
0 commit comments