1616
1717import { ApiAudience } from '../package'
1818import { OperationsApiType , PackageId , VersionId } from './types'
19- import { ClassifierType , DiffType , risky } from '@netcracker/qubership-apihub-api-diff'
19+ import {
20+ annotation ,
21+ breaking ,
22+ ClassifierType , deprecated ,
23+ DiffType ,
24+ nonBreaking ,
25+ risky ,
26+ unclassified ,
27+ } from '@netcracker/qubership-apihub-api-diff'
2028
2129export type VersionComparisonResolver = (
2230 version : VersionId ,
@@ -37,28 +45,39 @@ export interface ResolvedComparisonSummary {
3745 operationTypes : OperationType [ ]
3846}
3947
40- export interface OperationType {
48+ export interface OperationType < T extends string | number | symbol = DiffType > {
4149 apiType : OperationsApiType
42- changesSummary : ChangeSummary
43- numberOfImpactedOperations : ChangeSummary
50+ changesSummary : ChangeSummary < T >
51+ numberOfImpactedOperations : ChangeSummary < T >
4452 apiAudienceTransitions : ApiAudienceTransition [ ]
4553 tags ?: string [ ]
4654}
4755
48- export const BREAKING_CHANGE_TYPE = 'breaking'
49- export const NON_BREAKING_CHANGE_TYPE = 'non-breaking'
50- export const UNCLASSIFIED_CHANGE_TYPE = 'unclassified'
51- export const SEMI_BREAKING_CHANGE_TYPE = risky
52- export const DEPRECATED_CHANGE_TYPE = 'deprecated'
53- export const ANNOTATION_CHANGE_TYPE = 'annotation'
56+ export const BREAKING_CHANGE_TYPE = breaking
57+ export const NON_BREAKING_CHANGE_TYPE = nonBreaking
58+ export const UNCLASSIFIED_CHANGE_TYPE = unclassified
59+ export const RISKY_CHANGE_TYPE = risky
60+ export const DEPRECATED_CHANGE_TYPE = deprecated
61+ export const ANNOTATION_CHANGE_TYPE = annotation
62+ export const SEMI_BREAKING_CHANGE_TYPE = 'semi-breaking'
5463
55- export type ChangeSummary = Record < DiffType , number >
64+ export type ChangeSummary < T extends string | number | symbol = DiffType > = Record < T , number >
5665export type ImpactedOperationSummary = Record < DiffType , boolean >
57-
5866export const DIFF_TYPES : DiffType [ ] = Object . values ( ClassifierType )
5967
6068export interface ApiAudienceTransition {
6169 previousAudience : ApiAudience
6270 currentAudience : ApiAudience
6371 operationsCount : number
6472}
73+
74+ export type ChangeSummaryDto = Record < DiffTypeDto , number >
75+ export type DiffTypeDto = typeof ClassifierTypeDto [ keyof typeof ClassifierTypeDto ]
76+ export const ClassifierTypeDto = {
77+ breaking,
78+ nonBreaking,
79+ SEMI_BREAKING_CHANGE_TYPE ,
80+ annotation,
81+ unclassified,
82+ deprecated,
83+ } as const
0 commit comments