@llun/activities.schema 0.0.9 → 0.1.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.
Files changed (61) hide show
  1. package/dist/mastodon/filter/index.d.ts +62 -0
  2. package/dist/mastodon/filter/index.js +24 -0
  3. package/dist/mastodon/filter/keyword.d.ts +15 -0
  4. package/dist/mastodon/filter/keyword.js +9 -0
  5. package/dist/mastodon/filter/status.d.ts +12 -0
  6. package/dist/mastodon/filter/status.js +8 -0
  7. package/dist/mastodon/filterResult.d.ts +104 -0
  8. package/dist/mastodon/filterResult.js +16 -0
  9. package/dist/mastodon/mediaAttachment/audio.d.ts +87 -0
  10. package/dist/mastodon/mediaAttachment/audio.js +17 -0
  11. package/dist/mastodon/mediaAttachment/base.d.ts +24 -0
  12. package/dist/mastodon/mediaAttachment/base.js +26 -0
  13. package/dist/mastodon/mediaAttachment/gifv.d.ts +158 -0
  14. package/dist/mastodon/mediaAttachment/gifv.js +37 -0
  15. package/dist/mastodon/mediaAttachment/image.d.ts +142 -0
  16. package/dist/mastodon/mediaAttachment/image.js +30 -0
  17. package/dist/mastodon/mediaAttachment/index.d.ts +576 -0
  18. package/dist/mastodon/mediaAttachment/index.js +8 -0
  19. package/dist/mastodon/mediaAttachment/unknown.d.ts +28 -0
  20. package/dist/mastodon/mediaAttachment/unknown.js +8 -0
  21. package/dist/mastodon/mediaAttachment/video.d.ts +173 -0
  22. package/dist/mastodon/mediaAttachment/video.js +38 -0
  23. package/dist/mastodon/poll/index.d.ts +81 -0
  24. package/dist/mastodon/poll/index.js +27 -0
  25. package/dist/mastodon/poll/option.d.ts +12 -0
  26. package/dist/mastodon/poll/option.js +10 -0
  27. package/dist/mastodon/previewCard.d.ts +48 -0
  28. package/dist/mastodon/previewCard.js +34 -0
  29. package/dist/mastodon/status/application.d.ts +12 -0
  30. package/dist/mastodon/status/application.js +12 -0
  31. package/dist/mastodon/status/base.d.ts +1738 -0
  32. package/dist/mastodon/status/base.js +96 -0
  33. package/dist/mastodon/status/index.d.ts +4035 -0
  34. package/dist/mastodon/status/index.js +4 -0
  35. package/dist/mastodon/status/mention.d.ts +18 -0
  36. package/dist/mastodon/status/mention.js +12 -0
  37. package/dist/mastodon/status/tag.d.ts +12 -0
  38. package/dist/mastodon/status/tag.js +10 -0
  39. package/dist/mastodon/status/visibility.d.ts +3 -0
  40. package/dist/mastodon/status/visibility.js +3 -0
  41. package/package.json +2 -2
  42. package/src/mastodon/filter/index.ts +31 -0
  43. package/src/mastodon/filter/keyword.ts +12 -0
  44. package/src/mastodon/filter/status.ts +10 -0
  45. package/src/mastodon/filterResult.ts +18 -0
  46. package/src/mastodon/mediaAttachment/audio.ts +19 -0
  47. package/src/mastodon/mediaAttachment/base.ts +34 -0
  48. package/src/mastodon/mediaAttachment/gifv.ts +41 -0
  49. package/src/mastodon/mediaAttachment/image.ts +32 -0
  50. package/src/mastodon/mediaAttachment/index.ts +10 -0
  51. package/src/mastodon/mediaAttachment/unknown.ts +12 -0
  52. package/src/mastodon/mediaAttachment/video.ts +43 -0
  53. package/src/mastodon/poll/index.ts +35 -0
  54. package/src/mastodon/poll/option.ts +13 -0
  55. package/src/mastodon/previewCard.ts +41 -0
  56. package/src/mastodon/status/application.ts +15 -0
  57. package/src/mastodon/status/base.ts +125 -0
  58. package/src/mastodon/status/index.ts +8 -0
  59. package/src/mastodon/status/mention.ts +15 -0
  60. package/src/mastodon/status/tag.ts +12 -0
  61. package/src/mastodon/status/visibility.ts +5 -0
@@ -0,0 +1,4 @@
1
+ import { BaseStatus } from "./base.js";
2
+ export const Status = BaseStatus.extend({
3
+ reblog: BaseStatus.nullable().describe("The status being reblogged"),
4
+ });
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ export declare const Mention: z.ZodObject<{
3
+ id: z.ZodString;
4
+ username: z.ZodString;
5
+ url: z.ZodString;
6
+ acct: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ id: string;
9
+ url: string;
10
+ username: string;
11
+ acct: string;
12
+ }, {
13
+ id: string;
14
+ url: string;
15
+ username: string;
16
+ acct: string;
17
+ }>;
18
+ export type Mention = z.infer<typeof Mention>;
@@ -0,0 +1,12 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Status/#Mention
2
+ import { z } from "zod";
3
+ export const Mention = z.object({
4
+ id: z.string({ description: "The actor ID of the mentioned user" }),
5
+ username: z.string({ description: "The username of the mentioned user" }),
6
+ url: z.string({
7
+ description: "The location of the mentioned user’s profile",
8
+ }),
9
+ acct: z.string({
10
+ description: "The webfinger acct: URI of the mentioned user. Equivalent to `username` for local users, or `username@domain` for remote users",
11
+ }),
12
+ });
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ export declare const Tag: z.ZodObject<{
3
+ name: z.ZodString;
4
+ url: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ url: string;
7
+ name: string;
8
+ }, {
9
+ url: string;
10
+ name: string;
11
+ }>;
12
+ export type Tag = z.infer<typeof Tag>;
@@ -0,0 +1,10 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Status/#Tag
2
+ import { z } from "zod";
3
+ export const Tag = z.object({
4
+ name: z.string({
5
+ description: "The value of the hashtag after the `#` sign",
6
+ }),
7
+ url: z.string({
8
+ description: "A link to the hashtag on the instance",
9
+ }),
10
+ });
@@ -0,0 +1,3 @@
1
+ import { z } from "zod";
2
+ export declare const Visibility: z.ZodEnum<["public", "unlist", "private", "direct"]>;
3
+ export type Visibility = z.infer<typeof Visibility>;
@@ -0,0 +1,3 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Status/#visibility
2
+ import { z } from "zod";
3
+ export const Visibility = z.enum(["public", "unlist", "private", "direct"]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@llun/activities.schema",
3
- "version": "0.0.9",
4
- "description": "Validate ActivityPub with Zod",
3
+ "version": "0.1.0",
4
+ "description": "Validate ActivityPub and Mastodon with Zod",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "module",
@@ -0,0 +1,31 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Filter/
2
+ import { z } from "zod";
3
+ import { FilterKeyword } from "./keyword.js";
4
+ import { FilterStatus } from "./status.js";
5
+
6
+ export const Filter = z.object({
7
+ id: z.string({ description: "The ID of the Filter in the database" }),
8
+ title: z.string({
9
+ description: "A title given by the user to name the filter",
10
+ }),
11
+ context: z
12
+ .enum(["home", "notifications", "public", "thread", "account"])
13
+ .array()
14
+ .describe("The contexts in which the filter should be applied"),
15
+ expires_at: z
16
+ .string({
17
+ description:
18
+ "When the filter should no longer be applied in ISO 8601 Datetime format or null if the filter does not expire",
19
+ })
20
+ .nullable(),
21
+ filter_action: z
22
+ .enum(["warn", "hide"])
23
+ .describe("The action to be taken when a status matches this filter"),
24
+ keywords: FilterKeyword.array().describe(
25
+ "The keywords grouped under this filter"
26
+ ),
27
+ statuses: FilterStatus.array().describe(
28
+ "The statuses grouped under this filter"
29
+ ),
30
+ });
31
+ export type Filter = z.infer<typeof Filter>;
@@ -0,0 +1,12 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/FilterKeyword/
2
+ import { z } from "zod";
3
+
4
+ export const FilterKeyword = z.object({
5
+ id: z.string({ description: "The ID of the FilterKeyword in the database" }),
6
+ keyword: z.string({ description: "The phrase to be matched against" }),
7
+ whole_word: z.boolean({
8
+ description:
9
+ "Should the filter consider word boundaries? See [implementation guidelines for filters](https://docs.joinmastodon.org/api/guidelines/#filters)",
10
+ }),
11
+ });
12
+ export type FilterKeyword = z.infer<typeof FilterKeyword>;
@@ -0,0 +1,10 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/FilterStatus/
2
+ import { z } from "zod";
3
+
4
+ export const FilterStatus = z.object({
5
+ id: z.string({ description: "The ID of the FilterStatus in the database" }),
6
+ status_id: z.string({
7
+ description: "The ID of the Status that will be filtered",
8
+ }),
9
+ });
10
+ export type FilterStatus = z.infer<typeof FilterStatus>;
@@ -0,0 +1,18 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/FilterResult/
2
+ import { z } from "zod";
3
+ import { Filter } from "./filter/index.js";
4
+
5
+ export const FilterResult = z.object({
6
+ filter: Filter.describe("The filter that was matched"),
7
+ keyword_matches: z
8
+ .string()
9
+ .array()
10
+ .nullable()
11
+ .describe("The keyword within the filter that was matched"),
12
+ status_matches: z
13
+ .string()
14
+ .array()
15
+ .nullable()
16
+ .describe("The status ID within the filter that was matched"),
17
+ });
18
+ export type FilterResult = z.infer<typeof FilterResult>;
@@ -0,0 +1,19 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/#audio
2
+ import { z } from "zod";
3
+ import { BaseMediaAttachment } from "./base.js";
4
+
5
+ export const Audio = BaseMediaAttachment.extend({
6
+ type: z.literal("audio").describe("The type of the attachment (Audio track)"),
7
+ meta: z.object({
8
+ length: z.string(),
9
+ duration: z.number(),
10
+ audio_encode: z.string(),
11
+ audio_bitrate: z.string(),
12
+ audio_channels: z.string(),
13
+ original: z.object({
14
+ duration: z.number(),
15
+ bitrate: z.number(),
16
+ }),
17
+ }),
18
+ });
19
+ export type Audio = z.infer<typeof Audio>;
@@ -0,0 +1,34 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/
2
+ import { z } from "zod";
3
+
4
+ export const BaseMediaAttachment = z.object({
5
+ id: z.string({
6
+ description: "The ID of the attachment in the database",
7
+ }),
8
+
9
+ url: z.string({
10
+ description: "The location of the original full-size attachment",
11
+ }),
12
+ preview_url: z.string({
13
+ description: "The location of a scaled-down preview of the attachment",
14
+ }),
15
+ remote_url: z
16
+ .string({
17
+ description:
18
+ "The location of the full-size original attachment on the remote website",
19
+ })
20
+ .nullable(),
21
+
22
+ description: z
23
+ .string({
24
+ description:
25
+ "Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load",
26
+ })
27
+ .nullable(),
28
+
29
+ bluehash: z.string({
30
+ description:
31
+ "hash computed by the [BlurHash algorithm](https://github.com/woltapp/blurhash), for generating colorful preview thumbnails when media has not been downloaded yet.",
32
+ }),
33
+ });
34
+ export type BaseMediaAttachment = z.infer<typeof BaseMediaAttachment>;
@@ -0,0 +1,41 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/#gifv
2
+ import { z } from "zod";
3
+ import { BaseMediaAttachment } from "./base.js";
4
+
5
+ export const Gifv = BaseMediaAttachment.extend({
6
+ type: z
7
+ .literal("gifv")
8
+ .describe("The type of the attachment (Looping, soundless animation)"),
9
+ meta: z.object({
10
+ length: z.string(),
11
+ duration: z.number(),
12
+ fps: z.number(),
13
+
14
+ size: z.string({
15
+ description: "Video width and height in string wxh format",
16
+ }),
17
+ width: z.number(),
18
+ height: z.number(),
19
+ aspect: z.number({
20
+ description: "Aspect ratio of the video (width/height)",
21
+ }),
22
+
23
+ original: z.object({
24
+ width: z.number(),
25
+ height: z.number(),
26
+ frame_rate: z.string(),
27
+ duration: z.number(),
28
+ bitrate: z.number(),
29
+ }),
30
+ small: z
31
+ .object({
32
+ width: z.number(),
33
+ height: z.number(),
34
+ size: z.string(),
35
+ aspect: z.number(),
36
+ })
37
+ .describe("A video preview in static image")
38
+ .nullish(),
39
+ }),
40
+ });
41
+ export type Gifv = z.infer<typeof Gifv>;
@@ -0,0 +1,32 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/#image
2
+ import { z } from "zod";
3
+ import { BaseMediaAttachment } from "./base.js";
4
+
5
+ export const Image = BaseMediaAttachment.extend({
6
+ type: z
7
+ .literal("image")
8
+ .describe("The type of the attachment (Static image)"),
9
+ meta: z.object({
10
+ original: z.object({
11
+ width: z.number(),
12
+ height: z.number(),
13
+ size: z.string(),
14
+ aspect: z.number(),
15
+ }),
16
+ small: z
17
+ .object({
18
+ width: z.number(),
19
+ height: z.number(),
20
+ size: z.string(),
21
+ aspect: z.number(),
22
+ })
23
+ .nullish(),
24
+ focus: z
25
+ .object({
26
+ x: z.number(),
27
+ y: z.number(),
28
+ })
29
+ .nullish(),
30
+ }),
31
+ });
32
+ export type Image = z.infer<typeof Image>;
@@ -0,0 +1,10 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/
2
+ import { z } from "zod";
3
+ import { Gifv } from "./gifv.js";
4
+ import { Image } from "./image.js";
5
+ import { Video } from "./video.js";
6
+ import { Audio } from "./audio.js";
7
+ import { Unknown } from "./unknown.js";
8
+
9
+ export const MediaAttachment = z.union([Image, Gifv, Video, Audio, Unknown]);
10
+ export type MediaAttachment = z.infer<typeof MediaAttachment>;
@@ -0,0 +1,12 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/
2
+ import { z } from "zod";
3
+ import { BaseMediaAttachment } from "./base.js";
4
+
5
+ export const Unknown = BaseMediaAttachment.extend({
6
+ type: z
7
+ .literal("unknown")
8
+ .describe(
9
+ "The type of the attachment (unsupported or unrecognized file type)"
10
+ ),
11
+ });
12
+ export type Unknown = z.infer<typeof Unknown>;
@@ -0,0 +1,43 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/#video
2
+ import { z } from "zod";
3
+ import { BaseMediaAttachment } from "./base.js";
4
+
5
+ export const Video = BaseMediaAttachment.extend({
6
+ type: z.literal("video").describe("The type of the attachment (Video clip)"),
7
+ meta: z.object({
8
+ length: z.string(),
9
+ duration: z.number(),
10
+ fps: z.number(),
11
+
12
+ size: z.string({
13
+ description: "Video width and height in string wxh format",
14
+ }),
15
+ width: z.number(),
16
+ height: z.number(),
17
+ aspect: z.number({
18
+ description: "Aspect ratio of the video (width/height)",
19
+ }),
20
+
21
+ audio_encode: z.string(),
22
+ audio_bitrate: z.string(),
23
+ audio_channels: z.string(),
24
+
25
+ original: z.object({
26
+ width: z.number(),
27
+ height: z.number(),
28
+ frame_rate: z.string(),
29
+ duration: z.number(),
30
+ bitrate: z.number(),
31
+ }),
32
+ small: z
33
+ .object({
34
+ width: z.number(),
35
+ height: z.number(),
36
+ size: z.string(),
37
+ aspect: z.number(),
38
+ })
39
+ .describe("A video preview in static image")
40
+ .nullish(),
41
+ }),
42
+ });
43
+ export type Video = z.infer<typeof Video>;
@@ -0,0 +1,35 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Poll/
2
+ import { z } from "zod";
3
+ import { CustomEmoji } from "../customEmoji.js";
4
+ import { Option } from "./option.js";
5
+
6
+ export const Poll = z.object({
7
+ id: z.string({ description: "The ID of the poll in the database" }),
8
+ expires_at: z
9
+ .string({
10
+ description:
11
+ "The time the poll ends in ISO 8601 datetime or null if the poll does not end",
12
+ })
13
+ .nullable(),
14
+ expired: z.boolean({ description: "Whether the poll has expired" }),
15
+ multiple: z.boolean({ description: "Whether multiple choices are allowed" }),
16
+ votes_count: z.number({ description: "The number of votes the poll has" }),
17
+ voters_count: z.number({ description: "The number of actors that voted" }),
18
+ options: Option.array().describe("Possible answers for the poll"),
19
+ emojis: CustomEmoji.array().describe(
20
+ "Custom emoji to be used for rendering poll options"
21
+ ),
22
+ voted: z
23
+ .boolean({
24
+ description:
25
+ "When called with a user token, has the authorized user voted?",
26
+ })
27
+ .optional(),
28
+ own_votes: z
29
+ .number()
30
+ .array()
31
+ .describe(
32
+ "When called with a user token, which options has the authorized user chosen? Contains an array of index values for `options`"
33
+ ),
34
+ });
35
+ export type Poll = z.infer<typeof Poll>;
@@ -0,0 +1,13 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Poll/#Option
2
+ import { z } from "zod";
3
+
4
+ export const Option = z.object({
5
+ title: z.string({ description: "The text value of the poll option" }),
6
+ votes_count: z
7
+ .number({
8
+ description:
9
+ "The number of votes the poll option has or null if the results are not published yet",
10
+ })
11
+ .nullable(),
12
+ });
13
+ export type Option = z.infer<typeof Option>;
@@ -0,0 +1,41 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/PreviewCard/
2
+ import { z } from "zod";
3
+
4
+ export const PreviewCard = z.object({
5
+ url: z.string({ description: "Location of linked resource" }),
6
+ title: z.string({ description: "Title of linked resource" }),
7
+ description: z.string({ description: "Description of preview" }),
8
+ type: z.enum(["link", "photo", "video", "rich"], {
9
+ description: "The type of the preview card",
10
+ }),
11
+
12
+ author_name: z.string({ description: "The author of the original resource" }),
13
+ author_url: z.string({
14
+ description: "A link to the author of the original resource",
15
+ }),
16
+
17
+ provider_name: z.string({
18
+ description: "The provider of the original resource",
19
+ }),
20
+ provider_url: z.string({
21
+ description: "A link to the provider of the original resource",
22
+ }),
23
+
24
+ html: z.string({
25
+ description: "HTML to be used for generating the preview card",
26
+ }),
27
+ width: z.number({ description: "Width of preview, in pixels" }),
28
+ height: z.number({ description: "Height of preview, in pixels" }),
29
+
30
+ image: z.string({ description: "Preview thumbnail url" }).nullable(),
31
+ embed_url: z.string({
32
+ description: "Used for photo embeds, instead of custom html",
33
+ }),
34
+ blurhash: z
35
+ .string({
36
+ description:
37
+ "A hash computed by the [BlurHash algorithm](https://github.com/woltapp/blurhash), for generating colorful preview thumbnails when media has not been downloaded yet",
38
+ })
39
+ .nullable(),
40
+ });
41
+ export type PreviewCard = z.infer<typeof PreviewCard>;
@@ -0,0 +1,15 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Status/#application
2
+ import { z } from "zod";
3
+
4
+ export const Application = z.object({
5
+ name: z.string({
6
+ description: "The name of the application that posted this status",
7
+ }),
8
+ website: z
9
+ .string({
10
+ description:
11
+ "The website associated with the application that posted this status",
12
+ })
13
+ .nullable(),
14
+ });
15
+ export type Application = z.infer<typeof Application>;
@@ -0,0 +1,125 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Status/
2
+ import { z } from "zod";
3
+ import { Account } from "../account.js";
4
+ import { Visibility } from "./visibility.js";
5
+ import { MediaAttachment } from "../mediaAttachment/index.js";
6
+ import { Application } from "./application.js";
7
+ import { CustomEmoji } from "../customEmoji.js";
8
+ import { Poll } from "../poll/index.js";
9
+ import { PreviewCard } from "../previewCard.js";
10
+ import { FilterResult } from "../filterResult.js";
11
+
12
+ export const BaseStatus = z.object({
13
+ id: z.string({
14
+ description:
15
+ "ID of the status in the database, for Mastodon, it is numeric casting to string. For Activities.next, this is equal to status URI",
16
+ }),
17
+ uri: z.string({
18
+ description: "URI of the status used for federation",
19
+ }),
20
+
21
+ account: Account.describe("The actor that authored the status"),
22
+
23
+ content: z.string({ description: "HTML-encoded status content" }),
24
+ visibility: Visibility.describe("Visibility of this status"),
25
+ sensitive: z.boolean({
26
+ description: "Is this status marked as sensitive content?",
27
+ }),
28
+ spoiler_text: z.string({
29
+ description:
30
+ "Subject or summary line, below which status content is collapsed until expanded",
31
+ }),
32
+
33
+ media_attachments: MediaAttachment.array(),
34
+ application: Application.optional(),
35
+ emojis: CustomEmoji.array().describe(
36
+ "Custom emoji to be used when rendering status content"
37
+ ),
38
+
39
+ reblogs_count: z.number({
40
+ description: "How many boosts this status has received",
41
+ }),
42
+ favourites_count: z.number({
43
+ description: "How many favourites this status has received",
44
+ }),
45
+ replies_count: z.number({
46
+ description: "How many replies this status has received",
47
+ }),
48
+
49
+ url: z
50
+ .string({ description: "A link to the status’s HTML representation" })
51
+ .nullable(),
52
+ in_reply_to_id: z
53
+ .string({ description: "ID of the status being replied to" })
54
+ .nullable(),
55
+ in_reply_to_account_id: z
56
+ .string({
57
+ description: "ID of the actor that authored the status being replied to",
58
+ })
59
+ .nullable(),
60
+
61
+ poll: Poll.nullable().describe("The poll attached to the status"),
62
+ card: PreviewCard.nullable().describe(
63
+ "Preview card for links included within status content"
64
+ ),
65
+
66
+ language: z
67
+ .string({
68
+ description:
69
+ "Primary language of this status in ISO 639 Part 1 two-letter language code",
70
+ })
71
+ .nullable(),
72
+
73
+ text: z
74
+ .string({
75
+ description:
76
+ "Plain-text source of a status. Returned instead of `content` when status is deleted, so the user may redraft from the source text without the client having to reverse-engineer the original text from the HTML content",
77
+ })
78
+ .nullable(),
79
+
80
+ created_at: z.string({
81
+ description:
82
+ "The date when this status was created in ISO 8601 Datetime format",
83
+ }),
84
+ edited_at: z
85
+ .string({
86
+ description:
87
+ "Timestamp of when the status was last edited in ISO 8601 Datetime format",
88
+ })
89
+ .nullable(),
90
+
91
+ favourited: z
92
+ .boolean({
93
+ description:
94
+ "If the current token has an authorized user: Have you favourited this status?",
95
+ })
96
+ .optional(),
97
+ reblogged: z
98
+ .boolean({
99
+ description:
100
+ "If the current token has an authorized user: Have you boosted this status?",
101
+ })
102
+ .optional(),
103
+ muted: z
104
+ .boolean({
105
+ description:
106
+ "If the current token has an authorized user: Have you muted notifications for this status’s conversation?",
107
+ })
108
+ .optional(),
109
+ bookmarked: z
110
+ .boolean({
111
+ description:
112
+ "If the current token has an authorized user: Have you bookmarked this status?",
113
+ })
114
+ .optional(),
115
+ pinned: z
116
+ .boolean({
117
+ description:
118
+ "If the current token has an authorized user: Have you pinned this status? Only appears if the status is pinnable",
119
+ })
120
+ .optional(),
121
+ filtered: FilterResult.optional().describe(
122
+ "If the current token has an authorized user: The filter and keywords that matched this status"
123
+ ),
124
+ });
125
+ export type BaseStatus = z.infer<typeof BaseStatus>;
@@ -0,0 +1,8 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Status/
2
+ import { z } from "zod";
3
+ import { BaseStatus } from "./base.js";
4
+
5
+ export const Status = BaseStatus.extend({
6
+ reblog: BaseStatus.nullable().describe("The status being reblogged"),
7
+ });
8
+ export type Status = z.infer<typeof Status>;
@@ -0,0 +1,15 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Status/#Mention
2
+ import { z } from "zod";
3
+
4
+ export const Mention = z.object({
5
+ id: z.string({ description: "The actor ID of the mentioned user" }),
6
+ username: z.string({ description: "The username of the mentioned user" }),
7
+ url: z.string({
8
+ description: "The location of the mentioned user’s profile",
9
+ }),
10
+ acct: z.string({
11
+ description:
12
+ "The webfinger acct: URI of the mentioned user. Equivalent to `username` for local users, or `username@domain` for remote users",
13
+ }),
14
+ });
15
+ export type Mention = z.infer<typeof Mention>;
@@ -0,0 +1,12 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Status/#Tag
2
+ import { z } from "zod";
3
+
4
+ export const Tag = z.object({
5
+ name: z.string({
6
+ description: "The value of the hashtag after the `#` sign",
7
+ }),
8
+ url: z.string({
9
+ description: "A link to the hashtag on the instance",
10
+ }),
11
+ });
12
+ export type Tag = z.infer<typeof Tag>;
@@ -0,0 +1,5 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Status/#visibility
2
+ import { z } from "zod";
3
+
4
+ export const Visibility = z.enum(["public", "unlist", "private", "direct"]);
5
+ export type Visibility = z.infer<typeof Visibility>;