-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
78 lines (73 loc) · 1.71 KB
/
types.ts
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { z } from "zod";
type Env = { API_AUTH: string; PAGE_CACHE: KVNamespace };
// deno-lint-ignore no-explicit-any
type Attributes = Record<string, any>;
type Category = { id: string; title: string; url: string; library: Library };
const ZLibrary = z.object({
id: z.string(),
description: z.string(),
logo: z.string().optional(),
name: z.string(),
links: z.object({
site: z.string().optional(),
github: z.string().optional(),
}),
tags: z.array(z.string()),
stargazers: z.number().optional(),
// There is more data available but only a subset is used for now.
security: z
.object({
score: z.object({
supplyChain: z.number(),
quality: z.number(),
maintenance: z.number(),
vulnerability: z.number(),
license: z.number(),
}),
metrics: z.object({
dependencyCount: z.number(),
dependencyVulnerabilityCount: z.number(),
}),
})
.optional(),
});
type Library = z.infer<typeof ZLibrary>;
type DataContext = Record<string, unknown> | Record<string, unknown>[];
type ParentCategory = { title: string; children: Category[] };
type BlogPost = {
path: string;
id: string;
title: string;
shortTitle: string;
slug: string;
date: string;
type: "comparison" | "interview" | "rating" | "static";
user: string;
includes?: string[];
body: string;
footer?: string;
table?: Record<string, string[]>;
profile?: {
name: string;
twitter: string;
github: string;
bio: string;
photo: string;
};
};
type Tag = {
id: string;
title: string;
libraries: Library[];
};
export { ZLibrary };
export type {
Env,
Attributes,
BlogPost,
Category,
DataContext,
Library,
ParentCategory,
Tag,
};