tangled
alpha
login
or
join now
isuggest.selfce.st
/
strand
3
fork
atom
alternative tangled frontend (extremely wip)
3
fork
atom
overview
issues
pulls
pipelines
feat: zod schema for tangled actor lexicon
serenity
2 weeks ago
1b9a65ba
78b5f0d6
+80
1 changed file
expand all
collapse all
unified
split
src
lib
types
lexicons
sh
tangled
actor
profile.ts
+80
src/lib/types/lexicons/sh/tangled/actor/profile.ts
···
1
1
+
import { z } from "zod/v4";
2
2
+
3
3
+
/**
4
4
+
* Zod v4 schema for the ATProto lexicon: sh.tangled.actor.profile
5
5
+
*
6
6
+
* A declaration of a Tangled account profile.
7
7
+
* Record key: "literal:self"
8
8
+
*/
9
9
+
10
10
+
const blobSchema = z.object({
11
11
+
$type: z.literal("blob"),
12
12
+
ref: z.object({
13
13
+
$link: z.string(),
14
14
+
}),
15
15
+
mimeType: z.enum(["image/png", "image/jpeg"]),
16
16
+
size: z.number().int().max(1000000),
17
17
+
});
18
18
+
19
19
+
const _statsEnum = z.enum([
20
20
+
"merged-pull-request-count",
21
21
+
"closed-pull-request-count",
22
22
+
"open-pull-request-count",
23
23
+
"open-issue-count",
24
24
+
"closed-issue-count",
25
25
+
"repository-count",
26
26
+
"star-count",
27
27
+
]);
28
28
+
29
29
+
export const shTangledActorProfileSchema = z.object({
30
30
+
avatar: blobSchema
31
31
+
.describe(
32
32
+
"Small image to be displayed next to posts from account. AKA, 'profile picture'",
33
33
+
)
34
34
+
.optional(),
35
35
+
36
36
+
description: z
37
37
+
.string()
38
38
+
.max(2560)
39
39
+
.describe("Free-form profile description text.")
40
40
+
.optional(),
41
41
+
42
42
+
links: z
43
43
+
.array(
44
44
+
z
45
45
+
.url()
46
46
+
.describe(
47
47
+
"Any URI, intended for social profiles or websites, can be used to link DIDs/AT-URIs too.",
48
48
+
),
49
49
+
)
50
50
+
.min(0)
51
51
+
.max(5)
52
52
+
.optional(),
53
53
+
54
54
+
stats: z
55
55
+
.array(_statsEnum.describe("Vanity stats."))
56
56
+
.min(0)
57
57
+
.max(2)
58
58
+
.optional(),
59
59
+
60
60
+
bluesky: z.boolean().describe("Include link to this account on Bluesky."),
61
61
+
62
62
+
location: z
63
63
+
.string()
64
64
+
.max(400)
65
65
+
.describe("Free-form location text.")
66
66
+
.optional(),
67
67
+
68
68
+
pinnedRepositories: z
69
69
+
.array(z.string().describe("AT-URI reference to a repository."))
70
70
+
.min(0)
71
71
+
.max(6)
72
72
+
.describe("Any ATURI, it is up to appviews to validate these fields.")
73
73
+
.optional(),
74
74
+
75
75
+
pronouns: z
76
76
+
.string()
77
77
+
.max(40)
78
78
+
.describe("Preferred gender pronouns.")
79
79
+
.optional(),
80
80
+
});