@code-pushup/models 0.12.0 → 0.12.2
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 +7 -4
- package/package.json +1 -1
- package/src/lib/core-config.d.ts +54 -54
package/index.js
CHANGED
|
@@ -32,6 +32,9 @@ function exists(value) {
|
|
|
32
32
|
return value != null;
|
|
33
33
|
}
|
|
34
34
|
function getMissingRefsForCategories(categories, plugins) {
|
|
35
|
+
if (categories.length === 0) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
35
38
|
const auditRefsFromCategory = categories.flatMap(
|
|
36
39
|
({ refs }) => refs.filter(({ type }) => type === "audit").map(({ plugin, slug }) => `${plugin}/${slug}`)
|
|
37
40
|
);
|
|
@@ -306,7 +309,7 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
|
|
|
306
309
|
}
|
|
307
310
|
var categoriesSchema = z5.array(categoryConfigSchema, {
|
|
308
311
|
description: "Categorization of individual audits"
|
|
309
|
-
}).
|
|
312
|
+
}).refine(
|
|
310
313
|
(categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
|
|
311
314
|
(categoryCfg) => ({
|
|
312
315
|
message: duplicateSlugCategoriesErrorMsg(categoryCfg)
|
|
@@ -464,15 +467,15 @@ var unrefinedCoreConfigSchema = z11.object({
|
|
|
464
467
|
persist: persistConfigSchema.optional(),
|
|
465
468
|
/** portal configuration for uploading results */
|
|
466
469
|
upload: uploadConfigSchema.optional(),
|
|
467
|
-
categories: categoriesSchema
|
|
470
|
+
categories: categoriesSchema.optional()
|
|
468
471
|
});
|
|
469
472
|
var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
|
|
470
473
|
function refineCoreConfig(schema) {
|
|
471
474
|
return schema.refine(
|
|
472
|
-
(coreCfg) => !getMissingRefsForCategories(coreCfg.categories, coreCfg.plugins),
|
|
475
|
+
(coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
|
|
473
476
|
(coreCfg) => ({
|
|
474
477
|
message: missingRefsForCategoriesErrorMsg(
|
|
475
|
-
coreCfg.categories,
|
|
478
|
+
coreCfg.categories ?? [],
|
|
476
479
|
coreCfg.plugins
|
|
477
480
|
)
|
|
478
481
|
})
|
package/package.json
CHANGED
package/src/lib/core-config.d.ts
CHANGED
|
@@ -1721,7 +1721,7 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
|
|
|
1721
1721
|
project: string;
|
|
1722
1722
|
timeout?: number | undefined;
|
|
1723
1723
|
}>>;
|
|
1724
|
-
categories: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
1724
|
+
categories: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
1725
1725
|
slug: z.ZodString;
|
|
1726
1726
|
description: z.ZodOptional<z.ZodString>;
|
|
1727
1727
|
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
@@ -1811,21 +1811,8 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
|
|
|
1811
1811
|
description?: string | undefined;
|
|
1812
1812
|
docsUrl?: string | undefined;
|
|
1813
1813
|
isBinary?: boolean | undefined;
|
|
1814
|
-
}[]
|
|
1814
|
+
}[]>>;
|
|
1815
1815
|
}, "strip", z.ZodTypeAny, {
|
|
1816
|
-
categories: {
|
|
1817
|
-
slug: string;
|
|
1818
|
-
refs: {
|
|
1819
|
-
slug: string;
|
|
1820
|
-
weight: number;
|
|
1821
|
-
type: "audit" | "group";
|
|
1822
|
-
plugin: string;
|
|
1823
|
-
}[];
|
|
1824
|
-
title: string;
|
|
1825
|
-
description?: string | undefined;
|
|
1826
|
-
docsUrl?: string | undefined;
|
|
1827
|
-
isBinary?: boolean | undefined;
|
|
1828
|
-
}[];
|
|
1829
1816
|
plugins: {
|
|
1830
1817
|
slug: string;
|
|
1831
1818
|
title: string;
|
|
@@ -2034,8 +2021,7 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
|
|
|
2034
2021
|
project: string;
|
|
2035
2022
|
timeout?: number | undefined;
|
|
2036
2023
|
} | undefined;
|
|
2037
|
-
|
|
2038
|
-
categories: {
|
|
2024
|
+
categories?: {
|
|
2039
2025
|
slug: string;
|
|
2040
2026
|
refs: {
|
|
2041
2027
|
slug: string;
|
|
@@ -2047,7 +2033,8 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
|
|
|
2047
2033
|
description?: string | undefined;
|
|
2048
2034
|
docsUrl?: string | undefined;
|
|
2049
2035
|
isBinary?: boolean | undefined;
|
|
2050
|
-
}[];
|
|
2036
|
+
}[] | undefined;
|
|
2037
|
+
}, {
|
|
2051
2038
|
plugins: {
|
|
2052
2039
|
slug: string;
|
|
2053
2040
|
title: string;
|
|
@@ -2256,6 +2243,19 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
|
|
|
2256
2243
|
project: string;
|
|
2257
2244
|
timeout?: number | undefined;
|
|
2258
2245
|
} | undefined;
|
|
2246
|
+
categories?: {
|
|
2247
|
+
slug: string;
|
|
2248
|
+
refs: {
|
|
2249
|
+
slug: string;
|
|
2250
|
+
weight: number;
|
|
2251
|
+
type: "audit" | "group";
|
|
2252
|
+
plugin: string;
|
|
2253
|
+
}[];
|
|
2254
|
+
title: string;
|
|
2255
|
+
description?: string | undefined;
|
|
2256
|
+
docsUrl?: string | undefined;
|
|
2257
|
+
isBinary?: boolean | undefined;
|
|
2258
|
+
}[] | undefined;
|
|
2259
2259
|
}>;
|
|
2260
2260
|
export declare const coreConfigSchema: z.ZodObject<{
|
|
2261
2261
|
plugins: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
@@ -3979,7 +3979,7 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
3979
3979
|
project: string;
|
|
3980
3980
|
timeout?: number | undefined;
|
|
3981
3981
|
}>>;
|
|
3982
|
-
categories: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
3982
|
+
categories: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
3983
3983
|
slug: z.ZodString;
|
|
3984
3984
|
description: z.ZodOptional<z.ZodString>;
|
|
3985
3985
|
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
@@ -4069,21 +4069,8 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
4069
4069
|
description?: string | undefined;
|
|
4070
4070
|
docsUrl?: string | undefined;
|
|
4071
4071
|
isBinary?: boolean | undefined;
|
|
4072
|
-
}[]
|
|
4072
|
+
}[]>>;
|
|
4073
4073
|
}, "strip", z.ZodTypeAny, {
|
|
4074
|
-
categories: {
|
|
4075
|
-
slug: string;
|
|
4076
|
-
refs: {
|
|
4077
|
-
slug: string;
|
|
4078
|
-
weight: number;
|
|
4079
|
-
type: "audit" | "group";
|
|
4080
|
-
plugin: string;
|
|
4081
|
-
}[];
|
|
4082
|
-
title: string;
|
|
4083
|
-
description?: string | undefined;
|
|
4084
|
-
docsUrl?: string | undefined;
|
|
4085
|
-
isBinary?: boolean | undefined;
|
|
4086
|
-
}[];
|
|
4087
4074
|
plugins: {
|
|
4088
4075
|
slug: string;
|
|
4089
4076
|
title: string;
|
|
@@ -4292,8 +4279,7 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
4292
4279
|
project: string;
|
|
4293
4280
|
timeout?: number | undefined;
|
|
4294
4281
|
} | undefined;
|
|
4295
|
-
|
|
4296
|
-
categories: {
|
|
4282
|
+
categories?: {
|
|
4297
4283
|
slug: string;
|
|
4298
4284
|
refs: {
|
|
4299
4285
|
slug: string;
|
|
@@ -4305,7 +4291,8 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
4305
4291
|
description?: string | undefined;
|
|
4306
4292
|
docsUrl?: string | undefined;
|
|
4307
4293
|
isBinary?: boolean | undefined;
|
|
4308
|
-
}[];
|
|
4294
|
+
}[] | undefined;
|
|
4295
|
+
}, {
|
|
4309
4296
|
plugins: {
|
|
4310
4297
|
slug: string;
|
|
4311
4298
|
title: string;
|
|
@@ -4514,6 +4501,19 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
4514
4501
|
project: string;
|
|
4515
4502
|
timeout?: number | undefined;
|
|
4516
4503
|
} | undefined;
|
|
4504
|
+
categories?: {
|
|
4505
|
+
slug: string;
|
|
4506
|
+
refs: {
|
|
4507
|
+
slug: string;
|
|
4508
|
+
weight: number;
|
|
4509
|
+
type: "audit" | "group";
|
|
4510
|
+
plugin: string;
|
|
4511
|
+
}[];
|
|
4512
|
+
title: string;
|
|
4513
|
+
description?: string | undefined;
|
|
4514
|
+
docsUrl?: string | undefined;
|
|
4515
|
+
isBinary?: boolean | undefined;
|
|
4516
|
+
}[] | undefined;
|
|
4517
4517
|
}>;
|
|
4518
4518
|
/**
|
|
4519
4519
|
* Add refinements to coreConfigSchema
|
|
@@ -6242,7 +6242,7 @@ export declare function refineCoreConfig(schema: typeof unrefinedCoreConfigSchem
|
|
|
6242
6242
|
project: string;
|
|
6243
6243
|
timeout?: number | undefined;
|
|
6244
6244
|
}>>;
|
|
6245
|
-
categories: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
6245
|
+
categories: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
6246
6246
|
slug: z.ZodString;
|
|
6247
6247
|
description: z.ZodOptional<z.ZodString>;
|
|
6248
6248
|
refs: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
@@ -6332,21 +6332,8 @@ export declare function refineCoreConfig(schema: typeof unrefinedCoreConfigSchem
|
|
|
6332
6332
|
description?: string | undefined;
|
|
6333
6333
|
docsUrl?: string | undefined;
|
|
6334
6334
|
isBinary?: boolean | undefined;
|
|
6335
|
-
}[]
|
|
6335
|
+
}[]>>;
|
|
6336
6336
|
}, "strip", z.ZodTypeAny, {
|
|
6337
|
-
categories: {
|
|
6338
|
-
slug: string;
|
|
6339
|
-
refs: {
|
|
6340
|
-
slug: string;
|
|
6341
|
-
weight: number;
|
|
6342
|
-
type: "audit" | "group";
|
|
6343
|
-
plugin: string;
|
|
6344
|
-
}[];
|
|
6345
|
-
title: string;
|
|
6346
|
-
description?: string | undefined;
|
|
6347
|
-
docsUrl?: string | undefined;
|
|
6348
|
-
isBinary?: boolean | undefined;
|
|
6349
|
-
}[];
|
|
6350
6337
|
plugins: {
|
|
6351
6338
|
slug: string;
|
|
6352
6339
|
title: string;
|
|
@@ -6555,8 +6542,7 @@ export declare function refineCoreConfig(schema: typeof unrefinedCoreConfigSchem
|
|
|
6555
6542
|
project: string;
|
|
6556
6543
|
timeout?: number | undefined;
|
|
6557
6544
|
} | undefined;
|
|
6558
|
-
|
|
6559
|
-
categories: {
|
|
6545
|
+
categories?: {
|
|
6560
6546
|
slug: string;
|
|
6561
6547
|
refs: {
|
|
6562
6548
|
slug: string;
|
|
@@ -6568,7 +6554,8 @@ export declare function refineCoreConfig(schema: typeof unrefinedCoreConfigSchem
|
|
|
6568
6554
|
description?: string | undefined;
|
|
6569
6555
|
docsUrl?: string | undefined;
|
|
6570
6556
|
isBinary?: boolean | undefined;
|
|
6571
|
-
}[];
|
|
6557
|
+
}[] | undefined;
|
|
6558
|
+
}, {
|
|
6572
6559
|
plugins: {
|
|
6573
6560
|
slug: string;
|
|
6574
6561
|
title: string;
|
|
@@ -6777,5 +6764,18 @@ export declare function refineCoreConfig(schema: typeof unrefinedCoreConfigSchem
|
|
|
6777
6764
|
project: string;
|
|
6778
6765
|
timeout?: number | undefined;
|
|
6779
6766
|
} | undefined;
|
|
6767
|
+
categories?: {
|
|
6768
|
+
slug: string;
|
|
6769
|
+
refs: {
|
|
6770
|
+
slug: string;
|
|
6771
|
+
weight: number;
|
|
6772
|
+
type: "audit" | "group";
|
|
6773
|
+
plugin: string;
|
|
6774
|
+
}[];
|
|
6775
|
+
title: string;
|
|
6776
|
+
description?: string | undefined;
|
|
6777
|
+
docsUrl?: string | undefined;
|
|
6778
|
+
isBinary?: boolean | undefined;
|
|
6779
|
+
}[] | undefined;
|
|
6780
6780
|
}>;
|
|
6781
6781
|
export type CoreConfig = z.infer<typeof unrefinedCoreConfigSchema>;
|