@code-pushup/core 0.42.1 → 0.44.1

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.
package/index.js CHANGED
@@ -2453,7 +2453,7 @@ var verboseUtils = (verbose = false) => ({
2453
2453
 
2454
2454
  // packages/core/package.json
2455
2455
  var name = "@code-pushup/core";
2456
- var version = "0.42.1";
2456
+ var version = "0.44.1";
2457
2457
 
2458
2458
  // packages/core/src/lib/implementation/execute-plugin.ts
2459
2459
  import chalk5 from "chalk";
@@ -2907,7 +2907,8 @@ import {
2907
2907
  import {
2908
2908
  CategoryConfigRefType as PortalCategoryRefType,
2909
2909
  IssueSeverity as PortalIssueSeverity,
2910
- IssueSourceType as PortalIssueSourceType
2910
+ IssueSourceType as PortalIssueSourceType,
2911
+ TableAlignment as PortalTableAlignment
2911
2912
  } from "@code-pushup/portal-client";
2912
2913
  function reportToGQL(report) {
2913
2914
  return {
@@ -2953,10 +2954,7 @@ function auditToGQL(audit) {
2953
2954
  displayValue: formattedValue,
2954
2955
  details: details4
2955
2956
  } = audit;
2956
- const {
2957
- issues
2958
- /*, table */
2959
- } = details4 ?? {};
2957
+ const { issues, table: table5 } = details4 ?? {};
2960
2958
  return {
2961
2959
  slug,
2962
2960
  title,
@@ -2967,9 +2965,8 @@ function auditToGQL(audit) {
2967
2965
  formattedValue,
2968
2966
  ...details4 && {
2969
2967
  details: {
2970
- ...issues && { issues: issues.map(issueToGQL) }
2971
- // @TODO add when https://github.com/code-pushup/cli/issues/530 is implemented
2972
- // ...(table ? {table} : {}),
2968
+ ...issues && { issues: issues.map(issueToGQL) },
2969
+ ...table5 && { tables: [tableToGQL(table5)] }
2973
2970
  }
2974
2971
  }
2975
2972
  };
@@ -2988,6 +2985,26 @@ function issueToGQL(issue) {
2988
2985
  }
2989
2986
  };
2990
2987
  }
2988
+ function tableToGQL(table5) {
2989
+ return {
2990
+ ...table5.title && { title: table5.title },
2991
+ ...table5.columns?.length && {
2992
+ columns: table5.columns.map(
2993
+ (column) => typeof column === "string" ? { alignment: tableAlignmentToGQL(column) } : {
2994
+ key: column.key,
2995
+ label: column.label,
2996
+ alignment: column.align && tableAlignmentToGQL(column.align)
2997
+ }
2998
+ )
2999
+ },
3000
+ rows: table5.rows.map(
3001
+ (row) => Array.isArray(row) ? row.map((content) => ({ content: content.toString() })) : Object.entries(row).map(([key, content]) => ({
3002
+ key,
3003
+ content: content.toString()
3004
+ }))
3005
+ )
3006
+ };
3007
+ }
2991
3008
  function categoryToGQL(category) {
2992
3009
  return {
2993
3010
  slug: category.slug,
@@ -3020,6 +3037,16 @@ function issueSeverityToGQL(severity) {
3020
3037
  return PortalIssueSeverity.Warning;
3021
3038
  }
3022
3039
  }
3040
+ function tableAlignmentToGQL(alignment) {
3041
+ switch (alignment) {
3042
+ case "left":
3043
+ return PortalTableAlignment.Left;
3044
+ case "center":
3045
+ return PortalTableAlignment.Center;
3046
+ case "right":
3047
+ return PortalTableAlignment.Right;
3048
+ }
3049
+ }
3023
3050
 
3024
3051
  // packages/core/src/lib/upload.ts
3025
3052
  async function upload(options, uploadFn = uploadToPortal) {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@code-pushup/core",
3
- "version": "0.42.1",
3
+ "version": "0.44.1",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "@code-pushup/models": "0.42.1",
7
- "@code-pushup/utils": "0.42.1",
8
- "@code-pushup/portal-client": "^0.6.1",
6
+ "@code-pushup/models": "0.44.1",
7
+ "@code-pushup/utils": "0.44.1",
8
+ "@code-pushup/portal-client": "^0.7.0",
9
9
  "chalk": "^5.3.0"
10
10
  },
11
11
  "type": "module",
@@ -1,4 +1,5 @@
1
- import { type AuditReportIssue as PortalIssue, type SaveReportMutationVariables } from '@code-pushup/portal-client';
2
- import { Issue, Report } from '@code-pushup/models';
1
+ import { type AuditReportIssue as PortalIssue, type AuditReportTable as PortalTable, type SaveReportMutationVariables } from '@code-pushup/portal-client';
2
+ import type { Issue, Report, Table } from '@code-pushup/models';
3
3
  export declare function reportToGQL(report: Report): Omit<SaveReportMutationVariables, 'organization' | 'project' | 'commit'>;
4
4
  export declare function issueToGQL(issue: Issue): PortalIssue;
5
+ export declare function tableToGQL(table: Table): PortalTable;