@llun/activities.schema 0.0.4 → 0.0.6
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/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +1 -0
- package/dist/accept.d.ts +43 -0
- package/dist/accept.js +8 -0
- package/dist/follow.d.ts +18 -0
- package/dist/follow.js +7 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/like.d.ts +489 -0
- package/dist/like.js +8 -0
- package/dist/note/attachment.d.ts +42 -0
- package/dist/note/attachment.js +4 -0
- package/dist/note/document.d.ts +30 -0
- package/dist/note/document.js +11 -0
- package/dist/note/emoji.d.ts +38 -0
- package/dist/note/emoji.js +8 -0
- package/dist/note/image.d.ts +15 -0
- package/dist/note/image.js +6 -0
- package/dist/note/mention.d.ts +15 -0
- package/dist/note/mention.js +6 -0
- package/dist/note/propertyValue.d.ts +15 -0
- package/dist/note/propertyValue.js +6 -0
- package/dist/note.d.ts +217 -8
- package/dist/note.js +6 -1
- package/dist/reject.d.ts +43 -0
- package/dist/reject.js +8 -0
- package/dist/undo.d.ts +759 -0
- package/dist/undo.js +9 -0
- package/package.json +6 -7
- package/src/accept.ts +12 -0
- package/src/follow.ts +10 -0
- package/src/index.ts +5 -0
- package/src/like.ts +12 -0
- package/src/note/attachment.ts +8 -0
- package/src/note/document.ts +14 -0
- package/src/note/emoji.ts +12 -0
- package/src/note/image.ts +9 -0
- package/src/note/mention.ts +9 -0
- package/src/note/propertyValue.ts +9 -0
- package/src/note.ts +7 -1
- package/src/reject.ts +12 -0
- package/src/undo.ts +13 -0
package/dist/undo.js
ADDED
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llun/activities.schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Validate ActivityPub with Zod",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"default": "./dist/index.js"
|
|
8
|
-
},
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
9
7
|
"type": "module",
|
|
10
8
|
"scripts": {
|
|
11
9
|
"build": "tsc",
|
|
@@ -17,6 +15,7 @@
|
|
|
17
15
|
"zod": "^3.22.4"
|
|
18
16
|
},
|
|
19
17
|
"devDependencies": {
|
|
20
|
-
"typescript": "^5.
|
|
21
|
-
}
|
|
18
|
+
"typescript": "^5.3.2"
|
|
19
|
+
},
|
|
20
|
+
"packageManager": "yarn@4.0.1"
|
|
22
21
|
}
|
package/src/accept.ts
ADDED
package/src/follow.ts
ADDED
package/src/index.ts
CHANGED
package/src/like.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const Document = z.object({
|
|
4
|
+
type: z.literal("Document"),
|
|
5
|
+
mediaType: z.string(),
|
|
6
|
+
url: z.string(),
|
|
7
|
+
blurhash: z.string().optional(),
|
|
8
|
+
width: z.number().optional(),
|
|
9
|
+
height: z.number().optional(),
|
|
10
|
+
name: z.string().optional().nullable(),
|
|
11
|
+
focalPoint: z.tuple([z.number(), z.number()]).optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type Document = z.infer<typeof Document>;
|
package/src/note.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { Attachment } from "./note/attachment.js";
|
|
3
|
+
import { Emoji } from "./note/emoji.js";
|
|
4
|
+
import { Mention } from "./note/mention.js";
|
|
2
5
|
|
|
3
6
|
const BaseContent = z.object({
|
|
4
7
|
id: z.string(),
|
|
@@ -8,7 +11,7 @@ const BaseContent = z.object({
|
|
|
8
11
|
to: z.union([z.string(), z.string().array()]),
|
|
9
12
|
cc: z.union([z.string(), z.string().array()]),
|
|
10
13
|
|
|
11
|
-
inReplyTo: z.string().
|
|
14
|
+
inReplyTo: z.string().nullable(),
|
|
12
15
|
|
|
13
16
|
summary: z.string({ description: "Note short summary" }).optional(),
|
|
14
17
|
summaryMap: z
|
|
@@ -20,6 +23,9 @@ const BaseContent = z.object({
|
|
|
20
23
|
.record(z.string(), { description: "Note content in each locale" })
|
|
21
24
|
.optional(),
|
|
22
25
|
|
|
26
|
+
attachment: z.union([Attachment, Attachment.array()]).optional(),
|
|
27
|
+
tag: z.union([Mention, Emoji]).array(),
|
|
28
|
+
|
|
23
29
|
published: z.string({ description: "Object published datetime" }),
|
|
24
30
|
updated: z.string({ description: "Object updated datetime" }).optional(),
|
|
25
31
|
});
|
package/src/reject.ts
ADDED
package/src/undo.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import { Follow } from "./follow.js";
|
|
4
|
+
import { Like } from "./like.js";
|
|
5
|
+
|
|
6
|
+
export const Undo = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
actor: z.string(),
|
|
9
|
+
type: z.literal("Undo"),
|
|
10
|
+
object: z.union([Like, Follow]),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type Undo = z.infer<typeof Undo>;
|