@code-pushup/models 0.56.0 → 0.58.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 +6 -5
- package/src/index.d.ts +21 -21
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/lib/audit-output.d.ts +24 -0
- package/src/lib/audit-output.js +37 -0
- package/src/lib/audit-output.js.map +1 -0
- package/src/lib/audit.d.ts +16 -0
- package/src/lib/audit.js +33 -0
- package/src/lib/audit.js.map +1 -0
- package/src/lib/category-config.d.ts +24 -0
- package/src/lib/category-config.js +47 -0
- package/src/lib/category-config.js.map +1 -0
- package/src/lib/commit.d.ts +8 -0
- package/src/lib/commit.js +16 -0
- package/src/lib/commit.js.map +1 -0
- package/src/lib/core-config.d.ts +1785 -866
- package/src/lib/core-config.js +31 -0
- package/src/lib/core-config.js.map +1 -0
- package/src/lib/group.d.ts +35 -0
- package/src/lib/group.js +41 -0
- package/src/lib/group.js.map +1 -0
- package/src/lib/implementation/configuration.js +3 -0
- package/src/lib/implementation/configuration.js.map +1 -0
- package/src/lib/implementation/constants.d.ts +1 -1
- package/src/lib/implementation/constants.js +4 -0
- package/src/lib/implementation/constants.js.map +1 -0
- package/src/lib/implementation/limits.js +5 -0
- package/src/lib/implementation/limits.js.map +1 -0
- package/src/lib/implementation/schemas.d.ts +31 -13
- package/src/lib/implementation/schemas.js +133 -0
- package/src/lib/implementation/schemas.js.map +1 -0
- package/src/lib/implementation/utils.d.ts +3 -3
- package/src/lib/implementation/utils.js +72 -0
- package/src/lib/implementation/utils.js.map +1 -0
- package/src/lib/issue.d.ts +16 -0
- package/src/lib/issue.js +14 -0
- package/src/lib/issue.js.map +1 -0
- package/src/lib/persist-config.d.ts +16 -0
- package/src/lib/persist-config.js +11 -0
- package/src/lib/persist-config.js.map +1 -0
- package/src/lib/plugin-config.d.ts +68 -0
- package/src/lib/plugin-config.js +37 -0
- package/src/lib/plugin-config.js.map +1 -0
- package/src/lib/report.d.ts +84 -0
- package/src/lib/report.js +49 -0
- package/src/lib/report.js.map +1 -0
- package/src/lib/reports-diff.d.ts +68 -0
- package/src/lib/reports-diff.js +79 -0
- package/src/lib/reports-diff.js.map +1 -0
- package/src/lib/runner-config.d.ts +54 -0
- package/src/lib/runner-config.js +31 -0
- package/src/lib/runner-config.js.map +1 -0
- package/src/lib/source.d.ts +8 -0
- package/src/lib/source.js +14 -0
- package/src/lib/source.js.map +1 -0
- package/src/lib/table.d.ts +48 -0
- package/src/lib/table.js +37 -0
- package/src/lib/table.js.map +1 -0
- package/src/lib/upload-config.d.ts +8 -0
- package/src/lib/upload-config.js +16 -0
- package/src/lib/upload-config.js.map +1 -0
- package/index.js +0 -753
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { auditDisplayValueSchema, auditOutputSchema, auditValueSchema, } from './audit-output.js';
|
|
3
|
+
import { commitSchema } from './commit.js';
|
|
4
|
+
import { docsUrlSchema, executionMetaSchema, packageVersionSchema, scoreSchema, slugSchema, titleSchema, urlSchema, } from './implementation/schemas.js';
|
|
5
|
+
import { pluginMetaSchema } from './plugin-config.js';
|
|
6
|
+
function makeComparisonSchema(schema) {
|
|
7
|
+
const sharedDescription = schema.description || 'Result';
|
|
8
|
+
return z.object({
|
|
9
|
+
before: schema.describe(`${sharedDescription} (source commit)`),
|
|
10
|
+
after: schema.describe(`${sharedDescription} (target commit)`),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function makeArraysComparisonSchema(diffSchema, resultSchema, description) {
|
|
14
|
+
return z.object({
|
|
15
|
+
changed: z.array(diffSchema),
|
|
16
|
+
unchanged: z.array(resultSchema),
|
|
17
|
+
added: z.array(resultSchema),
|
|
18
|
+
removed: z.array(resultSchema),
|
|
19
|
+
}, { description });
|
|
20
|
+
}
|
|
21
|
+
const scorableMetaSchema = z.object({
|
|
22
|
+
slug: slugSchema,
|
|
23
|
+
title: titleSchema,
|
|
24
|
+
docsUrl: docsUrlSchema,
|
|
25
|
+
});
|
|
26
|
+
const scorableWithPluginMetaSchema = scorableMetaSchema.merge(z.object({
|
|
27
|
+
plugin: pluginMetaSchema
|
|
28
|
+
.pick({ slug: true, title: true, docsUrl: true })
|
|
29
|
+
.describe('Plugin which defines it'),
|
|
30
|
+
}));
|
|
31
|
+
const scorableDiffSchema = scorableMetaSchema.merge(z.object({
|
|
32
|
+
scores: makeComparisonSchema(scoreSchema)
|
|
33
|
+
.merge(z.object({
|
|
34
|
+
diff: z
|
|
35
|
+
.number()
|
|
36
|
+
.min(-1)
|
|
37
|
+
.max(1)
|
|
38
|
+
.describe('Score change (`scores.after - scores.before`)'),
|
|
39
|
+
}))
|
|
40
|
+
.describe('Score comparison'),
|
|
41
|
+
}));
|
|
42
|
+
const scorableWithPluginDiffSchema = scorableDiffSchema.merge(scorableWithPluginMetaSchema);
|
|
43
|
+
export const categoryDiffSchema = scorableDiffSchema;
|
|
44
|
+
export const groupDiffSchema = scorableWithPluginDiffSchema;
|
|
45
|
+
export const auditDiffSchema = scorableWithPluginDiffSchema.merge(z.object({
|
|
46
|
+
values: makeComparisonSchema(auditValueSchema)
|
|
47
|
+
.merge(z.object({
|
|
48
|
+
diff: z
|
|
49
|
+
.number()
|
|
50
|
+
.describe('Value change (`values.after - values.before`)'),
|
|
51
|
+
}))
|
|
52
|
+
.describe('Audit `value` comparison'),
|
|
53
|
+
displayValues: makeComparisonSchema(auditDisplayValueSchema).describe('Audit `displayValue` comparison'),
|
|
54
|
+
}));
|
|
55
|
+
export const categoryResultSchema = scorableMetaSchema.merge(z.object({ score: scoreSchema }));
|
|
56
|
+
export const groupResultSchema = scorableWithPluginMetaSchema.merge(z.object({ score: scoreSchema }));
|
|
57
|
+
export const auditResultSchema = scorableWithPluginMetaSchema.merge(auditOutputSchema.pick({ score: true, value: true, displayValue: true }));
|
|
58
|
+
export const reportsDiffSchema = z
|
|
59
|
+
.object({
|
|
60
|
+
commits: makeComparisonSchema(commitSchema)
|
|
61
|
+
.nullable()
|
|
62
|
+
.describe('Commits identifying compared reports'),
|
|
63
|
+
portalUrl: urlSchema
|
|
64
|
+
.optional()
|
|
65
|
+
.describe('Link to comparison page in Code PushUp portal'),
|
|
66
|
+
label: z.string().optional().describe('Label (e.g. project name)'),
|
|
67
|
+
categories: makeArraysComparisonSchema(categoryDiffSchema, categoryResultSchema, 'Changes affecting categories'),
|
|
68
|
+
groups: makeArraysComparisonSchema(groupDiffSchema, groupResultSchema, 'Changes affecting groups'),
|
|
69
|
+
audits: makeArraysComparisonSchema(auditDiffSchema, auditResultSchema, 'Changes affecting audits'),
|
|
70
|
+
})
|
|
71
|
+
.merge(packageVersionSchema({
|
|
72
|
+
versionDescription: 'NPM version of the CLI (when `compare` was run)',
|
|
73
|
+
required: true,
|
|
74
|
+
}))
|
|
75
|
+
.merge(executionMetaSchema({
|
|
76
|
+
descriptionDate: 'Start date and time of the compare run',
|
|
77
|
+
descriptionDuration: 'Duration of the compare run in ms',
|
|
78
|
+
}));
|
|
79
|
+
//# sourceMappingURL=reports-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports-diff.js","sourceRoot":"","sources":["../../../../../packages/models/src/lib/reports-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,CAAC,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,SAAS,oBAAoB,CAAuB,MAAS;IAC3D,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,IAAI,QAAQ,CAAC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OAAO,EAAE,oBAAoB,CAAC,YAAY,CAAC;SACxC,QAAQ,EAAE;SACV,QAAQ,CAAC,sCAAsC,CAAC;IACnD,SAAS,EAAE,SAAS;SACjB,QAAQ,EAAE;SACV,QAAQ,CAAC,+CAA+C,CAAC;IAC5D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAClE,UAAU,EAAE,0BAA0B,CACpC,kBAAkB,EAClB,oBAAoB,EACpB,8BAA8B,CAC/B;IACD,MAAM,EAAE,0BAA0B,CAChC,eAAe,EACf,iBAAiB,EACjB,0BAA0B,CAC3B;IACD,MAAM,EAAE,0BAA0B,CAChC,eAAe,EACf,iBAAiB,EACjB,0BAA0B,CAC3B;CACF,CAAC;KACD,KAAK,CACJ,oBAAoB,CAAC;IACnB,kBAAkB,EAAE,iDAAiD;IACrE,QAAQ,EAAE,IAAI;CACf,CAAC,CACH;KACA,KAAK,CACJ,mBAAmB,CAAC;IAClB,eAAe,EAAE,wCAAwC;IACzD,mBAAmB,EAAE,mCAAmC;CACzD,CAAC,CACH,CAAC"}
|
|
@@ -606,6 +606,14 @@ export declare const outputTransformSchema: z.ZodFunction<z.ZodTuple<[z.ZodUnkno
|
|
|
606
606
|
} | undefined;
|
|
607
607
|
} | undefined;
|
|
608
608
|
}[]>>]>>;
|
|
609
|
+
/**
|
|
610
|
+
* Type Definition: `OutputTransform`
|
|
611
|
+
*
|
|
612
|
+
* This type is derived from a Zod schema and represents
|
|
613
|
+
* the validated structure of `OutputTransform` used within the application.
|
|
614
|
+
*
|
|
615
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#outputtransform}
|
|
616
|
+
*/
|
|
609
617
|
export type OutputTransform = z.infer<typeof outputTransformSchema>;
|
|
610
618
|
export declare const runnerConfigSchema: z.ZodObject<{
|
|
611
619
|
command: z.ZodString;
|
|
@@ -1218,6 +1226,7 @@ export declare const runnerConfigSchema: z.ZodObject<{
|
|
|
1218
1226
|
} | undefined;
|
|
1219
1227
|
} | undefined;
|
|
1220
1228
|
}[]>>]>>>;
|
|
1229
|
+
configFile: z.ZodOptional<z.ZodString>;
|
|
1221
1230
|
}, "strip", z.ZodTypeAny, {
|
|
1222
1231
|
command: string;
|
|
1223
1232
|
outputFile: string;
|
|
@@ -1289,6 +1298,7 @@ export declare const runnerConfigSchema: z.ZodObject<{
|
|
|
1289
1298
|
} | undefined;
|
|
1290
1299
|
} | undefined;
|
|
1291
1300
|
}[]>) | undefined;
|
|
1301
|
+
configFile?: string | undefined;
|
|
1292
1302
|
}, {
|
|
1293
1303
|
command: string;
|
|
1294
1304
|
outputFile: string;
|
|
@@ -1360,9 +1370,26 @@ export declare const runnerConfigSchema: z.ZodObject<{
|
|
|
1360
1370
|
} | undefined;
|
|
1361
1371
|
} | undefined;
|
|
1362
1372
|
}[]>) | undefined;
|
|
1373
|
+
configFile?: string | undefined;
|
|
1363
1374
|
}>;
|
|
1375
|
+
/**
|
|
1376
|
+
* Type Definition: `RunnerConfig`
|
|
1377
|
+
*
|
|
1378
|
+
* This type is derived from a Zod schema and represents
|
|
1379
|
+
* the validated structure of `RunnerConfig` used within the application.
|
|
1380
|
+
*
|
|
1381
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#runnerconfig}
|
|
1382
|
+
*/
|
|
1364
1383
|
export type RunnerConfig = z.infer<typeof runnerConfigSchema>;
|
|
1365
1384
|
export declare const onProgressSchema: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodVoid>;
|
|
1385
|
+
/**
|
|
1386
|
+
* Type Definition: `OnProgress`
|
|
1387
|
+
*
|
|
1388
|
+
* This type is derived from a Zod schema and represents
|
|
1389
|
+
* the validated structure of `OnProgress` used within the application.
|
|
1390
|
+
*
|
|
1391
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#onprogress}
|
|
1392
|
+
*/
|
|
1366
1393
|
export type OnProgress = z.infer<typeof onProgressSchema>;
|
|
1367
1394
|
export declare const runnerFunctionSchema: z.ZodFunction<z.ZodTuple<[z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodVoid>>], z.ZodUnknown>, z.ZodUnion<[z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
1368
1395
|
slug: z.ZodString;
|
|
@@ -1971,4 +1998,31 @@ export declare const runnerFunctionSchema: z.ZodFunction<z.ZodTuple<[z.ZodOption
|
|
|
1971
1998
|
} | undefined;
|
|
1972
1999
|
} | undefined;
|
|
1973
2000
|
}[]>>]>>;
|
|
2001
|
+
/**
|
|
2002
|
+
* Type Definition: `RunnerFunction`
|
|
2003
|
+
*
|
|
2004
|
+
* This type is derived from a Zod schema and represents
|
|
2005
|
+
* the validated structure of `RunnerFunction` used within the application.
|
|
2006
|
+
*
|
|
2007
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#runnerfunction}
|
|
2008
|
+
*/
|
|
1974
2009
|
export type RunnerFunction = z.infer<typeof runnerFunctionSchema>;
|
|
2010
|
+
export declare const runnerFilesPathsSchema: z.ZodObject<{
|
|
2011
|
+
runnerConfigPath: z.ZodString;
|
|
2012
|
+
runnerOutputPath: z.ZodString;
|
|
2013
|
+
}, "strip", z.ZodTypeAny, {
|
|
2014
|
+
runnerConfigPath: string;
|
|
2015
|
+
runnerOutputPath: string;
|
|
2016
|
+
}, {
|
|
2017
|
+
runnerConfigPath: string;
|
|
2018
|
+
runnerOutputPath: string;
|
|
2019
|
+
}>;
|
|
2020
|
+
/**
|
|
2021
|
+
* Type Definition: `RunnerFilesPaths`
|
|
2022
|
+
*
|
|
2023
|
+
* This type is derived from a Zod schema and represents
|
|
2024
|
+
* the validated structure of `RunnerFilesPaths` used within the application.
|
|
2025
|
+
*
|
|
2026
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#runnerfilespaths}
|
|
2027
|
+
*/
|
|
2028
|
+
export type RunnerFilesPaths = z.infer<typeof runnerFilesPathsSchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { auditOutputsSchema } from './audit-output.js';
|
|
3
|
+
import { filePathSchema } from './implementation/schemas.js';
|
|
4
|
+
export const outputTransformSchema = z
|
|
5
|
+
.function()
|
|
6
|
+
.args(z.unknown())
|
|
7
|
+
.returns(z.union([auditOutputsSchema, z.promise(auditOutputsSchema)]));
|
|
8
|
+
export const runnerConfigSchema = z.object({
|
|
9
|
+
command: z.string({
|
|
10
|
+
description: 'Shell command to execute',
|
|
11
|
+
}),
|
|
12
|
+
args: z.array(z.string({ description: 'Command arguments' })).optional(),
|
|
13
|
+
outputFile: filePathSchema.describe('Runner output path'),
|
|
14
|
+
outputTransform: outputTransformSchema.optional(),
|
|
15
|
+
configFile: filePathSchema.describe('Runner config path').optional(),
|
|
16
|
+
}, {
|
|
17
|
+
description: 'How to execute runner',
|
|
18
|
+
});
|
|
19
|
+
export const onProgressSchema = z
|
|
20
|
+
.function()
|
|
21
|
+
.args(z.unknown())
|
|
22
|
+
.returns(z.void());
|
|
23
|
+
export const runnerFunctionSchema = z
|
|
24
|
+
.function()
|
|
25
|
+
.args(onProgressSchema.optional())
|
|
26
|
+
.returns(z.union([auditOutputsSchema, z.promise(auditOutputsSchema)]));
|
|
27
|
+
export const runnerFilesPathsSchema = z.object({
|
|
28
|
+
runnerConfigPath: filePathSchema.describe('Runner config path'),
|
|
29
|
+
runnerOutputPath: filePathSchema.describe('Runner output path'),
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=runner-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-config.js","sourceRoot":"","sources":["../../../../../packages/models/src/lib/runner-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,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C;AAIzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,gBAAgB,EAAE,cAAc,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IAC/D,gBAAgB,EAAE,cAAc,CAAC,QAAQ,CAAC,oBAAoB,CAAC;CAChE,CAAC,CAAC"}
|
package/src/lib/source.d.ts
CHANGED
|
@@ -34,4 +34,12 @@ export declare const sourceFileLocationSchema: z.ZodObject<{
|
|
|
34
34
|
endColumn?: number | undefined;
|
|
35
35
|
} | undefined;
|
|
36
36
|
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Type Definition: `SourceFileLocation`
|
|
39
|
+
*
|
|
40
|
+
* This type is derived from a Zod schema and represents
|
|
41
|
+
* the validated structure of `SourceFileLocation` used within the application.
|
|
42
|
+
*
|
|
43
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#sourcefilelocation}
|
|
44
|
+
*/
|
|
37
45
|
export type SourceFileLocation = z.infer<typeof sourceFileLocationSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { filePathSchema, positiveIntSchema } from './implementation/schemas.js';
|
|
3
|
+
export const sourceFileLocationSchema = z.object({
|
|
4
|
+
file: filePathSchema.describe('Relative path to source file in Git repo'),
|
|
5
|
+
position: z
|
|
6
|
+
.object({
|
|
7
|
+
startLine: positiveIntSchema.describe('Start line'),
|
|
8
|
+
startColumn: positiveIntSchema.describe('Start column').optional(),
|
|
9
|
+
endLine: positiveIntSchema.describe('End line').optional(),
|
|
10
|
+
endColumn: positiveIntSchema.describe('End column').optional(),
|
|
11
|
+
}, { description: 'Location in file' })
|
|
12
|
+
.optional(),
|
|
13
|
+
}, { description: 'Source file location' });
|
|
14
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../../../packages/models/src/lib/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAC9C;IACE,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,0CAA0C,CAAC;IACzE,QAAQ,EAAE,CAAC;SACR,MAAM,CACL;QACE,SAAS,EAAE,iBAAiB,CAAC,QAAQ,CAAC,YAAY,CAAC;QACnD,WAAW,EAAE,iBAAiB,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;QAClE,OAAO,EAAE,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;QAC1D,SAAS,EAAE,iBAAiB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE;KAC/D,EACD,EAAE,WAAW,EAAE,kBAAkB,EAAE,CACpC;SACA,QAAQ,EAAE;CACd,EACD,EAAE,WAAW,EAAE,sBAAsB,EAAE,CACxC,CAAC"}
|
package/src/lib/table.d.ts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const tableAlignmentSchema: z.ZodEnum<["left", "center", "right"]>;
|
|
3
|
+
/**
|
|
4
|
+
* Type Definition: `TableAlignment`
|
|
5
|
+
*
|
|
6
|
+
* This type is derived from a Zod schema and represents
|
|
7
|
+
* the validated structure of `TableAlignment` used within the application.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#tablealignment}
|
|
10
|
+
*/
|
|
3
11
|
export type TableAlignment = z.infer<typeof tableAlignmentSchema>;
|
|
4
12
|
export declare const tableColumnPrimitiveSchema: z.ZodEnum<["left", "center", "right"]>;
|
|
13
|
+
/**
|
|
14
|
+
* Type Definition: `TableColumnPrimitive`
|
|
15
|
+
*
|
|
16
|
+
* This type is derived from a Zod schema and represents
|
|
17
|
+
* the validated structure of `TableColumnPrimitive` used within the application.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#tablecolumnprimitive}
|
|
20
|
+
*/
|
|
5
21
|
export type TableColumnPrimitive = z.infer<typeof tableColumnPrimitiveSchema>;
|
|
6
22
|
export declare const tableColumnObjectSchema: z.ZodObject<{
|
|
7
23
|
key: z.ZodString;
|
|
@@ -16,10 +32,34 @@ export declare const tableColumnObjectSchema: z.ZodObject<{
|
|
|
16
32
|
label?: string | undefined;
|
|
17
33
|
align?: "left" | "center" | "right" | undefined;
|
|
18
34
|
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Type Definition: `TableColumnObject`
|
|
37
|
+
*
|
|
38
|
+
* This type is derived from a Zod schema and represents
|
|
39
|
+
* the validated structure of `TableColumnObject` used within the application.
|
|
40
|
+
*
|
|
41
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#tablecolumnobject}
|
|
42
|
+
*/
|
|
19
43
|
export type TableColumnObject = z.infer<typeof tableColumnObjectSchema>;
|
|
20
44
|
export declare const tableRowObjectSchema: z.ZodRecord<z.ZodString, z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
45
|
+
/**
|
|
46
|
+
* Type Definition: `TableRowObject`
|
|
47
|
+
*
|
|
48
|
+
* This type is derived from a Zod schema and represents
|
|
49
|
+
* the validated structure of `TableRowObject` used within the application.
|
|
50
|
+
*
|
|
51
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#tablerowobject}
|
|
52
|
+
*/
|
|
21
53
|
export type TableRowObject = z.infer<typeof tableRowObjectSchema>;
|
|
22
54
|
export declare const tableRowPrimitiveSchema: z.ZodArray<z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, "many">;
|
|
55
|
+
/**
|
|
56
|
+
* Type Definition: `TableRowPrimitive`
|
|
57
|
+
*
|
|
58
|
+
* This type is derived from a Zod schema and represents
|
|
59
|
+
* the validated structure of `TableRowPrimitive` used within the application.
|
|
60
|
+
*
|
|
61
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#tablerowprimitive}
|
|
62
|
+
*/
|
|
23
63
|
export type TableRowPrimitive = z.infer<typeof tableRowPrimitiveSchema>;
|
|
24
64
|
export declare const tableSchema: (description?: string) => z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
25
65
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -68,4 +108,12 @@ export declare const tableSchema: (description?: string) => z.ZodUnion<[z.ZodObj
|
|
|
68
108
|
align?: "left" | "center" | "right" | undefined;
|
|
69
109
|
}[] | undefined;
|
|
70
110
|
}>]>;
|
|
111
|
+
/**
|
|
112
|
+
* Type Definition: `Table`
|
|
113
|
+
*
|
|
114
|
+
* This type is derived from a Zod schema and represents
|
|
115
|
+
* the validated structure of `Table` used within the application.
|
|
116
|
+
*
|
|
117
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#table}
|
|
118
|
+
*/
|
|
71
119
|
export type Table = z.infer<ReturnType<typeof tableSchema>>;
|
package/src/lib/table.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { tableCellValueSchema } from './implementation/schemas.js';
|
|
3
|
+
export const tableAlignmentSchema = z.enum(['left', 'center', 'right'], {
|
|
4
|
+
description: 'Cell alignment',
|
|
5
|
+
});
|
|
6
|
+
export const tableColumnPrimitiveSchema = tableAlignmentSchema;
|
|
7
|
+
export const tableColumnObjectSchema = z.object({
|
|
8
|
+
key: z.string(),
|
|
9
|
+
label: z.string().optional(),
|
|
10
|
+
align: tableAlignmentSchema.optional(),
|
|
11
|
+
});
|
|
12
|
+
export const tableRowObjectSchema = z.record(tableCellValueSchema, {
|
|
13
|
+
description: 'Object row',
|
|
14
|
+
});
|
|
15
|
+
export const tableRowPrimitiveSchema = z.array(tableCellValueSchema, {
|
|
16
|
+
description: 'Primitive row',
|
|
17
|
+
});
|
|
18
|
+
const tableSharedSchema = z.object({
|
|
19
|
+
title: z.string().optional().describe('Display title for table'),
|
|
20
|
+
});
|
|
21
|
+
const tablePrimitiveSchema = tableSharedSchema.merge(z.object({
|
|
22
|
+
columns: z.array(tableAlignmentSchema).optional(),
|
|
23
|
+
rows: z.array(tableRowPrimitiveSchema),
|
|
24
|
+
}, { description: 'Table with primitive rows and optional alignment columns' }));
|
|
25
|
+
const tableObjectSchema = tableSharedSchema.merge(z.object({
|
|
26
|
+
columns: z
|
|
27
|
+
.union([
|
|
28
|
+
z.array(tableAlignmentSchema),
|
|
29
|
+
z.array(tableColumnObjectSchema),
|
|
30
|
+
])
|
|
31
|
+
.optional(),
|
|
32
|
+
rows: z.array(tableRowObjectSchema),
|
|
33
|
+
}, {
|
|
34
|
+
description: 'Table with object rows and optional alignment or object columns',
|
|
35
|
+
}));
|
|
36
|
+
export const tableSchema = (description = 'Table information') => z.union([tablePrimitiveSchema, tableObjectSchema], { description });
|
|
37
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../../../packages/models/src/lib/table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE;IACtE,WAAW,EAAE,gBAAgB;CAC9B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAG/D,MAAM,CAAC,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AEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,WAAW,GAAG,mBAAmB,EAAE,EAAE,CAC/D,CAAC,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC"}
|
|
@@ -18,4 +18,12 @@ export declare const uploadConfigSchema: z.ZodObject<{
|
|
|
18
18
|
project: string;
|
|
19
19
|
timeout?: number | undefined;
|
|
20
20
|
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Type Definition: `UploadConfig`
|
|
23
|
+
*
|
|
24
|
+
* This type is derived from a Zod schema and represents
|
|
25
|
+
* the validated structure of `UploadConfig` used within the application.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#uploadconfig}
|
|
28
|
+
*/
|
|
21
29
|
export type UploadConfig = z.infer<typeof uploadConfigSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { slugSchema, urlSchema } from './implementation/schemas.js';
|
|
3
|
+
export const uploadConfigSchema = z.object({
|
|
4
|
+
server: urlSchema.describe('URL of deployed portal API'),
|
|
5
|
+
apiKey: z.string({
|
|
6
|
+
description: 'API key with write access to portal (use `process.env` for security)',
|
|
7
|
+
}),
|
|
8
|
+
organization: slugSchema.describe('Organization slug from Code PushUp portal'),
|
|
9
|
+
project: slugSchema.describe('Project slug from Code PushUp portal'),
|
|
10
|
+
timeout: z
|
|
11
|
+
.number({ description: 'Request timeout in minutes (default is 5)' })
|
|
12
|
+
.positive()
|
|
13
|
+
.int()
|
|
14
|
+
.optional(),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=upload-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-config.js","sourceRoot":"","sources":["../../../../../packages/models/src/lib/upload-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACxD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,WAAW,EACT,sEAAsE;KACzE,CAAC;IACF,YAAY,EAAE,UAAU,CAAC,QAAQ,CAC/B,2CAA2C,CAC5C;IACD,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACpE,OAAO,EAAE,CAAC;SACP,MAAM,CAAC,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;SACpE,QAAQ,EAAE;SACV,GAAG,EAAE;SACL,QAAQ,EAAE;CACd,CAAC,CAAC"}
|