forked from
samuel.fm/statusphere-react
the statusphere demo reworked into a vite/react app in a monorepo
1/**
2 * GENERATED CODE - DO NOT MODIFY
3 */
4import {
5 LexiconDoc,
6 Lexicons,
7 ValidationError,
8 ValidationResult,
9} from '@atproto/lexicon'
10
11import { $Typed, is$typed, maybe$typed } from './util.js'
12
13export const schemaDict = {
14 XyzStatusphereDefs: {
15 lexicon: 1,
16 id: 'xyz.statusphere.defs',
17 defs: {
18 statusView: {
19 type: 'object',
20 required: ['uri', 'status', 'profile', 'createdAt'],
21 properties: {
22 uri: {
23 type: 'string',
24 format: 'at-uri',
25 },
26 status: {
27 type: 'string',
28 minLength: 1,
29 maxGraphemes: 1,
30 maxLength: 32,
31 },
32 createdAt: {
33 type: 'string',
34 format: 'datetime',
35 },
36 profile: {
37 type: 'ref',
38 ref: 'lex:xyz.statusphere.defs#profileView',
39 },
40 },
41 },
42 profileView: {
43 type: 'object',
44 required: ['did', 'handle'],
45 properties: {
46 did: {
47 type: 'string',
48 format: 'did',
49 },
50 handle: {
51 type: 'string',
52 format: 'handle',
53 },
54 },
55 },
56 },
57 },
58 XyzStatusphereGetStatuses: {
59 lexicon: 1,
60 id: 'xyz.statusphere.getStatuses',
61 defs: {
62 main: {
63 type: 'query',
64 description: 'Get a list of the most recent statuses on the network.',
65 parameters: {
66 type: 'params',
67 properties: {
68 limit: {
69 type: 'integer',
70 minimum: 1,
71 maximum: 100,
72 default: 50,
73 },
74 },
75 },
76 output: {
77 encoding: 'application/json',
78 schema: {
79 type: 'object',
80 required: ['statuses'],
81 properties: {
82 statuses: {
83 type: 'array',
84 items: {
85 type: 'ref',
86 ref: 'lex:xyz.statusphere.defs#statusView',
87 },
88 },
89 },
90 },
91 },
92 },
93 },
94 },
95 XyzStatusphereGetUser: {
96 lexicon: 1,
97 id: 'xyz.statusphere.getUser',
98 defs: {
99 main: {
100 type: 'query',
101 description: "Get the current user's profile and status.",
102 parameters: {
103 type: 'params',
104 properties: {},
105 },
106 output: {
107 encoding: 'application/json',
108 schema: {
109 type: 'object',
110 required: ['profile'],
111 properties: {
112 profile: {
113 type: 'ref',
114 ref: 'lex:app.bsky.actor.defs#profileView',
115 },
116 status: {
117 type: 'ref',
118 ref: 'lex:xyz.statusphere.defs#statusView',
119 },
120 },
121 },
122 },
123 },
124 },
125 },
126 XyzStatusphereSendStatus: {
127 lexicon: 1,
128 id: 'xyz.statusphere.sendStatus',
129 defs: {
130 main: {
131 type: 'procedure',
132 description: 'Send a status into the ATmosphere.',
133 input: {
134 encoding: 'application/json',
135 schema: {
136 type: 'object',
137 required: ['status'],
138 properties: {
139 status: {
140 type: 'string',
141 minLength: 1,
142 maxGraphemes: 1,
143 maxLength: 32,
144 },
145 },
146 },
147 },
148 output: {
149 encoding: 'application/json',
150 schema: {
151 type: 'object',
152 required: ['status'],
153 properties: {
154 status: {
155 type: 'ref',
156 ref: 'lex:xyz.statusphere.defs#statusView',
157 },
158 },
159 },
160 },
161 },
162 },
163 },
164 XyzStatusphereStatus: {
165 lexicon: 1,
166 id: 'xyz.statusphere.status',
167 defs: {
168 main: {
169 type: 'record',
170 key: 'tid',
171 record: {
172 type: 'object',
173 required: ['status', 'createdAt'],
174 properties: {
175 status: {
176 type: 'string',
177 minLength: 1,
178 maxGraphemes: 1,
179 maxLength: 32,
180 },
181 createdAt: {
182 type: 'string',
183 format: 'datetime',
184 },
185 },
186 },
187 },
188 },
189 },
190 ComAtprotoLabelDefs: {
191 lexicon: 1,
192 id: 'com.atproto.label.defs',
193 defs: {
194 label: {
195 type: 'object',
196 description:
197 'Metadata tag on an atproto resource (eg, repo or record).',
198 required: ['src', 'uri', 'val', 'cts'],
199 properties: {
200 ver: {
201 type: 'integer',
202 description: 'The AT Protocol version of the label object.',
203 },
204 src: {
205 type: 'string',
206 format: 'did',
207 description: 'DID of the actor who created this label.',
208 },
209 uri: {
210 type: 'string',
211 format: 'uri',
212 description:
213 'AT URI of the record, repository (account), or other resource that this label applies to.',
214 },
215 cid: {
216 type: 'string',
217 format: 'cid',
218 description:
219 "Optionally, CID specifying the specific version of 'uri' resource this label applies to.",
220 },
221 val: {
222 type: 'string',
223 maxLength: 128,
224 description:
225 'The short string name of the value or type of this label.',
226 },
227 neg: {
228 type: 'boolean',
229 description:
230 'If true, this is a negation label, overwriting a previous label.',
231 },
232 cts: {
233 type: 'string',
234 format: 'datetime',
235 description: 'Timestamp when this label was created.',
236 },
237 exp: {
238 type: 'string',
239 format: 'datetime',
240 description:
241 'Timestamp at which this label expires (no longer applies).',
242 },
243 sig: {
244 type: 'bytes',
245 description: 'Signature of dag-cbor encoded label.',
246 },
247 },
248 },
249 selfLabels: {
250 type: 'object',
251 description:
252 'Metadata tags on an atproto record, published by the author within the record.',
253 required: ['values'],
254 properties: {
255 values: {
256 type: 'array',
257 items: {
258 type: 'ref',
259 ref: 'lex:com.atproto.label.defs#selfLabel',
260 },
261 maxLength: 10,
262 },
263 },
264 },
265 selfLabel: {
266 type: 'object',
267 description:
268 'Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.',
269 required: ['val'],
270 properties: {
271 val: {
272 type: 'string',
273 maxLength: 128,
274 description:
275 'The short string name of the value or type of this label.',
276 },
277 },
278 },
279 labelValueDefinition: {
280 type: 'object',
281 description:
282 'Declares a label value and its expected interpretations and behaviors.',
283 required: ['identifier', 'severity', 'blurs', 'locales'],
284 properties: {
285 identifier: {
286 type: 'string',
287 description:
288 "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).",
289 maxLength: 100,
290 maxGraphemes: 100,
291 },
292 severity: {
293 type: 'string',
294 description:
295 "How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.",
296 knownValues: ['inform', 'alert', 'none'],
297 },
298 blurs: {
299 type: 'string',
300 description:
301 "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.",
302 knownValues: ['content', 'media', 'none'],
303 },
304 defaultSetting: {
305 type: 'string',
306 description: 'The default setting for this label.',
307 knownValues: ['ignore', 'warn', 'hide'],
308 default: 'warn',
309 },
310 adultOnly: {
311 type: 'boolean',
312 description:
313 'Does the user need to have adult content enabled in order to configure this label?',
314 },
315 locales: {
316 type: 'array',
317 items: {
318 type: 'ref',
319 ref: 'lex:com.atproto.label.defs#labelValueDefinitionStrings',
320 },
321 },
322 },
323 },
324 labelValueDefinitionStrings: {
325 type: 'object',
326 description:
327 'Strings which describe the label in the UI, localized into a specific language.',
328 required: ['lang', 'name', 'description'],
329 properties: {
330 lang: {
331 type: 'string',
332 description:
333 'The code of the language these strings are written in.',
334 format: 'language',
335 },
336 name: {
337 type: 'string',
338 description: 'A short human-readable name for the label.',
339 maxGraphemes: 64,
340 maxLength: 640,
341 },
342 description: {
343 type: 'string',
344 description:
345 'A longer description of what the label means and why it might be applied.',
346 maxGraphemes: 10000,
347 maxLength: 100000,
348 },
349 },
350 },
351 labelValue: {
352 type: 'string',
353 knownValues: [
354 '!hide',
355 '!no-promote',
356 '!warn',
357 '!no-unauthenticated',
358 'dmca-violation',
359 'doxxing',
360 'porn',
361 'sexual',
362 'nudity',
363 'nsfl',
364 'gore',
365 ],
366 },
367 },
368 },
369 ComAtprotoRepoApplyWrites: {
370 lexicon: 1,
371 id: 'com.atproto.repo.applyWrites',
372 defs: {
373 main: {
374 type: 'procedure',
375 description:
376 'Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS.',
377 input: {
378 encoding: 'application/json',
379 schema: {
380 type: 'object',
381 required: ['repo', 'writes'],
382 properties: {
383 repo: {
384 type: 'string',
385 format: 'at-identifier',
386 description:
387 'The handle or DID of the repo (aka, current account).',
388 },
389 validate: {
390 type: 'boolean',
391 description:
392 "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.",
393 },
394 writes: {
395 type: 'array',
396 items: {
397 type: 'union',
398 refs: [
399 'lex:com.atproto.repo.applyWrites#create',
400 'lex:com.atproto.repo.applyWrites#update',
401 'lex:com.atproto.repo.applyWrites#delete',
402 ],
403 closed: true,
404 },
405 },
406 swapCommit: {
407 type: 'string',
408 description:
409 'If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations.',
410 format: 'cid',
411 },
412 },
413 },
414 },
415 output: {
416 encoding: 'application/json',
417 schema: {
418 type: 'object',
419 required: [],
420 properties: {
421 commit: {
422 type: 'ref',
423 ref: 'lex:com.atproto.repo.defs#commitMeta',
424 },
425 results: {
426 type: 'array',
427 items: {
428 type: 'union',
429 refs: [
430 'lex:com.atproto.repo.applyWrites#createResult',
431 'lex:com.atproto.repo.applyWrites#updateResult',
432 'lex:com.atproto.repo.applyWrites#deleteResult',
433 ],
434 closed: true,
435 },
436 },
437 },
438 },
439 },
440 errors: [
441 {
442 name: 'InvalidSwap',
443 description:
444 "Indicates that the 'swapCommit' parameter did not match current commit.",
445 },
446 ],
447 },
448 create: {
449 type: 'object',
450 description: 'Operation which creates a new record.',
451 required: ['collection', 'value'],
452 properties: {
453 collection: {
454 type: 'string',
455 format: 'nsid',
456 },
457 rkey: {
458 type: 'string',
459 maxLength: 512,
460 format: 'record-key',
461 description:
462 'NOTE: maxLength is redundant with record-key format. Keeping it temporarily to ensure backwards compatibility.',
463 },
464 value: {
465 type: 'unknown',
466 },
467 },
468 },
469 update: {
470 type: 'object',
471 description: 'Operation which updates an existing record.',
472 required: ['collection', 'rkey', 'value'],
473 properties: {
474 collection: {
475 type: 'string',
476 format: 'nsid',
477 },
478 rkey: {
479 type: 'string',
480 format: 'record-key',
481 },
482 value: {
483 type: 'unknown',
484 },
485 },
486 },
487 delete: {
488 type: 'object',
489 description: 'Operation which deletes an existing record.',
490 required: ['collection', 'rkey'],
491 properties: {
492 collection: {
493 type: 'string',
494 format: 'nsid',
495 },
496 rkey: {
497 type: 'string',
498 format: 'record-key',
499 },
500 },
501 },
502 createResult: {
503 type: 'object',
504 required: ['uri', 'cid'],
505 properties: {
506 uri: {
507 type: 'string',
508 format: 'at-uri',
509 },
510 cid: {
511 type: 'string',
512 format: 'cid',
513 },
514 validationStatus: {
515 type: 'string',
516 knownValues: ['valid', 'unknown'],
517 },
518 },
519 },
520 updateResult: {
521 type: 'object',
522 required: ['uri', 'cid'],
523 properties: {
524 uri: {
525 type: 'string',
526 format: 'at-uri',
527 },
528 cid: {
529 type: 'string',
530 format: 'cid',
531 },
532 validationStatus: {
533 type: 'string',
534 knownValues: ['valid', 'unknown'],
535 },
536 },
537 },
538 deleteResult: {
539 type: 'object',
540 required: [],
541 properties: {},
542 },
543 },
544 },
545 ComAtprotoRepoCreateRecord: {
546 lexicon: 1,
547 id: 'com.atproto.repo.createRecord',
548 defs: {
549 main: {
550 type: 'procedure',
551 description:
552 'Create a single new repository record. Requires auth, implemented by PDS.',
553 input: {
554 encoding: 'application/json',
555 schema: {
556 type: 'object',
557 required: ['repo', 'collection', 'record'],
558 properties: {
559 repo: {
560 type: 'string',
561 format: 'at-identifier',
562 description:
563 'The handle or DID of the repo (aka, current account).',
564 },
565 collection: {
566 type: 'string',
567 format: 'nsid',
568 description: 'The NSID of the record collection.',
569 },
570 rkey: {
571 type: 'string',
572 format: 'record-key',
573 description: 'The Record Key.',
574 maxLength: 512,
575 },
576 validate: {
577 type: 'boolean',
578 description:
579 "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.",
580 },
581 record: {
582 type: 'unknown',
583 description: 'The record itself. Must contain a $type field.',
584 },
585 swapCommit: {
586 type: 'string',
587 format: 'cid',
588 description:
589 'Compare and swap with the previous commit by CID.',
590 },
591 },
592 },
593 },
594 output: {
595 encoding: 'application/json',
596 schema: {
597 type: 'object',
598 required: ['uri', 'cid'],
599 properties: {
600 uri: {
601 type: 'string',
602 format: 'at-uri',
603 },
604 cid: {
605 type: 'string',
606 format: 'cid',
607 },
608 commit: {
609 type: 'ref',
610 ref: 'lex:com.atproto.repo.defs#commitMeta',
611 },
612 validationStatus: {
613 type: 'string',
614 knownValues: ['valid', 'unknown'],
615 },
616 },
617 },
618 },
619 errors: [
620 {
621 name: 'InvalidSwap',
622 description:
623 "Indicates that 'swapCommit' didn't match current repo commit.",
624 },
625 ],
626 },
627 },
628 },
629 ComAtprotoRepoDefs: {
630 lexicon: 1,
631 id: 'com.atproto.repo.defs',
632 defs: {
633 commitMeta: {
634 type: 'object',
635 required: ['cid', 'rev'],
636 properties: {
637 cid: {
638 type: 'string',
639 format: 'cid',
640 },
641 rev: {
642 type: 'string',
643 format: 'tid',
644 },
645 },
646 },
647 },
648 },
649 ComAtprotoRepoDeleteRecord: {
650 lexicon: 1,
651 id: 'com.atproto.repo.deleteRecord',
652 defs: {
653 main: {
654 type: 'procedure',
655 description:
656 "Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.",
657 input: {
658 encoding: 'application/json',
659 schema: {
660 type: 'object',
661 required: ['repo', 'collection', 'rkey'],
662 properties: {
663 repo: {
664 type: 'string',
665 format: 'at-identifier',
666 description:
667 'The handle or DID of the repo (aka, current account).',
668 },
669 collection: {
670 type: 'string',
671 format: 'nsid',
672 description: 'The NSID of the record collection.',
673 },
674 rkey: {
675 type: 'string',
676 format: 'record-key',
677 description: 'The Record Key.',
678 },
679 swapRecord: {
680 type: 'string',
681 format: 'cid',
682 description:
683 'Compare and swap with the previous record by CID.',
684 },
685 swapCommit: {
686 type: 'string',
687 format: 'cid',
688 description:
689 'Compare and swap with the previous commit by CID.',
690 },
691 },
692 },
693 },
694 output: {
695 encoding: 'application/json',
696 schema: {
697 type: 'object',
698 properties: {
699 commit: {
700 type: 'ref',
701 ref: 'lex:com.atproto.repo.defs#commitMeta',
702 },
703 },
704 },
705 },
706 errors: [
707 {
708 name: 'InvalidSwap',
709 },
710 ],
711 },
712 },
713 },
714 ComAtprotoRepoDescribeRepo: {
715 lexicon: 1,
716 id: 'com.atproto.repo.describeRepo',
717 defs: {
718 main: {
719 type: 'query',
720 description:
721 'Get information about an account and repository, including the list of collections. Does not require auth.',
722 parameters: {
723 type: 'params',
724 required: ['repo'],
725 properties: {
726 repo: {
727 type: 'string',
728 format: 'at-identifier',
729 description: 'The handle or DID of the repo.',
730 },
731 },
732 },
733 output: {
734 encoding: 'application/json',
735 schema: {
736 type: 'object',
737 required: [
738 'handle',
739 'did',
740 'didDoc',
741 'collections',
742 'handleIsCorrect',
743 ],
744 properties: {
745 handle: {
746 type: 'string',
747 format: 'handle',
748 },
749 did: {
750 type: 'string',
751 format: 'did',
752 },
753 didDoc: {
754 type: 'unknown',
755 description: 'The complete DID document for this account.',
756 },
757 collections: {
758 type: 'array',
759 description:
760 'List of all the collections (NSIDs) for which this repo contains at least one record.',
761 items: {
762 type: 'string',
763 format: 'nsid',
764 },
765 },
766 handleIsCorrect: {
767 type: 'boolean',
768 description:
769 'Indicates if handle is currently valid (resolves bi-directionally)',
770 },
771 },
772 },
773 },
774 },
775 },
776 },
777 ComAtprotoRepoGetRecord: {
778 lexicon: 1,
779 id: 'com.atproto.repo.getRecord',
780 defs: {
781 main: {
782 type: 'query',
783 description:
784 'Get a single record from a repository. Does not require auth.',
785 parameters: {
786 type: 'params',
787 required: ['repo', 'collection', 'rkey'],
788 properties: {
789 repo: {
790 type: 'string',
791 format: 'at-identifier',
792 description: 'The handle or DID of the repo.',
793 },
794 collection: {
795 type: 'string',
796 format: 'nsid',
797 description: 'The NSID of the record collection.',
798 },
799 rkey: {
800 type: 'string',
801 description: 'The Record Key.',
802 format: 'record-key',
803 },
804 cid: {
805 type: 'string',
806 format: 'cid',
807 description:
808 'The CID of the version of the record. If not specified, then return the most recent version.',
809 },
810 },
811 },
812 output: {
813 encoding: 'application/json',
814 schema: {
815 type: 'object',
816 required: ['uri', 'value'],
817 properties: {
818 uri: {
819 type: 'string',
820 format: 'at-uri',
821 },
822 cid: {
823 type: 'string',
824 format: 'cid',
825 },
826 value: {
827 type: 'unknown',
828 },
829 },
830 },
831 },
832 errors: [
833 {
834 name: 'RecordNotFound',
835 },
836 ],
837 },
838 },
839 },
840 ComAtprotoRepoImportRepo: {
841 lexicon: 1,
842 id: 'com.atproto.repo.importRepo',
843 defs: {
844 main: {
845 type: 'procedure',
846 description:
847 'Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.',
848 input: {
849 encoding: 'application/vnd.ipld.car',
850 },
851 },
852 },
853 },
854 ComAtprotoRepoListMissingBlobs: {
855 lexicon: 1,
856 id: 'com.atproto.repo.listMissingBlobs',
857 defs: {
858 main: {
859 type: 'query',
860 description:
861 'Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.',
862 parameters: {
863 type: 'params',
864 properties: {
865 limit: {
866 type: 'integer',
867 minimum: 1,
868 maximum: 1000,
869 default: 500,
870 },
871 cursor: {
872 type: 'string',
873 },
874 },
875 },
876 output: {
877 encoding: 'application/json',
878 schema: {
879 type: 'object',
880 required: ['blobs'],
881 properties: {
882 cursor: {
883 type: 'string',
884 },
885 blobs: {
886 type: 'array',
887 items: {
888 type: 'ref',
889 ref: 'lex:com.atproto.repo.listMissingBlobs#recordBlob',
890 },
891 },
892 },
893 },
894 },
895 },
896 recordBlob: {
897 type: 'object',
898 required: ['cid', 'recordUri'],
899 properties: {
900 cid: {
901 type: 'string',
902 format: 'cid',
903 },
904 recordUri: {
905 type: 'string',
906 format: 'at-uri',
907 },
908 },
909 },
910 },
911 },
912 ComAtprotoRepoListRecords: {
913 lexicon: 1,
914 id: 'com.atproto.repo.listRecords',
915 defs: {
916 main: {
917 type: 'query',
918 description:
919 'List a range of records in a repository, matching a specific collection. Does not require auth.',
920 parameters: {
921 type: 'params',
922 required: ['repo', 'collection'],
923 properties: {
924 repo: {
925 type: 'string',
926 format: 'at-identifier',
927 description: 'The handle or DID of the repo.',
928 },
929 collection: {
930 type: 'string',
931 format: 'nsid',
932 description: 'The NSID of the record type.',
933 },
934 limit: {
935 type: 'integer',
936 minimum: 1,
937 maximum: 100,
938 default: 50,
939 description: 'The number of records to return.',
940 },
941 cursor: {
942 type: 'string',
943 },
944 rkeyStart: {
945 type: 'string',
946 description:
947 'DEPRECATED: The lowest sort-ordered rkey to start from (exclusive)',
948 },
949 rkeyEnd: {
950 type: 'string',
951 description:
952 'DEPRECATED: The highest sort-ordered rkey to stop at (exclusive)',
953 },
954 reverse: {
955 type: 'boolean',
956 description: 'Flag to reverse the order of the returned records.',
957 },
958 },
959 },
960 output: {
961 encoding: 'application/json',
962 schema: {
963 type: 'object',
964 required: ['records'],
965 properties: {
966 cursor: {
967 type: 'string',
968 },
969 records: {
970 type: 'array',
971 items: {
972 type: 'ref',
973 ref: 'lex:com.atproto.repo.listRecords#record',
974 },
975 },
976 },
977 },
978 },
979 },
980 record: {
981 type: 'object',
982 required: ['uri', 'cid', 'value'],
983 properties: {
984 uri: {
985 type: 'string',
986 format: 'at-uri',
987 },
988 cid: {
989 type: 'string',
990 format: 'cid',
991 },
992 value: {
993 type: 'unknown',
994 },
995 },
996 },
997 },
998 },
999 ComAtprotoRepoPutRecord: {
1000 lexicon: 1,
1001 id: 'com.atproto.repo.putRecord',
1002 defs: {
1003 main: {
1004 type: 'procedure',
1005 description:
1006 'Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.',
1007 input: {
1008 encoding: 'application/json',
1009 schema: {
1010 type: 'object',
1011 required: ['repo', 'collection', 'rkey', 'record'],
1012 nullable: ['swapRecord'],
1013 properties: {
1014 repo: {
1015 type: 'string',
1016 format: 'at-identifier',
1017 description:
1018 'The handle or DID of the repo (aka, current account).',
1019 },
1020 collection: {
1021 type: 'string',
1022 format: 'nsid',
1023 description: 'The NSID of the record collection.',
1024 },
1025 rkey: {
1026 type: 'string',
1027 format: 'record-key',
1028 description: 'The Record Key.',
1029 maxLength: 512,
1030 },
1031 validate: {
1032 type: 'boolean',
1033 description:
1034 "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.",
1035 },
1036 record: {
1037 type: 'unknown',
1038 description: 'The record to write.',
1039 },
1040 swapRecord: {
1041 type: 'string',
1042 format: 'cid',
1043 description:
1044 'Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation',
1045 },
1046 swapCommit: {
1047 type: 'string',
1048 format: 'cid',
1049 description:
1050 'Compare and swap with the previous commit by CID.',
1051 },
1052 },
1053 },
1054 },
1055 output: {
1056 encoding: 'application/json',
1057 schema: {
1058 type: 'object',
1059 required: ['uri', 'cid'],
1060 properties: {
1061 uri: {
1062 type: 'string',
1063 format: 'at-uri',
1064 },
1065 cid: {
1066 type: 'string',
1067 format: 'cid',
1068 },
1069 commit: {
1070 type: 'ref',
1071 ref: 'lex:com.atproto.repo.defs#commitMeta',
1072 },
1073 validationStatus: {
1074 type: 'string',
1075 knownValues: ['valid', 'unknown'],
1076 },
1077 },
1078 },
1079 },
1080 errors: [
1081 {
1082 name: 'InvalidSwap',
1083 },
1084 ],
1085 },
1086 },
1087 },
1088 ComAtprotoRepoStrongRef: {
1089 lexicon: 1,
1090 id: 'com.atproto.repo.strongRef',
1091 description: 'A URI with a content-hash fingerprint.',
1092 defs: {
1093 main: {
1094 type: 'object',
1095 required: ['uri', 'cid'],
1096 properties: {
1097 uri: {
1098 type: 'string',
1099 format: 'at-uri',
1100 },
1101 cid: {
1102 type: 'string',
1103 format: 'cid',
1104 },
1105 },
1106 },
1107 },
1108 },
1109 ComAtprotoRepoUploadBlob: {
1110 lexicon: 1,
1111 id: 'com.atproto.repo.uploadBlob',
1112 defs: {
1113 main: {
1114 type: 'procedure',
1115 description:
1116 '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.',
1117 input: {
1118 encoding: '*/*',
1119 },
1120 output: {
1121 encoding: 'application/json',
1122 schema: {
1123 type: 'object',
1124 required: ['blob'],
1125 properties: {
1126 blob: {
1127 type: 'blob',
1128 },
1129 },
1130 },
1131 },
1132 },
1133 },
1134 },
1135 AppBskyActorDefs: {
1136 lexicon: 1,
1137 id: 'app.bsky.actor.defs',
1138 defs: {
1139 profileView: {
1140 type: 'object',
1141 required: ['did', 'handle'],
1142 properties: {
1143 did: {
1144 type: 'string',
1145 format: 'did',
1146 },
1147 handle: {
1148 type: 'string',
1149 format: 'handle',
1150 },
1151 displayName: {
1152 type: 'string',
1153 maxGraphemes: 64,
1154 maxLength: 640,
1155 },
1156 description: {
1157 type: 'string',
1158 maxGraphemes: 256,
1159 maxLength: 2560,
1160 },
1161 avatar: {
1162 type: 'string',
1163 format: 'uri',
1164 },
1165 indexedAt: {
1166 type: 'string',
1167 format: 'datetime',
1168 },
1169 createdAt: {
1170 type: 'string',
1171 format: 'datetime',
1172 },
1173 labels: {
1174 type: 'array',
1175 items: {
1176 type: 'ref',
1177 ref: 'lex:com.atproto.label.defs#label',
1178 },
1179 },
1180 },
1181 },
1182 },
1183 },
1184 AppBskyActorProfile: {
1185 lexicon: 1,
1186 id: 'app.bsky.actor.profile',
1187 defs: {
1188 main: {
1189 type: 'record',
1190 description: 'A declaration of a Bluesky account profile.',
1191 key: 'literal:self',
1192 record: {
1193 type: 'object',
1194 properties: {
1195 displayName: {
1196 type: 'string',
1197 maxGraphemes: 64,
1198 maxLength: 640,
1199 },
1200 description: {
1201 type: 'string',
1202 description: 'Free-form profile description text.',
1203 maxGraphemes: 256,
1204 maxLength: 2560,
1205 },
1206 avatar: {
1207 type: 'blob',
1208 description:
1209 "Small image to be displayed next to posts from account. AKA, 'profile picture'",
1210 accept: ['image/png', 'image/jpeg'],
1211 maxSize: 1000000,
1212 },
1213 banner: {
1214 type: 'blob',
1215 description:
1216 'Larger horizontal image to display behind profile view.',
1217 accept: ['image/png', 'image/jpeg'],
1218 maxSize: 1000000,
1219 },
1220 labels: {
1221 type: 'union',
1222 description:
1223 'Self-label values, specific to the Bluesky application, on the overall account.',
1224 refs: ['lex:com.atproto.label.defs#selfLabels'],
1225 },
1226 joinedViaStarterPack: {
1227 type: 'ref',
1228 ref: 'lex:com.atproto.repo.strongRef',
1229 },
1230 pinnedPost: {
1231 type: 'ref',
1232 ref: 'lex:com.atproto.repo.strongRef',
1233 },
1234 createdAt: {
1235 type: 'string',
1236 format: 'datetime',
1237 },
1238 },
1239 },
1240 },
1241 },
1242 },
1243} as const satisfies Record<string, LexiconDoc>
1244
1245export const schemas = Object.values(schemaDict) satisfies LexiconDoc[]
1246export const lexicons: Lexicons = new Lexicons(schemas)
1247
1248export function validate<T extends { $type: string }>(
1249 v: unknown,
1250 id: string,
1251 hash: string,
1252 requiredType: true,
1253): ValidationResult<T>
1254export function validate<T extends { $type?: string }>(
1255 v: unknown,
1256 id: string,
1257 hash: string,
1258 requiredType?: false,
1259): ValidationResult<T>
1260export function validate(
1261 v: unknown,
1262 id: string,
1263 hash: string,
1264 requiredType?: boolean,
1265): ValidationResult {
1266 return (requiredType ? is$typed : maybe$typed)(v, id, hash)
1267 ? lexicons.validate(`${id}#${hash}`, v)
1268 : {
1269 success: false,
1270 error: new ValidationError(
1271 `Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`,
1272 ),
1273 }
1274}
1275
1276export const ids = {
1277 XyzStatusphereDefs: 'xyz.statusphere.defs',
1278 XyzStatusphereGetStatuses: 'xyz.statusphere.getStatuses',
1279 XyzStatusphereGetUser: 'xyz.statusphere.getUser',
1280 XyzStatusphereSendStatus: 'xyz.statusphere.sendStatus',
1281 XyzStatusphereStatus: 'xyz.statusphere.status',
1282 ComAtprotoLabelDefs: 'com.atproto.label.defs',
1283 ComAtprotoRepoApplyWrites: 'com.atproto.repo.applyWrites',
1284 ComAtprotoRepoCreateRecord: 'com.atproto.repo.createRecord',
1285 ComAtprotoRepoDefs: 'com.atproto.repo.defs',
1286 ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord',
1287 ComAtprotoRepoDescribeRepo: 'com.atproto.repo.describeRepo',
1288 ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord',
1289 ComAtprotoRepoImportRepo: 'com.atproto.repo.importRepo',
1290 ComAtprotoRepoListMissingBlobs: 'com.atproto.repo.listMissingBlobs',
1291 ComAtprotoRepoListRecords: 'com.atproto.repo.listRecords',
1292 ComAtprotoRepoPutRecord: 'com.atproto.repo.putRecord',
1293 ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef',
1294 ComAtprotoRepoUploadBlob: 'com.atproto.repo.uploadBlob',
1295 AppBskyActorDefs: 'app.bsky.actor.defs',
1296 AppBskyActorProfile: 'app.bsky.actor.profile',
1297} as const