@code-pushup/models 0.53.1 → 0.55.0

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
@@ -29,7 +29,7 @@ function exists(value) {
29
29
  return value != null;
30
30
  }
31
31
  function getMissingRefsForCategories(categories, plugins) {
32
- if (categories.length === 0) {
32
+ if (!categories || categories.length === 0) {
33
33
  return false;
34
34
  }
35
35
  const auditRefsFromCategory = categories.flatMap(
@@ -106,7 +106,6 @@ var fileNameSchema = z.string().trim().regex(filenameRegex, {
106
106
  message: `The filename has to be valid`
107
107
  }).min(1, { message: "file name is invalid" });
108
108
  var positiveIntSchema = z.number().int().positive();
109
- var nonnegativeIntSchema = z.number().int().nonnegative();
110
109
  var nonnegativeNumberSchema = z.number().nonnegative();
111
110
  function packageVersionSchema(options) {
112
111
  const { versionDescription = "NPM version of the package", required } = options ?? {};
@@ -530,12 +529,9 @@ var unrefinedCoreConfigSchema = z14.object({
530
529
  var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
531
530
  function refineCoreConfig(schema) {
532
531
  return schema.refine(
533
- (coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
534
- (coreCfg) => ({
535
- message: missingRefsForCategoriesErrorMsg(
536
- coreCfg.categories ?? [],
537
- coreCfg.plugins
538
- )
532
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
533
+ ({ categories, plugins }) => ({
534
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
539
535
  })
540
536
  );
541
537
  }
@@ -596,19 +592,16 @@ var reportSchema = packageVersionSchema({
596
592
  ).merge(
597
593
  z15.object(
598
594
  {
599
- categories: z15.array(categoryConfigSchema),
600
595
  plugins: z15.array(pluginReportSchema).min(1),
596
+ categories: z15.array(categoryConfigSchema).optional(),
601
597
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
602
598
  },
603
599
  { description: "Collect output data" }
604
600
  )
605
601
  ).refine(
606
- (report) => !getMissingRefsForCategories(report.categories, report.plugins),
607
- (report) => ({
608
- message: missingRefsForCategoriesErrorMsg(
609
- report.categories,
610
- report.plugins
611
- )
602
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
603
+ ({ categories, plugins }) => ({
604
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
612
605
  })
613
606
  );
614
607
 
@@ -660,7 +653,7 @@ var auditDiffSchema = scorableWithPluginDiffSchema.merge(
660
653
  z16.object({
661
654
  values: makeComparisonSchema(auditValueSchema).merge(
662
655
  z16.object({
663
- diff: z16.number().int().describe("Value change (`values.after - values.before`)")
656
+ diff: z16.number().describe("Value change (`values.after - values.before`)")
664
657
  })
665
658
  ).describe("Audit `value` comparison"),
666
659
  displayValues: makeComparisonSchema(auditDisplayValueSchema).describe(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/models",
3
- "version": "0.53.1",
3
+ "version": "0.55.0",
4
4
  "license": "MIT",
5
5
  "description": "Model definitions and validators for the Code PushUp CLI",
6
6
  "homepage": "https://github.com/code-pushup/cli/tree/main/packages/models#readme",
package/src/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { type AuditDetails, type AuditOutput, type AuditOutputs, auditDetailsSch
5
5
  export { type CategoryConfig, type CategoryRef, categoryConfigSchema, categoryRefSchema, } from './lib/category-config';
6
6
  export { type Commit, commitSchema } from './lib/commit';
7
7
  export { type CoreConfig, coreConfigSchema } from './lib/core-config';
8
- export { type Group, type GroupRef, groupRefSchema, groupSchema, } from './lib/group';
8
+ export { type Group, type GroupRef, type GroupMeta, groupRefSchema, groupSchema, } from './lib/group';
9
9
  export { CONFIG_FILE_NAME, SUPPORTED_CONFIG_FILE_FORMATS, } from './lib/implementation/configuration';
10
10
  export { DEFAULT_PERSIST_FILENAME, DEFAULT_PERSIST_FORMAT, DEFAULT_PERSIST_OUTPUT_DIR, } from './lib/implementation/constants';
11
11
  export { MAX_DESCRIPTION_LENGTH, MAX_ISSUE_MESSAGE_LENGTH, MAX_SLUG_LENGTH, MAX_TITLE_LENGTH, } from './lib/implementation/limits';