Monorepo for Tangled

lexicons, api/tangled: add repoDid field to all repo-scoped lexicons

Signed-off-by: Lewis <lewis@tangled.org>
Lewis: May this revision serve well! <lewis@tangled.org>

authored by oyster.cafe and committed by tangled.org a91facf1 7b3842c8

+1047 -195
+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 // preferredHandle: A handle the user prefers to be displayed as. 33 34 PreferredHandle *string `json:"preferredHandle,omitempty" cborgen:"preferredHandle,omitempty"` 34 35 // pronouns: Preferred gender pronouns.
+902 -143
api/tangled/cbor_gen.go
··· 26 26 } 27 27 28 28 cw := cbg.NewCborWriter(w) 29 - fieldCount := 10 29 + fieldCount := 11 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 ··· 353 357 354 358 } 355 359 } 360 + 361 + // t.PinnedRepositoryDids ([]string) (slice) 362 + if t.PinnedRepositoryDids != nil { 363 + 364 + if len("pinnedRepositoryDids") > 1000000 { 365 + return xerrors.Errorf("Value in field \"pinnedRepositoryDids\" was too long") 366 + } 367 + 368 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pinnedRepositoryDids"))); err != nil { 369 + return err 370 + } 371 + if _, err := cw.WriteString(string("pinnedRepositoryDids")); err != nil { 372 + return err 373 + } 374 + 375 + if len(t.PinnedRepositoryDids) > 8192 { 376 + return xerrors.Errorf("Slice value in field t.PinnedRepositoryDids was too long") 377 + } 378 + 379 + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.PinnedRepositoryDids))); err != nil { 380 + return err 381 + } 382 + for _, v := range t.PinnedRepositoryDids { 383 + if len(v) > 1000000 { 384 + return xerrors.Errorf("Value in field v was too long") 385 + } 386 + 387 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil { 388 + return err 389 + } 390 + if _, err := cw.WriteString(string(v)); err != nil { 391 + return err 392 + } 393 + 394 + } 395 + } 356 396 return nil 357 397 } 358 398 ··· 381 421 382 422 n := extra 383 423 384 - nameBuf := make([]byte, 18) 424 + nameBuf := make([]byte, 20) 385 425 for i := uint64(0); i < n; i++ { 386 426 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 387 427 if err != nil { ··· 650 690 651 691 } 652 692 } 693 + // t.PinnedRepositoryDids ([]string) (slice) 694 + case "pinnedRepositoryDids": 695 + 696 + maj, extra, err = cr.ReadHeader() 697 + if err != nil { 698 + return err 699 + } 700 + 701 + if extra > 8192 { 702 + return fmt.Errorf("t.PinnedRepositoryDids: array too large (%d)", extra) 703 + } 704 + 705 + if maj != cbg.MajArray { 706 + return fmt.Errorf("expected cbor array") 707 + } 708 + 709 + if extra > 0 { 710 + t.PinnedRepositoryDids = make([]string, extra) 711 + } 712 + 713 + for i := 0; i < int(extra); i++ { 714 + { 715 + var maj byte 716 + var extra uint64 717 + var err error 718 + _ = maj 719 + _ = extra 720 + _ = err 721 + 722 + { 723 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 724 + if err != nil { 725 + return err 726 + } 727 + 728 + t.PinnedRepositoryDids[i] = string(sval) 729 + } 730 + 731 + } 732 + } 653 733 654 734 default: 655 735 // Field doesn't exist on this type, so ignore it ··· 866 946 } 867 947 868 948 cw := cbg.NewCborWriter(w) 949 + fieldCount := 4 869 950 870 - if _, err := cw.Write([]byte{163}); err != nil { 951 + if t.Subject == nil { 952 + fieldCount-- 953 + } 954 + 955 + if t.SubjectDid == nil { 956 + fieldCount-- 957 + } 958 + 959 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 871 960 return err 872 961 } 873 962 ··· 891 980 } 892 981 893 982 // t.Subject (string) (string) 894 - if len("subject") > 1000000 { 895 - return xerrors.Errorf("Value in field \"subject\" was too long") 896 - } 983 + if t.Subject != nil { 897 984 898 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { 899 - return err 900 - } 901 - if _, err := cw.WriteString(string("subject")); err != nil { 902 - return err 903 - } 985 + if len("subject") > 1000000 { 986 + return xerrors.Errorf("Value in field \"subject\" was too long") 987 + } 904 988 905 - if len(t.Subject) > 1000000 { 906 - return xerrors.Errorf("Value in field t.Subject was too long") 907 - } 989 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { 990 + return err 991 + } 992 + if _, err := cw.WriteString(string("subject")); err != nil { 993 + return err 994 + } 995 + 996 + if t.Subject == nil { 997 + if _, err := cw.Write(cbg.CborNull); err != nil { 998 + return err 999 + } 1000 + } else { 1001 + if len(*t.Subject) > 1000000 { 1002 + return xerrors.Errorf("Value in field t.Subject was too long") 1003 + } 908 1004 909 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil { 910 - return err 911 - } 912 - if _, err := cw.WriteString(string(t.Subject)); err != nil { 913 - return err 1005 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Subject))); err != nil { 1006 + return err 1007 + } 1008 + if _, err := cw.WriteString(string(*t.Subject)); err != nil { 1009 + return err 1010 + } 1011 + } 914 1012 } 915 1013 916 1014 // t.CreatedAt (string) (string) ··· 935 1033 if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 936 1034 return err 937 1035 } 1036 + 1037 + // t.SubjectDid (string) (string) 1038 + if t.SubjectDid != nil { 1039 + 1040 + if len("subjectDid") > 1000000 { 1041 + return xerrors.Errorf("Value in field \"subjectDid\" was too long") 1042 + } 1043 + 1044 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subjectDid"))); err != nil { 1045 + return err 1046 + } 1047 + if _, err := cw.WriteString(string("subjectDid")); err != nil { 1048 + return err 1049 + } 1050 + 1051 + if t.SubjectDid == nil { 1052 + if _, err := cw.Write(cbg.CborNull); err != nil { 1053 + return err 1054 + } 1055 + } else { 1056 + if len(*t.SubjectDid) > 1000000 { 1057 + return xerrors.Errorf("Value in field t.SubjectDid was too long") 1058 + } 1059 + 1060 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.SubjectDid))); err != nil { 1061 + return err 1062 + } 1063 + if _, err := cw.WriteString(string(*t.SubjectDid)); err != nil { 1064 + return err 1065 + } 1066 + } 1067 + } 938 1068 return nil 939 1069 } 940 1070 ··· 963 1093 964 1094 n := extra 965 1095 966 - nameBuf := make([]byte, 9) 1096 + nameBuf := make([]byte, 10) 967 1097 for i := uint64(0); i < n; i++ { 968 1098 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 969 1099 if err != nil { ··· 994 1124 case "subject": 995 1125 996 1126 { 997 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 1127 + b, err := cr.ReadByte() 998 1128 if err != nil { 999 1129 return err 1000 1130 } 1131 + if b != cbg.CborNull[0] { 1132 + if err := cr.UnreadByte(); err != nil { 1133 + return err 1134 + } 1001 1135 1002 - t.Subject = string(sval) 1136 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1137 + if err != nil { 1138 + return err 1139 + } 1140 + 1141 + t.Subject = (*string)(&sval) 1142 + } 1003 1143 } 1004 1144 // t.CreatedAt (string) (string) 1005 1145 case "createdAt": ··· 1012 1152 1013 1153 t.CreatedAt = string(sval) 1014 1154 } 1155 + // t.SubjectDid (string) (string) 1156 + case "subjectDid": 1157 + 1158 + { 1159 + b, err := cr.ReadByte() 1160 + if err != nil { 1161 + return err 1162 + } 1163 + if b != cbg.CborNull[0] { 1164 + if err := cr.UnreadByte(); err != nil { 1165 + return err 1166 + } 1167 + 1168 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1169 + if err != nil { 1170 + return err 1171 + } 1172 + 1173 + t.SubjectDid = (*string)(&sval) 1174 + } 1175 + } 1015 1176 1016 1177 default: 1017 1178 // Field doesn't exist on this type, so ignore it ··· 1030 1191 } 1031 1192 1032 1193 cw := cbg.NewCborWriter(w) 1194 + fieldCount := 9 1033 1195 1034 - if _, err := cw.Write([]byte{168}); err != nil { 1196 + if t.OwnerDid == nil { 1197 + fieldCount-- 1198 + } 1199 + 1200 + if t.RepoDid == nil { 1201 + fieldCount-- 1202 + } 1203 + 1204 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 1035 1205 return err 1036 1206 } 1037 1207 ··· 1140 1310 } 1141 1311 1142 1312 // t.RepoDid (string) (string) 1143 - if len("repoDid") > 1000000 { 1144 - return xerrors.Errorf("Value in field \"repoDid\" was too long") 1313 + if t.RepoDid != nil { 1314 + 1315 + if len("repoDid") > 1000000 { 1316 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 1317 + } 1318 + 1319 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 1320 + return err 1321 + } 1322 + if _, err := cw.WriteString(string("repoDid")); err != nil { 1323 + return err 1324 + } 1325 + 1326 + if t.RepoDid == nil { 1327 + if _, err := cw.Write(cbg.CborNull); err != nil { 1328 + return err 1329 + } 1330 + } else { 1331 + if len(*t.RepoDid) > 1000000 { 1332 + return xerrors.Errorf("Value in field t.RepoDid was too long") 1333 + } 1334 + 1335 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 1336 + return err 1337 + } 1338 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 1339 + return err 1340 + } 1341 + } 1145 1342 } 1146 1343 1147 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 1148 - return err 1149 - } 1150 - if _, err := cw.WriteString(string("repoDid")); err != nil { 1151 - return err 1152 - } 1344 + // t.OwnerDid (string) (string) 1345 + if t.OwnerDid != nil { 1153 1346 1154 - if len(t.RepoDid) > 1000000 { 1155 - return xerrors.Errorf("Value in field t.RepoDid was too long") 1156 - } 1347 + if len("ownerDid") > 1000000 { 1348 + return xerrors.Errorf("Value in field \"ownerDid\" was too long") 1349 + } 1157 1350 1158 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RepoDid))); err != nil { 1159 - return err 1160 - } 1161 - if _, err := cw.WriteString(string(t.RepoDid)); err != nil { 1162 - return err 1351 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ownerDid"))); err != nil { 1352 + return err 1353 + } 1354 + if _, err := cw.WriteString(string("ownerDid")); err != nil { 1355 + return err 1356 + } 1357 + 1358 + if t.OwnerDid == nil { 1359 + if _, err := cw.Write(cbg.CborNull); err != nil { 1360 + return err 1361 + } 1362 + } else { 1363 + if len(*t.OwnerDid) > 1000000 { 1364 + return xerrors.Errorf("Value in field t.OwnerDid was too long") 1365 + } 1366 + 1367 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.OwnerDid))); err != nil { 1368 + return err 1369 + } 1370 + if _, err := cw.WriteString(string(*t.OwnerDid)); err != nil { 1371 + return err 1372 + } 1373 + } 1163 1374 } 1164 1375 1165 1376 // t.RepoName (string) (string) ··· 1319 1530 case "repoDid": 1320 1531 1321 1532 { 1322 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 1533 + b, err := cr.ReadByte() 1534 + if err != nil { 1535 + return err 1536 + } 1537 + if b != cbg.CborNull[0] { 1538 + if err := cr.UnreadByte(); err != nil { 1539 + return err 1540 + } 1541 + 1542 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1543 + if err != nil { 1544 + return err 1545 + } 1546 + 1547 + t.RepoDid = (*string)(&sval) 1548 + } 1549 + } 1550 + // t.OwnerDid (string) (string) 1551 + case "ownerDid": 1552 + 1553 + { 1554 + b, err := cr.ReadByte() 1323 1555 if err != nil { 1324 1556 return err 1325 1557 } 1558 + if b != cbg.CborNull[0] { 1559 + if err := cr.UnreadByte(); err != nil { 1560 + return err 1561 + } 1326 1562 1327 - t.RepoDid = string(sval) 1563 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1564 + if err != nil { 1565 + return err 1566 + } 1567 + 1568 + t.OwnerDid = (*string)(&sval) 1569 + } 1328 1570 } 1329 1571 // t.RepoName (string) (string) 1330 1572 case "repoName": ··· 5359 5601 } 5360 5602 5361 5603 cw := cbg.NewCborWriter(w) 5604 + fieldCount := 5 5362 5605 5363 - if _, err := cw.Write([]byte{164}); err != nil { 5606 + if t.Repo == nil { 5607 + fieldCount-- 5608 + } 5609 + 5610 + if t.RepoDid == nil { 5611 + fieldCount-- 5612 + } 5613 + 5614 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 5364 5615 return err 5365 5616 } 5366 5617 ··· 5411 5662 } 5412 5663 5413 5664 // t.Repo (string) (string) 5414 - if len("repo") > 1000000 { 5415 - return xerrors.Errorf("Value in field \"repo\" was too long") 5665 + if t.Repo != nil { 5666 + 5667 + if len("repo") > 1000000 { 5668 + return xerrors.Errorf("Value in field \"repo\" was too long") 5669 + } 5670 + 5671 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 5672 + return err 5673 + } 5674 + if _, err := cw.WriteString(string("repo")); err != nil { 5675 + return err 5676 + } 5677 + 5678 + if t.Repo == nil { 5679 + if _, err := cw.Write(cbg.CborNull); err != nil { 5680 + return err 5681 + } 5682 + } else { 5683 + if len(*t.Repo) > 1000000 { 5684 + return xerrors.Errorf("Value in field t.Repo was too long") 5685 + } 5686 + 5687 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { 5688 + return err 5689 + } 5690 + if _, err := cw.WriteString(string(*t.Repo)); err != nil { 5691 + return err 5692 + } 5693 + } 5416 5694 } 5417 5695 5418 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 5419 - return err 5420 - } 5421 - if _, err := cw.WriteString(string("repo")); err != nil { 5422 - return err 5423 - } 5696 + // t.RepoDid (string) (string) 5697 + if t.RepoDid != nil { 5698 + 5699 + if len("repoDid") > 1000000 { 5700 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 5701 + } 5702 + 5703 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 5704 + return err 5705 + } 5706 + if _, err := cw.WriteString(string("repoDid")); err != nil { 5707 + return err 5708 + } 5424 5709 5425 - if len(t.Repo) > 1000000 { 5426 - return xerrors.Errorf("Value in field t.Repo was too long") 5427 - } 5710 + if t.RepoDid == nil { 5711 + if _, err := cw.Write(cbg.CborNull); err != nil { 5712 + return err 5713 + } 5714 + } else { 5715 + if len(*t.RepoDid) > 1000000 { 5716 + return xerrors.Errorf("Value in field t.RepoDid was too long") 5717 + } 5428 5718 5429 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { 5430 - return err 5431 - } 5432 - if _, err := cw.WriteString(string(t.Repo)); err != nil { 5433 - return err 5719 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 5720 + return err 5721 + } 5722 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 5723 + return err 5724 + } 5725 + } 5434 5726 } 5435 5727 5436 5728 // t.DefaultBranch (string) (string) ··· 5525 5817 case "repo": 5526 5818 5527 5819 { 5528 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 5820 + b, err := cr.ReadByte() 5821 + if err != nil { 5822 + return err 5823 + } 5824 + if b != cbg.CborNull[0] { 5825 + if err := cr.UnreadByte(); err != nil { 5826 + return err 5827 + } 5828 + 5829 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5830 + if err != nil { 5831 + return err 5832 + } 5833 + 5834 + t.Repo = (*string)(&sval) 5835 + } 5836 + } 5837 + // t.RepoDid (string) (string) 5838 + case "repoDid": 5839 + 5840 + { 5841 + b, err := cr.ReadByte() 5529 5842 if err != nil { 5530 5843 return err 5531 5844 } 5845 + if b != cbg.CborNull[0] { 5846 + if err := cr.UnreadByte(); err != nil { 5847 + return err 5848 + } 5532 5849 5533 - t.Repo = string(sval) 5850 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5851 + if err != nil { 5852 + return err 5853 + } 5854 + 5855 + t.RepoDid = (*string)(&sval) 5856 + } 5534 5857 } 5535 5858 // t.DefaultBranch (string) (string) 5536 5859 case "defaultBranch": ··· 5963 6286 } 5964 6287 5965 6288 cw := cbg.NewCborWriter(w) 5966 - fieldCount := 10 6289 + fieldCount := 11 5967 6290 5968 6291 if t.Description == nil { 5969 6292 fieldCount-- 5970 6293 } 5971 6294 5972 6295 if t.Labels == nil { 6296 + fieldCount-- 6297 + } 6298 + 6299 + if t.RepoDid == nil { 5973 6300 fieldCount-- 5974 6301 } 5975 6302 ··· 6162 6489 } 6163 6490 } 6164 6491 6492 + // t.RepoDid (string) (string) 6493 + if t.RepoDid != nil { 6494 + 6495 + if len("repoDid") > 1000000 { 6496 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 6497 + } 6498 + 6499 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 6500 + return err 6501 + } 6502 + if _, err := cw.WriteString(string("repoDid")); err != nil { 6503 + return err 6504 + } 6505 + 6506 + if t.RepoDid == nil { 6507 + if _, err := cw.Write(cbg.CborNull); err != nil { 6508 + return err 6509 + } 6510 + } else { 6511 + if len(*t.RepoDid) > 1000000 { 6512 + return xerrors.Errorf("Value in field t.RepoDid was too long") 6513 + } 6514 + 6515 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 6516 + return err 6517 + } 6518 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 6519 + return err 6520 + } 6521 + } 6522 + } 6523 + 6165 6524 // t.Spindle (string) (string) 6166 6525 if t.Spindle != nil { 6167 6526 ··· 6458 6817 6459 6818 } 6460 6819 } 6820 + // t.RepoDid (string) (string) 6821 + case "repoDid": 6822 + 6823 + { 6824 + b, err := cr.ReadByte() 6825 + if err != nil { 6826 + return err 6827 + } 6828 + if b != cbg.CborNull[0] { 6829 + if err := cr.UnreadByte(); err != nil { 6830 + return err 6831 + } 6832 + 6833 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 6834 + if err != nil { 6835 + return err 6836 + } 6837 + 6838 + t.RepoDid = (*string)(&sval) 6839 + } 6840 + } 6461 6841 // t.Spindle (string) (string) 6462 6842 case "spindle": 6463 6843 ··· 6550 6930 } 6551 6931 6552 6932 cw := cbg.NewCborWriter(w) 6553 - fieldCount := 6 6933 + fieldCount := 7 6934 + 6935 + if t.Repo == nil { 6936 + fieldCount-- 6937 + } 6938 + 6939 + if t.RepoDid == nil { 6940 + fieldCount-- 6941 + } 6554 6942 6555 6943 if t.Tag == nil { 6556 6944 fieldCount-- ··· 6612 7000 } 6613 7001 6614 7002 // t.Repo (string) (string) 6615 - if len("repo") > 1000000 { 6616 - return xerrors.Errorf("Value in field \"repo\" was too long") 6617 - } 7003 + if t.Repo != nil { 7004 + 7005 + if len("repo") > 1000000 { 7006 + return xerrors.Errorf("Value in field \"repo\" was too long") 7007 + } 6618 7008 6619 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 6620 - return err 6621 - } 6622 - if _, err := cw.WriteString(string("repo")); err != nil { 6623 - return err 6624 - } 7009 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 7010 + return err 7011 + } 7012 + if _, err := cw.WriteString(string("repo")); err != nil { 7013 + return err 7014 + } 6625 7015 6626 - if len(t.Repo) > 1000000 { 6627 - return xerrors.Errorf("Value in field t.Repo was too long") 6628 - } 7016 + if t.Repo == nil { 7017 + if _, err := cw.Write(cbg.CborNull); err != nil { 7018 + return err 7019 + } 7020 + } else { 7021 + if len(*t.Repo) > 1000000 { 7022 + return xerrors.Errorf("Value in field t.Repo was too long") 7023 + } 6629 7024 6630 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { 6631 - return err 6632 - } 6633 - if _, err := cw.WriteString(string(t.Repo)); err != nil { 6634 - return err 7025 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { 7026 + return err 7027 + } 7028 + if _, err := cw.WriteString(string(*t.Repo)); err != nil { 7029 + return err 7030 + } 7031 + } 6635 7032 } 6636 7033 6637 7034 // t.LexiconTypeID (string) (string) ··· 6651 7048 } 6652 7049 if _, err := cw.WriteString(string("sh.tangled.repo.artifact")); err != nil { 6653 7050 return err 7051 + } 7052 + 7053 + // t.RepoDid (string) (string) 7054 + if t.RepoDid != nil { 7055 + 7056 + if len("repoDid") > 1000000 { 7057 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 7058 + } 7059 + 7060 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 7061 + return err 7062 + } 7063 + if _, err := cw.WriteString(string("repoDid")); err != nil { 7064 + return err 7065 + } 7066 + 7067 + if t.RepoDid == nil { 7068 + if _, err := cw.Write(cbg.CborNull); err != nil { 7069 + return err 7070 + } 7071 + } else { 7072 + if len(*t.RepoDid) > 1000000 { 7073 + return xerrors.Errorf("Value in field t.RepoDid was too long") 7074 + } 7075 + 7076 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 7077 + return err 7078 + } 7079 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 7080 + return err 7081 + } 7082 + } 6654 7083 } 6655 7084 6656 7085 // t.Artifact (util.LexBlob) (struct) ··· 6773 7202 case "repo": 6774 7203 6775 7204 { 6776 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 7205 + b, err := cr.ReadByte() 6777 7206 if err != nil { 6778 7207 return err 6779 7208 } 7209 + if b != cbg.CborNull[0] { 7210 + if err := cr.UnreadByte(); err != nil { 7211 + return err 7212 + } 6780 7213 6781 - t.Repo = string(sval) 7214 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7215 + if err != nil { 7216 + return err 7217 + } 7218 + 7219 + t.Repo = (*string)(&sval) 7220 + } 6782 7221 } 6783 7222 // t.LexiconTypeID (string) (string) 6784 7223 case "$type": ··· 6791 7230 6792 7231 t.LexiconTypeID = string(sval) 6793 7232 } 7233 + // t.RepoDid (string) (string) 7234 + case "repoDid": 7235 + 7236 + { 7237 + b, err := cr.ReadByte() 7238 + if err != nil { 7239 + return err 7240 + } 7241 + if b != cbg.CborNull[0] { 7242 + if err := cr.UnreadByte(); err != nil { 7243 + return err 7244 + } 7245 + 7246 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7247 + if err != nil { 7248 + return err 7249 + } 7250 + 7251 + t.RepoDid = (*string)(&sval) 7252 + } 7253 + } 6794 7254 // t.Artifact (util.LexBlob) (struct) 6795 7255 case "artifact": 6796 7256 ··· 6840 7300 } 6841 7301 6842 7302 cw := cbg.NewCborWriter(w) 7303 + fieldCount := 5 6843 7304 6844 - if _, err := cw.Write([]byte{164}); err != nil { 6845 - return err 7305 + if t.Repo == nil { 7306 + fieldCount-- 6846 7307 } 6847 7308 6848 - // t.Repo (string) (string) 6849 - if len("repo") > 1000000 { 6850 - return xerrors.Errorf("Value in field \"repo\" was too long") 7309 + if t.RepoDid == nil { 7310 + fieldCount-- 6851 7311 } 6852 7312 6853 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 7313 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 6854 7314 return err 6855 7315 } 6856 - if _, err := cw.WriteString(string("repo")); err != nil { 6857 - return err 6858 - } 7316 + 7317 + // t.Repo (string) (string) 7318 + if t.Repo != nil { 7319 + 7320 + if len("repo") > 1000000 { 7321 + return xerrors.Errorf("Value in field \"repo\" was too long") 7322 + } 7323 + 7324 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 7325 + return err 7326 + } 7327 + if _, err := cw.WriteString(string("repo")); err != nil { 7328 + return err 7329 + } 6859 7330 6860 - if len(t.Repo) > 1000000 { 6861 - return xerrors.Errorf("Value in field t.Repo was too long") 6862 - } 7331 + if t.Repo == nil { 7332 + if _, err := cw.Write(cbg.CborNull); err != nil { 7333 + return err 7334 + } 7335 + } else { 7336 + if len(*t.Repo) > 1000000 { 7337 + return xerrors.Errorf("Value in field t.Repo was too long") 7338 + } 6863 7339 6864 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { 6865 - return err 6866 - } 6867 - if _, err := cw.WriteString(string(t.Repo)); err != nil { 6868 - return err 7340 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { 7341 + return err 7342 + } 7343 + if _, err := cw.WriteString(string(*t.Repo)); err != nil { 7344 + return err 7345 + } 7346 + } 6869 7347 } 6870 7348 6871 7349 // t.LexiconTypeID (string) (string) ··· 6887 7365 return err 6888 7366 } 6889 7367 7368 + // t.RepoDid (string) (string) 7369 + if t.RepoDid != nil { 7370 + 7371 + if len("repoDid") > 1000000 { 7372 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 7373 + } 7374 + 7375 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 7376 + return err 7377 + } 7378 + if _, err := cw.WriteString(string("repoDid")); err != nil { 7379 + return err 7380 + } 7381 + 7382 + if t.RepoDid == nil { 7383 + if _, err := cw.Write(cbg.CborNull); err != nil { 7384 + return err 7385 + } 7386 + } else { 7387 + if len(*t.RepoDid) > 1000000 { 7388 + return xerrors.Errorf("Value in field t.RepoDid was too long") 7389 + } 7390 + 7391 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 7392 + return err 7393 + } 7394 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 7395 + return err 7396 + } 7397 + } 7398 + } 7399 + 6890 7400 // t.Subject (string) (string) 6891 7401 if len("subject") > 1000000 { 6892 7402 return xerrors.Errorf("Value in field \"subject\" was too long") ··· 6980 7490 case "repo": 6981 7491 6982 7492 { 6983 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 7493 + b, err := cr.ReadByte() 6984 7494 if err != nil { 6985 7495 return err 6986 7496 } 7497 + if b != cbg.CborNull[0] { 7498 + if err := cr.UnreadByte(); err != nil { 7499 + return err 7500 + } 6987 7501 6988 - t.Repo = string(sval) 7502 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7503 + if err != nil { 7504 + return err 7505 + } 7506 + 7507 + t.Repo = (*string)(&sval) 7508 + } 6989 7509 } 6990 7510 // t.LexiconTypeID (string) (string) 6991 7511 case "$type": ··· 6998 7518 6999 7519 t.LexiconTypeID = string(sval) 7000 7520 } 7521 + // t.RepoDid (string) (string) 7522 + case "repoDid": 7523 + 7524 + { 7525 + b, err := cr.ReadByte() 7526 + if err != nil { 7527 + return err 7528 + } 7529 + if b != cbg.CborNull[0] { 7530 + if err := cr.UnreadByte(); err != nil { 7531 + return err 7532 + } 7533 + 7534 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7535 + if err != nil { 7536 + return err 7537 + } 7538 + 7539 + t.RepoDid = (*string)(&sval) 7540 + } 7541 + } 7001 7542 // t.Subject (string) (string) 7002 7543 case "subject": 7003 7544 ··· 7038 7579 } 7039 7580 7040 7581 cw := cbg.NewCborWriter(w) 7041 - fieldCount := 7 7582 + fieldCount := 8 7042 7583 7043 7584 if t.Body == nil { 7044 7585 fieldCount-- ··· 7052 7593 fieldCount-- 7053 7594 } 7054 7595 7596 + if t.Repo == nil { 7597 + fieldCount-- 7598 + } 7599 + 7600 + if t.RepoDid == nil { 7601 + fieldCount-- 7602 + } 7603 + 7055 7604 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 7056 7605 return err 7057 7606 } ··· 7089 7638 } 7090 7639 7091 7640 // t.Repo (string) (string) 7092 - if len("repo") > 1000000 { 7093 - return xerrors.Errorf("Value in field \"repo\" was too long") 7094 - } 7641 + if t.Repo != nil { 7095 7642 7096 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 7097 - return err 7098 - } 7099 - if _, err := cw.WriteString(string("repo")); err != nil { 7100 - return err 7101 - } 7643 + if len("repo") > 1000000 { 7644 + return xerrors.Errorf("Value in field \"repo\" was too long") 7645 + } 7102 7646 7103 - if len(t.Repo) > 1000000 { 7104 - return xerrors.Errorf("Value in field t.Repo was too long") 7105 - } 7647 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 7648 + return err 7649 + } 7650 + if _, err := cw.WriteString(string("repo")); err != nil { 7651 + return err 7652 + } 7106 7653 7107 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { 7108 - return err 7109 - } 7110 - if _, err := cw.WriteString(string(t.Repo)); err != nil { 7111 - return err 7654 + if t.Repo == nil { 7655 + if _, err := cw.Write(cbg.CborNull); err != nil { 7656 + return err 7657 + } 7658 + } else { 7659 + if len(*t.Repo) > 1000000 { 7660 + return xerrors.Errorf("Value in field t.Repo was too long") 7661 + } 7662 + 7663 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { 7664 + return err 7665 + } 7666 + if _, err := cw.WriteString(string(*t.Repo)); err != nil { 7667 + return err 7668 + } 7669 + } 7112 7670 } 7113 7671 7114 7672 // t.LexiconTypeID (string) (string) ··· 7151 7709 } 7152 7710 if _, err := cw.WriteString(string(t.Title)); err != nil { 7153 7711 return err 7712 + } 7713 + 7714 + // t.RepoDid (string) (string) 7715 + if t.RepoDid != nil { 7716 + 7717 + if len("repoDid") > 1000000 { 7718 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 7719 + } 7720 + 7721 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 7722 + return err 7723 + } 7724 + if _, err := cw.WriteString(string("repoDid")); err != nil { 7725 + return err 7726 + } 7727 + 7728 + if t.RepoDid == nil { 7729 + if _, err := cw.Write(cbg.CborNull); err != nil { 7730 + return err 7731 + } 7732 + } else { 7733 + if len(*t.RepoDid) > 1000000 { 7734 + return xerrors.Errorf("Value in field t.RepoDid was too long") 7735 + } 7736 + 7737 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 7738 + return err 7739 + } 7740 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 7741 + return err 7742 + } 7743 + } 7154 7744 } 7155 7745 7156 7746 // t.Mentions ([]string) (slice) ··· 7316 7906 case "repo": 7317 7907 7318 7908 { 7319 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 7909 + b, err := cr.ReadByte() 7320 7910 if err != nil { 7321 7911 return err 7322 7912 } 7913 + if b != cbg.CborNull[0] { 7914 + if err := cr.UnreadByte(); err != nil { 7915 + return err 7916 + } 7323 7917 7324 - t.Repo = string(sval) 7918 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7919 + if err != nil { 7920 + return err 7921 + } 7922 + 7923 + t.Repo = (*string)(&sval) 7924 + } 7325 7925 } 7326 7926 // t.LexiconTypeID (string) (string) 7327 7927 case "$type": ··· 7344 7944 } 7345 7945 7346 7946 t.Title = string(sval) 7947 + } 7948 + // t.RepoDid (string) (string) 7949 + case "repoDid": 7950 + 7951 + { 7952 + b, err := cr.ReadByte() 7953 + if err != nil { 7954 + return err 7955 + } 7956 + if b != cbg.CborNull[0] { 7957 + if err := cr.UnreadByte(); err != nil { 7958 + return err 7959 + } 7960 + 7961 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7962 + if err != nil { 7963 + return err 7964 + } 7965 + 7966 + t.RepoDid = (*string)(&sval) 7967 + } 7347 7968 } 7348 7969 // t.Mentions ([]string) (slice) 7349 7970 case "mentions": ··· 8947 9568 } 8948 9569 8949 9570 cw := cbg.NewCborWriter(w) 8950 - fieldCount := 3 9571 + fieldCount := 4 8951 9572 8952 9573 if t.Repo == nil { 9574 + fieldCount-- 9575 + } 9576 + 9577 + if t.RepoDid == nil { 8953 9578 fieldCount-- 8954 9579 } 8955 9580 ··· 9034 9659 if _, err := cw.WriteString(string(t.Branch)); err != nil { 9035 9660 return err 9036 9661 } 9662 + 9663 + // t.RepoDid (string) (string) 9664 + if t.RepoDid != nil { 9665 + 9666 + if len("repoDid") > 1000000 { 9667 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 9668 + } 9669 + 9670 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 9671 + return err 9672 + } 9673 + if _, err := cw.WriteString(string("repoDid")); err != nil { 9674 + return err 9675 + } 9676 + 9677 + if t.RepoDid == nil { 9678 + if _, err := cw.Write(cbg.CborNull); err != nil { 9679 + return err 9680 + } 9681 + } else { 9682 + if len(*t.RepoDid) > 1000000 { 9683 + return xerrors.Errorf("Value in field t.RepoDid was too long") 9684 + } 9685 + 9686 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 9687 + return err 9688 + } 9689 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 9690 + return err 9691 + } 9692 + } 9693 + } 9037 9694 return nil 9038 9695 } 9039 9696 ··· 9062 9719 9063 9720 n := extra 9064 9721 9065 - nameBuf := make([]byte, 6) 9722 + nameBuf := make([]byte, 7) 9066 9723 for i := uint64(0); i < n; i++ { 9067 9724 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 9068 9725 if err != nil { ··· 9121 9778 9122 9779 t.Branch = string(sval) 9123 9780 } 9781 + // t.RepoDid (string) (string) 9782 + case "repoDid": 9783 + 9784 + { 9785 + b, err := cr.ReadByte() 9786 + if err != nil { 9787 + return err 9788 + } 9789 + if b != cbg.CborNull[0] { 9790 + if err := cr.UnreadByte(); err != nil { 9791 + return err 9792 + } 9793 + 9794 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 9795 + if err != nil { 9796 + return err 9797 + } 9798 + 9799 + t.RepoDid = (*string)(&sval) 9800 + } 9801 + } 9124 9802 9125 9803 default: 9126 9804 // Field doesn't exist on this type, so ignore it ··· 9303 9981 } 9304 9982 9305 9983 cw := cbg.NewCborWriter(w) 9984 + fieldCount := 3 9306 9985 9307 - if _, err := cw.Write([]byte{162}); err != nil { 9308 - return err 9986 + if t.Repo == nil { 9987 + fieldCount-- 9309 9988 } 9310 9989 9311 - // t.Repo (string) (string) 9312 - if len("repo") > 1000000 { 9313 - return xerrors.Errorf("Value in field \"repo\" was too long") 9990 + if t.RepoDid == nil { 9991 + fieldCount-- 9314 9992 } 9315 9993 9316 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 9317 - return err 9318 - } 9319 - if _, err := cw.WriteString(string("repo")); err != nil { 9994 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 9320 9995 return err 9321 9996 } 9322 9997 9323 - if len(t.Repo) > 1000000 { 9324 - return xerrors.Errorf("Value in field t.Repo was too long") 9325 - } 9998 + // t.Repo (string) (string) 9999 + if t.Repo != nil { 10000 + 10001 + if len("repo") > 1000000 { 10002 + return xerrors.Errorf("Value in field \"repo\" was too long") 10003 + } 9326 10004 9327 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { 9328 - return err 9329 - } 9330 - if _, err := cw.WriteString(string(t.Repo)); err != nil { 9331 - return err 10005 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 10006 + return err 10007 + } 10008 + if _, err := cw.WriteString(string("repo")); err != nil { 10009 + return err 10010 + } 10011 + 10012 + if t.Repo == nil { 10013 + if _, err := cw.Write(cbg.CborNull); err != nil { 10014 + return err 10015 + } 10016 + } else { 10017 + if len(*t.Repo) > 1000000 { 10018 + return xerrors.Errorf("Value in field t.Repo was too long") 10019 + } 10020 + 10021 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { 10022 + return err 10023 + } 10024 + if _, err := cw.WriteString(string(*t.Repo)); err != nil { 10025 + return err 10026 + } 10027 + } 9332 10028 } 9333 10029 9334 10030 // t.Branch (string) (string) ··· 9353 10049 if _, err := cw.WriteString(string(t.Branch)); err != nil { 9354 10050 return err 9355 10051 } 10052 + 10053 + // t.RepoDid (string) (string) 10054 + if t.RepoDid != nil { 10055 + 10056 + if len("repoDid") > 1000000 { 10057 + return xerrors.Errorf("Value in field \"repoDid\" was too long") 10058 + } 10059 + 10060 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { 10061 + return err 10062 + } 10063 + if _, err := cw.WriteString(string("repoDid")); err != nil { 10064 + return err 10065 + } 10066 + 10067 + if t.RepoDid == nil { 10068 + if _, err := cw.Write(cbg.CborNull); err != nil { 10069 + return err 10070 + } 10071 + } else { 10072 + if len(*t.RepoDid) > 1000000 { 10073 + return xerrors.Errorf("Value in field t.RepoDid was too long") 10074 + } 10075 + 10076 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { 10077 + return err 10078 + } 10079 + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { 10080 + return err 10081 + } 10082 + } 10083 + } 9356 10084 return nil 9357 10085 } 9358 10086 ··· 9381 10109 9382 10110 n := extra 9383 10111 9384 - nameBuf := make([]byte, 6) 10112 + nameBuf := make([]byte, 7) 9385 10113 for i := uint64(0); i < n; i++ { 9386 10114 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 9387 10115 if err != nil { ··· 9401 10129 case "repo": 9402 10130 9403 10131 { 9404 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 10132 + b, err := cr.ReadByte() 9405 10133 if err != nil { 9406 10134 return err 9407 10135 } 10136 + if b != cbg.CborNull[0] { 10137 + if err := cr.UnreadByte(); err != nil { 10138 + return err 10139 + } 9408 10140 9409 - t.Repo = string(sval) 10141 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10142 + if err != nil { 10143 + return err 10144 + } 10145 + 10146 + t.Repo = (*string)(&sval) 10147 + } 9410 10148 } 9411 10149 // t.Branch (string) (string) 9412 10150 case "branch": ··· 9418 10156 } 9419 10157 9420 10158 t.Branch = string(sval) 10159 + } 10160 + // t.RepoDid (string) (string) 10161 + case "repoDid": 10162 + 10163 + { 10164 + b, err := cr.ReadByte() 10165 + if err != nil { 10166 + return err 10167 + } 10168 + if b != cbg.CborNull[0] { 10169 + if err := cr.UnreadByte(); err != nil { 10170 + return err 10171 + } 10172 + 10173 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10174 + if err != nil { 10175 + return err 10176 + } 10177 + 10178 + t.RepoDid = (*string)(&sval) 10179 + } 9421 10180 } 9422 10181 9423 10182 default:
+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,omitempty" cborgen:"subject,omitempty"` 23 + SubjectDid *string `json:"subjectDid,omitempty" cborgen:"subjectDid,omitempty"` 23 24 }
+4 -2
api/tangled/gitrefUpdate.go
··· 25 25 NewSha string `json:"newSha" cborgen:"newSha"` 26 26 // oldSha: old SHA of this ref 27 27 OldSha string `json:"oldSha" cborgen:"oldSha"` 28 + // ownerDid: did of the owner of the repo 29 + OwnerDid *string `json:"ownerDid,omitempty" cborgen:"ownerDid,omitempty"` 28 30 // ref: Ref being updated 29 31 Ref string `json:"ref" cborgen:"ref"` 30 - // repoDid: did of the owner of the repo 31 - RepoDid string `json:"repoDid" cborgen:"repoDid"` 32 + // repoDid: DID of the repo itself 33 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 32 34 // repoName: name of the repo 33 35 RepoName string `json:"repoName" cborgen:"repoName"` 34 36 }
+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,omitempty" cborgen:"repo,omitempty"` 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,omitempty" cborgen:"repo,omitempty"` 24 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 25 + Subject string `json:"subject" cborgen:"subject"` 25 26 }
+14 -4
api/tangled/repocreate.go
··· 18 18 type RepoCreate_Input struct { 19 19 // defaultBranch: Default branch to push to 20 20 DefaultBranch *string `json:"defaultBranch,omitempty" cborgen:"defaultBranch,omitempty"` 21 + // name: Name of the repository 22 + Name string `json:"name" cborgen:"name"` 23 + // repoDid: Optional user-provided did:web to use as the repo identity instead of minting a did:plc. 24 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 21 25 // rkey: Rkey of the repository record 22 26 Rkey string `json:"rkey" cborgen:"rkey"` 23 27 // source: A source URL to clone from, populate this when forking or importing a repository. 24 28 Source *string `json:"source,omitempty" cborgen:"source,omitempty"` 29 + } 30 + 31 + // RepoCreate_Output is the output of a sh.tangled.repo.create call. 32 + type RepoCreate_Output struct { 33 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 25 34 } 26 35 27 36 // RepoCreate calls the XRPC method "sh.tangled.repo.create". 28 - func RepoCreate(ctx context.Context, c util.LexClient, input *RepoCreate_Input) error { 29 - if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.create", nil, input, nil); err != nil { 30 - return err 37 + func RepoCreate(ctx context.Context, c util.LexClient, input *RepoCreate_Input) (*RepoCreate_Output, error) { 38 + var out RepoCreate_Output 39 + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.create", nil, input, &out); err != nil { 40 + return nil, err 31 41 } 32 42 33 - return nil 43 + return &out, nil 34 44 }
+2 -1
api/tangled/repoissue.go
··· 22 22 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 23 Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"` 24 24 References []string `json:"references,omitempty" cborgen:"references,omitempty"` 25 - Repo string `json:"repo" cborgen:"repo"` 25 + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` 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,omitempty" cborgen:"repo,omitempty"` 46 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 45 47 }
+6 -4
api/tangled/tangledpipeline.go
··· 66 66 67 67 // Pipeline_TriggerRepo is a "triggerRepo" in the sh.tangled.pipeline schema. 68 68 type Pipeline_TriggerRepo struct { 69 - DefaultBranch string `json:"defaultBranch" cborgen:"defaultBranch"` 70 - Did string `json:"did" cborgen:"did"` 71 - Knot string `json:"knot" cborgen:"knot"` 72 - Repo string `json:"repo" cborgen:"repo"` 69 + DefaultBranch string `json:"defaultBranch" cborgen:"defaultBranch"` 70 + Did string `json:"did" cborgen:"did"` 71 + Knot string `json:"knot" cborgen:"knot"` 72 + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` 73 + // repoDid: DID of the repo itself 74 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 73 75 } 74 76 75 77 // Pipeline_Workflow is a "workflow" in the sh.tangled.pipeline schema.
+2
api/tangled/tangledrepo.go
··· 26 26 Labels []string `json:"labels,omitempty" cborgen:"labels,omitempty"` 27 27 // name: name of the repo 28 28 Name string `json:"name" cborgen:"name"` 29 + // repoDid: DID of the repo itself, if assigned 30 + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 29 31 // source: source of the repo 30 32 Source *string `json:"source,omitempty" cborgen:"source,omitempty"` 31 33 // spindle: CI runner to send jobs to and receive results from
+7 -3
knotmirror/knotstream/slurper.go
··· 274 274 275 275 l := s.logger.With("src", source) 276 276 277 - curr, err := db.GetRepoByName(ctx, s.db, syntax.DID(evt.Event.RepoDid), evt.Event.RepoName) 277 + repoDid := "" 278 + if evt.Event.RepoDid != nil { 279 + repoDid = *evt.Event.RepoDid 280 + } 281 + curr, err := db.GetRepoByName(ctx, s.db, syntax.DID(repoDid), evt.Event.RepoName) 278 282 if err != nil { 279 - return fmt.Errorf("failed to get repo '%s': %w", evt.Event.RepoDid+"/"+evt.Event.RepoName, err) 283 + return fmt.Errorf("failed to get repo '%s': %w", repoDid+"/"+evt.Event.RepoName, err) 280 284 } 281 285 if curr == nil { 282 286 // if repo doesn't exist in DB, just ignore the event. That repo is unknown. ··· 286 290 // But we want to store that in did/rkey in knot-mirror. 287 291 // Therefore, we should ignore when the repository is unknown. 288 292 // Hopefully crawler will sync it later. 289 - l.Warn("skipping event from unknown repo", "did/name", evt.Event.RepoDid+"/"+evt.Event.RepoName) 293 + l.Warn("skipping event from unknown repo", "did/name", repoDid+"/"+evt.Event.RepoName) 290 294 knotstreamEventsSkipped.Inc() 291 295 return nil 292 296 }
+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 -1
lexicons/feed/star.json
··· 10 10 "record": { 11 11 "type": "object", 12 12 "required": [ 13 - "subject", 14 13 "createdAt" 15 14 ], 16 15 "properties": { 17 16 "subject": { 18 17 "type": "string", 19 18 "format": "at-uri" 19 + }, 20 + "subjectDid": { 21 + "type": "string", 22 + "format": "did" 20 23 }, 21 24 "createdAt": { 22 25 "type": "string",
+6 -2
lexicons/git/refUpdate.json
··· 11 11 "required": [ 12 12 "ref", 13 13 "committerDid", 14 - "repoDid", 15 14 "repoName", 16 15 "oldSha", 17 16 "newSha", ··· 29 28 "description": "did of the user that pushed this ref", 30 29 "format": "did" 31 30 }, 31 + "ownerDid": { 32 + "type": "string", 33 + "description": "did of the owner of the repo", 34 + "format": "did" 35 + }, 32 36 "repoDid": { 33 37 "type": "string", 34 - "description": "did of the owner of the repo", 38 + "description": "DID of the repo itself", 35 39 "format": "did" 36 40 }, 37 41 "repoName": {
+5 -1
lexicons/issue/issue.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 - "required": ["repo", "title", "createdAt"], 12 + "required": ["title", "createdAt"], 13 13 "properties": { 14 14 "repo": { 15 15 "type": "string", 16 16 "format": "at-uri" 17 + }, 18 + "repoDid": { 19 + "type": "string", 20 + "format": "did" 17 21 }, 18 22 "title": { 19 23 "type": "string"
+5 -1
lexicons/pipeline/pipeline.json
··· 66 66 "required": [ 67 67 "knot", 68 68 "did", 69 - "repo", 70 69 "defaultBranch" 71 70 ], 72 71 "properties": { ··· 75 74 }, 76 75 "did": { 77 76 "type": "string", 77 + "format": "did" 78 + }, 79 + "repoDid": { 80 + "type": "string", 81 + "description": "DID of the repo itself", 78 82 "format": "did" 79 83 }, 80 84 "repo": {
+8 -1
lexicons/pulls/pull.json
··· 65 65 "target": { 66 66 "type": "object", 67 67 "required": [ 68 - "repo", 69 68 "branch" 70 69 ], 71 70 "properties": { 72 71 "repo": { 73 72 "type": "string", 74 73 "format": "at-uri" 74 + }, 75 + "repoDid": { 76 + "type": "string", 77 + "format": "did" 75 78 }, 76 79 "branch": { 77 80 "type": "string" ··· 96 99 "repo": { 97 100 "type": "string", 98 101 "format": "at-uri" 102 + }, 103 + "repoDid": { 104 + "type": "string", 105 + "format": "did" 99 106 } 100 107 } 101 108 }
+4 -1
lexicons/repo/artifact.json
··· 11 11 "type": "object", 12 12 "required": [ 13 13 "name", 14 - "repo", 15 14 "tag", 16 15 "createdAt", 17 16 "artifact" ··· 25 24 "type": "string", 26 25 "format": "at-uri", 27 26 "description": "repo that this artifact is being uploaded to" 27 + }, 28 + "repoDid": { 29 + "type": "string", 30 + "format": "did" 28 31 }, 29 32 "tag": { 30 33 "type": "bytes",
+4 -1
lexicons/repo/collaborator.json
··· 11 11 "type": "object", 12 12 "required": [ 13 13 "subject", 14 - "repo", 15 14 "createdAt" 16 15 ], 17 16 "properties": { ··· 23 22 "type": "string", 24 23 "description": "repo to add this user to", 25 24 "format": "at-uri" 25 + }, 26 + "repoDid": { 27 + "type": "string", 28 + "format": "did" 26 29 }, 27 30 "createdAt": { 28 31 "type": "string",
+23 -1
lexicons/repo/create.json
··· 10 10 "schema": { 11 11 "type": "object", 12 12 "required": [ 13 - "rkey" 13 + "rkey", 14 + "name" 14 15 ], 15 16 "properties": { 16 17 "rkey": { 17 18 "type": "string", 18 19 "description": "Rkey of the repository record" 19 20 }, 21 + "name": { 22 + "type": "string", 23 + "description": "Name of the repository" 24 + }, 20 25 "defaultBranch": { 21 26 "type": "string", 22 27 "description": "Default branch to push to" ··· 24 29 "source": { 25 30 "type": "string", 26 31 "description": "A source URL to clone from, populate this when forking or importing a repository." 32 + }, 33 + "repoDid": { 34 + "type": "string", 35 + "format": "did", 36 + "description": "Optional user-provided did:web to use as the repo identity instead of minting a did:plc." 37 + } 38 + } 39 + } 40 + }, 41 + "output": { 42 + "encoding": "application/json", 43 + "schema": { 44 + "type": "object", 45 + "properties": { 46 + "repoDid": { 47 + "type": "string", 48 + "format": "did" 27 49 } 28 50 } 29 51 }
+5
lexicons/repo/repo.json
··· 60 60 "format": "at-uri" 61 61 } 62 62 }, 63 + "repoDid": { 64 + "type": "string", 65 + "format": "did", 66 + "description": "DID of the repo itself, if assigned" 67 + }, 63 68 "createdAt": { 64 69 "type": "string", 65 70 "format": "datetime"
+13 -11
spindle/models/clone_test.go
··· 8 8 "tangled.org/core/workflow" 9 9 ) 10 10 11 + func sp(s string) *string { return &s } 12 + 11 13 func TestBuildCloneStep_PushTrigger(t *testing.T) { 12 14 twf := tangled.Pipeline_Workflow{ 13 15 Clone: &tangled.Pipeline_CloneOpts{ ··· 26 28 Repo: &tangled.Pipeline_TriggerRepo{ 27 29 Knot: "example.com", 28 30 Did: "did:plc:user123", 29 - Repo: "my-repo", 31 + Repo: sp("my-repo"), 30 32 }, 31 33 } 32 34 ··· 85 87 Repo: &tangled.Pipeline_TriggerRepo{ 86 88 Knot: "example.com", 87 89 Did: "did:plc:user123", 88 - Repo: "my-repo", 90 + Repo: sp("my-repo"), 89 91 }, 90 92 } 91 93 ··· 112 114 Repo: &tangled.Pipeline_TriggerRepo{ 113 115 Knot: "example.com", 114 116 Did: "did:plc:user123", 115 - Repo: "my-repo", 117 + Repo: sp("my-repo"), 116 118 }, 117 119 } 118 120 ··· 143 145 Repo: &tangled.Pipeline_TriggerRepo{ 144 146 Knot: "example.com", 145 147 Did: "did:plc:user123", 146 - Repo: "my-repo", 148 + Repo: sp("my-repo"), 147 149 }, 148 150 } 149 151 ··· 173 175 Repo: &tangled.Pipeline_TriggerRepo{ 174 176 Knot: "localhost:3000", 175 177 Did: "did:plc:user123", 176 - Repo: "my-repo", 178 + Repo: sp("my-repo"), 177 179 }, 178 180 } 179 181 ··· 203 205 Repo: &tangled.Pipeline_TriggerRepo{ 204 206 Knot: "example.com", 205 207 Did: "did:plc:user123", 206 - Repo: "my-repo", 208 + Repo: sp("my-repo"), 207 209 }, 208 210 } 209 211 ··· 234 236 Repo: &tangled.Pipeline_TriggerRepo{ 235 237 Knot: "example.com", 236 238 Did: "did:plc:user123", 237 - Repo: "my-repo", 239 + Repo: sp("my-repo"), 238 240 }, 239 241 } 240 242 ··· 259 261 Repo: &tangled.Pipeline_TriggerRepo{ 260 262 Knot: "example.com", 261 263 Did: "did:plc:user123", 262 - Repo: "my-repo", 264 + Repo: sp("my-repo"), 263 265 }, 264 266 } 265 267 ··· 292 294 Repo: &tangled.Pipeline_TriggerRepo{ 293 295 Knot: "example.com", 294 296 Did: "did:plc:user123", 295 - Repo: "my-repo", 297 + Repo: sp("my-repo"), 296 298 }, 297 299 } 298 300 ··· 321 323 Repo: &tangled.Pipeline_TriggerRepo{ 322 324 Knot: "example.com", 323 325 Did: "did:plc:user123", 324 - Repo: "my-repo", 326 + Repo: sp("my-repo"), 325 327 }, 326 328 } 327 329 ··· 350 352 Repo: &tangled.Pipeline_TriggerRepo{ 351 353 Knot: "example.com", 352 354 Did: "did:plc:user123", 353 - Repo: "my-repo", 355 + Repo: sp("my-repo"), 354 356 }, 355 357 } 356 358
+6 -6
spindle/models/pipeline_env_test.go
··· 18 18 Repo: &tangled.Pipeline_TriggerRepo{ 19 19 Knot: "example.com", 20 20 Did: "did:plc:user123", 21 - Repo: "my-repo", 21 + Repo: sp("my-repo"), 22 22 DefaultBranch: "main", 23 23 }, 24 24 } ··· 81 81 Repo: &tangled.Pipeline_TriggerRepo{ 82 82 Knot: "example.com", 83 83 Did: "did:plc:user123", 84 - Repo: "my-repo", 84 + Repo: sp("my-repo"), 85 85 }, 86 86 } 87 87 id := PipelineId{ ··· 113 113 Repo: &tangled.Pipeline_TriggerRepo{ 114 114 Knot: "example.com", 115 115 Did: "did:plc:user123", 116 - Repo: "my-repo", 116 + Repo: sp("my-repo"), 117 117 }, 118 118 } 119 119 id := PipelineId{ ··· 168 168 Repo: &tangled.Pipeline_TriggerRepo{ 169 169 Knot: "example.com", 170 170 Did: "did:plc:user123", 171 - Repo: "my-repo", 171 + Repo: sp("my-repo"), 172 172 }, 173 173 } 174 174 id := PipelineId{ ··· 204 204 Repo: &tangled.Pipeline_TriggerRepo{ 205 205 Knot: "localhost:3000", 206 206 Did: "did:plc:user123", 207 - Repo: "my-repo", 207 + Repo: sp("my-repo"), 208 208 }, 209 209 } 210 210 id := PipelineId{ ··· 239 239 Repo: &tangled.Pipeline_TriggerRepo{ 240 240 Knot: "example.com", 241 241 Did: "did:plc:user123", 242 - Repo: "my-repo", 242 + Repo: sp("my-repo"), 243 243 }, 244 244 } 245 245 id := PipelineId{