Monorepo for Tangled

lexicons: add new CI lexicons

Signed-off-by: Seongmin Lee <git@boltless.me>

boltless.me 54748b06 06349f70

verified
+1232
+911
api/tangled/cbor_gen.go
··· 9890 9890 9891 9891 return nil 9892 9892 } 9893 + func (t *CiEvent) MarshalCBOR(w io.Writer) error { 9894 + if t == nil { 9895 + _, err := w.Write(cbg.CborNull) 9896 + return err 9897 + } 9898 + 9899 + cw := cbg.NewCborWriter(w) 9900 + 9901 + if _, err := cw.Write([]byte{161}); err != nil { 9902 + return err 9903 + } 9904 + 9905 + // t.Meta (tangled.CiEvent_Meta) (struct) 9906 + if len("meta") > 1000000 { 9907 + return xerrors.Errorf("Value in field \"meta\" was too long") 9908 + } 9909 + 9910 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("meta"))); err != nil { 9911 + return err 9912 + } 9913 + if _, err := cw.WriteString(string("meta")); err != nil { 9914 + return err 9915 + } 9916 + 9917 + if err := t.Meta.MarshalCBOR(cw); err != nil { 9918 + return err 9919 + } 9920 + return nil 9921 + } 9922 + 9923 + func (t *CiEvent) UnmarshalCBOR(r io.Reader) (err error) { 9924 + *t = CiEvent{} 9925 + 9926 + cr := cbg.NewCborReader(r) 9927 + 9928 + maj, extra, err := cr.ReadHeader() 9929 + if err != nil { 9930 + return err 9931 + } 9932 + defer func() { 9933 + if err == io.EOF { 9934 + err = io.ErrUnexpectedEOF 9935 + } 9936 + }() 9937 + 9938 + if maj != cbg.MajMap { 9939 + return fmt.Errorf("cbor input should be of type map") 9940 + } 9941 + 9942 + if extra > cbg.MaxLength { 9943 + return fmt.Errorf("CiEvent: map struct too large (%d)", extra) 9944 + } 9945 + 9946 + n := extra 9947 + 9948 + nameBuf := make([]byte, 4) 9949 + for i := uint64(0); i < n; i++ { 9950 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 9951 + if err != nil { 9952 + return err 9953 + } 9954 + 9955 + if !ok { 9956 + // Field doesn't exist on this type, so ignore it 9957 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 9958 + return err 9959 + } 9960 + continue 9961 + } 9962 + 9963 + switch string(nameBuf[:nameLen]) { 9964 + // t.Meta (tangled.CiEvent_Meta) (struct) 9965 + case "meta": 9966 + 9967 + { 9968 + 9969 + b, err := cr.ReadByte() 9970 + if err != nil { 9971 + return err 9972 + } 9973 + if b != cbg.CborNull[0] { 9974 + if err := cr.UnreadByte(); err != nil { 9975 + return err 9976 + } 9977 + t.Meta = new(CiEvent_Meta) 9978 + if err := t.Meta.UnmarshalCBOR(cr); err != nil { 9979 + return xerrors.Errorf("unmarshaling t.Meta pointer: %w", err) 9980 + } 9981 + } 9982 + 9983 + } 9984 + 9985 + default: 9986 + // Field doesn't exist on this type, so ignore it 9987 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 9988 + return err 9989 + } 9990 + } 9991 + } 9992 + 9993 + return nil 9994 + } 9995 + func (t *CiEvent_PullRequest) MarshalCBOR(w io.Writer) error { 9996 + if t == nil { 9997 + _, err := w.Write(cbg.CborNull) 9998 + return err 9999 + } 10000 + 10001 + cw := cbg.NewCborWriter(w) 10002 + 10003 + if _, err := cw.Write([]byte{161}); err != nil { 10004 + return err 10005 + } 10006 + 10007 + // t.LexiconTypeID (string) (string) 10008 + if len("$type") > 1000000 { 10009 + return xerrors.Errorf("Value in field \"$type\" was too long") 10010 + } 10011 + 10012 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10013 + return err 10014 + } 10015 + if _, err := cw.WriteString(string("$type")); err != nil { 10016 + return err 10017 + } 10018 + 10019 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.event#pullRequest"))); err != nil { 10020 + return err 10021 + } 10022 + if _, err := cw.WriteString(string("sh.tangled.ci.event#pullRequest")); err != nil { 10023 + return err 10024 + } 10025 + return nil 10026 + } 10027 + 10028 + func (t *CiEvent_PullRequest) UnmarshalCBOR(r io.Reader) (err error) { 10029 + *t = CiEvent_PullRequest{} 10030 + 10031 + cr := cbg.NewCborReader(r) 10032 + 10033 + maj, extra, err := cr.ReadHeader() 10034 + if err != nil { 10035 + return err 10036 + } 10037 + defer func() { 10038 + if err == io.EOF { 10039 + err = io.ErrUnexpectedEOF 10040 + } 10041 + }() 10042 + 10043 + if maj != cbg.MajMap { 10044 + return fmt.Errorf("cbor input should be of type map") 10045 + } 10046 + 10047 + if extra > cbg.MaxLength { 10048 + return fmt.Errorf("CiEvent_PullRequest: map struct too large (%d)", extra) 10049 + } 10050 + 10051 + n := extra 10052 + 10053 + nameBuf := make([]byte, 5) 10054 + for i := uint64(0); i < n; i++ { 10055 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10056 + if err != nil { 10057 + return err 10058 + } 10059 + 10060 + if !ok { 10061 + // Field doesn't exist on this type, so ignore it 10062 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10063 + return err 10064 + } 10065 + continue 10066 + } 10067 + 10068 + switch string(nameBuf[:nameLen]) { 10069 + // t.LexiconTypeID (string) (string) 10070 + case "$type": 10071 + 10072 + { 10073 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10074 + if err != nil { 10075 + return err 10076 + } 10077 + 10078 + t.LexiconTypeID = string(sval) 10079 + } 10080 + 10081 + default: 10082 + // Field doesn't exist on this type, so ignore it 10083 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10084 + return err 10085 + } 10086 + } 10087 + } 10088 + 10089 + return nil 10090 + } 10091 + func (t *CiEvent_Push) MarshalCBOR(w io.Writer) error { 10092 + if t == nil { 10093 + _, err := w.Write(cbg.CborNull) 10094 + return err 10095 + } 10096 + 10097 + cw := cbg.NewCborWriter(w) 10098 + 10099 + if _, err := cw.Write([]byte{164}); err != nil { 10100 + return err 10101 + } 10102 + 10103 + // t.Ref (string) (string) 10104 + if len("ref") > 1000000 { 10105 + return xerrors.Errorf("Value in field \"ref\" was too long") 10106 + } 10107 + 10108 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil { 10109 + return err 10110 + } 10111 + if _, err := cw.WriteString(string("ref")); err != nil { 10112 + return err 10113 + } 10114 + 10115 + if len(t.Ref) > 1000000 { 10116 + return xerrors.Errorf("Value in field t.Ref was too long") 10117 + } 10118 + 10119 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Ref))); err != nil { 10120 + return err 10121 + } 10122 + if _, err := cw.WriteString(string(t.Ref)); err != nil { 10123 + return err 10124 + } 10125 + 10126 + // t.LexiconTypeID (string) (string) 10127 + if len("$type") > 1000000 { 10128 + return xerrors.Errorf("Value in field \"$type\" was too long") 10129 + } 10130 + 10131 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10132 + return err 10133 + } 10134 + if _, err := cw.WriteString(string("$type")); err != nil { 10135 + return err 10136 + } 10137 + 10138 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.event#push"))); err != nil { 10139 + return err 10140 + } 10141 + if _, err := cw.WriteString(string("sh.tangled.ci.event#push")); err != nil { 10142 + return err 10143 + } 10144 + 10145 + // t.NewSha (string) (string) 10146 + if len("newSha") > 1000000 { 10147 + return xerrors.Errorf("Value in field \"newSha\" was too long") 10148 + } 10149 + 10150 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("newSha"))); err != nil { 10151 + return err 10152 + } 10153 + if _, err := cw.WriteString(string("newSha")); err != nil { 10154 + return err 10155 + } 10156 + 10157 + if len(t.NewSha) > 1000000 { 10158 + return xerrors.Errorf("Value in field t.NewSha was too long") 10159 + } 10160 + 10161 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.NewSha))); err != nil { 10162 + return err 10163 + } 10164 + if _, err := cw.WriteString(string(t.NewSha)); err != nil { 10165 + return err 10166 + } 10167 + 10168 + // t.OldSha (string) (string) 10169 + if len("oldSha") > 1000000 { 10170 + return xerrors.Errorf("Value in field \"oldSha\" was too long") 10171 + } 10172 + 10173 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("oldSha"))); err != nil { 10174 + return err 10175 + } 10176 + if _, err := cw.WriteString(string("oldSha")); err != nil { 10177 + return err 10178 + } 10179 + 10180 + if len(t.OldSha) > 1000000 { 10181 + return xerrors.Errorf("Value in field t.OldSha was too long") 10182 + } 10183 + 10184 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.OldSha))); err != nil { 10185 + return err 10186 + } 10187 + if _, err := cw.WriteString(string(t.OldSha)); err != nil { 10188 + return err 10189 + } 10190 + return nil 10191 + } 10192 + 10193 + func (t *CiEvent_Push) UnmarshalCBOR(r io.Reader) (err error) { 10194 + *t = CiEvent_Push{} 10195 + 10196 + cr := cbg.NewCborReader(r) 10197 + 10198 + maj, extra, err := cr.ReadHeader() 10199 + if err != nil { 10200 + return err 10201 + } 10202 + defer func() { 10203 + if err == io.EOF { 10204 + err = io.ErrUnexpectedEOF 10205 + } 10206 + }() 10207 + 10208 + if maj != cbg.MajMap { 10209 + return fmt.Errorf("cbor input should be of type map") 10210 + } 10211 + 10212 + if extra > cbg.MaxLength { 10213 + return fmt.Errorf("CiEvent_Push: map struct too large (%d)", extra) 10214 + } 10215 + 10216 + n := extra 10217 + 10218 + nameBuf := make([]byte, 6) 10219 + for i := uint64(0); i < n; i++ { 10220 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10221 + if err != nil { 10222 + return err 10223 + } 10224 + 10225 + if !ok { 10226 + // Field doesn't exist on this type, so ignore it 10227 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10228 + return err 10229 + } 10230 + continue 10231 + } 10232 + 10233 + switch string(nameBuf[:nameLen]) { 10234 + // t.Ref (string) (string) 10235 + case "ref": 10236 + 10237 + { 10238 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10239 + if err != nil { 10240 + return err 10241 + } 10242 + 10243 + t.Ref = string(sval) 10244 + } 10245 + // t.LexiconTypeID (string) (string) 10246 + case "$type": 10247 + 10248 + { 10249 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10250 + if err != nil { 10251 + return err 10252 + } 10253 + 10254 + t.LexiconTypeID = string(sval) 10255 + } 10256 + // t.NewSha (string) (string) 10257 + case "newSha": 10258 + 10259 + { 10260 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10261 + if err != nil { 10262 + return err 10263 + } 10264 + 10265 + t.NewSha = string(sval) 10266 + } 10267 + // t.OldSha (string) (string) 10268 + case "oldSha": 10269 + 10270 + { 10271 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10272 + if err != nil { 10273 + return err 10274 + } 10275 + 10276 + t.OldSha = string(sval) 10277 + } 10278 + 10279 + default: 10280 + // Field doesn't exist on this type, so ignore it 10281 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10282 + return err 10283 + } 10284 + } 10285 + } 10286 + 10287 + return nil 10288 + } 10289 + func (t *CiEvent_Manual) MarshalCBOR(w io.Writer) error { 10290 + if t == nil { 10291 + _, err := w.Write(cbg.CborNull) 10292 + return err 10293 + } 10294 + 10295 + cw := cbg.NewCborWriter(w) 10296 + 10297 + if _, err := cw.Write([]byte{161}); err != nil { 10298 + return err 10299 + } 10300 + 10301 + // t.LexiconTypeID (string) (string) 10302 + if len("$type") > 1000000 { 10303 + return xerrors.Errorf("Value in field \"$type\" was too long") 10304 + } 10305 + 10306 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10307 + return err 10308 + } 10309 + if _, err := cw.WriteString(string("$type")); err != nil { 10310 + return err 10311 + } 10312 + 10313 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.event#manual"))); err != nil { 10314 + return err 10315 + } 10316 + if _, err := cw.WriteString(string("sh.tangled.ci.event#manual")); err != nil { 10317 + return err 10318 + } 10319 + return nil 10320 + } 10321 + 10322 + func (t *CiEvent_Manual) UnmarshalCBOR(r io.Reader) (err error) { 10323 + *t = CiEvent_Manual{} 10324 + 10325 + cr := cbg.NewCborReader(r) 10326 + 10327 + maj, extra, err := cr.ReadHeader() 10328 + if err != nil { 10329 + return err 10330 + } 10331 + defer func() { 10332 + if err == io.EOF { 10333 + err = io.ErrUnexpectedEOF 10334 + } 10335 + }() 10336 + 10337 + if maj != cbg.MajMap { 10338 + return fmt.Errorf("cbor input should be of type map") 10339 + } 10340 + 10341 + if extra > cbg.MaxLength { 10342 + return fmt.Errorf("CiEvent_Manual: map struct too large (%d)", extra) 10343 + } 10344 + 10345 + n := extra 10346 + 10347 + nameBuf := make([]byte, 5) 10348 + for i := uint64(0); i < n; i++ { 10349 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10350 + if err != nil { 10351 + return err 10352 + } 10353 + 10354 + if !ok { 10355 + // Field doesn't exist on this type, so ignore it 10356 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10357 + return err 10358 + } 10359 + continue 10360 + } 10361 + 10362 + switch string(nameBuf[:nameLen]) { 10363 + // t.LexiconTypeID (string) (string) 10364 + case "$type": 10365 + 10366 + { 10367 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10368 + if err != nil { 10369 + return err 10370 + } 10371 + 10372 + t.LexiconTypeID = string(sval) 10373 + } 10374 + 10375 + default: 10376 + // Field doesn't exist on this type, so ignore it 10377 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10378 + return err 10379 + } 10380 + } 10381 + } 10382 + 10383 + return nil 10384 + } 10385 + func (t *CiPipeline) MarshalCBOR(w io.Writer) error { 10386 + if t == nil { 10387 + _, err := w.Write(cbg.CborNull) 10388 + return err 10389 + } 10390 + 10391 + cw := cbg.NewCborWriter(w) 10392 + 10393 + if _, err := cw.Write([]byte{163}); err != nil { 10394 + return err 10395 + } 10396 + 10397 + // t.LexiconTypeID (string) (string) 10398 + if len("$type") > 1000000 { 10399 + return xerrors.Errorf("Value in field \"$type\" was too long") 10400 + } 10401 + 10402 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10403 + return err 10404 + } 10405 + if _, err := cw.WriteString(string("$type")); err != nil { 10406 + return err 10407 + } 10408 + 10409 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.pipeline"))); err != nil { 10410 + return err 10411 + } 10412 + if _, err := cw.WriteString(string("sh.tangled.ci.pipeline")); err != nil { 10413 + return err 10414 + } 10415 + 10416 + // t.Event (tangled.CiEvent) (struct) 10417 + if len("event") > 1000000 { 10418 + return xerrors.Errorf("Value in field \"event\" was too long") 10419 + } 10420 + 10421 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("event"))); err != nil { 10422 + return err 10423 + } 10424 + if _, err := cw.WriteString(string("event")); err != nil { 10425 + return err 10426 + } 10427 + 10428 + if err := t.Event.MarshalCBOR(cw); err != nil { 10429 + return err 10430 + } 10431 + 10432 + // t.WorkflowRuns ([]string) (slice) 10433 + if len("workflowRuns") > 1000000 { 10434 + return xerrors.Errorf("Value in field \"workflowRuns\" was too long") 10435 + } 10436 + 10437 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflowRuns"))); err != nil { 10438 + return err 10439 + } 10440 + if _, err := cw.WriteString(string("workflowRuns")); err != nil { 10441 + return err 10442 + } 10443 + 10444 + if len(t.WorkflowRuns) > 8192 { 10445 + return xerrors.Errorf("Slice value in field t.WorkflowRuns was too long") 10446 + } 10447 + 10448 + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.WorkflowRuns))); err != nil { 10449 + return err 10450 + } 10451 + for _, v := range t.WorkflowRuns { 10452 + if len(v) > 1000000 { 10453 + return xerrors.Errorf("Value in field v was too long") 10454 + } 10455 + 10456 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil { 10457 + return err 10458 + } 10459 + if _, err := cw.WriteString(string(v)); err != nil { 10460 + return err 10461 + } 10462 + 10463 + } 10464 + return nil 10465 + } 10466 + 10467 + func (t *CiPipeline) UnmarshalCBOR(r io.Reader) (err error) { 10468 + *t = CiPipeline{} 10469 + 10470 + cr := cbg.NewCborReader(r) 10471 + 10472 + maj, extra, err := cr.ReadHeader() 10473 + if err != nil { 10474 + return err 10475 + } 10476 + defer func() { 10477 + if err == io.EOF { 10478 + err = io.ErrUnexpectedEOF 10479 + } 10480 + }() 10481 + 10482 + if maj != cbg.MajMap { 10483 + return fmt.Errorf("cbor input should be of type map") 10484 + } 10485 + 10486 + if extra > cbg.MaxLength { 10487 + return fmt.Errorf("CiPipeline: map struct too large (%d)", extra) 10488 + } 10489 + 10490 + n := extra 10491 + 10492 + nameBuf := make([]byte, 12) 10493 + for i := uint64(0); i < n; i++ { 10494 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10495 + if err != nil { 10496 + return err 10497 + } 10498 + 10499 + if !ok { 10500 + // Field doesn't exist on this type, so ignore it 10501 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10502 + return err 10503 + } 10504 + continue 10505 + } 10506 + 10507 + switch string(nameBuf[:nameLen]) { 10508 + // t.LexiconTypeID (string) (string) 10509 + case "$type": 10510 + 10511 + { 10512 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10513 + if err != nil { 10514 + return err 10515 + } 10516 + 10517 + t.LexiconTypeID = string(sval) 10518 + } 10519 + // t.Event (tangled.CiEvent) (struct) 10520 + case "event": 10521 + 10522 + { 10523 + 10524 + b, err := cr.ReadByte() 10525 + if err != nil { 10526 + return err 10527 + } 10528 + if b != cbg.CborNull[0] { 10529 + if err := cr.UnreadByte(); err != nil { 10530 + return err 10531 + } 10532 + t.Event = new(CiEvent) 10533 + if err := t.Event.UnmarshalCBOR(cr); err != nil { 10534 + return xerrors.Errorf("unmarshaling t.Event pointer: %w", err) 10535 + } 10536 + } 10537 + 10538 + } 10539 + // t.WorkflowRuns ([]string) (slice) 10540 + case "workflowRuns": 10541 + 10542 + maj, extra, err = cr.ReadHeader() 10543 + if err != nil { 10544 + return err 10545 + } 10546 + 10547 + if extra > 8192 { 10548 + return fmt.Errorf("t.WorkflowRuns: array too large (%d)", extra) 10549 + } 10550 + 10551 + if maj != cbg.MajArray { 10552 + return fmt.Errorf("expected cbor array") 10553 + } 10554 + 10555 + if extra > 0 { 10556 + t.WorkflowRuns = make([]string, extra) 10557 + } 10558 + 10559 + for i := 0; i < int(extra); i++ { 10560 + { 10561 + var maj byte 10562 + var extra uint64 10563 + var err error 10564 + _ = maj 10565 + _ = extra 10566 + _ = err 10567 + 10568 + { 10569 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10570 + if err != nil { 10571 + return err 10572 + } 10573 + 10574 + t.WorkflowRuns[i] = string(sval) 10575 + } 10576 + 10577 + } 10578 + } 10579 + 10580 + default: 10581 + // Field doesn't exist on this type, so ignore it 10582 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10583 + return err 10584 + } 10585 + } 10586 + } 10587 + 10588 + return nil 10589 + } 10590 + func (t *CiWorkflowRun) MarshalCBOR(w io.Writer) error { 10591 + if t == nil { 10592 + _, err := w.Write(cbg.CborNull) 10593 + return err 10594 + } 10595 + 10596 + cw := cbg.NewCborWriter(w) 10597 + 10598 + if _, err := cw.Write([]byte{164}); err != nil { 10599 + return err 10600 + } 10601 + 10602 + // t.Name (string) (string) 10603 + if len("name") > 1000000 { 10604 + return xerrors.Errorf("Value in field \"name\" was too long") 10605 + } 10606 + 10607 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil { 10608 + return err 10609 + } 10610 + if _, err := cw.WriteString(string("name")); err != nil { 10611 + return err 10612 + } 10613 + 10614 + if len(t.Name) > 1000000 { 10615 + return xerrors.Errorf("Value in field t.Name was too long") 10616 + } 10617 + 10618 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil { 10619 + return err 10620 + } 10621 + if _, err := cw.WriteString(string(t.Name)); err != nil { 10622 + return err 10623 + } 10624 + 10625 + // t.LexiconTypeID (string) (string) 10626 + if len("$type") > 1000000 { 10627 + return xerrors.Errorf("Value in field \"$type\" was too long") 10628 + } 10629 + 10630 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10631 + return err 10632 + } 10633 + if _, err := cw.WriteString(string("$type")); err != nil { 10634 + return err 10635 + } 10636 + 10637 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.workflow.run"))); err != nil { 10638 + return err 10639 + } 10640 + if _, err := cw.WriteString(string("sh.tangled.ci.workflow.run")); err != nil { 10641 + return err 10642 + } 10643 + 10644 + // t.Status (string) (string) 10645 + if len("status") > 1000000 { 10646 + return xerrors.Errorf("Value in field \"status\" was too long") 10647 + } 10648 + 10649 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { 10650 + return err 10651 + } 10652 + if _, err := cw.WriteString(string("status")); err != nil { 10653 + return err 10654 + } 10655 + 10656 + if t.Status == nil { 10657 + if _, err := cw.Write(cbg.CborNull); err != nil { 10658 + return err 10659 + } 10660 + } else { 10661 + if len(*t.Status) > 1000000 { 10662 + return xerrors.Errorf("Value in field t.Status was too long") 10663 + } 10664 + 10665 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Status))); err != nil { 10666 + return err 10667 + } 10668 + if _, err := cw.WriteString(string(*t.Status)); err != nil { 10669 + return err 10670 + } 10671 + } 10672 + 10673 + // t.Adapter (string) (string) 10674 + if len("adapter") > 1000000 { 10675 + return xerrors.Errorf("Value in field \"adapter\" was too long") 10676 + } 10677 + 10678 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("adapter"))); err != nil { 10679 + return err 10680 + } 10681 + if _, err := cw.WriteString(string("adapter")); err != nil { 10682 + return err 10683 + } 10684 + 10685 + if len(t.Adapter) > 1000000 { 10686 + return xerrors.Errorf("Value in field t.Adapter was too long") 10687 + } 10688 + 10689 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Adapter))); err != nil { 10690 + return err 10691 + } 10692 + if _, err := cw.WriteString(string(t.Adapter)); err != nil { 10693 + return err 10694 + } 10695 + return nil 10696 + } 10697 + 10698 + func (t *CiWorkflowRun) UnmarshalCBOR(r io.Reader) (err error) { 10699 + *t = CiWorkflowRun{} 10700 + 10701 + cr := cbg.NewCborReader(r) 10702 + 10703 + maj, extra, err := cr.ReadHeader() 10704 + if err != nil { 10705 + return err 10706 + } 10707 + defer func() { 10708 + if err == io.EOF { 10709 + err = io.ErrUnexpectedEOF 10710 + } 10711 + }() 10712 + 10713 + if maj != cbg.MajMap { 10714 + return fmt.Errorf("cbor input should be of type map") 10715 + } 10716 + 10717 + if extra > cbg.MaxLength { 10718 + return fmt.Errorf("CiWorkflowRun: map struct too large (%d)", extra) 10719 + } 10720 + 10721 + n := extra 10722 + 10723 + nameBuf := make([]byte, 7) 10724 + for i := uint64(0); i < n; i++ { 10725 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10726 + if err != nil { 10727 + return err 10728 + } 10729 + 10730 + if !ok { 10731 + // Field doesn't exist on this type, so ignore it 10732 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10733 + return err 10734 + } 10735 + continue 10736 + } 10737 + 10738 + switch string(nameBuf[:nameLen]) { 10739 + // t.Name (string) (string) 10740 + case "name": 10741 + 10742 + { 10743 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10744 + if err != nil { 10745 + return err 10746 + } 10747 + 10748 + t.Name = string(sval) 10749 + } 10750 + // t.LexiconTypeID (string) (string) 10751 + case "$type": 10752 + 10753 + { 10754 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10755 + if err != nil { 10756 + return err 10757 + } 10758 + 10759 + t.LexiconTypeID = string(sval) 10760 + } 10761 + // t.Status (string) (string) 10762 + case "status": 10763 + 10764 + { 10765 + b, err := cr.ReadByte() 10766 + if err != nil { 10767 + return err 10768 + } 10769 + if b != cbg.CborNull[0] { 10770 + if err := cr.UnreadByte(); err != nil { 10771 + return err 10772 + } 10773 + 10774 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10775 + if err != nil { 10776 + return err 10777 + } 10778 + 10779 + t.Status = (*string)(&sval) 10780 + } 10781 + } 10782 + // t.Adapter (string) (string) 10783 + case "adapter": 10784 + 10785 + { 10786 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10787 + if err != nil { 10788 + return err 10789 + } 10790 + 10791 + t.Adapter = string(sval) 10792 + } 10793 + 10794 + default: 10795 + // Field doesn't exist on this type, so ignore it 10796 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10797 + return err 10798 + } 10799 + } 10800 + } 10801 + 10802 + return nil 10803 + }
+124
api/tangled/cievent.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + // Lexicon schema: sh.tangled.ci.event 4 + 5 + package tangled 6 + 7 + import ( 8 + "bytes" 9 + "encoding/json" 10 + "fmt" 11 + "io" 12 + 13 + lexutil "github.com/bluesky-social/indigo/lex/util" 14 + cbg "github.com/whyrusleeping/cbor-gen" 15 + ) 16 + 17 + const ( 18 + CiEventNSID = "sh.tangled.ci.event" 19 + ) 20 + 21 + // CiEvent is a "main" in the sh.tangled.ci.event schema. 22 + type CiEvent struct { 23 + Meta *CiEvent_Meta `json:"meta" cborgen:"meta"` 24 + } 25 + 26 + // CiEvent_Manual is a "manual" in the sh.tangled.ci.event schema. 27 + type CiEvent_Manual struct { 28 + LexiconTypeID string `json:"$type" cborgen:"$type,const=sh.tangled.ci.event#manual"` 29 + } 30 + 31 + type CiEvent_Meta struct { 32 + CiEvent_PullRequest *CiEvent_PullRequest 33 + CiEvent_Push *CiEvent_Push 34 + CiEvent_Manual *CiEvent_Manual 35 + } 36 + 37 + func (t *CiEvent_Meta) MarshalJSON() ([]byte, error) { 38 + if t.CiEvent_PullRequest != nil { 39 + t.CiEvent_PullRequest.LexiconTypeID = "sh.tangled.ci.event#pullRequest" 40 + return json.Marshal(t.CiEvent_PullRequest) 41 + } 42 + if t.CiEvent_Push != nil { 43 + t.CiEvent_Push.LexiconTypeID = "sh.tangled.ci.event#push" 44 + return json.Marshal(t.CiEvent_Push) 45 + } 46 + if t.CiEvent_Manual != nil { 47 + t.CiEvent_Manual.LexiconTypeID = "sh.tangled.ci.event#manual" 48 + return json.Marshal(t.CiEvent_Manual) 49 + } 50 + return nil, fmt.Errorf("can not marshal empty union as JSON") 51 + } 52 + 53 + func (t *CiEvent_Meta) UnmarshalJSON(b []byte) error { 54 + typ, err := lexutil.TypeExtract(b) 55 + if err != nil { 56 + return err 57 + } 58 + 59 + switch typ { 60 + case "sh.tangled.ci.event#pullRequest": 61 + t.CiEvent_PullRequest = new(CiEvent_PullRequest) 62 + return json.Unmarshal(b, t.CiEvent_PullRequest) 63 + case "sh.tangled.ci.event#push": 64 + t.CiEvent_Push = new(CiEvent_Push) 65 + return json.Unmarshal(b, t.CiEvent_Push) 66 + case "sh.tangled.ci.event#manual": 67 + t.CiEvent_Manual = new(CiEvent_Manual) 68 + return json.Unmarshal(b, t.CiEvent_Manual) 69 + default: 70 + return nil 71 + } 72 + } 73 + 74 + func (t *CiEvent_Meta) MarshalCBOR(w io.Writer) error { 75 + 76 + if t == nil { 77 + _, err := w.Write(cbg.CborNull) 78 + return err 79 + } 80 + if t.CiEvent_PullRequest != nil { 81 + return t.CiEvent_PullRequest.MarshalCBOR(w) 82 + } 83 + if t.CiEvent_Push != nil { 84 + return t.CiEvent_Push.MarshalCBOR(w) 85 + } 86 + if t.CiEvent_Manual != nil { 87 + return t.CiEvent_Manual.MarshalCBOR(w) 88 + } 89 + return fmt.Errorf("can not marshal empty union as CBOR") 90 + } 91 + 92 + func (t *CiEvent_Meta) UnmarshalCBOR(r io.Reader) error { 93 + typ, b, err := lexutil.CborTypeExtractReader(r) 94 + if err != nil { 95 + return err 96 + } 97 + 98 + switch typ { 99 + case "sh.tangled.ci.event#pullRequest": 100 + t.CiEvent_PullRequest = new(CiEvent_PullRequest) 101 + return t.CiEvent_PullRequest.UnmarshalCBOR(bytes.NewReader(b)) 102 + case "sh.tangled.ci.event#push": 103 + t.CiEvent_Push = new(CiEvent_Push) 104 + return t.CiEvent_Push.UnmarshalCBOR(bytes.NewReader(b)) 105 + case "sh.tangled.ci.event#manual": 106 + t.CiEvent_Manual = new(CiEvent_Manual) 107 + return t.CiEvent_Manual.UnmarshalCBOR(bytes.NewReader(b)) 108 + default: 109 + return nil 110 + } 111 + } 112 + 113 + // CiEvent_PullRequest is a "pullRequest" in the sh.tangled.ci.event schema. 114 + type CiEvent_PullRequest struct { 115 + LexiconTypeID string `json:"$type" cborgen:"$type,const=sh.tangled.ci.event#pullRequest"` 116 + } 117 + 118 + // CiEvent_Push is a "push" in the sh.tangled.ci.event schema. 119 + type CiEvent_Push struct { 120 + LexiconTypeID string `json:"$type" cborgen:"$type,const=sh.tangled.ci.event#push"` 121 + NewSha string `json:"newSha" cborgen:"newSha"` 122 + OldSha string `json:"oldSha" cborgen:"oldSha"` 123 + Ref string `json:"ref" cborgen:"ref"` 124 + }
+23
api/tangled/cipipeline.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + // Lexicon schema: sh.tangled.ci.pipeline 4 + 5 + package tangled 6 + 7 + import ( 8 + lexutil "github.com/bluesky-social/indigo/lex/util" 9 + ) 10 + 11 + const ( 12 + CiPipelineNSID = "sh.tangled.ci.pipeline" 13 + ) 14 + 15 + func init() { 16 + lexutil.RegisterType("sh.tangled.ci.pipeline", &CiPipeline{}) 17 + } 18 + 19 + type CiPipeline struct { 20 + LexiconTypeID string `json:"$type" cborgen:"$type,const=sh.tangled.ci.pipeline"` 21 + Event *CiEvent `json:"event" cborgen:"event"` 22 + WorkflowRuns []string `json:"workflowRuns" cborgen:"workflowRuns"` 23 + }
+24
api/tangled/workflowrun.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + // Lexicon schema: sh.tangled.ci.workflow.run 4 + 5 + package tangled 6 + 7 + import ( 8 + lexutil "github.com/bluesky-social/indigo/lex/util" 9 + ) 10 + 11 + const ( 12 + CiWorkflowRunNSID = "sh.tangled.ci.workflow.run" 13 + ) 14 + 15 + func init() { 16 + lexutil.RegisterType("sh.tangled.ci.workflow.run", &CiWorkflowRun{}) 17 + } 18 + 19 + type CiWorkflowRun struct { 20 + LexiconTypeID string `json:"$type" cborgen:"$type,const=sh.tangled.ci.workflow.run"` 21 + Adapter string `json:"adapter" cborgen:"adapter"` 22 + Name string `json:"name" cborgen:"name"` 23 + Status *string `json:"status" cborgen:"status"` 24 + }
+9
api/tangled/workflowstatus.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + // Lexicon schema: sh.tangled.ci.workflow.status 4 + 5 + package tangled 6 + 7 + const ( 8 + CiWorkflowStatusNSID = "sh.tangled.ci.workflow.status" 9 + )
+6
cmd/cborgen/cborgen.go
··· 55 55 tangled.Spindle{}, 56 56 tangled.SpindleMember{}, 57 57 tangled.String{}, 58 + tangled.CiEvent{}, 59 + tangled.CiEvent_PullRequest{}, 60 + tangled.CiEvent_Push{}, 61 + tangled.CiEvent_Manual{}, 62 + tangled.CiPipeline{}, 63 + tangled.CiWorkflowRun{}, 58 64 ); err != nil { 59 65 panic(err) 60 66 }
+57
lexicons/ci/event.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.event", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "object", 9 + "required": [ 10 + "meta" 11 + ], 12 + "properties": { 13 + "meta": { 14 + "type": "union", 15 + "refs": [ 16 + "#pullRequest", 17 + "#push", 18 + "#manual" 19 + ] 20 + } 21 + } 22 + }, 23 + "pullRequest": { 24 + "type": "object", 25 + "required": [], 26 + "properties": {} 27 + }, 28 + "push": { 29 + "type": "object", 30 + "required": [ 31 + "ref", 32 + "oldSha", 33 + "newSha" 34 + ], 35 + "properties": { 36 + "ref": { 37 + "type": "string" 38 + }, 39 + "oldSha": { 40 + "type": "string", 41 + "minLength": 40, 42 + "maxLength": 40 43 + }, 44 + "newSha": { 45 + "type": "string", 46 + "minLength": 40, 47 + "maxLength": 40 48 + } 49 + } 50 + }, 51 + "manual": { 52 + "type": "object", 53 + "required": [], 54 + "properties": {} 55 + } 56 + } 57 + }
+30
lexicons/ci/pipeline.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.pipeline", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "key": "tid", 8 + "record": { 9 + "type": "object", 10 + "required": [ 11 + "event", 12 + "workflowRuns" 13 + ], 14 + "properties": { 15 + "event": { 16 + "type": "ref", 17 + "ref": "sh.tangled.ci.event" 18 + }, 19 + "workflowRuns": { 20 + "type": "array", 21 + "items": { 22 + "type": "string", 23 + "format": "at-uri" 24 + } 25 + } 26 + } 27 + } 28 + } 29 + } 30 + }
+30
lexicons/ci/workflow/run.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.workflow.run", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "key": "tid", 8 + "record": { 9 + "type": "object", 10 + "required": [ 11 + "name", 12 + "adapter", 13 + "status" 14 + ], 15 + "properties": { 16 + "name": { 17 + "type": "string" 18 + }, 19 + "adapter": { 20 + "type": "string" 21 + }, 22 + "status": { 23 + "type": "ref", 24 + "ref": "sh.tangled.ci.workflow.status" 25 + } 26 + } 27 + } 28 + } 29 + } 30 + }
+18
lexicons/ci/workflow/status.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.workflow.status", 4 + "defs": { 5 + "main": { 6 + "type": "string", 7 + "description": "status of the workflow run", 8 + "enum": [ 9 + "pending", 10 + "running", 11 + "failed", 12 + "timeout", 13 + "cancelled", 14 + "success" 15 + ] 16 + } 17 + } 18 + }