/** * Copyright (c) 2019 Paul Armstrong */ import Build from '@build-tracker/build'; import BuildDelta from './BuildDelta'; import { ArtifactBudgets, ArtifactFilters, Budget, BudgetResult, Group } from '@build-tracker/types'; export interface ArtifactSizes { [key: string]: number; } export declare enum CellType { TEXT = "text", DELTA = "delta", TOTAL = "total", TOTAL_DELTA = "totalDelta", REVISION = "revision", REVISION_DELTA = "revisionDelta", ARTIFACT = "artifact", GROUP = "group" } export interface TextCell { type: CellType.TEXT; text: string; } export interface DeltaCell { type: CellType.DELTA; name: string; sizes: ArtifactSizes; percents: ArtifactSizes; hashChanged: boolean; hashChangeUnexpected: boolean; budgets: Array; failingBudgets: Array; } export interface TotalCell { type: CellType.TOTAL; name: string; sizes: ArtifactSizes; } export interface TotalDeltaCell { type: CellType.TOTAL_DELTA; name: string; sizes: ArtifactSizes; percents: ArtifactSizes; hashChanged: boolean; hashChangeUnexpected: boolean; budgets: Array; failingBudgets: Array; } export interface RevisionCell { type: CellType.REVISION; revision: string; } export interface RevisionDeltaCell { type: CellType.REVISION_DELTA; revision: string; deltaIndex: number; againstRevision: string; } export interface ArtifactCell { type: CellType.ARTIFACT; text: string; } export interface GroupCell { type: CellType.GROUP; text: string; artifactNames: Array; } export declare type HeaderRow = [TextCell, ...Array]; export declare type ArtifactRow = [ArtifactCell, ...Array]; export declare type GroupRow = [GroupCell, ...Array]; export interface ComparisonMatrix { header: HeaderRow; groups: Array; artifacts: Array; } export declare type CellTextStringFormatter = (cell: TextCell | GroupCell | ArtifactCell) => string; export declare type RevisionStringFormatter = (cell: RevisionCell) => string; export declare type RevisionDeltaStringFormatter = (cell: RevisionDeltaCell) => string; export declare type TotalStringFormatter = (cell: TotalCell, sizeKey: string) => string; export declare type DeltaStringFormatter = (cell: DeltaCell | TotalDeltaCell, sizeKey: string) => string; export declare type ArtifactFilter = (row: ArtifactRow) => boolean; export interface FormattingOptions { formatCellText?: CellTextStringFormatter; formatRevision?: RevisionStringFormatter; formatRevisionDelta?: RevisionDeltaStringFormatter; formatTotal?: TotalStringFormatter; formatDelta?: DeltaStringFormatter; artifactFilter?: ArtifactFilter; sizeKey?: string; } interface ComparatorOptions { artifactBudgets?: ArtifactBudgets; artifactFilters?: ArtifactFilters; budgets?: Array; builds: Array; groups?: Array; } export default class BuildComparator { builds: Array; private _artifactBudgets; private _artifactFilters; private _groups; private _artifactNames; private _sizeKeys; private _buildDeltas; private _emptySizes; private _matrixHeader; private _matrixGroups; private _matrixArtifacts; private _errors; private _warnings; private _unexpectedHashChanges; constructor({ artifactBudgets, artifactFilters, budgets, builds, groups }: ComparatorOptions); static deserialize(data: string): BuildComparator; serialize(): string; get artifactNames(): Array; get sizeKeys(): Array; get buildDeltas(): Array>; get matrixHeader(): ComparisonMatrix['header']; get matrixGroups(): ComparisonMatrix['groups']; get matrixArtifacts(): ComparisonMatrix['artifacts']; get errors(): Array<{ name: string; result: BudgetResult; }>; get warnings(): Array<{ name: string; result: BudgetResult; }>; get unexpectedHashChanges(): Array<{ name: string; }>; private _getArtifactRow; private _getGroupRow; getStringFormattedHeader(formatRevision?: RevisionStringFormatter, formatRevisionDelta?: RevisionDeltaStringFormatter): Array; getStringFormattedGroups(formatCellText?: CellTextStringFormatter, formatTotal?: TotalStringFormatter, formatDelta?: DeltaStringFormatter, sizeKey?: string): Array>; getStringFormattedRows(formatCellText?: CellTextStringFormatter, formatTotal?: TotalStringFormatter, formatDelta?: DeltaStringFormatter, sizeKey?: string, artifactFilter?: ArtifactFilter): Array>; toJSON(): ComparisonMatrix; toMarkdown({ formatCellText, formatRevision, formatRevisionDelta, formatTotal, formatDelta, artifactFilter, sizeKey, }?: FormattingOptions): string; toCsv({ formatCellText, formatRevision, formatRevisionDelta, formatTotal, formatDelta, artifactFilter, sizeKey, }?: FormattingOptions): string; toSummary(useEmoji?: boolean): Array; } export {}; //# sourceMappingURL=index.d.ts.map