@code-pushup/models 0.4.4 → 0.5.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 +11 -6
- package/package.json +1 -1
- package/src/lib/category-config.d.ts +11 -1
- package/src/lib/core-config.d.ts +18 -2
- package/src/lib/implementation/schemas.d.ts +1 -1
- package/src/lib/plugin-config-groups.d.ts +14 -2
- package/src/lib/plugin-config.d.ts +14 -2
- package/src/lib/report.d.ts +25 -3
package/index.js
CHANGED
|
@@ -118,12 +118,14 @@ function scorableSchema(description, refSchema, duplicateCheckFn, duplicateMessa
|
|
|
118
118
|
return z.object(
|
|
119
119
|
{
|
|
120
120
|
slug: slugSchema('Human-readable unique ID, e.g. "performance"'),
|
|
121
|
-
refs: z.array(refSchema).refine(
|
|
121
|
+
refs: z.array(refSchema).min(1).refine(
|
|
122
122
|
(refs) => !duplicateCheckFn(refs),
|
|
123
123
|
(refs) => ({
|
|
124
124
|
message: duplicateMessageFn(refs)
|
|
125
125
|
})
|
|
126
|
-
)
|
|
126
|
+
).refine(hasWeightedRefsInCategories, () => ({
|
|
127
|
+
message: `In a category there has to be at least one ref with weight > 0`
|
|
128
|
+
}))
|
|
127
129
|
},
|
|
128
130
|
{ description }
|
|
129
131
|
);
|
|
@@ -132,6 +134,9 @@ var materialIconSchema = z.enum(
|
|
|
132
134
|
MATERIAL_ICONS,
|
|
133
135
|
{ description: "Icon from VSCode Material Icons extension" }
|
|
134
136
|
);
|
|
137
|
+
function hasWeightedRefsInCategories(categoryRefs) {
|
|
138
|
+
return categoryRefs.reduce((acc, { weight }) => weight + acc, 0) !== 0;
|
|
139
|
+
}
|
|
135
140
|
|
|
136
141
|
// packages/models/src/lib/category-config.ts
|
|
137
142
|
var categoryRefSchema = weightedRefSchema(
|
|
@@ -429,10 +434,10 @@ var unrefinedCoreConfigSchema = z11.object({
|
|
|
429
434
|
upload: uploadConfigSchema.optional(),
|
|
430
435
|
categories: z11.array(categoryConfigSchema, {
|
|
431
436
|
description: "Categorization of individual audits"
|
|
432
|
-
}).refine(
|
|
433
|
-
(
|
|
434
|
-
(
|
|
435
|
-
message: duplicateSlugCategoriesErrorMsg(
|
|
437
|
+
}).min(1).refine(
|
|
438
|
+
(categories) => !getDuplicateSlugCategories(categories),
|
|
439
|
+
(categories) => ({
|
|
440
|
+
message: duplicateSlugCategoriesErrorMsg(categories)
|
|
436
441
|
})
|
|
437
442
|
)
|
|
438
443
|
});
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ export declare const categoryConfigSchema: z.ZodObject<{
|
|
|
21
21
|
title: z.ZodString;
|
|
22
22
|
docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString]>;
|
|
23
23
|
slug: z.ZodString;
|
|
24
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
24
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
25
25
|
slug: z.ZodString;
|
|
26
26
|
weight: z.ZodNumber;
|
|
27
27
|
type: z.ZodEnum<["audit", "group"]>;
|
|
@@ -46,6 +46,16 @@ export declare const categoryConfigSchema: z.ZodObject<{
|
|
|
46
46
|
slug: string;
|
|
47
47
|
weight: number;
|
|
48
48
|
plugin: string;
|
|
49
|
+
}[]>, {
|
|
50
|
+
type: "audit" | "group";
|
|
51
|
+
slug: string;
|
|
52
|
+
weight: number;
|
|
53
|
+
plugin: string;
|
|
54
|
+
}[], {
|
|
55
|
+
type: "audit" | "group";
|
|
56
|
+
slug: string;
|
|
57
|
+
weight: number;
|
|
58
|
+
plugin: string;
|
|
49
59
|
}[]>;
|
|
50
60
|
isBinary: z.ZodOptional<z.ZodBoolean>;
|
|
51
61
|
}, "strip", z.ZodTypeAny, {
|
package/src/lib/core-config.d.ts
CHANGED
|
@@ -844,7 +844,7 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
|
|
|
844
844
|
}[]>;
|
|
845
845
|
groups: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
846
846
|
slug: z.ZodString;
|
|
847
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
847
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
848
848
|
slug: z.ZodString;
|
|
849
849
|
weight: z.ZodNumber;
|
|
850
850
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -859,6 +859,12 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
|
|
|
859
859
|
}[], {
|
|
860
860
|
slug: string;
|
|
861
861
|
weight: number;
|
|
862
|
+
}[]>, {
|
|
863
|
+
slug: string;
|
|
864
|
+
weight: number;
|
|
865
|
+
}[], {
|
|
866
|
+
slug: string;
|
|
867
|
+
weight: number;
|
|
862
868
|
}[]>;
|
|
863
869
|
title: z.ZodString;
|
|
864
870
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -1717,7 +1723,7 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
|
|
|
1717
1723
|
title: z.ZodString;
|
|
1718
1724
|
docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString]>;
|
|
1719
1725
|
slug: z.ZodString;
|
|
1720
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
1726
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
1721
1727
|
slug: z.ZodString;
|
|
1722
1728
|
weight: z.ZodNumber;
|
|
1723
1729
|
type: z.ZodEnum<["audit", "group"]>;
|
|
@@ -1742,6 +1748,16 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
|
|
|
1742
1748
|
slug: string;
|
|
1743
1749
|
weight: number;
|
|
1744
1750
|
plugin: string;
|
|
1751
|
+
}[]>, {
|
|
1752
|
+
type: "audit" | "group";
|
|
1753
|
+
slug: string;
|
|
1754
|
+
weight: number;
|
|
1755
|
+
plugin: string;
|
|
1756
|
+
}[], {
|
|
1757
|
+
type: "audit" | "group";
|
|
1758
|
+
slug: string;
|
|
1759
|
+
weight: number;
|
|
1760
|
+
plugin: string;
|
|
1745
1761
|
}[]>;
|
|
1746
1762
|
isBinary: z.ZodOptional<z.ZodBoolean>;
|
|
1747
1763
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -108,7 +108,7 @@ export declare function weightedRefSchema(description: string, slugDescription:
|
|
|
108
108
|
export type WeightedRef = z.infer<ReturnType<typeof weightedRefSchema>>;
|
|
109
109
|
export declare function scorableSchema<T extends ReturnType<typeof weightedRefSchema>>(description: string, refSchema: T, duplicateCheckFn: (metrics: z.infer<T>[]) => false | string[], duplicateMessageFn: (metrics: z.infer<T>[]) => string): z.ZodObject<{
|
|
110
110
|
slug: z.ZodString;
|
|
111
|
-
refs: z.ZodEffects<z.ZodArray<T, "many">, T["_output"][], T["_input"][]>;
|
|
111
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<T, "many">, T["_output"][], T["_input"][]>, T["_output"][], T["_input"][]>;
|
|
112
112
|
}, "strip", z.ZodTypeAny, {
|
|
113
113
|
slug: string;
|
|
114
114
|
refs: T["_output"][];
|
|
@@ -26,7 +26,7 @@ export declare const auditGroupMetaSchema: z.ZodObject<{
|
|
|
26
26
|
export type AuditGroupMeta = z.infer<typeof auditGroupMetaSchema>;
|
|
27
27
|
export declare const auditGroupSchema: z.ZodObject<{
|
|
28
28
|
slug: z.ZodString;
|
|
29
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
29
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
30
30
|
slug: z.ZodString;
|
|
31
31
|
weight: z.ZodNumber;
|
|
32
32
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -41,6 +41,12 @@ export declare const auditGroupSchema: z.ZodObject<{
|
|
|
41
41
|
}[], {
|
|
42
42
|
slug: string;
|
|
43
43
|
weight: number;
|
|
44
|
+
}[]>, {
|
|
45
|
+
slug: string;
|
|
46
|
+
weight: number;
|
|
47
|
+
}[], {
|
|
48
|
+
slug: string;
|
|
49
|
+
weight: number;
|
|
44
50
|
}[]>;
|
|
45
51
|
title: z.ZodString;
|
|
46
52
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -67,7 +73,7 @@ export declare const auditGroupSchema: z.ZodObject<{
|
|
|
67
73
|
export type AuditGroup = z.infer<typeof auditGroupSchema>;
|
|
68
74
|
export declare const auditGroupsSchema: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
69
75
|
slug: z.ZodString;
|
|
70
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
76
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
71
77
|
slug: z.ZodString;
|
|
72
78
|
weight: z.ZodNumber;
|
|
73
79
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -82,6 +88,12 @@ export declare const auditGroupsSchema: z.ZodEffects<z.ZodOptional<z.ZodArray<z.
|
|
|
82
88
|
}[], {
|
|
83
89
|
slug: string;
|
|
84
90
|
weight: number;
|
|
91
|
+
}[]>, {
|
|
92
|
+
slug: string;
|
|
93
|
+
weight: number;
|
|
94
|
+
}[], {
|
|
95
|
+
slug: string;
|
|
96
|
+
weight: number;
|
|
85
97
|
}[]>;
|
|
86
98
|
title: z.ZodString;
|
|
87
99
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -862,7 +862,7 @@ export declare const pluginDataSchema: z.ZodObject<{
|
|
|
862
862
|
}[]>;
|
|
863
863
|
groups: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
864
864
|
slug: z.ZodString;
|
|
865
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
865
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
866
866
|
slug: z.ZodString;
|
|
867
867
|
weight: z.ZodNumber;
|
|
868
868
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -877,6 +877,12 @@ export declare const pluginDataSchema: z.ZodObject<{
|
|
|
877
877
|
}[], {
|
|
878
878
|
slug: string;
|
|
879
879
|
weight: number;
|
|
880
|
+
}[]>, {
|
|
881
|
+
slug: string;
|
|
882
|
+
weight: number;
|
|
883
|
+
}[], {
|
|
884
|
+
slug: string;
|
|
885
|
+
weight: number;
|
|
880
886
|
}[]>;
|
|
881
887
|
title: z.ZodString;
|
|
882
888
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -2139,7 +2145,7 @@ export declare const pluginConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2139
2145
|
}[]>;
|
|
2140
2146
|
groups: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2141
2147
|
slug: z.ZodString;
|
|
2142
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
2148
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
2143
2149
|
slug: z.ZodString;
|
|
2144
2150
|
weight: z.ZodNumber;
|
|
2145
2151
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -2154,6 +2160,12 @@ export declare const pluginConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2154
2160
|
}[], {
|
|
2155
2161
|
slug: string;
|
|
2156
2162
|
weight: number;
|
|
2163
|
+
}[]>, {
|
|
2164
|
+
slug: string;
|
|
2165
|
+
weight: number;
|
|
2166
|
+
}[], {
|
|
2167
|
+
slug: string;
|
|
2168
|
+
weight: number;
|
|
2157
2169
|
}[]>;
|
|
2158
2170
|
title: z.ZodString;
|
|
2159
2171
|
description: z.ZodOptional<z.ZodString>;
|
package/src/lib/report.d.ts
CHANGED
|
@@ -308,7 +308,7 @@ export declare const pluginReportSchema: z.ZodObject<{
|
|
|
308
308
|
}>, "many">;
|
|
309
309
|
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
310
310
|
slug: z.ZodString;
|
|
311
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
311
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
312
312
|
slug: z.ZodString;
|
|
313
313
|
weight: z.ZodNumber;
|
|
314
314
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -323,6 +323,12 @@ export declare const pluginReportSchema: z.ZodObject<{
|
|
|
323
323
|
}[], {
|
|
324
324
|
slug: string;
|
|
325
325
|
weight: number;
|
|
326
|
+
}[]>, {
|
|
327
|
+
slug: string;
|
|
328
|
+
weight: number;
|
|
329
|
+
}[], {
|
|
330
|
+
slug: string;
|
|
331
|
+
weight: number;
|
|
326
332
|
}[]>;
|
|
327
333
|
title: z.ZodString;
|
|
328
334
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -446,7 +452,7 @@ export declare const reportSchema: z.ZodObject<{
|
|
|
446
452
|
title: z.ZodString;
|
|
447
453
|
docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString]>;
|
|
448
454
|
slug: z.ZodString;
|
|
449
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
455
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
450
456
|
slug: z.ZodString;
|
|
451
457
|
weight: z.ZodNumber;
|
|
452
458
|
type: z.ZodEnum<["audit", "group"]>;
|
|
@@ -471,6 +477,16 @@ export declare const reportSchema: z.ZodObject<{
|
|
|
471
477
|
slug: string;
|
|
472
478
|
weight: number;
|
|
473
479
|
plugin: string;
|
|
480
|
+
}[]>, {
|
|
481
|
+
type: "audit" | "group";
|
|
482
|
+
slug: string;
|
|
483
|
+
weight: number;
|
|
484
|
+
plugin: string;
|
|
485
|
+
}[], {
|
|
486
|
+
type: "audit" | "group";
|
|
487
|
+
slug: string;
|
|
488
|
+
weight: number;
|
|
489
|
+
plugin: string;
|
|
474
490
|
}[]>;
|
|
475
491
|
isBinary: z.ZodOptional<z.ZodBoolean>;
|
|
476
492
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -658,7 +674,7 @@ export declare const reportSchema: z.ZodObject<{
|
|
|
658
674
|
}>, "many">;
|
|
659
675
|
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
660
676
|
slug: z.ZodString;
|
|
661
|
-
refs: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
677
|
+
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
662
678
|
slug: z.ZodString;
|
|
663
679
|
weight: z.ZodNumber;
|
|
664
680
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -673,6 +689,12 @@ export declare const reportSchema: z.ZodObject<{
|
|
|
673
689
|
}[], {
|
|
674
690
|
slug: string;
|
|
675
691
|
weight: number;
|
|
692
|
+
}[]>, {
|
|
693
|
+
slug: string;
|
|
694
|
+
weight: number;
|
|
695
|
+
}[], {
|
|
696
|
+
slug: string;
|
|
697
|
+
weight: number;
|
|
676
698
|
}[]>;
|
|
677
699
|
title: z.ZodString;
|
|
678
700
|
description: z.ZodOptional<z.ZodString>;
|