File tree Expand file tree Collapse file tree 6 files changed +28
-5
lines changed Expand file tree Collapse file tree 6 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 1414 * limitations under the License. 
1515 */ 
1616
17+ import  {  version  as  apiProcessorVersion  }  from  '../package.json' 
1718import  { 
1819  BuildConfig , 
1920  BuildConfigBase , 
@@ -650,6 +651,7 @@ export class PackageVersionBuilder implements IPackageVersionBuilder {
650651      version : this . config . version , 
651652      revision : 0 , 
652653      operationTypes : this . operationsTypes , 
654+       apiProcessorVersion : apiProcessorVersion , 
653655    } 
654656  } 
655657
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import {
4040  removeObjectDuplicates , 
4141}  from  '../../utils' 
4242import  {  asyncDebugPerformance ,  DebugPerformanceContext ,  syncDebugPerformance  }  from  '../../utils/logs' 
43+ import  {  validateApiProcessorVersion  }  from  '../../validators' 
4344
4445export  async  function  compareVersionsOperations ( 
4546  prev : VersionParams , 
@@ -52,9 +53,13 @@ export async function compareVersionsOperations(
5253
5354  const  {  versionResolver }  =  ctx 
5455
55-   // resolve all version with operation hashes 
56-   const  prevVersionData  =  prev  &&  ( await  versionResolver ( ...prev )  ??  {  version : prev ?. [ 0 ] ,  packageId : prev ?. [ 1 ]  } ) 
57-   const  currVersionData  =  curr  &&  ( await  versionResolver ( ...curr )  ??  {  version : curr ?. [ 0 ] ,  packageId : curr ?. [ 1 ]  } ) 
56+   // resolve both versions 
57+   const  prevVersionData  =  prev  &&  await  versionResolver ( ...prev ) 
58+   const  currVersionData  =  curr  &&  await  versionResolver ( ...curr ) 
59+ 
60+   // validate api-processor version compatibility 
61+   validateApiProcessorVersion ( prevVersionData ,  'Can\'t build the changelog if previous version was built using an outdated api-processor.' ) 
62+   validateApiProcessorVersion ( currVersionData ,  'Can\'t build the changelog if current version was built using an outdated api-processor.' ) 
5863
5964  // compare operations of each type 
6065  for  ( const  apiType  of  getUniqueApiTypesFromVersions ( prevVersionData ,  currVersionData ) )  { 
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export type ResolvedVersion = {
2828  previousVersionPackageId ?: string 
2929  operationTypes ?: OperationTypes [ ] 
3030  version : string 
31+   apiProcessorVersion : string 
3132
3233  // other params (not used in builder logic) 
3334  [ key : string ] : unknown 
Original file line number Diff line number Diff line change 1414 * limitations under the License. 
1515 */ 
1616
17- import  {  BuildConfig  }  from  './types' 
17+ import  {  BuildConfig ,   VersionCache  }  from  './types' 
1818import  {  assert  }  from  './utils' 
1919import  {  BUILD_TYPE  }  from  './consts' 
20+ import  {  version  as  apiProcessorVersion  }  from  '../package.json' 
2021
2122export  function  validateConfig ( config : BuildConfig ) : void { 
2223  assert ( config . packageId ,  'builder config: packageId required' ) 
@@ -28,3 +29,15 @@ export function validateConfig(config: BuildConfig): void {
2829    throw  new  Error ( 'Incorrect config. Got no files and refs' ) 
2930  } 
3031} 
32+ 
33+ export  function  validateApiProcessorVersion ( resolvedVersion : VersionCache  |  null ,  errorPrefix ?: string ) : void { 
34+ 
35+   if  ( ! resolvedVersion ?. apiProcessorVersion )  { 
36+     return 
37+   } 
38+ 
39+   if  ( resolvedVersion . apiProcessorVersion  !==  apiProcessorVersion )  { 
40+     errorPrefix  =  errorPrefix  ? `${ errorPrefix }   : '' 
41+     throw  new  Error ( `${ errorPrefix } ${ apiProcessorVersion } ${ resolvedVersion . apiProcessorVersion } ${ resolvedVersion . packageId } ${ resolvedVersion . version }  ) 
42+   } 
43+ } 
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ export class ApihubRegistry implements IRegistry {
164164    const  encodedPackageKey  =  encodeURIComponent ( packageId ) 
165165    const  encodedVersionKey  =  encodeURIComponent ( versionId ) 
166166
167-     const  {  data }  =  await  this . axios . get ( `/api/v2 /packages/${ encodedPackageKey } ${ encodedVersionKey } ${ includeOperations }  ) 
167+     const  {  data }  =  await  this . axios . get ( `/api/v3 /packages/${ encodedPackageKey } ${ encodedVersionKey } ${ includeOperations }  ) 
168168    return  data 
169169  } 
170170
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ import { calculateTotalChangeSummary } from '../../../src/components/compare'
8686import  {  toVersionsComparisonDto  }  from  '../../../src/utils/transformToDto' 
8787import  path  from  'path' 
8888import  {  ResolvedPackage  }  from  '../../../src/types/external/package' 
89+ import  {  version  as  apiProcessorVersion  }  from  '../../../package.json' 
8990
9091const  VERSIONS_PATH  =  'test/versions' 
9192const  DEFAULT_PROJECTS_PATH  =  'test/projects' 
@@ -175,6 +176,7 @@ export class LocalRegistry implements IRegistry {
175176      versionLabels : [ ] , 
176177      revision : 0 , 
177178      operationTypes : apiTypes . map ( apiType  =>  ( {  apiType : apiType ,  changesSummary : getChangesSummary ( apiType )  } ) ) , 
179+       apiProcessorVersion : apiProcessorVersion , 
178180    } 
179181  } 
180182
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments