From 9d70af5e007ded7fc0c35ce048d4b20b63ce93c8 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Fri, 6 Jun 2025 17:31:47 +0300 Subject: [PATCH] lexicons: setup sh.tangled.spindle.member Signed-off-by: Anirudh Oppiliappan --- api/tangled/cbor_gen.go | 3910 ++++++++++++++++++---------------- api/tangled/spindlemember.go | 25 + cmd/gen.go | 21 +- cmd/spindle/main.go | 4 + lexicons/spindle/member.json | 34 + 5 files changed, 2140 insertions(+), 1854 deletions(-) create mode 100644 api/tangled/spindlemember.go create mode 100644 cmd/spindle/main.go create mode 100644 lexicons/spindle/member.json diff --git a/api/tangled/cbor_gen.go b/api/tangled/cbor_gen.go index bb6f06b..83efa83 100644 --- a/api/tangled/cbor_gen.go +++ b/api/tangled/cbor_gen.go @@ -668,7 +668,7 @@ func (t *FeedStar) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *GitRefUpdate) MarshalCBOR(w io.Writer) error { +func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -676,187 +676,59 @@ func (t *GitRefUpdate) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) - if _, err := cw.Write([]byte{168}); err != nil { - return err - } - - // t.Ref (string) (string) - if len("ref") > 1000000 { - return xerrors.Errorf("Value in field \"ref\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil { - return err - } - if _, err := cw.WriteString(string("ref")); err != nil { - return err - } - - if len(t.Ref) > 1000000 { - return xerrors.Errorf("Value in field t.Ref was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Ref))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Ref)); err != nil { - return err - } - - // t.Meta (tangled.GitRefUpdate_Meta) (struct) - if len("meta") > 1000000 { - return xerrors.Errorf("Value in field \"meta\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("meta"))); err != nil { - return err - } - if _, err := cw.WriteString(string("meta")); err != nil { - return err - } - - if err := t.Meta.MarshalCBOR(cw); err != nil { - return err - } - - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { - return err - } - if _, err := cw.WriteString(string("$type")); err != nil { - return err - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.git.refUpdate"))); err != nil { - return err - } - if _, err := cw.WriteString(string("sh.tangled.git.refUpdate")); err != nil { - return err - } - - // t.NewSha (string) (string) - if len("newSha") > 1000000 { - return xerrors.Errorf("Value in field \"newSha\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("newSha"))); err != nil { - return err - } - if _, err := cw.WriteString(string("newSha")); err != nil { - return err - } - - if len(t.NewSha) > 1000000 { - return xerrors.Errorf("Value in field t.NewSha was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.NewSha))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.NewSha)); err != nil { - return err - } - - // t.OldSha (string) (string) - if len("oldSha") > 1000000 { - return xerrors.Errorf("Value in field \"oldSha\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("oldSha"))); err != nil { - return err - } - if _, err := cw.WriteString(string("oldSha")); err != nil { - return err - } - - if len(t.OldSha) > 1000000 { - return xerrors.Errorf("Value in field t.OldSha was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.OldSha))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.OldSha)); err != nil { - return err - } - - // t.RepoDid (string) (string) - if len("repoDid") > 1000000 { - return xerrors.Errorf("Value in field \"repoDid\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { - return err - } - if _, err := cw.WriteString(string("repoDid")); err != nil { - return err - } - - if len(t.RepoDid) > 1000000 { - return xerrors.Errorf("Value in field t.RepoDid was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RepoDid))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.RepoDid)); err != nil { + if _, err := cw.Write([]byte{162}); err != nil { return err } - // t.RepoName (string) (string) - if len("repoName") > 1000000 { - return xerrors.Errorf("Value in field \"repoName\" was too long") + // t.Count (int64) (int64) + if len("count") > 1000000 { + return xerrors.Errorf("Value in field \"count\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoName"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("count"))); err != nil { return err } - if _, err := cw.WriteString(string("repoName")); err != nil { + if _, err := cw.WriteString(string("count")); err != nil { return err } - if len(t.RepoName) > 1000000 { - return xerrors.Errorf("Value in field t.RepoName was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RepoName))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.RepoName)); err != nil { - return err + if t.Count >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Count)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Count-1)); err != nil { + return err + } } - // t.CommitterDid (string) (string) - if len("committerDid") > 1000000 { - return xerrors.Errorf("Value in field \"committerDid\" was too long") + // t.Email (string) (string) + if len("email") > 1000000 { + return xerrors.Errorf("Value in field \"email\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("committerDid"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("email"))); err != nil { return err } - if _, err := cw.WriteString(string("committerDid")); err != nil { + if _, err := cw.WriteString(string("email")); err != nil { return err } - if len(t.CommitterDid) > 1000000 { - return xerrors.Errorf("Value in field t.CommitterDid was too long") + if len(t.Email) > 1000000 { + return xerrors.Errorf("Value in field t.Email was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CommitterDid))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Email))); err != nil { return err } - if _, err := cw.WriteString(string(t.CommitterDid)); err != nil { + if _, err := cw.WriteString(string(t.Email)); err != nil { return err } return nil } -func (t *GitRefUpdate) UnmarshalCBOR(r io.Reader) (err error) { - *t = GitRefUpdate{} +func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) UnmarshalCBOR(r io.Reader) (err error) { + *t = GitRefUpdate_Meta_CommitCount_ByEmail_Elem{} cr := cbg.NewCborReader(r) @@ -875,12 +747,12 @@ func (t *GitRefUpdate) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("GitRefUpdate: map struct too large (%d)", extra) + return fmt.Errorf("GitRefUpdate_Meta_CommitCount_ByEmail_Elem: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 12) + nameBuf := make([]byte, 5) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -896,39 +768,34 @@ func (t *GitRefUpdate) UnmarshalCBOR(r io.Reader) (err error) { } switch string(nameBuf[:nameLen]) { - // t.Ref (string) (string) - case "ref": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Ref = string(sval) - } - // t.Meta (tangled.GitRefUpdate_Meta) (struct) - case "meta": - + // t.Count (int64) (int64) + case "count": { - - b, err := cr.ReadByte() + maj, extra, err := cr.ReadHeader() if err != nil { return err } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err + var extraI int64 + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") } - t.Meta = new(GitRefUpdate_Meta) - if err := t.Meta.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Meta pointer: %w", err) + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) } + t.Count = int64(extraI) } - // t.LexiconTypeID (string) (string) - case "$type": + // t.Email (string) (string) + case "email": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -936,207 +803,16 @@ func (t *GitRefUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.LexiconTypeID = string(sval) + t.Email = string(sval) } - // t.NewSha (string) (string) - case "newSha": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - t.NewSha = string(sval) + default: + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { + return err } - // t.OldSha (string) (string) - case "oldSha": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.OldSha = string(sval) - } - // t.RepoDid (string) (string) - case "repoDid": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.RepoDid = string(sval) - } - // t.RepoName (string) (string) - case "repoName": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.RepoName = string(sval) - } - // t.CommitterDid (string) (string) - case "committerDid": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.CommitterDid = string(sval) - } - - default: - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { - return err - } - } - } - - return nil -} -func (t *GitRefUpdate_Meta) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write([]byte{162}); err != nil { - return err - } - - // t.CommitCount (tangled.GitRefUpdate_Meta_CommitCount) (struct) - if len("commitCount") > 1000000 { - return xerrors.Errorf("Value in field \"commitCount\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commitCount"))); err != nil { - return err - } - if _, err := cw.WriteString(string("commitCount")); err != nil { - return err - } - - if err := t.CommitCount.MarshalCBOR(cw); err != nil { - return err - } - - // t.IsDefaultRef (bool) (bool) - if len("isDefaultRef") > 1000000 { - return xerrors.Errorf("Value in field \"isDefaultRef\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("isDefaultRef"))); err != nil { - return err - } - if _, err := cw.WriteString(string("isDefaultRef")); err != nil { - return err - } - - if err := cbg.WriteBool(w, t.IsDefaultRef); err != nil { - return err - } - return nil -} - -func (t *GitRefUpdate_Meta) UnmarshalCBOR(r io.Reader) (err error) { - *t = GitRefUpdate_Meta{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajMap { - return fmt.Errorf("cbor input should be of type map") - } - - if extra > cbg.MaxLength { - return fmt.Errorf("GitRefUpdate_Meta: map struct too large (%d)", extra) - } - - n := extra - - nameBuf := make([]byte, 12) - for i := uint64(0); i < n; i++ { - nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) - if err != nil { - return err - } - - if !ok { - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { - return err - } - continue - } - - switch string(nameBuf[:nameLen]) { - // t.CommitCount (tangled.GitRefUpdate_Meta_CommitCount) (struct) - case "commitCount": - - { - - b, err := cr.ReadByte() - if err != nil { - return err - } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - t.CommitCount = new(GitRefUpdate_Meta_CommitCount) - if err := t.CommitCount.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.CommitCount pointer: %w", err) - } - } - - } - // t.IsDefaultRef (bool) (bool) - case "isDefaultRef": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") - } - switch extra { - case 20: - t.IsDefaultRef = false - case 21: - t.IsDefaultRef = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) - } - - default: - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { - return err - } - } - } + } + } return nil } @@ -1289,7 +965,7 @@ func (t *GitRefUpdate_Meta_CommitCount) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) MarshalCBOR(w io.Writer) error { +func (t *GitRefUpdate_Meta) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -1301,55 +977,42 @@ func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) MarshalCBOR(w io.Writer) er return err } - // t.Count (int64) (int64) - if len("count") > 1000000 { - return xerrors.Errorf("Value in field \"count\" was too long") + // t.CommitCount (tangled.GitRefUpdate_Meta_CommitCount) (struct) + if len("commitCount") > 1000000 { + return xerrors.Errorf("Value in field \"commitCount\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("count"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commitCount"))); err != nil { return err } - if _, err := cw.WriteString(string("count")); err != nil { + if _, err := cw.WriteString(string("commitCount")); err != nil { return err } - if t.Count >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Count)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Count-1)); err != nil { - return err - } + if err := t.CommitCount.MarshalCBOR(cw); err != nil { + return err } - // t.Email (string) (string) - if len("email") > 1000000 { - return xerrors.Errorf("Value in field \"email\" was too long") + // t.IsDefaultRef (bool) (bool) + if len("isDefaultRef") > 1000000 { + return xerrors.Errorf("Value in field \"isDefaultRef\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("email"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("isDefaultRef"))); err != nil { return err } - if _, err := cw.WriteString(string("email")); err != nil { + if _, err := cw.WriteString(string("isDefaultRef")); err != nil { return err } - if len(t.Email) > 1000000 { - return xerrors.Errorf("Value in field t.Email was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Email))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Email)); err != nil { + if err := cbg.WriteBool(w, t.IsDefaultRef); err != nil { return err } return nil } -func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) UnmarshalCBOR(r io.Reader) (err error) { - *t = GitRefUpdate_Meta_CommitCount_ByEmail_Elem{} +func (t *GitRefUpdate_Meta) UnmarshalCBOR(r io.Reader) (err error) { + *t = GitRefUpdate_Meta{} cr := cbg.NewCborReader(r) @@ -1368,12 +1031,12 @@ func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) UnmarshalCBOR(r io.Reader) } if extra > cbg.MaxLength { - return fmt.Errorf("GitRefUpdate_Meta_CommitCount_ByEmail_Elem: map struct too large (%d)", extra) + return fmt.Errorf("GitRefUpdate_Meta: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 5) + nameBuf := make([]byte, 12) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -1389,42 +1052,43 @@ func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) UnmarshalCBOR(r io.Reader) } switch string(nameBuf[:nameLen]) { - // t.Count (int64) (int64) - case "count": + // t.CommitCount (tangled.GitRefUpdate_Meta_CommitCount) (struct) + case "commitCount": + { - maj, extra, err := cr.ReadHeader() + + b, err := cr.ReadByte() if err != nil { return err } - var extraI int64 - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative overflow") + t.CommitCount = new(GitRefUpdate_Meta_CommitCount) + if err := t.CommitCount.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.CommitCount pointer: %w", err) } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) } - t.Count = int64(extraI) } - // t.Email (string) (string) - case "email": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } + // t.IsDefaultRef (bool) (bool) + case "isDefaultRef": - t.Email = string(sval) + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.IsDefaultRef = false + case 21: + t.IsDefaultRef = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) } default: @@ -1437,7 +1101,7 @@ func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) UnmarshalCBOR(r io.Reader) return nil } -func (t *GraphFollow) MarshalCBOR(w io.Writer) error { +func (t *GitRefUpdate) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -1445,266 +1109,187 @@ func (t *GraphFollow) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) - if _, err := cw.Write([]byte{163}); err != nil { + if _, err := cw.Write([]byte{168}); err != nil { return err } - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") + // t.Ref (string) (string) + if len("ref") > 1000000 { + return xerrors.Errorf("Value in field \"ref\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil { return err } - if _, err := cw.WriteString(string("$type")); err != nil { + if _, err := cw.WriteString(string("ref")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.graph.follow"))); err != nil { + if len(t.Ref) > 1000000 { + return xerrors.Errorf("Value in field t.Ref was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Ref))); err != nil { return err } - if _, err := cw.WriteString(string("sh.tangled.graph.follow")); err != nil { + if _, err := cw.WriteString(string(t.Ref)); err != nil { return err } - // t.Subject (string) (string) - if len("subject") > 1000000 { - return xerrors.Errorf("Value in field \"subject\" was too long") + // t.Meta (tangled.GitRefUpdate_Meta) (struct) + if len("meta") > 1000000 { + return xerrors.Errorf("Value in field \"meta\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("meta"))); err != nil { return err } - if _, err := cw.WriteString(string("subject")); err != nil { + if _, err := cw.WriteString(string("meta")); err != nil { return err } - if len(t.Subject) > 1000000 { - return xerrors.Errorf("Value in field t.Subject was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Subject)); err != nil { + if err := t.Meta.MarshalCBOR(cw); err != nil { return err } - // t.CreatedAt (string) (string) - if len("createdAt") > 1000000 { - return xerrors.Errorf("Value in field \"createdAt\" was too long") + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } - if _, err := cw.WriteString(string("createdAt")); err != nil { + if _, err := cw.WriteString(string("$type")); err != nil { return err } - if len(t.CreatedAt) > 1000000 { - return xerrors.Errorf("Value in field t.CreatedAt was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.git.refUpdate"))); err != nil { return err } - if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { + if _, err := cw.WriteString(string("sh.tangled.git.refUpdate")); err != nil { return err } - return nil -} - -func (t *GraphFollow) UnmarshalCBOR(r io.Reader) (err error) { - *t = GraphFollow{} - - cr := cbg.NewCborReader(r) - maj, extra, err := cr.ReadHeader() - if err != nil { - return err + // t.NewSha (string) (string) + if len("newSha") > 1000000 { + return xerrors.Errorf("Value in field \"newSha\" was too long") } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - if maj != cbg.MajMap { - return fmt.Errorf("cbor input should be of type map") + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("newSha"))); err != nil { + return err } - - if extra > cbg.MaxLength { - return fmt.Errorf("GraphFollow: map struct too large (%d)", extra) + if _, err := cw.WriteString(string("newSha")); err != nil { + return err } - n := extra - - nameBuf := make([]byte, 9) - for i := uint64(0); i < n; i++ { - nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) - if err != nil { - return err - } - - if !ok { - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { - return err - } - continue - } - - switch string(nameBuf[:nameLen]) { - // t.LexiconTypeID (string) (string) - case "$type": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.LexiconTypeID = string(sval) - } - // t.Subject (string) (string) - case "subject": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Subject = string(sval) - } - // t.CreatedAt (string) (string) - case "createdAt": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.CreatedAt = string(sval) - } - - default: - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { - return err - } - } + if len(t.NewSha) > 1000000 { + return xerrors.Errorf("Value in field t.NewSha was too long") } - return nil -} -func (t *KnotMember) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.NewSha))); err != nil { return err } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write([]byte{164}); err != nil { + if _, err := cw.WriteString(string(t.NewSha)); err != nil { return err } - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") + // t.OldSha (string) (string) + if len("oldSha") > 1000000 { + return xerrors.Errorf("Value in field \"oldSha\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("oldSha"))); err != nil { return err } - if _, err := cw.WriteString(string("$type")); err != nil { + if _, err := cw.WriteString(string("oldSha")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.knot.member"))); err != nil { + if len(t.OldSha) > 1000000 { + return xerrors.Errorf("Value in field t.OldSha was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.OldSha))); err != nil { return err } - if _, err := cw.WriteString(string("sh.tangled.knot.member")); err != nil { + if _, err := cw.WriteString(string(t.OldSha)); err != nil { return err } - // t.Domain (string) (string) - if len("domain") > 1000000 { - return xerrors.Errorf("Value in field \"domain\" was too long") + // t.RepoDid (string) (string) + if len("repoDid") > 1000000 { + return xerrors.Errorf("Value in field \"repoDid\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("domain"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { return err } - if _, err := cw.WriteString(string("domain")); err != nil { + if _, err := cw.WriteString(string("repoDid")); err != nil { return err } - if len(t.Domain) > 1000000 { - return xerrors.Errorf("Value in field t.Domain was too long") + if len(t.RepoDid) > 1000000 { + return xerrors.Errorf("Value in field t.RepoDid was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Domain))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RepoDid))); err != nil { return err } - if _, err := cw.WriteString(string(t.Domain)); err != nil { + if _, err := cw.WriteString(string(t.RepoDid)); err != nil { return err } - // t.Subject (string) (string) - if len("subject") > 1000000 { - return xerrors.Errorf("Value in field \"subject\" was too long") + // t.RepoName (string) (string) + if len("repoName") > 1000000 { + return xerrors.Errorf("Value in field \"repoName\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoName"))); err != nil { return err } - if _, err := cw.WriteString(string("subject")); err != nil { + if _, err := cw.WriteString(string("repoName")); err != nil { return err } - if len(t.Subject) > 1000000 { - return xerrors.Errorf("Value in field t.Subject was too long") + if len(t.RepoName) > 1000000 { + return xerrors.Errorf("Value in field t.RepoName was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RepoName))); err != nil { return err } - if _, err := cw.WriteString(string(t.Subject)); err != nil { + if _, err := cw.WriteString(string(t.RepoName)); err != nil { return err } - // t.CreatedAt (string) (string) - if len("createdAt") > 1000000 { - return xerrors.Errorf("Value in field \"createdAt\" was too long") + // t.CommitterDid (string) (string) + if len("committerDid") > 1000000 { + return xerrors.Errorf("Value in field \"committerDid\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("committerDid"))); err != nil { return err } - if _, err := cw.WriteString(string("createdAt")); err != nil { + if _, err := cw.WriteString(string("committerDid")); err != nil { return err } - if len(t.CreatedAt) > 1000000 { - return xerrors.Errorf("Value in field t.CreatedAt was too long") + if len(t.CommitterDid) > 1000000 { + return xerrors.Errorf("Value in field t.CommitterDid was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CommitterDid))); err != nil { return err } - if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { + if _, err := cw.WriteString(string(t.CommitterDid)); err != nil { return err } return nil } -func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) { - *t = KnotMember{} +func (t *GitRefUpdate) UnmarshalCBOR(r io.Reader) (err error) { + *t = GitRefUpdate{} cr := cbg.NewCborReader(r) @@ -1723,12 +1308,12 @@ func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("KnotMember: map struct too large (%d)", extra) + return fmt.Errorf("GitRefUpdate: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 9) + nameBuf := make([]byte, 12) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -1744,7 +1329,38 @@ func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) { } switch string(nameBuf[:nameLen]) { - // t.LexiconTypeID (string) (string) + // t.Ref (string) (string) + case "ref": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Ref = string(sval) + } + // t.Meta (tangled.GitRefUpdate_Meta) (struct) + case "meta": + + { + + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + t.Meta = new(GitRefUpdate_Meta) + if err := t.Meta.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Meta pointer: %w", err) + } + } + + } + // t.LexiconTypeID (string) (string) case "$type": { @@ -1755,8 +1371,8 @@ func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) { t.LexiconTypeID = string(sval) } - // t.Domain (string) (string) - case "domain": + // t.NewSha (string) (string) + case "newSha": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -1764,10 +1380,10 @@ func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Domain = string(sval) + t.NewSha = string(sval) } - // t.Subject (string) (string) - case "subject": + // t.OldSha (string) (string) + case "oldSha": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -1775,10 +1391,10 @@ func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Subject = string(sval) + t.OldSha = string(sval) } - // t.CreatedAt (string) (string) - case "createdAt": + // t.RepoDid (string) (string) + case "repoDid": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -1786,7 +1402,29 @@ func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.CreatedAt = string(sval) + t.RepoDid = string(sval) + } + // t.RepoName (string) (string) + case "repoName": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.RepoName = string(sval) + } + // t.CommitterDid (string) (string) + case "committerDid": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.CommitterDid = string(sval) } default: @@ -1799,7 +1437,7 @@ func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *Pipeline) MarshalCBOR(w io.Writer) error { +func (t *GraphFollow) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -1823,59 +1461,63 @@ func (t *Pipeline) MarshalCBOR(w io.Writer) error { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.pipeline"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.graph.follow"))); err != nil { return err } - if _, err := cw.WriteString(string("sh.tangled.pipeline")); err != nil { + if _, err := cw.WriteString(string("sh.tangled.graph.follow")); err != nil { return err } - // t.Workflows ([]*tangled.Pipeline_Workflow) (slice) - if len("workflows") > 1000000 { - return xerrors.Errorf("Value in field \"workflows\" was too long") + // t.Subject (string) (string) + if len("subject") > 1000000 { + return xerrors.Errorf("Value in field \"subject\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflows"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { return err } - if _, err := cw.WriteString(string("workflows")); err != nil { + if _, err := cw.WriteString(string("subject")); err != nil { return err } - if len(t.Workflows) > 8192 { - return xerrors.Errorf("Slice value in field t.Workflows was too long") + if len(t.Subject) > 1000000 { + return xerrors.Errorf("Value in field t.Subject was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Workflows))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil { return err } - for _, v := range t.Workflows { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - + if _, err := cw.WriteString(string(t.Subject)); err != nil { + return err } - // t.TriggerMetadata (tangled.Pipeline_TriggerMetadata) (struct) - if len("triggerMetadata") > 1000000 { - return xerrors.Errorf("Value in field \"triggerMetadata\" was too long") + // t.CreatedAt (string) (string) + if len("createdAt") > 1000000 { + return xerrors.Errorf("Value in field \"createdAt\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("triggerMetadata"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { return err } - if _, err := cw.WriteString(string("triggerMetadata")); err != nil { + if _, err := cw.WriteString(string("createdAt")); err != nil { return err } - if err := t.TriggerMetadata.MarshalCBOR(cw); err != nil { + if len(t.CreatedAt) > 1000000 { + return xerrors.Errorf("Value in field t.CreatedAt was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { return err } return nil } -func (t *Pipeline) UnmarshalCBOR(r io.Reader) (err error) { - *t = Pipeline{} +func (t *GraphFollow) UnmarshalCBOR(r io.Reader) (err error) { + *t = GraphFollow{} cr := cbg.NewCborReader(r) @@ -1894,12 +1536,12 @@ func (t *Pipeline) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("Pipeline: map struct too large (%d)", extra) + return fmt.Errorf("GraphFollow: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 15) + nameBuf := make([]byte, 9) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -1926,74 +1568,27 @@ func (t *Pipeline) UnmarshalCBOR(r io.Reader) (err error) { t.LexiconTypeID = string(sval) } - // t.Workflows ([]*tangled.Pipeline_Workflow) (slice) - case "workflows": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > 8192 { - return fmt.Errorf("t.Workflows: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Workflows = make([]*Pipeline_Workflow, extra) - } - - for i := 0; i < int(extra); i++ { - { - var maj byte - var extra uint64 - var err error - _ = maj - _ = extra - _ = err - - { - - b, err := cr.ReadByte() - if err != nil { - return err - } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - t.Workflows[i] = new(Pipeline_Workflow) - if err := t.Workflows[i].UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Workflows[i] pointer: %w", err) - } - } - - } + // t.Subject (string) (string) + case "subject": + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err } + + t.Subject = string(sval) } - // t.TriggerMetadata (tangled.Pipeline_TriggerMetadata) (struct) - case "triggerMetadata": + // t.CreatedAt (string) (string) + case "createdAt": { - - b, err := cr.ReadByte() + sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - t.TriggerMetadata = new(Pipeline_TriggerMetadata) - if err := t.TriggerMetadata.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.TriggerMetadata pointer: %w", err) - } - } + t.CreatedAt = string(sval) } default: @@ -2006,7 +1601,7 @@ func (t *Pipeline) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *Pipeline_CloneOpts) MarshalCBOR(w io.Writer) error { +func (t *KnotMember) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -2014,62 +1609,260 @@ func (t *Pipeline_CloneOpts) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) - if _, err := cw.Write([]byte{163}); err != nil { + if _, err := cw.Write([]byte{164}); err != nil { return err } - // t.Skip (bool) (bool) - if len("skip") > 1000000 { - return xerrors.Errorf("Value in field \"skip\" was too long") + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("skip"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } - if _, err := cw.WriteString(string("skip")); err != nil { + if _, err := cw.WriteString(string("$type")); err != nil { return err } - if err := cbg.WriteBool(w, t.Skip); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.knot.member"))); err != nil { + return err + } + if _, err := cw.WriteString(string("sh.tangled.knot.member")); err != nil { return err } - // t.Depth (int64) (int64) - if len("depth") > 1000000 { - return xerrors.Errorf("Value in field \"depth\" was too long") + // t.Domain (string) (string) + if len("domain") > 1000000 { + return xerrors.Errorf("Value in field \"domain\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("depth"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("domain"))); err != nil { return err } - if _, err := cw.WriteString(string("depth")); err != nil { + if _, err := cw.WriteString(string("domain")); err != nil { return err } - if t.Depth >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Depth)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Depth-1)); err != nil { - return err - } - } - - // t.Submodules (bool) (bool) - if len("submodules") > 1000000 { - return xerrors.Errorf("Value in field \"submodules\" was too long") + if len(t.Domain) > 1000000 { + return xerrors.Errorf("Value in field t.Domain was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("submodules"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Domain))); err != nil { return err } - if _, err := cw.WriteString(string("submodules")); err != nil { + if _, err := cw.WriteString(string(t.Domain)); err != nil { return err } - if err := cbg.WriteBool(w, t.Submodules); err != nil { - return err + // t.Subject (string) (string) + if len("subject") > 1000000 { + return xerrors.Errorf("Value in field \"subject\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { + return err + } + if _, err := cw.WriteString(string("subject")); err != nil { + return err + } + + if len(t.Subject) > 1000000 { + return xerrors.Errorf("Value in field t.Subject was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Subject)); err != nil { + return err + } + + // t.CreatedAt (string) (string) + if len("createdAt") > 1000000 { + return xerrors.Errorf("Value in field \"createdAt\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { + return err + } + if _, err := cw.WriteString(string("createdAt")); err != nil { + return err + } + + if len(t.CreatedAt) > 1000000 { + return xerrors.Errorf("Value in field t.CreatedAt was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { + return err + } + return nil +} + +func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) { + *t = KnotMember{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") + } + + if extra > cbg.MaxLength { + return fmt.Errorf("KnotMember: map struct too large (%d)", extra) + } + + n := extra + + nameBuf := make([]byte, 9) + for i := uint64(0); i < n; i++ { + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) + if err != nil { + return err + } + + if !ok { + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { + return err + } + continue + } + + switch string(nameBuf[:nameLen]) { + // t.LexiconTypeID (string) (string) + case "$type": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.LexiconTypeID = string(sval) + } + // t.Domain (string) (string) + case "domain": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Domain = string(sval) + } + // t.Subject (string) (string) + case "subject": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Subject = string(sval) + } + // t.CreatedAt (string) (string) + case "createdAt": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.CreatedAt = string(sval) + } + + default: + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { + return err + } + } + } + + return nil +} +func (t *Pipeline_CloneOpts) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write([]byte{163}); err != nil { + return err + } + + // t.Skip (bool) (bool) + if len("skip") > 1000000 { + return xerrors.Errorf("Value in field \"skip\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("skip"))); err != nil { + return err + } + if _, err := cw.WriteString(string("skip")); err != nil { + return err + } + + if err := cbg.WriteBool(w, t.Skip); err != nil { + return err + } + + // t.Depth (int64) (int64) + if len("depth") > 1000000 { + return xerrors.Errorf("Value in field \"depth\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("depth"))); err != nil { + return err + } + if _, err := cw.WriteString(string("depth")); err != nil { + return err + } + + if t.Depth >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Depth)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Depth-1)); err != nil { + return err + } + } + + // t.Submodules (bool) (bool) + if len("submodules") > 1000000 { + return xerrors.Errorf("Value in field \"submodules\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("submodules"))); err != nil { + return err + } + if _, err := cw.WriteString(string("submodules")); err != nil { + return err + } + + if err := cbg.WriteBool(w, t.Submodules); err != nil { + return err } return nil } @@ -2361,56 +2154,68 @@ func (t *Pipeline_Dependencies_Elem) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *Pipeline_ManualTriggerData) MarshalCBOR(w io.Writer) error { +func (t *Pipeline_ManualTriggerData_Inputs_Elem) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) - fieldCount := 1 - if t.Inputs == nil { - fieldCount-- + if _, err := cw.Write([]byte{162}); err != nil { + return err } - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { + // t.Key (string) (string) + if len("key") > 1000000 { + return xerrors.Errorf("Value in field \"key\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil { + return err + } + if _, err := cw.WriteString(string("key")); err != nil { return err } - // t.Inputs ([]*tangled.Pipeline_ManualTriggerData_Inputs_Elem) (slice) - if t.Inputs != nil { + if len(t.Key) > 1000000 { + return xerrors.Errorf("Value in field t.Key was too long") + } - if len("inputs") > 1000000 { - return xerrors.Errorf("Value in field \"inputs\" was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Key)); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("inputs"))); err != nil { - return err - } - if _, err := cw.WriteString(string("inputs")); err != nil { - return err - } + // t.Value (string) (string) + if len("value") > 1000000 { + return xerrors.Errorf("Value in field \"value\" was too long") + } - if len(t.Inputs) > 8192 { - return xerrors.Errorf("Slice value in field t.Inputs was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("value"))); err != nil { + return err + } + if _, err := cw.WriteString(string("value")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Inputs))); err != nil { - return err - } - for _, v := range t.Inputs { - if err := v.MarshalCBOR(cw); err != nil { - return err - } + if len(t.Value) > 1000000 { + return xerrors.Errorf("Value in field t.Value was too long") + } - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Value))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Value)); err != nil { + return err } return nil } -func (t *Pipeline_ManualTriggerData) UnmarshalCBOR(r io.Reader) (err error) { - *t = Pipeline_ManualTriggerData{} +func (t *Pipeline_ManualTriggerData_Inputs_Elem) UnmarshalCBOR(r io.Reader) (err error) { + *t = Pipeline_ManualTriggerData_Inputs_Elem{} cr := cbg.NewCborReader(r) @@ -2429,12 +2234,12 @@ func (t *Pipeline_ManualTriggerData) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("Pipeline_ManualTriggerData: map struct too large (%d)", extra) + return fmt.Errorf("Pipeline_ManualTriggerData_Inputs_Elem: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 6) + nameBuf := make([]byte, 5) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -2450,54 +2255,27 @@ func (t *Pipeline_ManualTriggerData) UnmarshalCBOR(r io.Reader) (err error) { } switch string(nameBuf[:nameLen]) { - // t.Inputs ([]*tangled.Pipeline_ManualTriggerData_Inputs_Elem) (slice) - case "inputs": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > 8192 { - return fmt.Errorf("t.Inputs: array too large (%d)", extra) - } + // t.Key (string) (string) + case "key": - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } - if extra > 0 { - t.Inputs = make([]*Pipeline_ManualTriggerData_Inputs_Elem, extra) + t.Key = string(sval) } + // t.Value (string) (string) + case "value": - for i := 0; i < int(extra); i++ { - { - var maj byte - var extra uint64 - var err error - _ = maj - _ = extra - _ = err - - { - - b, err := cr.ReadByte() - if err != nil { - return err - } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - t.Inputs[i] = new(Pipeline_ManualTriggerData_Inputs_Elem) - if err := t.Inputs[i].UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Inputs[i] pointer: %w", err) - } - } - - } - + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err } + + t.Value = string(sval) } default: @@ -2510,68 +2288,56 @@ func (t *Pipeline_ManualTriggerData) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *Pipeline_ManualTriggerData_Inputs_Elem) MarshalCBOR(w io.Writer) error { +func (t *Pipeline_ManualTriggerData) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) + fieldCount := 1 - if _, err := cw.Write([]byte{162}); err != nil { - return err - } - - // t.Key (string) (string) - if len("key") > 1000000 { - return xerrors.Errorf("Value in field \"key\" was too long") + if t.Inputs == nil { + fieldCount-- } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil { - return err - } - if _, err := cw.WriteString(string("key")); err != nil { + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } - if len(t.Key) > 1000000 { - return xerrors.Errorf("Value in field t.Key was too long") - } + // t.Inputs ([]*tangled.Pipeline_ManualTriggerData_Inputs_Elem) (slice) + if t.Inputs != nil { - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Key)); err != nil { - return err - } + if len("inputs") > 1000000 { + return xerrors.Errorf("Value in field \"inputs\" was too long") + } - // t.Value (string) (string) - if len("value") > 1000000 { - return xerrors.Errorf("Value in field \"value\" was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("inputs"))); err != nil { + return err + } + if _, err := cw.WriteString(string("inputs")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("value"))); err != nil { - return err - } - if _, err := cw.WriteString(string("value")); err != nil { - return err - } + if len(t.Inputs) > 8192 { + return xerrors.Errorf("Slice value in field t.Inputs was too long") + } - if len(t.Value) > 1000000 { - return xerrors.Errorf("Value in field t.Value was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Inputs))); err != nil { + return err + } + for _, v := range t.Inputs { + if err := v.MarshalCBOR(cw); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Value))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Value)); err != nil { - return err + } } return nil } -func (t *Pipeline_ManualTriggerData_Inputs_Elem) UnmarshalCBOR(r io.Reader) (err error) { - *t = Pipeline_ManualTriggerData_Inputs_Elem{} +func (t *Pipeline_ManualTriggerData) UnmarshalCBOR(r io.Reader) (err error) { + *t = Pipeline_ManualTriggerData{} cr := cbg.NewCborReader(r) @@ -2590,12 +2356,12 @@ func (t *Pipeline_ManualTriggerData_Inputs_Elem) UnmarshalCBOR(r io.Reader) (err } if extra > cbg.MaxLength { - return fmt.Errorf("Pipeline_ManualTriggerData_Inputs_Elem: map struct too large (%d)", extra) + return fmt.Errorf("Pipeline_ManualTriggerData: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 5) + nameBuf := make([]byte, 6) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -2611,27 +2377,54 @@ func (t *Pipeline_ManualTriggerData_Inputs_Elem) UnmarshalCBOR(r io.Reader) (err } switch string(nameBuf[:nameLen]) { - // t.Key (string) (string) - case "key": + // t.Inputs ([]*tangled.Pipeline_ManualTriggerData_Inputs_Elem) (slice) + case "inputs": - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } - t.Key = string(sval) + if extra > 8192 { + return fmt.Errorf("t.Inputs: array too large (%d)", extra) } - // t.Value (string) (string) - case "value": - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } - t.Value = string(sval) + if extra > 0 { + t.Inputs = make([]*Pipeline_ManualTriggerData_Inputs_Elem, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + t.Inputs[i] = new(Pipeline_ManualTriggerData_Inputs_Elem) + if err := t.Inputs[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Inputs[i] pointer: %w", err) + } + } + + } + + } } default: @@ -3616,7 +3409,7 @@ func (t *Pipeline_TriggerRepo) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *Pipeline_Workflow) MarshalCBOR(w io.Writer) error { +func (t *Pipeline_Workflow_Environment_Elem) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -3624,52 +3417,186 @@ func (t *Pipeline_Workflow) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) - if _, err := cw.Write([]byte{165}); err != nil { + if _, err := cw.Write([]byte{162}); err != nil { return err } - // t.Name (string) (string) - if len("name") > 1000000 { - return xerrors.Errorf("Value in field \"name\" was too long") + // t.Key (string) (string) + if len("key") > 1000000 { + return xerrors.Errorf("Value in field \"key\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil { return err } - if _, err := cw.WriteString(string("name")); err != nil { + if _, err := cw.WriteString(string("key")); err != nil { return err } - if len(t.Name) > 1000000 { - return xerrors.Errorf("Value in field t.Name was too long") + if len(t.Key) > 1000000 { + return xerrors.Errorf("Value in field t.Key was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil { return err } - if _, err := cw.WriteString(string(t.Name)); err != nil { + if _, err := cw.WriteString(string(t.Key)); err != nil { return err } - // t.Clone (tangled.Pipeline_CloneOpts) (struct) - if len("clone") > 1000000 { - return xerrors.Errorf("Value in field \"clone\" was too long") + // t.Value (string) (string) + if len("value") > 1000000 { + return xerrors.Errorf("Value in field \"value\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("clone"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("value"))); err != nil { return err } - if _, err := cw.WriteString(string("clone")); err != nil { + if _, err := cw.WriteString(string("value")); err != nil { return err } - if err := t.Clone.MarshalCBOR(cw); err != nil { - return err + if len(t.Value) > 1000000 { + return xerrors.Errorf("Value in field t.Value was too long") } - // t.Steps ([]*tangled.Pipeline_Step) (slice) - if len("steps") > 1000000 { - return xerrors.Errorf("Value in field \"steps\" was too long") + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Value))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Value)); err != nil { + return err + } + return nil +} + +func (t *Pipeline_Workflow_Environment_Elem) UnmarshalCBOR(r io.Reader) (err error) { + *t = Pipeline_Workflow_Environment_Elem{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") + } + + if extra > cbg.MaxLength { + return fmt.Errorf("Pipeline_Workflow_Environment_Elem: map struct too large (%d)", extra) + } + + n := extra + + nameBuf := make([]byte, 5) + for i := uint64(0); i < n; i++ { + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) + if err != nil { + return err + } + + if !ok { + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { + return err + } + continue + } + + switch string(nameBuf[:nameLen]) { + // t.Key (string) (string) + case "key": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Key = string(sval) + } + // t.Value (string) (string) + case "value": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Value = string(sval) + } + + default: + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { + return err + } + } + } + + return nil +} +func (t *Pipeline_Workflow) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write([]byte{165}); err != nil { + return err + } + + // t.Name (string) (string) + if len("name") > 1000000 { + return xerrors.Errorf("Value in field \"name\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil { + return err + } + if _, err := cw.WriteString(string("name")); err != nil { + return err + } + + if len(t.Name) > 1000000 { + return xerrors.Errorf("Value in field t.Name was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Name)); err != nil { + return err + } + + // t.Clone (tangled.Pipeline_CloneOpts) (struct) + if len("clone") > 1000000 { + return xerrors.Errorf("Value in field \"clone\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("clone"))); err != nil { + return err + } + if _, err := cw.WriteString(string("clone")); err != nil { + return err + } + + if err := t.Clone.MarshalCBOR(cw); err != nil { + return err + } + + // t.Steps ([]*tangled.Pipeline_Step) (slice) + if len("steps") > 1000000 { + return xerrors.Errorf("Value in field \"steps\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("steps"))); err != nil { @@ -3967,7 +3894,7 @@ func (t *Pipeline_Workflow) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *Pipeline_Workflow_Environment_Elem) MarshalCBOR(w io.Writer) error { +func (t *Pipeline) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -3975,60 +3902,75 @@ func (t *Pipeline_Workflow_Environment_Elem) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) - if _, err := cw.Write([]byte{162}); err != nil { + if _, err := cw.Write([]byte{163}); err != nil { return err } - // t.Key (string) (string) - if len("key") > 1000000 { - return xerrors.Errorf("Value in field \"key\" was too long") + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } - if _, err := cw.WriteString(string("key")); err != nil { + if _, err := cw.WriteString(string("$type")); err != nil { return err } - if len(t.Key) > 1000000 { - return xerrors.Errorf("Value in field t.Key was too long") + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.pipeline"))); err != nil { + return err + } + if _, err := cw.WriteString(string("sh.tangled.pipeline")); err != nil { + return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil { + // t.Workflows ([]*tangled.Pipeline_Workflow) (slice) + if len("workflows") > 1000000 { + return xerrors.Errorf("Value in field \"workflows\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflows"))); err != nil { return err } - if _, err := cw.WriteString(string(t.Key)); err != nil { + if _, err := cw.WriteString(string("workflows")); err != nil { return err } - // t.Value (string) (string) - if len("value") > 1000000 { - return xerrors.Errorf("Value in field \"value\" was too long") + if len(t.Workflows) > 8192 { + return xerrors.Errorf("Slice value in field t.Workflows was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("value"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Workflows))); err != nil { return err } - if _, err := cw.WriteString(string("value")); err != nil { - return err + for _, v := range t.Workflows { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } - if len(t.Value) > 1000000 { - return xerrors.Errorf("Value in field t.Value was too long") + // t.TriggerMetadata (tangled.Pipeline_TriggerMetadata) (struct) + if len("triggerMetadata") > 1000000 { + return xerrors.Errorf("Value in field \"triggerMetadata\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Value))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("triggerMetadata"))); err != nil { return err } - if _, err := cw.WriteString(string(t.Value)); err != nil { + if _, err := cw.WriteString(string("triggerMetadata")); err != nil { + return err + } + + if err := t.TriggerMetadata.MarshalCBOR(cw); err != nil { return err } return nil } -func (t *Pipeline_Workflow_Environment_Elem) UnmarshalCBOR(r io.Reader) (err error) { - *t = Pipeline_Workflow_Environment_Elem{} +func (t *Pipeline) UnmarshalCBOR(r io.Reader) (err error) { + *t = Pipeline{} cr := cbg.NewCborReader(r) @@ -4047,12 +3989,12 @@ func (t *Pipeline_Workflow_Environment_Elem) UnmarshalCBOR(r io.Reader) (err err } if extra > cbg.MaxLength { - return fmt.Errorf("Pipeline_Workflow_Environment_Elem: map struct too large (%d)", extra) + return fmt.Errorf("Pipeline: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 5) + nameBuf := make([]byte, 15) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -4068,8 +4010,8 @@ func (t *Pipeline_Workflow_Environment_Elem) UnmarshalCBOR(r io.Reader) (err err } switch string(nameBuf[:nameLen]) { - // t.Key (string) (string) - case "key": + // t.LexiconTypeID (string) (string) + case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -4077,45 +4019,103 @@ func (t *Pipeline_Workflow_Environment_Elem) UnmarshalCBOR(r io.Reader) (err err return err } - t.Key = string(sval) + t.LexiconTypeID = string(sval) } - // t.Value (string) (string) - case "value": + // t.Workflows ([]*tangled.Pipeline_Workflow) (slice) + case "workflows": - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } - t.Value = string(sval) + if extra > 8192 { + return fmt.Errorf("t.Workflows: array too large (%d)", extra) } - default: - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { - return err + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") } - } - } - return nil -} -func (t *PublicKey) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } + if extra > 0 { + t.Workflows = make([]*Pipeline_Workflow, extra) + } - cw := cbg.NewCborWriter(w) + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err - if _, err := cw.Write([]byte{164}); err != nil { - return err - } + { - // t.Key (string) (string) - if len("key") > 1000000 { - return xerrors.Errorf("Value in field \"key\" was too long") + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + t.Workflows[i] = new(Pipeline_Workflow) + if err := t.Workflows[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Workflows[i] pointer: %w", err) + } + } + + } + + } + } + // t.TriggerMetadata (tangled.Pipeline_TriggerMetadata) (struct) + case "triggerMetadata": + + { + + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + t.TriggerMetadata = new(Pipeline_TriggerMetadata) + if err := t.TriggerMetadata.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.TriggerMetadata pointer: %w", err) + } + } + + } + + default: + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { + return err + } + } + } + + return nil +} +func (t *PublicKey) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write([]byte{164}); err != nil { + return err + } + + // t.Key (string) (string) + if len("key") > 1000000 { + return xerrors.Errorf("Value in field \"key\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil { @@ -4299,20 +4299,16 @@ func (t *PublicKey) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *Repo) MarshalCBOR(w io.Writer) error { +func (t *RepoArtifact) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) - fieldCount := 7 - - if t.Description == nil { - fieldCount-- - } + fieldCount := 6 - if t.Source == nil { + if t.Tag == nil { fieldCount-- } @@ -4320,27 +4316,32 @@ func (t *Repo) MarshalCBOR(w io.Writer) error { return err } - // t.Knot (string) (string) - if len("knot") > 1000000 { - return xerrors.Errorf("Value in field \"knot\" was too long") - } + // t.Tag (util.LexBytes) (slice) + if t.Tag != nil { - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("knot"))); err != nil { - return err - } - if _, err := cw.WriteString(string("knot")); err != nil { - return err - } + if len("tag") > 1000000 { + return xerrors.Errorf("Value in field \"tag\" was too long") + } - if len(t.Knot) > 1000000 { - return xerrors.Errorf("Value in field t.Knot was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("tag"))); err != nil { + return err + } + if _, err := cw.WriteString(string("tag")); err != nil { + return err + } + + if len(t.Tag) > 2097152 { + return xerrors.Errorf("Byte array in field t.Tag was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Tag))); err != nil { + return err + } + + if _, err := cw.Write(t.Tag); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Knot))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Knot)); err != nil { - return err } // t.Name (string) (string) @@ -4366,78 +4367,62 @@ func (t *Repo) MarshalCBOR(w io.Writer) error { return err } - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") + // t.Repo (string) (string) + if len("repo") > 1000000 { + return xerrors.Errorf("Value in field \"repo\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { return err } - if _, err := cw.WriteString(string("$type")); err != nil { + if _, err := cw.WriteString(string("repo")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo"))); err != nil { + if len(t.Repo) > 1000000 { + return xerrors.Errorf("Value in field t.Repo was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { return err } - if _, err := cw.WriteString(string("sh.tangled.repo")); err != nil { + if _, err := cw.WriteString(string(t.Repo)); err != nil { return err } - // t.Owner (string) (string) - if len("owner") > 1000000 { - return xerrors.Errorf("Value in field \"owner\" was too long") + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } - if _, err := cw.WriteString(string("owner")); err != nil { + if _, err := cw.WriteString(string("$type")); err != nil { return err } - if len(t.Owner) > 1000000 { - return xerrors.Errorf("Value in field t.Owner was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Owner))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.artifact"))); err != nil { return err } - if _, err := cw.WriteString(string(t.Owner)); err != nil { + if _, err := cw.WriteString(string("sh.tangled.repo.artifact")); err != nil { return err } - // t.Source (string) (string) - if t.Source != nil { - - if len("source") > 1000000 { - return xerrors.Errorf("Value in field \"source\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil { - return err - } - if _, err := cw.WriteString(string("source")); err != nil { - return err - } + // t.Artifact (util.LexBlob) (struct) + if len("artifact") > 1000000 { + return xerrors.Errorf("Value in field \"artifact\" was too long") + } - if t.Source == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { - return err - } - } else { - if len(*t.Source) > 1000000 { - return xerrors.Errorf("Value in field t.Source was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("artifact"))); err != nil { + return err + } + if _, err := cw.WriteString(string("artifact")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Source))); err != nil { - return err - } - if _, err := cw.WriteString(string(*t.Source)); err != nil { - return err - } - } + if err := t.Artifact.MarshalCBOR(cw); err != nil { + return err } // t.CreatedAt (string) (string) @@ -4462,43 +4447,11 @@ func (t *Repo) MarshalCBOR(w io.Writer) error { if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { return err } - - // t.Description (string) (string) - if t.Description != nil { - - if len("description") > 1000000 { - return xerrors.Errorf("Value in field \"description\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("description"))); err != nil { - return err - } - if _, err := cw.WriteString(string("description")); err != nil { - return err - } - - if t.Description == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { - return err - } - } else { - if len(*t.Description) > 1000000 { - return xerrors.Errorf("Value in field t.Description was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Description))); err != nil { - return err - } - if _, err := cw.WriteString(string(*t.Description)); err != nil { - return err - } - } - } return nil } -func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) { - *t = Repo{} +func (t *RepoArtifact) UnmarshalCBOR(r io.Reader) (err error) { + *t = RepoArtifact{} cr := cbg.NewCborReader(r) @@ -4517,12 +4470,12 @@ func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("Repo: map struct too large (%d)", extra) + return fmt.Errorf("RepoArtifact: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 11) + nameBuf := make([]byte, 9) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -4538,41 +4491,31 @@ func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) { } switch string(nameBuf[:nameLen]) { - // t.Knot (string) (string) - case "knot": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } + // t.Tag (util.LexBytes) (slice) + case "tag": - t.Knot = string(sval) + maj, extra, err = cr.ReadHeader() + if err != nil { + return err } - // t.Name (string) (string) - case "name": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - t.Name = string(sval) + if extra > 2097152 { + return fmt.Errorf("t.Tag: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") } - // t.LexiconTypeID (string) (string) - case "$type": - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } + if extra > 0 { + t.Tag = make([]uint8, extra) + } - t.LexiconTypeID = string(sval) + if _, err := io.ReadFull(cr, t.Tag); err != nil { + return err } - // t.Owner (string) (string) - case "owner": + + // t.Name (string) (string) + case "name": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -4580,31 +4523,21 @@ func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Owner = string(sval) + t.Name = string(sval) } - // t.Source (string) (string) - case "source": + // t.Repo (string) (string) + case "repo": { - b, err := cr.ReadByte() + sval, err := cbg.ReadStringWithMax(cr, 1000000) if err != nil { return err } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - t.Source = (*string)(&sval) - } + t.Repo = string(sval) } - // t.CreatedAt (string) (string) - case "createdAt": + // t.LexiconTypeID (string) (string) + case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -4612,12 +4545,13 @@ func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.CreatedAt = string(sval) + t.LexiconTypeID = string(sval) } - // t.Description (string) (string) - case "description": + // t.Artifact (util.LexBlob) (struct) + case "artifact": { + b, err := cr.ReadByte() if err != nil { return err @@ -4626,14 +4560,23 @@ func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) { if err := cr.UnreadByte(); err != nil { return err } - - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err + t.Artifact = new(util.LexBlob) + if err := t.Artifact.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Artifact pointer: %w", err) } + } - t.Description = (*string)(&sval) + } + // t.CreatedAt (string) (string) + case "createdAt": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err } + + t.CreatedAt = string(sval) } default: @@ -4646,95 +4589,84 @@ func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *RepoArtifact) MarshalCBOR(w io.Writer) error { +func (t *RepoIssueComment) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) - fieldCount := 6 + fieldCount := 7 - if t.Tag == nil { + if t.CommentId == nil { fieldCount-- } - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { - return err + if t.Owner == nil { + fieldCount-- } - // t.Tag (util.LexBytes) (slice) - if t.Tag != nil { - - if len("tag") > 1000000 { - return xerrors.Errorf("Value in field \"tag\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("tag"))); err != nil { - return err - } - if _, err := cw.WriteString(string("tag")); err != nil { - return err - } - - if len(t.Tag) > 2097152 { - return xerrors.Errorf("Byte array in field t.Tag was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Tag))); err != nil { - return err - } - - if _, err := cw.Write(t.Tag); err != nil { - return err - } + if t.Repo == nil { + fieldCount-- + } + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { + return err } - // t.Name (string) (string) - if len("name") > 1000000 { - return xerrors.Errorf("Value in field \"name\" was too long") + // t.Body (string) (string) + if len("body") > 1000000 { + return xerrors.Errorf("Value in field \"body\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { return err } - if _, err := cw.WriteString(string("name")); err != nil { + if _, err := cw.WriteString(string("body")); err != nil { return err } - if len(t.Name) > 1000000 { - return xerrors.Errorf("Value in field t.Name was too long") + if len(t.Body) > 1000000 { + return xerrors.Errorf("Value in field t.Body was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Body))); err != nil { return err } - if _, err := cw.WriteString(string(t.Name)); err != nil { + if _, err := cw.WriteString(string(t.Body)); err != nil { return err } // t.Repo (string) (string) - if len("repo") > 1000000 { - return xerrors.Errorf("Value in field \"repo\" was too long") - } + if t.Repo != nil { - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { - return err - } - if _, err := cw.WriteString(string("repo")); err != nil { - return err - } + if len("repo") > 1000000 { + return xerrors.Errorf("Value in field \"repo\" was too long") + } - if len(t.Repo) > 1000000 { - return xerrors.Errorf("Value in field t.Repo was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repo")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Repo)); err != nil { - return err + if t.Repo == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Repo) > 1000000 { + return xerrors.Errorf("Value in field t.Repo was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Repo)); err != nil { + return err + } + } } // t.LexiconTypeID (string) (string) @@ -4749,120 +4681,168 @@ func (t *RepoArtifact) MarshalCBOR(w io.Writer) error { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.artifact"))); err != nil { - return err - } - if _, err := cw.WriteString(string("sh.tangled.repo.artifact")); err != nil { - return err - } - - // t.Artifact (util.LexBlob) (struct) - if len("artifact") > 1000000 { - return xerrors.Errorf("Value in field \"artifact\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("artifact"))); err != nil { - return err - } - if _, err := cw.WriteString(string("artifact")); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue.comment"))); err != nil { return err } - - if err := t.Artifact.MarshalCBOR(cw); err != nil { + if _, err := cw.WriteString(string("sh.tangled.repo.issue.comment")); err != nil { return err } - // t.CreatedAt (string) (string) - if len("createdAt") > 1000000 { - return xerrors.Errorf("Value in field \"createdAt\" was too long") + // t.Issue (string) (string) + if len("issue") > 1000000 { + return xerrors.Errorf("Value in field \"issue\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issue"))); err != nil { return err } - if _, err := cw.WriteString(string("createdAt")); err != nil { + if _, err := cw.WriteString(string("issue")); err != nil { return err } - if len(t.CreatedAt) > 1000000 { - return xerrors.Errorf("Value in field t.CreatedAt was too long") + if len(t.Issue) > 1000000 { + return xerrors.Errorf("Value in field t.Issue was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Issue))); err != nil { return err } - if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { + if _, err := cw.WriteString(string(t.Issue)); err != nil { return err } - return nil -} -func (t *RepoArtifact) UnmarshalCBOR(r io.Reader) (err error) { - *t = RepoArtifact{} - - cr := cbg.NewCborReader(r) + // t.Owner (string) (string) + if t.Owner != nil { - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF + if len("owner") > 1000000 { + return xerrors.Errorf("Value in field \"owner\" was too long") } - }() - - if maj != cbg.MajMap { - return fmt.Errorf("cbor input should be of type map") - } - if extra > cbg.MaxLength { - return fmt.Errorf("RepoArtifact: map struct too large (%d)", extra) - } - - n := extra - - nameBuf := make([]byte, 9) - for i := uint64(0); i < n; i++ { - nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) - if err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil { + return err + } + if _, err := cw.WriteString(string("owner")); err != nil { return err } - if !ok { - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { + if t.Owner == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { return err } - continue - } - - switch string(nameBuf[:nameLen]) { - // t.Tag (util.LexBytes) (slice) - case "tag": + } else { + if len(*t.Owner) > 1000000 { + return xerrors.Errorf("Value in field t.Owner was too long") + } - maj, extra, err = cr.ReadHeader() - if err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil { return err } + if _, err := cw.WriteString(string(*t.Owner)); err != nil { + return err + } + } + } - if extra > 2097152 { - return fmt.Errorf("t.Tag: byte array too large (%d)", extra) + // t.CommentId (int64) (int64) + if t.CommentId != nil { + + if len("commentId") > 1000000 { + return xerrors.Errorf("Value in field \"commentId\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commentId"))); err != nil { + return err + } + if _, err := cw.WriteString(string("commentId")); err != nil { + return err + } + + if t.CommentId == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") + } else { + if *t.CommentId >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.CommentId)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.CommentId-1)); err != nil { + return err + } } + } - if extra > 0 { - t.Tag = make([]uint8, extra) - } + } - if _, err := io.ReadFull(cr, t.Tag); err != nil { + // t.CreatedAt (string) (string) + if len("createdAt") > 1000000 { + return xerrors.Errorf("Value in field \"createdAt\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { + return err + } + if _, err := cw.WriteString(string("createdAt")); err != nil { + return err + } + + if len(t.CreatedAt) > 1000000 { + return xerrors.Errorf("Value in field t.CreatedAt was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { + return err + } + return nil +} + +func (t *RepoIssueComment) UnmarshalCBOR(r io.Reader) (err error) { + *t = RepoIssueComment{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") + } + + if extra > cbg.MaxLength { + return fmt.Errorf("RepoIssueComment: map struct too large (%d)", extra) + } + + n := extra + + nameBuf := make([]byte, 9) + for i := uint64(0); i < n; i++ { + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) + if err != nil { + return err + } + + if !ok { + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { return err } + continue + } - // t.Name (string) (string) - case "name": + switch string(nameBuf[:nameLen]) { + // t.Body (string) (string) + case "body": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -4870,18 +4850,28 @@ func (t *RepoArtifact) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Name = string(sval) + t.Body = string(sval) } // t.Repo (string) (string) case "repo": { - sval, err := cbg.ReadStringWithMax(cr, 1000000) + b, err := cr.ReadByte() if err != nil { return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } - t.Repo = string(sval) + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Repo = (*string)(&sval) + } } // t.LexiconTypeID (string) (string) case "$type": @@ -4894,11 +4884,21 @@ func (t *RepoArtifact) UnmarshalCBOR(r io.Reader) (err error) { t.LexiconTypeID = string(sval) } - // t.Artifact (util.LexBlob) (struct) - case "artifact": + // t.Issue (string) (string) + case "issue": { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Issue = string(sval) + } + // t.Owner (string) (string) + case "owner": + { b, err := cr.ReadByte() if err != nil { return err @@ -4907,12 +4907,50 @@ func (t *RepoArtifact) UnmarshalCBOR(r io.Reader) (err error) { if err := cr.UnreadByte(); err != nil { return err } - t.Artifact = new(util.LexBlob) - if err := t.Artifact.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Artifact pointer: %w", err) + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err } + + t.Owner = (*string)(&sval) + } + } + // t.CommentId (int64) (int64) + case "commentId": + { + + b, err := cr.ReadByte() + if err != nil { + return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + var extraI int64 + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + t.CommentId = (*int64)(&extraI) + } } // t.CreatedAt (string) (string) case "createdAt": @@ -4936,81 +4974,245 @@ func (t *RepoArtifact) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *RepoIssue) MarshalCBOR(w io.Writer) error { +func (t *RepoIssueState) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) - fieldCount := 7 - - if t.Body == nil { - fieldCount-- - } - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { + if _, err := cw.Write([]byte{163}); err != nil { return err } - // t.Body (string) (string) - if t.Body != nil { - - if len("body") > 1000000 { - return xerrors.Errorf("Value in field \"body\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { - return err - } - if _, err := cw.WriteString(string("body")); err != nil { - return err - } - - if t.Body == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { - return err - } - } else { - if len(*t.Body) > 1000000 { - return xerrors.Errorf("Value in field t.Body was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil { - return err - } - if _, err := cw.WriteString(string(*t.Body)); err != nil { - return err - } - } + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") } - // t.Repo (string) (string) - if len("repo") > 1000000 { - return xerrors.Errorf("Value in field \"repo\" was too long") + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + return err + } + if _, err := cw.WriteString(string("$type")); err != nil { + return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue.state"))); err != nil { return err } - if _, err := cw.WriteString(string("repo")); err != nil { + if _, err := cw.WriteString(string("sh.tangled.repo.issue.state")); err != nil { return err } - if len(t.Repo) > 1000000 { - return xerrors.Errorf("Value in field t.Repo was too long") + // t.Issue (string) (string) + if len("issue") > 1000000 { + return xerrors.Errorf("Value in field \"issue\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issue"))); err != nil { return err } - if _, err := cw.WriteString(string(t.Repo)); err != nil { + if _, err := cw.WriteString(string("issue")); err != nil { return err } - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") + if len(t.Issue) > 1000000 { + return xerrors.Errorf("Value in field t.Issue was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Issue))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Issue)); err != nil { + return err + } + + // t.State (string) (string) + if len("state") > 1000000 { + return xerrors.Errorf("Value in field \"state\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("state"))); err != nil { + return err + } + if _, err := cw.WriteString(string("state")); err != nil { + return err + } + + if len(t.State) > 1000000 { + return xerrors.Errorf("Value in field t.State was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.State))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.State)); err != nil { + return err + } + return nil +} + +func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) { + *t = RepoIssueState{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") + } + + if extra > cbg.MaxLength { + return fmt.Errorf("RepoIssueState: map struct too large (%d)", extra) + } + + n := extra + + nameBuf := make([]byte, 5) + for i := uint64(0); i < n; i++ { + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) + if err != nil { + return err + } + + if !ok { + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { + return err + } + continue + } + + switch string(nameBuf[:nameLen]) { + // t.LexiconTypeID (string) (string) + case "$type": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.LexiconTypeID = string(sval) + } + // t.Issue (string) (string) + case "issue": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Issue = string(sval) + } + // t.State (string) (string) + case "state": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.State = string(sval) + } + + default: + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { + return err + } + } + } + + return nil +} +func (t *RepoIssue) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + fieldCount := 7 + + if t.Body == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { + return err + } + + // t.Body (string) (string) + if t.Body != nil { + + if len("body") > 1000000 { + return xerrors.Errorf("Value in field \"body\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { + return err + } + if _, err := cw.WriteString(string("body")); err != nil { + return err + } + + if t.Body == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Body) > 1000000 { + return xerrors.Errorf("Value in field t.Body was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Body)); err != nil { + return err + } + } + } + + // t.Repo (string) (string) + if len("repo") > 1000000 { + return xerrors.Errorf("Value in field \"repo\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repo")); err != nil { + return err + } + + if len(t.Repo) > 1000000 { + return xerrors.Errorf("Value in field t.Repo was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Repo)); err != nil { + return err + } + + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { @@ -5274,7 +5476,7 @@ func (t *RepoIssue) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *RepoIssueComment) MarshalCBOR(w io.Writer) error { +func (t *RepoPullComment) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -5322,6 +5524,29 @@ func (t *RepoIssueComment) MarshalCBOR(w io.Writer) error { return err } + // t.Pull (string) (string) + if len("pull") > 1000000 { + return xerrors.Errorf("Value in field \"pull\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil { + return err + } + if _, err := cw.WriteString(string("pull")); err != nil { + return err + } + + if len(t.Pull) > 1000000 { + return xerrors.Errorf("Value in field t.Pull was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Pull)); err != nil { + return err + } + // t.Repo (string) (string) if t.Repo != nil { @@ -5366,33 +5591,10 @@ func (t *RepoIssueComment) MarshalCBOR(w io.Writer) error { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue.comment"))); err != nil { - return err - } - if _, err := cw.WriteString(string("sh.tangled.repo.issue.comment")); err != nil { - return err - } - - // t.Issue (string) (string) - if len("issue") > 1000000 { - return xerrors.Errorf("Value in field \"issue\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issue"))); err != nil { - return err - } - if _, err := cw.WriteString(string("issue")); err != nil { - return err - } - - if len(t.Issue) > 1000000 { - return xerrors.Errorf("Value in field t.Issue was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Issue))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.comment"))); err != nil { return err } - if _, err := cw.WriteString(string(t.Issue)); err != nil { + if _, err := cw.WriteString(string("sh.tangled.repo.pull.comment")); err != nil { return err } @@ -5485,8 +5687,8 @@ func (t *RepoIssueComment) MarshalCBOR(w io.Writer) error { return nil } -func (t *RepoIssueComment) UnmarshalCBOR(r io.Reader) (err error) { - *t = RepoIssueComment{} +func (t *RepoPullComment) UnmarshalCBOR(r io.Reader) (err error) { + *t = RepoPullComment{} cr := cbg.NewCborReader(r) @@ -5505,7 +5707,7 @@ func (t *RepoIssueComment) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("RepoIssueComment: map struct too large (%d)", extra) + return fmt.Errorf("RepoPullComment: map struct too large (%d)", extra) } n := extra @@ -5537,8 +5739,19 @@ func (t *RepoIssueComment) UnmarshalCBOR(r io.Reader) (err error) { t.Body = string(sval) } - // t.Repo (string) (string) - case "repo": + // t.Pull (string) (string) + case "pull": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Pull = string(sval) + } + // t.Repo (string) (string) + case "repo": { b, err := cr.ReadByte() @@ -5569,17 +5782,6 @@ func (t *RepoIssueComment) UnmarshalCBOR(r io.Reader) (err error) { t.LexiconTypeID = string(sval) } - // t.Issue (string) (string) - case "issue": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Issue = string(sval) - } // t.Owner (string) (string) case "owner": @@ -5659,7 +5861,7 @@ func (t *RepoIssueComment) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *RepoIssueState) MarshalCBOR(w io.Writer) error { +func (t *RepoPullStatus) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -5671,75 +5873,75 @@ func (t *RepoIssueState) MarshalCBOR(w io.Writer) error { return err } - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") + // t.Pull (string) (string) + if len("pull") > 1000000 { + return xerrors.Errorf("Value in field \"pull\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil { return err } - if _, err := cw.WriteString(string("$type")); err != nil { + if _, err := cw.WriteString(string("pull")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue.state"))); err != nil { + if len(t.Pull) > 1000000 { + return xerrors.Errorf("Value in field t.Pull was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil { return err } - if _, err := cw.WriteString(string("sh.tangled.repo.issue.state")); err != nil { + if _, err := cw.WriteString(string(t.Pull)); err != nil { return err } - // t.Issue (string) (string) - if len("issue") > 1000000 { - return xerrors.Errorf("Value in field \"issue\" was too long") + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issue"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } - if _, err := cw.WriteString(string("issue")); err != nil { + if _, err := cw.WriteString(string("$type")); err != nil { return err } - if len(t.Issue) > 1000000 { - return xerrors.Errorf("Value in field t.Issue was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Issue))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.status"))); err != nil { return err } - if _, err := cw.WriteString(string(t.Issue)); err != nil { + if _, err := cw.WriteString(string("sh.tangled.repo.pull.status")); err != nil { return err } - // t.State (string) (string) - if len("state") > 1000000 { - return xerrors.Errorf("Value in field \"state\" was too long") + // t.Status (string) (string) + if len("status") > 1000000 { + return xerrors.Errorf("Value in field \"status\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("state"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { return err } - if _, err := cw.WriteString(string("state")); err != nil { + if _, err := cw.WriteString(string("status")); err != nil { return err } - if len(t.State) > 1000000 { - return xerrors.Errorf("Value in field t.State was too long") + if len(t.Status) > 1000000 { + return xerrors.Errorf("Value in field t.Status was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.State))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Status))); err != nil { return err } - if _, err := cw.WriteString(string(t.State)); err != nil { + if _, err := cw.WriteString(string(t.Status)); err != nil { return err } return nil } -func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) { - *t = RepoIssueState{} +func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) { + *t = RepoPullStatus{} cr := cbg.NewCborReader(r) @@ -5758,12 +5960,12 @@ func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("RepoIssueState: map struct too large (%d)", extra) + return fmt.Errorf("RepoPullStatus: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 5) + nameBuf := make([]byte, 6) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -5779,8 +5981,8 @@ func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) { } switch string(nameBuf[:nameLen]) { - // t.LexiconTypeID (string) (string) - case "$type": + // t.Pull (string) (string) + case "pull": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -5788,10 +5990,10 @@ func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.LexiconTypeID = string(sval) + t.Pull = string(sval) } - // t.Issue (string) (string) - case "issue": + // t.LexiconTypeID (string) (string) + case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -5799,10 +6001,10 @@ func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Issue = string(sval) + t.LexiconTypeID = string(sval) } - // t.State (string) (string) - case "state": + // t.Status (string) (string) + case "status": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -5810,7 +6012,7 @@ func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.State = string(sval) + t.Status = string(sval) } default: @@ -5823,20 +6025,16 @@ func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *RepoPull) MarshalCBOR(w io.Writer) error { +func (t *RepoPull_Source) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) - fieldCount := 9 - - if t.Body == nil { - fieldCount-- - } + fieldCount := 2 - if t.Source == nil { + if t.Repo == nil { fieldCount-- } @@ -5844,147 +6042,309 @@ func (t *RepoPull) MarshalCBOR(w io.Writer) error { return err } - // t.Body (string) (string) - if t.Body != nil { + // t.Repo (string) (string) + if t.Repo != nil { - if len("body") > 1000000 { - return xerrors.Errorf("Value in field \"body\" was too long") + if len("repo") > 1000000 { + return xerrors.Errorf("Value in field \"repo\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { return err } - if _, err := cw.WriteString(string("body")); err != nil { + if _, err := cw.WriteString(string("repo")); err != nil { return err } - if t.Body == nil { + if t.Repo == nil { if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { - if len(*t.Body) > 1000000 { - return xerrors.Errorf("Value in field t.Body was too long") + if len(*t.Repo) > 1000000 { + return xerrors.Errorf("Value in field t.Repo was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { return err } - if _, err := cw.WriteString(string(*t.Body)); err != nil { + if _, err := cw.WriteString(string(*t.Repo)); err != nil { return err } } } - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { - return err - } - if _, err := cw.WriteString(string("$type")); err != nil { - return err + // t.Branch (string) (string) + if len("branch") > 1000000 { + return xerrors.Errorf("Value in field \"branch\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("branch"))); err != nil { return err } - if _, err := cw.WriteString(string("sh.tangled.repo.pull")); err != nil { + if _, err := cw.WriteString(string("branch")); err != nil { return err } - // t.Patch (string) (string) - if len("patch") > 1000000 { - return xerrors.Errorf("Value in field \"patch\" was too long") + if len(t.Branch) > 1000000 { + return xerrors.Errorf("Value in field t.Branch was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("patch"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Branch))); err != nil { return err } - if _, err := cw.WriteString(string("patch")); err != nil { + if _, err := cw.WriteString(string(t.Branch)); err != nil { return err } + return nil +} - if len(t.Patch) > 1000000 { - return xerrors.Errorf("Value in field t.Patch was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Patch))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Patch)); err != nil { - return err - } +func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) { + *t = RepoPull_Source{} - // t.Title (string) (string) - if len("title") > 1000000 { - return xerrors.Errorf("Value in field \"title\" was too long") - } + cr := cbg.NewCborReader(r) - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("title"))); err != nil { - return err - } - if _, err := cw.WriteString(string("title")); err != nil { + maj, extra, err := cr.ReadHeader() + if err != nil { return err } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() - if len(t.Title) > 1000000 { - return xerrors.Errorf("Value in field t.Title was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Title))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Title)); err != nil { - return err + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") } - // t.PullId (int64) (int64) - if len("pullId") > 1000000 { - return xerrors.Errorf("Value in field \"pullId\" was too long") + if extra > cbg.MaxLength { + return fmt.Errorf("RepoPull_Source: map struct too large (%d)", extra) } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullId"))); err != nil { - return err - } - if _, err := cw.WriteString(string("pullId")); err != nil { - return err - } + n := extra - if t.PullId >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PullId)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.PullId-1)); err != nil { + nameBuf := make([]byte, 6) + for i := uint64(0); i < n; i++ { + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) + if err != nil { return err } - } - - // t.Source (tangled.RepoPull_Source) (struct) - if t.Source != nil { - - if len("source") > 1000000 { - return xerrors.Errorf("Value in field \"source\" was too long") - } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil { - return err - } - if _, err := cw.WriteString(string("source")); err != nil { - return err + if !ok { + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { + return err + } + continue } - if err := t.Source.MarshalCBOR(cw); err != nil { - return err - } - } + switch string(nameBuf[:nameLen]) { + // t.Repo (string) (string) + case "repo": - // t.CreatedAt (string) (string) - if len("createdAt") > 1000000 { - return xerrors.Errorf("Value in field \"createdAt\" was too long") + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Repo = (*string)(&sval) + } + } + // t.Branch (string) (string) + case "branch": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Branch = string(sval) + } + + default: + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { + return err + } + } + } + + return nil +} +func (t *RepoPull) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + fieldCount := 9 + + if t.Body == nil { + fieldCount-- + } + + if t.Source == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { + return err + } + + // t.Body (string) (string) + if t.Body != nil { + + if len("body") > 1000000 { + return xerrors.Errorf("Value in field \"body\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { + return err + } + if _, err := cw.WriteString(string("body")); err != nil { + return err + } + + if t.Body == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Body) > 1000000 { + return xerrors.Errorf("Value in field t.Body was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Body)); err != nil { + return err + } + } + } + + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + return err + } + if _, err := cw.WriteString(string("$type")); err != nil { + return err + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull"))); err != nil { + return err + } + if _, err := cw.WriteString(string("sh.tangled.repo.pull")); err != nil { + return err + } + + // t.Patch (string) (string) + if len("patch") > 1000000 { + return xerrors.Errorf("Value in field \"patch\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("patch"))); err != nil { + return err + } + if _, err := cw.WriteString(string("patch")); err != nil { + return err + } + + if len(t.Patch) > 1000000 { + return xerrors.Errorf("Value in field t.Patch was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Patch))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Patch)); err != nil { + return err + } + + // t.Title (string) (string) + if len("title") > 1000000 { + return xerrors.Errorf("Value in field \"title\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("title"))); err != nil { + return err + } + if _, err := cw.WriteString(string("title")); err != nil { + return err + } + + if len(t.Title) > 1000000 { + return xerrors.Errorf("Value in field t.Title was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Title))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Title)); err != nil { + return err + } + + // t.PullId (int64) (int64) + if len("pullId") > 1000000 { + return xerrors.Errorf("Value in field \"pullId\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullId"))); err != nil { + return err + } + if _, err := cw.WriteString(string("pullId")); err != nil { + return err + } + + if t.PullId >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PullId)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.PullId-1)); err != nil { + return err + } + } + + // t.Source (tangled.RepoPull_Source) (struct) + if t.Source != nil { + + if len("source") > 1000000 { + return xerrors.Errorf("Value in field \"source\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil { + return err + } + if _, err := cw.WriteString(string("source")); err != nil { + return err + } + + if err := t.Source.MarshalCBOR(cw); err != nil { + return err + } + } + + // t.CreatedAt (string) (string) + if len("createdAt") > 1000000 { + return xerrors.Errorf("Value in field \"createdAt\" was too long") } if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { @@ -6238,7 +6598,7 @@ func (t *RepoPull) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *RepoPullComment) MarshalCBOR(w io.Writer) error { +func (t *Repo) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -6247,15 +6607,11 @@ func (t *RepoPullComment) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) fieldCount := 7 - if t.CommentId == nil { - fieldCount-- - } - - if t.Owner == nil { + if t.Description == nil { fieldCount-- } - if t.Repo == nil { + if t.Source == nil { fieldCount-- } @@ -6263,165 +6619,124 @@ func (t *RepoPullComment) MarshalCBOR(w io.Writer) error { return err } - // t.Body (string) (string) - if len("body") > 1000000 { - return xerrors.Errorf("Value in field \"body\" was too long") + // t.Knot (string) (string) + if len("knot") > 1000000 { + return xerrors.Errorf("Value in field \"knot\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("knot"))); err != nil { return err } - if _, err := cw.WriteString(string("body")); err != nil { + if _, err := cw.WriteString(string("knot")); err != nil { return err } - if len(t.Body) > 1000000 { - return xerrors.Errorf("Value in field t.Body was too long") + if len(t.Knot) > 1000000 { + return xerrors.Errorf("Value in field t.Knot was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Body))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Knot))); err != nil { return err } - if _, err := cw.WriteString(string(t.Body)); err != nil { + if _, err := cw.WriteString(string(t.Knot)); err != nil { return err } - // t.Pull (string) (string) - if len("pull") > 1000000 { - return xerrors.Errorf("Value in field \"pull\" was too long") + // t.Name (string) (string) + if len("name") > 1000000 { + return xerrors.Errorf("Value in field \"name\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil { return err } - if _, err := cw.WriteString(string("pull")); err != nil { + if _, err := cw.WriteString(string("name")); err != nil { return err } - if len(t.Pull) > 1000000 { - return xerrors.Errorf("Value in field t.Pull was too long") + if len(t.Name) > 1000000 { + return xerrors.Errorf("Value in field t.Name was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil { return err } - if _, err := cw.WriteString(string(t.Pull)); err != nil { + if _, err := cw.WriteString(string(t.Name)); err != nil { return err } - // t.Repo (string) (string) - if t.Repo != nil { + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") + } - if len("repo") > 1000000 { - return xerrors.Errorf("Value in field \"repo\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { - return err - } - if _, err := cw.WriteString(string("repo")); err != nil { - return err - } - - if t.Repo == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { - return err - } - } else { - if len(*t.Repo) > 1000000 { - return xerrors.Errorf("Value in field t.Repo was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + return err + } + if _, err := cw.WriteString(string("$type")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { - return err - } - if _, err := cw.WriteString(string(*t.Repo)); err != nil { - return err - } - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo"))); err != nil { + return err + } + if _, err := cw.WriteString(string("sh.tangled.repo")); err != nil { + return err } - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") + // t.Owner (string) (string) + if len("owner") > 1000000 { + return xerrors.Errorf("Value in field \"owner\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil { return err } - if _, err := cw.WriteString(string("$type")); err != nil { + if _, err := cw.WriteString(string("owner")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.comment"))); err != nil { + if len(t.Owner) > 1000000 { + return xerrors.Errorf("Value in field t.Owner was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Owner))); err != nil { return err } - if _, err := cw.WriteString(string("sh.tangled.repo.pull.comment")); err != nil { + if _, err := cw.WriteString(string(t.Owner)); err != nil { return err } - // t.Owner (string) (string) - if t.Owner != nil { + // t.Source (string) (string) + if t.Source != nil { - if len("owner") > 1000000 { - return xerrors.Errorf("Value in field \"owner\" was too long") + if len("source") > 1000000 { + return xerrors.Errorf("Value in field \"source\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil { return err } - if _, err := cw.WriteString(string("owner")); err != nil { + if _, err := cw.WriteString(string("source")); err != nil { return err } - if t.Owner == nil { + if t.Source == nil { if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { - if len(*t.Owner) > 1000000 { - return xerrors.Errorf("Value in field t.Owner was too long") + if len(*t.Source) > 1000000 { + return xerrors.Errorf("Value in field t.Source was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil { - return err - } - if _, err := cw.WriteString(string(*t.Owner)); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Source))); err != nil { return err } - } - } - - // t.CommentId (int64) (int64) - if t.CommentId != nil { - - if len("commentId") > 1000000 { - return xerrors.Errorf("Value in field \"commentId\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commentId"))); err != nil { - return err - } - if _, err := cw.WriteString(string("commentId")); err != nil { - return err - } - - if t.CommentId == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { + if _, err := cw.WriteString(string(*t.Source)); err != nil { return err } - } else { - if *t.CommentId >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.CommentId)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.CommentId-1)); err != nil { - return err - } - } } - } // t.CreatedAt (string) (string) @@ -6437,268 +6752,52 @@ func (t *RepoPullComment) MarshalCBOR(w io.Writer) error { } if len(t.CreatedAt) > 1000000 { - return xerrors.Errorf("Value in field t.CreatedAt was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { - return err - } - return nil -} - -func (t *RepoPullComment) UnmarshalCBOR(r io.Reader) (err error) { - *t = RepoPullComment{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajMap { - return fmt.Errorf("cbor input should be of type map") - } - - if extra > cbg.MaxLength { - return fmt.Errorf("RepoPullComment: map struct too large (%d)", extra) - } - - n := extra - - nameBuf := make([]byte, 9) - for i := uint64(0); i < n; i++ { - nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) - if err != nil { - return err - } - - if !ok { - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { - return err - } - continue - } - - switch string(nameBuf[:nameLen]) { - // t.Body (string) (string) - case "body": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Body = string(sval) - } - // t.Pull (string) (string) - case "pull": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Pull = string(sval) - } - // t.Repo (string) (string) - case "repo": - - { - b, err := cr.ReadByte() - if err != nil { - return err - } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Repo = (*string)(&sval) - } - } - // t.LexiconTypeID (string) (string) - case "$type": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.LexiconTypeID = string(sval) - } - // t.Owner (string) (string) - case "owner": - - { - b, err := cr.ReadByte() - if err != nil { - return err - } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Owner = (*string)(&sval) - } - } - // t.CommentId (int64) (int64) - case "commentId": - { - - b, err := cr.ReadByte() - if err != nil { - return err - } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - var extraI int64 - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") - } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative overflow") - } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) - } - - t.CommentId = (*int64)(&extraI) - } - } - // t.CreatedAt (string) (string) - case "createdAt": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.CreatedAt = string(sval) - } - - default: - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { - return err - } - } - } - - return nil -} -func (t *RepoPull_Source) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - fieldCount := 2 - - if t.Repo == nil { - fieldCount-- + return xerrors.Errorf("Value in field t.CreatedAt was too long") } - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { return err } - // t.Repo (string) (string) - if t.Repo != nil { + // t.Description (string) (string) + if t.Description != nil { - if len("repo") > 1000000 { - return xerrors.Errorf("Value in field \"repo\" was too long") + if len("description") > 1000000 { + return xerrors.Errorf("Value in field \"description\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("description"))); err != nil { return err } - if _, err := cw.WriteString(string("repo")); err != nil { + if _, err := cw.WriteString(string("description")); err != nil { return err } - if t.Repo == nil { + if t.Description == nil { if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { - if len(*t.Repo) > 1000000 { - return xerrors.Errorf("Value in field t.Repo was too long") + if len(*t.Description) > 1000000 { + return xerrors.Errorf("Value in field t.Description was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Description))); err != nil { return err } - if _, err := cw.WriteString(string(*t.Repo)); err != nil { + if _, err := cw.WriteString(string(*t.Description)); err != nil { return err } } } - - // t.Branch (string) (string) - if len("branch") > 1000000 { - return xerrors.Errorf("Value in field \"branch\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("branch"))); err != nil { - return err - } - if _, err := cw.WriteString(string("branch")); err != nil { - return err - } - - if len(t.Branch) > 1000000 { - return xerrors.Errorf("Value in field t.Branch was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Branch))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Branch)); err != nil { - return err - } return nil } -func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) { - *t = RepoPull_Source{} +func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) { + *t = Repo{} cr := cbg.NewCborReader(r) @@ -6717,12 +6816,12 @@ func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("RepoPull_Source: map struct too large (%d)", extra) + return fmt.Errorf("Repo: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 6) + nameBuf := make([]byte, 11) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -6738,8 +6837,52 @@ func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) { } switch string(nameBuf[:nameLen]) { - // t.Repo (string) (string) - case "repo": + // t.Knot (string) (string) + case "knot": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Knot = string(sval) + } + // t.Name (string) (string) + case "name": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Name = string(sval) + } + // t.LexiconTypeID (string) (string) + case "$type": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.LexiconTypeID = string(sval) + } + // t.Owner (string) (string) + case "owner": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Owner = string(sval) + } + // t.Source (string) (string) + case "source": { b, err := cr.ReadByte() @@ -6756,11 +6899,11 @@ func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Repo = (*string)(&sval) + t.Source = (*string)(&sval) } } - // t.Branch (string) (string) - case "branch": + // t.CreatedAt (string) (string) + case "createdAt": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -6768,7 +6911,28 @@ func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Branch = string(sval) + t.CreatedAt = string(sval) + } + // t.Description (string) (string) + case "description": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Description = (*string)(&sval) + } } default: @@ -6781,87 +6945,124 @@ func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) { return nil } -func (t *RepoPullStatus) MarshalCBOR(w io.Writer) error { +func (t *SpindleMember) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } cw := cbg.NewCborWriter(w) + fieldCount := 4 - if _, err := cw.Write([]byte{163}); err != nil { + if t.Instance == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } - // t.Pull (string) (string) - if len("pull") > 1000000 { - return xerrors.Errorf("Value in field \"pull\" was too long") + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + return xerrors.Errorf("Value in field \"$type\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { return err } - if _, err := cw.WriteString(string("pull")); err != nil { + if _, err := cw.WriteString(string("$type")); err != nil { return err } - if len(t.Pull) > 1000000 { - return xerrors.Errorf("Value in field t.Pull was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.spindle.member"))); err != nil { return err } - if _, err := cw.WriteString(string(t.Pull)); err != nil { + if _, err := cw.WriteString(string("sh.tangled.spindle.member")); err != nil { return err } - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") + // t.Subject (string) (string) + if len("subject") > 1000000 { + return xerrors.Errorf("Value in field \"subject\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { return err } - if _, err := cw.WriteString(string("$type")); err != nil { + if _, err := cw.WriteString(string("subject")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.status"))); err != nil { + if len(t.Subject) > 1000000 { + return xerrors.Errorf("Value in field t.Subject was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil { return err } - if _, err := cw.WriteString(string("sh.tangled.repo.pull.status")); err != nil { + if _, err := cw.WriteString(string(t.Subject)); err != nil { return err } - // t.Status (string) (string) - if len("status") > 1000000 { - return xerrors.Errorf("Value in field \"status\" was too long") + // t.Instance (string) (string) + if t.Instance != nil { + + if len("instance") > 1000000 { + return xerrors.Errorf("Value in field \"instance\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("instance"))); err != nil { + return err + } + if _, err := cw.WriteString(string("instance")); err != nil { + return err + } + + if t.Instance == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Instance) > 1000000 { + return xerrors.Errorf("Value in field t.Instance was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Instance))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Instance)); err != nil { + return err + } + } } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { + // t.CreatedAt (string) (string) + if len("createdAt") > 1000000 { + return xerrors.Errorf("Value in field \"createdAt\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { return err } - if _, err := cw.WriteString(string("status")); err != nil { + if _, err := cw.WriteString(string("createdAt")); err != nil { return err } - if len(t.Status) > 1000000 { - return xerrors.Errorf("Value in field t.Status was too long") + if len(t.CreatedAt) > 1000000 { + return xerrors.Errorf("Value in field t.CreatedAt was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Status))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { return err } - if _, err := cw.WriteString(string(t.Status)); err != nil { + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { return err } return nil } -func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) { - *t = RepoPullStatus{} +func (t *SpindleMember) UnmarshalCBOR(r io.Reader) (err error) { + *t = SpindleMember{} cr := cbg.NewCborReader(r) @@ -6880,12 +7081,12 @@ func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("RepoPullStatus: map struct too large (%d)", extra) + return fmt.Errorf("SpindleMember: map struct too large (%d)", extra) } n := extra - nameBuf := make([]byte, 6) + nameBuf := make([]byte, 9) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -6901,8 +7102,8 @@ func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) { } switch string(nameBuf[:nameLen]) { - // t.Pull (string) (string) - case "pull": + // t.LexiconTypeID (string) (string) + case "$type": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -6910,10 +7111,10 @@ func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Pull = string(sval) + t.LexiconTypeID = string(sval) } - // t.LexiconTypeID (string) (string) - case "$type": + // t.Subject (string) (string) + case "subject": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -6921,10 +7122,31 @@ func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.LexiconTypeID = string(sval) + t.Subject = string(sval) } - // t.Status (string) (string) - case "status": + // t.Instance (string) (string) + case "instance": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Instance = (*string)(&sval) + } + } + // t.CreatedAt (string) (string) + case "createdAt": { sval, err := cbg.ReadStringWithMax(cr, 1000000) @@ -6932,7 +7154,7 @@ func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Status = string(sval) + t.CreatedAt = string(sval) } default: diff --git a/api/tangled/spindlemember.go b/api/tangled/spindlemember.go new file mode 100644 index 0000000..27dadc2 --- /dev/null +++ b/api/tangled/spindlemember.go @@ -0,0 +1,25 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.spindle.member + +import ( + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + SpindleMemberNSID = "sh.tangled.spindle.member" +) + +func init() { + util.RegisterType("sh.tangled.spindle.member", &SpindleMember{}) +} // +// RECORDTYPE: SpindleMember +type SpindleMember struct { + LexiconTypeID string `json:"$type,const=sh.tangled.spindle.member" cborgen:"$type,const=sh.tangled.spindle.member"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // instance: spindle instance that the subject is now a member of + Instance *string `json:"instance,omitempty" cborgen:"instance,omitempty"` + Subject string `json:"subject" cborgen:"subject"` +} diff --git a/cmd/gen.go b/cmd/gen.go index 2532bd1..3069f8b 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -16,34 +16,35 @@ func main() { "tangled", tangled.ActorProfile{}, tangled.FeedStar{}, - tangled.GitRefUpdate{}, - tangled.GitRefUpdate_Meta{}, - tangled.GitRefUpdate_Meta_CommitCount{}, tangled.GitRefUpdate_Meta_CommitCount_ByEmail_Elem{}, + tangled.GitRefUpdate_Meta_CommitCount{}, + tangled.GitRefUpdate_Meta{}, + tangled.GitRefUpdate{}, tangled.GraphFollow{}, tangled.KnotMember{}, - tangled.Pipeline{}, tangled.Pipeline_CloneOpts{}, tangled.Pipeline_Dependencies_Elem{}, - tangled.Pipeline_ManualTriggerData{}, tangled.Pipeline_ManualTriggerData_Inputs_Elem{}, + tangled.Pipeline_ManualTriggerData{}, tangled.Pipeline_PullRequestTriggerData{}, tangled.Pipeline_PushTriggerData{}, tangled.Pipeline_Step{}, tangled.Pipeline_TriggerMetadata{}, tangled.Pipeline_TriggerRepo{}, - tangled.Pipeline_Workflow{}, tangled.Pipeline_Workflow_Environment_Elem{}, + tangled.Pipeline_Workflow{}, + tangled.Pipeline{}, tangled.PublicKey{}, - tangled.Repo{}, tangled.RepoArtifact{}, - tangled.RepoIssue{}, tangled.RepoIssueComment{}, tangled.RepoIssueState{}, - tangled.RepoPull{}, + tangled.RepoIssue{}, tangled.RepoPullComment{}, - tangled.RepoPull_Source{}, tangled.RepoPullStatus{}, + tangled.RepoPull_Source{}, + tangled.RepoPull{}, + tangled.Repo{}, + tangled.SpindleMember{}, ); err != nil { panic(err) } diff --git a/cmd/spindle/main.go b/cmd/spindle/main.go new file mode 100644 index 0000000..da29a2c --- /dev/null +++ b/cmd/spindle/main.go @@ -0,0 +1,4 @@ +package main + +func main() { +} diff --git a/lexicons/spindle/member.json b/lexicons/spindle/member.json new file mode 100644 index 0000000..036794a --- /dev/null +++ b/lexicons/spindle/member.json @@ -0,0 +1,34 @@ +{ + "lexicon": 1, + "id": "sh.tangled.spindle.member", + "needsCbor": true, + "needsType": true, + "defs": { + "main": { + "type": "record", + "key": "tid", + "record": { + "type": "object", + "required": [ + "subject", + "domain", + "createdAt" + ], + "properties": { + "subject": { + "type": "string", + "format": "did" + }, + "instance": { + "type": "string", + "description": "spindle instance that the subject is now a member of" + }, + "createdAt": { + "type": "string", + "format": "datetime" + } + } + } + } + } +} -- 2.51.2