@code-pushup/models 0.74.1 → 0.75.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/models",
3
- "version": "0.74.1",
3
+ "version": "0.75.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",
@@ -32,7 +32,7 @@ export declare const categoryConfigSchema: z.ZodObject<{
32
32
  description: z.ZodOptional<z.ZodString>;
33
33
  docsUrl: z.ZodCatch<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
34
34
  isSkipped: z.ZodOptional<z.ZodBoolean>;
35
- isBinary: z.ZodOptional<z.ZodBoolean>;
35
+ scoreTarget: z.ZodOptional<z.ZodNumber>;
36
36
  }, z.core.$strip>;
37
37
  /**
38
38
  * Type Definition: `CategoryConfig`
@@ -58,5 +58,5 @@ export declare const categoriesSchema: z.ZodArray<z.ZodObject<{
58
58
  description: z.ZodOptional<z.ZodString>;
59
59
  docsUrl: z.ZodCatch<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
60
60
  isSkipped: z.ZodOptional<z.ZodBoolean>;
61
- isBinary: z.ZodOptional<z.ZodBoolean>;
61
+ scoreTarget: z.ZodOptional<z.ZodNumber>;
62
62
  }, z.core.$strip>>;
@@ -1,26 +1,26 @@
1
1
  import { z } from 'zod';
2
2
  import { createDuplicateSlugsCheck, createDuplicatesCheck, } from './implementation/checks.js';
3
- import { metaSchema, scorableSchema, slugSchema, weightedRefSchema, } from './implementation/schemas.js';
3
+ import { metaSchema, nonnegativeNumberSchema, scorableSchema, slugSchema, weightedRefSchema, } from './implementation/schemas.js';
4
4
  import { formatRef } from './implementation/utils.js';
5
- export const categoryRefSchema = weightedRefSchema('Weighted references to audits and/or groups for the category', 'Slug of an audit or group (depending on `type`)').merge(z.object({
5
+ export const categoryRefSchema = weightedRefSchema('Weighted references to audits and/or groups for the category', 'Slug of an audit or group (depending on `type`)').extend({
6
6
  type: z
7
7
  .enum(['audit', 'group'])
8
8
  .describe('Discriminant for reference kind, affects where `slug` is looked up'),
9
9
  plugin: slugSchema.describe('Plugin slug (plugin should contain referenced audit or group)'),
10
- }));
10
+ });
11
11
  export const categoryConfigSchema = scorableSchema('Category with a score calculated from audits and groups from various plugins', categoryRefSchema, createDuplicatesCheck(serializeCategoryRefTarget, duplicates => `Category has duplicate references: ${formatSerializedCategoryRefTargets(duplicates)}`))
12
- .merge(metaSchema({
12
+ .extend(metaSchema({
13
13
  titleDescription: 'Category Title',
14
14
  docsUrlDescription: 'Category docs URL',
15
15
  descriptionDescription: 'Category description',
16
16
  description: 'Meta info for category',
17
- }))
18
- .merge(z.object({
19
- isBinary: z
20
- .boolean()
21
- .describe('Is this a binary category (i.e. only a perfect score considered a "pass")?')
17
+ }).shape)
18
+ .extend({
19
+ scoreTarget: nonnegativeNumberSchema
20
+ .max(1)
21
+ .describe('Pass/fail score threshold (0-1)')
22
22
  .optional(),
23
- }));
23
+ });
24
24
  const CATEGORY_REF_SEP = '||';
25
25
  function serializeCategoryRefTarget(ref) {
26
26
  return [ref.type, ref.plugin, ref.slug].join(CATEGORY_REF_SEP);
@@ -1 +1 @@
1
- {"version":3,"file":"category-config.js","sourceRoot":"","sources":["../../../src/lib/category-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,UAAU,EACV,cAAc,EACd,UAAU,EACV,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAChD,8DAA8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AC3C,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,KAAK,CAAC,oBAAoB,CAAC;KAC3B,KAAK,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;KAC5C,QAAQ,CAAC,qCAAqC,CAAC,CAAC"}
1
+ {"version":3,"file":"category-config.js","sourceRoot":"","sources":["../../../src/lib/category-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,UAAU,EACV,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAChD,8DAA8D,EAC9D,iDAAiD,CAClD,CAAC,MAAM,CAAC;IACP,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;SACxB,QAAQ,CACP,oEAAoE,CACrE;IACH,MAAM,EAAE,UAAU,CAAC,QAAQ,CACzB,+DAA+D,CAChE;CACF,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAChD,8EAA8E,EAC9E,iBAAiB,EACjB,qBAAqB,CACnB,0BAA0B,EAC1B,UAAU,CAAC,EAAE,CACX,sCAAsC,kCAAkC,CAAC,UAAU,CAAC,EAAE,CACzF,CACF;KACE,MAAM,CACL,UAAU,CAAC;IACT,gBAAgB,EAAE,gBAAgB;IAClC,kBAAkB,EAAE,mBAAmB;IACvC,sBAAsB,EAAE,sBAAsB;IAC9C,WAAW,EAAE,wBAAwB;CACtC,CAAC,CAAC,KAAK,CACT;KACA,MAAM,CAAC;IACN,WAAW,EAAE,uBAAuB;SACjC,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,iCAAiC,CAAC;SAC3C,QAAQ,EAAE;CACd,CAAC,CAAC;AAIL,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,SAAS,0BAA0B,CAAC,GAAgB;IAClD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,kCAAkC,CAAC,IAAc;IACxD,OAAO,IAAI;SACR,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAItD,CAAC;QACF,OAAO,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,KAAK,CAAC,oBAAoB,CAAC;KAC3B,KAAK,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;KAC5C,QAAQ,CAAC,qCAAqC,CAAC,CAAC"}
@@ -1158,7 +1158,7 @@ export declare const unrefinedCoreConfigSchema: z.ZodObject<{
1158
1158
  description: z.ZodOptional<z.ZodString>;
1159
1159
  docsUrl: z.ZodCatch<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
1160
1160
  isSkipped: z.ZodOptional<z.ZodBoolean>;
1161
- isBinary: z.ZodOptional<z.ZodBoolean>;
1161
+ scoreTarget: z.ZodOptional<z.ZodNumber>;
1162
1162
  }, z.core.$strip>>>;
1163
1163
  }, z.core.$strip>;
1164
1164
  export declare const coreConfigSchema: z.ZodObject<{
@@ -2320,7 +2320,7 @@ export declare const coreConfigSchema: z.ZodObject<{
2320
2320
  description: z.ZodOptional<z.ZodString>;
2321
2321
  docsUrl: z.ZodCatch<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
2322
2322
  isSkipped: z.ZodOptional<z.ZodBoolean>;
2323
- isBinary: z.ZodOptional<z.ZodBoolean>;
2323
+ scoreTarget: z.ZodOptional<z.ZodNumber>;
2324
2324
  }, z.core.$strip>>>;
2325
2325
  }, z.core.$strip>;
2326
2326
  /**
@@ -3487,7 +3487,7 @@ export declare function refineCoreConfig(schema: typeof unrefinedCoreConfigSchem
3487
3487
  description: z.ZodOptional<z.ZodString>;
3488
3488
  docsUrl: z.ZodCatch<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
3489
3489
  isSkipped: z.ZodOptional<z.ZodBoolean>;
3490
- isBinary: z.ZodOptional<z.ZodBoolean>;
3490
+ scoreTarget: z.ZodOptional<z.ZodNumber>;
3491
3491
  }, z.core.$strip>>>;
3492
3492
  }, z.core.$strip>;
3493
3493
  /**
@@ -1990,7 +1990,7 @@ export declare const reportSchema: z.ZodObject<{
1990
1990
  description: z.ZodOptional<z.ZodString>;
1991
1991
  docsUrl: z.ZodCatch<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
1992
1992
  isSkipped: z.ZodOptional<z.ZodBoolean>;
1993
- isBinary: z.ZodOptional<z.ZodBoolean>;
1993
+ scoreTarget: z.ZodOptional<z.ZodNumber>;
1994
1994
  }, z.core.$strip>>>;
1995
1995
  commit: z.ZodNullable<z.ZodObject<{
1996
1996
  hash: z.ZodString;