@llun/activities.schema 0.2.13 → 0.2.15

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.
Binary file
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Collection = void 0;
4
+ const zod_1 = require("zod");
5
+ const CollectionWithFirstPage = zod_1.z.object({
6
+ id: zod_1.z.string(),
7
+ type: zod_1.z.literal("Collection"),
8
+ first: zod_1.z.object({
9
+ type: zod_1.z.literal("CollectionPage"),
10
+ next: zod_1.z.string(),
11
+ partOf: zod_1.z.string(),
12
+ items: zod_1.z.array(zod_1.z.any()),
13
+ }),
14
+ });
15
+ const CollectionWithItems = zod_1.z.object({
16
+ id: zod_1.z.string(),
17
+ type: zod_1.z.literal("Collection"),
18
+ totalItems: zod_1.z.number(),
19
+ items: zod_1.z.array(zod_1.z.any()),
20
+ });
21
+ exports.Collection = zod_1.z.union([
22
+ CollectionWithFirstPage,
23
+ CollectionWithItems,
24
+ ]);
package/dist/cjs/note.js CHANGED
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
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
+ const collection_js_1 = require("./collection.js");
6
7
  exports.ENTITY_TYPE_NOTE = "Note";
7
8
  exports.Note = baseContent_js_1.BaseContent.extend({
8
9
  type: zod_1.z.literal(exports.ENTITY_TYPE_NOTE),
10
+ replies: collection_js_1.Collection.nullish(),
9
11
  });
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ const CollectionWithFirstPage = z.object({
3
+ id: z.string(),
4
+ type: z.literal("Collection"),
5
+ first: z.object({
6
+ type: z.literal("CollectionPage"),
7
+ next: z.string(),
8
+ partOf: z.string(),
9
+ items: z.array(z.any()),
10
+ }),
11
+ });
12
+ const CollectionWithItems = z.object({
13
+ id: z.string(),
14
+ type: z.literal("Collection"),
15
+ totalItems: z.number(),
16
+ items: z.array(z.any()),
17
+ });
18
+ export const Collection = z.union([
19
+ CollectionWithFirstPage,
20
+ CollectionWithItems,
21
+ ]);
package/dist/esm/note.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { BaseContent } from "./note/baseContent.js";
3
+ import { Collection } from "./collection.js";
3
4
  export const ENTITY_TYPE_NOTE = "Note";
4
5
  export const Note = BaseContent.extend({
5
6
  type: z.literal(ENTITY_TYPE_NOTE),
7
+ replies: Collection.nullish(),
6
8
  });
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ export declare const Collection: z.ZodUnion<[z.ZodObject<{
3
+ id: z.ZodString;
4
+ type: z.ZodLiteral<"Collection">;
5
+ first: z.ZodObject<{
6
+ type: z.ZodLiteral<"CollectionPage">;
7
+ next: z.ZodString;
8
+ partOf: z.ZodString;
9
+ items: z.ZodArray<z.ZodAny, "many">;
10
+ }, "strip", z.ZodTypeAny, {
11
+ type: "CollectionPage";
12
+ next: string;
13
+ partOf: string;
14
+ items: any[];
15
+ }, {
16
+ type: "CollectionPage";
17
+ next: string;
18
+ partOf: string;
19
+ items: any[];
20
+ }>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ id: string;
23
+ type: "Collection";
24
+ first: {
25
+ type: "CollectionPage";
26
+ next: string;
27
+ partOf: string;
28
+ items: any[];
29
+ };
30
+ }, {
31
+ id: string;
32
+ type: "Collection";
33
+ first: {
34
+ type: "CollectionPage";
35
+ next: string;
36
+ partOf: string;
37
+ items: any[];
38
+ };
39
+ }>, z.ZodObject<{
40
+ id: z.ZodString;
41
+ type: z.ZodLiteral<"Collection">;
42
+ totalItems: z.ZodNumber;
43
+ items: z.ZodArray<z.ZodAny, "many">;
44
+ }, "strip", z.ZodTypeAny, {
45
+ id: string;
46
+ type: "Collection";
47
+ items: any[];
48
+ totalItems: number;
49
+ }, {
50
+ id: string;
51
+ type: "Collection";
52
+ items: any[];
53
+ totalItems: number;
54
+ }>]>;
55
+ export type Collection = z.infer<typeof Collection>;
@@ -217,6 +217,59 @@ export declare const Like: z.ZodObject<{
217
217
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
218
218
  }, {
219
219
  type: z.ZodLiteral<"Note">;
220
+ replies: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
221
+ id: z.ZodString;
222
+ type: z.ZodLiteral<"Collection">;
223
+ first: z.ZodObject<{
224
+ type: z.ZodLiteral<"CollectionPage">;
225
+ next: z.ZodString;
226
+ partOf: z.ZodString;
227
+ items: z.ZodArray<z.ZodAny, "many">;
228
+ }, "strip", z.ZodTypeAny, {
229
+ type: "CollectionPage";
230
+ next: string;
231
+ partOf: string;
232
+ items: any[];
233
+ }, {
234
+ type: "CollectionPage";
235
+ next: string;
236
+ partOf: string;
237
+ items: any[];
238
+ }>;
239
+ }, "strip", z.ZodTypeAny, {
240
+ id: string;
241
+ type: "Collection";
242
+ first: {
243
+ type: "CollectionPage";
244
+ next: string;
245
+ partOf: string;
246
+ items: any[];
247
+ };
248
+ }, {
249
+ id: string;
250
+ type: "Collection";
251
+ first: {
252
+ type: "CollectionPage";
253
+ next: string;
254
+ partOf: string;
255
+ items: any[];
256
+ };
257
+ }>, z.ZodObject<{
258
+ id: z.ZodString;
259
+ type: z.ZodLiteral<"Collection">;
260
+ totalItems: z.ZodNumber;
261
+ items: z.ZodArray<z.ZodAny, "many">;
262
+ }, "strip", z.ZodTypeAny, {
263
+ id: string;
264
+ type: "Collection";
265
+ items: any[];
266
+ totalItems: number;
267
+ }, {
268
+ id: string;
269
+ type: "Collection";
270
+ items: any[];
271
+ totalItems: number;
272
+ }>]>>>;
220
273
  }>, "strip", z.ZodTypeAny, {
221
274
  id: string;
222
275
  type: "Note";
@@ -293,6 +346,21 @@ export declare const Like: z.ZodObject<{
293
346
  value: string;
294
347
  name: string;
295
348
  })[] | null | undefined;
349
+ replies?: {
350
+ id: string;
351
+ type: "Collection";
352
+ first: {
353
+ type: "CollectionPage";
354
+ next: string;
355
+ partOf: string;
356
+ items: any[];
357
+ };
358
+ } | {
359
+ id: string;
360
+ type: "Collection";
361
+ items: any[];
362
+ totalItems: number;
363
+ } | null | undefined;
296
364
  }, {
297
365
  id: string;
298
366
  type: "Note";
@@ -369,6 +437,21 @@ export declare const Like: z.ZodObject<{
369
437
  value: string;
370
438
  name: string;
371
439
  })[] | null | undefined;
440
+ replies?: {
441
+ id: string;
442
+ type: "Collection";
443
+ first: {
444
+ type: "CollectionPage";
445
+ next: string;
446
+ partOf: string;
447
+ items: any[];
448
+ };
449
+ } | {
450
+ id: string;
451
+ type: "Collection";
452
+ items: any[];
453
+ totalItems: number;
454
+ } | null | undefined;
372
455
  }>]>;
373
456
  }, "strip", z.ZodTypeAny, {
374
457
  object: string | {
@@ -447,6 +530,21 @@ export declare const Like: z.ZodObject<{
447
530
  value: string;
448
531
  name: string;
449
532
  })[] | null | undefined;
533
+ replies?: {
534
+ id: string;
535
+ type: "Collection";
536
+ first: {
537
+ type: "CollectionPage";
538
+ next: string;
539
+ partOf: string;
540
+ items: any[];
541
+ };
542
+ } | {
543
+ id: string;
544
+ type: "Collection";
545
+ items: any[];
546
+ totalItems: number;
547
+ } | null | undefined;
450
548
  };
451
549
  id: string;
452
550
  type: "Like";
@@ -528,6 +626,21 @@ export declare const Like: z.ZodObject<{
528
626
  value: string;
529
627
  name: string;
530
628
  })[] | null | undefined;
629
+ replies?: {
630
+ id: string;
631
+ type: "Collection";
632
+ first: {
633
+ type: "CollectionPage";
634
+ next: string;
635
+ partOf: string;
636
+ items: any[];
637
+ };
638
+ } | {
639
+ id: string;
640
+ type: "Collection";
641
+ items: any[];
642
+ totalItems: number;
643
+ } | null | undefined;
531
644
  };
532
645
  id: string;
533
646
  type: "Like";
@@ -213,6 +213,59 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
213
213
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
214
  }, {
215
215
  type: z.ZodLiteral<"Note">;
216
+ replies: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
217
+ id: z.ZodString;
218
+ type: z.ZodLiteral<"Collection">;
219
+ first: z.ZodObject<{
220
+ type: z.ZodLiteral<"CollectionPage">;
221
+ next: z.ZodString;
222
+ partOf: z.ZodString;
223
+ items: z.ZodArray<z.ZodAny, "many">;
224
+ }, "strip", z.ZodTypeAny, {
225
+ type: "CollectionPage";
226
+ next: string;
227
+ partOf: string;
228
+ items: any[];
229
+ }, {
230
+ type: "CollectionPage";
231
+ next: string;
232
+ partOf: string;
233
+ items: any[];
234
+ }>;
235
+ }, "strip", z.ZodTypeAny, {
236
+ id: string;
237
+ type: "Collection";
238
+ first: {
239
+ type: "CollectionPage";
240
+ next: string;
241
+ partOf: string;
242
+ items: any[];
243
+ };
244
+ }, {
245
+ id: string;
246
+ type: "Collection";
247
+ first: {
248
+ type: "CollectionPage";
249
+ next: string;
250
+ partOf: string;
251
+ items: any[];
252
+ };
253
+ }>, z.ZodObject<{
254
+ id: z.ZodString;
255
+ type: z.ZodLiteral<"Collection">;
256
+ totalItems: z.ZodNumber;
257
+ items: z.ZodArray<z.ZodAny, "many">;
258
+ }, "strip", z.ZodTypeAny, {
259
+ id: string;
260
+ type: "Collection";
261
+ items: any[];
262
+ totalItems: number;
263
+ }, {
264
+ id: string;
265
+ type: "Collection";
266
+ items: any[];
267
+ totalItems: number;
268
+ }>]>>>;
216
269
  }>, "strip", z.ZodTypeAny, {
217
270
  id: string;
218
271
  type: "Note";
@@ -289,6 +342,21 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
289
342
  value: string;
290
343
  name: string;
291
344
  })[] | null | undefined;
345
+ replies?: {
346
+ id: string;
347
+ type: "Collection";
348
+ first: {
349
+ type: "CollectionPage";
350
+ next: string;
351
+ partOf: string;
352
+ items: any[];
353
+ };
354
+ } | {
355
+ id: string;
356
+ type: "Collection";
357
+ items: any[];
358
+ totalItems: number;
359
+ } | null | undefined;
292
360
  }, {
293
361
  id: string;
294
362
  type: "Note";
@@ -365,5 +433,20 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
365
433
  value: string;
366
434
  name: string;
367
435
  })[] | null | undefined;
436
+ replies?: {
437
+ id: string;
438
+ type: "Collection";
439
+ first: {
440
+ type: "CollectionPage";
441
+ next: string;
442
+ partOf: string;
443
+ items: any[];
444
+ };
445
+ } | {
446
+ id: string;
447
+ type: "Collection";
448
+ items: any[];
449
+ totalItems: number;
450
+ } | null | undefined;
368
451
  }>;
369
452
  export type Note = z.infer<typeof Note>;
@@ -220,6 +220,59 @@ export declare const Undo: z.ZodObject<{
220
220
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
221
221
  }, {
222
222
  type: z.ZodLiteral<"Note">;
223
+ replies: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
224
+ id: z.ZodString;
225
+ type: z.ZodLiteral<"Collection">;
226
+ first: z.ZodObject<{
227
+ type: z.ZodLiteral<"CollectionPage">;
228
+ next: z.ZodString;
229
+ partOf: z.ZodString;
230
+ items: z.ZodArray<z.ZodAny, "many">;
231
+ }, "strip", z.ZodTypeAny, {
232
+ type: "CollectionPage";
233
+ next: string;
234
+ partOf: string;
235
+ items: any[];
236
+ }, {
237
+ type: "CollectionPage";
238
+ next: string;
239
+ partOf: string;
240
+ items: any[];
241
+ }>;
242
+ }, "strip", z.ZodTypeAny, {
243
+ id: string;
244
+ type: "Collection";
245
+ first: {
246
+ type: "CollectionPage";
247
+ next: string;
248
+ partOf: string;
249
+ items: any[];
250
+ };
251
+ }, {
252
+ id: string;
253
+ type: "Collection";
254
+ first: {
255
+ type: "CollectionPage";
256
+ next: string;
257
+ partOf: string;
258
+ items: any[];
259
+ };
260
+ }>, z.ZodObject<{
261
+ id: z.ZodString;
262
+ type: z.ZodLiteral<"Collection">;
263
+ totalItems: z.ZodNumber;
264
+ items: z.ZodArray<z.ZodAny, "many">;
265
+ }, "strip", z.ZodTypeAny, {
266
+ id: string;
267
+ type: "Collection";
268
+ items: any[];
269
+ totalItems: number;
270
+ }, {
271
+ id: string;
272
+ type: "Collection";
273
+ items: any[];
274
+ totalItems: number;
275
+ }>]>>>;
223
276
  }>, "strip", z.ZodTypeAny, {
224
277
  id: string;
225
278
  type: "Note";
@@ -296,6 +349,21 @@ export declare const Undo: z.ZodObject<{
296
349
  value: string;
297
350
  name: string;
298
351
  })[] | null | undefined;
352
+ replies?: {
353
+ id: string;
354
+ type: "Collection";
355
+ first: {
356
+ type: "CollectionPage";
357
+ next: string;
358
+ partOf: string;
359
+ items: any[];
360
+ };
361
+ } | {
362
+ id: string;
363
+ type: "Collection";
364
+ items: any[];
365
+ totalItems: number;
366
+ } | null | undefined;
299
367
  }, {
300
368
  id: string;
301
369
  type: "Note";
@@ -372,6 +440,21 @@ export declare const Undo: z.ZodObject<{
372
440
  value: string;
373
441
  name: string;
374
442
  })[] | null | undefined;
443
+ replies?: {
444
+ id: string;
445
+ type: "Collection";
446
+ first: {
447
+ type: "CollectionPage";
448
+ next: string;
449
+ partOf: string;
450
+ items: any[];
451
+ };
452
+ } | {
453
+ id: string;
454
+ type: "Collection";
455
+ items: any[];
456
+ totalItems: number;
457
+ } | null | undefined;
375
458
  }>]>;
376
459
  }, "strip", z.ZodTypeAny, {
377
460
  object: string | {
@@ -450,6 +533,21 @@ export declare const Undo: z.ZodObject<{
450
533
  value: string;
451
534
  name: string;
452
535
  })[] | null | undefined;
536
+ replies?: {
537
+ id: string;
538
+ type: "Collection";
539
+ first: {
540
+ type: "CollectionPage";
541
+ next: string;
542
+ partOf: string;
543
+ items: any[];
544
+ };
545
+ } | {
546
+ id: string;
547
+ type: "Collection";
548
+ items: any[];
549
+ totalItems: number;
550
+ } | null | undefined;
453
551
  };
454
552
  id: string;
455
553
  type: "Like";
@@ -531,6 +629,21 @@ export declare const Undo: z.ZodObject<{
531
629
  value: string;
532
630
  name: string;
533
631
  })[] | null | undefined;
632
+ replies?: {
633
+ id: string;
634
+ type: "Collection";
635
+ first: {
636
+ type: "CollectionPage";
637
+ next: string;
638
+ partOf: string;
639
+ items: any[];
640
+ };
641
+ } | {
642
+ id: string;
643
+ type: "Collection";
644
+ items: any[];
645
+ totalItems: number;
646
+ } | null | undefined;
534
647
  };
535
648
  id: string;
536
649
  type: "Like";
@@ -634,6 +747,21 @@ export declare const Undo: z.ZodObject<{
634
747
  value: string;
635
748
  name: string;
636
749
  })[] | null | undefined;
750
+ replies?: {
751
+ id: string;
752
+ type: "Collection";
753
+ first: {
754
+ type: "CollectionPage";
755
+ next: string;
756
+ partOf: string;
757
+ items: any[];
758
+ };
759
+ } | {
760
+ id: string;
761
+ type: "Collection";
762
+ items: any[];
763
+ totalItems: number;
764
+ } | null | undefined;
637
765
  };
638
766
  id: string;
639
767
  type: "Like";
@@ -725,6 +853,21 @@ export declare const Undo: z.ZodObject<{
725
853
  value: string;
726
854
  name: string;
727
855
  })[] | null | undefined;
856
+ replies?: {
857
+ id: string;
858
+ type: "Collection";
859
+ first: {
860
+ type: "CollectionPage";
861
+ next: string;
862
+ partOf: string;
863
+ items: any[];
864
+ };
865
+ } | {
866
+ id: string;
867
+ type: "Collection";
868
+ items: any[];
869
+ totalItems: number;
870
+ } | null | undefined;
728
871
  };
729
872
  id: string;
730
873
  type: "Like";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llun/activities.schema",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "Validate ActivityPub and Mastodon with Zod",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -13,10 +13,10 @@
13
13
  "author": "Maythee Anegboonlap <null@llun.dev>",
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "zod": "^3.23.8"
16
+ "zod": "^3.24.1"
17
17
  },
18
18
  "devDependencies": {
19
- "typescript": "^5.6.2"
19
+ "typescript": "^5.7.3"
20
20
  },
21
- "packageManager": "yarn@4.4.1"
21
+ "packageManager": "yarn@4.6.0"
22
22
  }
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+
3
+ const CollectionWithFirstPage = z.object({
4
+ id: z.string(),
5
+ type: z.literal("Collection"),
6
+ first: z.object({
7
+ type: z.literal("CollectionPage"),
8
+ next: z.string(),
9
+ partOf: z.string(),
10
+ items: z.array(z.any()),
11
+ }),
12
+ });
13
+
14
+ const CollectionWithItems = z.object({
15
+ id: z.string(),
16
+ type: z.literal("Collection"),
17
+ totalItems: z.number(),
18
+ items: z.array(z.any()),
19
+ });
20
+
21
+ export const Collection = z.union([
22
+ CollectionWithFirstPage,
23
+ CollectionWithItems,
24
+ ]);
25
+ export type Collection = z.infer<typeof Collection>;
package/src/note.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { z } from "zod";
2
2
  import { BaseContent } from "./note/baseContent.js";
3
+ import { Collection } from "./collection.js";
3
4
 
4
5
  export const ENTITY_TYPE_NOTE = "Note";
5
6
  export const Note = BaseContent.extend({
6
7
  type: z.literal(ENTITY_TYPE_NOTE),
8
+ replies: Collection.nullish(),
7
9
  });
8
10
  export type Note = z.infer<typeof Note>;