forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

lexicons: rename, format and other required changes

authored by nel.pet and committed by anirudh.fi 5d021119 79ed2d0a

+225 -458
api/tangled/cbor_gen.go
··· 353 353 } 354 354 355 355 cw := cbg.NewCborWriter(w) 356 - fieldCount := 4 357 356 358 - if t.AddedAt == nil { 359 - fieldCount-- 360 - } 361 - 362 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 357 + if _, err := cw.Write([]byte{164}); err != nil { 363 358 return err 364 359 } 365 360 ··· 405 400 return err 406 401 } 407 402 408 - // t.Member (string) (string) 409 - if len("member") > 1000000 { 410 - return xerrors.Errorf("Value in field \"member\" was too long") 403 + // t.Subject (string) (string) 404 + if len("subject") > 1000000 { 405 + return xerrors.Errorf("Value in field \"subject\" was too long") 411 406 } 412 407 413 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("member"))); err != nil { 408 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { 414 409 return err 415 410 } 416 - if _, err := cw.WriteString(string("member")); err != nil { 411 + if _, err := cw.WriteString(string("subject")); err != nil { 417 412 return err 418 413 } 419 414 420 - if len(t.Member) > 1000000 { 421 - return xerrors.Errorf("Value in field t.Member was too long") 415 + if len(t.Subject) > 1000000 { 416 + return xerrors.Errorf("Value in field t.Subject was too long") 422 417 } 423 418 424 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Member))); err != nil { 419 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil { 425 420 return err 426 421 } 427 - if _, err := cw.WriteString(string(t.Member)); err != nil { 422 + if _, err := cw.WriteString(string(t.Subject)); err != nil { 428 423 return err 429 424 } 430 425 431 - // t.AddedAt (string) (string) 432 - if t.AddedAt != nil { 433 - 434 - if len("addedAt") > 1000000 { 435 - return xerrors.Errorf("Value in field \"addedAt\" was too long") 436 - } 426 + // t.CreatedAt (string) (string) 427 + if len("createdAt") > 1000000 { 428 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 429 + } 437 430 438 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("addedAt"))); err != nil { 439 - return err 440 - } 441 - if _, err := cw.WriteString(string("addedAt")); err != nil { 442 - return err 443 - } 431 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 432 + return err 433 + } 434 + if _, err := cw.WriteString(string("createdAt")); err != nil { 435 + return err 436 + } 444 437 445 - if t.AddedAt == nil { 446 - if _, err := cw.Write(cbg.CborNull); err != nil { 447 - return err 448 - } 449 - } else { 450 - if len(*t.AddedAt) > 1000000 { 451 - return xerrors.Errorf("Value in field t.AddedAt was too long") 452 - } 438 + if len(t.CreatedAt) > 1000000 { 439 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 440 + } 453 441 454 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.AddedAt))); err != nil { 455 - return err 456 - } 457 - if _, err := cw.WriteString(string(*t.AddedAt)); err != nil { 458 - return err 459 - } 460 - } 442 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 443 + return err 444 + } 445 + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 446 + return err 461 447 } 462 448 return nil 463 449 } ··· 487 473 488 474 n := extra 489 475 490 - nameBuf := make([]byte, 7) 476 + nameBuf := make([]byte, 9) 491 477 for i := uint64(0); i < n; i++ { 492 478 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 493 479 if err != nil { ··· 525 511 526 512 t.Domain = string(sval) 527 513 } 528 - // t.Member (string) (string) 529 - case "member": 514 + // t.Subject (string) (string) 515 + case "subject": 530 516 531 517 { 532 518 sval, err := cbg.ReadStringWithMax(cr, 1000000) ··· 534 520 return err 535 521 } 536 522 537 - t.Member = string(sval) 523 + t.Subject = string(sval) 538 524 } 539 - // t.AddedAt (string) (string) 540 - case "addedAt": 525 + // t.CreatedAt (string) (string) 526 + case "createdAt": 541 527 542 528 { 543 - b, err := cr.ReadByte() 529 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 544 530 if err != nil { 545 531 return err 546 532 } 547 - if b != cbg.CborNull[0] { 548 - if err := cr.UnreadByte(); err != nil { 549 - return err 550 - } 551 533 552 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 553 - if err != nil { 554 - return err 555 - } 556 - 557 - t.AddedAt = (*string)(&sval) 558 - } 534 + t.CreatedAt = string(sval) 559 535 } 560 536 561 537 default: ··· 645 621 return err 646 622 } 647 623 648 - // t.Created (string) (string) 649 - if len("created") > 1000000 { 650 - return xerrors.Errorf("Value in field \"created\" was too long") 624 + // t.CreatedAt (string) (string) 625 + if len("createdAt") > 1000000 { 626 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 651 627 } 652 628 653 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("created"))); err != nil { 629 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 654 630 return err 655 631 } 656 - if _, err := cw.WriteString(string("created")); err != nil { 632 + if _, err := cw.WriteString(string("createdAt")); err != nil { 657 633 return err 658 634 } 659 635 660 - if len(t.Created) > 1000000 { 661 - return xerrors.Errorf("Value in field t.Created was too long") 636 + if len(t.CreatedAt) > 1000000 { 637 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 662 638 } 663 639 664 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Created))); err != nil { 640 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 665 641 return err 666 642 } 667 - if _, err := cw.WriteString(string(t.Created)); err != nil { 643 + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 668 644 return err 669 645 } 670 646 return nil ··· 695 671 696 672 n := extra 697 673 698 - nameBuf := make([]byte, 7) 674 + nameBuf := make([]byte, 9) 699 675 for i := uint64(0); i < n; i++ { 700 676 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 701 677 if err != nil { ··· 744 720 745 721 t.LexiconTypeID = string(sval) 746 722 } 747 - // t.Created (string) (string) 748 - case "created": 723 + // t.CreatedAt (string) (string) 724 + case "createdAt": 749 725 750 726 { 751 727 sval, err := cbg.ReadStringWithMax(cr, 1000000) ··· 753 729 return err 754 730 } 755 731 756 - t.Created = string(sval) 732 + t.CreatedAt = string(sval) 757 733 } 758 734 759 735 default: ··· 775 751 cw := cbg.NewCborWriter(w) 776 752 fieldCount := 7 777 753 778 - if t.Body == nil { 779 - fieldCount-- 780 - } 781 - 782 754 if t.CommentId == nil { 783 755 fieldCount-- 784 756 } 785 757 786 - if t.CreatedAt == nil { 787 - fieldCount-- 788 - } 789 - 790 758 if t.Owner == nil { 791 759 fieldCount-- 792 760 } ··· 800 768 } 801 769 802 770 // t.Body (string) (string) 803 - if t.Body != nil { 804 - 805 - if len("body") > 1000000 { 806 - return xerrors.Errorf("Value in field \"body\" was too long") 807 - } 771 + if len("body") > 1000000 { 772 + return xerrors.Errorf("Value in field \"body\" was too long") 773 + } 808 774 809 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { 810 - return err 811 - } 812 - if _, err := cw.WriteString(string("body")); err != nil { 813 - return err 814 - } 775 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { 776 + return err 777 + } 778 + if _, err := cw.WriteString(string("body")); err != nil { 779 + return err 780 + } 815 781 816 - if t.Body == nil { 817 - if _, err := cw.Write(cbg.CborNull); err != nil { 818 - return err 819 - } 820 - } else { 821 - if len(*t.Body) > 1000000 { 822 - return xerrors.Errorf("Value in field t.Body was too long") 823 - } 782 + if len(t.Body) > 1000000 { 783 + return xerrors.Errorf("Value in field t.Body was too long") 784 + } 824 785 825 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil { 826 - return err 827 - } 828 - if _, err := cw.WriteString(string(*t.Body)); err != nil { 829 - return err 830 - } 831 - } 786 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Body))); err != nil { 787 + return err 788 + } 789 + if _, err := cw.WriteString(string(t.Body)); err != nil { 790 + return err 832 791 } 833 792 834 793 // t.Repo (string) (string) ··· 970 929 } 971 930 972 931 // t.CreatedAt (string) (string) 973 - if t.CreatedAt != nil { 932 + if len("createdAt") > 1000000 { 933 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 934 + } 974 935 975 - if len("createdAt") > 1000000 { 976 - return xerrors.Errorf("Value in field \"createdAt\" was too long") 977 - } 936 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 937 + return err 938 + } 939 + if _, err := cw.WriteString(string("createdAt")); err != nil { 940 + return err 941 + } 978 942 979 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 980 - return err 981 - } 982 - if _, err := cw.WriteString(string("createdAt")); err != nil { 983 - return err 984 - } 985 - 986 - if t.CreatedAt == nil { 987 - if _, err := cw.Write(cbg.CborNull); err != nil { 988 - return err 989 - } 990 - } else { 991 - if len(*t.CreatedAt) > 1000000 { 992 - return xerrors.Errorf("Value in field t.CreatedAt was too long") 993 - } 943 + if len(t.CreatedAt) > 1000000 { 944 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 945 + } 994 946 995 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil { 996 - return err 997 - } 998 - if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil { 999 - return err 1000 - } 1001 - } 947 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 948 + return err 949 + } 950 + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 951 + return err 1002 952 } 1003 953 return nil 1004 954 } ··· 1048 998 case "body": 1049 999 1050 1000 { 1051 - b, err := cr.ReadByte() 1001 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1052 1002 if err != nil { 1053 1003 return err 1054 1004 } 1055 - if b != cbg.CborNull[0] { 1056 - if err := cr.UnreadByte(); err != nil { 1057 - return err 1058 - } 1059 1005 1060 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 1061 - if err != nil { 1062 - return err 1063 - } 1064 - 1065 - t.Body = (*string)(&sval) 1066 - } 1006 + t.Body = string(sval) 1067 1007 } 1068 1008 // t.Repo (string) (string) 1069 1009 case "repo": ··· 1169 1109 case "createdAt": 1170 1110 1171 1111 { 1172 - b, err := cr.ReadByte() 1112 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1173 1113 if err != nil { 1174 1114 return err 1175 1115 } 1176 - if b != cbg.CborNull[0] { 1177 - if err := cr.UnreadByte(); err != nil { 1178 - return err 1179 - } 1180 1116 1181 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 1182 - if err != nil { 1183 - return err 1184 - } 1185 - 1186 - t.CreatedAt = (*string)(&sval) 1187 - } 1117 + t.CreatedAt = string(sval) 1188 1118 } 1189 1119 1190 1120 default: ··· 1204 1134 } 1205 1135 1206 1136 cw := cbg.NewCborWriter(w) 1207 - fieldCount := 3 1208 1137 1209 - if t.State == nil { 1210 - fieldCount-- 1211 - } 1212 - 1213 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 1138 + if _, err := cw.Write([]byte{163}); err != nil { 1214 1139 return err 1215 1140 } 1216 1141 ··· 1257 1182 } 1258 1183 1259 1184 // t.State (string) (string) 1260 - if t.State != nil { 1185 + if len("state") > 1000000 { 1186 + return xerrors.Errorf("Value in field \"state\" was too long") 1187 + } 1261 1188 1262 - if len("state") > 1000000 { 1263 - return xerrors.Errorf("Value in field \"state\" was too long") 1264 - } 1189 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("state"))); err != nil { 1190 + return err 1191 + } 1192 + if _, err := cw.WriteString(string("state")); err != nil { 1193 + return err 1194 + } 1265 1195 1266 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("state"))); err != nil { 1267 - return err 1268 - } 1269 - if _, err := cw.WriteString(string("state")); err != nil { 1270 - return err 1271 - } 1196 + if len(t.State) > 1000000 { 1197 + return xerrors.Errorf("Value in field t.State was too long") 1198 + } 1272 1199 1273 - if t.State == nil { 1274 - if _, err := cw.Write(cbg.CborNull); err != nil { 1275 - return err 1276 - } 1277 - } else { 1278 - if len(*t.State) > 1000000 { 1279 - return xerrors.Errorf("Value in field t.State was too long") 1280 - } 1281 - 1282 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.State))); err != nil { 1283 - return err 1284 - } 1285 - if _, err := cw.WriteString(string(*t.State)); err != nil { 1286 - return err 1287 - } 1288 - } 1200 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.State))); err != nil { 1201 + return err 1202 + } 1203 + if _, err := cw.WriteString(string(t.State)); err != nil { 1204 + return err 1289 1205 } 1290 1206 return nil 1291 1207 } ··· 1357 1273 case "state": 1358 1274 1359 1275 { 1360 - b, err := cr.ReadByte() 1276 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1361 1277 if err != nil { 1362 1278 return err 1363 1279 } 1364 - if b != cbg.CborNull[0] { 1365 - if err := cr.UnreadByte(); err != nil { 1366 - return err 1367 - } 1368 1280 1369 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 1370 - if err != nil { 1371 - return err 1372 - } 1373 - 1374 - t.State = (*string)(&sval) 1375 - } 1281 + t.State = string(sval) 1376 1282 } 1377 1283 1378 1284 default: ··· 1395 1301 fieldCount := 7 1396 1302 1397 1303 if t.Body == nil { 1398 - fieldCount-- 1399 - } 1400 - 1401 - if t.CreatedAt == nil { 1402 1304 fieldCount-- 1403 1305 } 1404 1306 ··· 1549 1451 } 1550 1452 1551 1453 // t.CreatedAt (string) (string) 1552 - if t.CreatedAt != nil { 1454 + if len("createdAt") > 1000000 { 1455 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 1456 + } 1553 1457 1554 - if len("createdAt") > 1000000 { 1555 - return xerrors.Errorf("Value in field \"createdAt\" was too long") 1556 - } 1458 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 1459 + return err 1460 + } 1461 + if _, err := cw.WriteString(string("createdAt")); err != nil { 1462 + return err 1463 + } 1557 1464 1558 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 1559 - return err 1560 - } 1561 - if _, err := cw.WriteString(string("createdAt")); err != nil { 1562 - return err 1563 - } 1465 + if len(t.CreatedAt) > 1000000 { 1466 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 1467 + } 1564 1468 1565 - if t.CreatedAt == nil { 1566 - if _, err := cw.Write(cbg.CborNull); err != nil { 1567 - return err 1568 - } 1569 - } else { 1570 - if len(*t.CreatedAt) > 1000000 { 1571 - return xerrors.Errorf("Value in field t.CreatedAt was too long") 1572 - } 1573 - 1574 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil { 1575 - return err 1576 - } 1577 - if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil { 1578 - return err 1579 - } 1580 - } 1469 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 1470 + return err 1471 + } 1472 + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 1473 + return err 1581 1474 } 1582 1475 return nil 1583 1476 } ··· 1718 1611 case "createdAt": 1719 1612 1720 1613 { 1721 - b, err := cr.ReadByte() 1614 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1722 1615 if err != nil { 1723 1616 return err 1724 1617 } 1725 - if b != cbg.CborNull[0] { 1726 - if err := cr.UnreadByte(); err != nil { 1727 - return err 1728 - } 1729 1618 1730 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 1731 - if err != nil { 1732 - return err 1733 - } 1734 - 1735 - t.CreatedAt = (*string)(&sval) 1736 - } 1619 + t.CreatedAt = string(sval) 1737 1620 } 1738 1621 1739 1622 default: ··· 1754 1637 1755 1638 cw := cbg.NewCborWriter(w) 1756 1639 fieldCount := 7 1757 - 1758 - if t.AddedAt == nil { 1759 - fieldCount-- 1760 - } 1761 1640 1762 1641 if t.Description == nil { 1763 1642 fieldCount-- ··· 1891 1770 } 1892 1771 } 1893 1772 1894 - // t.AddedAt (string) (string) 1895 - if t.AddedAt != nil { 1896 - 1897 - if len("addedAt") > 1000000 { 1898 - return xerrors.Errorf("Value in field \"addedAt\" was too long") 1899 - } 1773 + // t.CreatedAt (string) (string) 1774 + if len("createdAt") > 1000000 { 1775 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 1776 + } 1900 1777 1901 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("addedAt"))); err != nil { 1902 - return err 1903 - } 1904 - if _, err := cw.WriteString(string("addedAt")); err != nil { 1905 - return err 1906 - } 1778 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 1779 + return err 1780 + } 1781 + if _, err := cw.WriteString(string("createdAt")); err != nil { 1782 + return err 1783 + } 1907 1784 1908 - if t.AddedAt == nil { 1909 - if _, err := cw.Write(cbg.CborNull); err != nil { 1910 - return err 1911 - } 1912 - } else { 1913 - if len(*t.AddedAt) > 1000000 { 1914 - return xerrors.Errorf("Value in field t.AddedAt was too long") 1915 - } 1785 + if len(t.CreatedAt) > 1000000 { 1786 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 1787 + } 1916 1788 1917 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.AddedAt))); err != nil { 1918 - return err 1919 - } 1920 - if _, err := cw.WriteString(string(*t.AddedAt)); err != nil { 1921 - return err 1922 - } 1923 - } 1789 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 1790 + return err 1791 + } 1792 + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 1793 + return err 1924 1794 } 1925 1795 1926 1796 // t.Description (string) (string) ··· 2063 1933 t.Source = (*string)(&sval) 2064 1934 } 2065 1935 } 2066 - // t.AddedAt (string) (string) 2067 - case "addedAt": 1936 + // t.CreatedAt (string) (string) 1937 + case "createdAt": 2068 1938 2069 1939 { 2070 - b, err := cr.ReadByte() 1940 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2071 1941 if err != nil { 2072 1942 return err 2073 1943 } 2074 - if b != cbg.CborNull[0] { 2075 - if err := cr.UnreadByte(); err != nil { 2076 - return err 2077 - } 2078 1944 2079 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 2080 - if err != nil { 2081 - return err 2082 - } 2083 - 2084 - t.AddedAt = (*string)(&sval) 2085 - } 1945 + t.CreatedAt = string(sval) 2086 1946 } 2087 1947 // t.Description (string) (string) 2088 1948 case "description": ··· 2126 1986 fieldCount := 9 2127 1987 2128 1988 if t.Body == nil { 2129 - fieldCount-- 2130 - } 2131 - 2132 - if t.CreatedAt == nil { 2133 1989 fieldCount-- 2134 1990 } 2135 1991 ··· 2280 2136 } 2281 2137 2282 2138 // t.CreatedAt (string) (string) 2283 - if t.CreatedAt != nil { 2139 + if len("createdAt") > 1000000 { 2140 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 2141 + } 2284 2142 2285 - if len("createdAt") > 1000000 { 2286 - return xerrors.Errorf("Value in field \"createdAt\" was too long") 2287 - } 2143 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 2144 + return err 2145 + } 2146 + if _, err := cw.WriteString(string("createdAt")); err != nil { 2147 + return err 2148 + } 2288 2149 2289 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 2290 - return err 2291 - } 2292 - if _, err := cw.WriteString(string("createdAt")); err != nil { 2293 - return err 2294 - } 2150 + if len(t.CreatedAt) > 1000000 { 2151 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 2152 + } 2295 2153 2296 - if t.CreatedAt == nil { 2297 - if _, err := cw.Write(cbg.CborNull); err != nil { 2298 - return err 2299 - } 2300 - } else { 2301 - if len(*t.CreatedAt) > 1000000 { 2302 - return xerrors.Errorf("Value in field t.CreatedAt was too long") 2303 - } 2304 - 2305 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil { 2306 - return err 2307 - } 2308 - if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil { 2309 - return err 2310 - } 2311 - } 2154 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 2155 + return err 2156 + } 2157 + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 2158 + return err 2312 2159 } 2313 2160 2314 2161 // t.TargetRepo (string) (string) ··· 2504 2351 case "createdAt": 2505 2352 2506 2353 { 2507 - b, err := cr.ReadByte() 2354 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2508 2355 if err != nil { 2509 2356 return err 2510 2357 } 2511 - if b != cbg.CborNull[0] { 2512 - if err := cr.UnreadByte(); err != nil { 2513 - return err 2514 - } 2515 2358 2516 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 2517 - if err != nil { 2518 - return err 2519 - } 2520 - 2521 - t.CreatedAt = (*string)(&sval) 2522 - } 2359 + t.CreatedAt = string(sval) 2523 2360 } 2524 2361 // t.TargetRepo (string) (string) 2525 2362 case "targetRepo": ··· 2719 2556 } 2720 2557 2721 2558 cw := cbg.NewCborWriter(w) 2722 - fieldCount := 3 2723 2559 2724 - if t.Status == nil { 2725 - fieldCount-- 2726 - } 2727 - 2728 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 2560 + if _, err := cw.Write([]byte{163}); err != nil { 2729 2561 return err 2730 2562 } 2731 2563 ··· 2772 2604 } 2773 2605 2774 2606 // t.Status (string) (string) 2775 - if t.Status != nil { 2607 + if len("status") > 1000000 { 2608 + return xerrors.Errorf("Value in field \"status\" was too long") 2609 + } 2776 2610 2777 - if len("status") > 1000000 { 2778 - return xerrors.Errorf("Value in field \"status\" was too long") 2779 - } 2611 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { 2612 + return err 2613 + } 2614 + if _, err := cw.WriteString(string("status")); err != nil { 2615 + return err 2616 + } 2780 2617 2781 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { 2782 - return err 2783 - } 2784 - if _, err := cw.WriteString(string("status")); err != nil { 2785 - return err 2786 - } 2787 - 2788 - if t.Status == nil { 2789 - if _, err := cw.Write(cbg.CborNull); err != nil { 2790 - return err 2791 - } 2792 - } else { 2793 - if len(*t.Status) > 1000000 { 2794 - return xerrors.Errorf("Value in field t.Status was too long") 2795 - } 2618 + if len(t.Status) > 1000000 { 2619 + return xerrors.Errorf("Value in field t.Status was too long") 2620 + } 2796 2621 2797 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Status))); err != nil { 2798 - return err 2799 - } 2800 - if _, err := cw.WriteString(string(*t.Status)); err != nil { 2801 - return err 2802 - } 2803 - } 2622 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Status))); err != nil { 2623 + return err 2624 + } 2625 + if _, err := cw.WriteString(string(t.Status)); err != nil { 2626 + return err 2804 2627 } 2805 2628 return nil 2806 2629 } ··· 2872 2695 case "status": 2873 2696 2874 2697 { 2875 - b, err := cr.ReadByte() 2698 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2876 2699 if err != nil { 2877 2700 return err 2878 2701 } 2879 - if b != cbg.CborNull[0] { 2880 - if err := cr.UnreadByte(); err != nil { 2881 - return err 2882 - } 2883 2702 2884 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 2885 - if err != nil { 2886 - return err 2887 - } 2888 - 2889 - t.Status = (*string)(&sval) 2890 - } 2703 + t.Status = string(sval) 2891 2704 } 2892 2705 2893 2706 default: ··· 2909 2722 cw := cbg.NewCborWriter(w) 2910 2723 fieldCount := 7 2911 2724 2912 - if t.Body == nil { 2913 - fieldCount-- 2914 - } 2915 - 2916 2725 if t.CommentId == nil { 2917 2726 fieldCount-- 2918 2727 } 2919 2728 2920 - if t.CreatedAt == nil { 2921 - fieldCount-- 2922 - } 2923 - 2924 2729 if t.Owner == nil { 2925 2730 fieldCount-- 2926 2731 } ··· 2934 2739 } 2935 2740 2936 2741 // t.Body (string) (string) 2937 - if t.Body != nil { 2938 - 2939 - if len("body") > 1000000 { 2940 - return xerrors.Errorf("Value in field \"body\" was too long") 2941 - } 2742 + if len("body") > 1000000 { 2743 + return xerrors.Errorf("Value in field \"body\" was too long") 2744 + } 2942 2745 2943 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { 2944 - return err 2945 - } 2946 - if _, err := cw.WriteString(string("body")); err != nil { 2947 - return err 2948 - } 2746 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { 2747 + return err 2748 + } 2749 + if _, err := cw.WriteString(string("body")); err != nil { 2750 + return err 2751 + } 2949 2752 2950 - if t.Body == nil { 2951 - if _, err := cw.Write(cbg.CborNull); err != nil { 2952 - return err 2953 - } 2954 - } else { 2955 - if len(*t.Body) > 1000000 { 2956 - return xerrors.Errorf("Value in field t.Body was too long") 2957 - } 2753 + if len(t.Body) > 1000000 { 2754 + return xerrors.Errorf("Value in field t.Body was too long") 2755 + } 2958 2756 2959 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil { 2960 - return err 2961 - } 2962 - if _, err := cw.WriteString(string(*t.Body)); err != nil { 2963 - return err 2964 - } 2965 - } 2757 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Body))); err != nil { 2758 + return err 2759 + } 2760 + if _, err := cw.WriteString(string(t.Body)); err != nil { 2761 + return err 2966 2762 } 2967 2763 2968 2764 // t.Pull (string) (string) ··· 3104 2900 } 3105 2901 3106 2902 // t.CreatedAt (string) (string) 3107 - if t.CreatedAt != nil { 2903 + if len("createdAt") > 1000000 { 2904 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 2905 + } 3108 2906 3109 - if len("createdAt") > 1000000 { 3110 - return xerrors.Errorf("Value in field \"createdAt\" was too long") 3111 - } 2907 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 2908 + return err 2909 + } 2910 + if _, err := cw.WriteString(string("createdAt")); err != nil { 2911 + return err 2912 + } 3112 2913 3113 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 3114 - return err 3115 - } 3116 - if _, err := cw.WriteString(string("createdAt")); err != nil { 3117 - return err 3118 - } 2914 + if len(t.CreatedAt) > 1000000 { 2915 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 2916 + } 3119 2917 3120 - if t.CreatedAt == nil { 3121 - if _, err := cw.Write(cbg.CborNull); err != nil { 3122 - return err 3123 - } 3124 - } else { 3125 - if len(*t.CreatedAt) > 1000000 { 3126 - return xerrors.Errorf("Value in field t.CreatedAt was too long") 3127 - } 3128 - 3129 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil { 3130 - return err 3131 - } 3132 - if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil { 3133 - return err 3134 - } 3135 - } 2918 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 2919 + return err 2920 + } 2921 + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 2922 + return err 3136 2923 } 3137 2924 return nil 3138 2925 } ··· 3182 2969 case "body": 3183 2970 3184 2971 { 3185 - b, err := cr.ReadByte() 2972 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3186 2973 if err != nil { 3187 2974 return err 3188 2975 } 3189 - if b != cbg.CborNull[0] { 3190 - if err := cr.UnreadByte(); err != nil { 3191 - return err 3192 - } 3193 2976 3194 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 3195 - if err != nil { 3196 - return err 3197 - } 3198 - 3199 - t.Body = (*string)(&sval) 3200 - } 2977 + t.Body = string(sval) 3201 2978 } 3202 2979 // t.Pull (string) (string) 3203 2980 case "pull": ··· 3303 3080 case "createdAt": 3304 3081 3305 3082 { 3306 - b, err := cr.ReadByte() 3083 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3307 3084 if err != nil { 3308 3085 return err 3309 3086 } 3310 - if b != cbg.CborNull[0] { 3311 - if err := cr.UnreadByte(); err != nil { 3312 - return err 3313 - } 3314 3087 3315 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 3316 - if err != nil { 3317 - return err 3318 - } 3319 - 3320 - t.CreatedAt = (*string)(&sval) 3321 - } 3088 + t.CreatedAt = string(sval) 3322 3089 } 3323 3090 3324 3091 default:
+2 -2
api/tangled/issuecomment.go
··· 18 18 // RECORDTYPE: RepoIssueComment 19 19 type RepoIssueComment struct { 20 20 LexiconTypeID string `json:"$type,const=sh.tangled.repo.issue.comment" cborgen:"$type,const=sh.tangled.repo.issue.comment"` 21 - Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 21 + Body string `json:"body" cborgen:"body"` 22 22 CommentId *int64 `json:"commentId,omitempty" cborgen:"commentId,omitempty"` 23 - CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` 23 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 24 24 Issue string `json:"issue" cborgen:"issue"` 25 25 Owner *string `json:"owner,omitempty" cborgen:"owner,omitempty"` 26 26 Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
+1 -1
api/tangled/issuestate.go
··· 20 20 LexiconTypeID string `json:"$type,const=sh.tangled.repo.issue.state" cborgen:"$type,const=sh.tangled.repo.issue.state"` 21 21 Issue string `json:"issue" cborgen:"issue"` 22 22 // state: state of the issue 23 - State *string `json:"state,omitempty" cborgen:"state,omitempty"` 23 + State string `json:"state" cborgen:"state"` 24 24 }
+4 -4
api/tangled/knotmember.go
··· 17 17 } // 18 18 // RECORDTYPE: KnotMember 19 19 type KnotMember struct { 20 - LexiconTypeID string `json:"$type,const=sh.tangled.knot.member" cborgen:"$type,const=sh.tangled.knot.member"` 21 - AddedAt *string `json:"addedAt,omitempty" cborgen:"addedAt,omitempty"` 20 + LexiconTypeID string `json:"$type,const=sh.tangled.knot.member" cborgen:"$type,const=sh.tangled.knot.member"` 21 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 22 22 // domain: domain that this member now belongs to 23 - Domain string `json:"domain" cborgen:"domain"` 24 - Member string `json:"member" cborgen:"member"` 23 + Domain string `json:"domain" cborgen:"domain"` 24 + Subject string `json:"subject" cborgen:"subject"` 25 25 }
+2 -2
api/tangled/pullcomment.go
··· 18 18 // RECORDTYPE: RepoPullComment 19 19 type RepoPullComment struct { 20 20 LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull.comment" cborgen:"$type,const=sh.tangled.repo.pull.comment"` 21 - Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 21 + Body string `json:"body" cborgen:"body"` 22 22 CommentId *int64 `json:"commentId,omitempty" cborgen:"commentId,omitempty"` 23 - CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` 23 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 24 24 Owner *string `json:"owner,omitempty" cborgen:"owner,omitempty"` 25 25 Pull string `json:"pull" cborgen:"pull"` 26 26 Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
+1 -1
api/tangled/pullstatus.go
··· 20 20 LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull.status" cborgen:"$type,const=sh.tangled.repo.pull.status"` 21 21 Pull string `json:"pull" cborgen:"pull"` 22 22 // status: status of the pull request 23 - Status *string `json:"status,omitempty" cborgen:"status,omitempty"` 23 + Status string `json:"status" cborgen:"status"` 24 24 }
+1 -1
api/tangled/repoissue.go
··· 19 19 type RepoIssue struct { 20 20 LexiconTypeID string `json:"$type,const=sh.tangled.repo.issue" cborgen:"$type,const=sh.tangled.repo.issue"` 21 21 Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 22 - CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` 22 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 23 IssueId int64 `json:"issueId" cborgen:"issueId"` 24 24 Owner string `json:"owner" cborgen:"owner"` 25 25 Repo string `json:"repo" cborgen:"repo"`
+1 -1
api/tangled/repopull.go
··· 19 19 type RepoPull struct { 20 20 LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull" cborgen:"$type,const=sh.tangled.repo.pull"` 21 21 Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 22 - CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` 22 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 23 Patch string `json:"patch" cborgen:"patch"` 24 24 PullId int64 `json:"pullId" cborgen:"pullId"` 25 25 Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"`
+2 -2
api/tangled/tangledpublicKey.go
··· 18 18 // RECORDTYPE: PublicKey 19 19 type PublicKey struct { 20 20 LexiconTypeID string `json:"$type,const=sh.tangled.publicKey" cborgen:"$type,const=sh.tangled.publicKey"` 21 - // created: key upload timestamp 22 - Created string `json:"created" cborgen:"created"` 21 + // createdAt: key upload timestamp 22 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 23 // key: public key contents 24 24 Key string `json:"key" cborgen:"key"` 25 25 // name: human-readable name for this key
+1 -1
api/tangled/tangledrepo.go
··· 18 18 // RECORDTYPE: Repo 19 19 type Repo struct { 20 20 LexiconTypeID string `json:"$type,const=sh.tangled.repo" cborgen:"$type,const=sh.tangled.repo"` 21 - AddedAt *string `json:"addedAt,omitempty" cborgen:"addedAt,omitempty"` 21 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 22 22 Description *string `json:"description,omitempty" cborgen:"description,omitempty"` 23 23 // knot: knot where the repo was created 24 24 Knot string `json:"knot" cborgen:"knot"`
+2 -2
appview/pages/templates/knot.html
··· 83 83 class="max-w-2xl space-y-4"> 84 84 <input 85 85 type="text" 86 - id="member" 87 - name="member" 86 + id="subject" 87 + name="subject" 88 88 placeholder="did or handle" 89 89 required 90 90 class="w-full dark:bg-gray-700 dark:text-white dark:border-gray-600 dark:placeholder-gray-400"/>
+3 -3
appview/settings/settings.go
··· 384 384 Rkey: rkey, 385 385 Record: &lexutil.LexiconTypeDecoder{ 386 386 Val: &tangled.PublicKey{ 387 - Created: time.Now().Format(time.RFC3339), 388 - Key: key, 389 - Name: name, 387 + CreatedAt: time.Now().Format(time.RFC3339), 388 + Key: key, 389 + Name: name, 390 390 }}, 391 391 }) 392 392 // invalid record
+2 -2
appview/state/pull.go
··· 530 530 Repo: &atUri, 531 531 Pull: string(pullAt), 532 532 Owner: &ownerDid, 533 - Body: &body, 534 - CreatedAt: &createdAt, 533 + Body: body, 534 + CreatedAt: createdAt, 535 535 }, 536 536 }, 537 537 })
+15 -15
appview/state/repo.go
··· 217 217 Knot: f.Knot, 218 218 Name: f.RepoName, 219 219 Owner: user.Did, 220 - AddedAt: &f.AddedAt, 220 + CreatedAt: f.CreatedAt, 221 221 Description: &newDescription, 222 222 }, 223 223 }, ··· 851 851 RepoName string 852 852 RepoAt syntax.ATURI 853 853 Description string 854 - AddedAt string 854 + CreatedAt string 855 855 } 856 856 857 857 func (f *FullyResolvedRepo) OwnerDid() string { ··· 1122 1122 Record: &lexutil.LexiconTypeDecoder{ 1123 1123 Val: &tangled.RepoIssueState{ 1124 1124 Issue: issue.IssueAt, 1125 - State: &closed, 1125 + State: closed, 1126 1126 }, 1127 1127 }, 1128 1128 }) ··· 1260 1260 Issue: issueAt, 1261 1261 CommentId: &commentIdInt64, 1262 1262 Owner: &ownerDid, 1263 - Body: &body, 1264 - CreatedAt: &createdAt, 1263 + Body: body, 1264 + CreatedAt: createdAt, 1265 1265 }, 1266 1266 }, 1267 1267 }) ··· 1429 1429 Issue: issueAt, 1430 1430 CommentId: &commentIdInt64, 1431 1431 Owner: &comment.OwnerDid, 1432 - Body: &newBody, 1433 - CreatedAt: &createdAt, 1432 + Body: newBody, 1433 + CreatedAt: createdAt, 1434 1434 }, 1435 1435 }, 1436 1436 }) ··· 1760 1760 } else { 1761 1761 uri = "https" 1762 1762 } 1763 - sourceUrl := fmt.Sprintf("%s://%s/%s/%s", uri, f.Knot, f.OwnerDid(), f.RepoName) 1763 + forkSourceUrl := fmt.Sprintf("%s://%s/%s/%s", uri, f.Knot, f.OwnerDid(), f.RepoName) 1764 1764 sourceAt := f.RepoAt.String() 1765 1765 1766 1766 rkey := appview.TID() ··· 1786 1786 } 1787 1787 }() 1788 1788 1789 - resp, err := client.ForkRepo(user.Did, sourceUrl, forkName) 1789 + resp, err := client.ForkRepo(user.Did, forkSourceUrl, forkName) 1790 1790 if err != nil { 1791 1791 s.pages.Notice(w, "repo", "Failed to create repository on knot server.") 1792 1792 return ··· 1804 1804 1805 1805 xrpcClient, _ := s.auth.AuthorizedClient(r) 1806 1806 1807 - addedAt := time.Now().Format(time.RFC3339) 1807 + createdAt := time.Now().Format(time.RFC3339) 1808 1808 atresp, err := comatproto.RepoPutRecord(r.Context(), xrpcClient, &comatproto.RepoPutRecord_Input{ 1809 1809 Collection: tangled.RepoNSID, 1810 1810 Repo: user.Did, 1811 1811 Rkey: rkey, 1812 1812 Record: &lexutil.LexiconTypeDecoder{ 1813 1813 Val: &tangled.Repo{ 1814 - Knot: repo.Knot, 1815 - Name: repo.Name, 1816 - AddedAt: &addedAt, 1817 - Owner: user.Did, 1818 - Source: &sourceAt, 1814 + Knot: repo.Knot, 1815 + Name: repo.Name, 1816 + CreatedAt: createdAt, 1817 + Owner: user.Did, 1818 + Source: &sourceAt, 1819 1819 }}, 1820 1820 }) 1821 1821 if err != nil {
+1 -1
appview/state/repo_util.go
··· 52 52 RepoName: repoName, 53 53 RepoAt: parsedRepoAt, 54 54 Description: description, 55 - AddedAt: addedAt, 55 + CreatedAt: addedAt, 56 56 }, nil 57 57 } 58 58
+16 -16
appview/state/state.go
··· 502 502 return 503 503 } 504 504 505 - memberDid := r.FormValue("member") 506 - if memberDid == "" { 505 + subjectIdentifier := r.FormValue("subject") 506 + if subjectIdentifier == "" { 507 507 http.Error(w, "malformed form", http.StatusBadRequest) 508 508 return 509 509 } 510 510 511 - memberIdent, err := s.resolver.ResolveIdent(r.Context(), memberDid) 511 + subjectIdentity, err := s.resolver.ResolveIdent(r.Context(), subjectIdentifier) 512 512 if err != nil { 513 513 w.Write([]byte("failed to resolve member did to a handle")) 514 514 return 515 515 } 516 - log.Printf("adding %s to %s\n", memberIdent.Handle.String(), domain) 516 + log.Printf("adding %s to %s\n", subjectIdentity.Handle.String(), domain) 517 517 518 518 // announce this relation into the firehose, store into owners' pds 519 519 client, _ := s.auth.AuthorizedClient(r) 520 520 currentUser := s.auth.GetUser(r) 521 - addedAt := time.Now().Format(time.RFC3339) 521 + createdAt := time.Now().Format(time.RFC3339) 522 522 resp, err := comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{ 523 523 Collection: tangled.KnotMemberNSID, 524 524 Repo: currentUser.Did, 525 525 Rkey: appview.TID(), 526 526 Record: &lexutil.LexiconTypeDecoder{ 527 527 Val: &tangled.KnotMember{ 528 - Member: memberIdent.DID.String(), 529 - Domain: domain, 530 - AddedAt: &addedAt, 528 + Subject: subjectIdentity.DID.String(), 529 + Domain: domain, 530 + CreatedAt: createdAt, 531 531 }}, 532 532 }) 533 533 ··· 550 550 return 551 551 } 552 552 553 - ksResp, err := ksClient.AddMember(memberIdent.DID.String()) 553 + ksResp, err := ksClient.AddMember(subjectIdentity.DID.String()) 554 554 if err != nil { 555 555 log.Printf("failed to make request to %s: %s", domain, err) 556 556 return ··· 561 561 return 562 562 } 563 563 564 - err = s.enforcer.AddMember(domain, memberIdent.DID.String()) 564 + err = s.enforcer.AddMember(domain, subjectIdentity.DID.String()) 565 565 if err != nil { 566 566 w.Write([]byte(fmt.Sprint("failed to add member: ", err))) 567 567 return 568 568 } 569 569 570 - w.Write([]byte(fmt.Sprint("added member: ", memberIdent.Handle.String()))) 570 + w.Write([]byte(fmt.Sprint("added member: ", subjectIdentity.Handle.String()))) 571 571 } 572 572 573 573 func (s *State) RemoveMember(w http.ResponseWriter, r *http.Request) { ··· 657 657 658 658 xrpcClient, _ := s.auth.AuthorizedClient(r) 659 659 660 - addedAt := time.Now().Format(time.RFC3339) 660 + createdAt := time.Now().Format(time.RFC3339) 661 661 atresp, err := comatproto.RepoPutRecord(r.Context(), xrpcClient, &comatproto.RepoPutRecord_Input{ 662 662 Collection: tangled.RepoNSID, 663 663 Repo: user.Did, 664 664 Rkey: rkey, 665 665 Record: &lexutil.LexiconTypeDecoder{ 666 666 Val: &tangled.Repo{ 667 - Knot: repo.Knot, 668 - Name: repoName, 669 - AddedAt: &addedAt, 670 - Owner: user.Did, 667 + Knot: repo.Knot, 668 + Name: repoName, 669 + CreatedAt: createdAt, 670 + Owner: user.Did, 671 671 }}, 672 672 }) 673 673 if err != nil {
+9 -9
knotserver/db/pubkeys.go
··· 23 23 Did: did, 24 24 } 25 25 pk.Key = record["key"] 26 - pk.Created = record["created"] 26 + pk.CreatedAt = record["createdAt"] 27 27 28 28 return d.AddPublicKey(pk) 29 29 } 30 30 31 31 func (d *DB) AddPublicKey(pk PublicKey) error { 32 - if pk.Created == "" { 33 - pk.Created = time.Now().Format(time.RFC3339) 32 + if pk.CreatedAt == "" { 33 + pk.CreatedAt = time.Now().Format(time.RFC3339) 34 34 } 35 35 36 36 query := `insert or ignore into public_keys (did, key, created) values (?, ?, ?)` 37 - _, err := d.db.Exec(query, pk.Did, pk.Key, pk.Created) 37 + _, err := d.db.Exec(query, pk.Did, pk.Key, pk.CreatedAt) 38 38 return err 39 39 } 40 40 ··· 46 46 47 47 func (pk *PublicKey) JSON() map[string]any { 48 48 return map[string]any{ 49 - "did": pk.Did, 50 - "key": pk.Key, 51 - "created": pk.Created, 49 + "did": pk.Did, 50 + "key": pk.Key, 51 + "createdAt": pk.CreatedAt, 52 52 } 53 53 } 54 54 ··· 63 63 64 64 for rows.Next() { 65 65 var publicKey PublicKey 66 - if err := rows.Scan(&publicKey.Key, &publicKey.Did, &publicKey.Created); err != nil { 66 + if err := rows.Scan(&publicKey.Key, &publicKey.Did, &publicKey.CreatedAt); err != nil { 67 67 return nil, err 68 68 } 69 69 keys = append(keys, publicKey) ··· 87 87 88 88 for rows.Next() { 89 89 var publicKey PublicKey 90 - if err := rows.Scan(&publicKey.Did, &publicKey.Key, &publicKey.Created); err != nil { 90 + if err := rows.Scan(&publicKey.Did, &publicKey.Key, &publicKey.CreatedAt); err != nil { 91 91 return nil, err 92 92 } 93 93 keys = append(keys, publicKey)
+2 -2
knotserver/jetstream.go
··· 43 43 return fmt.Errorf("failed to enforce permissions: %w", err) 44 44 } 45 45 46 - if err := h.e.AddMember(ThisServer, record.Member); err != nil { 46 + if err := h.e.AddMember(ThisServer, record.Subject); err != nil { 47 47 l.Error("failed to add member", "error", err) 48 48 return fmt.Errorf("failed to add member: %w", err) 49 49 } 50 - l.Info("added member from firehose", "member", record.Member) 50 + l.Info("added member from firehose", "member", record.Subject) 51 51 52 52 if err := h.db.AddDid(did); err != nil { 53 53 l.Error("failed to add did", "error", err)
+6 -7
lexicons/follow.json
··· 10 10 "record": { 11 11 "type": "object", 12 12 "required": [ 13 - "createdAt", 14 - "subject" 13 + "subject", 14 + "createdAt" 15 15 ], 16 16 "properties": { 17 + "subject": { 18 + "type": "string", 19 + "format": "did" 20 + }, 17 21 "createdAt": { 18 22 "type": "string", 19 23 "format": "datetime" 20 - }, 21 - "subject": { 22 - "type": "string", 23 - "format": "did" 24 24 } 25 25 } 26 26 } 27 27 } 28 28 } 29 29 } 30 -
+5 -1
lexicons/issue/comment.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 - "required": ["issue"], 12 + "required": [ 13 + "issue", 14 + "body", 15 + "createdAt" 16 + ], 13 17 "properties": { 14 18 "issue": { 15 19 "type": "string",
+7 -1
lexicons/issue/issue.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 - "required": ["repo", "issueId", "owner", "title"], 12 + "required": [ 13 + "repo", 14 + "issueId", 15 + "owner", 16 + "title", 17 + "createdAt" 18 + ], 13 19 "properties": { 14 20 "repo": { 15 21 "type": "string",
+4 -1
lexicons/issue/state.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 - "required": ["issue"], 12 + "required": [ 13 + "issue", 14 + "state" 15 + ], 13 16 "properties": { 14 17 "issue": { 15 18 "type": "string",
+5 -4
lexicons/member.json
··· 10 10 "record": { 11 11 "type": "object", 12 12 "required": [ 13 - "member", 14 - "domain" 13 + "subject", 14 + "domain", 15 + "createdAt" 15 16 ], 16 17 "properties": { 17 - "member": { 18 + "subject": { 18 19 "type": "string", 19 20 "format": "did" 20 21 }, ··· 22 23 "type": "string", 23 24 "description": "domain that this member now belongs to" 24 25 }, 25 - "addedAt": { 26 + "createdAt": { 26 27 "type": "string", 27 28 "format": "datetime" 28 29 }
+2 -3
lexicons/publicKey.json
··· 12 12 "required": [ 13 13 "key", 14 14 "name", 15 - "created" 15 + "createdAt" 16 16 ], 17 17 "properties": { 18 18 "key": { 19 19 "type": "string", 20 20 "maxLength": 4096, 21 - "maxGraphemes": 4096, 22 21 "description": "public key contents" 23 22 }, 24 23 "name": { ··· 26 25 "format": "string", 27 26 "description": "human-readable name for this key" 28 27 }, 29 - "created": { 28 + "createdAt": { 30 29 "type": "string", 31 30 "format": "datetime", 32 31 "description": "key upload timestamp"
+5 -1
lexicons/pulls/comment.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 - "required": ["pull"], 12 + "required": [ 13 + "pull", 14 + "body", 15 + "createdAt" 16 + ], 13 17 "properties": { 14 18 "pull": { 15 19 "type": "string",
+9 -6
lexicons/pulls/pull.json
··· 14 14 "targetBranch", 15 15 "pullId", 16 16 "title", 17 - "patch" 17 + "patch", 18 + "createdAt" 18 19 ], 19 20 "properties": { 20 21 "targetRepo": { ··· 33 34 "body": { 34 35 "type": "string" 35 36 }, 36 - "createdAt": { 37 - "type": "string", 38 - "format": "datetime" 39 - }, 40 37 "patch": { 41 38 "type": "string" 42 39 }, 43 40 "source": { 44 41 "type": "ref", 45 42 "ref": "#source" 43 + }, 44 + "createdAt": { 45 + "type": "string", 46 + "format": "datetime" 46 47 } 47 48 } 48 49 } 49 50 }, 50 51 "source": { 51 52 "type": "object", 52 - "required": ["branch"], 53 + "required": [ 54 + "branch" 55 + ], 53 56 "properties": { 54 57 "branch": { 55 58 "type": "string"
+4 -1
lexicons/pulls/state.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 - "required": ["pull"], 12 + "required": [ 13 + "pull", 14 + "status" 15 + ], 13 16 "properties": { 14 17 "pull": { 15 18 "type": "string",
+12 -7
lexicons/repo.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 - "required": ["name", "knot", "owner"], 12 + "required": [ 13 + "name", 14 + "knot", 15 + "owner", 16 + "createdAt" 17 + ], 13 18 "properties": { 14 19 "name": { 15 20 "type": "string", ··· 23 28 "type": "string", 24 29 "description": "knot where the repo was created" 25 30 }, 26 - "addedAt": { 27 - "type": "string", 28 - "format": "datetime" 29 - }, 30 31 "description": { 31 32 "type": "string", 32 33 "format": "datetime", 33 - "minLength": 1, 34 - "maxLength": 140 34 + "minGraphemes": 1, 35 + "maxGraphemes": 140 35 36 }, 36 37 "source": { 37 38 "type": "string", 38 39 "format": "uri", 39 40 "description": "source of the repo" 41 + }, 42 + "createdAt": { 43 + "type": "string", 44 + "format": "datetime" 40 45 } 41 46 } 42 47 }
+6 -8
lexicons/star.json
··· 10 10 "record": { 11 11 "type": "object", 12 12 "required": [ 13 - "createdAt", 14 - "subject" 13 + "subject", 14 + "createdAt" 15 15 ], 16 16 "properties": { 17 - "createdAt": { 18 - "type": "string", 19 - "format": "datetime" 20 - }, 21 17 "subject": { 22 18 "type": "string", 23 19 "format": "at-uri" 20 + }, 21 + "createdAt": { 22 + "type": "string", 23 + "format": "datetime" 24 24 } 25 25 } 26 26 } 27 27 } 28 28 } 29 29 } 30 - 31 -