@llun/activities.schema 0.0.8 → 0.1.0
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/.yarn/install-state.gz +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/like.d.ts +16 -125
- package/dist/mastodon/account.d.ts +327 -0
- package/dist/mastodon/account.js +87 -0
- package/dist/mastodon/accountField.d.ts +15 -0
- package/dist/mastodon/accountField.js +15 -0
- package/dist/mastodon/customEmoji.d.ts +21 -0
- package/dist/mastodon/customEmoji.js +21 -0
- package/dist/mastodon/filter/index.d.ts +62 -0
- package/dist/mastodon/filter/index.js +24 -0
- package/dist/mastodon/filter/keyword.d.ts +15 -0
- package/dist/mastodon/filter/keyword.js +9 -0
- package/dist/mastodon/filter/status.d.ts +12 -0
- package/dist/mastodon/filter/status.js +8 -0
- package/dist/mastodon/filterResult.d.ts +104 -0
- package/dist/mastodon/filterResult.js +16 -0
- package/dist/mastodon/index.d.ts +3 -0
- package/dist/mastodon/index.js +3 -0
- package/dist/mastodon/mediaAttachment/audio.d.ts +87 -0
- package/dist/mastodon/mediaAttachment/audio.js +17 -0
- package/dist/mastodon/mediaAttachment/base.d.ts +24 -0
- package/dist/mastodon/mediaAttachment/base.js +26 -0
- package/dist/mastodon/mediaAttachment/gifv.d.ts +158 -0
- package/dist/mastodon/mediaAttachment/gifv.js +37 -0
- package/dist/mastodon/mediaAttachment/image.d.ts +142 -0
- package/dist/mastodon/mediaAttachment/image.js +30 -0
- package/dist/mastodon/mediaAttachment/index.d.ts +576 -0
- package/dist/mastodon/mediaAttachment/index.js +8 -0
- package/dist/mastodon/mediaAttachment/unknown.d.ts +28 -0
- package/dist/mastodon/mediaAttachment/unknown.js +8 -0
- package/dist/mastodon/mediaAttachment/video.d.ts +173 -0
- package/dist/mastodon/mediaAttachment/video.js +38 -0
- package/dist/mastodon/poll/index.d.ts +81 -0
- package/dist/mastodon/poll/index.js +27 -0
- package/dist/mastodon/poll/option.d.ts +12 -0
- package/dist/mastodon/poll/option.js +10 -0
- package/dist/mastodon/previewCard.d.ts +48 -0
- package/dist/mastodon/previewCard.js +34 -0
- package/dist/mastodon/status/application.d.ts +12 -0
- package/dist/mastodon/status/application.js +12 -0
- package/dist/mastodon/status/base.d.ts +1738 -0
- package/dist/mastodon/status/base.js +96 -0
- package/dist/mastodon/status/index.d.ts +4035 -0
- package/dist/mastodon/status/index.js +4 -0
- package/dist/mastodon/status/mention.d.ts +18 -0
- package/dist/mastodon/status/mention.js +12 -0
- package/dist/mastodon/status/tag.d.ts +12 -0
- package/dist/mastodon/status/tag.js +10 -0
- package/dist/mastodon/status/visibility.d.ts +3 -0
- package/dist/mastodon/status/visibility.js +3 -0
- package/dist/note/baseContent.d.ts +251 -0
- package/dist/note/baseContent.js +24 -0
- package/dist/note.d.ts +8 -7
- package/dist/note.js +1 -23
- package/dist/undo.d.ts +24 -243
- package/package.json +4 -4
- package/src/mastodon/filter/index.ts +31 -0
- package/src/mastodon/filter/keyword.ts +12 -0
- package/src/mastodon/filter/status.ts +10 -0
- package/src/mastodon/filterResult.ts +18 -0
- package/src/mastodon/mediaAttachment/audio.ts +19 -0
- package/src/mastodon/mediaAttachment/base.ts +34 -0
- package/src/mastodon/mediaAttachment/gifv.ts +41 -0
- package/src/mastodon/mediaAttachment/image.ts +32 -0
- package/src/mastodon/mediaAttachment/index.ts +10 -0
- package/src/mastodon/mediaAttachment/unknown.ts +12 -0
- package/src/mastodon/mediaAttachment/video.ts +43 -0
- package/src/mastodon/poll/index.ts +35 -0
- package/src/mastodon/poll/option.ts +13 -0
- package/src/mastodon/previewCard.ts +41 -0
- package/src/mastodon/status/application.ts +15 -0
- package/src/mastodon/status/base.ts +125 -0
- package/src/mastodon/status/index.ts +8 -0
- package/src/mastodon/status/mention.ts +15 -0
- package/src/mastodon/status/tag.ts +12 -0
- package/src/mastodon/status/visibility.ts +5 -0
package/dist/undo.d.ts
CHANGED
|
@@ -7,10 +7,9 @@ export declare const Undo: z.ZodObject<{
|
|
|
7
7
|
type: z.ZodLiteral<"Like">;
|
|
8
8
|
id: z.ZodString;
|
|
9
9
|
actor: z.ZodString;
|
|
10
|
-
object: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
10
|
+
object: z.ZodUnion<[z.ZodString, z.ZodObject<z.objectUtil.extendShape<{
|
|
11
11
|
id: z.ZodString;
|
|
12
12
|
url: z.ZodString;
|
|
13
|
-
updated: z.ZodOptional<z.ZodString>;
|
|
14
13
|
attributedTo: z.ZodString;
|
|
15
14
|
to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
16
15
|
cc: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
@@ -147,14 +146,16 @@ export declare const Undo: z.ZodObject<{
|
|
|
147
146
|
};
|
|
148
147
|
}>]>, "many">;
|
|
149
148
|
published: z.ZodString;
|
|
149
|
+
updated: z.ZodOptional<z.ZodString>;
|
|
150
|
+
}, {
|
|
150
151
|
type: z.ZodLiteral<"Note">;
|
|
151
|
-
}
|
|
152
|
+
}>, "strip", z.ZodTypeAny, {
|
|
152
153
|
id: string;
|
|
153
154
|
type: "Note";
|
|
154
155
|
url: string;
|
|
155
156
|
attributedTo: string;
|
|
156
|
-
to:
|
|
157
|
-
cc:
|
|
157
|
+
to: string | string[];
|
|
158
|
+
cc: string | string[];
|
|
158
159
|
inReplyTo: string | null;
|
|
159
160
|
tag: ({
|
|
160
161
|
type: "Emoji";
|
|
@@ -208,8 +209,8 @@ export declare const Undo: z.ZodObject<{
|
|
|
208
209
|
type: "Note";
|
|
209
210
|
url: string;
|
|
210
211
|
attributedTo: string;
|
|
211
|
-
to:
|
|
212
|
-
cc:
|
|
212
|
+
to: string | string[];
|
|
213
|
+
cc: string | string[];
|
|
213
214
|
inReplyTo: string | null;
|
|
214
215
|
tag: ({
|
|
215
216
|
type: "Emoji";
|
|
@@ -260,68 +261,13 @@ export declare const Undo: z.ZodObject<{
|
|
|
260
261
|
})[] | undefined;
|
|
261
262
|
}>]>;
|
|
262
263
|
}, "strip", z.ZodTypeAny, {
|
|
263
|
-
object:
|
|
264
|
-
id: string;
|
|
265
|
-
type: "Note";
|
|
266
|
-
url: string;
|
|
267
|
-
attributedTo: string;
|
|
268
|
-
to: (string | string[]) & (string | string[] | undefined);
|
|
269
|
-
cc: (string | string[]) & (string | string[] | undefined);
|
|
270
|
-
inReplyTo: string | null;
|
|
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
|
-
})[];
|
|
285
|
-
published: string;
|
|
286
|
-
updated?: string | undefined;
|
|
287
|
-
summary?: string | undefined;
|
|
288
|
-
summaryMap?: Record<string, string> | undefined;
|
|
289
|
-
content?: string | undefined;
|
|
290
|
-
contentMap?: Record<string, string> | undefined;
|
|
291
|
-
attachment?: {
|
|
292
|
-
type: "Document";
|
|
293
|
-
mediaType: string;
|
|
294
|
-
url: string;
|
|
295
|
-
blurhash?: string | undefined;
|
|
296
|
-
width?: number | undefined;
|
|
297
|
-
height?: number | undefined;
|
|
298
|
-
name?: string | null | undefined;
|
|
299
|
-
focalPoint?: [number, number] | undefined;
|
|
300
|
-
} | {
|
|
301
|
-
type: "PropertyValue";
|
|
302
|
-
value: string;
|
|
303
|
-
name: string;
|
|
304
|
-
} | ({
|
|
305
|
-
type: "Document";
|
|
306
|
-
mediaType: string;
|
|
307
|
-
url: string;
|
|
308
|
-
blurhash?: string | undefined;
|
|
309
|
-
width?: number | undefined;
|
|
310
|
-
height?: number | undefined;
|
|
311
|
-
name?: string | null | undefined;
|
|
312
|
-
focalPoint?: [number, number] | undefined;
|
|
313
|
-
} | {
|
|
314
|
-
type: "PropertyValue";
|
|
315
|
-
value: string;
|
|
316
|
-
name: string;
|
|
317
|
-
})[] | undefined;
|
|
318
|
-
}) & (string | {
|
|
264
|
+
object: string | {
|
|
319
265
|
id: string;
|
|
320
266
|
type: "Note";
|
|
321
267
|
url: string;
|
|
322
268
|
attributedTo: string;
|
|
323
|
-
to:
|
|
324
|
-
cc:
|
|
269
|
+
to: string | string[];
|
|
270
|
+
cc: string | string[];
|
|
325
271
|
inReplyTo: string | null;
|
|
326
272
|
tag: ({
|
|
327
273
|
type: "Emoji";
|
|
@@ -370,18 +316,18 @@ export declare const Undo: z.ZodObject<{
|
|
|
370
316
|
value: string;
|
|
371
317
|
name: string;
|
|
372
318
|
})[] | undefined;
|
|
373
|
-
}
|
|
319
|
+
};
|
|
374
320
|
id: string;
|
|
375
321
|
type: "Like";
|
|
376
322
|
actor: string;
|
|
377
323
|
}, {
|
|
378
|
-
object:
|
|
324
|
+
object: string | {
|
|
379
325
|
id: string;
|
|
380
326
|
type: "Note";
|
|
381
327
|
url: string;
|
|
382
328
|
attributedTo: string;
|
|
383
|
-
to:
|
|
384
|
-
cc:
|
|
329
|
+
to: string | string[];
|
|
330
|
+
cc: string | string[];
|
|
385
331
|
inReplyTo: string | null;
|
|
386
332
|
tag: ({
|
|
387
333
|
type: "Emoji";
|
|
@@ -430,62 +376,7 @@ export declare const Undo: z.ZodObject<{
|
|
|
430
376
|
value: string;
|
|
431
377
|
name: string;
|
|
432
378
|
})[] | undefined;
|
|
433
|
-
}
|
|
434
|
-
id: string;
|
|
435
|
-
type: "Note";
|
|
436
|
-
url: string;
|
|
437
|
-
attributedTo: string;
|
|
438
|
-
to: (string | string[]) & (string | string[] | undefined);
|
|
439
|
-
cc: (string | string[]) & (string | string[] | undefined);
|
|
440
|
-
inReplyTo: string | null;
|
|
441
|
-
tag: ({
|
|
442
|
-
type: "Emoji";
|
|
443
|
-
name: string;
|
|
444
|
-
updated: string;
|
|
445
|
-
icon: {
|
|
446
|
-
type: "Image";
|
|
447
|
-
mediaType: string;
|
|
448
|
-
url: string;
|
|
449
|
-
};
|
|
450
|
-
} | {
|
|
451
|
-
type: "Mention";
|
|
452
|
-
name: string;
|
|
453
|
-
href: string;
|
|
454
|
-
})[];
|
|
455
|
-
published: string;
|
|
456
|
-
updated?: string | undefined;
|
|
457
|
-
summary?: string | undefined;
|
|
458
|
-
summaryMap?: Record<string, string> | undefined;
|
|
459
|
-
content?: string | undefined;
|
|
460
|
-
contentMap?: Record<string, string> | undefined;
|
|
461
|
-
attachment?: {
|
|
462
|
-
type: "Document";
|
|
463
|
-
mediaType: string;
|
|
464
|
-
url: string;
|
|
465
|
-
blurhash?: string | undefined;
|
|
466
|
-
width?: number | undefined;
|
|
467
|
-
height?: number | undefined;
|
|
468
|
-
name?: string | null | undefined;
|
|
469
|
-
focalPoint?: [number, number] | undefined;
|
|
470
|
-
} | {
|
|
471
|
-
type: "PropertyValue";
|
|
472
|
-
value: string;
|
|
473
|
-
name: string;
|
|
474
|
-
} | ({
|
|
475
|
-
type: "Document";
|
|
476
|
-
mediaType: string;
|
|
477
|
-
url: string;
|
|
478
|
-
blurhash?: string | undefined;
|
|
479
|
-
width?: number | undefined;
|
|
480
|
-
height?: number | undefined;
|
|
481
|
-
name?: string | null | undefined;
|
|
482
|
-
focalPoint?: [number, number] | undefined;
|
|
483
|
-
} | {
|
|
484
|
-
type: "PropertyValue";
|
|
485
|
-
value: string;
|
|
486
|
-
name: string;
|
|
487
|
-
})[] | undefined;
|
|
488
|
-
} | undefined);
|
|
379
|
+
};
|
|
489
380
|
id: string;
|
|
490
381
|
type: "Like";
|
|
491
382
|
actor: string;
|
|
@@ -512,68 +403,13 @@ export declare const Undo: z.ZodObject<{
|
|
|
512
403
|
type: "Follow";
|
|
513
404
|
actor: string;
|
|
514
405
|
} | {
|
|
515
|
-
object:
|
|
516
|
-
id: string;
|
|
517
|
-
type: "Note";
|
|
518
|
-
url: string;
|
|
519
|
-
attributedTo: string;
|
|
520
|
-
to: (string | string[]) & (string | string[] | undefined);
|
|
521
|
-
cc: (string | string[]) & (string | string[] | undefined);
|
|
522
|
-
inReplyTo: string | null;
|
|
523
|
-
tag: ({
|
|
524
|
-
type: "Emoji";
|
|
525
|
-
name: string;
|
|
526
|
-
updated: string;
|
|
527
|
-
icon: {
|
|
528
|
-
type: "Image";
|
|
529
|
-
mediaType: string;
|
|
530
|
-
url: string;
|
|
531
|
-
};
|
|
532
|
-
} | {
|
|
533
|
-
type: "Mention";
|
|
534
|
-
name: string;
|
|
535
|
-
href: string;
|
|
536
|
-
})[];
|
|
537
|
-
published: string;
|
|
538
|
-
updated?: string | undefined;
|
|
539
|
-
summary?: string | undefined;
|
|
540
|
-
summaryMap?: Record<string, string> | undefined;
|
|
541
|
-
content?: string | undefined;
|
|
542
|
-
contentMap?: Record<string, string> | undefined;
|
|
543
|
-
attachment?: {
|
|
544
|
-
type: "Document";
|
|
545
|
-
mediaType: string;
|
|
546
|
-
url: string;
|
|
547
|
-
blurhash?: string | undefined;
|
|
548
|
-
width?: number | undefined;
|
|
549
|
-
height?: number | undefined;
|
|
550
|
-
name?: string | null | undefined;
|
|
551
|
-
focalPoint?: [number, number] | undefined;
|
|
552
|
-
} | {
|
|
553
|
-
type: "PropertyValue";
|
|
554
|
-
value: string;
|
|
555
|
-
name: string;
|
|
556
|
-
} | ({
|
|
557
|
-
type: "Document";
|
|
558
|
-
mediaType: string;
|
|
559
|
-
url: string;
|
|
560
|
-
blurhash?: string | undefined;
|
|
561
|
-
width?: number | undefined;
|
|
562
|
-
height?: number | undefined;
|
|
563
|
-
name?: string | null | undefined;
|
|
564
|
-
focalPoint?: [number, number] | undefined;
|
|
565
|
-
} | {
|
|
566
|
-
type: "PropertyValue";
|
|
567
|
-
value: string;
|
|
568
|
-
name: string;
|
|
569
|
-
})[] | undefined;
|
|
570
|
-
}) & (string | {
|
|
406
|
+
object: string | {
|
|
571
407
|
id: string;
|
|
572
408
|
type: "Note";
|
|
573
409
|
url: string;
|
|
574
410
|
attributedTo: string;
|
|
575
|
-
to:
|
|
576
|
-
cc:
|
|
411
|
+
to: string | string[];
|
|
412
|
+
cc: string | string[];
|
|
577
413
|
inReplyTo: string | null;
|
|
578
414
|
tag: ({
|
|
579
415
|
type: "Emoji";
|
|
@@ -622,7 +458,7 @@ export declare const Undo: z.ZodObject<{
|
|
|
622
458
|
value: string;
|
|
623
459
|
name: string;
|
|
624
460
|
})[] | undefined;
|
|
625
|
-
}
|
|
461
|
+
};
|
|
626
462
|
id: string;
|
|
627
463
|
type: "Like";
|
|
628
464
|
actor: string;
|
|
@@ -637,68 +473,13 @@ export declare const Undo: z.ZodObject<{
|
|
|
637
473
|
type: "Follow";
|
|
638
474
|
actor: string;
|
|
639
475
|
} | {
|
|
640
|
-
object:
|
|
641
|
-
id: string;
|
|
642
|
-
type: "Note";
|
|
643
|
-
url: string;
|
|
644
|
-
attributedTo: string;
|
|
645
|
-
to: (string | string[]) & (string | string[] | undefined);
|
|
646
|
-
cc: (string | string[]) & (string | string[] | undefined);
|
|
647
|
-
inReplyTo: string | null;
|
|
648
|
-
tag: ({
|
|
649
|
-
type: "Emoji";
|
|
650
|
-
name: string;
|
|
651
|
-
updated: string;
|
|
652
|
-
icon: {
|
|
653
|
-
type: "Image";
|
|
654
|
-
mediaType: string;
|
|
655
|
-
url: string;
|
|
656
|
-
};
|
|
657
|
-
} | {
|
|
658
|
-
type: "Mention";
|
|
659
|
-
name: string;
|
|
660
|
-
href: string;
|
|
661
|
-
})[];
|
|
662
|
-
published: string;
|
|
663
|
-
updated?: string | undefined;
|
|
664
|
-
summary?: string | undefined;
|
|
665
|
-
summaryMap?: Record<string, string> | undefined;
|
|
666
|
-
content?: string | undefined;
|
|
667
|
-
contentMap?: Record<string, string> | undefined;
|
|
668
|
-
attachment?: {
|
|
669
|
-
type: "Document";
|
|
670
|
-
mediaType: string;
|
|
671
|
-
url: string;
|
|
672
|
-
blurhash?: string | undefined;
|
|
673
|
-
width?: number | undefined;
|
|
674
|
-
height?: number | undefined;
|
|
675
|
-
name?: string | null | undefined;
|
|
676
|
-
focalPoint?: [number, number] | undefined;
|
|
677
|
-
} | {
|
|
678
|
-
type: "PropertyValue";
|
|
679
|
-
value: string;
|
|
680
|
-
name: string;
|
|
681
|
-
} | ({
|
|
682
|
-
type: "Document";
|
|
683
|
-
mediaType: string;
|
|
684
|
-
url: string;
|
|
685
|
-
blurhash?: string | undefined;
|
|
686
|
-
width?: number | undefined;
|
|
687
|
-
height?: number | undefined;
|
|
688
|
-
name?: string | null | undefined;
|
|
689
|
-
focalPoint?: [number, number] | undefined;
|
|
690
|
-
} | {
|
|
691
|
-
type: "PropertyValue";
|
|
692
|
-
value: string;
|
|
693
|
-
name: string;
|
|
694
|
-
})[] | undefined;
|
|
695
|
-
}) & (string | {
|
|
476
|
+
object: string | {
|
|
696
477
|
id: string;
|
|
697
478
|
type: "Note";
|
|
698
479
|
url: string;
|
|
699
480
|
attributedTo: string;
|
|
700
|
-
to:
|
|
701
|
-
cc:
|
|
481
|
+
to: string | string[];
|
|
482
|
+
cc: string | string[];
|
|
702
483
|
inReplyTo: string | null;
|
|
703
484
|
tag: ({
|
|
704
485
|
type: "Emoji";
|
|
@@ -747,7 +528,7 @@ export declare const Undo: z.ZodObject<{
|
|
|
747
528
|
value: string;
|
|
748
529
|
name: string;
|
|
749
530
|
})[] | undefined;
|
|
750
|
-
}
|
|
531
|
+
};
|
|
751
532
|
id: string;
|
|
752
533
|
type: "Like";
|
|
753
534
|
actor: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llun/activities.schema",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "Validate ActivityPub with Zod",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Validate ActivityPub and Mastodon with Zod",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"author": "Maythee Anegboonlap <null@llun.dev>",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"zod": "^3.23.
|
|
15
|
+
"zod": "^3.23.8"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"typescript": "^5.4.5"
|
|
19
19
|
},
|
|
20
|
-
"packageManager": "yarn@4.
|
|
20
|
+
"packageManager": "yarn@4.2.2"
|
|
21
21
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/Filter/
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { FilterKeyword } from "./keyword.js";
|
|
4
|
+
import { FilterStatus } from "./status.js";
|
|
5
|
+
|
|
6
|
+
export const Filter = z.object({
|
|
7
|
+
id: z.string({ description: "The ID of the Filter in the database" }),
|
|
8
|
+
title: z.string({
|
|
9
|
+
description: "A title given by the user to name the filter",
|
|
10
|
+
}),
|
|
11
|
+
context: z
|
|
12
|
+
.enum(["home", "notifications", "public", "thread", "account"])
|
|
13
|
+
.array()
|
|
14
|
+
.describe("The contexts in which the filter should be applied"),
|
|
15
|
+
expires_at: z
|
|
16
|
+
.string({
|
|
17
|
+
description:
|
|
18
|
+
"When the filter should no longer be applied in ISO 8601 Datetime format or null if the filter does not expire",
|
|
19
|
+
})
|
|
20
|
+
.nullable(),
|
|
21
|
+
filter_action: z
|
|
22
|
+
.enum(["warn", "hide"])
|
|
23
|
+
.describe("The action to be taken when a status matches this filter"),
|
|
24
|
+
keywords: FilterKeyword.array().describe(
|
|
25
|
+
"The keywords grouped under this filter"
|
|
26
|
+
),
|
|
27
|
+
statuses: FilterStatus.array().describe(
|
|
28
|
+
"The statuses grouped under this filter"
|
|
29
|
+
),
|
|
30
|
+
});
|
|
31
|
+
export type Filter = z.infer<typeof Filter>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/FilterKeyword/
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const FilterKeyword = z.object({
|
|
5
|
+
id: z.string({ description: "The ID of the FilterKeyword in the database" }),
|
|
6
|
+
keyword: z.string({ description: "The phrase to be matched against" }),
|
|
7
|
+
whole_word: z.boolean({
|
|
8
|
+
description:
|
|
9
|
+
"Should the filter consider word boundaries? See [implementation guidelines for filters](https://docs.joinmastodon.org/api/guidelines/#filters)",
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
export type FilterKeyword = z.infer<typeof FilterKeyword>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/FilterStatus/
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const FilterStatus = z.object({
|
|
5
|
+
id: z.string({ description: "The ID of the FilterStatus in the database" }),
|
|
6
|
+
status_id: z.string({
|
|
7
|
+
description: "The ID of the Status that will be filtered",
|
|
8
|
+
}),
|
|
9
|
+
});
|
|
10
|
+
export type FilterStatus = z.infer<typeof FilterStatus>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/FilterResult/
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { Filter } from "./filter/index.js";
|
|
4
|
+
|
|
5
|
+
export const FilterResult = z.object({
|
|
6
|
+
filter: Filter.describe("The filter that was matched"),
|
|
7
|
+
keyword_matches: z
|
|
8
|
+
.string()
|
|
9
|
+
.array()
|
|
10
|
+
.nullable()
|
|
11
|
+
.describe("The keyword within the filter that was matched"),
|
|
12
|
+
status_matches: z
|
|
13
|
+
.string()
|
|
14
|
+
.array()
|
|
15
|
+
.nullable()
|
|
16
|
+
.describe("The status ID within the filter that was matched"),
|
|
17
|
+
});
|
|
18
|
+
export type FilterResult = z.infer<typeof FilterResult>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/#audio
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { BaseMediaAttachment } from "./base.js";
|
|
4
|
+
|
|
5
|
+
export const Audio = BaseMediaAttachment.extend({
|
|
6
|
+
type: z.literal("audio").describe("The type of the attachment (Audio track)"),
|
|
7
|
+
meta: z.object({
|
|
8
|
+
length: z.string(),
|
|
9
|
+
duration: z.number(),
|
|
10
|
+
audio_encode: z.string(),
|
|
11
|
+
audio_bitrate: z.string(),
|
|
12
|
+
audio_channels: z.string(),
|
|
13
|
+
original: z.object({
|
|
14
|
+
duration: z.number(),
|
|
15
|
+
bitrate: z.number(),
|
|
16
|
+
}),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Audio = z.infer<typeof Audio>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const BaseMediaAttachment = z.object({
|
|
5
|
+
id: z.string({
|
|
6
|
+
description: "The ID of the attachment in the database",
|
|
7
|
+
}),
|
|
8
|
+
|
|
9
|
+
url: z.string({
|
|
10
|
+
description: "The location of the original full-size attachment",
|
|
11
|
+
}),
|
|
12
|
+
preview_url: z.string({
|
|
13
|
+
description: "The location of a scaled-down preview of the attachment",
|
|
14
|
+
}),
|
|
15
|
+
remote_url: z
|
|
16
|
+
.string({
|
|
17
|
+
description:
|
|
18
|
+
"The location of the full-size original attachment on the remote website",
|
|
19
|
+
})
|
|
20
|
+
.nullable(),
|
|
21
|
+
|
|
22
|
+
description: z
|
|
23
|
+
.string({
|
|
24
|
+
description:
|
|
25
|
+
"Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load",
|
|
26
|
+
})
|
|
27
|
+
.nullable(),
|
|
28
|
+
|
|
29
|
+
bluehash: z.string({
|
|
30
|
+
description:
|
|
31
|
+
"hash computed by the [BlurHash algorithm](https://github.com/woltapp/blurhash), for generating colorful preview thumbnails when media has not been downloaded yet.",
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
export type BaseMediaAttachment = z.infer<typeof BaseMediaAttachment>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/#gifv
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { BaseMediaAttachment } from "./base.js";
|
|
4
|
+
|
|
5
|
+
export const Gifv = BaseMediaAttachment.extend({
|
|
6
|
+
type: z
|
|
7
|
+
.literal("gifv")
|
|
8
|
+
.describe("The type of the attachment (Looping, soundless animation)"),
|
|
9
|
+
meta: z.object({
|
|
10
|
+
length: z.string(),
|
|
11
|
+
duration: z.number(),
|
|
12
|
+
fps: z.number(),
|
|
13
|
+
|
|
14
|
+
size: z.string({
|
|
15
|
+
description: "Video width and height in string wxh format",
|
|
16
|
+
}),
|
|
17
|
+
width: z.number(),
|
|
18
|
+
height: z.number(),
|
|
19
|
+
aspect: z.number({
|
|
20
|
+
description: "Aspect ratio of the video (width/height)",
|
|
21
|
+
}),
|
|
22
|
+
|
|
23
|
+
original: z.object({
|
|
24
|
+
width: z.number(),
|
|
25
|
+
height: z.number(),
|
|
26
|
+
frame_rate: z.string(),
|
|
27
|
+
duration: z.number(),
|
|
28
|
+
bitrate: z.number(),
|
|
29
|
+
}),
|
|
30
|
+
small: z
|
|
31
|
+
.object({
|
|
32
|
+
width: z.number(),
|
|
33
|
+
height: z.number(),
|
|
34
|
+
size: z.string(),
|
|
35
|
+
aspect: z.number(),
|
|
36
|
+
})
|
|
37
|
+
.describe("A video preview in static image")
|
|
38
|
+
.nullish(),
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
export type Gifv = z.infer<typeof Gifv>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/#image
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { BaseMediaAttachment } from "./base.js";
|
|
4
|
+
|
|
5
|
+
export const Image = BaseMediaAttachment.extend({
|
|
6
|
+
type: z
|
|
7
|
+
.literal("image")
|
|
8
|
+
.describe("The type of the attachment (Static image)"),
|
|
9
|
+
meta: z.object({
|
|
10
|
+
original: z.object({
|
|
11
|
+
width: z.number(),
|
|
12
|
+
height: z.number(),
|
|
13
|
+
size: z.string(),
|
|
14
|
+
aspect: z.number(),
|
|
15
|
+
}),
|
|
16
|
+
small: z
|
|
17
|
+
.object({
|
|
18
|
+
width: z.number(),
|
|
19
|
+
height: z.number(),
|
|
20
|
+
size: z.string(),
|
|
21
|
+
aspect: z.number(),
|
|
22
|
+
})
|
|
23
|
+
.nullish(),
|
|
24
|
+
focus: z
|
|
25
|
+
.object({
|
|
26
|
+
x: z.number(),
|
|
27
|
+
y: z.number(),
|
|
28
|
+
})
|
|
29
|
+
.nullish(),
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
export type Image = z.infer<typeof Image>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { Gifv } from "./gifv.js";
|
|
4
|
+
import { Image } from "./image.js";
|
|
5
|
+
import { Video } from "./video.js";
|
|
6
|
+
import { Audio } from "./audio.js";
|
|
7
|
+
import { Unknown } from "./unknown.js";
|
|
8
|
+
|
|
9
|
+
export const MediaAttachment = z.union([Image, Gifv, Video, Audio, Unknown]);
|
|
10
|
+
export type MediaAttachment = z.infer<typeof MediaAttachment>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { BaseMediaAttachment } from "./base.js";
|
|
4
|
+
|
|
5
|
+
export const Unknown = BaseMediaAttachment.extend({
|
|
6
|
+
type: z
|
|
7
|
+
.literal("unknown")
|
|
8
|
+
.describe(
|
|
9
|
+
"The type of the attachment (unsupported or unrecognized file type)"
|
|
10
|
+
),
|
|
11
|
+
});
|
|
12
|
+
export type Unknown = z.infer<typeof Unknown>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// This schema is base on https://docs.joinmastodon.org/entities/MediaAttachment/#video
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { BaseMediaAttachment } from "./base.js";
|
|
4
|
+
|
|
5
|
+
export const Video = BaseMediaAttachment.extend({
|
|
6
|
+
type: z.literal("video").describe("The type of the attachment (Video clip)"),
|
|
7
|
+
meta: z.object({
|
|
8
|
+
length: z.string(),
|
|
9
|
+
duration: z.number(),
|
|
10
|
+
fps: z.number(),
|
|
11
|
+
|
|
12
|
+
size: z.string({
|
|
13
|
+
description: "Video width and height in string wxh format",
|
|
14
|
+
}),
|
|
15
|
+
width: z.number(),
|
|
16
|
+
height: z.number(),
|
|
17
|
+
aspect: z.number({
|
|
18
|
+
description: "Aspect ratio of the video (width/height)",
|
|
19
|
+
}),
|
|
20
|
+
|
|
21
|
+
audio_encode: z.string(),
|
|
22
|
+
audio_bitrate: z.string(),
|
|
23
|
+
audio_channels: z.string(),
|
|
24
|
+
|
|
25
|
+
original: z.object({
|
|
26
|
+
width: z.number(),
|
|
27
|
+
height: z.number(),
|
|
28
|
+
frame_rate: z.string(),
|
|
29
|
+
duration: z.number(),
|
|
30
|
+
bitrate: z.number(),
|
|
31
|
+
}),
|
|
32
|
+
small: z
|
|
33
|
+
.object({
|
|
34
|
+
width: z.number(),
|
|
35
|
+
height: z.number(),
|
|
36
|
+
size: z.string(),
|
|
37
|
+
aspect: z.number(),
|
|
38
|
+
})
|
|
39
|
+
.describe("A video preview in static image")
|
|
40
|
+
.nullish(),
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
export type Video = z.infer<typeof Video>;
|