@code-pushup/models 0.54.0 → 0.56.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(
@@ -529,12 +529,9 @@ var unrefinedCoreConfigSchema = z14.object({
529
529
  var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
530
530
  function refineCoreConfig(schema) {
531
531
  return schema.refine(
532
- (coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
533
- (coreCfg) => ({
534
- message: missingRefsForCategoriesErrorMsg(
535
- coreCfg.categories ?? [],
536
- coreCfg.plugins
537
- )
532
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
533
+ ({ categories, plugins }) => ({
534
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
538
535
  })
539
536
  );
540
537
  }
@@ -595,19 +592,16 @@ var reportSchema = packageVersionSchema({
595
592
  ).merge(
596
593
  z15.object(
597
594
  {
598
- categories: z15.array(categoryConfigSchema),
599
595
  plugins: z15.array(pluginReportSchema).min(1),
596
+ categories: z15.array(categoryConfigSchema).optional(),
600
597
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
601
598
  },
602
599
  { description: "Collect output data" }
603
600
  )
604
601
  ).refine(
605
- (report) => !getMissingRefsForCategories(report.categories, report.plugins),
606
- (report) => ({
607
- message: missingRefsForCategoriesErrorMsg(
608
- report.categories,
609
- report.plugins
610
- )
602
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
603
+ ({ categories, plugins }) => ({
604
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
611
605
  })
612
606
  );
613
607
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/models",
3
- "version": "0.54.0",
3
+ "version": "0.56.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",
@@ -36,5 +36,5 @@ export declare function exists<T>(value: T): value is NonNullable<T>;
36
36
  * @param plugins
37
37
  * @returns Array of missing references.
38
38
  */
39
- export declare function getMissingRefsForCategories(categories: CategoryConfig[], plugins: PluginConfig[] | PluginReport[]): false | string[];
40
- export declare function missingRefsForCategoriesErrorMsg(categories: CategoryConfig[], plugins: PluginConfig[] | PluginReport[]): string;
39
+ export declare function getMissingRefsForCategories(categories: CategoryConfig[] | undefined, plugins: PluginConfig[] | PluginReport[]): false | string[];
40
+ export declare function missingRefsForCategoriesErrorMsg(categories: CategoryConfig[] | undefined, plugins: PluginConfig[] | PluginReport[]): string;
@@ -798,76 +798,6 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
798
798
  date: z.ZodString;
799
799
  duration: z.ZodNumber;
800
800
  }>, {
801
- categories: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
802
- slug: z.ZodString;
803
- refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
804
- slug: z.ZodString;
805
- weight: z.ZodNumber;
806
- }, {
807
- type: z.ZodEnum<["audit", "group"]>;
808
- plugin: z.ZodString;
809
- }>, "strip", z.ZodTypeAny, {
810
- slug: string;
811
- weight: number;
812
- type: "audit" | "group";
813
- plugin: string;
814
- }, {
815
- slug: string;
816
- weight: number;
817
- type: "audit" | "group";
818
- plugin: string;
819
- }>, "many">, {
820
- slug: string;
821
- weight: number;
822
- type: "audit" | "group";
823
- plugin: string;
824
- }[], {
825
- slug: string;
826
- weight: number;
827
- type: "audit" | "group";
828
- plugin: string;
829
- }[]>, {
830
- slug: string;
831
- weight: number;
832
- type: "audit" | "group";
833
- plugin: string;
834
- }[], {
835
- slug: string;
836
- weight: number;
837
- type: "audit" | "group";
838
- plugin: string;
839
- }[]>;
840
- }, {
841
- title: z.ZodString;
842
- description: z.ZodOptional<z.ZodString>;
843
- docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
844
- }>, {
845
- isBinary: z.ZodOptional<z.ZodBoolean>;
846
- }>, "strip", z.ZodTypeAny, {
847
- slug: string;
848
- refs: {
849
- slug: string;
850
- weight: number;
851
- type: "audit" | "group";
852
- plugin: string;
853
- }[];
854
- title: string;
855
- description?: string | undefined;
856
- docsUrl?: string | undefined;
857
- isBinary?: boolean | undefined;
858
- }, {
859
- slug: string;
860
- refs: {
861
- slug: string;
862
- weight: number;
863
- type: "audit" | "group";
864
- plugin: string;
865
- }[];
866
- title: string;
867
- description?: string | undefined;
868
- docsUrl?: string | undefined;
869
- isBinary?: boolean | undefined;
870
- }>, "many">;
871
801
  plugins: z.ZodArray<z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
872
802
  packageName: z.ZodString | z.ZodOptional<z.ZodString>;
873
803
  version: z.ZodString | z.ZodOptional<z.ZodString>;
@@ -1408,6 +1338,76 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
1408
1338
  docsUrl?: string | undefined;
1409
1339
  }[] | undefined;
1410
1340
  }>, "many">;
1341
+ categories: z.ZodOptional<z.ZodArray<z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
1342
+ slug: z.ZodString;
1343
+ refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
1344
+ slug: z.ZodString;
1345
+ weight: z.ZodNumber;
1346
+ }, {
1347
+ type: z.ZodEnum<["audit", "group"]>;
1348
+ plugin: z.ZodString;
1349
+ }>, "strip", z.ZodTypeAny, {
1350
+ slug: string;
1351
+ weight: number;
1352
+ type: "audit" | "group";
1353
+ plugin: string;
1354
+ }, {
1355
+ slug: string;
1356
+ weight: number;
1357
+ type: "audit" | "group";
1358
+ plugin: string;
1359
+ }>, "many">, {
1360
+ slug: string;
1361
+ weight: number;
1362
+ type: "audit" | "group";
1363
+ plugin: string;
1364
+ }[], {
1365
+ slug: string;
1366
+ weight: number;
1367
+ type: "audit" | "group";
1368
+ plugin: string;
1369
+ }[]>, {
1370
+ slug: string;
1371
+ weight: number;
1372
+ type: "audit" | "group";
1373
+ plugin: string;
1374
+ }[], {
1375
+ slug: string;
1376
+ weight: number;
1377
+ type: "audit" | "group";
1378
+ plugin: string;
1379
+ }[]>;
1380
+ }, {
1381
+ title: z.ZodString;
1382
+ description: z.ZodOptional<z.ZodString>;
1383
+ docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
1384
+ }>, {
1385
+ isBinary: z.ZodOptional<z.ZodBoolean>;
1386
+ }>, "strip", z.ZodTypeAny, {
1387
+ slug: string;
1388
+ refs: {
1389
+ slug: string;
1390
+ weight: number;
1391
+ type: "audit" | "group";
1392
+ plugin: string;
1393
+ }[];
1394
+ title: string;
1395
+ description?: string | undefined;
1396
+ docsUrl?: string | undefined;
1397
+ isBinary?: boolean | undefined;
1398
+ }, {
1399
+ slug: string;
1400
+ refs: {
1401
+ slug: string;
1402
+ weight: number;
1403
+ type: "audit" | "group";
1404
+ plugin: string;
1405
+ }[];
1406
+ title: string;
1407
+ description?: string | undefined;
1408
+ docsUrl?: string | undefined;
1409
+ isBinary?: boolean | undefined;
1410
+ }>, "many">>;
1411
1411
  commit: z.ZodNullable<z.ZodObject<{
1412
1412
  hash: z.ZodString;
1413
1413
  message: z.ZodString;
@@ -1429,19 +1429,6 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
1429
1429
  packageName: string;
1430
1430
  version: string;
1431
1431
  duration: number;
1432
- categories: {
1433
- slug: string;
1434
- refs: {
1435
- slug: string;
1436
- weight: number;
1437
- type: "audit" | "group";
1438
- plugin: string;
1439
- }[];
1440
- title: string;
1441
- description?: string | undefined;
1442
- docsUrl?: string | undefined;
1443
- isBinary?: boolean | undefined;
1444
- }[];
1445
1432
  plugins: {
1446
1433
  slug: string;
1447
1434
  date: string;
@@ -1506,12 +1493,7 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
1506
1493
  hash: string;
1507
1494
  author: string;
1508
1495
  } | null;
1509
- }, {
1510
- date: string;
1511
- packageName: string;
1512
- version: string;
1513
- duration: number;
1514
- categories: {
1496
+ categories?: {
1515
1497
  slug: string;
1516
1498
  refs: {
1517
1499
  slug: string;
@@ -1523,7 +1505,12 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
1523
1505
  description?: string | undefined;
1524
1506
  docsUrl?: string | undefined;
1525
1507
  isBinary?: boolean | undefined;
1526
- }[];
1508
+ }[] | undefined;
1509
+ }, {
1510
+ date: string;
1511
+ packageName: string;
1512
+ version: string;
1513
+ duration: number;
1527
1514
  plugins: {
1528
1515
  slug: string;
1529
1516
  date: string;
@@ -1588,12 +1575,7 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
1588
1575
  hash: string;
1589
1576
  author: string;
1590
1577
  } | null;
1591
- }>, {
1592
- date: string;
1593
- packageName: string;
1594
- version: string;
1595
- duration: number;
1596
- categories: {
1578
+ categories?: {
1597
1579
  slug: string;
1598
1580
  refs: {
1599
1581
  slug: string;
@@ -1605,7 +1587,12 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
1605
1587
  description?: string | undefined;
1606
1588
  docsUrl?: string | undefined;
1607
1589
  isBinary?: boolean | undefined;
1608
- }[];
1590
+ }[] | undefined;
1591
+ }>, {
1592
+ date: string;
1593
+ packageName: string;
1594
+ version: string;
1595
+ duration: number;
1609
1596
  plugins: {
1610
1597
  slug: string;
1611
1598
  date: string;
@@ -1670,12 +1657,7 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
1670
1657
  hash: string;
1671
1658
  author: string;
1672
1659
  } | null;
1673
- }, {
1674
- date: string;
1675
- packageName: string;
1676
- version: string;
1677
- duration: number;
1678
- categories: {
1660
+ categories?: {
1679
1661
  slug: string;
1680
1662
  refs: {
1681
1663
  slug: string;
@@ -1687,7 +1669,12 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
1687
1669
  description?: string | undefined;
1688
1670
  docsUrl?: string | undefined;
1689
1671
  isBinary?: boolean | undefined;
1690
- }[];
1672
+ }[] | undefined;
1673
+ }, {
1674
+ date: string;
1675
+ packageName: string;
1676
+ version: string;
1677
+ duration: number;
1691
1678
  plugins: {
1692
1679
  slug: string;
1693
1680
  date: string;
@@ -1752,5 +1739,18 @@ export declare const reportSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendS
1752
1739
  hash: string;
1753
1740
  author: string;
1754
1741
  } | null;
1742
+ categories?: {
1743
+ slug: string;
1744
+ refs: {
1745
+ slug: string;
1746
+ weight: number;
1747
+ type: "audit" | "group";
1748
+ plugin: string;
1749
+ }[];
1750
+ title: string;
1751
+ description?: string | undefined;
1752
+ docsUrl?: string | undefined;
1753
+ isBinary?: boolean | undefined;
1754
+ }[] | undefined;
1755
1755
  }>;
1756
1756
  export type Report = z.infer<typeof reportSchema>;