-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathmanifest-schema.mts
More file actions
45 lines (41 loc) · 1.17 KB
/
manifest-schema.mts
File metadata and controls
45 lines (41 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { z } from 'zod'
export type PatchManifest = z.infer<typeof PatchManifestSchema>
export type PatchRecord = z.infer<typeof PatchRecordSchema>
export const PatchRecordSchema = z.object({
description: z.string().optional(),
exportedAt: z.string(),
files: z.record(
z.string(), // File path.
z.object({
beforeHash: z.string(),
afterHash: z.string(),
}),
),
license: z.string().optional(),
tier: z.string().optional(),
uuid: z.string().optional(),
vulnerabilities: z
.record(
z.string(), // Vulnerability ID like "GHSA-jrhj-2j3q-xf3v".
z.object({
cves: z.array(z.string()),
summary: z.string(),
severity: z.string(),
description: z.string(),
patchExplanation: z.string(),
}),
)
.optional(),
// Status tracking fields.
status: z.enum(['downloaded', 'applied', 'failed']).optional(),
downloadedAt: z.string().optional(),
appliedAt: z.string().optional(),
appliedTo: z.array(z.string()).optional(),
})
export const PatchManifestSchema = z.object({
patches: z.record(
// Package identifier like "npm:simplehttpserver@0.0.6".
z.string(),
PatchRecordSchema,
),
})