@llun/activities.schema 0.2.34 → 0.3.1
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/.claude/settings.local.json +22 -0
- package/.yarn/install-state.gz +0 -0
- package/dist/cjs/announce.js +1 -1
- package/dist/cjs/mastodon/account/field.js +4 -9
- package/dist/cjs/mastodon/account/source.js +4 -12
- package/dist/cjs/mastodon/account.js +27 -66
- package/dist/cjs/mastodon/customEmoji.js +6 -15
- package/dist/cjs/mastodon/filter/index.js +4 -7
- package/dist/cjs/mastodon/filter/keyword.js +3 -5
- package/dist/cjs/mastodon/filter/status.js +2 -4
- package/dist/cjs/mastodon/mediaAttachment/base.js +10 -18
- package/dist/cjs/mastodon/mediaAttachment/gifv.js +2 -6
- package/dist/cjs/mastodon/mediaAttachment/video.js +2 -6
- package/dist/cjs/mastodon/poll/index.js +9 -11
- package/dist/cjs/mastodon/poll/option.js +3 -4
- package/dist/cjs/mastodon/previewCard.js +15 -28
- package/dist/cjs/mastodon/status/application.js +3 -6
- package/dist/cjs/mastodon/status/base.js +31 -54
- package/dist/cjs/mastodon/status/mention.js +4 -8
- package/dist/cjs/mastodon/status/tag.js +2 -6
- package/dist/cjs/note/baseContent.js +11 -12
- package/dist/cjs/question.js +1 -1
- package/dist/esm/announce.js +1 -1
- package/dist/esm/mastodon/account/field.js +4 -9
- package/dist/esm/mastodon/account/source.js +4 -12
- package/dist/esm/mastodon/account.js +27 -66
- package/dist/esm/mastodon/customEmoji.js +6 -15
- package/dist/esm/mastodon/filter/index.js +4 -7
- package/dist/esm/mastodon/filter/keyword.js +3 -5
- package/dist/esm/mastodon/filter/status.js +2 -4
- package/dist/esm/mastodon/mediaAttachment/base.js +10 -18
- package/dist/esm/mastodon/mediaAttachment/gifv.js +2 -6
- package/dist/esm/mastodon/mediaAttachment/video.js +2 -6
- package/dist/esm/mastodon/poll/index.js +9 -11
- package/dist/esm/mastodon/poll/option.js +3 -4
- package/dist/esm/mastodon/previewCard.js +15 -28
- package/dist/esm/mastodon/status/application.js +3 -6
- package/dist/esm/mastodon/status/base.js +31 -54
- package/dist/esm/mastodon/status/mention.js +4 -8
- package/dist/esm/mastodon/status/tag.js +2 -6
- package/dist/esm/note/baseContent.js +11 -12
- package/dist/esm/question.js +1 -1
- package/dist/types/accept.d.ts +2 -32
- package/dist/types/actor.d.ts +18 -288
- package/dist/types/announce.d.ts +3 -19
- package/dist/types/collection.d.ts +11 -87
- package/dist/types/follow.d.ts +1 -11
- package/dist/types/image.d.ts +1 -9
- package/dist/types/like.d.ts +27 -576
- package/dist/types/mastodon/account/field.d.ts +1 -9
- package/dist/types/mastodon/account/relationship.d.ts +2 -34
- package/dist/types/mastodon/account/source.d.ts +8 -33
- package/dist/types/mastodon/account.d.ts +22 -397
- package/dist/types/mastodon/customEmoji.d.ts +1 -13
- package/dist/types/mastodon/filter/index.d.ts +14 -49
- package/dist/types/mastodon/filter/keyword.d.ts +1 -9
- package/dist/types/mastodon/filter/status.d.ts +1 -7
- package/dist/types/mastodon/filterResult.d.ts +17 -90
- package/dist/types/mastodon/mediaAttachment/audio.d.ts +3 -68
- package/dist/types/mastodon/mediaAttachment/base.d.ts +1 -15
- package/dist/types/mastodon/mediaAttachment/gifv.d.ts +4 -129
- package/dist/types/mastodon/mediaAttachment/image.d.ts +5 -118
- package/dist/types/mastodon/mediaAttachment/index.d.ts +35 -949
- package/dist/types/mastodon/mediaAttachment/unknown.d.ts +1 -18
- package/dist/types/mastodon/mediaAttachment/video.d.ts +4 -141
- package/dist/types/mastodon/poll/index.d.ts +4 -62
- package/dist/types/mastodon/poll/option.d.ts +1 -7
- package/dist/types/mastodon/previewCard.d.ts +7 -32
- package/dist/types/mastodon/status/application.d.ts +1 -7
- package/dist/types/mastodon/status/base.d.ts +79 -1722
- package/dist/types/mastodon/status/index.d.ts +158 -4073
- package/dist/types/mastodon/status/mention.d.ts +1 -11
- package/dist/types/mastodon/status/tag.d.ts +1 -7
- package/dist/types/mastodon/visibility.d.ts +6 -1
- package/dist/types/note/attachment.d.ts +3 -29
- package/dist/types/note/baseContent.d.ts +25 -379
- package/dist/types/note/document.d.ts +1 -19
- package/dist/types/note/emoji.d.ts +2 -28
- package/dist/types/note/hashtag.d.ts +1 -9
- package/dist/types/note/mention.d.ts +1 -9
- package/dist/types/note/propertyValue.d.ts +1 -9
- package/dist/types/note/tag.d.ts +5 -47
- package/dist/types/note.d.ts +25 -382
- package/dist/types/question/note.d.ts +2 -22
- package/dist/types/question.d.ts +27 -422
- package/dist/types/reject.d.ts +2 -32
- package/dist/types/tombstone.d.ts +1 -7
- package/dist/types/undo.d.ts +30 -801
- package/package.json +4 -4
- package/src/announce.ts +1 -1
- package/src/mastodon/account/field.ts +6 -10
- package/src/mastodon/account/source.ts +4 -12
- package/src/mastodon/account.ts +71 -78
- package/src/mastodon/customEmoji.ts +8 -16
- package/src/mastodon/filter/index.ts +6 -8
- package/src/mastodon/filter/keyword.ts +5 -6
- package/src/mastodon/filter/status.ts +2 -4
- package/src/mastodon/mediaAttachment/base.ts +16 -21
- package/src/mastodon/mediaAttachment/gifv.ts +2 -6
- package/src/mastodon/mediaAttachment/video.ts +2 -6
- package/src/mastodon/poll/index.ts +13 -13
- package/src/mastodon/poll/option.ts +5 -5
- package/src/mastodon/previewCard.ts +17 -29
- package/src/mastodon/status/application.ts +5 -7
- package/src/mastodon/status/base.ts +53 -65
- package/src/mastodon/status/mention.ts +6 -9
- package/src/mastodon/status/tag.ts +2 -6
- package/src/note/baseContent.ts +13 -13
- package/src/question.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llun/activities.schema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Validate ActivityPub and Mastodon with Zod",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"author": "Maythee Anegboonlap <null@llun.dev>",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"zod": "^
|
|
16
|
+
"zod": "^4.2.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"typescript": "^5.
|
|
19
|
+
"typescript": "^5.9.3"
|
|
20
20
|
},
|
|
21
|
-
"packageManager": "yarn@4.
|
|
21
|
+
"packageManager": "yarn@4.12.0"
|
|
22
22
|
}
|
package/src/announce.ts
CHANGED
|
@@ -5,7 +5,7 @@ export const Announce = z.object({
|
|
|
5
5
|
id: z.string(),
|
|
6
6
|
actor: z.string(),
|
|
7
7
|
|
|
8
|
-
published: z.string(
|
|
8
|
+
published: z.string().describe("Object published datetime"),
|
|
9
9
|
to: z.union([z.string(), z.string().array()]),
|
|
10
10
|
cc: z.union([z.string(), z.string().array()]),
|
|
11
11
|
object: z.string(),
|
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const Field = z.object({
|
|
5
|
-
name: z.string(
|
|
6
|
-
|
|
7
|
-
}),
|
|
8
|
-
value: z.string({
|
|
9
|
-
description: "The value associated with the `name` key.",
|
|
10
|
-
}),
|
|
5
|
+
name: z.string().describe("The key of a given field's key-value pair"),
|
|
6
|
+
value: z.string().describe("The value associated with the `name` key."),
|
|
11
7
|
verified_at: z
|
|
12
|
-
.string(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
.string()
|
|
9
|
+
.describe(
|
|
10
|
+
'Timestamp of when the server verified a URL value for a rel="me" link in ISO 8601 Date time format'
|
|
11
|
+
)
|
|
16
12
|
.nullable(),
|
|
17
13
|
});
|
|
18
14
|
export type Field = z.infer<typeof Field>;
|
|
@@ -4,21 +4,13 @@ import { Field } from "./field.js";
|
|
|
4
4
|
import { Visibility } from "../visibility.js";
|
|
5
5
|
|
|
6
6
|
export const Source = z.object({
|
|
7
|
-
note: z.string(
|
|
8
|
-
description: "Profile bio, in plain-text instead of in HTML",
|
|
9
|
-
}),
|
|
7
|
+
note: z.string().describe("Profile bio, in plain-text instead of in HTML"),
|
|
10
8
|
fields: Field.array().describe("Metadata about the account"),
|
|
11
9
|
privacy: Visibility.describe(
|
|
12
10
|
"The default post privacy to be used for new statuses."
|
|
13
11
|
),
|
|
14
|
-
sensitive: z.boolean(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
language: z.string({
|
|
18
|
-
description: "The default posting language for new statuses",
|
|
19
|
-
}),
|
|
20
|
-
follow_requests_count: z.number({
|
|
21
|
-
description: "The number of pending follow requests",
|
|
22
|
-
}),
|
|
12
|
+
sensitive: z.boolean().describe("Whether new statuses should be marked sensitive by default"),
|
|
13
|
+
language: z.string().describe("The default posting language for new statuses"),
|
|
14
|
+
follow_requests_count: z.number().describe("The number of pending follow requests"),
|
|
23
15
|
});
|
|
24
16
|
export type Source = z.infer<typeof Source>;
|
package/src/mastodon/account.ts
CHANGED
|
@@ -5,45 +5,39 @@ import { CustomEmoji } from "./customEmoji.js";
|
|
|
5
5
|
import { Source } from "./account/source.js";
|
|
6
6
|
|
|
7
7
|
const BaseAccount = z.object({
|
|
8
|
-
id: z.string(
|
|
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
|
-
description:
|
|
42
|
-
"A static version of the `header`. Equal to `header` if its value is a static image; different if `header` is an animated GIF",
|
|
43
|
-
}),
|
|
44
|
-
locked: z.boolean({
|
|
45
|
-
description: "Whether the actor manually approves follow requests",
|
|
46
|
-
}),
|
|
8
|
+
id: z.string().describe(
|
|
9
|
+
"This is actor id, for Mastodon, it is a string that case from number but in Activities.next, this is URI"
|
|
10
|
+
),
|
|
11
|
+
username: z.string().describe(
|
|
12
|
+
"The username of the actor, not including domain"
|
|
13
|
+
),
|
|
14
|
+
acct: z.string().describe(
|
|
15
|
+
"The Webfinger actor URI. Equal to username for local users, or username@domain for remote users"
|
|
16
|
+
),
|
|
17
|
+
url: z.string().describe(
|
|
18
|
+
"The location of the user's profile page"
|
|
19
|
+
),
|
|
20
|
+
display_name: z.string().describe(
|
|
21
|
+
"The profile's display name"
|
|
22
|
+
),
|
|
23
|
+
note: z.string().describe(
|
|
24
|
+
"The profile's bio or description"
|
|
25
|
+
),
|
|
26
|
+
avatar: z.string().describe(
|
|
27
|
+
"An image URL icon that is shown next to statuses and in the profile"
|
|
28
|
+
),
|
|
29
|
+
avatar_static: z.string().describe(
|
|
30
|
+
"A static version of the `avatar`. Equal to `avatar` if its value is a static image; different if `avatar` is an animated GIF"
|
|
31
|
+
),
|
|
32
|
+
header: z.string().describe(
|
|
33
|
+
"An image banner URL that is shown above the profile and in profile cards."
|
|
34
|
+
),
|
|
35
|
+
header_static: z.string().describe(
|
|
36
|
+
"A static version of the `header`. Equal to `header` if its value is a static image; different if `header` is an animated GIF"
|
|
37
|
+
),
|
|
38
|
+
locked: z.boolean().describe(
|
|
39
|
+
"Whether the actor manually approves follow requests"
|
|
40
|
+
),
|
|
47
41
|
source: Source.describe(
|
|
48
42
|
"An extra attribute that contains source values to be used with API methods that verify credentials and update credentials"
|
|
49
43
|
),
|
|
@@ -53,57 +47,56 @@ const BaseAccount = z.object({
|
|
|
53
47
|
emojis: CustomEmoji.array().describe(
|
|
54
48
|
"Custom emoji entities to be used when rendering the profile"
|
|
55
49
|
),
|
|
56
|
-
bot: z.boolean(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}),
|
|
50
|
+
bot: z.boolean().describe(
|
|
51
|
+
"Indicates that the actor may perform automated actions, may not be monitored, or identifies as a robot"
|
|
52
|
+
),
|
|
53
|
+
group: z.boolean().describe(
|
|
54
|
+
"Indicates that the actor represents a Group actor"
|
|
55
|
+
),
|
|
63
56
|
discoverable: z
|
|
64
|
-
.boolean(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
.boolean()
|
|
58
|
+
.describe(
|
|
59
|
+
"Whether the actor has opted into discovery features such as the profile directory"
|
|
60
|
+
)
|
|
68
61
|
.nullable(),
|
|
69
62
|
noindex: z
|
|
70
|
-
.boolean(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
.boolean()
|
|
64
|
+
.describe(
|
|
65
|
+
"Whether the local user has opted out of being indexed by search engines"
|
|
66
|
+
)
|
|
74
67
|
.nullish(),
|
|
75
68
|
suspended: z
|
|
76
|
-
.boolean(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
.boolean()
|
|
70
|
+
.describe(
|
|
71
|
+
"An extra attribute returned only when an actor is suspended"
|
|
72
|
+
)
|
|
80
73
|
.optional(),
|
|
81
74
|
limited: z
|
|
82
|
-
.boolean(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
.boolean()
|
|
76
|
+
.describe(
|
|
77
|
+
"An extra attribute returned only when an actor is silenced. If true, indicates that the actor should be hidden behind a warning screen."
|
|
78
|
+
)
|
|
86
79
|
.optional(),
|
|
87
80
|
|
|
88
|
-
created_at: z.string(
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
created_at: z.string().describe(
|
|
82
|
+
"The time the actor was created in ISO 8601 Datetime format"
|
|
83
|
+
),
|
|
91
84
|
last_status_at: z
|
|
92
|
-
.string(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
85
|
+
.string()
|
|
86
|
+
.describe(
|
|
87
|
+
"The time when the most recent status was posted in ISO 8601 Datetime format"
|
|
88
|
+
)
|
|
96
89
|
.nullable(),
|
|
97
90
|
|
|
98
|
-
statuses_count: z.number(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
followers_count: z.number(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
following_count: z.number(
|
|
105
|
-
|
|
106
|
-
|
|
91
|
+
statuses_count: z.number().describe(
|
|
92
|
+
"How many statuses are attached to this actor"
|
|
93
|
+
),
|
|
94
|
+
followers_count: z.number().describe(
|
|
95
|
+
"The reported followers of this profile"
|
|
96
|
+
),
|
|
97
|
+
following_count: z.number().describe(
|
|
98
|
+
"The reported follows of this profile"
|
|
99
|
+
),
|
|
107
100
|
});
|
|
108
101
|
type BaseAccount = z.infer<typeof BaseAccount>;
|
|
109
102
|
|
|
@@ -2,23 +2,15 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const CustomEmoji = z.object({
|
|
5
|
-
shortcode: z.string(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
url: z.string({
|
|
12
|
-
description: "A link to the custom emoji",
|
|
13
|
-
}),
|
|
14
|
-
visible_in_picker: z.boolean({
|
|
15
|
-
description:
|
|
16
|
-
"Whether this Emoji should be visible in the picker or unlisted",
|
|
17
|
-
}),
|
|
5
|
+
shortcode: z.string().describe("The name of the custom emoji"),
|
|
6
|
+
static_url: z.string().describe("A link to a static copy of the custom emoji"),
|
|
7
|
+
url: z.string().describe("A link to the custom emoji"),
|
|
8
|
+
visible_in_picker: z.boolean().describe(
|
|
9
|
+
"Whether this Emoji should be visible in the picker or unlisted"
|
|
10
|
+
),
|
|
18
11
|
category: z
|
|
19
|
-
.string(
|
|
20
|
-
|
|
21
|
-
})
|
|
12
|
+
.string()
|
|
13
|
+
.describe("Used for sorting custom emoji in the picker")
|
|
22
14
|
.nullable(),
|
|
23
15
|
});
|
|
24
16
|
export type CustomEmoji = z.infer<typeof CustomEmoji>;
|
|
@@ -4,19 +4,17 @@ import { FilterKeyword } from "./keyword.js";
|
|
|
4
4
|
import { FilterStatus } from "./status.js";
|
|
5
5
|
|
|
6
6
|
export const Filter = z.object({
|
|
7
|
-
id: z.string(
|
|
8
|
-
title: z.string(
|
|
9
|
-
description: "A title given by the user to name the filter",
|
|
10
|
-
}),
|
|
7
|
+
id: z.string().describe("The ID of the Filter in the database"),
|
|
8
|
+
title: z.string().describe("A title given by the user to name the filter"),
|
|
11
9
|
context: z
|
|
12
10
|
.enum(["home", "notifications", "public", "thread", "account"])
|
|
13
11
|
.array()
|
|
14
12
|
.describe("The contexts in which the filter should be applied"),
|
|
15
13
|
expires_at: z
|
|
16
|
-
.string(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
.string()
|
|
15
|
+
.describe(
|
|
16
|
+
"When the filter should no longer be applied in ISO 8601 Datetime format or null if the filter does not expire"
|
|
17
|
+
)
|
|
20
18
|
.nullable(),
|
|
21
19
|
filter_action: z
|
|
22
20
|
.enum(["warn", "hide"])
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const FilterKeyword = z.object({
|
|
5
|
-
id: z.string(
|
|
6
|
-
keyword: z.string(
|
|
7
|
-
whole_word: z.boolean(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}),
|
|
5
|
+
id: z.string().describe("The ID of the FilterKeyword in the database"),
|
|
6
|
+
keyword: z.string().describe("The phrase to be matched against"),
|
|
7
|
+
whole_word: z.boolean().describe(
|
|
8
|
+
"Should the filter consider word boundaries? See [implementation guidelines for filters](https://docs.joinmastodon.org/api/guidelines/#filters)"
|
|
9
|
+
),
|
|
11
10
|
});
|
|
12
11
|
export type FilterKeyword = z.infer<typeof FilterKeyword>;
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const FilterStatus = z.object({
|
|
5
|
-
id: z.string(
|
|
6
|
-
status_id: z.string(
|
|
7
|
-
description: "The ID of the Status that will be filtered",
|
|
8
|
-
}),
|
|
5
|
+
id: z.string().describe("The ID of the FilterStatus in the database"),
|
|
6
|
+
status_id: z.string().describe("The ID of the Status that will be filtered"),
|
|
9
7
|
});
|
|
10
8
|
export type FilterStatus = z.infer<typeof FilterStatus>;
|
|
@@ -2,37 +2,32 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const BaseMediaAttachment = z.object({
|
|
5
|
-
id: z.string(
|
|
6
|
-
description: "The ID of the attachment in the database",
|
|
7
|
-
}),
|
|
5
|
+
id: z.string().describe("The ID of the attachment in the database"),
|
|
8
6
|
|
|
9
|
-
url: z.string(
|
|
10
|
-
description: "The location of the original full-size attachment",
|
|
11
|
-
}),
|
|
7
|
+
url: z.string().describe("The location of the original full-size attachment"),
|
|
12
8
|
preview_url: z
|
|
13
|
-
.string(
|
|
14
|
-
|
|
15
|
-
})
|
|
9
|
+
.string()
|
|
10
|
+
.describe("The location of a scaled-down preview of the attachment")
|
|
16
11
|
.nullable(),
|
|
17
12
|
remote_url: z
|
|
18
|
-
.string(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
.string()
|
|
14
|
+
.describe(
|
|
15
|
+
"The location of the full-size original attachment on the remote website"
|
|
16
|
+
)
|
|
22
17
|
.nullable(),
|
|
23
18
|
|
|
24
19
|
description: z
|
|
25
|
-
.string(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
.string()
|
|
21
|
+
.describe(
|
|
22
|
+
"Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load"
|
|
23
|
+
)
|
|
29
24
|
.nullable(),
|
|
30
25
|
|
|
31
26
|
blurhash: z
|
|
32
|
-
.string(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
.string()
|
|
28
|
+
.describe(
|
|
29
|
+
"hash computed by the [BlurHash algorithm](https://github.com/woltapp/blurhash), for generating colorful preview thumbnails when media has not been downloaded yet."
|
|
30
|
+
)
|
|
36
31
|
.nullable(),
|
|
37
32
|
});
|
|
38
33
|
export type BaseMediaAttachment = z.infer<typeof BaseMediaAttachment>;
|
|
@@ -12,14 +12,10 @@ export const Gifv = BaseMediaAttachment.extend({
|
|
|
12
12
|
duration: z.number().nullish(),
|
|
13
13
|
fps: z.number().nullish(),
|
|
14
14
|
|
|
15
|
-
size: z.string(
|
|
16
|
-
description: "Video width and height in string wxh format",
|
|
17
|
-
}),
|
|
15
|
+
size: z.string().describe("Video width and height in string wxh format"),
|
|
18
16
|
width: z.number(),
|
|
19
17
|
height: z.number(),
|
|
20
|
-
aspect: z.number(
|
|
21
|
-
description: "Aspect ratio of the video (width/height)",
|
|
22
|
-
}),
|
|
18
|
+
aspect: z.number().describe("Aspect ratio of the video (width/height)"),
|
|
23
19
|
|
|
24
20
|
original: z.object({
|
|
25
21
|
width: z.number(),
|
|
@@ -10,14 +10,10 @@ export const Video = BaseMediaAttachment.extend({
|
|
|
10
10
|
duration: z.number().nullish(),
|
|
11
11
|
fps: z.number().nullish(),
|
|
12
12
|
|
|
13
|
-
size: z.string(
|
|
14
|
-
description: "Video width and height in string wxh format",
|
|
15
|
-
}),
|
|
13
|
+
size: z.string().describe("Video width and height in string wxh format"),
|
|
16
14
|
width: z.number(),
|
|
17
15
|
height: z.number(),
|
|
18
|
-
aspect: z.number(
|
|
19
|
-
description: "Aspect ratio of the video (width/height)",
|
|
20
|
-
}),
|
|
16
|
+
aspect: z.number().describe("Aspect ratio of the video (width/height)"),
|
|
21
17
|
|
|
22
18
|
audio_encode: z.string().nullish(),
|
|
23
19
|
audio_bitrate: z.string().nullish(),
|
|
@@ -4,26 +4,26 @@ import { CustomEmoji } from "../customEmoji.js";
|
|
|
4
4
|
import { Option } from "./option.js";
|
|
5
5
|
|
|
6
6
|
export const Poll = z.object({
|
|
7
|
-
id: z.string(
|
|
7
|
+
id: z.string().describe("The ID of the poll in the database"),
|
|
8
8
|
expires_at: z
|
|
9
|
-
.string(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
.string()
|
|
10
|
+
.describe(
|
|
11
|
+
"The time the poll ends in ISO 8601 datetime or null if the poll does not end"
|
|
12
|
+
)
|
|
13
13
|
.nullable(),
|
|
14
|
-
expired: z.boolean(
|
|
15
|
-
multiple: z.boolean(
|
|
16
|
-
votes_count: z.number(
|
|
17
|
-
voters_count: z.number(
|
|
14
|
+
expired: z.boolean().describe("Whether the poll has expired"),
|
|
15
|
+
multiple: z.boolean().describe("Whether multiple choices are allowed"),
|
|
16
|
+
votes_count: z.number().describe("The number of votes the poll has"),
|
|
17
|
+
voters_count: z.number().describe("The number of actors that voted"),
|
|
18
18
|
options: Option.array().describe("Possible answers for the poll"),
|
|
19
19
|
emojis: CustomEmoji.array().describe(
|
|
20
20
|
"Custom emoji to be used for rendering poll options"
|
|
21
21
|
),
|
|
22
22
|
voted: z
|
|
23
|
-
.boolean(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
.boolean()
|
|
24
|
+
.describe(
|
|
25
|
+
"When called with a user token, has the authorized user voted?"
|
|
26
|
+
)
|
|
27
27
|
.optional(),
|
|
28
28
|
own_votes: z
|
|
29
29
|
.number()
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const Option = z.object({
|
|
5
|
-
title: z.string(
|
|
5
|
+
title: z.string().describe("The text value of the poll option"),
|
|
6
6
|
votes_count: z
|
|
7
|
-
.number(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
.number()
|
|
8
|
+
.describe(
|
|
9
|
+
"The number of votes the poll option has or null if the results are not published yet"
|
|
10
|
+
)
|
|
11
11
|
.nullable(),
|
|
12
12
|
});
|
|
13
13
|
export type Option = z.infer<typeof Option>;
|
|
@@ -2,40 +2,28 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const PreviewCard = z.object({
|
|
5
|
-
url: z.string(
|
|
6
|
-
title: z.string(
|
|
7
|
-
description: z.string(
|
|
8
|
-
type: z.enum(["link", "photo", "video", "rich"],
|
|
9
|
-
description: "The type of the preview card",
|
|
10
|
-
}),
|
|
5
|
+
url: z.string().describe("Location of linked resource"),
|
|
6
|
+
title: z.string().describe("Title of linked resource"),
|
|
7
|
+
description: z.string().describe("Description of preview"),
|
|
8
|
+
type: z.enum(["link", "photo", "video", "rich"]).describe("The type of the preview card"),
|
|
11
9
|
|
|
12
|
-
author_name: z.string(
|
|
13
|
-
author_url: z.string(
|
|
14
|
-
description: "A link to the author of the original resource",
|
|
15
|
-
}),
|
|
10
|
+
author_name: z.string().describe("The author of the original resource"),
|
|
11
|
+
author_url: z.string().describe("A link to the author of the original resource"),
|
|
16
12
|
|
|
17
|
-
provider_name: z.string(
|
|
18
|
-
|
|
19
|
-
}),
|
|
20
|
-
provider_url: z.string({
|
|
21
|
-
description: "A link to the provider of the original resource",
|
|
22
|
-
}),
|
|
13
|
+
provider_name: z.string().describe("The provider of the original resource"),
|
|
14
|
+
provider_url: z.string().describe("A link to the provider of the original resource"),
|
|
23
15
|
|
|
24
|
-
html: z.string(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
width: z.number({ description: "Width of preview, in pixels" }),
|
|
28
|
-
height: z.number({ description: "Height of preview, in pixels" }),
|
|
16
|
+
html: z.string().describe("HTML to be used for generating the preview card"),
|
|
17
|
+
width: z.number().describe("Width of preview, in pixels"),
|
|
18
|
+
height: z.number().describe("Height of preview, in pixels"),
|
|
29
19
|
|
|
30
|
-
image: z.string(
|
|
31
|
-
embed_url: z.string(
|
|
32
|
-
description: "Used for photo embeds, instead of custom html",
|
|
33
|
-
}),
|
|
20
|
+
image: z.string().describe("Preview thumbnail url").nullable(),
|
|
21
|
+
embed_url: z.string().describe("Used for photo embeds, instead of custom html"),
|
|
34
22
|
blurhash: z
|
|
35
|
-
.string(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
.string()
|
|
24
|
+
.describe(
|
|
25
|
+
"A hash computed by the [BlurHash algorithm](https://github.com/woltapp/blurhash), for generating colorful preview thumbnails when media has not been downloaded yet"
|
|
26
|
+
)
|
|
39
27
|
.nullable(),
|
|
40
28
|
});
|
|
41
29
|
export type PreviewCard = z.infer<typeof PreviewCard>;
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const Application = z.object({
|
|
5
|
-
name: z.string(
|
|
6
|
-
description: "The name of the application that posted this status",
|
|
7
|
-
}),
|
|
5
|
+
name: z.string().describe("The name of the application that posted this status"),
|
|
8
6
|
website: z
|
|
9
|
-
.string(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
.string()
|
|
8
|
+
.describe(
|
|
9
|
+
"The website associated with the application that posted this status"
|
|
10
|
+
)
|
|
13
11
|
.nullable(),
|
|
14
12
|
});
|
|
15
13
|
export type Application = z.infer<typeof Application>;
|