@llun/activities.schema 0.2.10 → 0.2.12

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.
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Follow = void 0;
3
+ exports.Follow = exports.ENTITY_TYPE_FOLLOW = void 0;
4
4
  const zod_1 = require("zod");
5
+ exports.ENTITY_TYPE_FOLLOW = "Follow";
5
6
  exports.Follow = zod_1.z.object({
6
7
  id: zod_1.z.string(),
7
- type: zod_1.z.literal("Follow"),
8
+ type: zod_1.z.literal(exports.ENTITY_TYPE_FOLLOW),
8
9
  actor: zod_1.z.string(),
9
10
  object: zod_1.z.string(),
10
11
  });
package/dist/cjs/index.js CHANGED
@@ -19,7 +19,11 @@ __exportStar(require("./accept.js"), exports);
19
19
  __exportStar(require("./follow.js"), exports);
20
20
  __exportStar(require("./like.js"), exports);
21
21
  __exportStar(require("./note.js"), exports);
22
+ __exportStar(require("./question.js"), exports);
22
23
  __exportStar(require("./reject.js"), exports);
23
24
  __exportStar(require("./undo.js"), exports);
24
25
  __exportStar(require("./announce.js"), exports);
26
+ __exportStar(require("./note/emoji.js"), exports);
27
+ __exportStar(require("./note/mention.js"), exports);
28
+ __exportStar(require("./note/hashtag.js"), exports);
25
29
  exports.Mastodon = require("./mastodon/index.js");
package/dist/cjs/like.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Like = void 0;
3
+ exports.Like = exports.ENTITY_TYPE_LIKE = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const note_js_1 = require("./note.js");
6
+ exports.ENTITY_TYPE_LIKE = "Like";
6
7
  exports.Like = zod_1.z.object({
7
- type: zod_1.z.literal("Like"),
8
+ type: zod_1.z.literal(exports.ENTITY_TYPE_LIKE),
8
9
  id: zod_1.z.string(),
9
10
  actor: zod_1.z.string(),
10
11
  object: zod_1.z.union([zod_1.z.string(), note_js_1.Note]),
package/dist/cjs/note.js CHANGED
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Note = void 0;
3
+ exports.Note = exports.ENTITY_TYPE_NOTE = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const baseContent_js_1 = require("./note/baseContent.js");
6
+ exports.ENTITY_TYPE_NOTE = "Note";
6
7
  exports.Note = baseContent_js_1.BaseContent.extend({
7
- type: zod_1.z.literal("Note"),
8
+ type: zod_1.z.literal(exports.ENTITY_TYPE_NOTE),
8
9
  });
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Note = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.Note = zod_1.z.object({
6
+ type: zod_1.z.literal("Note"),
7
+ name: zod_1.z.string(),
8
+ replies: zod_1.z.object({
9
+ type: zod_1.z.literal("Collection"),
10
+ totalItems: zod_1.z.number(),
11
+ }),
12
+ });
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Question = exports.ENTITY_TYPE_QUESTION = void 0;
4
+ const zod_1 = require("zod");
5
+ const baseContent_js_1 = require("./note/baseContent.js");
6
+ const note_js_1 = require("./question/note.js");
7
+ exports.ENTITY_TYPE_QUESTION = "Question";
8
+ exports.Question = baseContent_js_1.BaseContent.extend({
9
+ type: zod_1.z.literal(exports.ENTITY_TYPE_QUESTION),
10
+ endTime: zod_1.z.string({ description: "Question end time" }),
11
+ oneOf: note_js_1.Note.array(),
12
+ });
@@ -1,7 +1,8 @@
1
1
  import { z } from "zod";
2
+ export const ENTITY_TYPE_FOLLOW = "Follow";
2
3
  export const Follow = z.object({
3
4
  id: z.string(),
4
- type: z.literal("Follow"),
5
+ type: z.literal(ENTITY_TYPE_FOLLOW),
5
6
  actor: z.string(),
6
7
  object: z.string(),
7
8
  });
package/dist/esm/index.js CHANGED
@@ -2,7 +2,11 @@ export * from "./accept.js";
2
2
  export * from "./follow.js";
3
3
  export * from "./like.js";
4
4
  export * from "./note.js";
5
+ export * from "./question.js";
5
6
  export * from "./reject.js";
6
7
  export * from "./undo.js";
7
8
  export * from "./announce.js";
9
+ export * from "./note/emoji.js";
10
+ export * from "./note/mention.js";
11
+ export * from "./note/hashtag.js";
8
12
  export * as Mastodon from "./mastodon/index.js";
package/dist/esm/like.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { Note } from "./note.js";
3
+ export const ENTITY_TYPE_LIKE = "Like";
3
4
  export const Like = z.object({
4
- type: z.literal("Like"),
5
+ type: z.literal(ENTITY_TYPE_LIKE),
5
6
  id: z.string(),
6
7
  actor: z.string(),
7
8
  object: z.union([z.string(), Note]),
package/dist/esm/note.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseContent } from "./note/baseContent.js";
3
+ export const ENTITY_TYPE_NOTE = "Note";
3
4
  export const Note = BaseContent.extend({
4
- type: z.literal("Note"),
5
+ type: z.literal(ENTITY_TYPE_NOTE),
5
6
  });
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ export const Note = z.object({
3
+ type: z.literal("Note"),
4
+ name: z.string(),
5
+ replies: z.object({
6
+ type: z.literal("Collection"),
7
+ totalItems: z.number(),
8
+ }),
9
+ });
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ import { BaseContent } from "./note/baseContent.js";
3
+ import { Note } from "./question/note.js";
4
+ export const ENTITY_TYPE_QUESTION = "Question";
5
+ export const Question = BaseContent.extend({
6
+ type: z.literal(ENTITY_TYPE_QUESTION),
7
+ endTime: z.string({ description: "Question end time" }),
8
+ oneOf: Note.array(),
9
+ });
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ export declare const ENTITY_TYPE_FOLLOW = "Follow";
2
3
  export declare const Follow: z.ZodObject<{
3
4
  id: z.ZodString;
4
5
  type: z.ZodLiteral<"Follow">;
@@ -2,7 +2,11 @@ export * from "./accept.js";
2
2
  export * from "./follow.js";
3
3
  export * from "./like.js";
4
4
  export * from "./note.js";
5
+ export * from "./question.js";
5
6
  export * from "./reject.js";
6
7
  export * from "./undo.js";
7
8
  export * from "./announce.js";
9
+ export * from "./note/emoji.js";
10
+ export * from "./note/mention.js";
11
+ export * from "./note/hashtag.js";
8
12
  export * as Mastodon from "./mastodon/index.js";
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ export declare const ENTITY_TYPE_LIKE = "Like";
2
3
  export declare const Like: z.ZodObject<{
3
4
  type: z.ZodLiteral<"Like">;
4
5
  id: z.ZodString;
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ export declare const ENTITY_TYPE_NOTE = "Note";
2
3
  export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
3
4
  id: z.ZodString;
4
5
  url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ export declare const Note: z.ZodObject<{
3
+ type: z.ZodLiteral<"Note">;
4
+ name: z.ZodString;
5
+ replies: z.ZodObject<{
6
+ type: z.ZodLiteral<"Collection">;
7
+ totalItems: z.ZodNumber;
8
+ }, "strip", z.ZodTypeAny, {
9
+ type: "Collection";
10
+ totalItems: number;
11
+ }, {
12
+ type: "Collection";
13
+ totalItems: number;
14
+ }>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ type: "Note";
17
+ name: string;
18
+ replies: {
19
+ type: "Collection";
20
+ totalItems: number;
21
+ };
22
+ }, {
23
+ type: "Note";
24
+ name: string;
25
+ replies: {
26
+ type: "Collection";
27
+ totalItems: number;
28
+ };
29
+ }>;
30
+ export type Note = z.infer<typeof Note>;
@@ -0,0 +1,416 @@
1
+ import { z } from "zod";
2
+ export declare const ENTITY_TYPE_QUESTION = "Question";
3
+ export declare const Question: z.ZodObject<z.objectUtil.extendShape<{
4
+ id: z.ZodString;
5
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
+ attributedTo: z.ZodString;
7
+ to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
8
+ cc: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
9
+ inReplyTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
+ summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ summaryMap: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
12
+ content: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
13
+ contentMap: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodArray<z.ZodString, "many">]>>>;
14
+ attachment: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
15
+ type: z.ZodLiteral<"PropertyValue">;
16
+ name: z.ZodString;
17
+ value: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ type: "PropertyValue";
20
+ value: string;
21
+ name: string;
22
+ }, {
23
+ type: "PropertyValue";
24
+ value: string;
25
+ name: string;
26
+ }>, z.ZodObject<{
27
+ type: z.ZodLiteral<"Document">;
28
+ mediaType: z.ZodString;
29
+ url: z.ZodString;
30
+ blurhash: z.ZodOptional<z.ZodString>;
31
+ width: z.ZodOptional<z.ZodNumber>;
32
+ height: z.ZodOptional<z.ZodNumber>;
33
+ name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
+ focalPoint: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ type: "Document";
37
+ mediaType: string;
38
+ url: string;
39
+ blurhash?: string | undefined;
40
+ width?: number | undefined;
41
+ height?: number | undefined;
42
+ name?: string | null | undefined;
43
+ focalPoint?: [number, number] | undefined;
44
+ }, {
45
+ type: "Document";
46
+ mediaType: string;
47
+ url: string;
48
+ blurhash?: string | undefined;
49
+ width?: number | undefined;
50
+ height?: number | undefined;
51
+ name?: string | null | undefined;
52
+ focalPoint?: [number, number] | undefined;
53
+ }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
54
+ type: z.ZodLiteral<"PropertyValue">;
55
+ name: z.ZodString;
56
+ value: z.ZodString;
57
+ }, "strip", z.ZodTypeAny, {
58
+ type: "PropertyValue";
59
+ value: string;
60
+ name: string;
61
+ }, {
62
+ type: "PropertyValue";
63
+ value: string;
64
+ name: string;
65
+ }>, z.ZodObject<{
66
+ type: z.ZodLiteral<"Document">;
67
+ mediaType: z.ZodString;
68
+ url: z.ZodString;
69
+ blurhash: z.ZodOptional<z.ZodString>;
70
+ width: z.ZodOptional<z.ZodNumber>;
71
+ height: z.ZodOptional<z.ZodNumber>;
72
+ name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
73
+ focalPoint: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ type: "Document";
76
+ mediaType: string;
77
+ url: string;
78
+ blurhash?: string | undefined;
79
+ width?: number | undefined;
80
+ height?: number | undefined;
81
+ name?: string | null | undefined;
82
+ focalPoint?: [number, number] | undefined;
83
+ }, {
84
+ type: "Document";
85
+ mediaType: string;
86
+ url: string;
87
+ blurhash?: string | undefined;
88
+ width?: number | undefined;
89
+ height?: number | undefined;
90
+ name?: string | null | undefined;
91
+ focalPoint?: [number, number] | undefined;
92
+ }>]>, "many">]>>>;
93
+ tag: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
94
+ type: z.ZodLiteral<"Mention">;
95
+ href: z.ZodString;
96
+ name: z.ZodString;
97
+ }, "strip", z.ZodTypeAny, {
98
+ type: "Mention";
99
+ name: string;
100
+ href: string;
101
+ }, {
102
+ type: "Mention";
103
+ name: string;
104
+ href: string;
105
+ }>, z.ZodObject<{
106
+ type: z.ZodLiteral<"Emoji">;
107
+ name: z.ZodString;
108
+ updated: z.ZodString;
109
+ icon: z.ZodObject<{
110
+ type: z.ZodLiteral<"Image">;
111
+ mediaType: z.ZodString;
112
+ url: z.ZodString;
113
+ }, "strip", z.ZodTypeAny, {
114
+ type: "Image";
115
+ mediaType: string;
116
+ url: string;
117
+ }, {
118
+ type: "Image";
119
+ mediaType: string;
120
+ url: string;
121
+ }>;
122
+ }, "strip", z.ZodTypeAny, {
123
+ type: "Emoji";
124
+ name: string;
125
+ updated: string;
126
+ icon: {
127
+ type: "Image";
128
+ mediaType: string;
129
+ url: string;
130
+ };
131
+ }, {
132
+ type: "Emoji";
133
+ name: string;
134
+ updated: string;
135
+ icon: {
136
+ type: "Image";
137
+ mediaType: string;
138
+ url: string;
139
+ };
140
+ }>, z.ZodObject<{
141
+ type: z.ZodLiteral<"Hashtag">;
142
+ href: z.ZodString;
143
+ name: z.ZodString;
144
+ }, "strip", z.ZodTypeAny, {
145
+ type: "Hashtag";
146
+ name: string;
147
+ href: string;
148
+ }, {
149
+ type: "Hashtag";
150
+ name: string;
151
+ href: string;
152
+ }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
153
+ type: z.ZodLiteral<"Mention">;
154
+ href: z.ZodString;
155
+ name: z.ZodString;
156
+ }, "strip", z.ZodTypeAny, {
157
+ type: "Mention";
158
+ name: string;
159
+ href: string;
160
+ }, {
161
+ type: "Mention";
162
+ name: string;
163
+ href: string;
164
+ }>, z.ZodObject<{
165
+ type: z.ZodLiteral<"Emoji">;
166
+ name: z.ZodString;
167
+ updated: z.ZodString;
168
+ icon: z.ZodObject<{
169
+ type: z.ZodLiteral<"Image">;
170
+ mediaType: z.ZodString;
171
+ url: z.ZodString;
172
+ }, "strip", z.ZodTypeAny, {
173
+ type: "Image";
174
+ mediaType: string;
175
+ url: string;
176
+ }, {
177
+ type: "Image";
178
+ mediaType: string;
179
+ url: string;
180
+ }>;
181
+ }, "strip", z.ZodTypeAny, {
182
+ type: "Emoji";
183
+ name: string;
184
+ updated: string;
185
+ icon: {
186
+ type: "Image";
187
+ mediaType: string;
188
+ url: string;
189
+ };
190
+ }, {
191
+ type: "Emoji";
192
+ name: string;
193
+ updated: string;
194
+ icon: {
195
+ type: "Image";
196
+ mediaType: string;
197
+ url: string;
198
+ };
199
+ }>, z.ZodObject<{
200
+ type: z.ZodLiteral<"Hashtag">;
201
+ href: z.ZodString;
202
+ name: z.ZodString;
203
+ }, "strip", z.ZodTypeAny, {
204
+ type: "Hashtag";
205
+ name: string;
206
+ href: string;
207
+ }, {
208
+ type: "Hashtag";
209
+ name: string;
210
+ href: string;
211
+ }>]>, "many">]>;
212
+ published: z.ZodString;
213
+ updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
+ }, {
215
+ type: z.ZodLiteral<"Question">;
216
+ endTime: z.ZodString;
217
+ oneOf: z.ZodArray<z.ZodObject<{
218
+ type: z.ZodLiteral<"Note">;
219
+ name: z.ZodString;
220
+ replies: z.ZodObject<{
221
+ type: z.ZodLiteral<"Collection">;
222
+ totalItems: z.ZodNumber;
223
+ }, "strip", z.ZodTypeAny, {
224
+ type: "Collection";
225
+ totalItems: number;
226
+ }, {
227
+ type: "Collection";
228
+ totalItems: number;
229
+ }>;
230
+ }, "strip", z.ZodTypeAny, {
231
+ type: "Note";
232
+ name: string;
233
+ replies: {
234
+ type: "Collection";
235
+ totalItems: number;
236
+ };
237
+ }, {
238
+ type: "Note";
239
+ name: string;
240
+ replies: {
241
+ type: "Collection";
242
+ totalItems: number;
243
+ };
244
+ }>, "many">;
245
+ }>, "strip", z.ZodTypeAny, {
246
+ id: string;
247
+ type: "Question";
248
+ published: string;
249
+ to: string | string[];
250
+ cc: string | string[];
251
+ attributedTo: string;
252
+ tag: {
253
+ type: "Emoji";
254
+ name: string;
255
+ updated: string;
256
+ icon: {
257
+ type: "Image";
258
+ mediaType: string;
259
+ url: string;
260
+ };
261
+ } | {
262
+ type: "Mention";
263
+ name: string;
264
+ href: string;
265
+ } | {
266
+ type: "Hashtag";
267
+ name: string;
268
+ href: string;
269
+ } | ({
270
+ type: "Emoji";
271
+ name: string;
272
+ updated: string;
273
+ icon: {
274
+ type: "Image";
275
+ mediaType: string;
276
+ url: string;
277
+ };
278
+ } | {
279
+ type: "Mention";
280
+ name: string;
281
+ href: string;
282
+ } | {
283
+ type: "Hashtag";
284
+ name: string;
285
+ href: string;
286
+ })[];
287
+ endTime: string;
288
+ oneOf: {
289
+ type: "Note";
290
+ name: string;
291
+ replies: {
292
+ type: "Collection";
293
+ totalItems: number;
294
+ };
295
+ }[];
296
+ url?: string | null | undefined;
297
+ updated?: string | null | undefined;
298
+ inReplyTo?: string | null | undefined;
299
+ summary?: string | null | undefined;
300
+ summaryMap?: Record<string, string> | null | undefined;
301
+ content?: string | string[] | null | undefined;
302
+ contentMap?: string[] | Record<string, string> | null | undefined;
303
+ attachment?: {
304
+ type: "Document";
305
+ mediaType: string;
306
+ url: string;
307
+ blurhash?: string | undefined;
308
+ width?: number | undefined;
309
+ height?: number | undefined;
310
+ name?: string | null | undefined;
311
+ focalPoint?: [number, number] | undefined;
312
+ } | {
313
+ type: "PropertyValue";
314
+ value: string;
315
+ name: string;
316
+ } | ({
317
+ type: "Document";
318
+ mediaType: string;
319
+ url: string;
320
+ blurhash?: string | undefined;
321
+ width?: number | undefined;
322
+ height?: number | undefined;
323
+ name?: string | null | undefined;
324
+ focalPoint?: [number, number] | undefined;
325
+ } | {
326
+ type: "PropertyValue";
327
+ value: string;
328
+ name: string;
329
+ })[] | null | undefined;
330
+ }, {
331
+ id: string;
332
+ type: "Question";
333
+ published: string;
334
+ to: string | string[];
335
+ cc: string | string[];
336
+ attributedTo: string;
337
+ tag: {
338
+ type: "Emoji";
339
+ name: string;
340
+ updated: string;
341
+ icon: {
342
+ type: "Image";
343
+ mediaType: string;
344
+ url: string;
345
+ };
346
+ } | {
347
+ type: "Mention";
348
+ name: string;
349
+ href: string;
350
+ } | {
351
+ type: "Hashtag";
352
+ name: string;
353
+ href: string;
354
+ } | ({
355
+ type: "Emoji";
356
+ name: string;
357
+ updated: string;
358
+ icon: {
359
+ type: "Image";
360
+ mediaType: string;
361
+ url: string;
362
+ };
363
+ } | {
364
+ type: "Mention";
365
+ name: string;
366
+ href: string;
367
+ } | {
368
+ type: "Hashtag";
369
+ name: string;
370
+ href: string;
371
+ })[];
372
+ endTime: string;
373
+ oneOf: {
374
+ type: "Note";
375
+ name: string;
376
+ replies: {
377
+ type: "Collection";
378
+ totalItems: number;
379
+ };
380
+ }[];
381
+ url?: string | null | undefined;
382
+ updated?: string | null | undefined;
383
+ inReplyTo?: string | null | undefined;
384
+ summary?: string | null | undefined;
385
+ summaryMap?: Record<string, string> | null | undefined;
386
+ content?: string | string[] | null | undefined;
387
+ contentMap?: string[] | Record<string, string> | null | undefined;
388
+ attachment?: {
389
+ type: "Document";
390
+ mediaType: string;
391
+ url: string;
392
+ blurhash?: string | undefined;
393
+ width?: number | undefined;
394
+ height?: number | undefined;
395
+ name?: string | null | undefined;
396
+ focalPoint?: [number, number] | undefined;
397
+ } | {
398
+ type: "PropertyValue";
399
+ value: string;
400
+ name: string;
401
+ } | ({
402
+ type: "Document";
403
+ mediaType: string;
404
+ url: string;
405
+ blurhash?: string | undefined;
406
+ width?: number | undefined;
407
+ height?: number | undefined;
408
+ name?: string | null | undefined;
409
+ focalPoint?: [number, number] | undefined;
410
+ } | {
411
+ type: "PropertyValue";
412
+ value: string;
413
+ name: string;
414
+ })[] | null | undefined;
415
+ }>;
416
+ export type Question = z.infer<typeof Question>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llun/activities.schema",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Validate ActivityPub and Mastodon with Zod",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/follow.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { z } from "zod";
2
2
 
3
+ export const ENTITY_TYPE_FOLLOW = "Follow";
3
4
  export const Follow = z.object({
4
5
  id: z.string(),
5
- type: z.literal("Follow"),
6
+ type: z.literal(ENTITY_TYPE_FOLLOW),
6
7
  actor: z.string(),
7
8
  object: z.string(),
8
9
  });
package/src/index.ts CHANGED
@@ -2,8 +2,13 @@ export * from "./accept.js";
2
2
  export * from "./follow.js";
3
3
  export * from "./like.js";
4
4
  export * from "./note.js";
5
+ export * from "./question.js";
5
6
  export * from "./reject.js";
6
7
  export * from "./undo.js";
7
8
  export * from "./announce.js";
8
9
 
10
+ export * from "./note/emoji.js";
11
+ export * from "./note/mention.js";
12
+ export * from "./note/hashtag.js";
13
+
9
14
  export * as Mastodon from "./mastodon/index.js";
package/src/like.ts CHANGED
@@ -2,8 +2,9 @@ import { z } from "zod";
2
2
 
3
3
  import { Note } from "./note.js";
4
4
 
5
+ export const ENTITY_TYPE_LIKE = "Like";
5
6
  export const Like = z.object({
6
- type: z.literal("Like"),
7
+ type: z.literal(ENTITY_TYPE_LIKE),
7
8
  id: z.string(),
8
9
  actor: z.string(),
9
10
  object: z.union([z.string(), Note]),
package/src/note.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { BaseContent } from "./note/baseContent.js";
3
3
 
4
+ export const ENTITY_TYPE_NOTE = "Note";
4
5
  export const Note = BaseContent.extend({
5
- type: z.literal("Note"),
6
+ type: z.literal(ENTITY_TYPE_NOTE),
6
7
  });
7
8
  export type Note = z.infer<typeof Note>;
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+
3
+ export const Note = z.object({
4
+ type: z.literal("Note"),
5
+ name: z.string(),
6
+ replies: z.object({
7
+ type: z.literal("Collection"),
8
+ totalItems: z.number(),
9
+ }),
10
+ });
11
+
12
+ export type Note = z.infer<typeof Note>;
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ import { BaseContent } from "./note/baseContent.js";
3
+ import { Note } from "./question/note.js";
4
+
5
+ export const ENTITY_TYPE_QUESTION = "Question";
6
+ export const Question = BaseContent.extend({
7
+ type: z.literal(ENTITY_TYPE_QUESTION),
8
+
9
+ endTime: z.string({ description: "Question end time" }),
10
+ oneOf: Note.array(),
11
+ });
12
+ export type Question = z.infer<typeof Question>;