@llun/activities.schema 0.2.9 → 0.2.11

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,6 +19,7 @@ __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);
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]),
@@ -6,7 +6,9 @@ const attachment_js_1 = require("./attachment.js");
6
6
  const tag_js_1 = require("./tag.js");
7
7
  exports.BaseContent = zod_1.z.object({
8
8
  id: zod_1.z.string(),
9
- url: zod_1.z.string({ description: "Note URL" }),
9
+ url: zod_1.z
10
+ .string({ description: "Note URL. This is optional for Pleloma" })
11
+ .nullish(),
10
12
  attributedTo: zod_1.z.string({ description: "Note publisher" }),
11
13
  to: zod_1.z.union([zod_1.z.string(), zod_1.z.string().array()]),
12
14
  cc: zod_1.z.union([zod_1.z.string(), zod_1.z.string().array()]),
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,6 +2,7 @@ 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";
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]),
@@ -3,7 +3,9 @@ import { Attachment } from "./attachment.js";
3
3
  import { Tag } from "./tag.js";
4
4
  export const BaseContent = z.object({
5
5
  id: z.string(),
6
- url: z.string({ description: "Note URL" }),
6
+ url: z
7
+ .string({ description: "Note URL. This is optional for Pleloma" })
8
+ .nullish(),
7
9
  attributedTo: z.string({ description: "Note publisher" }),
8
10
  to: z.union([z.string(), z.string().array()]),
9
11
  cc: z.union([z.string(), z.string().array()]),
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,6 +2,7 @@ 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";
@@ -1,11 +1,12 @@
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;
5
6
  actor: z.ZodString;
6
7
  object: z.ZodUnion<[z.ZodString, z.ZodObject<z.objectUtil.extendShape<{
7
8
  id: z.ZodString;
8
- url: z.ZodString;
9
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
10
  attributedTo: z.ZodString;
10
11
  to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
11
12
  cc: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
@@ -222,7 +223,6 @@ export declare const Like: z.ZodObject<{
222
223
  published: string;
223
224
  to: string | string[];
224
225
  cc: string | string[];
225
- url: string;
226
226
  attributedTo: string;
227
227
  tag: {
228
228
  type: "Emoji";
@@ -259,6 +259,7 @@ export declare const Like: z.ZodObject<{
259
259
  name: string;
260
260
  href: string;
261
261
  })[];
262
+ url?: string | null | undefined;
262
263
  updated?: string | null | undefined;
263
264
  inReplyTo?: string | null | undefined;
264
265
  summary?: string | null | undefined;
@@ -298,7 +299,6 @@ export declare const Like: z.ZodObject<{
298
299
  published: string;
299
300
  to: string | string[];
300
301
  cc: string | string[];
301
- url: string;
302
302
  attributedTo: string;
303
303
  tag: {
304
304
  type: "Emoji";
@@ -335,6 +335,7 @@ export declare const Like: z.ZodObject<{
335
335
  name: string;
336
336
  href: string;
337
337
  })[];
338
+ url?: string | null | undefined;
338
339
  updated?: string | null | undefined;
339
340
  inReplyTo?: string | null | undefined;
340
341
  summary?: string | null | undefined;
@@ -376,7 +377,6 @@ export declare const Like: z.ZodObject<{
376
377
  published: string;
377
378
  to: string | string[];
378
379
  cc: string | string[];
379
- url: string;
380
380
  attributedTo: string;
381
381
  tag: {
382
382
  type: "Emoji";
@@ -413,6 +413,7 @@ export declare const Like: z.ZodObject<{
413
413
  name: string;
414
414
  href: string;
415
415
  })[];
416
+ url?: string | null | undefined;
416
417
  updated?: string | null | undefined;
417
418
  inReplyTo?: string | null | undefined;
418
419
  summary?: string | null | undefined;
@@ -457,7 +458,6 @@ export declare const Like: z.ZodObject<{
457
458
  published: string;
458
459
  to: string | string[];
459
460
  cc: string | string[];
460
- url: string;
461
461
  attributedTo: string;
462
462
  tag: {
463
463
  type: "Emoji";
@@ -494,6 +494,7 @@ export declare const Like: z.ZodObject<{
494
494
  name: string;
495
495
  href: string;
496
496
  })[];
497
+ url?: string | null | undefined;
497
498
  updated?: string | null | undefined;
498
499
  inReplyTo?: string | null | undefined;
499
500
  summary?: string | null | undefined;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  export declare const BaseContent: z.ZodObject<{
3
3
  id: z.ZodString;
4
- url: z.ZodString;
4
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
5
  attributedTo: z.ZodString;
6
6
  to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
7
7
  cc: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
@@ -215,7 +215,6 @@ export declare const BaseContent: z.ZodObject<{
215
215
  published: string;
216
216
  to: string | string[];
217
217
  cc: string | string[];
218
- url: string;
219
218
  attributedTo: string;
220
219
  tag: {
221
220
  type: "Emoji";
@@ -252,6 +251,7 @@ export declare const BaseContent: z.ZodObject<{
252
251
  name: string;
253
252
  href: string;
254
253
  })[];
254
+ url?: string | null | undefined;
255
255
  updated?: string | null | undefined;
256
256
  inReplyTo?: string | null | undefined;
257
257
  summary?: string | null | undefined;
@@ -290,7 +290,6 @@ export declare const BaseContent: z.ZodObject<{
290
290
  published: string;
291
291
  to: string | string[];
292
292
  cc: string | string[];
293
- url: string;
294
293
  attributedTo: string;
295
294
  tag: {
296
295
  type: "Emoji";
@@ -327,6 +326,7 @@ export declare const BaseContent: z.ZodObject<{
327
326
  name: string;
328
327
  href: string;
329
328
  })[];
329
+ url?: string | null | undefined;
330
330
  updated?: string | null | undefined;
331
331
  inReplyTo?: string | null | undefined;
332
332
  summary?: string | null | undefined;
@@ -1,7 +1,8 @@
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
- url: z.ZodString;
5
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
6
  attributedTo: z.ZodString;
6
7
  to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
7
8
  cc: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
@@ -218,7 +219,6 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
218
219
  published: string;
219
220
  to: string | string[];
220
221
  cc: string | string[];
221
- url: string;
222
222
  attributedTo: string;
223
223
  tag: {
224
224
  type: "Emoji";
@@ -255,6 +255,7 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
255
255
  name: string;
256
256
  href: string;
257
257
  })[];
258
+ url?: string | null | undefined;
258
259
  updated?: string | null | undefined;
259
260
  inReplyTo?: string | null | undefined;
260
261
  summary?: string | null | undefined;
@@ -294,7 +295,6 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
294
295
  published: string;
295
296
  to: string | string[];
296
297
  cc: string | string[];
297
- url: string;
298
298
  attributedTo: string;
299
299
  tag: {
300
300
  type: "Emoji";
@@ -331,6 +331,7 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
331
331
  name: string;
332
332
  href: string;
333
333
  })[];
334
+ url?: string | null | undefined;
334
335
  updated?: string | null | undefined;
335
336
  inReplyTo?: string | null | undefined;
336
337
  summary?: string | null | undefined;
@@ -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>;
@@ -9,7 +9,7 @@ export declare const Undo: z.ZodObject<{
9
9
  actor: z.ZodString;
10
10
  object: z.ZodUnion<[z.ZodString, z.ZodObject<z.objectUtil.extendShape<{
11
11
  id: z.ZodString;
12
- url: z.ZodString;
12
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
13
  attributedTo: z.ZodString;
14
14
  to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
15
15
  cc: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
@@ -226,7 +226,6 @@ export declare const Undo: z.ZodObject<{
226
226
  published: string;
227
227
  to: string | string[];
228
228
  cc: string | string[];
229
- url: string;
230
229
  attributedTo: string;
231
230
  tag: {
232
231
  type: "Emoji";
@@ -263,6 +262,7 @@ export declare const Undo: z.ZodObject<{
263
262
  name: string;
264
263
  href: string;
265
264
  })[];
265
+ url?: string | null | undefined;
266
266
  updated?: string | null | undefined;
267
267
  inReplyTo?: string | null | undefined;
268
268
  summary?: string | null | undefined;
@@ -302,7 +302,6 @@ export declare const Undo: z.ZodObject<{
302
302
  published: string;
303
303
  to: string | string[];
304
304
  cc: string | string[];
305
- url: string;
306
305
  attributedTo: string;
307
306
  tag: {
308
307
  type: "Emoji";
@@ -339,6 +338,7 @@ export declare const Undo: z.ZodObject<{
339
338
  name: string;
340
339
  href: string;
341
340
  })[];
341
+ url?: string | null | undefined;
342
342
  updated?: string | null | undefined;
343
343
  inReplyTo?: string | null | undefined;
344
344
  summary?: string | null | undefined;
@@ -380,7 +380,6 @@ export declare const Undo: z.ZodObject<{
380
380
  published: string;
381
381
  to: string | string[];
382
382
  cc: string | string[];
383
- url: string;
384
383
  attributedTo: string;
385
384
  tag: {
386
385
  type: "Emoji";
@@ -417,6 +416,7 @@ export declare const Undo: z.ZodObject<{
417
416
  name: string;
418
417
  href: string;
419
418
  })[];
419
+ url?: string | null | undefined;
420
420
  updated?: string | null | undefined;
421
421
  inReplyTo?: string | null | undefined;
422
422
  summary?: string | null | undefined;
@@ -461,7 +461,6 @@ export declare const Undo: z.ZodObject<{
461
461
  published: string;
462
462
  to: string | string[];
463
463
  cc: string | string[];
464
- url: string;
465
464
  attributedTo: string;
466
465
  tag: {
467
466
  type: "Emoji";
@@ -498,6 +497,7 @@ export declare const Undo: z.ZodObject<{
498
497
  name: string;
499
498
  href: string;
500
499
  })[];
500
+ url?: string | null | undefined;
501
501
  updated?: string | null | undefined;
502
502
  inReplyTo?: string | null | undefined;
503
503
  summary?: string | null | undefined;
@@ -564,7 +564,6 @@ export declare const Undo: z.ZodObject<{
564
564
  published: string;
565
565
  to: string | string[];
566
566
  cc: string | string[];
567
- url: string;
568
567
  attributedTo: string;
569
568
  tag: {
570
569
  type: "Emoji";
@@ -601,6 +600,7 @@ export declare const Undo: z.ZodObject<{
601
600
  name: string;
602
601
  href: string;
603
602
  })[];
603
+ url?: string | null | undefined;
604
604
  updated?: string | null | undefined;
605
605
  inReplyTo?: string | null | undefined;
606
606
  summary?: string | null | undefined;
@@ -655,7 +655,6 @@ export declare const Undo: z.ZodObject<{
655
655
  published: string;
656
656
  to: string | string[];
657
657
  cc: string | string[];
658
- url: string;
659
658
  attributedTo: string;
660
659
  tag: {
661
660
  type: "Emoji";
@@ -692,6 +691,7 @@ export declare const Undo: z.ZodObject<{
692
691
  name: string;
693
692
  href: string;
694
693
  })[];
694
+ url?: string | null | undefined;
695
695
  updated?: string | null | undefined;
696
696
  inReplyTo?: string | null | undefined;
697
697
  summary?: string | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llun/activities.schema",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
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,6 +2,7 @@ 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";
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]),
@@ -4,7 +4,9 @@ import { Tag } from "./tag.js";
4
4
 
5
5
  export const BaseContent = z.object({
6
6
  id: z.string(),
7
- url: z.string({ description: "Note URL" }),
7
+ url: z
8
+ .string({ description: "Note URL. This is optional for Pleloma" })
9
+ .nullish(),
8
10
  attributedTo: z.string({ description: "Note publisher" }),
9
11
 
10
12
  to: z.union([z.string(), z.string().array()]),
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>;