@llun/activities.schema 0.2.7 → 0.2.8

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.
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseContent = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const attachment_js_1 = require("./attachment.js");
6
- const emoji_js_1 = require("./emoji.js");
7
- const mention_js_1 = require("./mention.js");
6
+ const tag_js_1 = require("./tag.js");
8
7
  exports.BaseContent = zod_1.z.object({
9
8
  id: zod_1.z.string(),
10
9
  url: zod_1.z.string({ description: "Note URL" }),
@@ -33,7 +32,7 @@ exports.BaseContent = zod_1.z.object({
33
32
  ])
34
33
  .nullish(),
35
34
  attachment: zod_1.z.union([attachment_js_1.Attachment, attachment_js_1.Attachment.array()]).nullish(),
36
- tag: zod_1.z.union([mention_js_1.Mention, emoji_js_1.Emoji]).array(),
35
+ tag: zod_1.z.union([tag_js_1.Tag, tag_js_1.Tag.array()]),
37
36
  published: zod_1.z.string({ description: "Object published datetime" }),
38
37
  updated: zod_1.z.string({ description: "Object updated datetime" }).nullish(),
39
38
  });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tag = void 0;
4
+ const zod_1 = require("zod");
5
+ const emoji_js_1 = require("./emoji.js");
6
+ const mention_js_1 = require("./mention.js");
7
+ exports.Tag = zod_1.z.union([mention_js_1.Mention, emoji_js_1.Emoji]);
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { Attachment } from "./attachment.js";
3
- import { Emoji } from "./emoji.js";
4
- import { Mention } from "./mention.js";
3
+ import { Tag } from "./tag.js";
5
4
  export const BaseContent = z.object({
6
5
  id: z.string(),
7
6
  url: z.string({ description: "Note URL" }),
@@ -30,7 +29,7 @@ export const BaseContent = z.object({
30
29
  ])
31
30
  .nullish(),
32
31
  attachment: z.union([Attachment, Attachment.array()]).nullish(),
33
- tag: z.union([Mention, Emoji]).array(),
32
+ tag: z.union([Tag, Tag.array()]),
34
33
  published: z.string({ description: "Object published datetime" }),
35
34
  updated: z.string({ description: "Object updated datetime" }).nullish(),
36
35
  });
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ import { Emoji } from "./emoji.js";
3
+ import { Mention } from "./mention.js";
4
+ export const Tag = z.union([Mention, Emoji]);
@@ -93,7 +93,7 @@ export declare const Like: z.ZodObject<{
93
93
  name?: string | null | undefined;
94
94
  focalPoint?: [number, number] | undefined;
95
95
  }>]>, "many">]>>>;
96
- tag: z.ZodArray<z.ZodUnion<[z.ZodObject<{
96
+ tag: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
97
97
  type: z.ZodLiteral<"Mention">;
98
98
  href: z.ZodString;
99
99
  name: z.ZodString;
@@ -140,7 +140,54 @@ export declare const Like: z.ZodObject<{
140
140
  mediaType: string;
141
141
  url: string;
142
142
  };
143
- }>]>, "many">;
143
+ }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
144
+ type: z.ZodLiteral<"Mention">;
145
+ href: z.ZodString;
146
+ name: z.ZodString;
147
+ }, "strip", z.ZodTypeAny, {
148
+ type: "Mention";
149
+ name: string;
150
+ href: string;
151
+ }, {
152
+ type: "Mention";
153
+ name: string;
154
+ href: string;
155
+ }>, z.ZodObject<{
156
+ type: z.ZodLiteral<"Emoji">;
157
+ name: z.ZodString;
158
+ updated: z.ZodString;
159
+ icon: z.ZodObject<{
160
+ type: z.ZodLiteral<"Image">;
161
+ mediaType: z.ZodString;
162
+ url: z.ZodString;
163
+ }, "strip", z.ZodTypeAny, {
164
+ type: "Image";
165
+ mediaType: string;
166
+ url: string;
167
+ }, {
168
+ type: "Image";
169
+ mediaType: string;
170
+ url: string;
171
+ }>;
172
+ }, "strip", z.ZodTypeAny, {
173
+ type: "Emoji";
174
+ name: string;
175
+ updated: string;
176
+ icon: {
177
+ type: "Image";
178
+ mediaType: string;
179
+ url: string;
180
+ };
181
+ }, {
182
+ type: "Emoji";
183
+ name: string;
184
+ updated: string;
185
+ icon: {
186
+ type: "Image";
187
+ mediaType: string;
188
+ url: string;
189
+ };
190
+ }>]>, "many">]>;
144
191
  published: z.ZodString;
145
192
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
146
193
  }, {
@@ -153,7 +200,20 @@ export declare const Like: z.ZodObject<{
153
200
  cc: string | string[];
154
201
  url: string;
155
202
  attributedTo: string;
156
- tag: ({
203
+ tag: {
204
+ type: "Emoji";
205
+ name: string;
206
+ updated: string;
207
+ icon: {
208
+ type: "Image";
209
+ mediaType: string;
210
+ url: string;
211
+ };
212
+ } | {
213
+ type: "Mention";
214
+ name: string;
215
+ href: string;
216
+ } | ({
157
217
  type: "Emoji";
158
218
  name: string;
159
219
  updated: string;
@@ -208,7 +268,20 @@ export declare const Like: z.ZodObject<{
208
268
  cc: string | string[];
209
269
  url: string;
210
270
  attributedTo: string;
211
- tag: ({
271
+ tag: {
272
+ type: "Emoji";
273
+ name: string;
274
+ updated: string;
275
+ icon: {
276
+ type: "Image";
277
+ mediaType: string;
278
+ url: string;
279
+ };
280
+ } | {
281
+ type: "Mention";
282
+ name: string;
283
+ href: string;
284
+ } | ({
212
285
  type: "Emoji";
213
286
  name: string;
214
287
  updated: string;
@@ -265,7 +338,20 @@ export declare const Like: z.ZodObject<{
265
338
  cc: string | string[];
266
339
  url: string;
267
340
  attributedTo: string;
268
- tag: ({
341
+ tag: {
342
+ type: "Emoji";
343
+ name: string;
344
+ updated: string;
345
+ icon: {
346
+ type: "Image";
347
+ mediaType: string;
348
+ url: string;
349
+ };
350
+ } | {
351
+ type: "Mention";
352
+ name: string;
353
+ href: string;
354
+ } | ({
269
355
  type: "Emoji";
270
356
  name: string;
271
357
  updated: string;
@@ -325,7 +411,20 @@ export declare const Like: z.ZodObject<{
325
411
  cc: string | string[];
326
412
  url: string;
327
413
  attributedTo: string;
328
- tag: ({
414
+ tag: {
415
+ type: "Emoji";
416
+ name: string;
417
+ updated: string;
418
+ icon: {
419
+ type: "Image";
420
+ mediaType: string;
421
+ url: string;
422
+ };
423
+ } | {
424
+ type: "Mention";
425
+ name: string;
426
+ href: string;
427
+ } | ({
329
428
  type: "Emoji";
330
429
  name: string;
331
430
  updated: string;
@@ -89,7 +89,7 @@ export declare const BaseContent: z.ZodObject<{
89
89
  name?: string | null | undefined;
90
90
  focalPoint?: [number, number] | undefined;
91
91
  }>]>, "many">]>>>;
92
- tag: z.ZodArray<z.ZodUnion<[z.ZodObject<{
92
+ tag: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
93
93
  type: z.ZodLiteral<"Mention">;
94
94
  href: z.ZodString;
95
95
  name: z.ZodString;
@@ -136,7 +136,54 @@ export declare const BaseContent: z.ZodObject<{
136
136
  mediaType: string;
137
137
  url: string;
138
138
  };
139
- }>]>, "many">;
139
+ }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
140
+ type: z.ZodLiteral<"Mention">;
141
+ href: z.ZodString;
142
+ name: z.ZodString;
143
+ }, "strip", z.ZodTypeAny, {
144
+ type: "Mention";
145
+ name: string;
146
+ href: string;
147
+ }, {
148
+ type: "Mention";
149
+ name: string;
150
+ href: string;
151
+ }>, z.ZodObject<{
152
+ type: z.ZodLiteral<"Emoji">;
153
+ name: z.ZodString;
154
+ updated: z.ZodString;
155
+ icon: z.ZodObject<{
156
+ type: z.ZodLiteral<"Image">;
157
+ mediaType: z.ZodString;
158
+ url: z.ZodString;
159
+ }, "strip", z.ZodTypeAny, {
160
+ type: "Image";
161
+ mediaType: string;
162
+ url: string;
163
+ }, {
164
+ type: "Image";
165
+ mediaType: string;
166
+ url: string;
167
+ }>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ type: "Emoji";
170
+ name: string;
171
+ updated: string;
172
+ icon: {
173
+ type: "Image";
174
+ mediaType: string;
175
+ url: string;
176
+ };
177
+ }, {
178
+ type: "Emoji";
179
+ name: string;
180
+ updated: string;
181
+ icon: {
182
+ type: "Image";
183
+ mediaType: string;
184
+ url: string;
185
+ };
186
+ }>]>, "many">]>;
140
187
  published: z.ZodString;
141
188
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
189
  }, "strip", z.ZodTypeAny, {
@@ -146,7 +193,20 @@ export declare const BaseContent: z.ZodObject<{
146
193
  cc: string | string[];
147
194
  url: string;
148
195
  attributedTo: string;
149
- tag: ({
196
+ tag: {
197
+ type: "Emoji";
198
+ name: string;
199
+ updated: string;
200
+ icon: {
201
+ type: "Image";
202
+ mediaType: string;
203
+ url: string;
204
+ };
205
+ } | {
206
+ type: "Mention";
207
+ name: string;
208
+ href: string;
209
+ } | ({
150
210
  type: "Emoji";
151
211
  name: string;
152
212
  updated: string;
@@ -200,7 +260,20 @@ export declare const BaseContent: z.ZodObject<{
200
260
  cc: string | string[];
201
261
  url: string;
202
262
  attributedTo: string;
203
- tag: ({
263
+ tag: {
264
+ type: "Emoji";
265
+ name: string;
266
+ updated: string;
267
+ icon: {
268
+ type: "Image";
269
+ mediaType: string;
270
+ url: string;
271
+ };
272
+ } | {
273
+ type: "Mention";
274
+ name: string;
275
+ href: string;
276
+ } | ({
204
277
  type: "Emoji";
205
278
  name: string;
206
279
  updated: string;
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ export declare const Tag: z.ZodUnion<[z.ZodObject<{
3
+ type: z.ZodLiteral<"Mention">;
4
+ href: z.ZodString;
5
+ name: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ type: "Mention";
8
+ name: string;
9
+ href: string;
10
+ }, {
11
+ type: "Mention";
12
+ name: string;
13
+ href: string;
14
+ }>, z.ZodObject<{
15
+ type: z.ZodLiteral<"Emoji">;
16
+ name: z.ZodString;
17
+ updated: z.ZodString;
18
+ icon: z.ZodObject<{
19
+ type: z.ZodLiteral<"Image">;
20
+ mediaType: z.ZodString;
21
+ url: z.ZodString;
22
+ }, "strip", z.ZodTypeAny, {
23
+ type: "Image";
24
+ mediaType: string;
25
+ url: string;
26
+ }, {
27
+ type: "Image";
28
+ mediaType: string;
29
+ url: string;
30
+ }>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ type: "Emoji";
33
+ name: string;
34
+ updated: string;
35
+ icon: {
36
+ type: "Image";
37
+ mediaType: string;
38
+ url: string;
39
+ };
40
+ }, {
41
+ type: "Emoji";
42
+ name: string;
43
+ updated: string;
44
+ icon: {
45
+ type: "Image";
46
+ mediaType: string;
47
+ url: string;
48
+ };
49
+ }>]>;
50
+ export type Tag = z.infer<typeof Tag>;
@@ -89,7 +89,7 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
89
89
  name?: string | null | undefined;
90
90
  focalPoint?: [number, number] | undefined;
91
91
  }>]>, "many">]>>>;
92
- tag: z.ZodArray<z.ZodUnion<[z.ZodObject<{
92
+ tag: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
93
93
  type: z.ZodLiteral<"Mention">;
94
94
  href: z.ZodString;
95
95
  name: z.ZodString;
@@ -136,7 +136,54 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
136
136
  mediaType: string;
137
137
  url: string;
138
138
  };
139
- }>]>, "many">;
139
+ }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
140
+ type: z.ZodLiteral<"Mention">;
141
+ href: z.ZodString;
142
+ name: z.ZodString;
143
+ }, "strip", z.ZodTypeAny, {
144
+ type: "Mention";
145
+ name: string;
146
+ href: string;
147
+ }, {
148
+ type: "Mention";
149
+ name: string;
150
+ href: string;
151
+ }>, z.ZodObject<{
152
+ type: z.ZodLiteral<"Emoji">;
153
+ name: z.ZodString;
154
+ updated: z.ZodString;
155
+ icon: z.ZodObject<{
156
+ type: z.ZodLiteral<"Image">;
157
+ mediaType: z.ZodString;
158
+ url: z.ZodString;
159
+ }, "strip", z.ZodTypeAny, {
160
+ type: "Image";
161
+ mediaType: string;
162
+ url: string;
163
+ }, {
164
+ type: "Image";
165
+ mediaType: string;
166
+ url: string;
167
+ }>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ type: "Emoji";
170
+ name: string;
171
+ updated: string;
172
+ icon: {
173
+ type: "Image";
174
+ mediaType: string;
175
+ url: string;
176
+ };
177
+ }, {
178
+ type: "Emoji";
179
+ name: string;
180
+ updated: string;
181
+ icon: {
182
+ type: "Image";
183
+ mediaType: string;
184
+ url: string;
185
+ };
186
+ }>]>, "many">]>;
140
187
  published: z.ZodString;
141
188
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
189
  }, {
@@ -149,7 +196,20 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
149
196
  cc: string | string[];
150
197
  url: string;
151
198
  attributedTo: string;
152
- tag: ({
199
+ tag: {
200
+ type: "Emoji";
201
+ name: string;
202
+ updated: string;
203
+ icon: {
204
+ type: "Image";
205
+ mediaType: string;
206
+ url: string;
207
+ };
208
+ } | {
209
+ type: "Mention";
210
+ name: string;
211
+ href: string;
212
+ } | ({
153
213
  type: "Emoji";
154
214
  name: string;
155
215
  updated: string;
@@ -204,7 +264,20 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
204
264
  cc: string | string[];
205
265
  url: string;
206
266
  attributedTo: string;
207
- tag: ({
267
+ tag: {
268
+ type: "Emoji";
269
+ name: string;
270
+ updated: string;
271
+ icon: {
272
+ type: "Image";
273
+ mediaType: string;
274
+ url: string;
275
+ };
276
+ } | {
277
+ type: "Mention";
278
+ name: string;
279
+ href: string;
280
+ } | ({
208
281
  type: "Emoji";
209
282
  name: string;
210
283
  updated: string;
@@ -97,7 +97,7 @@ export declare const Undo: z.ZodObject<{
97
97
  name?: string | null | undefined;
98
98
  focalPoint?: [number, number] | undefined;
99
99
  }>]>, "many">]>>>;
100
- tag: z.ZodArray<z.ZodUnion<[z.ZodObject<{
100
+ tag: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
101
101
  type: z.ZodLiteral<"Mention">;
102
102
  href: z.ZodString;
103
103
  name: z.ZodString;
@@ -144,7 +144,54 @@ export declare const Undo: z.ZodObject<{
144
144
  mediaType: string;
145
145
  url: string;
146
146
  };
147
- }>]>, "many">;
147
+ }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
148
+ type: z.ZodLiteral<"Mention">;
149
+ href: z.ZodString;
150
+ name: z.ZodString;
151
+ }, "strip", z.ZodTypeAny, {
152
+ type: "Mention";
153
+ name: string;
154
+ href: string;
155
+ }, {
156
+ type: "Mention";
157
+ name: string;
158
+ href: string;
159
+ }>, z.ZodObject<{
160
+ type: z.ZodLiteral<"Emoji">;
161
+ name: z.ZodString;
162
+ updated: z.ZodString;
163
+ icon: z.ZodObject<{
164
+ type: z.ZodLiteral<"Image">;
165
+ mediaType: z.ZodString;
166
+ url: z.ZodString;
167
+ }, "strip", z.ZodTypeAny, {
168
+ type: "Image";
169
+ mediaType: string;
170
+ url: string;
171
+ }, {
172
+ type: "Image";
173
+ mediaType: string;
174
+ url: string;
175
+ }>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ type: "Emoji";
178
+ name: string;
179
+ updated: string;
180
+ icon: {
181
+ type: "Image";
182
+ mediaType: string;
183
+ url: string;
184
+ };
185
+ }, {
186
+ type: "Emoji";
187
+ name: string;
188
+ updated: string;
189
+ icon: {
190
+ type: "Image";
191
+ mediaType: string;
192
+ url: string;
193
+ };
194
+ }>]>, "many">]>;
148
195
  published: z.ZodString;
149
196
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
150
197
  }, {
@@ -157,7 +204,20 @@ export declare const Undo: z.ZodObject<{
157
204
  cc: string | string[];
158
205
  url: string;
159
206
  attributedTo: string;
160
- tag: ({
207
+ tag: {
208
+ type: "Emoji";
209
+ name: string;
210
+ updated: string;
211
+ icon: {
212
+ type: "Image";
213
+ mediaType: string;
214
+ url: string;
215
+ };
216
+ } | {
217
+ type: "Mention";
218
+ name: string;
219
+ href: string;
220
+ } | ({
161
221
  type: "Emoji";
162
222
  name: string;
163
223
  updated: string;
@@ -212,7 +272,20 @@ export declare const Undo: z.ZodObject<{
212
272
  cc: string | string[];
213
273
  url: string;
214
274
  attributedTo: string;
215
- tag: ({
275
+ tag: {
276
+ type: "Emoji";
277
+ name: string;
278
+ updated: string;
279
+ icon: {
280
+ type: "Image";
281
+ mediaType: string;
282
+ url: string;
283
+ };
284
+ } | {
285
+ type: "Mention";
286
+ name: string;
287
+ href: string;
288
+ } | ({
216
289
  type: "Emoji";
217
290
  name: string;
218
291
  updated: string;
@@ -269,7 +342,20 @@ export declare const Undo: z.ZodObject<{
269
342
  cc: string | string[];
270
343
  url: string;
271
344
  attributedTo: string;
272
- tag: ({
345
+ tag: {
346
+ type: "Emoji";
347
+ name: string;
348
+ updated: string;
349
+ icon: {
350
+ type: "Image";
351
+ mediaType: string;
352
+ url: string;
353
+ };
354
+ } | {
355
+ type: "Mention";
356
+ name: string;
357
+ href: string;
358
+ } | ({
273
359
  type: "Emoji";
274
360
  name: string;
275
361
  updated: string;
@@ -329,7 +415,20 @@ export declare const Undo: z.ZodObject<{
329
415
  cc: string | string[];
330
416
  url: string;
331
417
  attributedTo: string;
332
- tag: ({
418
+ tag: {
419
+ type: "Emoji";
420
+ name: string;
421
+ updated: string;
422
+ icon: {
423
+ type: "Image";
424
+ mediaType: string;
425
+ url: string;
426
+ };
427
+ } | {
428
+ type: "Mention";
429
+ name: string;
430
+ href: string;
431
+ } | ({
333
432
  type: "Emoji";
334
433
  name: string;
335
434
  updated: string;
@@ -411,7 +510,20 @@ export declare const Undo: z.ZodObject<{
411
510
  cc: string | string[];
412
511
  url: string;
413
512
  attributedTo: string;
414
- tag: ({
513
+ tag: {
514
+ type: "Emoji";
515
+ name: string;
516
+ updated: string;
517
+ icon: {
518
+ type: "Image";
519
+ mediaType: string;
520
+ url: string;
521
+ };
522
+ } | {
523
+ type: "Mention";
524
+ name: string;
525
+ href: string;
526
+ } | ({
415
527
  type: "Emoji";
416
528
  name: string;
417
529
  updated: string;
@@ -481,7 +593,20 @@ export declare const Undo: z.ZodObject<{
481
593
  cc: string | string[];
482
594
  url: string;
483
595
  attributedTo: string;
484
- tag: ({
596
+ tag: {
597
+ type: "Emoji";
598
+ name: string;
599
+ updated: string;
600
+ icon: {
601
+ type: "Image";
602
+ mediaType: string;
603
+ url: string;
604
+ };
605
+ } | {
606
+ type: "Mention";
607
+ name: string;
608
+ href: string;
609
+ } | ({
485
610
  type: "Emoji";
486
611
  name: string;
487
612
  updated: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llun/activities.schema",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Validate ActivityPub and Mastodon with Zod",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { Attachment } from "./attachment.js";
3
- import { Emoji } from "./emoji.js";
4
- import { Mention } from "./mention.js";
3
+ import { Tag } from "./tag.js";
5
4
 
6
5
  export const BaseContent = z.object({
7
6
  id: z.string(),
@@ -37,7 +36,7 @@ export const BaseContent = z.object({
37
36
  .nullish(),
38
37
 
39
38
  attachment: z.union([Attachment, Attachment.array()]).nullish(),
40
- tag: z.union([Mention, Emoji]).array(),
39
+ tag: z.union([Tag, Tag.array()]),
41
40
 
42
41
  published: z.string({ description: "Object published datetime" }),
43
42
  updated: z.string({ description: "Object updated datetime" }).nullish(),
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ import { Emoji } from "./emoji.js";
3
+ import { Mention } from "./mention.js";
4
+
5
+ export const Tag = z.union([Mention, Emoji]);
6
+ export type Tag = z.infer<typeof Tag>;