@llun/activities.schema 0.4.2 → 0.4.3
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/.github/workflows/test.yml +33 -0
- package/.yarn/install-state.gz +0 -0
- package/dist/cjs/actor.js +32 -4
- package/dist/cjs/note/emoji.js +1 -0
- package/dist/esm/actor.js +32 -4
- package/dist/esm/note/emoji.js +1 -0
- package/dist/types/actor.d.ts +117 -12
- package/dist/types/content.d.ts +12 -0
- package/dist/types/like.d.ts +2 -0
- package/dist/types/note/baseContent.d.ts +2 -0
- package/dist/types/note/emoji.d.ts +1 -0
- package/dist/types/note/tag.d.ts +1 -0
- package/dist/types/undo.d.ts +2 -0
- package/package.json +2 -1
- package/src/actor.ts +32 -4
- package/src/note/emoji.ts +1 -0
- package/tests/README.md +70 -0
- package/tests/actor-compatibility.test.js +140 -0
- package/tests/fixtures/friendica-poliverso-org.json +55 -0
- package/tests/fixtures/mastodon-chaos-social.json +121 -0
- package/tests/fixtures/mastodon-hcommons-social.json +105 -0
- package/tests/fixtures/mastodon-social-1.json +146 -0
- package/tests/fixtures/mastodon-social-2.json +89 -0
- package/tests/fixtures/misskey-mewl-me.json +146 -0
- package/tests/fixtures/pleroma-udongein-xyz.json +81 -0
- package/.claude/settings.local.json +0 -22
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, develop ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [22.x, 24.x]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
cache: 'npm'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm ci
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: npm test
|
|
31
|
+
|
|
32
|
+
- name: Check build
|
|
33
|
+
run: npm run build
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/dist/cjs/actor.js
CHANGED
|
@@ -3,19 +3,37 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Service = exports.Person = exports.Actor = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const image_js_1 = require("./image.js");
|
|
6
|
+
const propertyValue_js_1 = require("./note/propertyValue.js");
|
|
7
|
+
const hashtag_js_1 = require("./note/hashtag.js");
|
|
8
|
+
const emoji_js_1 = require("./note/emoji.js");
|
|
6
9
|
exports.Actor = zod_1.z.object({
|
|
7
10
|
id: zod_1.z.string(),
|
|
8
|
-
type: zod_1.z.union([
|
|
11
|
+
type: zod_1.z.union([
|
|
12
|
+
zod_1.z.literal("Person"),
|
|
13
|
+
zod_1.z.literal("Service"),
|
|
14
|
+
zod_1.z.literal("Application"),
|
|
15
|
+
zod_1.z.literal("Group"),
|
|
16
|
+
zod_1.z.literal("Organization"),
|
|
17
|
+
]),
|
|
9
18
|
following: zod_1.z.string().url().optional(),
|
|
10
|
-
followers: zod_1.z.string().url(),
|
|
19
|
+
followers: zod_1.z.string().url().optional(),
|
|
11
20
|
inbox: zod_1.z.string().url(),
|
|
12
21
|
outbox: zod_1.z.string().url(),
|
|
22
|
+
featured: zod_1.z.string().url().optional(),
|
|
23
|
+
featuredTags: zod_1.z.string().url().optional(),
|
|
13
24
|
preferredUsername: zod_1.z.string(),
|
|
14
|
-
name: zod_1.z.string(),
|
|
25
|
+
name: zod_1.z.string().optional(),
|
|
15
26
|
summary: zod_1.z.string().nullish(),
|
|
16
|
-
url: zod_1.z.string().
|
|
27
|
+
url: zod_1.z.string().optional(),
|
|
17
28
|
published: zod_1.z.string().nullish(),
|
|
18
29
|
manuallyApprovesFollowers: zod_1.z.boolean().optional(),
|
|
30
|
+
discoverable: zod_1.z.boolean().optional(),
|
|
31
|
+
indexable: zod_1.z.boolean().optional(),
|
|
32
|
+
memorial: zod_1.z.boolean().optional(),
|
|
33
|
+
suspended: zod_1.z.boolean().optional(),
|
|
34
|
+
devices: zod_1.z.string().url().optional(),
|
|
35
|
+
alsoKnownAs: zod_1.z.array(zod_1.z.string()).optional(),
|
|
36
|
+
movedTo: zod_1.z.string().optional(),
|
|
19
37
|
publicKey: zod_1.z.object({
|
|
20
38
|
id: zod_1.z.string(),
|
|
21
39
|
owner: zod_1.z.string(),
|
|
@@ -28,6 +46,16 @@ exports.Actor = zod_1.z.object({
|
|
|
28
46
|
.optional(),
|
|
29
47
|
icon: image_js_1.Image.nullish(),
|
|
30
48
|
image: image_js_1.Image.nullish(),
|
|
49
|
+
attachment: zod_1.z.array(propertyValue_js_1.PropertyValue).optional(),
|
|
50
|
+
tag: zod_1.z.array(zod_1.z.union([hashtag_js_1.HashTag, emoji_js_1.Emoji])).optional(),
|
|
51
|
+
generator: zod_1.z
|
|
52
|
+
.object({
|
|
53
|
+
id: zod_1.z.string().optional(),
|
|
54
|
+
type: zod_1.z.string(),
|
|
55
|
+
name: zod_1.z.string().optional(),
|
|
56
|
+
url: zod_1.z.string().optional(),
|
|
57
|
+
})
|
|
58
|
+
.optional(),
|
|
31
59
|
});
|
|
32
60
|
exports.Person = exports.Actor;
|
|
33
61
|
exports.Service = exports.Actor;
|
package/dist/cjs/note/emoji.js
CHANGED
package/dist/esm/actor.js
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { Image } from "./image.js";
|
|
3
|
+
import { PropertyValue } from "./note/propertyValue.js";
|
|
4
|
+
import { HashTag } from "./note/hashtag.js";
|
|
5
|
+
import { Emoji } from "./note/emoji.js";
|
|
3
6
|
export const Actor = z.object({
|
|
4
7
|
id: z.string(),
|
|
5
|
-
type: z.union([
|
|
8
|
+
type: z.union([
|
|
9
|
+
z.literal("Person"),
|
|
10
|
+
z.literal("Service"),
|
|
11
|
+
z.literal("Application"),
|
|
12
|
+
z.literal("Group"),
|
|
13
|
+
z.literal("Organization"),
|
|
14
|
+
]),
|
|
6
15
|
following: z.string().url().optional(),
|
|
7
|
-
followers: z.string().url(),
|
|
16
|
+
followers: z.string().url().optional(),
|
|
8
17
|
inbox: z.string().url(),
|
|
9
18
|
outbox: z.string().url(),
|
|
19
|
+
featured: z.string().url().optional(),
|
|
20
|
+
featuredTags: z.string().url().optional(),
|
|
10
21
|
preferredUsername: z.string(),
|
|
11
|
-
name: z.string(),
|
|
22
|
+
name: z.string().optional(),
|
|
12
23
|
summary: z.string().nullish(),
|
|
13
|
-
url: z.string().
|
|
24
|
+
url: z.string().optional(),
|
|
14
25
|
published: z.string().nullish(),
|
|
15
26
|
manuallyApprovesFollowers: z.boolean().optional(),
|
|
27
|
+
discoverable: z.boolean().optional(),
|
|
28
|
+
indexable: z.boolean().optional(),
|
|
29
|
+
memorial: z.boolean().optional(),
|
|
30
|
+
suspended: z.boolean().optional(),
|
|
31
|
+
devices: z.string().url().optional(),
|
|
32
|
+
alsoKnownAs: z.array(z.string()).optional(),
|
|
33
|
+
movedTo: z.string().optional(),
|
|
16
34
|
publicKey: z.object({
|
|
17
35
|
id: z.string(),
|
|
18
36
|
owner: z.string(),
|
|
@@ -25,6 +43,16 @@ export const Actor = z.object({
|
|
|
25
43
|
.optional(),
|
|
26
44
|
icon: Image.nullish(),
|
|
27
45
|
image: Image.nullish(),
|
|
46
|
+
attachment: z.array(PropertyValue).optional(),
|
|
47
|
+
tag: z.array(z.union([HashTag, Emoji])).optional(),
|
|
48
|
+
generator: z
|
|
49
|
+
.object({
|
|
50
|
+
id: z.string().optional(),
|
|
51
|
+
type: z.string(),
|
|
52
|
+
name: z.string().optional(),
|
|
53
|
+
url: z.string().optional(),
|
|
54
|
+
})
|
|
55
|
+
.optional(),
|
|
28
56
|
});
|
|
29
57
|
export const Person = Actor;
|
|
30
58
|
export const Service = Actor;
|
package/dist/esm/note/emoji.js
CHANGED
package/dist/types/actor.d.ts
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const Actor: z.ZodObject<{
|
|
3
3
|
id: z.ZodString;
|
|
4
|
-
type: z.ZodUnion<readonly [z.ZodLiteral<"Person">, z.ZodLiteral<"Service">]>;
|
|
4
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"Person">, z.ZodLiteral<"Service">, z.ZodLiteral<"Application">, z.ZodLiteral<"Group">, z.ZodLiteral<"Organization">]>;
|
|
5
5
|
following: z.ZodOptional<z.ZodString>;
|
|
6
|
-
followers: z.ZodString
|
|
6
|
+
followers: z.ZodOptional<z.ZodString>;
|
|
7
7
|
inbox: z.ZodString;
|
|
8
8
|
outbox: z.ZodString;
|
|
9
|
+
featured: z.ZodOptional<z.ZodString>;
|
|
10
|
+
featuredTags: z.ZodOptional<z.ZodString>;
|
|
9
11
|
preferredUsername: z.ZodString;
|
|
10
|
-
name: z.ZodString
|
|
12
|
+
name: z.ZodOptional<z.ZodString>;
|
|
11
13
|
summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
-
url: z.ZodString
|
|
14
|
+
url: z.ZodOptional<z.ZodString>;
|
|
13
15
|
published: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
16
|
manuallyApprovesFollowers: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
discoverable: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
indexable: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
memorial: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
suspended: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
devices: z.ZodOptional<z.ZodString>;
|
|
22
|
+
alsoKnownAs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
movedTo: z.ZodOptional<z.ZodString>;
|
|
15
24
|
publicKey: z.ZodObject<{
|
|
16
25
|
id: z.ZodString;
|
|
17
26
|
owner: z.ZodString;
|
|
@@ -30,21 +39,56 @@ export declare const Actor: z.ZodObject<{
|
|
|
30
39
|
mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
40
|
url: z.ZodString;
|
|
32
41
|
}, z.core.$strip>>>;
|
|
42
|
+
attachment: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"PropertyValue">;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
value: z.ZodString;
|
|
46
|
+
}, z.core.$strip>>>;
|
|
47
|
+
tag: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
48
|
+
type: z.ZodLiteral<"Hashtag">;
|
|
49
|
+
href: z.ZodString;
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
|
+
type: z.ZodLiteral<"Emoji">;
|
|
53
|
+
id: z.ZodOptional<z.ZodString>;
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
updated: z.ZodString;
|
|
56
|
+
icon: z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"Image">;
|
|
58
|
+
mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
url: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
}, z.core.$strip>]>>>;
|
|
62
|
+
generator: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
id: z.ZodOptional<z.ZodString>;
|
|
64
|
+
type: z.ZodString;
|
|
65
|
+
name: z.ZodOptional<z.ZodString>;
|
|
66
|
+
url: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
33
68
|
}, z.core.$strip>;
|
|
34
69
|
export type Actor = z.infer<typeof Actor>;
|
|
35
70
|
export declare const Person: z.ZodObject<{
|
|
36
71
|
id: z.ZodString;
|
|
37
|
-
type: z.ZodUnion<readonly [z.ZodLiteral<"Person">, z.ZodLiteral<"Service">]>;
|
|
72
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"Person">, z.ZodLiteral<"Service">, z.ZodLiteral<"Application">, z.ZodLiteral<"Group">, z.ZodLiteral<"Organization">]>;
|
|
38
73
|
following: z.ZodOptional<z.ZodString>;
|
|
39
|
-
followers: z.ZodString
|
|
74
|
+
followers: z.ZodOptional<z.ZodString>;
|
|
40
75
|
inbox: z.ZodString;
|
|
41
76
|
outbox: z.ZodString;
|
|
77
|
+
featured: z.ZodOptional<z.ZodString>;
|
|
78
|
+
featuredTags: z.ZodOptional<z.ZodString>;
|
|
42
79
|
preferredUsername: z.ZodString;
|
|
43
|
-
name: z.ZodString
|
|
80
|
+
name: z.ZodOptional<z.ZodString>;
|
|
44
81
|
summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
|
-
url: z.ZodString
|
|
82
|
+
url: z.ZodOptional<z.ZodString>;
|
|
46
83
|
published: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
84
|
manuallyApprovesFollowers: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
discoverable: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
indexable: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
memorial: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
suspended: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
devices: z.ZodOptional<z.ZodString>;
|
|
90
|
+
alsoKnownAs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
91
|
+
movedTo: z.ZodOptional<z.ZodString>;
|
|
48
92
|
publicKey: z.ZodObject<{
|
|
49
93
|
id: z.ZodString;
|
|
50
94
|
owner: z.ZodString;
|
|
@@ -63,21 +107,56 @@ export declare const Person: z.ZodObject<{
|
|
|
63
107
|
mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
108
|
url: z.ZodString;
|
|
65
109
|
}, z.core.$strip>>>;
|
|
110
|
+
attachment: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
111
|
+
type: z.ZodLiteral<"PropertyValue">;
|
|
112
|
+
name: z.ZodString;
|
|
113
|
+
value: z.ZodString;
|
|
114
|
+
}, z.core.$strip>>>;
|
|
115
|
+
tag: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
116
|
+
type: z.ZodLiteral<"Hashtag">;
|
|
117
|
+
href: z.ZodString;
|
|
118
|
+
name: z.ZodString;
|
|
119
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
120
|
+
type: z.ZodLiteral<"Emoji">;
|
|
121
|
+
id: z.ZodOptional<z.ZodString>;
|
|
122
|
+
name: z.ZodString;
|
|
123
|
+
updated: z.ZodString;
|
|
124
|
+
icon: z.ZodObject<{
|
|
125
|
+
type: z.ZodLiteral<"Image">;
|
|
126
|
+
mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
127
|
+
url: z.ZodString;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
}, z.core.$strip>]>>>;
|
|
130
|
+
generator: z.ZodOptional<z.ZodObject<{
|
|
131
|
+
id: z.ZodOptional<z.ZodString>;
|
|
132
|
+
type: z.ZodString;
|
|
133
|
+
name: z.ZodOptional<z.ZodString>;
|
|
134
|
+
url: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>>;
|
|
66
136
|
}, z.core.$strip>;
|
|
67
137
|
export type Person = z.infer<typeof Person>;
|
|
68
138
|
export declare const Service: z.ZodObject<{
|
|
69
139
|
id: z.ZodString;
|
|
70
|
-
type: z.ZodUnion<readonly [z.ZodLiteral<"Person">, z.ZodLiteral<"Service">]>;
|
|
140
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"Person">, z.ZodLiteral<"Service">, z.ZodLiteral<"Application">, z.ZodLiteral<"Group">, z.ZodLiteral<"Organization">]>;
|
|
71
141
|
following: z.ZodOptional<z.ZodString>;
|
|
72
|
-
followers: z.ZodString
|
|
142
|
+
followers: z.ZodOptional<z.ZodString>;
|
|
73
143
|
inbox: z.ZodString;
|
|
74
144
|
outbox: z.ZodString;
|
|
145
|
+
featured: z.ZodOptional<z.ZodString>;
|
|
146
|
+
featuredTags: z.ZodOptional<z.ZodString>;
|
|
75
147
|
preferredUsername: z.ZodString;
|
|
76
|
-
name: z.ZodString
|
|
148
|
+
name: z.ZodOptional<z.ZodString>;
|
|
77
149
|
summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
-
url: z.ZodString
|
|
150
|
+
url: z.ZodOptional<z.ZodString>;
|
|
79
151
|
published: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
80
152
|
manuallyApprovesFollowers: z.ZodOptional<z.ZodBoolean>;
|
|
153
|
+
discoverable: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
indexable: z.ZodOptional<z.ZodBoolean>;
|
|
155
|
+
memorial: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
suspended: z.ZodOptional<z.ZodBoolean>;
|
|
157
|
+
devices: z.ZodOptional<z.ZodString>;
|
|
158
|
+
alsoKnownAs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
159
|
+
movedTo: z.ZodOptional<z.ZodString>;
|
|
81
160
|
publicKey: z.ZodObject<{
|
|
82
161
|
id: z.ZodString;
|
|
83
162
|
owner: z.ZodString;
|
|
@@ -96,5 +175,31 @@ export declare const Service: z.ZodObject<{
|
|
|
96
175
|
mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
176
|
url: z.ZodString;
|
|
98
177
|
}, z.core.$strip>>>;
|
|
178
|
+
attachment: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"PropertyValue">;
|
|
180
|
+
name: z.ZodString;
|
|
181
|
+
value: z.ZodString;
|
|
182
|
+
}, z.core.$strip>>>;
|
|
183
|
+
tag: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
184
|
+
type: z.ZodLiteral<"Hashtag">;
|
|
185
|
+
href: z.ZodString;
|
|
186
|
+
name: z.ZodString;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
|
+
type: z.ZodLiteral<"Emoji">;
|
|
189
|
+
id: z.ZodOptional<z.ZodString>;
|
|
190
|
+
name: z.ZodString;
|
|
191
|
+
updated: z.ZodString;
|
|
192
|
+
icon: z.ZodObject<{
|
|
193
|
+
type: z.ZodLiteral<"Image">;
|
|
194
|
+
mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
195
|
+
url: z.ZodString;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
}, z.core.$strip>]>>>;
|
|
198
|
+
generator: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
id: z.ZodOptional<z.ZodString>;
|
|
200
|
+
type: z.ZodString;
|
|
201
|
+
name: z.ZodOptional<z.ZodString>;
|
|
202
|
+
url: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>>;
|
|
99
204
|
}, z.core.$strip>;
|
|
100
205
|
export type Service = z.infer<typeof Service>;
|
package/dist/types/content.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export declare const Note: z.ZodObject<{
|
|
|
62
62
|
name: z.ZodString;
|
|
63
63
|
}, z.core.$strip>, z.ZodObject<{
|
|
64
64
|
type: z.ZodLiteral<"Emoji">;
|
|
65
|
+
id: z.ZodOptional<z.ZodString>;
|
|
65
66
|
name: z.ZodString;
|
|
66
67
|
updated: z.ZodString;
|
|
67
68
|
icon: z.ZodObject<{
|
|
@@ -79,6 +80,7 @@ export declare const Note: z.ZodObject<{
|
|
|
79
80
|
name: z.ZodString;
|
|
80
81
|
}, z.core.$strip>, z.ZodObject<{
|
|
81
82
|
type: z.ZodLiteral<"Emoji">;
|
|
83
|
+
id: z.ZodOptional<z.ZodString>;
|
|
82
84
|
name: z.ZodString;
|
|
83
85
|
updated: z.ZodString;
|
|
84
86
|
icon: z.ZodObject<{
|
|
@@ -159,6 +161,7 @@ export declare const Question: z.ZodObject<{
|
|
|
159
161
|
name: z.ZodString;
|
|
160
162
|
}, z.core.$strip>, z.ZodObject<{
|
|
161
163
|
type: z.ZodLiteral<"Emoji">;
|
|
164
|
+
id: z.ZodOptional<z.ZodString>;
|
|
162
165
|
name: z.ZodString;
|
|
163
166
|
updated: z.ZodString;
|
|
164
167
|
icon: z.ZodObject<{
|
|
@@ -176,6 +179,7 @@ export declare const Question: z.ZodObject<{
|
|
|
176
179
|
name: z.ZodString;
|
|
177
180
|
}, z.core.$strip>, z.ZodObject<{
|
|
178
181
|
type: z.ZodLiteral<"Emoji">;
|
|
182
|
+
id: z.ZodOptional<z.ZodString>;
|
|
179
183
|
name: z.ZodString;
|
|
180
184
|
updated: z.ZodString;
|
|
181
185
|
icon: z.ZodObject<{
|
|
@@ -275,6 +279,7 @@ export declare const ImageContent: z.ZodObject<{
|
|
|
275
279
|
name: z.ZodString;
|
|
276
280
|
}, z.core.$strip>, z.ZodObject<{
|
|
277
281
|
type: z.ZodLiteral<"Emoji">;
|
|
282
|
+
id: z.ZodOptional<z.ZodString>;
|
|
278
283
|
name: z.ZodString;
|
|
279
284
|
updated: z.ZodString;
|
|
280
285
|
icon: z.ZodObject<{
|
|
@@ -292,6 +297,7 @@ export declare const ImageContent: z.ZodObject<{
|
|
|
292
297
|
name: z.ZodString;
|
|
293
298
|
}, z.core.$strip>, z.ZodObject<{
|
|
294
299
|
type: z.ZodLiteral<"Emoji">;
|
|
300
|
+
id: z.ZodOptional<z.ZodString>;
|
|
295
301
|
name: z.ZodString;
|
|
296
302
|
updated: z.ZodString;
|
|
297
303
|
icon: z.ZodObject<{
|
|
@@ -376,6 +382,7 @@ export declare const PageContent: z.ZodObject<{
|
|
|
376
382
|
name: z.ZodString;
|
|
377
383
|
}, z.core.$strip>, z.ZodObject<{
|
|
378
384
|
type: z.ZodLiteral<"Emoji">;
|
|
385
|
+
id: z.ZodOptional<z.ZodString>;
|
|
379
386
|
name: z.ZodString;
|
|
380
387
|
updated: z.ZodString;
|
|
381
388
|
icon: z.ZodObject<{
|
|
@@ -393,6 +400,7 @@ export declare const PageContent: z.ZodObject<{
|
|
|
393
400
|
name: z.ZodString;
|
|
394
401
|
}, z.core.$strip>, z.ZodObject<{
|
|
395
402
|
type: z.ZodLiteral<"Emoji">;
|
|
403
|
+
id: z.ZodOptional<z.ZodString>;
|
|
396
404
|
name: z.ZodString;
|
|
397
405
|
updated: z.ZodString;
|
|
398
406
|
icon: z.ZodObject<{
|
|
@@ -477,6 +485,7 @@ export declare const ArticleContent: z.ZodObject<{
|
|
|
477
485
|
name: z.ZodString;
|
|
478
486
|
}, z.core.$strip>, z.ZodObject<{
|
|
479
487
|
type: z.ZodLiteral<"Emoji">;
|
|
488
|
+
id: z.ZodOptional<z.ZodString>;
|
|
480
489
|
name: z.ZodString;
|
|
481
490
|
updated: z.ZodString;
|
|
482
491
|
icon: z.ZodObject<{
|
|
@@ -494,6 +503,7 @@ export declare const ArticleContent: z.ZodObject<{
|
|
|
494
503
|
name: z.ZodString;
|
|
495
504
|
}, z.core.$strip>, z.ZodObject<{
|
|
496
505
|
type: z.ZodLiteral<"Emoji">;
|
|
506
|
+
id: z.ZodOptional<z.ZodString>;
|
|
497
507
|
name: z.ZodString;
|
|
498
508
|
updated: z.ZodString;
|
|
499
509
|
icon: z.ZodObject<{
|
|
@@ -578,6 +588,7 @@ export declare const VideoContent: z.ZodObject<{
|
|
|
578
588
|
name: z.ZodString;
|
|
579
589
|
}, z.core.$strip>, z.ZodObject<{
|
|
580
590
|
type: z.ZodLiteral<"Emoji">;
|
|
591
|
+
id: z.ZodOptional<z.ZodString>;
|
|
581
592
|
name: z.ZodString;
|
|
582
593
|
updated: z.ZodString;
|
|
583
594
|
icon: z.ZodObject<{
|
|
@@ -595,6 +606,7 @@ export declare const VideoContent: z.ZodObject<{
|
|
|
595
606
|
name: z.ZodString;
|
|
596
607
|
}, z.core.$strip>, z.ZodObject<{
|
|
597
608
|
type: z.ZodLiteral<"Emoji">;
|
|
609
|
+
id: z.ZodOptional<z.ZodString>;
|
|
598
610
|
name: z.ZodString;
|
|
599
611
|
updated: z.ZodString;
|
|
600
612
|
icon: z.ZodObject<{
|
package/dist/types/like.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export declare const Like: z.ZodObject<{
|
|
|
63
63
|
name: z.ZodString;
|
|
64
64
|
}, z.core.$strip>, z.ZodObject<{
|
|
65
65
|
type: z.ZodLiteral<"Emoji">;
|
|
66
|
+
id: z.ZodOptional<z.ZodString>;
|
|
66
67
|
name: z.ZodString;
|
|
67
68
|
updated: z.ZodString;
|
|
68
69
|
icon: z.ZodObject<{
|
|
@@ -80,6 +81,7 @@ export declare const Like: z.ZodObject<{
|
|
|
80
81
|
name: z.ZodString;
|
|
81
82
|
}, z.core.$strip>, z.ZodObject<{
|
|
82
83
|
type: z.ZodLiteral<"Emoji">;
|
|
84
|
+
id: z.ZodOptional<z.ZodString>;
|
|
83
85
|
name: z.ZodString;
|
|
84
86
|
updated: z.ZodString;
|
|
85
87
|
icon: z.ZodObject<{
|
|
@@ -58,6 +58,7 @@ export declare const BaseContent: z.ZodObject<{
|
|
|
58
58
|
name: z.ZodString;
|
|
59
59
|
}, z.core.$strip>, z.ZodObject<{
|
|
60
60
|
type: z.ZodLiteral<"Emoji">;
|
|
61
|
+
id: z.ZodOptional<z.ZodString>;
|
|
61
62
|
name: z.ZodString;
|
|
62
63
|
updated: z.ZodString;
|
|
63
64
|
icon: z.ZodObject<{
|
|
@@ -75,6 +76,7 @@ export declare const BaseContent: z.ZodObject<{
|
|
|
75
76
|
name: z.ZodString;
|
|
76
77
|
}, z.core.$strip>, z.ZodObject<{
|
|
77
78
|
type: z.ZodLiteral<"Emoji">;
|
|
79
|
+
id: z.ZodOptional<z.ZodString>;
|
|
78
80
|
name: z.ZodString;
|
|
79
81
|
updated: z.ZodString;
|
|
80
82
|
icon: z.ZodObject<{
|
package/dist/types/note/tag.d.ts
CHANGED
package/dist/types/undo.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export declare const Undo: z.ZodObject<{
|
|
|
66
66
|
name: z.ZodString;
|
|
67
67
|
}, z.core.$strip>, z.ZodObject<{
|
|
68
68
|
type: z.ZodLiteral<"Emoji">;
|
|
69
|
+
id: z.ZodOptional<z.ZodString>;
|
|
69
70
|
name: z.ZodString;
|
|
70
71
|
updated: z.ZodString;
|
|
71
72
|
icon: z.ZodObject<{
|
|
@@ -83,6 +84,7 @@ export declare const Undo: z.ZodObject<{
|
|
|
83
84
|
name: z.ZodString;
|
|
84
85
|
}, z.core.$strip>, z.ZodObject<{
|
|
85
86
|
type: z.ZodLiteral<"Emoji">;
|
|
87
|
+
id: z.ZodOptional<z.ZodString>;
|
|
86
88
|
name: z.ZodString;
|
|
87
89
|
updated: z.ZodString;
|
|
88
90
|
icon: z.ZodObject<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llun/activities.schema",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Validate ActivityPub and Mastodon with Zod",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "mkdir -p dist && tsc --module commonjs --moduleResolution Node --outDir dist/cjs && tsc --module NodeNext --moduleResolution NodeNext --outDir dist/esm && tsc --emitDeclarationOnly --declaration --moduleResolution node16 --module node16 --outDir dist/types",
|
|
11
|
+
"test": "npm run build && node tests/actor-compatibility.test.js",
|
|
11
12
|
"release": "rm -rf dist && npm run build && npm publish --access public"
|
|
12
13
|
},
|
|
13
14
|
"author": "Maythee Anegboonlap <null@llun.dev>",
|
package/src/actor.ts
CHANGED
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { Image } from "./image.js";
|
|
3
|
+
import { PropertyValue } from "./note/propertyValue.js";
|
|
4
|
+
import { HashTag } from "./note/hashtag.js";
|
|
5
|
+
import { Emoji } from "./note/emoji.js";
|
|
3
6
|
|
|
4
7
|
export const Actor = z.object({
|
|
5
8
|
id: z.string(),
|
|
6
|
-
type: z.union([
|
|
9
|
+
type: z.union([
|
|
10
|
+
z.literal("Person"),
|
|
11
|
+
z.literal("Service"),
|
|
12
|
+
z.literal("Application"),
|
|
13
|
+
z.literal("Group"),
|
|
14
|
+
z.literal("Organization"),
|
|
15
|
+
]),
|
|
7
16
|
following: z.string().url().optional(),
|
|
8
|
-
followers: z.string().url(),
|
|
17
|
+
followers: z.string().url().optional(),
|
|
9
18
|
inbox: z.string().url(),
|
|
10
19
|
outbox: z.string().url(),
|
|
20
|
+
featured: z.string().url().optional(),
|
|
21
|
+
featuredTags: z.string().url().optional(),
|
|
11
22
|
preferredUsername: z.string(),
|
|
12
|
-
name: z.string(),
|
|
23
|
+
name: z.string().optional(),
|
|
13
24
|
summary: z.string().nullish(),
|
|
14
|
-
url: z.string().
|
|
25
|
+
url: z.string().optional(),
|
|
15
26
|
published: z.string().nullish(),
|
|
16
27
|
manuallyApprovesFollowers: z.boolean().optional(),
|
|
28
|
+
discoverable: z.boolean().optional(),
|
|
29
|
+
indexable: z.boolean().optional(),
|
|
30
|
+
memorial: z.boolean().optional(),
|
|
31
|
+
suspended: z.boolean().optional(),
|
|
32
|
+
devices: z.string().url().optional(),
|
|
33
|
+
alsoKnownAs: z.array(z.string()).optional(),
|
|
34
|
+
movedTo: z.string().optional(),
|
|
17
35
|
publicKey: z.object({
|
|
18
36
|
id: z.string(),
|
|
19
37
|
owner: z.string(),
|
|
@@ -26,6 +44,16 @@ export const Actor = z.object({
|
|
|
26
44
|
.optional(),
|
|
27
45
|
icon: Image.nullish(),
|
|
28
46
|
image: Image.nullish(),
|
|
47
|
+
attachment: z.array(PropertyValue).optional(),
|
|
48
|
+
tag: z.array(z.union([HashTag, Emoji])).optional(),
|
|
49
|
+
generator: z
|
|
50
|
+
.object({
|
|
51
|
+
id: z.string().optional(),
|
|
52
|
+
type: z.string(),
|
|
53
|
+
name: z.string().optional(),
|
|
54
|
+
url: z.string().optional(),
|
|
55
|
+
})
|
|
56
|
+
.optional(),
|
|
29
57
|
});
|
|
30
58
|
export type Actor = z.infer<typeof Actor>;
|
|
31
59
|
|
package/src/note/emoji.ts
CHANGED
package/tests/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Actor Compatibility Tests
|
|
2
|
+
|
|
3
|
+
This directory contains compatibility tests for the ActivityPub Actor schema against real-world actor data from various federated platforms.
|
|
4
|
+
|
|
5
|
+
## Test Fixtures
|
|
6
|
+
|
|
7
|
+
The `fixtures/` directory contains actual actor JSON data fetched from live instances:
|
|
8
|
+
|
|
9
|
+
### Mastodon
|
|
10
|
+
- **hcommons.social** - Academic-focused Mastodon instance
|
|
11
|
+
- **mastodon.social** - Main Mastodon instance with profile hashtags and PropertyValue metadata
|
|
12
|
+
- **chaos.social** - Chaos Computer Club Mastodon instance
|
|
13
|
+
|
|
14
|
+
### Friendica
|
|
15
|
+
- **poliverso.org** - Friendica instance with extended ActivityPub support
|
|
16
|
+
|
|
17
|
+
### Pleroma/Akkoma
|
|
18
|
+
- **udongein.xyz** - Pleroma/Akkoma instance with custom emojis
|
|
19
|
+
|
|
20
|
+
### Misskey
|
|
21
|
+
- **mewl.me** - Misskey instance with extended Misskey-specific metadata
|
|
22
|
+
|
|
23
|
+
## Running Tests
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm test
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or manually:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm run build
|
|
33
|
+
node tests/actor-compatibility.test.js
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## What the Tests Validate
|
|
37
|
+
|
|
38
|
+
The tests verify that the Actor schema correctly handles:
|
|
39
|
+
|
|
40
|
+
- ✓ Different actor types (Person, Service, Application, Group, Organization)
|
|
41
|
+
- ✓ Optional fields (followers, name, url, featured, etc.)
|
|
42
|
+
- ✓ Account migration fields (alsoKnownAs, movedTo)
|
|
43
|
+
- ✓ Profile metadata (attachment with PropertyValue)
|
|
44
|
+
- ✓ Tags (both HashTag and Emoji types)
|
|
45
|
+
- ✓ Discovery settings (discoverable, indexable)
|
|
46
|
+
- ✓ Account states (memorial, suspended)
|
|
47
|
+
- ✓ Generator information
|
|
48
|
+
- ✓ Platform-specific extensions that don't break validation
|
|
49
|
+
|
|
50
|
+
## Updating Test Fixtures
|
|
51
|
+
|
|
52
|
+
To update fixtures with fresh data from live instances:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Fetch actor data
|
|
56
|
+
curl -H "Accept: application/activity+json" https://instance.social/users/username > tests/fixtures/platform-instance-social.json
|
|
57
|
+
|
|
58
|
+
# Run tests to verify
|
|
59
|
+
npm test
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Coverage
|
|
63
|
+
|
|
64
|
+
The test suite validates compatibility across **4 major ActivityPub platforms**:
|
|
65
|
+
- Mastodon
|
|
66
|
+
- Friendica
|
|
67
|
+
- Pleroma/Akkoma
|
|
68
|
+
- Misskey
|
|
69
|
+
|
|
70
|
+
This ensures the schema works with the vast majority of the Fediverse.
|