@code-pushup/models 0.50.0 → 0.51.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 +112 -108
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/source.d.ts +37 -0
package/index.js
CHANGED
|
@@ -155,9 +155,27 @@ function hasNonZeroWeightedRef(refs) {
|
|
|
155
155
|
return refs.reduce((acc, { weight }) => weight + acc, 0) !== 0;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
// packages/models/src/lib/
|
|
158
|
+
// packages/models/src/lib/source.ts
|
|
159
159
|
import { z as z2 } from "zod";
|
|
160
|
-
var
|
|
160
|
+
var sourceFileLocationSchema = z2.object(
|
|
161
|
+
{
|
|
162
|
+
file: filePathSchema.describe("Relative path to source file in Git repo"),
|
|
163
|
+
position: z2.object(
|
|
164
|
+
{
|
|
165
|
+
startLine: positiveIntSchema.describe("Start line"),
|
|
166
|
+
startColumn: positiveIntSchema.describe("Start column").optional(),
|
|
167
|
+
endLine: positiveIntSchema.describe("End line").optional(),
|
|
168
|
+
endColumn: positiveIntSchema.describe("End column").optional()
|
|
169
|
+
},
|
|
170
|
+
{ description: "Location in file" }
|
|
171
|
+
).optional()
|
|
172
|
+
},
|
|
173
|
+
{ description: "Source file location" }
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
// packages/models/src/lib/audit.ts
|
|
177
|
+
import { z as z3 } from "zod";
|
|
178
|
+
var auditSchema = z3.object({
|
|
161
179
|
slug: slugSchema.describe("ID (unique within plugin)")
|
|
162
180
|
}).merge(
|
|
163
181
|
metaSchema({
|
|
@@ -167,7 +185,7 @@ var auditSchema = z2.object({
|
|
|
167
185
|
description: "List of scorable metrics for the given plugin"
|
|
168
186
|
})
|
|
169
187
|
);
|
|
170
|
-
var pluginAuditsSchema =
|
|
188
|
+
var pluginAuditsSchema = z3.array(auditSchema, {
|
|
171
189
|
description: "List of audits maintained in a plugin"
|
|
172
190
|
}).min(1).refine(
|
|
173
191
|
(auditMetadata) => !getDuplicateSlugsInAudits(auditMetadata),
|
|
@@ -186,31 +204,16 @@ function getDuplicateSlugsInAudits(audits) {
|
|
|
186
204
|
}
|
|
187
205
|
|
|
188
206
|
// packages/models/src/lib/audit-output.ts
|
|
189
|
-
import { z as
|
|
207
|
+
import { z as z6 } from "zod";
|
|
190
208
|
|
|
191
209
|
// packages/models/src/lib/issue.ts
|
|
192
|
-
import { z as
|
|
193
|
-
var
|
|
194
|
-
{
|
|
195
|
-
file: filePathSchema.describe("Relative path to source file in Git repo"),
|
|
196
|
-
position: z3.object(
|
|
197
|
-
{
|
|
198
|
-
startLine: positiveIntSchema.describe("Start line"),
|
|
199
|
-
startColumn: positiveIntSchema.describe("Start column").optional(),
|
|
200
|
-
endLine: positiveIntSchema.describe("End line").optional(),
|
|
201
|
-
endColumn: positiveIntSchema.describe("End column").optional()
|
|
202
|
-
},
|
|
203
|
-
{ description: "Location in file" }
|
|
204
|
-
).optional()
|
|
205
|
-
},
|
|
206
|
-
{ description: "Source file location" }
|
|
207
|
-
);
|
|
208
|
-
var issueSeveritySchema = z3.enum(["info", "warning", "error"], {
|
|
210
|
+
import { z as z4 } from "zod";
|
|
211
|
+
var issueSeveritySchema = z4.enum(["info", "warning", "error"], {
|
|
209
212
|
description: "Severity level"
|
|
210
213
|
});
|
|
211
|
-
var issueSchema =
|
|
214
|
+
var issueSchema = z4.object(
|
|
212
215
|
{
|
|
213
|
-
message:
|
|
216
|
+
message: z4.string({ description: "Descriptive error message" }).max(MAX_ISSUE_MESSAGE_LENGTH),
|
|
214
217
|
severity: issueSeveritySchema,
|
|
215
218
|
source: sourceFileLocationSchema.optional()
|
|
216
219
|
},
|
|
@@ -218,61 +221,61 @@ var issueSchema = z3.object(
|
|
|
218
221
|
);
|
|
219
222
|
|
|
220
223
|
// packages/models/src/lib/table.ts
|
|
221
|
-
import { z as
|
|
222
|
-
var tableAlignmentSchema =
|
|
224
|
+
import { z as z5 } from "zod";
|
|
225
|
+
var tableAlignmentSchema = z5.enum(["left", "center", "right"], {
|
|
223
226
|
description: "Cell alignment"
|
|
224
227
|
});
|
|
225
228
|
var tableColumnPrimitiveSchema = tableAlignmentSchema;
|
|
226
|
-
var tableColumnObjectSchema =
|
|
227
|
-
key:
|
|
228
|
-
label:
|
|
229
|
+
var tableColumnObjectSchema = z5.object({
|
|
230
|
+
key: z5.string(),
|
|
231
|
+
label: z5.string().optional(),
|
|
229
232
|
align: tableAlignmentSchema.optional()
|
|
230
233
|
});
|
|
231
|
-
var tableRowObjectSchema =
|
|
234
|
+
var tableRowObjectSchema = z5.record(tableCellValueSchema, {
|
|
232
235
|
description: "Object row"
|
|
233
236
|
});
|
|
234
|
-
var tableRowPrimitiveSchema =
|
|
237
|
+
var tableRowPrimitiveSchema = z5.array(tableCellValueSchema, {
|
|
235
238
|
description: "Primitive row"
|
|
236
239
|
});
|
|
237
|
-
var tableSharedSchema =
|
|
238
|
-
title:
|
|
240
|
+
var tableSharedSchema = z5.object({
|
|
241
|
+
title: z5.string().optional().describe("Display title for table")
|
|
239
242
|
});
|
|
240
243
|
var tablePrimitiveSchema = tableSharedSchema.merge(
|
|
241
|
-
|
|
244
|
+
z5.object(
|
|
242
245
|
{
|
|
243
|
-
columns:
|
|
244
|
-
rows:
|
|
246
|
+
columns: z5.array(tableAlignmentSchema).optional(),
|
|
247
|
+
rows: z5.array(tableRowPrimitiveSchema)
|
|
245
248
|
},
|
|
246
249
|
{ description: "Table with primitive rows and optional alignment columns" }
|
|
247
250
|
)
|
|
248
251
|
);
|
|
249
252
|
var tableObjectSchema = tableSharedSchema.merge(
|
|
250
|
-
|
|
253
|
+
z5.object(
|
|
251
254
|
{
|
|
252
|
-
columns:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
columns: z5.union([
|
|
256
|
+
z5.array(tableAlignmentSchema),
|
|
257
|
+
z5.array(tableColumnObjectSchema)
|
|
255
258
|
]).optional(),
|
|
256
|
-
rows:
|
|
259
|
+
rows: z5.array(tableRowObjectSchema)
|
|
257
260
|
},
|
|
258
261
|
{
|
|
259
262
|
description: "Table with object rows and optional alignment or object columns"
|
|
260
263
|
}
|
|
261
264
|
)
|
|
262
265
|
);
|
|
263
|
-
var tableSchema = (description = "Table information") =>
|
|
266
|
+
var tableSchema = (description = "Table information") => z5.union([tablePrimitiveSchema, tableObjectSchema], { description });
|
|
264
267
|
|
|
265
268
|
// packages/models/src/lib/audit-output.ts
|
|
266
269
|
var auditValueSchema = nonnegativeNumberSchema.describe("Raw numeric value");
|
|
267
|
-
var auditDisplayValueSchema =
|
|
268
|
-
var auditDetailsSchema =
|
|
270
|
+
var auditDisplayValueSchema = z6.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional();
|
|
271
|
+
var auditDetailsSchema = z6.object(
|
|
269
272
|
{
|
|
270
|
-
issues:
|
|
273
|
+
issues: z6.array(issueSchema, { description: "List of findings" }).optional(),
|
|
271
274
|
table: tableSchema("Table of related findings").optional()
|
|
272
275
|
},
|
|
273
276
|
{ description: "Detailed information" }
|
|
274
277
|
);
|
|
275
|
-
var auditOutputSchema =
|
|
278
|
+
var auditOutputSchema = z6.object(
|
|
276
279
|
{
|
|
277
280
|
slug: slugSchema.describe("Reference to audit"),
|
|
278
281
|
displayValue: auditDisplayValueSchema,
|
|
@@ -282,7 +285,7 @@ var auditOutputSchema = z5.object(
|
|
|
282
285
|
},
|
|
283
286
|
{ description: "Audit information" }
|
|
284
287
|
);
|
|
285
|
-
var auditOutputsSchema =
|
|
288
|
+
var auditOutputsSchema = z6.array(auditOutputSchema, {
|
|
286
289
|
description: "List of JSON formatted audit output emitted by the runner process of a plugin"
|
|
287
290
|
}).refine(
|
|
288
291
|
(audits) => !getDuplicateSlugsInAudits2(audits),
|
|
@@ -299,13 +302,13 @@ function getDuplicateSlugsInAudits2(audits) {
|
|
|
299
302
|
}
|
|
300
303
|
|
|
301
304
|
// packages/models/src/lib/category-config.ts
|
|
302
|
-
import { z as
|
|
305
|
+
import { z as z7 } from "zod";
|
|
303
306
|
var categoryRefSchema = weightedRefSchema(
|
|
304
307
|
"Weighted references to audits and/or groups for the category",
|
|
305
308
|
"Slug of an audit or group (depending on `type`)"
|
|
306
309
|
).merge(
|
|
307
|
-
|
|
308
|
-
type:
|
|
310
|
+
z7.object({
|
|
311
|
+
type: z7.enum(["audit", "group"], {
|
|
309
312
|
description: "Discriminant for reference kind, affects where `slug` is looked up"
|
|
310
313
|
}),
|
|
311
314
|
plugin: slugSchema.describe(
|
|
@@ -326,8 +329,8 @@ var categoryConfigSchema = scorableSchema(
|
|
|
326
329
|
description: "Meta info for category"
|
|
327
330
|
})
|
|
328
331
|
).merge(
|
|
329
|
-
|
|
330
|
-
isBinary:
|
|
332
|
+
z7.object({
|
|
333
|
+
isBinary: z7.boolean({
|
|
331
334
|
description: 'Is this a binary category (i.e. only a perfect score considered a "pass")?'
|
|
332
335
|
}).optional()
|
|
333
336
|
})
|
|
@@ -343,7 +346,7 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
|
|
|
343
346
|
metrics.map(({ slug, type, plugin }) => `${type} :: ${plugin} / ${slug}`)
|
|
344
347
|
);
|
|
345
348
|
}
|
|
346
|
-
var categoriesSchema =
|
|
349
|
+
var categoriesSchema = z7.array(categoryConfigSchema, {
|
|
347
350
|
description: "Categorization of individual audits"
|
|
348
351
|
}).refine(
|
|
349
352
|
(categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
|
|
@@ -362,18 +365,18 @@ function getDuplicateSlugCategories(categories) {
|
|
|
362
365
|
}
|
|
363
366
|
|
|
364
367
|
// packages/models/src/lib/commit.ts
|
|
365
|
-
import { z as
|
|
366
|
-
var commitSchema =
|
|
368
|
+
import { z as z8 } from "zod";
|
|
369
|
+
var commitSchema = z8.object(
|
|
367
370
|
{
|
|
368
|
-
hash:
|
|
371
|
+
hash: z8.string({ description: "Commit SHA (full)" }).regex(
|
|
369
372
|
/^[\da-f]{40}$/,
|
|
370
373
|
"Commit SHA should be a 40-character hexadecimal string"
|
|
371
374
|
),
|
|
372
|
-
message:
|
|
373
|
-
date:
|
|
375
|
+
message: z8.string({ description: "Commit message" }),
|
|
376
|
+
date: z8.coerce.date({
|
|
374
377
|
description: "Date and time when commit was authored"
|
|
375
378
|
}),
|
|
376
|
-
author:
|
|
379
|
+
author: z8.string({
|
|
377
380
|
description: "Commit author name"
|
|
378
381
|
}).trim()
|
|
379
382
|
},
|
|
@@ -381,22 +384,22 @@ var commitSchema = z7.object(
|
|
|
381
384
|
);
|
|
382
385
|
|
|
383
386
|
// packages/models/src/lib/core-config.ts
|
|
384
|
-
import { z as
|
|
387
|
+
import { z as z14 } from "zod";
|
|
385
388
|
|
|
386
389
|
// packages/models/src/lib/persist-config.ts
|
|
387
|
-
import { z as
|
|
388
|
-
var formatSchema =
|
|
389
|
-
var persistConfigSchema =
|
|
390
|
+
import { z as z9 } from "zod";
|
|
391
|
+
var formatSchema = z9.enum(["json", "md"]);
|
|
392
|
+
var persistConfigSchema = z9.object({
|
|
390
393
|
outputDir: filePathSchema.describe("Artifacts folder").optional(),
|
|
391
394
|
filename: fileNameSchema.describe("Artifacts file name (without extension)").optional(),
|
|
392
|
-
format:
|
|
395
|
+
format: z9.array(formatSchema).optional()
|
|
393
396
|
});
|
|
394
397
|
|
|
395
398
|
// packages/models/src/lib/plugin-config.ts
|
|
396
|
-
import { z as
|
|
399
|
+
import { z as z12 } from "zod";
|
|
397
400
|
|
|
398
401
|
// packages/models/src/lib/group.ts
|
|
399
|
-
import { z as
|
|
402
|
+
import { z as z10 } from "zod";
|
|
400
403
|
var groupRefSchema = weightedRefSchema(
|
|
401
404
|
"Weighted reference to a group",
|
|
402
405
|
"Reference slug to a group within this plugin (e.g. 'max-lines')"
|
|
@@ -413,7 +416,7 @@ var groupSchema = scorableSchema(
|
|
|
413
416
|
getDuplicateRefsInGroups,
|
|
414
417
|
duplicateRefsInGroupsErrorMsg
|
|
415
418
|
).merge(groupMetaSchema);
|
|
416
|
-
var groupsSchema =
|
|
419
|
+
var groupsSchema = z10.array(groupSchema, {
|
|
417
420
|
description: "List of groups"
|
|
418
421
|
}).optional().refine(
|
|
419
422
|
(groups) => !getDuplicateSlugsInGroups(groups),
|
|
@@ -441,14 +444,14 @@ function getDuplicateSlugsInGroups(groups) {
|
|
|
441
444
|
}
|
|
442
445
|
|
|
443
446
|
// packages/models/src/lib/runner-config.ts
|
|
444
|
-
import { z as
|
|
445
|
-
var outputTransformSchema =
|
|
446
|
-
var runnerConfigSchema =
|
|
447
|
+
import { z as z11 } from "zod";
|
|
448
|
+
var outputTransformSchema = z11.function().args(z11.unknown()).returns(z11.union([auditOutputsSchema, z11.promise(auditOutputsSchema)]));
|
|
449
|
+
var runnerConfigSchema = z11.object(
|
|
447
450
|
{
|
|
448
|
-
command:
|
|
451
|
+
command: z11.string({
|
|
449
452
|
description: "Shell command to execute"
|
|
450
453
|
}),
|
|
451
|
-
args:
|
|
454
|
+
args: z11.array(z11.string({ description: "Command arguments" })).optional(),
|
|
452
455
|
outputFile: filePathSchema.describe("Output path"),
|
|
453
456
|
outputTransform: outputTransformSchema.optional()
|
|
454
457
|
},
|
|
@@ -456,8 +459,8 @@ var runnerConfigSchema = z10.object(
|
|
|
456
459
|
description: "How to execute runner"
|
|
457
460
|
}
|
|
458
461
|
);
|
|
459
|
-
var onProgressSchema =
|
|
460
|
-
var runnerFunctionSchema =
|
|
462
|
+
var onProgressSchema = z11.function().args(z11.unknown()).returns(z11.void());
|
|
463
|
+
var runnerFunctionSchema = z11.function().args(onProgressSchema.optional()).returns(z11.union([auditOutputsSchema, z11.promise(auditOutputsSchema)]));
|
|
461
464
|
|
|
462
465
|
// packages/models/src/lib/plugin-config.ts
|
|
463
466
|
var pluginMetaSchema = packageVersionSchema().merge(
|
|
@@ -468,13 +471,13 @@ var pluginMetaSchema = packageVersionSchema().merge(
|
|
|
468
471
|
description: "Plugin metadata"
|
|
469
472
|
})
|
|
470
473
|
).merge(
|
|
471
|
-
|
|
474
|
+
z12.object({
|
|
472
475
|
slug: slugSchema.describe("Unique plugin slug within core config"),
|
|
473
476
|
icon: materialIconSchema
|
|
474
477
|
})
|
|
475
478
|
);
|
|
476
|
-
var pluginDataSchema =
|
|
477
|
-
runner:
|
|
479
|
+
var pluginDataSchema = z12.object({
|
|
480
|
+
runner: z12.union([runnerConfigSchema, runnerFunctionSchema]),
|
|
478
481
|
audits: pluginAuditsSchema,
|
|
479
482
|
groups: groupsSchema
|
|
480
483
|
});
|
|
@@ -500,22 +503,22 @@ function getMissingRefsFromGroups(pluginCfg) {
|
|
|
500
503
|
}
|
|
501
504
|
|
|
502
505
|
// packages/models/src/lib/upload-config.ts
|
|
503
|
-
import { z as
|
|
504
|
-
var uploadConfigSchema =
|
|
506
|
+
import { z as z13 } from "zod";
|
|
507
|
+
var uploadConfigSchema = z13.object({
|
|
505
508
|
server: urlSchema.describe("URL of deployed portal API"),
|
|
506
|
-
apiKey:
|
|
509
|
+
apiKey: z13.string({
|
|
507
510
|
description: "API key with write access to portal (use `process.env` for security)"
|
|
508
511
|
}),
|
|
509
512
|
organization: slugSchema.describe(
|
|
510
513
|
"Organization slug from Code PushUp portal"
|
|
511
514
|
),
|
|
512
515
|
project: slugSchema.describe("Project slug from Code PushUp portal"),
|
|
513
|
-
timeout:
|
|
516
|
+
timeout: z13.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
|
|
514
517
|
});
|
|
515
518
|
|
|
516
519
|
// packages/models/src/lib/core-config.ts
|
|
517
|
-
var unrefinedCoreConfigSchema =
|
|
518
|
-
plugins:
|
|
520
|
+
var unrefinedCoreConfigSchema = z14.object({
|
|
521
|
+
plugins: z14.array(pluginConfigSchema, {
|
|
519
522
|
description: "List of plugins to be used (official, community-provided, or custom)"
|
|
520
523
|
}).min(1),
|
|
521
524
|
/** portal configuration for persisting results */
|
|
@@ -547,7 +550,7 @@ var DEFAULT_PERSIST_FILENAME = "report";
|
|
|
547
550
|
var DEFAULT_PERSIST_FORMAT = ["json", "md"];
|
|
548
551
|
|
|
549
552
|
// packages/models/src/lib/report.ts
|
|
550
|
-
import { z as
|
|
553
|
+
import { z as z15 } from "zod";
|
|
551
554
|
var auditReportSchema = auditSchema.merge(auditOutputSchema);
|
|
552
555
|
var pluginReportSchema = pluginMetaSchema.merge(
|
|
553
556
|
executionMetaSchema({
|
|
@@ -555,9 +558,9 @@ var pluginReportSchema = pluginMetaSchema.merge(
|
|
|
555
558
|
descriptionDuration: "Duration of the plugin run in ms"
|
|
556
559
|
})
|
|
557
560
|
).merge(
|
|
558
|
-
|
|
559
|
-
audits:
|
|
560
|
-
groups:
|
|
561
|
+
z15.object({
|
|
562
|
+
audits: z15.array(auditReportSchema).min(1),
|
|
563
|
+
groups: z15.array(groupSchema).optional()
|
|
561
564
|
})
|
|
562
565
|
).refine(
|
|
563
566
|
(pluginReport) => !getMissingRefsFromGroups2(pluginReport.audits, pluginReport.groups ?? []),
|
|
@@ -591,10 +594,10 @@ var reportSchema = packageVersionSchema({
|
|
|
591
594
|
descriptionDuration: "Duration of the collect run in ms"
|
|
592
595
|
})
|
|
593
596
|
).merge(
|
|
594
|
-
|
|
597
|
+
z15.object(
|
|
595
598
|
{
|
|
596
|
-
categories:
|
|
597
|
-
plugins:
|
|
599
|
+
categories: z15.array(categoryConfigSchema),
|
|
600
|
+
plugins: z15.array(pluginReportSchema).min(1),
|
|
598
601
|
commit: commitSchema.describe("Git commit for which report was collected").nullable()
|
|
599
602
|
},
|
|
600
603
|
{ description: "Collect output data" }
|
|
@@ -610,40 +613,40 @@ var reportSchema = packageVersionSchema({
|
|
|
610
613
|
);
|
|
611
614
|
|
|
612
615
|
// packages/models/src/lib/reports-diff.ts
|
|
613
|
-
import { z as
|
|
616
|
+
import { z as z16 } from "zod";
|
|
614
617
|
function makeComparisonSchema(schema) {
|
|
615
618
|
const sharedDescription = schema.description || "Result";
|
|
616
|
-
return
|
|
619
|
+
return z16.object({
|
|
617
620
|
before: schema.describe(`${sharedDescription} (source commit)`),
|
|
618
621
|
after: schema.describe(`${sharedDescription} (target commit)`)
|
|
619
622
|
});
|
|
620
623
|
}
|
|
621
624
|
function makeArraysComparisonSchema(diffSchema, resultSchema, description) {
|
|
622
|
-
return
|
|
625
|
+
return z16.object(
|
|
623
626
|
{
|
|
624
|
-
changed:
|
|
625
|
-
unchanged:
|
|
626
|
-
added:
|
|
627
|
-
removed:
|
|
627
|
+
changed: z16.array(diffSchema),
|
|
628
|
+
unchanged: z16.array(resultSchema),
|
|
629
|
+
added: z16.array(resultSchema),
|
|
630
|
+
removed: z16.array(resultSchema)
|
|
628
631
|
},
|
|
629
632
|
{ description }
|
|
630
633
|
);
|
|
631
634
|
}
|
|
632
|
-
var scorableMetaSchema =
|
|
635
|
+
var scorableMetaSchema = z16.object({
|
|
633
636
|
slug: slugSchema,
|
|
634
637
|
title: titleSchema,
|
|
635
638
|
docsUrl: docsUrlSchema
|
|
636
639
|
});
|
|
637
640
|
var scorableWithPluginMetaSchema = scorableMetaSchema.merge(
|
|
638
|
-
|
|
641
|
+
z16.object({
|
|
639
642
|
plugin: pluginMetaSchema.pick({ slug: true, title: true, docsUrl: true }).describe("Plugin which defines it")
|
|
640
643
|
})
|
|
641
644
|
);
|
|
642
645
|
var scorableDiffSchema = scorableMetaSchema.merge(
|
|
643
|
-
|
|
646
|
+
z16.object({
|
|
644
647
|
scores: makeComparisonSchema(scoreSchema).merge(
|
|
645
|
-
|
|
646
|
-
diff:
|
|
648
|
+
z16.object({
|
|
649
|
+
diff: z16.number().min(-1).max(1).describe("Score change (`scores.after - scores.before`)")
|
|
647
650
|
})
|
|
648
651
|
).describe("Score comparison")
|
|
649
652
|
})
|
|
@@ -654,10 +657,10 @@ var scorableWithPluginDiffSchema = scorableDiffSchema.merge(
|
|
|
654
657
|
var categoryDiffSchema = scorableDiffSchema;
|
|
655
658
|
var groupDiffSchema = scorableWithPluginDiffSchema;
|
|
656
659
|
var auditDiffSchema = scorableWithPluginDiffSchema.merge(
|
|
657
|
-
|
|
660
|
+
z16.object({
|
|
658
661
|
values: makeComparisonSchema(auditValueSchema).merge(
|
|
659
|
-
|
|
660
|
-
diff:
|
|
662
|
+
z16.object({
|
|
663
|
+
diff: z16.number().int().describe("Value change (`values.after - values.before`)")
|
|
661
664
|
})
|
|
662
665
|
).describe("Audit `value` comparison"),
|
|
663
666
|
displayValues: makeComparisonSchema(auditDisplayValueSchema).describe(
|
|
@@ -666,18 +669,18 @@ var auditDiffSchema = scorableWithPluginDiffSchema.merge(
|
|
|
666
669
|
})
|
|
667
670
|
);
|
|
668
671
|
var categoryResultSchema = scorableMetaSchema.merge(
|
|
669
|
-
|
|
672
|
+
z16.object({ score: scoreSchema })
|
|
670
673
|
);
|
|
671
674
|
var groupResultSchema = scorableWithPluginMetaSchema.merge(
|
|
672
|
-
|
|
675
|
+
z16.object({ score: scoreSchema })
|
|
673
676
|
);
|
|
674
677
|
var auditResultSchema = scorableWithPluginMetaSchema.merge(
|
|
675
678
|
auditOutputSchema.pick({ score: true, value: true, displayValue: true })
|
|
676
679
|
);
|
|
677
|
-
var reportsDiffSchema =
|
|
680
|
+
var reportsDiffSchema = z16.object({
|
|
678
681
|
commits: makeComparisonSchema(commitSchema).nullable().describe("Commits identifying compared reports"),
|
|
679
682
|
portalUrl: urlSchema.optional().describe("Link to comparison page in Code PushUp portal"),
|
|
680
|
-
label:
|
|
683
|
+
label: z16.string().optional().describe("Label (e.g. project name)"),
|
|
681
684
|
categories: makeArraysComparisonSchema(
|
|
682
685
|
categoryDiffSchema,
|
|
683
686
|
categoryResultSchema,
|
|
@@ -745,6 +748,7 @@ export {
|
|
|
745
748
|
reportsDiffSchema,
|
|
746
749
|
runnerConfigSchema,
|
|
747
750
|
runnerFunctionSchema,
|
|
751
|
+
sourceFileLocationSchema,
|
|
748
752
|
tableAlignmentSchema,
|
|
749
753
|
tableCellValueSchema,
|
|
750
754
|
tableColumnObjectSchema,
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { type TableCellValue, tableCellValueSchema, } from './lib/implementation/schemas';
|
|
2
|
+
export { type SourceFileLocation, sourceFileLocationSchema, } from './lib/source';
|
|
2
3
|
export { type Audit, auditSchema } from './lib/audit';
|
|
3
4
|
export { type AuditDetails, type AuditOutput, type AuditOutputs, auditDetailsSchema, auditOutputSchema, auditOutputsSchema, } from './lib/audit-output';
|
|
4
5
|
export { type CategoryConfig, type CategoryRef, categoryConfigSchema, categoryRefSchema, } from './lib/category-config';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const sourceFileLocationSchema: z.ZodObject<{
|
|
3
|
+
file: z.ZodString;
|
|
4
|
+
position: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
startLine: z.ZodNumber;
|
|
6
|
+
startColumn: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
endLine: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
endColumn: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
startLine: number;
|
|
11
|
+
startColumn?: number | undefined;
|
|
12
|
+
endLine?: number | undefined;
|
|
13
|
+
endColumn?: number | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
startLine: number;
|
|
16
|
+
startColumn?: number | undefined;
|
|
17
|
+
endLine?: number | undefined;
|
|
18
|
+
endColumn?: number | undefined;
|
|
19
|
+
}>>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
file: string;
|
|
22
|
+
position?: {
|
|
23
|
+
startLine: number;
|
|
24
|
+
startColumn?: number | undefined;
|
|
25
|
+
endLine?: number | undefined;
|
|
26
|
+
endColumn?: number | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
file: string;
|
|
30
|
+
position?: {
|
|
31
|
+
startLine: number;
|
|
32
|
+
startColumn?: number | undefined;
|
|
33
|
+
endLine?: number | undefined;
|
|
34
|
+
endColumn?: number | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
export type SourceFileLocation = z.infer<typeof sourceFileLocationSchema>;
|