a tool for shared writing and social publishing
1/**
2 * GENERATED CODE - DO NOT MODIFY
3 */
4import {
5 type LexiconDoc,
6 Lexicons,
7 ValidationError,
8 type ValidationResult,
9} from '@atproto/lexicon'
10import { type $Typed, is$typed, maybe$typed } from './util'
11
12export const schemaDict = {
13 AppBskyActorProfile: {
14 lexicon: 1,
15 id: 'app.bsky.actor.profile',
16 defs: {
17 main: {
18 type: 'record',
19 description: 'A declaration of a Bluesky account profile.',
20 key: 'literal:self',
21 record: {
22 type: 'object',
23 properties: {
24 displayName: {
25 type: 'string',
26 maxGraphemes: 64,
27 maxLength: 640,
28 },
29 description: {
30 type: 'string',
31 description: 'Free-form profile description text.',
32 maxGraphemes: 256,
33 maxLength: 2560,
34 },
35 avatar: {
36 type: 'blob',
37 description:
38 "Small image to be displayed next to posts from account. AKA, 'profile picture'",
39 accept: ['image/png', 'image/jpeg'],
40 maxSize: 1000000,
41 },
42 banner: {
43 type: 'blob',
44 description:
45 'Larger horizontal image to display behind profile view.',
46 accept: ['image/png', 'image/jpeg'],
47 maxSize: 1000000,
48 },
49 labels: {
50 type: 'union',
51 description:
52 'Self-label values, specific to the Bluesky application, on the overall account.',
53 refs: ['lex:com.atproto.label.defs#selfLabels'],
54 },
55 joinedViaStarterPack: {
56 type: 'ref',
57 ref: 'lex:com.atproto.repo.strongRef',
58 },
59 pinnedPost: {
60 type: 'ref',
61 ref: 'lex:com.atproto.repo.strongRef',
62 },
63 createdAt: {
64 type: 'string',
65 format: 'datetime',
66 },
67 },
68 },
69 },
70 },
71 },
72 ComAtprotoLabelDefs: {
73 lexicon: 1,
74 id: 'com.atproto.label.defs',
75 defs: {
76 label: {
77 type: 'object',
78 description:
79 'Metadata tag on an atproto resource (eg, repo or record).',
80 required: ['src', 'uri', 'val', 'cts'],
81 properties: {
82 ver: {
83 type: 'integer',
84 description: 'The AT Protocol version of the label object.',
85 },
86 src: {
87 type: 'string',
88 format: 'did',
89 description: 'DID of the actor who created this label.',
90 },
91 uri: {
92 type: 'string',
93 format: 'uri',
94 description:
95 'AT URI of the record, repository (account), or other resource that this label applies to.',
96 },
97 cid: {
98 type: 'string',
99 format: 'cid',
100 description:
101 "Optionally, CID specifying the specific version of 'uri' resource this label applies to.",
102 },
103 val: {
104 type: 'string',
105 maxLength: 128,
106 description:
107 'The short string name of the value or type of this label.',
108 },
109 neg: {
110 type: 'boolean',
111 description:
112 'If true, this is a negation label, overwriting a previous label.',
113 },
114 cts: {
115 type: 'string',
116 format: 'datetime',
117 description: 'Timestamp when this label was created.',
118 },
119 exp: {
120 type: 'string',
121 format: 'datetime',
122 description:
123 'Timestamp at which this label expires (no longer applies).',
124 },
125 sig: {
126 type: 'bytes',
127 description: 'Signature of dag-cbor encoded label.',
128 },
129 },
130 },
131 selfLabels: {
132 type: 'object',
133 description:
134 'Metadata tags on an atproto record, published by the author within the record.',
135 required: ['values'],
136 properties: {
137 values: {
138 type: 'array',
139 items: {
140 type: 'ref',
141 ref: 'lex:com.atproto.label.defs#selfLabel',
142 },
143 maxLength: 10,
144 },
145 },
146 },
147 selfLabel: {
148 type: 'object',
149 description:
150 'Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.',
151 required: ['val'],
152 properties: {
153 val: {
154 type: 'string',
155 maxLength: 128,
156 description:
157 'The short string name of the value or type of this label.',
158 },
159 },
160 },
161 labelValueDefinition: {
162 type: 'object',
163 description:
164 'Declares a label value and its expected interpretations and behaviors.',
165 required: ['identifier', 'severity', 'blurs', 'locales'],
166 properties: {
167 identifier: {
168 type: 'string',
169 description:
170 "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).",
171 maxLength: 100,
172 maxGraphemes: 100,
173 },
174 severity: {
175 type: 'string',
176 description:
177 "How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.",
178 knownValues: ['inform', 'alert', 'none'],
179 },
180 blurs: {
181 type: 'string',
182 description:
183 "What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing.",
184 knownValues: ['content', 'media', 'none'],
185 },
186 defaultSetting: {
187 type: 'string',
188 description: 'The default setting for this label.',
189 knownValues: ['ignore', 'warn', 'hide'],
190 default: 'warn',
191 },
192 adultOnly: {
193 type: 'boolean',
194 description:
195 'Does the user need to have adult content enabled in order to configure this label?',
196 },
197 locales: {
198 type: 'array',
199 items: {
200 type: 'ref',
201 ref: 'lex:com.atproto.label.defs#labelValueDefinitionStrings',
202 },
203 },
204 },
205 },
206 labelValueDefinitionStrings: {
207 type: 'object',
208 description:
209 'Strings which describe the label in the UI, localized into a specific language.',
210 required: ['lang', 'name', 'description'],
211 properties: {
212 lang: {
213 type: 'string',
214 description:
215 'The code of the language these strings are written in.',
216 format: 'language',
217 },
218 name: {
219 type: 'string',
220 description: 'A short human-readable name for the label.',
221 maxGraphemes: 64,
222 maxLength: 640,
223 },
224 description: {
225 type: 'string',
226 description:
227 'A longer description of what the label means and why it might be applied.',
228 maxGraphemes: 10000,
229 maxLength: 100000,
230 },
231 },
232 },
233 labelValue: {
234 type: 'string',
235 knownValues: [
236 '!hide',
237 '!no-promote',
238 '!warn',
239 '!no-unauthenticated',
240 'dmca-violation',
241 'doxxing',
242 'porn',
243 'sexual',
244 'nudity',
245 'nsfl',
246 'gore',
247 ],
248 },
249 },
250 },
251 ComAtprotoRepoApplyWrites: {
252 lexicon: 1,
253 id: 'com.atproto.repo.applyWrites',
254 defs: {
255 main: {
256 type: 'procedure',
257 description:
258 'Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS.',
259 input: {
260 encoding: 'application/json',
261 schema: {
262 type: 'object',
263 required: ['repo', 'writes'],
264 properties: {
265 repo: {
266 type: 'string',
267 format: 'at-identifier',
268 description:
269 'The handle or DID of the repo (aka, current account).',
270 },
271 validate: {
272 type: 'boolean',
273 description:
274 "Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons.",
275 },
276 writes: {
277 type: 'array',
278 items: {
279 type: 'union',
280 refs: [
281 'lex:com.atproto.repo.applyWrites#create',
282 'lex:com.atproto.repo.applyWrites#update',
283 'lex:com.atproto.repo.applyWrites#delete',
284 ],
285 closed: true,
286 },
287 },
288 swapCommit: {
289 type: 'string',
290 description:
291 'If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations.',
292 format: 'cid',
293 },
294 },
295 },
296 },
297 output: {
298 encoding: 'application/json',
299 schema: {
300 type: 'object',
301 required: [],
302 properties: {
303 commit: {
304 type: 'ref',
305 ref: 'lex:com.atproto.repo.defs#commitMeta',
306 },
307 results: {
308 type: 'array',
309 items: {
310 type: 'union',
311 refs: [
312 'lex:com.atproto.repo.applyWrites#createResult',
313 'lex:com.atproto.repo.applyWrites#updateResult',
314 'lex:com.atproto.repo.applyWrites#deleteResult',
315 ],
316 closed: true,
317 },
318 },
319 },
320 },
321 },
322 errors: [
323 {
324 name: 'InvalidSwap',
325 description:
326 "Indicates that the 'swapCommit' parameter did not match current commit.",
327 },
328 ],
329 },
330 create: {
331 type: 'object',
332 description: 'Operation which creates a new record.',
333 required: ['collection', 'value'],
334 properties: {
335 collection: {
336 type: 'string',
337 format: 'nsid',
338 },
339 rkey: {
340 type: 'string',
341 maxLength: 512,
342 format: 'record-key',
343 description:
344 'NOTE: maxLength is redundant with record-key format. Keeping it temporarily to ensure backwards compatibility.',
345 },
346 value: {
347 type: 'unknown',
348 },
349 },
350 },
351 update: {
352 type: 'object',
353 description: 'Operation which updates an existing record.',
354 required: ['collection', 'rkey', 'value'],
355 properties: {
356 collection: {
357 type: 'string',
358 format: 'nsid',
359 },
360 rkey: {
361 type: 'string',
362 format: 'record-key',
363 },
364 value: {
365 type: 'unknown',
366 },
367 },
368 },
369 delete: {
370 type: 'object',
371 description: 'Operation which deletes an existing record.',
372 required: ['collection', 'rkey'],
373 properties: {
374 collection: {
375 type: 'string',
376 format: 'nsid',
377 },
378 rkey: {
379 type: 'string',
380 format: 'record-key',
381 },
382 },
383 },
384 createResult: {
385 type: 'object',
386 required: ['uri', 'cid'],
387 properties: {
388 uri: {
389 type: 'string',
390 format: 'at-uri',
391 },
392 cid: {
393 type: 'string',
394 format: 'cid',
395 },
396 validationStatus: {
397 type: 'string',
398 knownValues: ['valid', 'unknown'],
399 },
400 },
401 },
402 updateResult: {
403 type: 'object',
404 required: ['uri', 'cid'],
405 properties: {
406 uri: {
407 type: 'string',
408 format: 'at-uri',
409 },
410 cid: {
411 type: 'string',
412 format: 'cid',
413 },
414 validationStatus: {
415 type: 'string',
416 knownValues: ['valid', 'unknown'],
417 },
418 },
419 },
420 deleteResult: {
421 type: 'object',
422 required: [],
423 properties: {},
424 },
425 },
426 },
427 ComAtprotoRepoCreateRecord: {
428 lexicon: 1,
429 id: 'com.atproto.repo.createRecord',
430 defs: {
431 main: {
432 type: 'procedure',
433 description:
434 'Create a single new repository record. Requires auth, implemented by PDS.',
435 input: {
436 encoding: 'application/json',
437 schema: {
438 type: 'object',
439 required: ['repo', 'collection', 'record'],
440 properties: {
441 repo: {
442 type: 'string',
443 format: 'at-identifier',
444 description:
445 'The handle or DID of the repo (aka, current account).',
446 },
447 collection: {
448 type: 'string',
449 format: 'nsid',
450 description: 'The NSID of the record collection.',
451 },
452 rkey: {
453 type: 'string',
454 format: 'record-key',
455 description: 'The Record Key.',
456 maxLength: 512,
457 },
458 validate: {
459 type: 'boolean',
460 description:
461 "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.",
462 },
463 record: {
464 type: 'unknown',
465 description: 'The record itself. Must contain a $type field.',
466 },
467 swapCommit: {
468 type: 'string',
469 format: 'cid',
470 description:
471 'Compare and swap with the previous commit by CID.',
472 },
473 },
474 },
475 },
476 output: {
477 encoding: 'application/json',
478 schema: {
479 type: 'object',
480 required: ['uri', 'cid'],
481 properties: {
482 uri: {
483 type: 'string',
484 format: 'at-uri',
485 },
486 cid: {
487 type: 'string',
488 format: 'cid',
489 },
490 commit: {
491 type: 'ref',
492 ref: 'lex:com.atproto.repo.defs#commitMeta',
493 },
494 validationStatus: {
495 type: 'string',
496 knownValues: ['valid', 'unknown'],
497 },
498 },
499 },
500 },
501 errors: [
502 {
503 name: 'InvalidSwap',
504 description:
505 "Indicates that 'swapCommit' didn't match current repo commit.",
506 },
507 ],
508 },
509 },
510 },
511 ComAtprotoRepoDefs: {
512 lexicon: 1,
513 id: 'com.atproto.repo.defs',
514 defs: {
515 commitMeta: {
516 type: 'object',
517 required: ['cid', 'rev'],
518 properties: {
519 cid: {
520 type: 'string',
521 format: 'cid',
522 },
523 rev: {
524 type: 'string',
525 format: 'tid',
526 },
527 },
528 },
529 },
530 },
531 ComAtprotoRepoDeleteRecord: {
532 lexicon: 1,
533 id: 'com.atproto.repo.deleteRecord',
534 defs: {
535 main: {
536 type: 'procedure',
537 description:
538 "Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.",
539 input: {
540 encoding: 'application/json',
541 schema: {
542 type: 'object',
543 required: ['repo', 'collection', 'rkey'],
544 properties: {
545 repo: {
546 type: 'string',
547 format: 'at-identifier',
548 description:
549 'The handle or DID of the repo (aka, current account).',
550 },
551 collection: {
552 type: 'string',
553 format: 'nsid',
554 description: 'The NSID of the record collection.',
555 },
556 rkey: {
557 type: 'string',
558 format: 'record-key',
559 description: 'The Record Key.',
560 },
561 swapRecord: {
562 type: 'string',
563 format: 'cid',
564 description:
565 'Compare and swap with the previous record by CID.',
566 },
567 swapCommit: {
568 type: 'string',
569 format: 'cid',
570 description:
571 'Compare and swap with the previous commit by CID.',
572 },
573 },
574 },
575 },
576 output: {
577 encoding: 'application/json',
578 schema: {
579 type: 'object',
580 properties: {
581 commit: {
582 type: 'ref',
583 ref: 'lex:com.atproto.repo.defs#commitMeta',
584 },
585 },
586 },
587 },
588 errors: [
589 {
590 name: 'InvalidSwap',
591 },
592 ],
593 },
594 },
595 },
596 ComAtprotoRepoDescribeRepo: {
597 lexicon: 1,
598 id: 'com.atproto.repo.describeRepo',
599 defs: {
600 main: {
601 type: 'query',
602 description:
603 'Get information about an account and repository, including the list of collections. Does not require auth.',
604 parameters: {
605 type: 'params',
606 required: ['repo'],
607 properties: {
608 repo: {
609 type: 'string',
610 format: 'at-identifier',
611 description: 'The handle or DID of the repo.',
612 },
613 },
614 },
615 output: {
616 encoding: 'application/json',
617 schema: {
618 type: 'object',
619 required: [
620 'handle',
621 'did',
622 'didDoc',
623 'collections',
624 'handleIsCorrect',
625 ],
626 properties: {
627 handle: {
628 type: 'string',
629 format: 'handle',
630 },
631 did: {
632 type: 'string',
633 format: 'did',
634 },
635 didDoc: {
636 type: 'unknown',
637 description: 'The complete DID document for this account.',
638 },
639 collections: {
640 type: 'array',
641 description:
642 'List of all the collections (NSIDs) for which this repo contains at least one record.',
643 items: {
644 type: 'string',
645 format: 'nsid',
646 },
647 },
648 handleIsCorrect: {
649 type: 'boolean',
650 description:
651 'Indicates if handle is currently valid (resolves bi-directionally)',
652 },
653 },
654 },
655 },
656 },
657 },
658 },
659 ComAtprotoRepoGetRecord: {
660 lexicon: 1,
661 id: 'com.atproto.repo.getRecord',
662 defs: {
663 main: {
664 type: 'query',
665 description:
666 'Get a single record from a repository. Does not require auth.',
667 parameters: {
668 type: 'params',
669 required: ['repo', 'collection', 'rkey'],
670 properties: {
671 repo: {
672 type: 'string',
673 format: 'at-identifier',
674 description: 'The handle or DID of the repo.',
675 },
676 collection: {
677 type: 'string',
678 format: 'nsid',
679 description: 'The NSID of the record collection.',
680 },
681 rkey: {
682 type: 'string',
683 description: 'The Record Key.',
684 format: 'record-key',
685 },
686 cid: {
687 type: 'string',
688 format: 'cid',
689 description:
690 'The CID of the version of the record. If not specified, then return the most recent version.',
691 },
692 },
693 },
694 output: {
695 encoding: 'application/json',
696 schema: {
697 type: 'object',
698 required: ['uri', 'value'],
699 properties: {
700 uri: {
701 type: 'string',
702 format: 'at-uri',
703 },
704 cid: {
705 type: 'string',
706 format: 'cid',
707 },
708 value: {
709 type: 'unknown',
710 },
711 },
712 },
713 },
714 errors: [
715 {
716 name: 'RecordNotFound',
717 },
718 ],
719 },
720 },
721 },
722 ComAtprotoRepoImportRepo: {
723 lexicon: 1,
724 id: 'com.atproto.repo.importRepo',
725 defs: {
726 main: {
727 type: 'procedure',
728 description:
729 'Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.',
730 input: {
731 encoding: 'application/vnd.ipld.car',
732 },
733 },
734 },
735 },
736 ComAtprotoRepoListMissingBlobs: {
737 lexicon: 1,
738 id: 'com.atproto.repo.listMissingBlobs',
739 defs: {
740 main: {
741 type: 'query',
742 description:
743 'Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.',
744 parameters: {
745 type: 'params',
746 properties: {
747 limit: {
748 type: 'integer',
749 minimum: 1,
750 maximum: 1000,
751 default: 500,
752 },
753 cursor: {
754 type: 'string',
755 },
756 },
757 },
758 output: {
759 encoding: 'application/json',
760 schema: {
761 type: 'object',
762 required: ['blobs'],
763 properties: {
764 cursor: {
765 type: 'string',
766 },
767 blobs: {
768 type: 'array',
769 items: {
770 type: 'ref',
771 ref: 'lex:com.atproto.repo.listMissingBlobs#recordBlob',
772 },
773 },
774 },
775 },
776 },
777 },
778 recordBlob: {
779 type: 'object',
780 required: ['cid', 'recordUri'],
781 properties: {
782 cid: {
783 type: 'string',
784 format: 'cid',
785 },
786 recordUri: {
787 type: 'string',
788 format: 'at-uri',
789 },
790 },
791 },
792 },
793 },
794 ComAtprotoRepoListRecords: {
795 lexicon: 1,
796 id: 'com.atproto.repo.listRecords',
797 defs: {
798 main: {
799 type: 'query',
800 description:
801 'List a range of records in a repository, matching a specific collection. Does not require auth.',
802 parameters: {
803 type: 'params',
804 required: ['repo', 'collection'],
805 properties: {
806 repo: {
807 type: 'string',
808 format: 'at-identifier',
809 description: 'The handle or DID of the repo.',
810 },
811 collection: {
812 type: 'string',
813 format: 'nsid',
814 description: 'The NSID of the record type.',
815 },
816 limit: {
817 type: 'integer',
818 minimum: 1,
819 maximum: 100,
820 default: 50,
821 description: 'The number of records to return.',
822 },
823 cursor: {
824 type: 'string',
825 },
826 rkeyStart: {
827 type: 'string',
828 description:
829 'DEPRECATED: The lowest sort-ordered rkey to start from (exclusive)',
830 },
831 rkeyEnd: {
832 type: 'string',
833 description:
834 'DEPRECATED: The highest sort-ordered rkey to stop at (exclusive)',
835 },
836 reverse: {
837 type: 'boolean',
838 description: 'Flag to reverse the order of the returned records.',
839 },
840 },
841 },
842 output: {
843 encoding: 'application/json',
844 schema: {
845 type: 'object',
846 required: ['records'],
847 properties: {
848 cursor: {
849 type: 'string',
850 },
851 records: {
852 type: 'array',
853 items: {
854 type: 'ref',
855 ref: 'lex:com.atproto.repo.listRecords#record',
856 },
857 },
858 },
859 },
860 },
861 },
862 record: {
863 type: 'object',
864 required: ['uri', 'cid', 'value'],
865 properties: {
866 uri: {
867 type: 'string',
868 format: 'at-uri',
869 },
870 cid: {
871 type: 'string',
872 format: 'cid',
873 },
874 value: {
875 type: 'unknown',
876 },
877 },
878 },
879 },
880 },
881 ComAtprotoRepoPutRecord: {
882 lexicon: 1,
883 id: 'com.atproto.repo.putRecord',
884 defs: {
885 main: {
886 type: 'procedure',
887 description:
888 'Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.',
889 input: {
890 encoding: 'application/json',
891 schema: {
892 type: 'object',
893 required: ['repo', 'collection', 'rkey', 'record'],
894 nullable: ['swapRecord'],
895 properties: {
896 repo: {
897 type: 'string',
898 format: 'at-identifier',
899 description:
900 'The handle or DID of the repo (aka, current account).',
901 },
902 collection: {
903 type: 'string',
904 format: 'nsid',
905 description: 'The NSID of the record collection.',
906 },
907 rkey: {
908 type: 'string',
909 format: 'record-key',
910 description: 'The Record Key.',
911 maxLength: 512,
912 },
913 validate: {
914 type: 'boolean',
915 description:
916 "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.",
917 },
918 record: {
919 type: 'unknown',
920 description: 'The record to write.',
921 },
922 swapRecord: {
923 type: 'string',
924 format: 'cid',
925 description:
926 'Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation',
927 },
928 swapCommit: {
929 type: 'string',
930 format: 'cid',
931 description:
932 'Compare and swap with the previous commit by CID.',
933 },
934 },
935 },
936 },
937 output: {
938 encoding: 'application/json',
939 schema: {
940 type: 'object',
941 required: ['uri', 'cid'],
942 properties: {
943 uri: {
944 type: 'string',
945 format: 'at-uri',
946 },
947 cid: {
948 type: 'string',
949 format: 'cid',
950 },
951 commit: {
952 type: 'ref',
953 ref: 'lex:com.atproto.repo.defs#commitMeta',
954 },
955 validationStatus: {
956 type: 'string',
957 knownValues: ['valid', 'unknown'],
958 },
959 },
960 },
961 },
962 errors: [
963 {
964 name: 'InvalidSwap',
965 },
966 ],
967 },
968 },
969 },
970 ComAtprotoRepoStrongRef: {
971 lexicon: 1,
972 id: 'com.atproto.repo.strongRef',
973 description: 'A URI with a content-hash fingerprint.',
974 defs: {
975 main: {
976 type: 'object',
977 required: ['uri', 'cid'],
978 properties: {
979 uri: {
980 type: 'string',
981 format: 'at-uri',
982 },
983 cid: {
984 type: 'string',
985 format: 'cid',
986 },
987 },
988 },
989 },
990 },
991 ComAtprotoRepoUploadBlob: {
992 lexicon: 1,
993 id: 'com.atproto.repo.uploadBlob',
994 defs: {
995 main: {
996 type: 'procedure',
997 description:
998 'Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS.',
999 input: {
1000 encoding: '*/*',
1001 },
1002 output: {
1003 encoding: 'application/json',
1004 schema: {
1005 type: 'object',
1006 required: ['blob'],
1007 properties: {
1008 blob: {
1009 type: 'blob',
1010 },
1011 },
1012 },
1013 },
1014 },
1015 },
1016 },
1017 PubLeafletBlocksBlockquote: {
1018 lexicon: 1,
1019 id: 'pub.leaflet.blocks.blockquote',
1020 defs: {
1021 main: {
1022 type: 'object',
1023 required: ['plaintext'],
1024 properties: {
1025 plaintext: {
1026 type: 'string',
1027 },
1028 facets: {
1029 type: 'array',
1030 items: {
1031 type: 'ref',
1032 ref: 'lex:pub.leaflet.richtext.facet',
1033 },
1034 },
1035 },
1036 },
1037 },
1038 },
1039 PubLeafletBlocksBskyPost: {
1040 lexicon: 1,
1041 id: 'pub.leaflet.blocks.bskyPost',
1042 defs: {
1043 main: {
1044 type: 'object',
1045 required: ['postRef'],
1046 properties: {
1047 postRef: {
1048 type: 'ref',
1049 ref: 'lex:com.atproto.repo.strongRef',
1050 },
1051 clientHost: {
1052 type: 'string',
1053 },
1054 },
1055 },
1056 },
1057 },
1058 PubLeafletBlocksButton: {
1059 lexicon: 1,
1060 id: 'pub.leaflet.blocks.button',
1061 defs: {
1062 main: {
1063 type: 'object',
1064 required: ['text', 'url'],
1065 properties: {
1066 text: {
1067 type: 'string',
1068 },
1069 url: {
1070 type: 'string',
1071 format: 'uri',
1072 },
1073 },
1074 },
1075 },
1076 },
1077 PubLeafletBlocksCode: {
1078 lexicon: 1,
1079 id: 'pub.leaflet.blocks.code',
1080 defs: {
1081 main: {
1082 type: 'object',
1083 required: ['plaintext'],
1084 properties: {
1085 plaintext: {
1086 type: 'string',
1087 },
1088 language: {
1089 type: 'string',
1090 },
1091 syntaxHighlightingTheme: {
1092 type: 'string',
1093 },
1094 },
1095 },
1096 },
1097 },
1098 PubLeafletBlocksHeader: {
1099 lexicon: 1,
1100 id: 'pub.leaflet.blocks.header',
1101 defs: {
1102 main: {
1103 type: 'object',
1104 required: ['plaintext'],
1105 properties: {
1106 level: {
1107 type: 'integer',
1108 minimum: 1,
1109 maximum: 6,
1110 },
1111 plaintext: {
1112 type: 'string',
1113 },
1114 facets: {
1115 type: 'array',
1116 items: {
1117 type: 'ref',
1118 ref: 'lex:pub.leaflet.richtext.facet',
1119 },
1120 },
1121 },
1122 },
1123 },
1124 },
1125 PubLeafletBlocksHorizontalRule: {
1126 lexicon: 1,
1127 id: 'pub.leaflet.blocks.horizontalRule',
1128 defs: {
1129 main: {
1130 type: 'object',
1131 required: [],
1132 properties: {},
1133 },
1134 },
1135 },
1136 PubLeafletBlocksIframe: {
1137 lexicon: 1,
1138 id: 'pub.leaflet.blocks.iframe',
1139 defs: {
1140 main: {
1141 type: 'object',
1142 required: ['url'],
1143 properties: {
1144 url: {
1145 type: 'string',
1146 format: 'uri',
1147 },
1148 height: {
1149 type: 'integer',
1150 minimum: 16,
1151 maximum: 1600,
1152 },
1153 },
1154 },
1155 },
1156 },
1157 PubLeafletBlocksImage: {
1158 lexicon: 1,
1159 id: 'pub.leaflet.blocks.image',
1160 defs: {
1161 main: {
1162 type: 'object',
1163 required: ['image', 'aspectRatio'],
1164 properties: {
1165 image: {
1166 type: 'blob',
1167 accept: ['image/*'],
1168 maxSize: 1000000,
1169 },
1170 alt: {
1171 type: 'string',
1172 description:
1173 'Alt text description of the image, for accessibility.',
1174 },
1175 aspectRatio: {
1176 type: 'ref',
1177 ref: 'lex:pub.leaflet.blocks.image#aspectRatio',
1178 },
1179 },
1180 },
1181 aspectRatio: {
1182 type: 'object',
1183 required: ['width', 'height'],
1184 properties: {
1185 width: {
1186 type: 'integer',
1187 },
1188 height: {
1189 type: 'integer',
1190 },
1191 },
1192 },
1193 },
1194 },
1195 PubLeafletBlocksMath: {
1196 lexicon: 1,
1197 id: 'pub.leaflet.blocks.math',
1198 defs: {
1199 main: {
1200 type: 'object',
1201 required: ['tex'],
1202 properties: {
1203 tex: {
1204 type: 'string',
1205 },
1206 },
1207 },
1208 },
1209 },
1210 PubLeafletBlocksPage: {
1211 lexicon: 1,
1212 id: 'pub.leaflet.blocks.page',
1213 defs: {
1214 main: {
1215 type: 'object',
1216 required: ['id'],
1217 properties: {
1218 id: {
1219 type: 'string',
1220 },
1221 },
1222 },
1223 },
1224 },
1225 PubLeafletBlocksPoll: {
1226 lexicon: 1,
1227 id: 'pub.leaflet.blocks.poll',
1228 defs: {
1229 main: {
1230 type: 'object',
1231 required: ['pollRef'],
1232 properties: {
1233 pollRef: {
1234 type: 'ref',
1235 ref: 'lex:com.atproto.repo.strongRef',
1236 },
1237 },
1238 },
1239 },
1240 },
1241 PubLeafletBlocksText: {
1242 lexicon: 1,
1243 id: 'pub.leaflet.blocks.text',
1244 defs: {
1245 main: {
1246 type: 'object',
1247 required: ['plaintext'],
1248 properties: {
1249 plaintext: {
1250 type: 'string',
1251 },
1252 textSize: {
1253 type: 'string',
1254 enum: ['default', 'small', 'large'],
1255 },
1256 facets: {
1257 type: 'array',
1258 items: {
1259 type: 'ref',
1260 ref: 'lex:pub.leaflet.richtext.facet',
1261 },
1262 },
1263 },
1264 },
1265 },
1266 },
1267 PubLeafletBlocksUnorderedList: {
1268 lexicon: 1,
1269 id: 'pub.leaflet.blocks.unorderedList',
1270 defs: {
1271 main: {
1272 type: 'object',
1273 required: ['children'],
1274 properties: {
1275 children: {
1276 type: 'array',
1277 items: {
1278 type: 'ref',
1279 ref: 'lex:pub.leaflet.blocks.unorderedList#listItem',
1280 },
1281 },
1282 },
1283 },
1284 listItem: {
1285 type: 'object',
1286 required: ['content'],
1287 properties: {
1288 content: {
1289 type: 'union',
1290 refs: [
1291 'lex:pub.leaflet.blocks.text',
1292 'lex:pub.leaflet.blocks.header',
1293 'lex:pub.leaflet.blocks.image',
1294 ],
1295 },
1296 children: {
1297 type: 'array',
1298 items: {
1299 type: 'ref',
1300 ref: 'lex:pub.leaflet.blocks.unorderedList#listItem',
1301 },
1302 },
1303 },
1304 },
1305 },
1306 },
1307 PubLeafletBlocksWebsite: {
1308 lexicon: 1,
1309 id: 'pub.leaflet.blocks.website',
1310 defs: {
1311 main: {
1312 type: 'object',
1313 required: ['src'],
1314 properties: {
1315 previewImage: {
1316 type: 'blob',
1317 accept: ['image/*'],
1318 maxSize: 1000000,
1319 },
1320 title: {
1321 type: 'string',
1322 },
1323 description: {
1324 type: 'string',
1325 },
1326 src: {
1327 type: 'string',
1328 format: 'uri',
1329 },
1330 },
1331 },
1332 },
1333 },
1334 PubLeafletComment: {
1335 lexicon: 1,
1336 id: 'pub.leaflet.comment',
1337 revision: 1,
1338 description: 'A lexicon for comments on documents',
1339 defs: {
1340 main: {
1341 type: 'record',
1342 key: 'tid',
1343 description: 'Record containing a comment',
1344 record: {
1345 type: 'object',
1346 required: ['subject', 'plaintext', 'createdAt'],
1347 properties: {
1348 subject: {
1349 type: 'string',
1350 format: 'at-uri',
1351 },
1352 createdAt: {
1353 type: 'string',
1354 format: 'datetime',
1355 },
1356 reply: {
1357 type: 'ref',
1358 ref: 'lex:pub.leaflet.comment#replyRef',
1359 },
1360 plaintext: {
1361 type: 'string',
1362 },
1363 facets: {
1364 type: 'array',
1365 items: {
1366 type: 'ref',
1367 ref: 'lex:pub.leaflet.richtext.facet',
1368 },
1369 },
1370 onPage: {
1371 type: 'string',
1372 },
1373 attachment: {
1374 type: 'union',
1375 refs: ['lex:pub.leaflet.comment#linearDocumentQuote'],
1376 },
1377 },
1378 },
1379 },
1380 linearDocumentQuote: {
1381 type: 'object',
1382 required: ['document', 'quote'],
1383 properties: {
1384 document: {
1385 type: 'string',
1386 format: 'at-uri',
1387 },
1388 quote: {
1389 type: 'ref',
1390 ref: 'lex:pub.leaflet.pages.linearDocument#quote',
1391 },
1392 },
1393 },
1394 replyRef: {
1395 type: 'object',
1396 required: ['parent'],
1397 properties: {
1398 parent: {
1399 type: 'string',
1400 format: 'at-uri',
1401 },
1402 },
1403 },
1404 },
1405 },
1406 PubLeafletContent: {
1407 lexicon: 1,
1408 id: 'pub.leaflet.content',
1409 revision: 1,
1410 description: 'A lexicon for long form rich media documents',
1411 defs: {
1412 main: {
1413 type: 'object',
1414 description: 'Content format for leaflet documents',
1415 required: ['pages'],
1416 properties: {
1417 pages: {
1418 type: 'array',
1419 items: {
1420 type: 'union',
1421 refs: [
1422 'lex:pub.leaflet.pages.linearDocument',
1423 'lex:pub.leaflet.pages.canvas',
1424 ],
1425 },
1426 },
1427 },
1428 },
1429 },
1430 },
1431 PubLeafletDocument: {
1432 lexicon: 1,
1433 id: 'pub.leaflet.document',
1434 revision: 1,
1435 description: 'A lexicon for long form rich media documents',
1436 defs: {
1437 main: {
1438 type: 'record',
1439 key: 'tid',
1440 description: 'Record containing a document',
1441 record: {
1442 type: 'object',
1443 required: ['pages', 'author', 'title'],
1444 properties: {
1445 title: {
1446 type: 'string',
1447 maxLength: 5000,
1448 maxGraphemes: 500,
1449 },
1450 postRef: {
1451 type: 'ref',
1452 ref: 'lex:com.atproto.repo.strongRef',
1453 },
1454 description: {
1455 type: 'string',
1456 maxLength: 30000,
1457 maxGraphemes: 3000,
1458 },
1459 publishedAt: {
1460 type: 'string',
1461 format: 'datetime',
1462 },
1463 publication: {
1464 type: 'string',
1465 format: 'at-uri',
1466 },
1467 author: {
1468 type: 'string',
1469 format: 'at-identifier',
1470 },
1471 theme: {
1472 type: 'ref',
1473 ref: 'lex:pub.leaflet.publication#theme',
1474 },
1475 preferences: {
1476 type: 'ref',
1477 ref: 'lex:pub.leaflet.publication#preferences',
1478 },
1479 tags: {
1480 type: 'array',
1481 items: {
1482 type: 'string',
1483 maxLength: 50,
1484 },
1485 },
1486 coverImage: {
1487 type: 'blob',
1488 accept: ['image/png', 'image/jpeg', 'image/webp'],
1489 maxSize: 1000000,
1490 },
1491 pages: {
1492 type: 'array',
1493 items: {
1494 type: 'union',
1495 refs: [
1496 'lex:pub.leaflet.pages.linearDocument',
1497 'lex:pub.leaflet.pages.canvas',
1498 ],
1499 },
1500 },
1501 },
1502 },
1503 },
1504 },
1505 },
1506 PubLeafletGraphSubscription: {
1507 lexicon: 1,
1508 id: 'pub.leaflet.graph.subscription',
1509 defs: {
1510 main: {
1511 type: 'record',
1512 key: 'tid',
1513 description: 'Record declaring a subscription to a publication',
1514 record: {
1515 type: 'object',
1516 required: ['publication'],
1517 properties: {
1518 publication: {
1519 type: 'string',
1520 format: 'at-uri',
1521 },
1522 },
1523 },
1524 },
1525 },
1526 },
1527 PubLeafletInteractionsRecommend: {
1528 lexicon: 1,
1529 id: 'pub.leaflet.interactions.recommend',
1530 defs: {
1531 main: {
1532 type: 'record',
1533 key: 'tid',
1534 description: 'Record representing a recommend on a document',
1535 record: {
1536 type: 'object',
1537 required: ['subject', 'createdAt'],
1538 properties: {
1539 subject: {
1540 type: 'string',
1541 format: 'at-uri',
1542 },
1543 createdAt: {
1544 type: 'string',
1545 format: 'datetime',
1546 },
1547 },
1548 },
1549 },
1550 },
1551 },
1552 PubLeafletPagesCanvas: {
1553 lexicon: 1,
1554 id: 'pub.leaflet.pages.canvas',
1555 defs: {
1556 main: {
1557 type: 'object',
1558 required: ['blocks'],
1559 properties: {
1560 id: {
1561 type: 'string',
1562 },
1563 blocks: {
1564 type: 'array',
1565 items: {
1566 type: 'ref',
1567 ref: 'lex:pub.leaflet.pages.canvas#block',
1568 },
1569 },
1570 },
1571 },
1572 block: {
1573 type: 'object',
1574 required: ['block', 'x', 'y', 'width'],
1575 properties: {
1576 block: {
1577 type: 'union',
1578 refs: [
1579 'lex:pub.leaflet.blocks.iframe',
1580 'lex:pub.leaflet.blocks.text',
1581 'lex:pub.leaflet.blocks.blockquote',
1582 'lex:pub.leaflet.blocks.header',
1583 'lex:pub.leaflet.blocks.image',
1584 'lex:pub.leaflet.blocks.unorderedList',
1585 'lex:pub.leaflet.blocks.website',
1586 'lex:pub.leaflet.blocks.math',
1587 'lex:pub.leaflet.blocks.code',
1588 'lex:pub.leaflet.blocks.horizontalRule',
1589 'lex:pub.leaflet.blocks.bskyPost',
1590 'lex:pub.leaflet.blocks.page',
1591 'lex:pub.leaflet.blocks.poll',
1592 'lex:pub.leaflet.blocks.button',
1593 ],
1594 },
1595 x: {
1596 type: 'integer',
1597 },
1598 y: {
1599 type: 'integer',
1600 },
1601 width: {
1602 type: 'integer',
1603 },
1604 height: {
1605 type: 'integer',
1606 },
1607 rotation: {
1608 type: 'integer',
1609 description: 'The rotation of the block in degrees',
1610 },
1611 },
1612 },
1613 textAlignLeft: {
1614 type: 'token',
1615 },
1616 textAlignCenter: {
1617 type: 'token',
1618 },
1619 textAlignRight: {
1620 type: 'token',
1621 },
1622 quote: {
1623 type: 'object',
1624 required: ['start', 'end'],
1625 properties: {
1626 start: {
1627 type: 'ref',
1628 ref: 'lex:pub.leaflet.pages.canvas#position',
1629 },
1630 end: {
1631 type: 'ref',
1632 ref: 'lex:pub.leaflet.pages.canvas#position',
1633 },
1634 },
1635 },
1636 position: {
1637 type: 'object',
1638 required: ['block', 'offset'],
1639 properties: {
1640 block: {
1641 type: 'array',
1642 items: {
1643 type: 'integer',
1644 },
1645 },
1646 offset: {
1647 type: 'integer',
1648 },
1649 },
1650 },
1651 },
1652 },
1653 PubLeafletPagesLinearDocument: {
1654 lexicon: 1,
1655 id: 'pub.leaflet.pages.linearDocument',
1656 defs: {
1657 main: {
1658 type: 'object',
1659 required: ['blocks'],
1660 properties: {
1661 id: {
1662 type: 'string',
1663 },
1664 blocks: {
1665 type: 'array',
1666 items: {
1667 type: 'ref',
1668 ref: 'lex:pub.leaflet.pages.linearDocument#block',
1669 },
1670 },
1671 },
1672 },
1673 block: {
1674 type: 'object',
1675 required: ['block'],
1676 properties: {
1677 block: {
1678 type: 'union',
1679 refs: [
1680 'lex:pub.leaflet.blocks.iframe',
1681 'lex:pub.leaflet.blocks.text',
1682 'lex:pub.leaflet.blocks.blockquote',
1683 'lex:pub.leaflet.blocks.header',
1684 'lex:pub.leaflet.blocks.image',
1685 'lex:pub.leaflet.blocks.unorderedList',
1686 'lex:pub.leaflet.blocks.website',
1687 'lex:pub.leaflet.blocks.math',
1688 'lex:pub.leaflet.blocks.code',
1689 'lex:pub.leaflet.blocks.horizontalRule',
1690 'lex:pub.leaflet.blocks.bskyPost',
1691 'lex:pub.leaflet.blocks.page',
1692 'lex:pub.leaflet.blocks.poll',
1693 'lex:pub.leaflet.blocks.button',
1694 ],
1695 },
1696 alignment: {
1697 type: 'string',
1698 knownValues: [
1699 'lex:pub.leaflet.pages.linearDocument#textAlignLeft',
1700 'lex:pub.leaflet.pages.linearDocument#textAlignCenter',
1701 'lex:pub.leaflet.pages.linearDocument#textAlignRight',
1702 'lex:pub.leaflet.pages.linearDocument#textAlignJustify',
1703 ],
1704 },
1705 },
1706 },
1707 textAlignLeft: {
1708 type: 'token',
1709 },
1710 textAlignCenter: {
1711 type: 'token',
1712 },
1713 textAlignRight: {
1714 type: 'token',
1715 },
1716 textAlignJustify: {
1717 type: 'token',
1718 },
1719 quote: {
1720 type: 'object',
1721 required: ['start', 'end'],
1722 properties: {
1723 start: {
1724 type: 'ref',
1725 ref: 'lex:pub.leaflet.pages.linearDocument#position',
1726 },
1727 end: {
1728 type: 'ref',
1729 ref: 'lex:pub.leaflet.pages.linearDocument#position',
1730 },
1731 },
1732 },
1733 position: {
1734 type: 'object',
1735 required: ['block', 'offset'],
1736 properties: {
1737 block: {
1738 type: 'array',
1739 items: {
1740 type: 'integer',
1741 },
1742 },
1743 offset: {
1744 type: 'integer',
1745 },
1746 },
1747 },
1748 },
1749 },
1750 PubLeafletPollDefinition: {
1751 lexicon: 1,
1752 id: 'pub.leaflet.poll.definition',
1753 defs: {
1754 main: {
1755 type: 'record',
1756 key: 'tid',
1757 description: 'Record declaring a poll',
1758 record: {
1759 type: 'object',
1760 required: ['name', 'options'],
1761 properties: {
1762 name: {
1763 type: 'string',
1764 maxLength: 500,
1765 maxGraphemes: 100,
1766 },
1767 options: {
1768 type: 'array',
1769 items: {
1770 type: 'ref',
1771 ref: 'lex:pub.leaflet.poll.definition#option',
1772 },
1773 },
1774 endDate: {
1775 type: 'string',
1776 format: 'datetime',
1777 },
1778 },
1779 },
1780 },
1781 option: {
1782 type: 'object',
1783 properties: {
1784 text: {
1785 type: 'string',
1786 maxLength: 500,
1787 maxGraphemes: 50,
1788 },
1789 },
1790 },
1791 },
1792 },
1793 PubLeafletPollVote: {
1794 lexicon: 1,
1795 id: 'pub.leaflet.poll.vote',
1796 defs: {
1797 main: {
1798 type: 'record',
1799 key: 'tid',
1800 description: 'Record declaring a vote on a poll',
1801 record: {
1802 type: 'object',
1803 required: ['poll', 'option'],
1804 properties: {
1805 poll: {
1806 type: 'ref',
1807 ref: 'lex:com.atproto.repo.strongRef',
1808 },
1809 option: {
1810 type: 'array',
1811 items: {
1812 type: 'string',
1813 },
1814 },
1815 },
1816 },
1817 },
1818 },
1819 },
1820 PubLeafletPublication: {
1821 lexicon: 1,
1822 id: 'pub.leaflet.publication',
1823 defs: {
1824 main: {
1825 type: 'record',
1826 key: 'tid',
1827 description: 'Record declaring a publication',
1828 record: {
1829 type: 'object',
1830 required: ['name'],
1831 properties: {
1832 name: {
1833 type: 'string',
1834 maxLength: 2000,
1835 },
1836 base_path: {
1837 type: 'string',
1838 },
1839 description: {
1840 type: 'string',
1841 maxLength: 2000,
1842 },
1843 icon: {
1844 type: 'blob',
1845 accept: ['image/*'],
1846 maxSize: 1000000,
1847 },
1848 theme: {
1849 type: 'ref',
1850 ref: 'lex:pub.leaflet.publication#theme',
1851 },
1852 preferences: {
1853 type: 'ref',
1854 ref: 'lex:pub.leaflet.publication#preferences',
1855 },
1856 },
1857 },
1858 },
1859 preferences: {
1860 type: 'object',
1861 properties: {
1862 showInDiscover: {
1863 type: 'boolean',
1864 default: true,
1865 },
1866 showComments: {
1867 type: 'boolean',
1868 default: true,
1869 },
1870 showMentions: {
1871 type: 'boolean',
1872 default: true,
1873 },
1874 showPrevNext: {
1875 type: 'boolean',
1876 default: true,
1877 },
1878 showRecommends: {
1879 type: 'boolean',
1880 default: true,
1881 },
1882 },
1883 },
1884 theme: {
1885 type: 'object',
1886 properties: {
1887 backgroundColor: {
1888 type: 'union',
1889 refs: [
1890 'lex:pub.leaflet.theme.color#rgba',
1891 'lex:pub.leaflet.theme.color#rgb',
1892 ],
1893 },
1894 backgroundImage: {
1895 type: 'ref',
1896 ref: 'lex:pub.leaflet.theme.backgroundImage',
1897 },
1898 pageWidth: {
1899 type: 'integer',
1900 minimum: 0,
1901 maximum: 1600,
1902 },
1903 primary: {
1904 type: 'union',
1905 refs: [
1906 'lex:pub.leaflet.theme.color#rgba',
1907 'lex:pub.leaflet.theme.color#rgb',
1908 ],
1909 },
1910 pageBackground: {
1911 type: 'union',
1912 refs: [
1913 'lex:pub.leaflet.theme.color#rgba',
1914 'lex:pub.leaflet.theme.color#rgb',
1915 ],
1916 },
1917 showPageBackground: {
1918 type: 'boolean',
1919 default: false,
1920 },
1921 accentBackground: {
1922 type: 'union',
1923 refs: [
1924 'lex:pub.leaflet.theme.color#rgba',
1925 'lex:pub.leaflet.theme.color#rgb',
1926 ],
1927 },
1928 accentText: {
1929 type: 'union',
1930 refs: [
1931 'lex:pub.leaflet.theme.color#rgba',
1932 'lex:pub.leaflet.theme.color#rgb',
1933 ],
1934 },
1935 },
1936 },
1937 },
1938 },
1939 PubLeafletRichtextFacet: {
1940 lexicon: 1,
1941 id: 'pub.leaflet.richtext.facet',
1942 defs: {
1943 main: {
1944 type: 'object',
1945 description: 'Annotation of a sub-string within rich text.',
1946 required: ['index', 'features'],
1947 properties: {
1948 index: {
1949 type: 'ref',
1950 ref: 'lex:pub.leaflet.richtext.facet#byteSlice',
1951 },
1952 features: {
1953 type: 'array',
1954 items: {
1955 type: 'union',
1956 refs: [
1957 'lex:pub.leaflet.richtext.facet#link',
1958 'lex:pub.leaflet.richtext.facet#didMention',
1959 'lex:pub.leaflet.richtext.facet#atMention',
1960 'lex:pub.leaflet.richtext.facet#code',
1961 'lex:pub.leaflet.richtext.facet#highlight',
1962 'lex:pub.leaflet.richtext.facet#underline',
1963 'lex:pub.leaflet.richtext.facet#strikethrough',
1964 'lex:pub.leaflet.richtext.facet#id',
1965 'lex:pub.leaflet.richtext.facet#bold',
1966 'lex:pub.leaflet.richtext.facet#italic',
1967 ],
1968 },
1969 },
1970 },
1971 },
1972 byteSlice: {
1973 type: 'object',
1974 description:
1975 'Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.',
1976 required: ['byteStart', 'byteEnd'],
1977 properties: {
1978 byteStart: {
1979 type: 'integer',
1980 minimum: 0,
1981 },
1982 byteEnd: {
1983 type: 'integer',
1984 minimum: 0,
1985 },
1986 },
1987 },
1988 link: {
1989 type: 'object',
1990 description:
1991 'Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.',
1992 required: ['uri'],
1993 properties: {
1994 uri: {
1995 type: 'string',
1996 },
1997 },
1998 },
1999 didMention: {
2000 type: 'object',
2001 description: 'Facet feature for mentioning a did.',
2002 required: ['did'],
2003 properties: {
2004 did: {
2005 type: 'string',
2006 format: 'did',
2007 },
2008 },
2009 },
2010 atMention: {
2011 type: 'object',
2012 description: 'Facet feature for mentioning an AT URI.',
2013 required: ['atURI'],
2014 properties: {
2015 atURI: {
2016 type: 'string',
2017 format: 'uri',
2018 },
2019 },
2020 },
2021 code: {
2022 type: 'object',
2023 description: 'Facet feature for inline code.',
2024 required: [],
2025 properties: {},
2026 },
2027 highlight: {
2028 type: 'object',
2029 description: 'Facet feature for highlighted text.',
2030 required: [],
2031 properties: {},
2032 },
2033 underline: {
2034 type: 'object',
2035 description: 'Facet feature for underline markup',
2036 required: [],
2037 properties: {},
2038 },
2039 strikethrough: {
2040 type: 'object',
2041 description: 'Facet feature for strikethrough markup',
2042 required: [],
2043 properties: {},
2044 },
2045 id: {
2046 type: 'object',
2047 description:
2048 'Facet feature for an identifier. Used for linking to a segment',
2049 required: [],
2050 properties: {
2051 id: {
2052 type: 'string',
2053 },
2054 },
2055 },
2056 bold: {
2057 type: 'object',
2058 description: 'Facet feature for bold text',
2059 required: [],
2060 properties: {},
2061 },
2062 italic: {
2063 type: 'object',
2064 description: 'Facet feature for italic text',
2065 required: [],
2066 properties: {},
2067 },
2068 },
2069 },
2070 PubLeafletThemeBackgroundImage: {
2071 lexicon: 1,
2072 id: 'pub.leaflet.theme.backgroundImage',
2073 defs: {
2074 main: {
2075 type: 'object',
2076 required: ['image'],
2077 properties: {
2078 image: {
2079 type: 'blob',
2080 accept: ['image/*'],
2081 maxSize: 1000000,
2082 },
2083 width: {
2084 type: 'integer',
2085 },
2086 repeat: {
2087 type: 'boolean',
2088 },
2089 },
2090 },
2091 },
2092 },
2093 PubLeafletThemeColor: {
2094 lexicon: 1,
2095 id: 'pub.leaflet.theme.color',
2096 defs: {
2097 rgba: {
2098 type: 'object',
2099 required: ['r', 'g', 'b', 'a'],
2100 properties: {
2101 r: {
2102 type: 'integer',
2103 maximum: 255,
2104 minimum: 0,
2105 },
2106 g: {
2107 type: 'integer',
2108 maximum: 255,
2109 minimum: 0,
2110 },
2111 b: {
2112 type: 'integer',
2113 maximum: 255,
2114 minimum: 0,
2115 },
2116 a: {
2117 type: 'integer',
2118 maximum: 100,
2119 minimum: 0,
2120 },
2121 },
2122 },
2123 rgb: {
2124 type: 'object',
2125 required: ['r', 'g', 'b'],
2126 properties: {
2127 r: {
2128 type: 'integer',
2129 maximum: 255,
2130 minimum: 0,
2131 },
2132 g: {
2133 type: 'integer',
2134 maximum: 255,
2135 minimum: 0,
2136 },
2137 b: {
2138 type: 'integer',
2139 maximum: 255,
2140 minimum: 0,
2141 },
2142 },
2143 },
2144 },
2145 },
2146 SiteStandardDocument: {
2147 defs: {
2148 main: {
2149 key: 'tid',
2150 record: {
2151 properties: {
2152 bskyPostRef: {
2153 ref: 'lex:com.atproto.repo.strongRef',
2154 type: 'ref',
2155 },
2156 content: {
2157 closed: false,
2158 refs: ['lex:pub.leaflet.content'],
2159 type: 'union',
2160 },
2161 coverImage: {
2162 accept: ['image/*'],
2163 maxSize: 1000000,
2164 type: 'blob',
2165 },
2166 description: {
2167 maxGraphemes: 3000,
2168 maxLength: 30000,
2169 type: 'string',
2170 },
2171 path: {
2172 description:
2173 'combine with the publication url or the document site to construct a full url to the document',
2174 type: 'string',
2175 },
2176 publishedAt: {
2177 format: 'datetime',
2178 type: 'string',
2179 },
2180 site: {
2181 description:
2182 'URI to the site or publication this document belongs to. Supports both AT-URIs (at://did/collection/rkey) for publication references and HTTPS URLs (https://example.com) for standalone documents or external sites.',
2183 format: 'uri',
2184 type: 'string',
2185 },
2186 tags: {
2187 items: {
2188 maxGraphemes: 50,
2189 maxLength: 100,
2190 type: 'string',
2191 },
2192 type: 'array',
2193 },
2194 textContent: {
2195 type: 'string',
2196 },
2197 theme: {
2198 description:
2199 'Theme for standalone documents. For documents in publications, theme is inherited from the publication.',
2200 ref: 'lex:pub.leaflet.publication#theme',
2201 type: 'ref',
2202 },
2203 title: {
2204 maxGraphemes: 500,
2205 maxLength: 5000,
2206 type: 'string',
2207 },
2208 preferences: {
2209 type: 'union',
2210 refs: ['lex:pub.leaflet.publication#preferences'],
2211 closed: false,
2212 },
2213 updatedAt: {
2214 format: 'datetime',
2215 type: 'string',
2216 },
2217 },
2218 required: ['site', 'title', 'publishedAt'],
2219 type: 'object',
2220 },
2221 type: 'record',
2222 },
2223 },
2224 id: 'site.standard.document',
2225 lexicon: 1,
2226 },
2227 SiteStandardGraphSubscription: {
2228 defs: {
2229 main: {
2230 description: 'Record declaring a subscription to a publication',
2231 key: 'tid',
2232 record: {
2233 properties: {
2234 publication: {
2235 format: 'at-uri',
2236 type: 'string',
2237 },
2238 },
2239 required: ['publication'],
2240 type: 'object',
2241 },
2242 type: 'record',
2243 },
2244 },
2245 id: 'site.standard.graph.subscription',
2246 lexicon: 1,
2247 },
2248 SiteStandardPublication: {
2249 defs: {
2250 main: {
2251 key: 'tid',
2252 record: {
2253 properties: {
2254 basicTheme: {
2255 ref: 'lex:site.standard.theme.basic',
2256 type: 'ref',
2257 },
2258 theme: {
2259 type: 'union',
2260 refs: ['lex:pub.leaflet.publication#theme'],
2261 },
2262 description: {
2263 maxGraphemes: 300,
2264 maxLength: 3000,
2265 type: 'string',
2266 },
2267 icon: {
2268 accept: ['image/*'],
2269 maxSize: 1000000,
2270 type: 'blob',
2271 },
2272 name: {
2273 maxGraphemes: 128,
2274 maxLength: 1280,
2275 type: 'string',
2276 },
2277 preferences: {
2278 ref: 'lex:site.standard.publication#preferences',
2279 type: 'ref',
2280 },
2281 url: {
2282 format: 'uri',
2283 type: 'string',
2284 },
2285 },
2286 required: ['url', 'name'],
2287 type: 'object',
2288 },
2289 type: 'record',
2290 },
2291 preferences: {
2292 properties: {
2293 showInDiscover: {
2294 default: true,
2295 type: 'boolean',
2296 },
2297 showComments: {
2298 default: true,
2299 type: 'boolean',
2300 },
2301 showMentions: {
2302 default: true,
2303 type: 'boolean',
2304 },
2305 showPrevNext: {
2306 default: false,
2307 type: 'boolean',
2308 },
2309 showRecommends: {
2310 default: true,
2311 type: 'boolean',
2312 },
2313 },
2314 type: 'object',
2315 },
2316 },
2317 id: 'site.standard.publication',
2318 lexicon: 1,
2319 },
2320 SiteStandardThemeBasic: {
2321 defs: {
2322 main: {
2323 properties: {
2324 accent: {
2325 refs: ['lex:site.standard.theme.color#rgb'],
2326 type: 'union',
2327 },
2328 accentForeground: {
2329 refs: ['lex:site.standard.theme.color#rgb'],
2330 type: 'union',
2331 },
2332 background: {
2333 refs: ['lex:site.standard.theme.color#rgb'],
2334 type: 'union',
2335 },
2336 foreground: {
2337 refs: ['lex:site.standard.theme.color#rgb'],
2338 type: 'union',
2339 },
2340 },
2341 required: ['background', 'foreground', 'accent', 'accentForeground'],
2342 type: 'object',
2343 },
2344 },
2345 id: 'site.standard.theme.basic',
2346 lexicon: 1,
2347 },
2348 SiteStandardThemeColor: {
2349 lexicon: 1,
2350 id: 'site.standard.theme.color',
2351 defs: {
2352 rgb: {
2353 type: 'object',
2354 required: ['r', 'g', 'b'],
2355 properties: {
2356 r: {
2357 type: 'integer',
2358 minimum: 0,
2359 maximum: 255,
2360 },
2361 g: {
2362 type: 'integer',
2363 minimum: 0,
2364 maximum: 255,
2365 },
2366 b: {
2367 type: 'integer',
2368 minimum: 0,
2369 maximum: 255,
2370 },
2371 },
2372 },
2373 rgba: {
2374 type: 'object',
2375 required: ['r', 'g', 'b', 'a'],
2376 properties: {
2377 r: {
2378 type: 'integer',
2379 minimum: 0,
2380 maximum: 255,
2381 },
2382 g: {
2383 type: 'integer',
2384 minimum: 0,
2385 maximum: 255,
2386 },
2387 b: {
2388 type: 'integer',
2389 minimum: 0,
2390 maximum: 255,
2391 },
2392 a: {
2393 type: 'integer',
2394 minimum: 0,
2395 maximum: 100,
2396 },
2397 },
2398 },
2399 },
2400 },
2401} as const satisfies Record<string, LexiconDoc>
2402export const schemas = Object.values(schemaDict) satisfies LexiconDoc[]
2403export const lexicons: Lexicons = new Lexicons(schemas)
2404
2405export function validate<T extends { $type: string }>(
2406 v: unknown,
2407 id: string,
2408 hash: string,
2409 requiredType: true,
2410): ValidationResult<T>
2411export function validate<T extends { $type?: string }>(
2412 v: unknown,
2413 id: string,
2414 hash: string,
2415 requiredType?: false,
2416): ValidationResult<T>
2417export function validate(
2418 v: unknown,
2419 id: string,
2420 hash: string,
2421 requiredType?: boolean,
2422): ValidationResult {
2423 return (requiredType ? is$typed : maybe$typed)(v, id, hash)
2424 ? lexicons.validate(`${id}#${hash}`, v)
2425 : {
2426 success: false,
2427 error: new ValidationError(
2428 `Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`,
2429 ),
2430 }
2431}
2432
2433export const ids = {
2434 AppBskyActorProfile: 'app.bsky.actor.profile',
2435 ComAtprotoLabelDefs: 'com.atproto.label.defs',
2436 ComAtprotoRepoApplyWrites: 'com.atproto.repo.applyWrites',
2437 ComAtprotoRepoCreateRecord: 'com.atproto.repo.createRecord',
2438 ComAtprotoRepoDefs: 'com.atproto.repo.defs',
2439 ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord',
2440 ComAtprotoRepoDescribeRepo: 'com.atproto.repo.describeRepo',
2441 ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord',
2442 ComAtprotoRepoImportRepo: 'com.atproto.repo.importRepo',
2443 ComAtprotoRepoListMissingBlobs: 'com.atproto.repo.listMissingBlobs',
2444 ComAtprotoRepoListRecords: 'com.atproto.repo.listRecords',
2445 ComAtprotoRepoPutRecord: 'com.atproto.repo.putRecord',
2446 ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef',
2447 ComAtprotoRepoUploadBlob: 'com.atproto.repo.uploadBlob',
2448 PubLeafletBlocksBlockquote: 'pub.leaflet.blocks.blockquote',
2449 PubLeafletBlocksBskyPost: 'pub.leaflet.blocks.bskyPost',
2450 PubLeafletBlocksButton: 'pub.leaflet.blocks.button',
2451 PubLeafletBlocksCode: 'pub.leaflet.blocks.code',
2452 PubLeafletBlocksHeader: 'pub.leaflet.blocks.header',
2453 PubLeafletBlocksHorizontalRule: 'pub.leaflet.blocks.horizontalRule',
2454 PubLeafletBlocksIframe: 'pub.leaflet.blocks.iframe',
2455 PubLeafletBlocksImage: 'pub.leaflet.blocks.image',
2456 PubLeafletBlocksMath: 'pub.leaflet.blocks.math',
2457 PubLeafletBlocksPage: 'pub.leaflet.blocks.page',
2458 PubLeafletBlocksPoll: 'pub.leaflet.blocks.poll',
2459 PubLeafletBlocksText: 'pub.leaflet.blocks.text',
2460 PubLeafletBlocksUnorderedList: 'pub.leaflet.blocks.unorderedList',
2461 PubLeafletBlocksWebsite: 'pub.leaflet.blocks.website',
2462 PubLeafletComment: 'pub.leaflet.comment',
2463 PubLeafletContent: 'pub.leaflet.content',
2464 PubLeafletDocument: 'pub.leaflet.document',
2465 PubLeafletGraphSubscription: 'pub.leaflet.graph.subscription',
2466 PubLeafletInteractionsRecommend: 'pub.leaflet.interactions.recommend',
2467 PubLeafletPagesCanvas: 'pub.leaflet.pages.canvas',
2468 PubLeafletPagesLinearDocument: 'pub.leaflet.pages.linearDocument',
2469 PubLeafletPollDefinition: 'pub.leaflet.poll.definition',
2470 PubLeafletPollVote: 'pub.leaflet.poll.vote',
2471 PubLeafletPublication: 'pub.leaflet.publication',
2472 PubLeafletRichtextFacet: 'pub.leaflet.richtext.facet',
2473 PubLeafletThemeBackgroundImage: 'pub.leaflet.theme.backgroundImage',
2474 PubLeafletThemeColor: 'pub.leaflet.theme.color',
2475 SiteStandardDocument: 'site.standard.document',
2476 SiteStandardGraphSubscription: 'site.standard.graph.subscription',
2477 SiteStandardPublication: 'site.standard.publication',
2478 SiteStandardThemeBasic: 'site.standard.theme.basic',
2479 SiteStandardThemeColor: 'site.standard.theme.color',
2480} as const