Monorepo for Tangled tangled.org
763
fork

Configure Feed

Select the types of activity you want to include in your feed.

lexicons: update pull lexicon

Signed-off-by: oppiliappan <me@oppi.li>

authored by

oppiliappan and committed by tangled.org 9319da61 7fa08bc4

+327 -166
+269 -128
api/tangled/cbor_gen.go
··· 8581 8581 fieldCount-- 8582 8582 } 8583 8583 8584 - if t.Mentions == nil { 8584 + if t.DependentOn == nil { 8585 8585 fieldCount-- 8586 8586 } 8587 8587 8588 - if t.Patch == nil { 8588 + if t.Mentions == nil { 8589 8589 fieldCount-- 8590 8590 } 8591 8591 ··· 8652 8652 return err 8653 8653 } 8654 8654 8655 - // t.Patch (string) (string) 8656 - if t.Patch != nil { 8657 - 8658 - if len("patch") > 1000000 { 8659 - return xerrors.Errorf("Value in field \"patch\" was too long") 8660 - } 8661 - 8662 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("patch"))); err != nil { 8663 - return err 8664 - } 8665 - if _, err := cw.WriteString(string("patch")); err != nil { 8666 - return err 8667 - } 8668 - 8669 - if t.Patch == nil { 8670 - if _, err := cw.Write(cbg.CborNull); err != nil { 8671 - return err 8672 - } 8673 - } else { 8674 - if len(*t.Patch) > 1000000 { 8675 - return xerrors.Errorf("Value in field t.Patch was too long") 8676 - } 8677 - 8678 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Patch))); err != nil { 8679 - return err 8680 - } 8681 - if _, err := cw.WriteString(string(*t.Patch)); err != nil { 8682 - return err 8683 - } 8684 - } 8685 - } 8686 - 8687 8655 // t.Title (string) (string) 8688 8656 if len("title") > 1000000 { 8689 8657 return xerrors.Errorf("Value in field \"title\" was too long") ··· 8707 8675 return err 8708 8676 } 8709 8677 8678 + // t.Rounds ([]*tangled.RepoPull_Round) (slice) 8679 + if len("rounds") > 1000000 { 8680 + return xerrors.Errorf("Value in field \"rounds\" was too long") 8681 + } 8682 + 8683 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("rounds"))); err != nil { 8684 + return err 8685 + } 8686 + if _, err := cw.WriteString(string("rounds")); err != nil { 8687 + return err 8688 + } 8689 + 8690 + if len(t.Rounds) > 8192 { 8691 + return xerrors.Errorf("Slice value in field t.Rounds was too long") 8692 + } 8693 + 8694 + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Rounds))); err != nil { 8695 + return err 8696 + } 8697 + for _, v := range t.Rounds { 8698 + if err := v.MarshalCBOR(cw); err != nil { 8699 + return err 8700 + } 8701 + 8702 + } 8703 + 8710 8704 // t.Source (tangled.RepoPull_Source) (struct) 8711 8705 if t.Source != nil { 8712 8706 ··· 8801 8795 return err 8802 8796 } 8803 8797 8804 - // t.PatchBlob (util.LexBlob) (struct) 8805 - if len("patchBlob") > 1000000 { 8806 - return xerrors.Errorf("Value in field \"patchBlob\" was too long") 8807 - } 8808 - 8809 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("patchBlob"))); err != nil { 8810 - return err 8811 - } 8812 - if _, err := cw.WriteString(string("patchBlob")); err != nil { 8813 - return err 8814 - } 8815 - 8816 - if err := t.PatchBlob.MarshalCBOR(cw); err != nil { 8817 - return err 8818 - } 8819 - 8820 8798 // t.References ([]string) (slice) 8821 8799 if t.References != nil { 8822 8800 ··· 8852 8830 8853 8831 } 8854 8832 } 8833 + 8834 + // t.DependentOn (string) (string) 8835 + if t.DependentOn != nil { 8836 + 8837 + if len("dependentOn") > 1000000 { 8838 + return xerrors.Errorf("Value in field \"dependentOn\" was too long") 8839 + } 8840 + 8841 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("dependentOn"))); err != nil { 8842 + return err 8843 + } 8844 + if _, err := cw.WriteString(string("dependentOn")); err != nil { 8845 + return err 8846 + } 8847 + 8848 + if t.DependentOn == nil { 8849 + if _, err := cw.Write(cbg.CborNull); err != nil { 8850 + return err 8851 + } 8852 + } else { 8853 + if len(*t.DependentOn) > 1000000 { 8854 + return xerrors.Errorf("Value in field t.DependentOn was too long") 8855 + } 8856 + 8857 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.DependentOn))); err != nil { 8858 + return err 8859 + } 8860 + if _, err := cw.WriteString(string(*t.DependentOn)); err != nil { 8861 + return err 8862 + } 8863 + } 8864 + } 8855 8865 return nil 8856 8866 } 8857 8867 ··· 8880 8890 8881 8891 n := extra 8882 8892 8883 - nameBuf := make([]byte, 10) 8893 + nameBuf := make([]byte, 11) 8884 8894 for i := uint64(0); i < n; i++ { 8885 8895 nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 8886 8896 if err != nil { ··· 8928 8938 8929 8939 t.LexiconTypeID = string(sval) 8930 8940 } 8931 - // t.Patch (string) (string) 8932 - case "patch": 8941 + // t.Title (string) (string) 8942 + case "title": 8933 8943 8934 8944 { 8935 - b, err := cr.ReadByte() 8945 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 8936 8946 if err != nil { 8937 8947 return err 8938 8948 } 8939 - if b != cbg.CborNull[0] { 8940 - if err := cr.UnreadByte(); err != nil { 8941 - return err 8942 - } 8943 8949 8944 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 8945 - if err != nil { 8946 - return err 8947 - } 8950 + t.Title = string(sval) 8951 + } 8952 + // t.Rounds ([]*tangled.RepoPull_Round) (slice) 8953 + case "rounds": 8954 + 8955 + maj, extra, err = cr.ReadHeader() 8956 + if err != nil { 8957 + return err 8958 + } 8959 + 8960 + if extra > 8192 { 8961 + return fmt.Errorf("t.Rounds: array too large (%d)", extra) 8962 + } 8948 8963 8949 - t.Patch = (*string)(&sval) 8950 - } 8964 + if maj != cbg.MajArray { 8965 + return fmt.Errorf("expected cbor array") 8951 8966 } 8952 - // t.Title (string) (string) 8953 - case "title": 8967 + 8968 + if extra > 0 { 8969 + t.Rounds = make([]*RepoPull_Round, extra) 8970 + } 8971 + 8972 + for i := 0; i < int(extra); i++ { 8973 + { 8974 + var maj byte 8975 + var extra uint64 8976 + var err error 8977 + _ = maj 8978 + _ = extra 8979 + _ = err 8954 8980 8955 - { 8956 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 8957 - if err != nil { 8958 - return err 8959 - } 8981 + { 8960 8982 8961 - t.Title = string(sval) 8983 + b, err := cr.ReadByte() 8984 + if err != nil { 8985 + return err 8986 + } 8987 + if b != cbg.CborNull[0] { 8988 + if err := cr.UnreadByte(); err != nil { 8989 + return err 8990 + } 8991 + t.Rounds[i] = new(RepoPull_Round) 8992 + if err := t.Rounds[i].UnmarshalCBOR(cr); err != nil { 8993 + return xerrors.Errorf("unmarshaling t.Rounds[i] pointer: %w", err) 8994 + } 8995 + } 8996 + 8997 + } 8998 + 8999 + } 8962 9000 } 8963 9001 // t.Source (tangled.RepoPull_Source) (struct) 8964 9002 case "source": ··· 9051 9089 9052 9090 t.CreatedAt = string(sval) 9053 9091 } 9054 - // t.PatchBlob (util.LexBlob) (struct) 9055 - case "patchBlob": 9056 - 9057 - { 9058 - 9059 - b, err := cr.ReadByte() 9060 - if err != nil { 9061 - return err 9062 - } 9063 - if b != cbg.CborNull[0] { 9064 - if err := cr.UnreadByte(); err != nil { 9065 - return err 9066 - } 9067 - t.PatchBlob = new(util.LexBlob) 9068 - if err := t.PatchBlob.UnmarshalCBOR(cr); err != nil { 9069 - return xerrors.Errorf("unmarshaling t.PatchBlob pointer: %w", err) 9070 - } 9071 - } 9072 - 9073 - } 9074 9092 // t.References ([]string) (slice) 9075 9093 case "references": 9076 9094 ··· 9109 9127 t.References[i] = string(sval) 9110 9128 } 9111 9129 9130 + } 9131 + } 9132 + // t.DependentOn (string) (string) 9133 + case "dependentOn": 9134 + 9135 + { 9136 + b, err := cr.ReadByte() 9137 + if err != nil { 9138 + return err 9139 + } 9140 + if b != cbg.CborNull[0] { 9141 + if err := cr.UnreadByte(); err != nil { 9142 + return err 9143 + } 9144 + 9145 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 9146 + if err != nil { 9147 + return err 9148 + } 9149 + 9150 + t.DependentOn = (*string)(&sval) 9112 9151 } 9113 9152 } 9114 9153 ··· 9488 9527 } 9489 9528 9490 9529 cw := cbg.NewCborWriter(w) 9491 - fieldCount := 4 9530 + fieldCount := 3 9492 9531 9493 9532 if t.Repo == nil { 9494 9533 fieldCount-- ··· 9499 9538 } 9500 9539 9501 9540 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 9502 - return err 9503 - } 9504 - 9505 - // t.Sha (string) (string) 9506 - if len("sha") > 1000000 { 9507 - return xerrors.Errorf("Value in field \"sha\" was too long") 9508 - } 9509 - 9510 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sha"))); err != nil { 9511 - return err 9512 - } 9513 - if _, err := cw.WriteString(string("sha")); err != nil { 9514 - return err 9515 - } 9516 - 9517 - if len(t.Sha) > 1000000 { 9518 - return xerrors.Errorf("Value in field t.Sha was too long") 9519 - } 9520 - 9521 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Sha))); err != nil { 9522 - return err 9523 - } 9524 - if _, err := cw.WriteString(string(t.Sha)); err != nil { 9525 9541 return err 9526 9542 } 9527 9543 ··· 9655 9671 } 9656 9672 9657 9673 switch string(nameBuf[:nameLen]) { 9658 - // t.Sha (string) (string) 9659 - case "sha": 9660 - 9661 - { 9662 - sval, err := cbg.ReadStringWithMax(cr, 1000000) 9663 - if err != nil { 9664 - return err 9665 - } 9666 - 9667 - t.Sha = string(sval) 9668 - } 9669 - // t.Repo (string) (string) 9674 + // t.Repo (string) (string) 9670 9675 case "repo": 9671 9676 9672 9677 { ··· 9718 9723 9719 9724 t.RepoDid = (*string)(&sval) 9720 9725 } 9726 + } 9727 + 9728 + default: 9729 + // Field doesn't exist on this type, so ignore it 9730 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 9731 + return err 9732 + } 9733 + } 9734 + } 9735 + 9736 + return nil 9737 + } 9738 + func (t *RepoPull_Round) MarshalCBOR(w io.Writer) error { 9739 + if t == nil { 9740 + _, err := w.Write(cbg.CborNull) 9741 + return err 9742 + } 9743 + 9744 + cw := cbg.NewCborWriter(w) 9745 + 9746 + if _, err := cw.Write([]byte{162}); err != nil { 9747 + return err 9748 + } 9749 + 9750 + // t.CreatedAt (string) (string) 9751 + if len("createdAt") > 1000000 { 9752 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 9753 + } 9754 + 9755 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 9756 + return err 9757 + } 9758 + if _, err := cw.WriteString(string("createdAt")); err != nil { 9759 + return err 9760 + } 9761 + 9762 + if len(t.CreatedAt) > 1000000 { 9763 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 9764 + } 9765 + 9766 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 9767 + return err 9768 + } 9769 + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 9770 + return err 9771 + } 9772 + 9773 + // t.PatchBlob (util.LexBlob) (struct) 9774 + if len("patchBlob") > 1000000 { 9775 + return xerrors.Errorf("Value in field \"patchBlob\" was too long") 9776 + } 9777 + 9778 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("patchBlob"))); err != nil { 9779 + return err 9780 + } 9781 + if _, err := cw.WriteString(string("patchBlob")); err != nil { 9782 + return err 9783 + } 9784 + 9785 + if err := t.PatchBlob.MarshalCBOR(cw); err != nil { 9786 + return err 9787 + } 9788 + return nil 9789 + } 9790 + 9791 + func (t *RepoPull_Round) UnmarshalCBOR(r io.Reader) (err error) { 9792 + *t = RepoPull_Round{} 9793 + 9794 + cr := cbg.NewCborReader(r) 9795 + 9796 + maj, extra, err := cr.ReadHeader() 9797 + if err != nil { 9798 + return err 9799 + } 9800 + defer func() { 9801 + if err == io.EOF { 9802 + err = io.ErrUnexpectedEOF 9803 + } 9804 + }() 9805 + 9806 + if maj != cbg.MajMap { 9807 + return fmt.Errorf("cbor input should be of type map") 9808 + } 9809 + 9810 + if extra > cbg.MaxLength { 9811 + return fmt.Errorf("RepoPull_Round: map struct too large (%d)", extra) 9812 + } 9813 + 9814 + n := extra 9815 + 9816 + nameBuf := make([]byte, 9) 9817 + for i := uint64(0); i < n; i++ { 9818 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 9819 + if err != nil { 9820 + return err 9821 + } 9822 + 9823 + if !ok { 9824 + // Field doesn't exist on this type, so ignore it 9825 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 9826 + return err 9827 + } 9828 + continue 9829 + } 9830 + 9831 + switch string(nameBuf[:nameLen]) { 9832 + // t.CreatedAt (string) (string) 9833 + case "createdAt": 9834 + 9835 + { 9836 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 9837 + if err != nil { 9838 + return err 9839 + } 9840 + 9841 + t.CreatedAt = string(sval) 9842 + } 9843 + // t.PatchBlob (util.LexBlob) (struct) 9844 + case "patchBlob": 9845 + 9846 + { 9847 + 9848 + b, err := cr.ReadByte() 9849 + if err != nil { 9850 + return err 9851 + } 9852 + if b != cbg.CborNull[0] { 9853 + if err := cr.UnreadByte(); err != nil { 9854 + return err 9855 + } 9856 + t.PatchBlob = new(util.LexBlob) 9857 + if err := t.PatchBlob.UnmarshalCBOR(cr); err != nil { 9858 + return xerrors.Errorf("unmarshaling t.PatchBlob pointer: %w", err) 9859 + } 9860 + } 9861 + 9721 9862 } 9722 9863 9723 9864 default:
+2 -2
api/tangled/knotsubscribeRepos.go
··· 18 18 19 19 // KnotSubscribeRepos_GitSync2 is a "gitSync2" in the sh.tangled.knot.subscribeRepos schema. 20 20 type KnotSubscribeRepos_GitSync2 struct { 21 - // did: Repository AT-URI identifier 22 - Did *string `json:"did,omitempty" cborgen:"did,omitempty"` 21 + // repo: Repository AT-URI identifier 22 + Repo string `json:"repo" cborgen:"repo"` 23 23 // seq: The stream sequence number of this message. 24 24 Seq int64 `json:"seq" cborgen:"seq"` 25 25 }
+18 -13
api/tangled/repopull.go
··· 17 17 } // 18 18 // RECORDTYPE: RepoPull 19 19 type RepoPull struct { 20 - LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull" cborgen:"$type,const=sh.tangled.repo.pull"` 21 - Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 22 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 - Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"` 24 - // patch: (deprecated) use patchBlob instead 25 - Patch *string `json:"patch,omitempty" cborgen:"patch,omitempty"` 26 - // patchBlob: patch content 27 - PatchBlob *util.LexBlob `json:"patchBlob" cborgen:"patchBlob"` 28 - References []string `json:"references,omitempty" cborgen:"references,omitempty"` 29 - Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"` 30 - Target *RepoPull_Target `json:"target" cborgen:"target"` 31 - Title string `json:"title" cborgen:"title"` 20 + LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull" cborgen:"$type,const=sh.tangled.repo.pull"` 21 + Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 22 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 + DependentOn *string `json:"dependentOn,omitempty" cborgen:"dependentOn,omitempty"` 24 + Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"` 25 + References []string `json:"references,omitempty" cborgen:"references,omitempty"` 26 + Rounds []*RepoPull_Round `json:"rounds" cborgen:"rounds"` 27 + Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"` 28 + Target *RepoPull_Target `json:"target" cborgen:"target"` 29 + Title string `json:"title" cborgen:"title"` 30 + } 31 + 32 + // RepoPull_Round is a "round" in the sh.tangled.repo.pull schema. 33 + // 34 + // revisions of this pull request, newer rounds are appended to this array. appviews may reject records do not treat this field as append-only. the blob format is gzipped text-based git-format-patches. 35 + type RepoPull_Round struct { 36 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 37 + PatchBlob *util.LexBlob `json:"patchBlob" cborgen:"patchBlob"` 32 38 } 33 39 34 40 // RepoPull_Source is a "source" in the sh.tangled.repo.pull schema. ··· 36 42 Branch string `json:"branch" cborgen:"branch"` 37 43 Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` 38 44 RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` 39 - Sha string `json:"sha" cborgen:"sha"` 40 45 } 41 46 42 47 // RepoPull_Target is a "target" in the sh.tangled.repo.pull schema.
+1
cmd/cborgen/cborgen.go
··· 50 50 tangled.RepoPull{}, 51 51 tangled.RepoPullComment{}, 52 52 tangled.RepoPull_Source{}, 53 + tangled.RepoPull_Round{}, 53 54 tangled.RepoPullStatus{}, 54 55 tangled.RepoPull_Target{}, 55 56 tangled.Spindle{},
+37 -23
lexicons/pulls/pull.json
··· 12 12 "required": [ 13 13 "target", 14 14 "title", 15 - "patchBlob", 16 - "createdAt" 15 + "createdAt", 16 + "rounds" 17 17 ], 18 18 "properties": { 19 - "target": { 20 - "type": "ref", 21 - "ref": "#target" 22 - }, 23 19 "title": { 24 20 "type": "string" 25 21 }, 26 22 "body": { 27 23 "type": "string" 28 24 }, 29 - "patch": { 30 - "type": "string", 31 - "description": "(deprecated) use patchBlob instead" 32 - }, 33 - "patchBlob": { 34 - "type": "blob", 35 - "accept": [ 36 - "text/x-patch" 37 - ], 38 - "description": "patch content" 25 + "rounds": { 26 + "type": "array", 27 + "items": { 28 + "type": "ref", 29 + "ref": "#round" 30 + } 39 31 }, 40 32 "source": { 41 33 "type": "ref", 42 34 "ref": "#source" 35 + }, 36 + "target": { 37 + "type": "ref", 38 + "ref": "#target" 43 39 }, 44 40 "createdAt": { 45 41 "type": "string", ··· 58 54 "type": "string", 59 55 "format": "at-uri" 60 56 } 57 + }, 58 + "dependentOn": { 59 + "type": "string", 60 + "format": "at-uri" 61 61 } 62 62 } 63 63 } ··· 84 84 "source": { 85 85 "type": "object", 86 86 "required": [ 87 - "branch", 88 - "sha" 87 + "branch" 89 88 ], 90 89 "properties": { 91 90 "branch": { 92 91 "type": "string" 93 92 }, 94 - "sha": { 95 - "type": "string", 96 - "minLength": 40, 97 - "maxLength": 40 98 - }, 99 93 "repo": { 100 94 "type": "string", 101 95 "format": "at-uri" ··· 103 97 "repoDid": { 104 98 "type": "string", 105 99 "format": "did" 100 + } 101 + } 102 + }, 103 + "round": { 104 + "type": "object", 105 + "required": [ 106 + "patchBlob", 107 + "createdAt" 108 + ], 109 + "description": "revisions of this pull request, newer rounds are appended to this array. appviews may reject records do not treat this field as append-only. the blob format is gzipped text-based git-format-patches.", 110 + "properties": { 111 + "createdAt": { 112 + "type": "string", 113 + "format": "datetime" 114 + }, 115 + "patchBlob": { 116 + "type": "blob", 117 + "accept": [ 118 + "application/gzip" 119 + ] 106 120 } 107 121 } 108 122 }