@allurereport/plugin-api 3.0.0-beta.18 → 3.0.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/charts/accessors/coverageDiffTreeMapAccessor.d.ts +17 -0
  2. package/dist/charts/accessors/coverageDiffTreeMapAccessor.js +181 -0
  3. package/dist/charts/accessors/problemsDistributionHeatMap.d.ts +2 -0
  4. package/dist/charts/accessors/problemsDistributionHeatMap.js +65 -0
  5. package/dist/{severityTrendAccessor.d.ts → charts/accessors/severityTrendAccessor.d.ts} +1 -1
  6. package/dist/{severityTrendAccessor.js → charts/accessors/severityTrendAccessor.js} +3 -3
  7. package/dist/charts/accessors/statusBySeverityBarAccessor.d.ts +3 -0
  8. package/dist/charts/accessors/statusBySeverityBarAccessor.js +33 -0
  9. package/dist/charts/accessors/statusChangeTrendBarAccessor.d.ts +4 -0
  10. package/dist/charts/accessors/statusChangeTrendBarAccessor.js +92 -0
  11. package/dist/{statusTrendAccessor.d.ts → charts/accessors/statusTrendAccessor.d.ts} +1 -1
  12. package/dist/{statusTrendAccessor.js → charts/accessors/statusTrendAccessor.js} +3 -3
  13. package/dist/charts/accessors/statusTrendBarAccessor.d.ts +5 -0
  14. package/dist/charts/accessors/statusTrendBarAccessor.js +63 -0
  15. package/dist/charts/accessors/successRateDistributionTreeMapAccessor.d.ts +14 -0
  16. package/dist/charts/accessors/successRateDistributionTreeMapAccessor.js +111 -0
  17. package/dist/charts/accessors/utils/behavior.d.ts +5 -0
  18. package/dist/charts/accessors/utils/behavior.js +4 -0
  19. package/dist/charts/bar.d.ts +3 -0
  20. package/dist/charts/bar.js +50 -0
  21. package/dist/charts/comingSoon.d.ts +2 -0
  22. package/dist/charts/comingSoon.js +7 -0
  23. package/dist/charts/heatmap.d.ts +3 -0
  24. package/dist/charts/heatmap.js +9 -0
  25. package/dist/charts/line.d.ts +8 -0
  26. package/dist/charts/line.js +140 -0
  27. package/dist/charts/pie.d.ts +6 -0
  28. package/dist/charts/pie.js +10 -0
  29. package/dist/charts/treeMap.d.ts +6 -0
  30. package/dist/charts/treeMap.js +88 -0
  31. package/dist/charts.d.ts +83 -38
  32. package/dist/charts.js +73 -153
  33. package/dist/config.d.ts +2 -0
  34. package/dist/index.d.ts +8 -4
  35. package/dist/index.js +7 -2
  36. package/dist/store.d.ts +35 -1
  37. package/dist/store.js +18 -1
  38. package/package.json +2 -2
@@ -0,0 +1,50 @@
1
+ import { BarChartType, ChartMode } from "@allurereport/core-api";
2
+ import { DEFAULT_CHART_HISTORY_LIMIT, limitHistoryDataPoints } from "../charts.js";
3
+ import { statusBySeverityBarDataAccessor } from "./accessors/statusBySeverityBarAccessor.js";
4
+ import { statusChangeTrendBarAccessor } from "./accessors/statusChangeTrendBarAccessor.js";
5
+ import { statusTrendBarAccessor } from "./accessors/statusTrendBarAccessor.js";
6
+ export const generateBarChartGeneric = (options, storeData, dataAccessor) => {
7
+ const { type, dataType, title, limit = DEFAULT_CHART_HISTORY_LIMIT, mode = ChartMode.Raw } = options;
8
+ const { historyDataPoints } = storeData;
9
+ const limitedHistoryPoints = limitHistoryDataPoints(historyDataPoints, limit);
10
+ const isFullHistory = limitedHistoryPoints.length === historyDataPoints.length;
11
+ const items = dataAccessor.getItems(storeData, limitedHistoryPoints, isFullHistory);
12
+ let processedData = items;
13
+ if (mode === ChartMode.Percent) {
14
+ processedData = items.map((group) => {
15
+ const { groupId, ...values } = group;
16
+ const total = Object.values(values).reduce((sum, value) => sum + value, 0);
17
+ const nextValues = Object.keys(values).reduce((acc, valueKey) => {
18
+ acc[valueKey] = values[valueKey] / total;
19
+ return acc;
20
+ }, {});
21
+ return {
22
+ groupId,
23
+ ...nextValues,
24
+ };
25
+ });
26
+ }
27
+ return {
28
+ type,
29
+ dataType,
30
+ mode,
31
+ title,
32
+ data: processedData,
33
+ keys: dataAccessor.getGroupKeys(),
34
+ groupMode: dataAccessor.getGroupMode(),
35
+ indexBy: "groupId",
36
+ };
37
+ };
38
+ export const generateBarChart = (options, storeData) => {
39
+ const newOptions = { limit: DEFAULT_CHART_HISTORY_LIMIT, ...options };
40
+ const { dataType } = newOptions;
41
+ if (dataType === BarChartType.StatusBySeverity) {
42
+ return generateBarChartGeneric(newOptions, storeData, statusBySeverityBarDataAccessor);
43
+ }
44
+ else if (dataType === BarChartType.StatusTrend) {
45
+ return generateBarChartGeneric(newOptions, storeData, statusTrendBarAccessor);
46
+ }
47
+ else if (dataType === BarChartType.StatusChangeTrend) {
48
+ return generateBarChartGeneric(newOptions, storeData, statusChangeTrendBarAccessor);
49
+ }
50
+ };
@@ -0,0 +1,2 @@
1
+ import type { ComingSoonChartData, ComingSoonChartOptions } from "../charts.js";
2
+ export declare const generateComingSoonChart: (options: ComingSoonChartOptions) => ComingSoonChartData;
@@ -0,0 +1,7 @@
1
+ import { ChartType } from "@allurereport/core-api";
2
+ export const generateComingSoonChart = (options) => {
3
+ return {
4
+ type: ChartType.ComingSoon,
5
+ title: options.title,
6
+ };
7
+ };
@@ -0,0 +1,3 @@
1
+ import type { AllureChartsStoreData, HeatMapChartData, HeatMapChartOptions, HeatMapDataAccessor } from "../charts.js";
2
+ export declare const generateHeatMapChartGeneric: <T extends Record<string, unknown>>(options: HeatMapChartOptions, storeData: AllureChartsStoreData, dataAccessor: HeatMapDataAccessor<T>) => HeatMapChartData | undefined;
3
+ export declare const generateHeatMapChart: (options: HeatMapChartOptions, storeData: AllureChartsStoreData) => HeatMapChartData | undefined;
@@ -0,0 +1,9 @@
1
+ import { problemsDistributionHeatMapAccessor } from "./accessors/problemsDistributionHeatMap.js";
2
+ export const generateHeatMapChartGeneric = (options, storeData, dataAccessor) => ({
3
+ type: options.type,
4
+ title: options.title,
5
+ data: dataAccessor.getHeatMap(storeData),
6
+ });
7
+ export const generateHeatMapChart = (options, storeData) => {
8
+ return generateHeatMapChartGeneric(options, storeData, problemsDistributionHeatMapAccessor);
9
+ };
@@ -0,0 +1,8 @@
1
+ import type { BaseTrendSliceMetadata } from "@allurereport/core-api";
2
+ import type { AllureChartsStoreData, GenericTrendChartData, TrendCalculationResult, TrendChartData, TrendChartOptions, TrendDataAccessor, TrendDataType } from "../charts.js";
3
+ import type { PluginContext } from "../plugin.js";
4
+ export declare const calculatePercentValues: <T extends TrendDataType>(stats: Record<T, number>, executionId: string, itemType: readonly T[]) => TrendCalculationResult<T>;
5
+ export declare const getTrendDataGeneric: <T extends TrendDataType, M extends BaseTrendSliceMetadata>(stats: Record<T, number>, reportName: string, executionOrder: number, itemType: readonly T[], chartOptions: TrendChartOptions) => GenericTrendChartData<T, M>;
6
+ export declare const mergeTrendDataGeneric: <T extends TrendDataType, M extends BaseTrendSliceMetadata>(trendData: GenericTrendChartData<T, M>, trendDataPart: GenericTrendChartData<T, M>, itemType: readonly T[]) => GenericTrendChartData<T, M>;
7
+ export declare const generateTrendChartGeneric: <T extends TrendDataType>(options: TrendChartOptions, storeData: AllureChartsStoreData, context: PluginContext, dataAccessor: TrendDataAccessor<T>) => GenericTrendChartData<T> | undefined;
8
+ export declare const generateTrendChart: (options: TrendChartOptions, storeData: AllureChartsStoreData, context: PluginContext) => TrendChartData | undefined;
@@ -0,0 +1,140 @@
1
+ import { ChartDataType, ChartMode } from "@allurereport/core-api";
2
+ import { DEFAULT_CHART_HISTORY_LIMIT, createEmptySeries, normalizeStatistic } from "../charts.js";
3
+ import { severityTrendDataAccessor } from "./accessors/severityTrendAccessor.js";
4
+ import { statusTrendDataAccessor } from "./accessors/statusTrendAccessor.js";
5
+ export const calculatePercentValues = (stats, executionId, itemType) => {
6
+ const points = {};
7
+ const series = createEmptySeries(itemType);
8
+ const values = Object.values(stats);
9
+ const total = values.reduce((sum, value) => sum + value, 0);
10
+ if (total === 0) {
11
+ return { points, series };
12
+ }
13
+ itemType.forEach((item) => {
14
+ const pointId = `${executionId}-${item}`;
15
+ const value = stats[item] ?? 0;
16
+ points[pointId] = {
17
+ x: executionId,
18
+ y: value / total,
19
+ };
20
+ series[item].push(pointId);
21
+ });
22
+ return { points, series };
23
+ };
24
+ const calculateRawValues = (stats, executionId, itemType) => {
25
+ const points = {};
26
+ const series = createEmptySeries(itemType);
27
+ itemType.forEach((item) => {
28
+ const pointId = `${executionId}-${item}`;
29
+ const value = stats[item] ?? 0;
30
+ points[pointId] = {
31
+ x: executionId,
32
+ y: value,
33
+ };
34
+ series[item].push(pointId);
35
+ });
36
+ return { points, series };
37
+ };
38
+ export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType, chartOptions) => {
39
+ const { type, dataType, title, mode = ChartMode.Raw, metadata = {} } = chartOptions;
40
+ const { executionIdAccessor, executionNameAccessor } = metadata;
41
+ const executionId = executionIdAccessor ? executionIdAccessor(executionOrder) : `execution-${executionOrder}`;
42
+ const { points, series } = mode === ChartMode.Percent
43
+ ? calculatePercentValues(stats, executionId, itemType)
44
+ : calculateRawValues(stats, executionId, itemType);
45
+ const slices = {};
46
+ const pointsAsArray = Object.values(points);
47
+ const pointsCount = pointsAsArray.length;
48
+ const values = pointsAsArray.map((point) => point.y);
49
+ const min = pointsCount ? Math.min(...values) : 0;
50
+ const max = pointsCount ? Math.max(...values) : 0;
51
+ if (pointsCount > 0) {
52
+ const executionName = executionNameAccessor ? executionNameAccessor(executionOrder) : reportName;
53
+ slices[executionId] = {
54
+ min,
55
+ max,
56
+ metadata: {
57
+ executionId,
58
+ executionName,
59
+ },
60
+ };
61
+ }
62
+ return {
63
+ type,
64
+ dataType,
65
+ mode,
66
+ title,
67
+ points,
68
+ slices,
69
+ series,
70
+ min,
71
+ max,
72
+ };
73
+ };
74
+ export const mergeTrendDataGeneric = (trendData, trendDataPart, itemType) => {
75
+ return {
76
+ ...trendData,
77
+ points: {
78
+ ...trendData.points,
79
+ ...trendDataPart.points,
80
+ },
81
+ slices: {
82
+ ...trendData.slices,
83
+ ...trendDataPart.slices,
84
+ },
85
+ series: Object.entries(trendDataPart.series).reduce((series, [group, pointIds]) => {
86
+ if (Array.isArray(pointIds)) {
87
+ return {
88
+ ...series,
89
+ [group]: [...(trendData.series?.[group] || []), ...pointIds],
90
+ };
91
+ }
92
+ return series;
93
+ }, trendData.series || createEmptySeries(itemType)),
94
+ min: Math.min(trendData.min ?? Infinity, trendDataPart.min),
95
+ max: Math.max(trendData.max ?? -Infinity, trendDataPart.max),
96
+ };
97
+ };
98
+ export const generateTrendChartGeneric = (options, storeData, context, dataAccessor) => {
99
+ const { limit } = options;
100
+ const historyLimit = limit && limit > 0 ? Math.max(0, limit - 1) : undefined;
101
+ const { historyDataPoints } = storeData;
102
+ const currentData = dataAccessor.getCurrentData(storeData);
103
+ const limitedHistoryPoints = historyLimit !== undefined ? historyDataPoints.slice(-historyLimit) : historyDataPoints;
104
+ const firstOriginalIndex = historyLimit !== undefined ? Math.max(0, historyDataPoints.length - historyLimit) : 0;
105
+ const convertedHistoryPoints = limitedHistoryPoints.map((point, index) => {
106
+ const originalIndex = firstOriginalIndex + index;
107
+ return {
108
+ name: point.name,
109
+ originalIndex,
110
+ statistic: dataAccessor.getHistoricalData(point),
111
+ };
112
+ });
113
+ const allValues = dataAccessor.getAllValues();
114
+ const currentTrendData = getTrendDataGeneric(normalizeStatistic(currentData, allValues), context.reportName, historyDataPoints.length + 1, allValues, options);
115
+ const historicalTrendData = convertedHistoryPoints.reduce((acc, historyPoint) => {
116
+ const trendDataPart = getTrendDataGeneric(normalizeStatistic(historyPoint.statistic, allValues), historyPoint.name, historyPoint.originalIndex + 1, allValues, options);
117
+ return mergeTrendDataGeneric(acc, trendDataPart, allValues);
118
+ }, {
119
+ type: options.type,
120
+ dataType: options.dataType,
121
+ mode: options.mode,
122
+ title: options.title,
123
+ points: {},
124
+ slices: {},
125
+ series: createEmptySeries(allValues),
126
+ min: Infinity,
127
+ max: -Infinity,
128
+ });
129
+ return mergeTrendDataGeneric(historicalTrendData, currentTrendData, allValues);
130
+ };
131
+ export const generateTrendChart = (options, storeData, context) => {
132
+ const newOptions = { limit: DEFAULT_CHART_HISTORY_LIMIT, ...options };
133
+ const { dataType } = newOptions;
134
+ if (dataType === ChartDataType.Status) {
135
+ return generateTrendChartGeneric(newOptions, storeData, context, statusTrendDataAccessor);
136
+ }
137
+ else if (dataType === ChartDataType.Severity) {
138
+ return generateTrendChartGeneric(newOptions, storeData, context, severityTrendDataAccessor);
139
+ }
140
+ };
@@ -0,0 +1,6 @@
1
+ import type { Statistic } from "@allurereport/core-api";
2
+ import type { PieChartData, PieChartOptions } from "../charts.js";
3
+ export declare const getPieChartData: (stats: Statistic, chartOptions: PieChartOptions) => PieChartData;
4
+ export declare const generatePieChart: (options: PieChartOptions, stores: {
5
+ statistic: Statistic;
6
+ }) => PieChartData;
@@ -0,0 +1,10 @@
1
+ import { getPieChartValues } from "@allurereport/core-api";
2
+ export const getPieChartData = (stats, chartOptions) => ({
3
+ type: chartOptions.type,
4
+ title: chartOptions?.title,
5
+ ...getPieChartValues(stats),
6
+ });
7
+ export const generatePieChart = (options, stores) => {
8
+ const { statistic } = stores;
9
+ return getPieChartData(statistic, options);
10
+ };
@@ -0,0 +1,6 @@
1
+ import type { TreeData, TreeGroup, TreeLeaf, TreeMapNode, WithChildren } from "@allurereport/core-api";
2
+ import type { AllureChartsStoreData, TreeMapChartData, TreeMapChartOptions, TreeMapDataAccessor } from "../charts.js";
3
+ export declare const convertTreeDataToTreeMapNode: <T extends TreeMapNode, L, G>(treeData: TreeData<L, G>, transform: (treeDataNode: TreeLeaf<L> | TreeGroup<G>, isGroup: boolean, parentNode?: TreeGroup<G>) => T, transformRoot?: (root: WithChildren) => T) => T;
4
+ export declare const transformTreeMapNode: <T extends TreeMapNode>(tree: T, transform: (node: T) => T) => T;
5
+ export declare const generateTreeMapChartGeneric: <T extends TreeMapNode>(options: TreeMapChartOptions, storeData: AllureChartsStoreData, dataAccessor: TreeMapDataAccessor<T>) => TreeMapChartData | undefined;
6
+ export declare const generateTreeMapChart: (options: TreeMapChartOptions, storeData: AllureChartsStoreData) => TreeMapChartData | undefined;
@@ -0,0 +1,88 @@
1
+ import { TreeMapChartType } from "@allurereport/core-api";
2
+ import { coverageDiffTreeMapAccessor } from "./accessors/coverageDiffTreeMapAccessor.js";
3
+ import { successRateDistributionTreeMapAccessor } from "./accessors/successRateDistributionTreeMapAccessor.js";
4
+ export const convertTreeDataToTreeMapNode = (treeData, transform, transformRoot = () => ({
5
+ id: "root",
6
+ value: undefined,
7
+ })) => {
8
+ const { root, leavesById, groupsById } = treeData;
9
+ const convertNode = (nodeId, parentGroup, isGroup) => {
10
+ const node = isGroup ? groupsById[nodeId] : leavesById[nodeId];
11
+ if (!node) {
12
+ return null;
13
+ }
14
+ const treeMapNode = transform(node, isGroup, parentGroup);
15
+ if (isGroup) {
16
+ const group = node;
17
+ const children = [];
18
+ if (group.groups) {
19
+ group.groups.forEach((groupId) => {
20
+ const childNode = convertNode(groupId, group, true);
21
+ if (childNode) {
22
+ children.push(childNode);
23
+ }
24
+ });
25
+ }
26
+ if (group.leaves) {
27
+ group.leaves.forEach((leafId) => {
28
+ const childNode = convertNode(leafId, group, false);
29
+ if (childNode) {
30
+ children.push(childNode);
31
+ }
32
+ });
33
+ }
34
+ if (children.length === 0) {
35
+ return null;
36
+ }
37
+ treeMapNode.children = children;
38
+ }
39
+ return treeMapNode;
40
+ };
41
+ const rootChildren = [];
42
+ if (root.groups) {
43
+ root.groups.forEach((groupId) => {
44
+ const childNode = convertNode(groupId, root, true);
45
+ if (childNode) {
46
+ rootChildren.push(childNode);
47
+ }
48
+ });
49
+ }
50
+ if (root.leaves) {
51
+ root.leaves.forEach((leafId) => {
52
+ const childNode = convertNode(leafId, root, false);
53
+ if (childNode) {
54
+ rootChildren.push(childNode);
55
+ }
56
+ });
57
+ }
58
+ return {
59
+ children: rootChildren.length > 0 ? rootChildren : undefined,
60
+ ...transformRoot(root),
61
+ };
62
+ };
63
+ export const transformTreeMapNode = (tree, transform) => {
64
+ const transformedNode = transform(tree);
65
+ if (transformedNode.children) {
66
+ const transformedChildren = transformedNode.children.map((child) => transformTreeMapNode(child, transform));
67
+ return {
68
+ ...transformedNode,
69
+ children: transformedChildren,
70
+ };
71
+ }
72
+ return transformedNode;
73
+ };
74
+ export const generateTreeMapChartGeneric = (options, storeData, dataAccessor) => ({
75
+ type: options.type,
76
+ dataType: options.dataType,
77
+ title: options.title,
78
+ treeMap: dataAccessor.getTreeMap(storeData),
79
+ });
80
+ export const generateTreeMapChart = (options, storeData) => {
81
+ const { dataType } = options;
82
+ if (dataType === TreeMapChartType.SuccessRateDistribution) {
83
+ return generateTreeMapChartGeneric(options, storeData, successRateDistributionTreeMapAccessor);
84
+ }
85
+ else if (dataType === TreeMapChartType.CoverageDiff) {
86
+ return generateTreeMapChartGeneric(options, storeData, coverageDiffTreeMapAccessor);
87
+ }
88
+ };
package/dist/charts.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- import type { BaseTrendSliceMetadata, ChartId, ChartType, HistoryDataPoint, PieSlice, SeverityLevel, Statistic, TestResult, TestStatus, TrendPoint, TrendPointId, TrendSlice, TrendSliceId } from "@allurereport/core-api";
2
- import { ChartDataType, ChartMode } from "@allurereport/core-api";
3
- import type { PluginContext } from "./plugin.js";
1
+ import type { BarChartType, BarGroup, BarGroupMode, BaseTrendSliceMetadata, ChartDataType, ChartId, ChartMode, ChartType, HeatMapSerie, HistoryDataPoint, HistoryTestResult, PieSlice, SeverityLevel, Statistic, TestResult, TestStatus, TreeMapChartType, TreeMapNode, TrendPoint, TrendPointId, TrendSlice, TrendSliceId } from "@allurereport/core-api";
4
2
  export type ExecutionIdFn = (executionOrder: number) => string;
5
3
  export type ExecutionNameFn = (executionOrder: number) => string;
6
4
  export type TrendMetadataFnOverrides = {
@@ -8,6 +6,7 @@ export type TrendMetadataFnOverrides = {
8
6
  executionNameAccessor?: ExecutionNameFn;
9
7
  };
10
8
  export type TrendDataType = TestStatus | SeverityLevel;
9
+ export type TrendStats<T extends TrendDataType> = Record<T, number>;
11
10
  export type TrendCalculationResult<T extends TrendDataType> = {
12
11
  points: Record<TrendPointId, TrendPoint>;
13
12
  series: Record<T, TrendPointId[]>;
@@ -26,9 +25,39 @@ export interface GenericTrendChartData<SeriesType extends string, Metadata exten
26
25
  export type StatusTrendChartData = GenericTrendChartData<TestStatus>;
27
26
  export type SeverityTrendChartData = GenericTrendChartData<SeverityLevel>;
28
27
  export type TrendChartData = StatusTrendChartData | SeverityTrendChartData;
29
- export type GeneratedChartData = TrendChartData | PieChartData | ComingSoonChartData;
28
+ export interface BarChartData {
29
+ type: ChartType.Bar;
30
+ dataType: BarChartType;
31
+ mode: ChartMode;
32
+ title?: string;
33
+ data: BarGroup<string, string>[];
34
+ keys: readonly string[];
35
+ indexBy: string;
36
+ groupMode: BarGroupMode;
37
+ }
38
+ export interface TreeMapChartData {
39
+ type: ChartType.TreeMap;
40
+ dataType: TreeMapChartType;
41
+ title?: string;
42
+ treeMap: TreeMapNode;
43
+ }
44
+ export interface HeatMapChartData<T extends Record<string, any> = {}> {
45
+ type: ChartType.HeatMap;
46
+ title?: string;
47
+ data: HeatMapSerie<T>[];
48
+ }
49
+ export interface PieChartData {
50
+ type: ChartType.Pie;
51
+ title?: string;
52
+ slices: PieSlice[];
53
+ percentage: number;
54
+ }
55
+ export interface ComingSoonChartData {
56
+ type: ChartType.ComingSoon;
57
+ title?: string;
58
+ }
59
+ export type GeneratedChartData = TrendChartData | PieChartData | BarChartData | ComingSoonChartData | TreeMapChartData | HeatMapChartData;
30
60
  export type GeneratedChartsData = Record<ChartId, GeneratedChartData>;
31
- export type TrendStats<T extends TrendDataType> = Record<T, number>;
32
61
  export type TrendChartOptions = {
33
62
  type: ChartType.Trend;
34
63
  dataType: ChartDataType;
@@ -41,45 +70,61 @@ export type PieChartOptions = {
41
70
  type: ChartType.Pie;
42
71
  title?: string;
43
72
  };
44
- export type ComingSoonChartOptions = {
45
- type: ChartType.HeatMap | ChartType.Bar | ChartType.Funnel | ChartType.TreeMap;
73
+ export type BarChartOptions = {
74
+ type: ChartType.Bar;
75
+ dataType: BarChartType;
76
+ mode?: ChartMode;
46
77
  title?: string;
78
+ limit?: number;
47
79
  };
48
- export type ChartOptions = TrendChartOptions | PieChartOptions | ComingSoonChartOptions;
49
- export interface PieChartData {
50
- type: ChartType.Pie;
80
+ export type TreeMapChartOptions = {
81
+ type: ChartType.TreeMap;
82
+ dataType: TreeMapChartType;
51
83
  title?: string;
52
- slices: PieSlice[];
53
- percentage: number;
54
- }
55
- export interface ComingSoonChartData {
56
- type: ChartType.HeatMap | ChartType.Bar | ChartType.Funnel | ChartType.TreeMap;
84
+ };
85
+ export type HeatMapChartOptions = {
86
+ type: ChartType.HeatMap;
57
87
  title?: string;
58
- }
59
- export declare const createEmptySeries: <T extends TrendDataType>(items: readonly T[]) => Record<T, string[]>;
60
- export declare const calculatePercentValues: <T extends TrendDataType>(stats: Record<T, number>, executionId: string, itemType: readonly T[]) => TrendCalculationResult<T>;
61
- export declare const getTrendDataGeneric: <T extends TrendDataType, M extends BaseTrendSliceMetadata>(stats: Record<T, number>, reportName: string, executionOrder: number, itemType: readonly T[], chartOptions: TrendChartOptions) => GenericTrendChartData<T, M>;
62
- export declare const createEmptyStats: <T extends TrendDataType>(items: readonly T[]) => TrendStats<T>;
63
- export declare const normalizeStatistic: <T extends TrendDataType>(statistic: Partial<TrendStats<T>>, itemType: readonly T[]) => TrendStats<T>;
64
- export declare const mergeTrendDataGeneric: <T extends TrendDataType, M extends BaseTrendSliceMetadata>(trendData: GenericTrendChartData<T, M>, trendDataPart: GenericTrendChartData<T, M>, itemType: readonly T[]) => GenericTrendChartData<T, M>;
65
- export declare const DEFAULT_CHART_HISTORY_LIMIT = 10;
66
- export declare const getPieChartData: (stats: Statistic, chartOptions: PieChartOptions) => PieChartData;
67
- export declare const generatePieChart: (options: PieChartOptions, stores: {
88
+ };
89
+ export type ComingSoonChartOptions = {
90
+ type: ChartType.ComingSoon;
91
+ title?: string;
92
+ };
93
+ export type ChartOptions = TrendChartOptions | PieChartOptions | BarChartOptions | ComingSoonChartOptions | TreeMapChartOptions | HeatMapChartOptions;
94
+ export interface AllureChartsStoreData {
95
+ historyDataPoints: HistoryDataPoint[];
96
+ testResults: TestResult[];
68
97
  statistic: Statistic;
69
- }) => PieChartData;
70
- export declare const generateComingSoonChart: (options: ComingSoonChartOptions) => ComingSoonChartData;
98
+ }
71
99
  export interface TrendDataAccessor<T extends TrendDataType> {
72
- getCurrentData: (trs: TestResult[], stats: Statistic) => TrendStats<T>;
100
+ getCurrentData: (storeData: AllureChartsStoreData) => TrendStats<T>;
73
101
  getHistoricalData: (historyPoint: HistoryDataPoint) => TrendStats<T>;
74
102
  getAllValues: () => readonly T[];
75
103
  }
76
- export declare const generateTrendChartGeneric: <T extends TrendDataType>(options: TrendChartOptions, stores: {
77
- trs: TestResult[];
78
- statistic: Statistic;
79
- history: HistoryDataPoint[];
80
- }, context: PluginContext, dataAccessor: TrendDataAccessor<T>) => GenericTrendChartData<T> | undefined;
81
- export declare const generateTrendChart: (options: TrendChartOptions, stores: {
82
- trs: TestResult[];
83
- statistic: Statistic;
84
- history: HistoryDataPoint[];
85
- }, context: PluginContext) => TrendChartData | undefined;
104
+ export interface BarDataAccessor<G extends string, T extends string> {
105
+ getItems: (storeData: AllureChartsStoreData, limitedHistoryDataPoints: HistoryDataPoint[], isFullHistory: boolean) => BarGroup<G, T>[];
106
+ getGroupKeys: () => readonly T[];
107
+ getGroupMode: () => BarGroupMode;
108
+ }
109
+ export interface TreeMapDataAccessor<T extends TreeMapNode> {
110
+ getTreeMap: (storeData: AllureChartsStoreData) => T;
111
+ }
112
+ export interface HeatMapDataAccessor<T extends Record<string, unknown> = {}> {
113
+ getHeatMap: (storeData: AllureChartsStoreData) => HeatMapSerie<T>[];
114
+ }
115
+ export declare const DEFAULT_CHART_HISTORY_LIMIT = 10;
116
+ export declare const limitHistoryDataPoints: (historyDataPoints: HistoryDataPoint[], limit: number) => HistoryDataPoint[];
117
+ export declare const createEmptySeries: <T extends string>(items: readonly T[]) => Record<T, string[]>;
118
+ export declare const createEmptyStats: <T extends string>(items: readonly T[]) => Record<T, number>;
119
+ export declare const normalizeStatistic: <T extends string>(statistic: Partial<Record<T, number>>, itemType: readonly T[]) => Record<T, number>;
120
+ export declare const hasLabels: <T extends string, TR extends TestResult | HistoryTestResult>(test: TR, labelHierarchy: T[]) => boolean;
121
+ export declare const isChildrenLeavesOnly: <T extends TreeMapNode>(node: T) => boolean;
122
+ export declare const defaultChartsConfig: ({
123
+ type: string;
124
+ title: string;
125
+ dataType?: undefined;
126
+ } | {
127
+ type: string;
128
+ dataType: string;
129
+ title: string;
130
+ })[];