Monorepo for Tangled

api/lexicons, appview/db, knotserver/db: add schema for per-repo DIDs

+805 -33
+2 -1
api/tangled/actorprofile.go
··· 28 28 // location: Free-form location text. 29 29 Location *string `json:"location,omitempty" cborgen:"location,omitempty"` 30 30 // pinnedRepositories: Any ATURI, it is up to appviews to validate these fields. 31 - PinnedRepositories []string `json:"pinnedRepositories,omitempty" cborgen:"pinnedRepositories,omitempty"` 31 + PinnedRepositories []string `json:"pinnedRepositories,omitempty" cborgen:"pinnedRepositories,omitempty"` 32 + PinnedRepositoryDids []string `json:"pinnedRepositoryDids,omitempty" cborgen:"pinnedRepositoryDids,omitempty"` 32 33 // pronouns: Preferred gender pronouns. 33 34 Pronouns *string `json:"pronouns,omitempty" cborgen:"pronouns,omitempty"` 34 35 Stats []string `json:"stats,omitempty" cborgen:"stats,omitempty"`
+613 -15
api/tangled/cbor_gen.go
··· 26 26 } 27 27 28 28 cw := cbg.NewCborWriter(w) 29 - fieldCount := 9 29 + fieldCount := 10 30 30 31 31 if t.Avatar == nil { 32 32 fieldCount-- ··· 45 45 } 46 46 47 47 if t.PinnedRepositories == nil { 48 + fieldCount-- 49 + } 50 + 51 + if t.PinnedRepositoryDids == nil { 48 52 fieldCount-- 49 53 } 50 54 ··· 317 321 318 322 } 319 323 } 324 + 325 + // t.PinnedRepositoryDids ([]string) (slice) 326 + if t.PinnedRepositoryDids != nil { 327 + 328 + if len("pinnedRepositoryDids") > 1000000 { 329 + return xerrors.Errorf("Value in field \"pinnedRepositoryDids\" was too long") 330 + } 331 + 332 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pinnedRepositoryDids"))); err != nil { 333 + return err 334 + } 335 + if _, err := cw.WriteString(string("pinnedRepositoryDids")); err != nil { 336 + return err 337 + } 338 + 339 + if len(t.PinnedRepositoryDids) > 8192 { 340 + return xerrors.Errorf("Slice value in field t.PinnedRepositoryDids was too long") 341 + } 342 + 343 + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.PinnedRepositoryDids))); err != nil { 344 + return err 345 + } 346 + for _, v := range t.PinnedRepositoryDids { 347 + if len(v) > 1000000 { 348 + return xerrors.Errorf("Value in field v was too long") 349 + } 350 + 351 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil { 352 + return err 353 + } 354 + if _, err := cw.WriteString(string(v)); err != nil { 355 + return err 356 + } 357 + 358 + } 359 + } 320 360 return nil 321 361 } 322 362 ··· 345 385 346 386 n := extra 347 387 348 - nameBuf := make([]byte, 18) 388 + nameBuf := make([]byte, 20) 349 389 for i := uint64(0); i < n; i++ { 350 390 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 351 391 if err != nil { ··· 593 633 594 634 } 595 635 } 636 + // t.PinnedRepositoryDids ([]string) (slice) 637 + case "pinnedRepositoryDids": 638 + 639 + maj, extra, err = cr.ReadHeader() 640 + if err != nil { 641 + return err 642 + } 643 + 644 + if extra > 8192 { 645 + return fmt.Errorf("t.PinnedRepositoryDids: array too large (%d)", extra) 646 + } 647 + 648 + if maj != cbg.MajArray { 649 + return fmt.Errorf("expected cbor array") 650 + } 651 + 652 + if extra > 0 { 653 + t.PinnedRepositoryDids = make([]string, extra) 654 + } 655 + 656 + for i := 0; i < int(extra); i++ { 657 + { 658 + var maj byte 659 + var extra uint64 660 + var err error 661 + _ = maj 662 + _ = extra 663 + _ = err 664 + 665 + { 666 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 667 + if err != nil { 668 + return err 669 + } 670 + 671 + t.PinnedRepositoryDids[i] = string(sval) 672 + } 673 + 674 + } 675 + } 596 676 597 677 default: 598 678 // Field doesn't exist on this type, so ignore it ··· 611 691 } 612 692 613 693 cw := cbg.NewCborWriter(w) 694 + fieldCount := 5 614 695 615 - if _, err := cw.Write([]byte{164}); err != nil { 696 + if t.SubjectDid == nil { 697 + fieldCount-- 698 + } 699 + 700 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 616 701 return err 617 702 } 618 703 ··· 703 788 if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 704 789 return err 705 790 } 791 + 792 + // t.SubjectDid (string) (string) 793 + if t.SubjectDid != nil { 794 + 795 + if len("subjectDid") > 1000000 { 796 + return xerrors.Errorf("Value in field \"subjectDid\" was too long") 797 + } 798 + 799 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subjectDid"))); err != nil { 800 + return err 801 + } 802 + if _, err := cw.WriteString(string("subjectDid")); err != nil { 803 + return err 804 + } 805 + 806 + if t.SubjectDid == nil { 807 + if _, err := cw.Write(cbg.CborNull); err != nil { 808 + return err 809 + } 810 + } else { 811 + if len(*t.SubjectDid) > 1000000 { 812 + return xerrors.Errorf("Value in field t.SubjectDid was too long") 813 + } 814 + 815 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.SubjectDid))); err != nil { 816 + return err 817 + } 818 + if _, err := cw.WriteString(string(*t.SubjectDid)); err != nil { 819 + return err 820 + } 821 + } 822 + } 706 823 return nil 707 824 } 708 825 ··· 731 848 732 849 n := extra 733 850 734 - nameBuf := make([]byte, 9) 851 + nameBuf := make([]byte, 10) 735 852 for i := uint64(0); i < n; i++ { 736 853 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 737 854 if err != nil { ··· 791 908 792 909 t.CreatedAt = string(sval) 793 910 } 911 + // t.SubjectDid (string) (string) 912 + case "subjectDid": 913 + 914 + { 915 + b, err := cr.ReadByte() 916 + if err != nil { 917 + return err 918 + } 919 + if b != cbg.CborNull[0] { 920 + if err := cr.UnreadByte(); err != nil { 921 + return err 922 + } 923 + 924 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 925 + if err != nil { 926 + return err 927 + } 928 + 929 + t.SubjectDid = (*string)(&sval) 930 + } 931 + } 794 932 795 933 default: 796 934 // Field doesn't exist on this type, so ignore it ··· 809 947 } 810 948 811 949 cw := cbg.NewCborWriter(w) 950 + fieldCount := 4 812 951 813 - if _, err := cw.Write([]byte{163}); err != nil { 952 + if t.SubjectDid == nil { 953 + fieldCount-- 954 + } 955 + 956 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 814 957 return err 815 958 } 816 959 ··· 878 1021 if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 879 1022 return err 880 1023 } 1024 + 1025 + // t.SubjectDid (string) (string) 1026 + if t.SubjectDid != nil { 1027 + 1028 + if len("subjectDid") > 1000000 { 1029 + return xerrors.Errorf("Value in field \"subjectDid\" was too long") 1030 + } 1031 + 1032 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subjectDid"))); err != nil { 1033 + return err 1034 + } 1035 + if _, err := cw.WriteString(string("subjectDid")); err != nil { 1036 + return err 1037 + } 1038 + 1039 + if t.SubjectDid == nil { 1040 + if _, err := cw.Write(cbg.CborNull); err != nil { 1041 + return err 1042 + } 1043 + } else { 1044 + if len(*t.SubjectDid) > 1000000 { 1045 + return xerrors.Errorf("Value in field t.SubjectDid was too long") 1046 + } 1047 + 1048 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.SubjectDid))); err != nil { 1049 + return err 1050 + } 1051 + if _, err := cw.WriteString(string(*t.SubjectDid)); err != nil { 1052 + return err 1053 + } 1054 + } 1055 + } 881 1056 return nil 882 1057 } 883 1058 ··· 906 1081 907 1082 n := extra 908 1083 909 - nameBuf := make([]byte, 9) 1084 + nameBuf := make([]byte, 10) 910 1085 for i := uint64(0); i < n; i++ { 911 1086 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 912 1087 if err != nil { ··· 954 1129 } 955 1130 956 1131 t.CreatedAt = string(sval) 1132 + } 1133 + // t.SubjectDid (string) (string) 1134 + case "subjectDid": 1135 + 1136 + { 1137 + b, err := cr.ReadByte() 1138 + if err != nil { 1139 + return err 1140 + } 1141 + if b != cbg.CborNull[0] { 1142 + if err := cr.UnreadByte(); err != nil { 1143 + return err 1144 + } 1145 + 1146 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1147 + if err != nil { 1148 + return err 1149 + } 1150 + 1151 + t.SubjectDid = (*string)(&sval) 1152 + } 957 1153 } 958 1154 959 1155 default: ··· 3184 3380 } 3185 3381 3186 3382 cw := cbg.NewCborWriter(w) 3383 + fieldCount := 6 3187 3384 3188 - if _, err := cw.Write([]byte{165}); err != nil { 3385 + if t.SubjectDid == nil { 3386 + fieldCount-- 3387 + } 3388 + 3389 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 3189 3390 return err 3190 3391 } 3191 3392 ··· 3283 3484 return err 3284 3485 } 3285 3486 3487 + // t.SubjectDid (string) (string) 3488 + if t.SubjectDid != nil { 3489 + 3490 + if len("subjectDid") > 1000000 { 3491 + return xerrors.Errorf("Value in field \"subjectDid\" was too long") 3492 + } 3493 + 3494 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subjectDid"))); err != nil { 3495 + return err 3496 + } 3497 + if _, err := cw.WriteString(string("subjectDid")); err != nil { 3498 + return err 3499 + } 3500 + 3501 + if t.SubjectDid == nil { 3502 + if _, err := cw.Write(cbg.CborNull); err != nil { 3503 + return err 3504 + } 3505 + } else { 3506 + if len(*t.SubjectDid) > 1000000 { 3507 + return xerrors.Errorf("Value in field t.SubjectDid was too long") 3508 + } 3509 + 3510 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.SubjectDid))); err != nil { 3511 + return err 3512 + } 3513 + if _, err := cw.WriteString(string(*t.SubjectDid)); err != nil { 3514 + return err 3515 + } 3516 + } 3517 + } 3518 + 3286 3519 // t.PerformedAt (string) (string) 3287 3520 if len("performedAt") > 1000000 { 3288 3521 return xerrors.Errorf("Value in field \"performedAt\" was too long") ··· 3468 3701 } 3469 3702 3470 3703 t.Subject = string(sval) 3704 + } 3705 + // t.SubjectDid (string) (string) 3706 + case "subjectDid": 3707 + 3708 + { 3709 + b, err := cr.ReadByte() 3710 + if err != nil { 3711 + return err 3712 + } 3713 + if b != cbg.CborNull[0] { 3714 + if err := cr.UnreadByte(); err != nil { 3715 + return err 3716 + } 3717 + 3718 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3719 + if err != nil { 3720 + return err 3721 + } 3722 + 3723 + t.SubjectDid = (*string)(&sval) 3724 + } 3471 3725 } 3472 3726 // t.PerformedAt (string) (string) 3473 3727 case "performedAt": ··· 5906 6160 } 5907 6161 5908 6162 cw := cbg.NewCborWriter(w) 5909 - fieldCount := 10 6163 + fieldCount := 11 5910 6164 5911 6165 if t.Description == nil { 5912 6166 fieldCount-- 5913 6167 } 5914 6168 5915 6169 if t.Labels == nil { 6170 + fieldCount-- 6171 + } 6172 + 6173 + if t.RepoDid == nil { 5916 6174 fieldCount-- 5917 6175 } 5918 6176 ··· 6102 6360 return err 6103 6361 } 6104 6362 6363 + } 6364 + } 6365 + 6366 + // t.RepoDid (string) (string) 6367 + if t.RepoDid != nil { 6368 + 6369 + if len("repoDid") > 1000000 { 6370 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 6371 + } 6372 + 6373 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 6374 + return err 6375 + } 6376 + if _, err := cw.WriteString(string("repoDid")); err != nil { 6377 + return err 6378 + } 6379 + 6380 + if t.RepoDid == nil { 6381 + if _, err := cw.Write(cbg.CborNull); err != nil { 6382 + return err 6383 + } 6384 + } else { 6385 + if len(*t.RepoDid) > 1000000 { 6386 + return xerrors.Errorf("Value in field t.RepoDid was too long") 6387 + } 6388 + 6389 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 6390 + return err 6391 + } 6392 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 6393 + return err 6394 + } 6105 6395 } 6106 6396 } 6107 6397 ··· 6401 6691 6402 6692 } 6403 6693 } 6694 + // t.RepoDid (string) (string) 6695 + case "repoDid": 6696 + 6697 + { 6698 + b, err := cr.ReadByte() 6699 + if err != nil { 6700 + return err 6701 + } 6702 + if b != cbg.CborNull[0] { 6703 + if err := cr.UnreadByte(); err != nil { 6704 + return err 6705 + } 6706 + 6707 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 6708 + if err != nil { 6709 + return err 6710 + } 6711 + 6712 + t.RepoDid = (*string)(&sval) 6713 + } 6714 + } 6404 6715 // t.Spindle (string) (string) 6405 6716 case "spindle": 6406 6717 ··· 6493 6804 } 6494 6805 6495 6806 cw := cbg.NewCborWriter(w) 6496 - fieldCount := 6 6807 + fieldCount := 7 6808 + 6809 + if t.RepoDid == nil { 6810 + fieldCount-- 6811 + } 6497 6812 6498 6813 if t.Tag == nil { 6499 6814 fieldCount-- ··· 6596 6911 return err 6597 6912 } 6598 6913 6914 + // t.RepoDid (string) (string) 6915 + if t.RepoDid != nil { 6916 + 6917 + if len("repoDid") > 1000000 { 6918 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 6919 + } 6920 + 6921 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 6922 + return err 6923 + } 6924 + if _, err := cw.WriteString(string("repoDid")); err != nil { 6925 + return err 6926 + } 6927 + 6928 + if t.RepoDid == nil { 6929 + if _, err := cw.Write(cbg.CborNull); err != nil { 6930 + return err 6931 + } 6932 + } else { 6933 + if len(*t.RepoDid) > 1000000 { 6934 + return xerrors.Errorf("Value in field t.RepoDid was too long") 6935 + } 6936 + 6937 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 6938 + return err 6939 + } 6940 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 6941 + return err 6942 + } 6943 + } 6944 + } 6945 + 6599 6946 // t.Artifact (util.LexBlob) (struct) 6600 6947 if len("artifact") > 1000000 { 6601 6948 return xerrors.Errorf("Value in field \"artifact\" was too long") ··· 6734 7081 6735 7082 t.LexiconTypeID = string(sval) 6736 7083 } 7084 + // t.RepoDid (string) (string) 7085 + case "repoDid": 7086 + 7087 + { 7088 + b, err := cr.ReadByte() 7089 + if err != nil { 7090 + return err 7091 + } 7092 + if b != cbg.CborNull[0] { 7093 + if err := cr.UnreadByte(); err != nil { 7094 + return err 7095 + } 7096 + 7097 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7098 + if err != nil { 7099 + return err 7100 + } 7101 + 7102 + t.RepoDid = (*string)(&sval) 7103 + } 7104 + } 6737 7105 // t.Artifact (util.LexBlob) (struct) 6738 7106 case "artifact": 6739 7107 ··· 6783 7151 } 6784 7152 6785 7153 cw := cbg.NewCborWriter(w) 7154 + fieldCount := 5 6786 7155 6787 - if _, err := cw.Write([]byte{164}); err != nil { 7156 + if t.RepoDid == nil { 7157 + fieldCount-- 7158 + } 7159 + 7160 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 6788 7161 return err 6789 7162 } 6790 7163 ··· 6830 7203 return err 6831 7204 } 6832 7205 7206 + // t.RepoDid (string) (string) 7207 + if t.RepoDid != nil { 7208 + 7209 + if len("repoDid") > 1000000 { 7210 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 7211 + } 7212 + 7213 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 7214 + return err 7215 + } 7216 + if _, err := cw.WriteString(string("repoDid")); err != nil { 7217 + return err 7218 + } 7219 + 7220 + if t.RepoDid == nil { 7221 + if _, err := cw.Write(cbg.CborNull); err != nil { 7222 + return err 7223 + } 7224 + } else { 7225 + if len(*t.RepoDid) > 1000000 { 7226 + return xerrors.Errorf("Value in field t.RepoDid was too long") 7227 + } 7228 + 7229 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 7230 + return err 7231 + } 7232 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 7233 + return err 7234 + } 7235 + } 7236 + } 7237 + 6833 7238 // t.Subject (string) (string) 6834 7239 if len("subject") > 1000000 { 6835 7240 return xerrors.Errorf("Value in field \"subject\" was too long") ··· 6941 7346 6942 7347 t.LexiconTypeID = string(sval) 6943 7348 } 7349 + // t.RepoDid (string) (string) 7350 + case "repoDid": 7351 + 7352 + { 7353 + b, err := cr.ReadByte() 7354 + if err != nil { 7355 + return err 7356 + } 7357 + if b != cbg.CborNull[0] { 7358 + if err := cr.UnreadByte(); err != nil { 7359 + return err 7360 + } 7361 + 7362 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7363 + if err != nil { 7364 + return err 7365 + } 7366 + 7367 + t.RepoDid = (*string)(&sval) 7368 + } 7369 + } 6944 7370 // t.Subject (string) (string) 6945 7371 case "subject": 6946 7372 ··· 6981 7407 } 6982 7408 6983 7409 cw := cbg.NewCborWriter(w) 6984 - fieldCount := 7 7410 + fieldCount := 8 6985 7411 6986 7412 if t.Body == nil { 6987 7413 fieldCount-- ··· 6992 7418 } 6993 7419 6994 7420 if t.References == nil { 7421 + fieldCount-- 7422 + } 7423 + 7424 + if t.RepoDid == nil { 6995 7425 fieldCount-- 6996 7426 } 6997 7427 ··· 7096 7526 return err 7097 7527 } 7098 7528 7529 + // t.RepoDid (string) (string) 7530 + if t.RepoDid != nil { 7531 + 7532 + if len("repoDid") > 1000000 { 7533 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 7534 + } 7535 + 7536 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 7537 + return err 7538 + } 7539 + if _, err := cw.WriteString(string("repoDid")); err != nil { 7540 + return err 7541 + } 7542 + 7543 + if t.RepoDid == nil { 7544 + if _, err := cw.Write(cbg.CborNull); err != nil { 7545 + return err 7546 + } 7547 + } else { 7548 + if len(*t.RepoDid) > 1000000 { 7549 + return xerrors.Errorf("Value in field t.RepoDid was too long") 7550 + } 7551 + 7552 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 7553 + return err 7554 + } 7555 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 7556 + return err 7557 + } 7558 + } 7559 + } 7560 + 7099 7561 // t.Mentions ([]string) (slice) 7100 7562 if t.Mentions != nil { 7101 7563 ··· 7287 7749 } 7288 7750 7289 7751 t.Title = string(sval) 7752 + } 7753 + // t.RepoDid (string) (string) 7754 + case "repoDid": 7755 + 7756 + { 7757 + b, err := cr.ReadByte() 7758 + if err != nil { 7759 + return err 7760 + } 7761 + if b != cbg.CborNull[0] { 7762 + if err := cr.UnreadByte(); err != nil { 7763 + return err 7764 + } 7765 + 7766 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7767 + if err != nil { 7768 + return err 7769 + } 7770 + 7771 + t.RepoDid = (*string)(&sval) 7772 + } 7290 7773 } 7291 7774 // t.Mentions ([]string) (slice) 7292 7775 case "mentions": ··· 8890 9373 } 8891 9374 8892 9375 cw := cbg.NewCborWriter(w) 8893 - fieldCount := 3 9376 + fieldCount := 4 8894 9377 8895 9378 if t.Repo == nil { 9379 + fieldCount-- 9380 + } 9381 + 9382 + if t.RepoDid == nil { 8896 9383 fieldCount-- 8897 9384 } 8898 9385 ··· 8977 9464 if _, err := cw.WriteString(string(t.Branch)); err != nil { 8978 9465 return err 8979 9466 } 9467 + 9468 + // t.RepoDid (string) (string) 9469 + if t.RepoDid != nil { 9470 + 9471 + if len("repoDid") > 1000000 { 9472 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 9473 + } 9474 + 9475 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 9476 + return err 9477 + } 9478 + if _, err := cw.WriteString(string("repoDid")); err != nil { 9479 + return err 9480 + } 9481 + 9482 + if t.RepoDid == nil { 9483 + if _, err := cw.Write(cbg.CborNull); err != nil { 9484 + return err 9485 + } 9486 + } else { 9487 + if len(*t.RepoDid) > 1000000 { 9488 + return xerrors.Errorf("Value in field t.RepoDid was too long") 9489 + } 9490 + 9491 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 9492 + return err 9493 + } 9494 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 9495 + return err 9496 + } 9497 + } 9498 + } 8980 9499 return nil 8981 9500 } 8982 9501 ··· 9005 9524 9006 9525 n := extra 9007 9526 9008 - nameBuf := make([]byte, 6) 9527 + nameBuf := make([]byte, 7) 9009 9528 for i := uint64(0); i < n; i++ { 9010 9529 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 9011 9530 if err != nil { ··· 9063 9582 } 9064 9583 9065 9584 t.Branch = string(sval) 9585 + } 9586 + // t.RepoDid (string) (string) 9587 + case "repoDid": 9588 + 9589 + { 9590 + b, err := cr.ReadByte() 9591 + if err != nil { 9592 + return err 9593 + } 9594 + if b != cbg.CborNull[0] { 9595 + if err := cr.UnreadByte(); err != nil { 9596 + return err 9597 + } 9598 + 9599 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 9600 + if err != nil { 9601 + return err 9602 + } 9603 + 9604 + t.RepoDid = (*string)(&sval) 9605 + } 9066 9606 } 9067 9607 9068 9608 default: ··· 9246 9786 } 9247 9787 9248 9788 cw := cbg.NewCborWriter(w) 9789 + fieldCount := 3 9249 9790 9250 - if _, err := cw.Write([]byte{162}); err != nil { 9791 + if t.RepoDid == nil { 9792 + fieldCount-- 9793 + } 9794 + 9795 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 9251 9796 return err 9252 9797 } 9253 9798 ··· 9296 9841 if _, err := cw.WriteString(string(t.Branch)); err != nil { 9297 9842 return err 9298 9843 } 9844 + 9845 + // t.RepoDid (string) (string) 9846 + if t.RepoDid != nil { 9847 + 9848 + if len("repoDid") > 1000000 { 9849 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 9850 + } 9851 + 9852 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 9853 + return err 9854 + } 9855 + if _, err := cw.WriteString(string("repoDid")); err != nil { 9856 + return err 9857 + } 9858 + 9859 + if t.RepoDid == nil { 9860 + if _, err := cw.Write(cbg.CborNull); err != nil { 9861 + return err 9862 + } 9863 + } else { 9864 + if len(*t.RepoDid) > 1000000 { 9865 + return xerrors.Errorf("Value in field t.RepoDid was too long") 9866 + } 9867 + 9868 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 9869 + return err 9870 + } 9871 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 9872 + return err 9873 + } 9874 + } 9875 + } 9299 9876 return nil 9300 9877 } 9301 9878 ··· 9324 9901 9325 9902 n := extra 9326 9903 9327 - nameBuf := make([]byte, 6) 9904 + nameBuf := make([]byte, 7) 9328 9905 for i := uint64(0); i < n; i++ { 9329 9906 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 9330 9907 if err != nil { ··· 9361 9938 } 9362 9939 9363 9940 t.Branch = string(sval) 9941 + } 9942 + // t.RepoDid (string) (string) 9943 + case "repoDid": 9944 + 9945 + { 9946 + b, err := cr.ReadByte() 9947 + if err != nil { 9948 + return err 9949 + } 9950 + if b != cbg.CborNull[0] { 9951 + if err := cr.UnreadByte(); err != nil { 9952 + return err 9953 + } 9954 + 9955 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 9956 + if err != nil { 9957 + return err 9958 + } 9959 + 9960 + t.RepoDid = (*string)(&sval) 9961 + } 9364 9962 } 9365 9963 9366 9964 default:
+5 -4
api/tangled/feedreaction.go
··· 17 17 } // 18 18 // RECORDTYPE: FeedReaction 19 19 type FeedReaction struct { 20 - LexiconTypeID string `json:"$type,const=sh.tangled.feed.reaction" cborgen:"$type,const=sh.tangled.feed.reaction"` 21 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 22 - Reaction string `json:"reaction" cborgen:"reaction"` 23 - Subject string `json:"subject" cborgen:"subject"` 20 + LexiconTypeID string `json:"$type,const=sh.tangled.feed.reaction" cborgen:"$type,const=sh.tangled.feed.reaction"` 21 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 22 + Reaction string `json:"reaction" cborgen:"reaction"` 23 + Subject string `json:"subject" cborgen:"subject"` 24 + SubjectDid *string `json:"subjectDid,omitempty" cborgen:"subjectDid,omitempty"` 24 25 }
+4 -3
api/tangled/feedstar.go
··· 17 17 } // 18 18 // RECORDTYPE: FeedStar 19 19 type FeedStar struct { 20 - LexiconTypeID string `json:"$type,const=sh.tangled.feed.star" cborgen:"$type,const=sh.tangled.feed.star"` 21 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 22 - Subject string `json:"subject" cborgen:"subject"` 20 + LexiconTypeID string `json:"$type,const=sh.tangled.feed.star" cborgen:"$type,const=sh.tangled.feed.star"` 21 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 22 + Subject string `json:"subject" cborgen:"subject"` 23 + SubjectDid *string `json:"subjectDid,omitempty" cborgen:"subjectDid,omitempty"` 23 24 }
+2 -1
api/tangled/labelop.go
··· 22 22 Delete []*LabelOp_Operand `json:"delete" cborgen:"delete"` 23 23 PerformedAt string `json:"performedAt" cborgen:"performedAt"` 24 24 // subject: The subject (task, pull or discussion) of this label. Appviews may apply a `scope` check and refuse this op. 25 - Subject string `json:"subject" cborgen:"subject"` 25 + Subject string `json:"subject" cborgen:"subject"` 26 + SubjectDid *string `json:"subjectDid,omitempty" cborgen:"subjectDid,omitempty"` 26 27 } 27 28 28 29 // LabelOp_Operand is a "operand" in the sh.tangled.label.op schema.
+2 -1
api/tangled/repoartifact.go
··· 25 25 // name: name of the artifact 26 26 Name string `json:"name" cborgen:"name"` 27 27 // repo: repo that this artifact is being uploaded to 28 - Repo string `json:"repo" cborgen:"repo"` 28 + Repo string `json:"repo" cborgen:"repo"` 29 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 29 30 // tag: hash of the tag object that this artifact is attached to (only annotated tags are supported) 30 31 Tag util.LexBytes `json:"tag,omitempty" cborgen:"tag,omitempty"` 31 32 }
+3 -2
api/tangled/repocollaborator.go
··· 20 20 LexiconTypeID string `json:"$type,const=sh.tangled.repo.collaborator" cborgen:"$type,const=sh.tangled.repo.collaborator"` 21 21 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 22 22 // repo: repo to add this user to 23 - Repo string `json:"repo" cborgen:"repo"` 24 - Subject string `json:"subject" cborgen:"subject"` 23 + Repo string `json:"repo" cborgen:"repo"` 24 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 25 + Subject string `json:"subject" cborgen:"subject"` 25 26 }
+1
api/tangled/repoissue.go
··· 23 23 Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"` 24 24 References []string `json:"references,omitempty" cborgen:"references,omitempty"` 25 25 Repo string `json:"repo" cborgen:"repo"` 26 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 26 27 Title string `json:"title" cborgen:"title"` 27 28 }
+7 -5
api/tangled/repopull.go
··· 33 33 34 34 // RepoPull_Source is a "source" in the sh.tangled.repo.pull schema. 35 35 type RepoPull_Source struct { 36 - Branch string `json:"branch" cborgen:"branch"` 37 - Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` 38 - Sha string `json:"sha" cborgen:"sha"` 36 + Branch string `json:"branch" cborgen:"branch"` 37 + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` 38 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 39 + Sha string `json:"sha" cborgen:"sha"` 39 40 } 40 41 41 42 // RepoPull_Target is a "target" in the sh.tangled.repo.pull schema. 42 43 type RepoPull_Target struct { 43 - Branch string `json:"branch" cborgen:"branch"` 44 - Repo string `json:"repo" cborgen:"repo"` 44 + Branch string `json:"branch" cborgen:"branch"` 45 + Repo string `json:"repo" cborgen:"repo"` 46 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 45 47 }
+33
api/tangled/reporesolveAtUri.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package tangled 4 + 5 + // schema: sh.tangled.repo.resolveAtUri 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/lex/util" 11 + ) 12 + 13 + const ( 14 + RepoResolveAtUriNSID = "sh.tangled.repo.resolveAtUri" 15 + ) 16 + 17 + // RepoResolveAtUri_Output is the output of a sh.tangled.repo.resolveAtUri call. 18 + type RepoResolveAtUri_Output struct { 19 + Did string `json:"did" cborgen:"did"` 20 + } 21 + 22 + // RepoResolveAtUri calls the XRPC method "sh.tangled.repo.resolveAtUri". 23 + func RepoResolveAtUri(ctx context.Context, c util.LexClient, atUri string) (*RepoResolveAtUri_Output, error) { 24 + var out RepoResolveAtUri_Output 25 + 26 + params := map[string]interface{}{} 27 + params["atUri"] = atUri 28 + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.resolveAtUri", params, nil, &out); err != nil { 29 + return nil, err 30 + } 31 + 32 + return &out, nil 33 + }
+2 -1
api/tangled/tangledrepo.go
··· 25 25 // labels: List of labels that this repo subscribes to 26 26 Labels []string `json:"labels,omitempty" cborgen:"labels,omitempty"` 27 27 // name: name of the repo 28 - Name string `json:"name" cborgen:"name"` 28 + Name string `json:"name" cborgen:"name"` 29 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 29 30 // source: source of the repo 30 31 Source *string `json:"source,omitempty" cborgen:"source,omitempty"` 31 32 // spindle: CI runner to send jobs to and receive results from
+39
appview/db/db.go
··· 1255 1255 return err 1256 1256 }) 1257 1257 1258 + orm.RunMigration(conn, logger, "add-repo-did-column", func(tx *sql.Tx) error { 1259 + _, err := tx.Exec(` 1260 + alter table repos add column repo_did text; 1261 + create unique index if not exists idx_repos_repo_did on repos(repo_did); 1262 + 1263 + alter table issues add column repo_did text; 1264 + alter table pulls add column repo_did text; 1265 + alter table artifacts add column repo_did text; 1266 + alter table webhooks add column repo_did text; 1267 + alter table collaborators add column repo_did text; 1268 + alter table pull_comments add column repo_did text; 1269 + alter table profile_pinned_repositories add column repo_did text; 1270 + alter table repo_issue_seqs add column repo_did text; 1271 + alter table repo_pull_seqs add column repo_did text; 1272 + alter table repo_languages add column repo_did text; 1273 + alter table repo_labels add column repo_did text; 1274 + alter table stars add column subject_did text; 1275 + `) 1276 + return err 1277 + }) 1278 + 1279 + orm.RunMigration(conn, logger, "add-pds-rewrite-status", func(tx *sql.Tx) error { 1280 + _, err := tx.Exec(` 1281 + create table if not exists pds_rewrite_status ( 1282 + id integer primary key autoincrement, 1283 + user_did text not null, 1284 + repo_did text not null, 1285 + record_nsid text not null, 1286 + record_rkey text not null, 1287 + old_repo_at text not null, 1288 + status text not null default 'pending', 1289 + updated_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')), 1290 + unique(user_did, record_nsid, record_rkey) 1291 + ); 1292 + create index if not exists idx_pds_rewrite_user on pds_rewrite_status(user_did, status); 1293 + `) 1294 + return err 1295 + }) 1296 + 1258 1297 return &DB{ 1259 1298 db, 1260 1299 logger,
+12
knotserver/db/db.go
··· 65 65 primary key (rkey, nsid) 66 66 ); 67 67 68 + create table if not exists repo_keys ( 69 + repo_did text primary key, 70 + signing_key blob not null, 71 + created_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')) 72 + ); 73 + 74 + create table if not exists repo_at_history ( 75 + old_repo_at text primary key, 76 + repo_did text not null, 77 + created_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')) 78 + ); 79 + 68 80 create table if not exists migrations ( 69 81 id integer primary key autoincrement, 70 82 name text unique
+9
lexicons/actor/profile.json
··· 60 60 "maxGraphemes": 40, 61 61 "maxLength": 400 62 62 }, 63 + "pinnedRepositoryDids": { 64 + "type": "array", 65 + "minLength": 0, 66 + "maxLength": 6, 67 + "items": { 68 + "type": "string", 69 + "format": "did" 70 + } 71 + }, 63 72 "pinnedRepositories": { 64 73 "type": "array", 65 74 "description": "Any ATURI, it is up to appviews to validate these fields.",
+4
lexicons/feed/reaction.json
··· 19 19 "type": "string", 20 20 "format": "at-uri" 21 21 }, 22 + "subjectDid": { 23 + "type": "string", 24 + "format": "did" 25 + }, 22 26 "reaction": { 23 27 "type": "string", 24 28 "enum": [ "👍", "👎", "😆", "🎉", "🫤", "❤️", "🚀", "👀" ]
+4
lexicons/feed/star.json
··· 18 18 "type": "string", 19 19 "format": "at-uri" 20 20 }, 21 + "subjectDid": { 22 + "type": "string", 23 + "format": "did" 24 + }, 21 25 "createdAt": { 22 26 "type": "string", 23 27 "format": "datetime"
+4
lexicons/issue/issue.json
··· 15 15 "type": "string", 16 16 "format": "at-uri" 17 17 }, 18 + "repoDid": { 19 + "type": "string", 20 + "format": "did" 21 + }, 18 22 "title": { 19 23 "type": "string" 20 24 },
+4
lexicons/label/op.json
··· 21 21 "format": "at-uri", 22 22 "description": "The subject (task, pull or discussion) of this label. Appviews may apply a `scope` check and refuse this op." 23 23 }, 24 + "subjectDid": { 25 + "type": "string", 26 + "format": "did" 27 + }, 24 28 "performedAt": { 25 29 "type": "string", 26 30 "format": "datetime"
+8
lexicons/pulls/pull.json
··· 73 73 "type": "string", 74 74 "format": "at-uri" 75 75 }, 76 + "repoDid": { 77 + "type": "string", 78 + "format": "did" 79 + }, 76 80 "branch": { 77 81 "type": "string" 78 82 } ··· 96 100 "repo": { 97 101 "type": "string", 98 102 "format": "at-uri" 103 + }, 104 + "repoDid": { 105 + "type": "string", 106 + "format": "did" 99 107 } 100 108 } 101 109 }
+4
lexicons/repo/artifact.json
··· 26 26 "format": "at-uri", 27 27 "description": "repo that this artifact is being uploaded to" 28 28 }, 29 + "repoDid": { 30 + "type": "string", 31 + "format": "did" 32 + }, 29 33 "tag": { 30 34 "type": "bytes", 31 35 "description": "hash of the tag object that this artifact is attached to (only annotated tags are supported)",
+4
lexicons/repo/collaborator.json
··· 24 24 "description": "repo to add this user to", 25 25 "format": "at-uri" 26 26 }, 27 + "repoDid": { 28 + "type": "string", 29 + "format": "did" 30 + }, 27 31 "createdAt": { 28 32 "type": "string", 29 33 "format": "datetime"
+4
lexicons/repo/repo.json
··· 60 60 "format": "at-uri" 61 61 } 62 62 }, 63 + "repoDid": { 64 + "type": "string", 65 + "format": "did" 66 + }, 63 67 "createdAt": { 64 68 "type": "string", 65 69 "format": "datetime"
+35
lexicons/repo/resolveAtUri.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.resolveAtUri", 4 + "defs": { 5 + "main": { 6 + "type": "query", 7 + "parameters": { 8 + "type": "params", 9 + "required": ["atUri"], 10 + "properties": { 11 + "atUri": { 12 + "type": "string", 13 + "format": "at-uri" 14 + } 15 + } 16 + }, 17 + "output": { 18 + "encoding": "application/json", 19 + "schema": { 20 + "type": "object", 21 + "required": ["did"], 22 + "properties": { 23 + "did": { 24 + "type": "string", 25 + "format": "did" 26 + } 27 + } 28 + } 29 + }, 30 + "errors": [ 31 + { "name": "NotFound" } 32 + ] 33 + } 34 + } 35 + }