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

lexicons: rename, format and other required changes

+225 -458
api/tangled/cbor_gen.go
···
}
cw := cbg.NewCborWriter(w)
-
fieldCount := 4
-
if t.AddedAt == nil {
-
fieldCount--
-
}
-
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
+
if _, err := cw.Write([]byte{164}); err != nil {
return err
}
···
return err
}
-
// t.Member (string) (string)
-
if len("member") > 1000000 {
-
return xerrors.Errorf("Value in field \"member\" 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("member"))); err != nil {
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
return err
}
-
if _, err := cw.WriteString(string("member")); err != nil {
+
if _, err := cw.WriteString(string("subject")); err != nil {
return err
}
-
if len(t.Member) > 1000000 {
-
return xerrors.Errorf("Value in field t.Member was too long")
+
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.Member))); err != nil {
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
return err
}
-
if _, err := cw.WriteString(string(t.Member)); err != nil {
+
if _, err := cw.WriteString(string(t.Subject)); err != nil {
return err
}
-
// t.AddedAt (string) (string)
-
if t.AddedAt != nil {
-
-
if len("addedAt") > 1000000 {
-
return xerrors.Errorf("Value in field \"addedAt\" 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("addedAt"))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string("addedAt")); err != nil {
-
return err
-
}
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string("createdAt")); err != nil {
+
return err
+
}
-
if t.AddedAt == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
if len(*t.AddedAt) > 1000000 {
-
return xerrors.Errorf("Value in field t.AddedAt 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.AddedAt))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string(*t.AddedAt)); err != nil {
-
return err
-
}
-
}
+
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
}
···
n := extra
-
nameBuf := make([]byte, 7)
+
nameBuf := make([]byte, 9)
for i := uint64(0); i < n; i++ {
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
if err != nil {
···
t.Domain = string(sval)
}
-
// t.Member (string) (string)
-
case "member":
+
// t.Subject (string) (string)
+
case "subject":
{
sval, err := cbg.ReadStringWithMax(cr, 1000000)
···
return err
}
-
t.Member = string(sval)
+
t.Subject = string(sval)
}
-
// t.AddedAt (string) (string)
-
case "addedAt":
+
// 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
-
}
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
-
if err != nil {
-
return err
-
}
-
-
t.AddedAt = (*string)(&sval)
-
}
+
t.CreatedAt = string(sval)
}
default:
···
return err
}
-
// t.Created (string) (string)
-
if len("created") > 1000000 {
-
return xerrors.Errorf("Value in field \"created\" 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("created"))); err != nil {
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
return err
}
-
if _, err := cw.WriteString(string("created")); err != nil {
+
if _, err := cw.WriteString(string("createdAt")); err != nil {
return err
}
-
if len(t.Created) > 1000000 {
-
return xerrors.Errorf("Value in field t.Created 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.Created))); err != nil {
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
return err
}
-
if _, err := cw.WriteString(string(t.Created)); err != nil {
+
if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
return err
}
return nil
···
n := extra
-
nameBuf := make([]byte, 7)
+
nameBuf := make([]byte, 9)
for i := uint64(0); i < n; i++ {
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
if err != nil {
···
t.LexiconTypeID = string(sval)
}
-
// t.Created (string) (string)
-
case "created":
+
// t.CreatedAt (string) (string)
+
case "createdAt":
{
sval, err := cbg.ReadStringWithMax(cr, 1000000)
···
return err
}
-
t.Created = string(sval)
+
t.CreatedAt = string(sval)
}
default:
···
cw := cbg.NewCborWriter(w)
fieldCount := 7
-
if t.Body == nil {
-
fieldCount--
-
}
-
if t.CommentId == nil {
fieldCount--
}
-
if t.CreatedAt == nil {
-
fieldCount--
-
}
-
if t.Owner == nil {
fieldCount--
}
···
}
// t.Body (string) (string)
-
if t.Body != nil {
-
-
if len("body") > 1000000 {
-
return xerrors.Errorf("Value in field \"body\" was too long")
-
}
+
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 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 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
-
}
-
}
+
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)
···
}
// t.CreatedAt (string) (string)
-
if t.CreatedAt != nil {
+
if len("createdAt") > 1000000 {
+
return xerrors.Errorf("Value in field \"createdAt\" was too long")
+
}
-
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 err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string("createdAt")); err != nil {
-
return err
-
}
-
-
if t.CreatedAt == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
if len(*t.CreatedAt) > 1000000 {
-
return xerrors.Errorf("Value in field t.CreatedAt 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.CreatedAt))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil {
-
return err
-
}
-
}
+
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
}
···
case "body":
-
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.Body = (*string)(&sval)
-
}
+
t.Body = string(sval)
// t.Repo (string) (string)
case "repo":
···
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
-
}
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
-
if err != nil {
-
return err
-
}
-
-
t.CreatedAt = (*string)(&sval)
-
}
+
t.CreatedAt = string(sval)
default:
···
cw := cbg.NewCborWriter(w)
-
fieldCount := 3
-
if t.State == 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.State (string) (string)
-
if t.State != nil {
+
if len("state") > 1000000 {
+
return xerrors.Errorf("Value in field \"state\" was too long")
+
}
-
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 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 t.State == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
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
-
}
-
}
+
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
···
case "state":
-
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.State = (*string)(&sval)
-
}
+
t.State = string(sval)
default:
···
fieldCount := 7
if t.Body == nil {
-
fieldCount--
-
}
-
-
if t.CreatedAt == nil {
fieldCount--
···
// t.CreatedAt (string) (string)
-
if t.CreatedAt != nil {
+
if len("createdAt") > 1000000 {
+
return xerrors.Errorf("Value in field \"createdAt\" was too long")
+
}
-
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 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 t.CreatedAt == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
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
-
}
-
}
+
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
···
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
-
}
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
-
if err != nil {
-
return err
-
}
-
-
t.CreatedAt = (*string)(&sval)
-
}
+
t.CreatedAt = string(sval)
default:
···
cw := cbg.NewCborWriter(w)
fieldCount := 7
-
-
if t.AddedAt == nil {
-
fieldCount--
-
}
if t.Description == nil {
fieldCount--
···
-
// t.AddedAt (string) (string)
-
if t.AddedAt != nil {
-
-
if len("addedAt") > 1000000 {
-
return xerrors.Errorf("Value in field \"addedAt\" 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("addedAt"))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string("addedAt")); err != nil {
-
return err
-
}
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string("createdAt")); err != nil {
+
return err
+
}
-
if t.AddedAt == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
if len(*t.AddedAt) > 1000000 {
-
return xerrors.Errorf("Value in field t.AddedAt 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.AddedAt))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string(*t.AddedAt)); err != nil {
-
return err
-
}
-
}
+
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.Description (string) (string)
···
t.Source = (*string)(&sval)
-
// t.AddedAt (string) (string)
-
case "addedAt":
+
// 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
-
}
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
-
if err != nil {
-
return err
-
}
-
-
t.AddedAt = (*string)(&sval)
-
}
+
t.CreatedAt = string(sval)
// t.Description (string) (string)
case "description":
···
fieldCount := 9
if t.Body == nil {
-
fieldCount--
-
}
-
-
if t.CreatedAt == nil {
fieldCount--
···
// t.CreatedAt (string) (string)
-
if t.CreatedAt != nil {
+
if len("createdAt") > 1000000 {
+
return xerrors.Errorf("Value in field \"createdAt\" was too long")
+
}
-
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 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 t.CreatedAt == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
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
-
}
-
}
+
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.TargetRepo (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
-
}
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
-
if err != nil {
-
return err
-
}
-
-
t.CreatedAt = (*string)(&sval)
-
}
+
t.CreatedAt = string(sval)
// t.TargetRepo (string) (string)
case "targetRepo":
···
cw := cbg.NewCborWriter(w)
-
fieldCount := 3
-
if t.Status == 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.Status (string) (string)
-
if t.Status != nil {
+
if len("status") > 1000000 {
+
return xerrors.Errorf("Value in field \"status\" was too long")
+
}
-
if len("status") > 1000000 {
-
return xerrors.Errorf("Value in field \"status\" was too long")
-
}
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string("status")); err != nil {
+
return err
+
}
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string("status")); err != nil {
-
return err
-
}
-
-
if t.Status == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
if len(*t.Status) > 1000000 {
-
return xerrors.Errorf("Value in field t.Status 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.Status))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string(*t.Status)); err != nil {
-
return err
-
}
-
}
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Status))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string(t.Status)); err != nil {
+
return err
return nil
···
case "status":
-
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.Status = (*string)(&sval)
-
}
+
t.Status = string(sval)
default:
···
cw := cbg.NewCborWriter(w)
fieldCount := 7
-
if t.Body == nil {
-
fieldCount--
-
}
-
if t.CommentId == nil {
fieldCount--
-
if t.CreatedAt == nil {
-
fieldCount--
-
}
-
if t.Owner == nil {
fieldCount--
···
// t.Body (string) (string)
-
if t.Body != nil {
-
-
if len("body") > 1000000 {
-
return xerrors.Errorf("Value in field \"body\" was too long")
-
}
+
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 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 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
-
}
-
}
+
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.Pull (string) (string)
···
// t.CreatedAt (string) (string)
-
if t.CreatedAt != nil {
+
if len("createdAt") > 1000000 {
+
return xerrors.Errorf("Value in field \"createdAt\" was too long")
+
}
-
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 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 t.CreatedAt == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
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
-
}
-
}
+
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
···
case "body":
-
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.Body = (*string)(&sval)
-
}
+
t.Body = string(sval)
// t.Pull (string) (string)
case "pull":
···
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
-
}
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
-
if err != nil {
-
return err
-
}
-
-
t.CreatedAt = (*string)(&sval)
-
}
+
t.CreatedAt = string(sval)
default:
+2 -2
api/tangled/issuecomment.go
···
// RECORDTYPE: RepoIssueComment
type RepoIssueComment struct {
LexiconTypeID string `json:"$type,const=sh.tangled.repo.issue.comment" cborgen:"$type,const=sh.tangled.repo.issue.comment"`
-
Body *string `json:"body,omitempty" cborgen:"body,omitempty"`
+
Body string `json:"body" cborgen:"body"`
CommentId *int64 `json:"commentId,omitempty" cborgen:"commentId,omitempty"`
-
CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"`
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
Issue string `json:"issue" cborgen:"issue"`
Owner *string `json:"owner,omitempty" cborgen:"owner,omitempty"`
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
+1 -1
api/tangled/issuestate.go
···
LexiconTypeID string `json:"$type,const=sh.tangled.repo.issue.state" cborgen:"$type,const=sh.tangled.repo.issue.state"`
Issue string `json:"issue" cborgen:"issue"`
// state: state of the issue
-
State *string `json:"state,omitempty" cborgen:"state,omitempty"`
+
State string `json:"state" cborgen:"state"`
}
+4 -4
api/tangled/knotmember.go
···
} //
// RECORDTYPE: KnotMember
type KnotMember struct {
-
LexiconTypeID string `json:"$type,const=sh.tangled.knot.member" cborgen:"$type,const=sh.tangled.knot.member"`
-
AddedAt *string `json:"addedAt,omitempty" cborgen:"addedAt,omitempty"`
+
LexiconTypeID string `json:"$type,const=sh.tangled.knot.member" cborgen:"$type,const=sh.tangled.knot.member"`
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
// domain: domain that this member now belongs to
-
Domain string `json:"domain" cborgen:"domain"`
-
Member string `json:"member" cborgen:"member"`
+
Domain string `json:"domain" cborgen:"domain"`
+
Subject string `json:"subject" cborgen:"subject"`
}
+2 -2
api/tangled/pullcomment.go
···
// RECORDTYPE: RepoPullComment
type RepoPullComment struct {
LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull.comment" cborgen:"$type,const=sh.tangled.repo.pull.comment"`
-
Body *string `json:"body,omitempty" cborgen:"body,omitempty"`
+
Body string `json:"body" cborgen:"body"`
CommentId *int64 `json:"commentId,omitempty" cborgen:"commentId,omitempty"`
-
CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"`
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
Owner *string `json:"owner,omitempty" cborgen:"owner,omitempty"`
Pull string `json:"pull" cborgen:"pull"`
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
+1 -1
api/tangled/pullstatus.go
···
LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull.status" cborgen:"$type,const=sh.tangled.repo.pull.status"`
Pull string `json:"pull" cborgen:"pull"`
// status: status of the pull request
-
Status *string `json:"status,omitempty" cborgen:"status,omitempty"`
+
Status string `json:"status" cborgen:"status"`
}
+1 -1
api/tangled/repoissue.go
···
type RepoIssue struct {
LexiconTypeID string `json:"$type,const=sh.tangled.repo.issue" cborgen:"$type,const=sh.tangled.repo.issue"`
Body *string `json:"body,omitempty" cborgen:"body,omitempty"`
-
CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"`
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
IssueId int64 `json:"issueId" cborgen:"issueId"`
Owner string `json:"owner" cborgen:"owner"`
Repo string `json:"repo" cborgen:"repo"`
+1 -1
api/tangled/repopull.go
···
type RepoPull struct {
LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull" cborgen:"$type,const=sh.tangled.repo.pull"`
Body *string `json:"body,omitempty" cborgen:"body,omitempty"`
-
CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"`
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
Patch string `json:"patch" cborgen:"patch"`
PullId int64 `json:"pullId" cborgen:"pullId"`
Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"`
+2 -2
api/tangled/tangledpublicKey.go
···
// RECORDTYPE: PublicKey
type PublicKey struct {
LexiconTypeID string `json:"$type,const=sh.tangled.publicKey" cborgen:"$type,const=sh.tangled.publicKey"`
-
// created: key upload timestamp
-
Created string `json:"created" cborgen:"created"`
+
// createdAt: key upload timestamp
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
// key: public key contents
Key string `json:"key" cborgen:"key"`
// name: human-readable name for this key
+1 -1
api/tangled/tangledrepo.go
···
// RECORDTYPE: Repo
type Repo struct {
LexiconTypeID string `json:"$type,const=sh.tangled.repo" cborgen:"$type,const=sh.tangled.repo"`
-
AddedAt *string `json:"addedAt,omitempty" cborgen:"addedAt,omitempty"`
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
// knot: knot where the repo was created
Knot string `json:"knot" cborgen:"knot"`
+2 -2
appview/pages/templates/knot.html
···
class="max-w-2xl space-y-4">
<input
type="text"
-
id="member"
-
name="member"
+
id="subject"
+
name="subject"
placeholder="did or handle"
required
class="w-full dark:bg-gray-700 dark:text-white dark:border-gray-600 dark:placeholder-gray-400"/>
+3 -3
appview/settings/settings.go
···
Rkey: rkey,
Record: &lexutil.LexiconTypeDecoder{
Val: &tangled.PublicKey{
-
Created: time.Now().Format(time.RFC3339),
-
Key: key,
-
Name: name,
+
CreatedAt: time.Now().Format(time.RFC3339),
+
Key: key,
+
Name: name,
}},
})
// invalid record
+2 -2
appview/state/pull.go
···
Repo: &atUri,
Pull: string(pullAt),
Owner: &ownerDid,
-
Body: &body,
-
CreatedAt: &createdAt,
+
Body: body,
+
CreatedAt: createdAt,
},
},
})
+15 -15
appview/state/repo.go
···
Knot: f.Knot,
Name: f.RepoName,
Owner: user.Did,
-
AddedAt: &f.AddedAt,
+
CreatedAt: f.CreatedAt,
Description: &newDescription,
},
},
···
RepoName string
RepoAt syntax.ATURI
Description string
-
AddedAt string
+
CreatedAt string
}
func (f *FullyResolvedRepo) OwnerDid() string {
···
Record: &lexutil.LexiconTypeDecoder{
Val: &tangled.RepoIssueState{
Issue: issue.IssueAt,
-
State: &closed,
+
State: closed,
},
},
})
···
Issue: issueAt,
CommentId: &commentIdInt64,
Owner: &ownerDid,
-
Body: &body,
-
CreatedAt: &createdAt,
+
Body: body,
+
CreatedAt: createdAt,
},
},
})
···
Issue: issueAt,
CommentId: &commentIdInt64,
Owner: &comment.OwnerDid,
-
Body: &newBody,
-
CreatedAt: &createdAt,
+
Body: newBody,
+
CreatedAt: createdAt,
},
},
})
···
} else {
uri = "https"
-
sourceUrl := fmt.Sprintf("%s://%s/%s/%s", uri, f.Knot, f.OwnerDid(), f.RepoName)
+
forkSourceUrl := fmt.Sprintf("%s://%s/%s/%s", uri, f.Knot, f.OwnerDid(), f.RepoName)
sourceAt := f.RepoAt.String()
rkey := appview.TID()
···
}()
-
resp, err := client.ForkRepo(user.Did, sourceUrl, forkName)
+
resp, err := client.ForkRepo(user.Did, forkSourceUrl, forkName)
if err != nil {
s.pages.Notice(w, "repo", "Failed to create repository on knot server.")
return
···
xrpcClient, _ := s.auth.AuthorizedClient(r)
-
addedAt := time.Now().Format(time.RFC3339)
+
createdAt := time.Now().Format(time.RFC3339)
atresp, err := comatproto.RepoPutRecord(r.Context(), xrpcClient, &comatproto.RepoPutRecord_Input{
Collection: tangled.RepoNSID,
Repo: user.Did,
Rkey: rkey,
Record: &lexutil.LexiconTypeDecoder{
Val: &tangled.Repo{
-
Knot: repo.Knot,
-
Name: repo.Name,
-
AddedAt: &addedAt,
-
Owner: user.Did,
-
Source: &sourceAt,
+
Knot: repo.Knot,
+
Name: repo.Name,
+
CreatedAt: createdAt,
+
Owner: user.Did,
+
Source: &sourceAt,
}},
})
if err != nil {
+1 -1
appview/state/repo_util.go
···
RepoName: repoName,
RepoAt: parsedRepoAt,
Description: description,
-
AddedAt: addedAt,
+
CreatedAt: addedAt,
}, nil
}
+16 -16
appview/state/state.go
···
return
}
-
memberDid := r.FormValue("member")
-
if memberDid == "" {
+
subjectIdentifier := r.FormValue("subject")
+
if subjectIdentifier == "" {
http.Error(w, "malformed form", http.StatusBadRequest)
return
}
-
memberIdent, err := s.resolver.ResolveIdent(r.Context(), memberDid)
+
subjectIdentity, err := s.resolver.ResolveIdent(r.Context(), subjectIdentifier)
if err != nil {
w.Write([]byte("failed to resolve member did to a handle"))
return
}
-
log.Printf("adding %s to %s\n", memberIdent.Handle.String(), domain)
+
log.Printf("adding %s to %s\n", subjectIdentity.Handle.String(), domain)
// announce this relation into the firehose, store into owners' pds
client, _ := s.auth.AuthorizedClient(r)
currentUser := s.auth.GetUser(r)
-
addedAt := time.Now().Format(time.RFC3339)
+
createdAt := time.Now().Format(time.RFC3339)
resp, err := comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{
Collection: tangled.KnotMemberNSID,
Repo: currentUser.Did,
Rkey: appview.TID(),
Record: &lexutil.LexiconTypeDecoder{
Val: &tangled.KnotMember{
-
Member: memberIdent.DID.String(),
-
Domain: domain,
-
AddedAt: &addedAt,
+
Subject: subjectIdentity.DID.String(),
+
Domain: domain,
+
CreatedAt: createdAt,
}},
})
···
return
}
-
ksResp, err := ksClient.AddMember(memberIdent.DID.String())
+
ksResp, err := ksClient.AddMember(subjectIdentity.DID.String())
if err != nil {
log.Printf("failed to make request to %s: %s", domain, err)
return
···
return
}
-
err = s.enforcer.AddMember(domain, memberIdent.DID.String())
+
err = s.enforcer.AddMember(domain, subjectIdentity.DID.String())
if err != nil {
w.Write([]byte(fmt.Sprint("failed to add member: ", err)))
return
}
-
w.Write([]byte(fmt.Sprint("added member: ", memberIdent.Handle.String())))
+
w.Write([]byte(fmt.Sprint("added member: ", subjectIdentity.Handle.String())))
}
func (s *State) RemoveMember(w http.ResponseWriter, r *http.Request) {
···
xrpcClient, _ := s.auth.AuthorizedClient(r)
-
addedAt := time.Now().Format(time.RFC3339)
+
createdAt := time.Now().Format(time.RFC3339)
atresp, err := comatproto.RepoPutRecord(r.Context(), xrpcClient, &comatproto.RepoPutRecord_Input{
Collection: tangled.RepoNSID,
Repo: user.Did,
Rkey: rkey,
Record: &lexutil.LexiconTypeDecoder{
Val: &tangled.Repo{
-
Knot: repo.Knot,
-
Name: repoName,
-
AddedAt: &addedAt,
-
Owner: user.Did,
+
Knot: repo.Knot,
+
Name: repoName,
+
CreatedAt: createdAt,
+
Owner: user.Did,
}},
})
if err != nil {
+9 -9
knotserver/db/pubkeys.go
···
Did: did,
}
pk.Key = record["key"]
-
pk.Created = record["created"]
+
pk.CreatedAt = record["createdAt"]
return d.AddPublicKey(pk)
}
func (d *DB) AddPublicKey(pk PublicKey) error {
-
if pk.Created == "" {
-
pk.Created = time.Now().Format(time.RFC3339)
+
if pk.CreatedAt == "" {
+
pk.CreatedAt = time.Now().Format(time.RFC3339)
}
query := `insert or ignore into public_keys (did, key, created) values (?, ?, ?)`
-
_, err := d.db.Exec(query, pk.Did, pk.Key, pk.Created)
+
_, err := d.db.Exec(query, pk.Did, pk.Key, pk.CreatedAt)
return err
}
···
func (pk *PublicKey) JSON() map[string]any {
return map[string]any{
-
"did": pk.Did,
-
"key": pk.Key,
-
"created": pk.Created,
+
"did": pk.Did,
+
"key": pk.Key,
+
"createdAt": pk.CreatedAt,
}
}
···
for rows.Next() {
var publicKey PublicKey
-
if err := rows.Scan(&publicKey.Key, &publicKey.Did, &publicKey.Created); err != nil {
+
if err := rows.Scan(&publicKey.Key, &publicKey.Did, &publicKey.CreatedAt); err != nil {
return nil, err
}
keys = append(keys, publicKey)
···
for rows.Next() {
var publicKey PublicKey
-
if err := rows.Scan(&publicKey.Did, &publicKey.Key, &publicKey.Created); err != nil {
+
if err := rows.Scan(&publicKey.Did, &publicKey.Key, &publicKey.CreatedAt); err != nil {
return nil, err
}
keys = append(keys, publicKey)
+2 -2
knotserver/jetstream.go
···
return fmt.Errorf("failed to enforce permissions: %w", err)
}
-
if err := h.e.AddMember(ThisServer, record.Member); err != nil {
+
if err := h.e.AddMember(ThisServer, record.Subject); err != nil {
l.Error("failed to add member", "error", err)
return fmt.Errorf("failed to add member: %w", err)
}
-
l.Info("added member from firehose", "member", record.Member)
+
l.Info("added member from firehose", "member", record.Subject)
if err := h.db.AddDid(did); err != nil {
l.Error("failed to add did", "error", err)
+6 -7
lexicons/follow.json
···
"record": {
"type": "object",
"required": [
-
"createdAt",
-
"subject"
+
"subject",
+
"createdAt"
],
"properties": {
+
"subject": {
+
"type": "string",
+
"format": "did"
+
},
"createdAt": {
"type": "string",
"format": "datetime"
-
},
-
"subject": {
-
"type": "string",
-
"format": "did"
}
}
}
}
}
}
-
+5 -1
lexicons/issue/comment.json
···
"key": "tid",
"record": {
"type": "object",
-
"required": ["issue"],
+
"required": [
+
"issue",
+
"body",
+
"createdAt"
+
],
"properties": {
"issue": {
"type": "string",
+7 -1
lexicons/issue/issue.json
···
"key": "tid",
"record": {
"type": "object",
-
"required": ["repo", "issueId", "owner", "title"],
+
"required": [
+
"repo",
+
"issueId",
+
"owner",
+
"title",
+
"createdAt"
+
],
"properties": {
"repo": {
"type": "string",
+4 -1
lexicons/issue/state.json
···
"key": "tid",
"record": {
"type": "object",
-
"required": ["issue"],
+
"required": [
+
"issue",
+
"state"
+
],
"properties": {
"issue": {
"type": "string",
+5 -4
lexicons/member.json
···
"record": {
"type": "object",
"required": [
-
"member",
-
"domain"
+
"subject",
+
"domain",
+
"createdAt"
],
"properties": {
-
"member": {
+
"subject": {
"type": "string",
"format": "did"
},
···
"type": "string",
"description": "domain that this member now belongs to"
},
-
"addedAt": {
+
"createdAt": {
"type": "string",
"format": "datetime"
}
+2 -3
lexicons/publicKey.json
···
"required": [
"key",
"name",
-
"created"
+
"createdAt"
],
"properties": {
"key": {
"type": "string",
"maxLength": 4096,
-
"maxGraphemes": 4096,
"description": "public key contents"
},
"name": {
···
"format": "string",
"description": "human-readable name for this key"
},
-
"created": {
+
"createdAt": {
"type": "string",
"format": "datetime",
"description": "key upload timestamp"
+5 -1
lexicons/pulls/comment.json
···
"key": "tid",
"record": {
"type": "object",
-
"required": ["pull"],
+
"required": [
+
"pull",
+
"body",
+
"createdAt"
+
],
"properties": {
"pull": {
"type": "string",
+9 -6
lexicons/pulls/pull.json
···
"targetBranch",
"pullId",
"title",
-
"patch"
+
"patch",
+
"createdAt"
],
"properties": {
"targetRepo": {
···
"body": {
"type": "string"
},
-
"createdAt": {
-
"type": "string",
-
"format": "datetime"
-
},
"patch": {
"type": "string"
},
"source": {
"type": "ref",
"ref": "#source"
+
},
+
"createdAt": {
+
"type": "string",
+
"format": "datetime"
}
}
}
},
"source": {
"type": "object",
-
"required": ["branch"],
+
"required": [
+
"branch"
+
],
"properties": {
"branch": {
"type": "string"
+4 -1
lexicons/pulls/state.json
···
"key": "tid",
"record": {
"type": "object",
-
"required": ["pull"],
+
"required": [
+
"pull",
+
"status"
+
],
"properties": {
"pull": {
"type": "string",
+12 -7
lexicons/repo.json
···
"key": "tid",
"record": {
"type": "object",
-
"required": ["name", "knot", "owner"],
+
"required": [
+
"name",
+
"knot",
+
"owner",
+
"createdAt"
+
],
"properties": {
"name": {
"type": "string",
···
"type": "string",
"description": "knot where the repo was created"
},
-
"addedAt": {
-
"type": "string",
-
"format": "datetime"
-
},
"description": {
"type": "string",
"format": "datetime",
-
"minLength": 1,
-
"maxLength": 140
+
"minGraphemes": 1,
+
"maxGraphemes": 140
},
"source": {
"type": "string",
"format": "uri",
"description": "source of the repo"
+
},
+
"createdAt": {
+
"type": "string",
+
"format": "datetime"
}
}
}
+6 -8
lexicons/star.json
···
"record": {
"type": "object",
"required": [
-
"createdAt",
-
"subject"
+
"subject",
+
"createdAt"
],
"properties": {
-
"createdAt": {
-
"type": "string",
-
"format": "datetime"
-
},
"subject": {
"type": "string",
"format": "at-uri"
+
},
+
"createdAt": {
+
"type": "string",
+
"format": "datetime"
}
}
}
}
}
}
-
-