A vibe coded tangled fork which supports pijul.

lexicons: add new CI lexicons

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

+1232
+911
api/tangled/cbor_gen.go
··· 9933 9933 9934 9934 return nil 9935 9935 } 9936 + func (t *CiEvent) MarshalCBOR(w io.Writer) error { 9937 + if t == nil { 9938 + _, err := w.Write(cbg.CborNull) 9939 + return err 9940 + } 9941 + 9942 + cw := cbg.NewCborWriter(w) 9943 + 9944 + if _, err := cw.Write([]byte{161}); err != nil { 9945 + return err 9946 + } 9947 + 9948 + // t.Meta (tangled.CiEvent_Meta) (struct) 9949 + if len("meta") > 1000000 { 9950 + return xerrors.Errorf("Value in field \"meta\" was too long") 9951 + } 9952 + 9953 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("meta"))); err != nil { 9954 + return err 9955 + } 9956 + if _, err := cw.WriteString(string("meta")); err != nil { 9957 + return err 9958 + } 9959 + 9960 + if err := t.Meta.MarshalCBOR(cw); err != nil { 9961 + return err 9962 + } 9963 + return nil 9964 + } 9965 + 9966 + func (t *CiEvent) UnmarshalCBOR(r io.Reader) (err error) { 9967 + *t = CiEvent{} 9968 + 9969 + cr := cbg.NewCborReader(r) 9970 + 9971 + maj, extra, err := cr.ReadHeader() 9972 + if err != nil { 9973 + return err 9974 + } 9975 + defer func() { 9976 + if err == io.EOF { 9977 + err = io.ErrUnexpectedEOF 9978 + } 9979 + }() 9980 + 9981 + if maj != cbg.MajMap { 9982 + return fmt.Errorf("cbor input should be of type map") 9983 + } 9984 + 9985 + if extra > cbg.MaxLength { 9986 + return fmt.Errorf("CiEvent: map struct too large (%d)", extra) 9987 + } 9988 + 9989 + n := extra 9990 + 9991 + nameBuf := make([]byte, 4) 9992 + for i := uint64(0); i < n; i++ { 9993 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 9994 + if err != nil { 9995 + return err 9996 + } 9997 + 9998 + if !ok { 9999 + // Field doesn't exist on this type, so ignore it 10000 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10001 + return err 10002 + } 10003 + continue 10004 + } 10005 + 10006 + switch string(nameBuf[:nameLen]) { 10007 + // t.Meta (tangled.CiEvent_Meta) (struct) 10008 + case "meta": 10009 + 10010 + { 10011 + 10012 + b, err := cr.ReadByte() 10013 + if err != nil { 10014 + return err 10015 + } 10016 + if b != cbg.CborNull[0] { 10017 + if err := cr.UnreadByte(); err != nil { 10018 + return err 10019 + } 10020 + t.Meta = new(CiEvent_Meta) 10021 + if err := t.Meta.UnmarshalCBOR(cr); err != nil { 10022 + return xerrors.Errorf("unmarshaling t.Meta pointer: %w", err) 10023 + } 10024 + } 10025 + 10026 + } 10027 + 10028 + default: 10029 + // Field doesn't exist on this type, so ignore it 10030 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10031 + return err 10032 + } 10033 + } 10034 + } 10035 + 10036 + return nil 10037 + } 10038 + func (t *CiEvent_PullRequest) MarshalCBOR(w io.Writer) error { 10039 + if t == nil { 10040 + _, err := w.Write(cbg.CborNull) 10041 + return err 10042 + } 10043 + 10044 + cw := cbg.NewCborWriter(w) 10045 + 10046 + if _, err := cw.Write([]byte{161}); err != nil { 10047 + return err 10048 + } 10049 + 10050 + // t.LexiconTypeID (string) (string) 10051 + if len("$type") > 1000000 { 10052 + return xerrors.Errorf("Value in field \"$type\" was too long") 10053 + } 10054 + 10055 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10056 + return err 10057 + } 10058 + if _, err := cw.WriteString(string("$type")); err != nil { 10059 + return err 10060 + } 10061 + 10062 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.event#pullRequest"))); err != nil { 10063 + return err 10064 + } 10065 + if _, err := cw.WriteString(string("sh.tangled.ci.event#pullRequest")); err != nil { 10066 + return err 10067 + } 10068 + return nil 10069 + } 10070 + 10071 + func (t *CiEvent_PullRequest) UnmarshalCBOR(r io.Reader) (err error) { 10072 + *t = CiEvent_PullRequest{} 10073 + 10074 + cr := cbg.NewCborReader(r) 10075 + 10076 + maj, extra, err := cr.ReadHeader() 10077 + if err != nil { 10078 + return err 10079 + } 10080 + defer func() { 10081 + if err == io.EOF { 10082 + err = io.ErrUnexpectedEOF 10083 + } 10084 + }() 10085 + 10086 + if maj != cbg.MajMap { 10087 + return fmt.Errorf("cbor input should be of type map") 10088 + } 10089 + 10090 + if extra > cbg.MaxLength { 10091 + return fmt.Errorf("CiEvent_PullRequest: map struct too large (%d)", extra) 10092 + } 10093 + 10094 + n := extra 10095 + 10096 + nameBuf := make([]byte, 5) 10097 + for i := uint64(0); i < n; i++ { 10098 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10099 + if err != nil { 10100 + return err 10101 + } 10102 + 10103 + if !ok { 10104 + // Field doesn't exist on this type, so ignore it 10105 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10106 + return err 10107 + } 10108 + continue 10109 + } 10110 + 10111 + switch string(nameBuf[:nameLen]) { 10112 + // t.LexiconTypeID (string) (string) 10113 + case "$type": 10114 + 10115 + { 10116 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10117 + if err != nil { 10118 + return err 10119 + } 10120 + 10121 + t.LexiconTypeID = string(sval) 10122 + } 10123 + 10124 + default: 10125 + // Field doesn't exist on this type, so ignore it 10126 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10127 + return err 10128 + } 10129 + } 10130 + } 10131 + 10132 + return nil 10133 + } 10134 + func (t *CiEvent_Push) MarshalCBOR(w io.Writer) error { 10135 + if t == nil { 10136 + _, err := w.Write(cbg.CborNull) 10137 + return err 10138 + } 10139 + 10140 + cw := cbg.NewCborWriter(w) 10141 + 10142 + if _, err := cw.Write([]byte{164}); err != nil { 10143 + return err 10144 + } 10145 + 10146 + // t.Ref (string) (string) 10147 + if len("ref") > 1000000 { 10148 + return xerrors.Errorf("Value in field \"ref\" was too long") 10149 + } 10150 + 10151 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil { 10152 + return err 10153 + } 10154 + if _, err := cw.WriteString(string("ref")); err != nil { 10155 + return err 10156 + } 10157 + 10158 + if len(t.Ref) > 1000000 { 10159 + return xerrors.Errorf("Value in field t.Ref was too long") 10160 + } 10161 + 10162 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Ref))); err != nil { 10163 + return err 10164 + } 10165 + if _, err := cw.WriteString(string(t.Ref)); err != nil { 10166 + return err 10167 + } 10168 + 10169 + // t.LexiconTypeID (string) (string) 10170 + if len("$type") > 1000000 { 10171 + return xerrors.Errorf("Value in field \"$type\" was too long") 10172 + } 10173 + 10174 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10175 + return err 10176 + } 10177 + if _, err := cw.WriteString(string("$type")); err != nil { 10178 + return err 10179 + } 10180 + 10181 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.event#push"))); err != nil { 10182 + return err 10183 + } 10184 + if _, err := cw.WriteString(string("sh.tangled.ci.event#push")); err != nil { 10185 + return err 10186 + } 10187 + 10188 + // t.NewSha (string) (string) 10189 + if len("newSha") > 1000000 { 10190 + return xerrors.Errorf("Value in field \"newSha\" was too long") 10191 + } 10192 + 10193 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("newSha"))); err != nil { 10194 + return err 10195 + } 10196 + if _, err := cw.WriteString(string("newSha")); err != nil { 10197 + return err 10198 + } 10199 + 10200 + if len(t.NewSha) > 1000000 { 10201 + return xerrors.Errorf("Value in field t.NewSha was too long") 10202 + } 10203 + 10204 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.NewSha))); err != nil { 10205 + return err 10206 + } 10207 + if _, err := cw.WriteString(string(t.NewSha)); err != nil { 10208 + return err 10209 + } 10210 + 10211 + // t.OldSha (string) (string) 10212 + if len("oldSha") > 1000000 { 10213 + return xerrors.Errorf("Value in field \"oldSha\" was too long") 10214 + } 10215 + 10216 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("oldSha"))); err != nil { 10217 + return err 10218 + } 10219 + if _, err := cw.WriteString(string("oldSha")); err != nil { 10220 + return err 10221 + } 10222 + 10223 + if len(t.OldSha) > 1000000 { 10224 + return xerrors.Errorf("Value in field t.OldSha was too long") 10225 + } 10226 + 10227 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.OldSha))); err != nil { 10228 + return err 10229 + } 10230 + if _, err := cw.WriteString(string(t.OldSha)); err != nil { 10231 + return err 10232 + } 10233 + return nil 10234 + } 10235 + 10236 + func (t *CiEvent_Push) UnmarshalCBOR(r io.Reader) (err error) { 10237 + *t = CiEvent_Push{} 10238 + 10239 + cr := cbg.NewCborReader(r) 10240 + 10241 + maj, extra, err := cr.ReadHeader() 10242 + if err != nil { 10243 + return err 10244 + } 10245 + defer func() { 10246 + if err == io.EOF { 10247 + err = io.ErrUnexpectedEOF 10248 + } 10249 + }() 10250 + 10251 + if maj != cbg.MajMap { 10252 + return fmt.Errorf("cbor input should be of type map") 10253 + } 10254 + 10255 + if extra > cbg.MaxLength { 10256 + return fmt.Errorf("CiEvent_Push: map struct too large (%d)", extra) 10257 + } 10258 + 10259 + n := extra 10260 + 10261 + nameBuf := make([]byte, 6) 10262 + for i := uint64(0); i < n; i++ { 10263 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10264 + if err != nil { 10265 + return err 10266 + } 10267 + 10268 + if !ok { 10269 + // Field doesn't exist on this type, so ignore it 10270 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10271 + return err 10272 + } 10273 + continue 10274 + } 10275 + 10276 + switch string(nameBuf[:nameLen]) { 10277 + // t.Ref (string) (string) 10278 + case "ref": 10279 + 10280 + { 10281 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10282 + if err != nil { 10283 + return err 10284 + } 10285 + 10286 + t.Ref = string(sval) 10287 + } 10288 + // t.LexiconTypeID (string) (string) 10289 + case "$type": 10290 + 10291 + { 10292 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10293 + if err != nil { 10294 + return err 10295 + } 10296 + 10297 + t.LexiconTypeID = string(sval) 10298 + } 10299 + // t.NewSha (string) (string) 10300 + case "newSha": 10301 + 10302 + { 10303 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10304 + if err != nil { 10305 + return err 10306 + } 10307 + 10308 + t.NewSha = string(sval) 10309 + } 10310 + // t.OldSha (string) (string) 10311 + case "oldSha": 10312 + 10313 + { 10314 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10315 + if err != nil { 10316 + return err 10317 + } 10318 + 10319 + t.OldSha = string(sval) 10320 + } 10321 + 10322 + default: 10323 + // Field doesn't exist on this type, so ignore it 10324 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10325 + return err 10326 + } 10327 + } 10328 + } 10329 + 10330 + return nil 10331 + } 10332 + func (t *CiEvent_Manual) MarshalCBOR(w io.Writer) error { 10333 + if t == nil { 10334 + _, err := w.Write(cbg.CborNull) 10335 + return err 10336 + } 10337 + 10338 + cw := cbg.NewCborWriter(w) 10339 + 10340 + if _, err := cw.Write([]byte{161}); err != nil { 10341 + return err 10342 + } 10343 + 10344 + // t.LexiconTypeID (string) (string) 10345 + if len("$type") > 1000000 { 10346 + return xerrors.Errorf("Value in field \"$type\" was too long") 10347 + } 10348 + 10349 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10350 + return err 10351 + } 10352 + if _, err := cw.WriteString(string("$type")); err != nil { 10353 + return err 10354 + } 10355 + 10356 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.event#manual"))); err != nil { 10357 + return err 10358 + } 10359 + if _, err := cw.WriteString(string("sh.tangled.ci.event#manual")); err != nil { 10360 + return err 10361 + } 10362 + return nil 10363 + } 10364 + 10365 + func (t *CiEvent_Manual) UnmarshalCBOR(r io.Reader) (err error) { 10366 + *t = CiEvent_Manual{} 10367 + 10368 + cr := cbg.NewCborReader(r) 10369 + 10370 + maj, extra, err := cr.ReadHeader() 10371 + if err != nil { 10372 + return err 10373 + } 10374 + defer func() { 10375 + if err == io.EOF { 10376 + err = io.ErrUnexpectedEOF 10377 + } 10378 + }() 10379 + 10380 + if maj != cbg.MajMap { 10381 + return fmt.Errorf("cbor input should be of type map") 10382 + } 10383 + 10384 + if extra > cbg.MaxLength { 10385 + return fmt.Errorf("CiEvent_Manual: map struct too large (%d)", extra) 10386 + } 10387 + 10388 + n := extra 10389 + 10390 + nameBuf := make([]byte, 5) 10391 + for i := uint64(0); i < n; i++ { 10392 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10393 + if err != nil { 10394 + return err 10395 + } 10396 + 10397 + if !ok { 10398 + // Field doesn't exist on this type, so ignore it 10399 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10400 + return err 10401 + } 10402 + continue 10403 + } 10404 + 10405 + switch string(nameBuf[:nameLen]) { 10406 + // t.LexiconTypeID (string) (string) 10407 + case "$type": 10408 + 10409 + { 10410 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10411 + if err != nil { 10412 + return err 10413 + } 10414 + 10415 + t.LexiconTypeID = string(sval) 10416 + } 10417 + 10418 + default: 10419 + // Field doesn't exist on this type, so ignore it 10420 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10421 + return err 10422 + } 10423 + } 10424 + } 10425 + 10426 + return nil 10427 + } 10428 + func (t *CiPipeline) MarshalCBOR(w io.Writer) error { 10429 + if t == nil { 10430 + _, err := w.Write(cbg.CborNull) 10431 + return err 10432 + } 10433 + 10434 + cw := cbg.NewCborWriter(w) 10435 + 10436 + if _, err := cw.Write([]byte{163}); err != nil { 10437 + return err 10438 + } 10439 + 10440 + // t.LexiconTypeID (string) (string) 10441 + if len("$type") > 1000000 { 10442 + return xerrors.Errorf("Value in field \"$type\" was too long") 10443 + } 10444 + 10445 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10446 + return err 10447 + } 10448 + if _, err := cw.WriteString(string("$type")); err != nil { 10449 + return err 10450 + } 10451 + 10452 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.pipeline"))); err != nil { 10453 + return err 10454 + } 10455 + if _, err := cw.WriteString(string("sh.tangled.ci.pipeline")); err != nil { 10456 + return err 10457 + } 10458 + 10459 + // t.Event (tangled.CiEvent) (struct) 10460 + if len("event") > 1000000 { 10461 + return xerrors.Errorf("Value in field \"event\" was too long") 10462 + } 10463 + 10464 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("event"))); err != nil { 10465 + return err 10466 + } 10467 + if _, err := cw.WriteString(string("event")); err != nil { 10468 + return err 10469 + } 10470 + 10471 + if err := t.Event.MarshalCBOR(cw); err != nil { 10472 + return err 10473 + } 10474 + 10475 + // t.WorkflowRuns ([]string) (slice) 10476 + if len("workflowRuns") > 1000000 { 10477 + return xerrors.Errorf("Value in field \"workflowRuns\" was too long") 10478 + } 10479 + 10480 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflowRuns"))); err != nil { 10481 + return err 10482 + } 10483 + if _, err := cw.WriteString(string("workflowRuns")); err != nil { 10484 + return err 10485 + } 10486 + 10487 + if len(t.WorkflowRuns) > 8192 { 10488 + return xerrors.Errorf("Slice value in field t.WorkflowRuns was too long") 10489 + } 10490 + 10491 + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.WorkflowRuns))); err != nil { 10492 + return err 10493 + } 10494 + for _, v := range t.WorkflowRuns { 10495 + if len(v) > 1000000 { 10496 + return xerrors.Errorf("Value in field v was too long") 10497 + } 10498 + 10499 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil { 10500 + return err 10501 + } 10502 + if _, err := cw.WriteString(string(v)); err != nil { 10503 + return err 10504 + } 10505 + 10506 + } 10507 + return nil 10508 + } 10509 + 10510 + func (t *CiPipeline) UnmarshalCBOR(r io.Reader) (err error) { 10511 + *t = CiPipeline{} 10512 + 10513 + cr := cbg.NewCborReader(r) 10514 + 10515 + maj, extra, err := cr.ReadHeader() 10516 + if err != nil { 10517 + return err 10518 + } 10519 + defer func() { 10520 + if err == io.EOF { 10521 + err = io.ErrUnexpectedEOF 10522 + } 10523 + }() 10524 + 10525 + if maj != cbg.MajMap { 10526 + return fmt.Errorf("cbor input should be of type map") 10527 + } 10528 + 10529 + if extra > cbg.MaxLength { 10530 + return fmt.Errorf("CiPipeline: map struct too large (%d)", extra) 10531 + } 10532 + 10533 + n := extra 10534 + 10535 + nameBuf := make([]byte, 12) 10536 + for i := uint64(0); i < n; i++ { 10537 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10538 + if err != nil { 10539 + return err 10540 + } 10541 + 10542 + if !ok { 10543 + // Field doesn't exist on this type, so ignore it 10544 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10545 + return err 10546 + } 10547 + continue 10548 + } 10549 + 10550 + switch string(nameBuf[:nameLen]) { 10551 + // t.LexiconTypeID (string) (string) 10552 + case "$type": 10553 + 10554 + { 10555 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10556 + if err != nil { 10557 + return err 10558 + } 10559 + 10560 + t.LexiconTypeID = string(sval) 10561 + } 10562 + // t.Event (tangled.CiEvent) (struct) 10563 + case "event": 10564 + 10565 + { 10566 + 10567 + b, err := cr.ReadByte() 10568 + if err != nil { 10569 + return err 10570 + } 10571 + if b != cbg.CborNull[0] { 10572 + if err := cr.UnreadByte(); err != nil { 10573 + return err 10574 + } 10575 + t.Event = new(CiEvent) 10576 + if err := t.Event.UnmarshalCBOR(cr); err != nil { 10577 + return xerrors.Errorf("unmarshaling t.Event pointer: %w", err) 10578 + } 10579 + } 10580 + 10581 + } 10582 + // t.WorkflowRuns ([]string) (slice) 10583 + case "workflowRuns": 10584 + 10585 + maj, extra, err = cr.ReadHeader() 10586 + if err != nil { 10587 + return err 10588 + } 10589 + 10590 + if extra > 8192 { 10591 + return fmt.Errorf("t.WorkflowRuns: array too large (%d)", extra) 10592 + } 10593 + 10594 + if maj != cbg.MajArray { 10595 + return fmt.Errorf("expected cbor array") 10596 + } 10597 + 10598 + if extra > 0 { 10599 + t.WorkflowRuns = make([]string, extra) 10600 + } 10601 + 10602 + for i := 0; i < int(extra); i++ { 10603 + { 10604 + var maj byte 10605 + var extra uint64 10606 + var err error 10607 + _ = maj 10608 + _ = extra 10609 + _ = err 10610 + 10611 + { 10612 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10613 + if err != nil { 10614 + return err 10615 + } 10616 + 10617 + t.WorkflowRuns[i] = string(sval) 10618 + } 10619 + 10620 + } 10621 + } 10622 + 10623 + default: 10624 + // Field doesn't exist on this type, so ignore it 10625 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10626 + return err 10627 + } 10628 + } 10629 + } 10630 + 10631 + return nil 10632 + } 10633 + func (t *CiWorkflowRun) MarshalCBOR(w io.Writer) error { 10634 + if t == nil { 10635 + _, err := w.Write(cbg.CborNull) 10636 + return err 10637 + } 10638 + 10639 + cw := cbg.NewCborWriter(w) 10640 + 10641 + if _, err := cw.Write([]byte{164}); err != nil { 10642 + return err 10643 + } 10644 + 10645 + // t.Name (string) (string) 10646 + if len("name") > 1000000 { 10647 + return xerrors.Errorf("Value in field \"name\" was too long") 10648 + } 10649 + 10650 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil { 10651 + return err 10652 + } 10653 + if _, err := cw.WriteString(string("name")); err != nil { 10654 + return err 10655 + } 10656 + 10657 + if len(t.Name) > 1000000 { 10658 + return xerrors.Errorf("Value in field t.Name was too long") 10659 + } 10660 + 10661 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil { 10662 + return err 10663 + } 10664 + if _, err := cw.WriteString(string(t.Name)); err != nil { 10665 + return err 10666 + } 10667 + 10668 + // t.LexiconTypeID (string) (string) 10669 + if len("$type") > 1000000 { 10670 + return xerrors.Errorf("Value in field \"$type\" was too long") 10671 + } 10672 + 10673 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 10674 + return err 10675 + } 10676 + if _, err := cw.WriteString(string("$type")); err != nil { 10677 + return err 10678 + } 10679 + 10680 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.workflow.run"))); err != nil { 10681 + return err 10682 + } 10683 + if _, err := cw.WriteString(string("sh.tangled.ci.workflow.run")); err != nil { 10684 + return err 10685 + } 10686 + 10687 + // t.Status (string) (string) 10688 + if len("status") > 1000000 { 10689 + return xerrors.Errorf("Value in field \"status\" was too long") 10690 + } 10691 + 10692 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { 10693 + return err 10694 + } 10695 + if _, err := cw.WriteString(string("status")); err != nil { 10696 + return err 10697 + } 10698 + 10699 + if t.Status == nil { 10700 + if _, err := cw.Write(cbg.CborNull); err != nil { 10701 + return err 10702 + } 10703 + } else { 10704 + if len(*t.Status) > 1000000 { 10705 + return xerrors.Errorf("Value in field t.Status was too long") 10706 + } 10707 + 10708 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Status))); err != nil { 10709 + return err 10710 + } 10711 + if _, err := cw.WriteString(string(*t.Status)); err != nil { 10712 + return err 10713 + } 10714 + } 10715 + 10716 + // t.Adapter (string) (string) 10717 + if len("adapter") > 1000000 { 10718 + return xerrors.Errorf("Value in field \"adapter\" was too long") 10719 + } 10720 + 10721 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("adapter"))); err != nil { 10722 + return err 10723 + } 10724 + if _, err := cw.WriteString(string("adapter")); err != nil { 10725 + return err 10726 + } 10727 + 10728 + if len(t.Adapter) > 1000000 { 10729 + return xerrors.Errorf("Value in field t.Adapter was too long") 10730 + } 10731 + 10732 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Adapter))); err != nil { 10733 + return err 10734 + } 10735 + if _, err := cw.WriteString(string(t.Adapter)); err != nil { 10736 + return err 10737 + } 10738 + return nil 10739 + } 10740 + 10741 + func (t *CiWorkflowRun) UnmarshalCBOR(r io.Reader) (err error) { 10742 + *t = CiWorkflowRun{} 10743 + 10744 + cr := cbg.NewCborReader(r) 10745 + 10746 + maj, extra, err := cr.ReadHeader() 10747 + if err != nil { 10748 + return err 10749 + } 10750 + defer func() { 10751 + if err == io.EOF { 10752 + err = io.ErrUnexpectedEOF 10753 + } 10754 + }() 10755 + 10756 + if maj != cbg.MajMap { 10757 + return fmt.Errorf("cbor input should be of type map") 10758 + } 10759 + 10760 + if extra > cbg.MaxLength { 10761 + return fmt.Errorf("CiWorkflowRun: map struct too large (%d)", extra) 10762 + } 10763 + 10764 + n := extra 10765 + 10766 + nameBuf := make([]byte, 7) 10767 + for i := uint64(0); i < n; i++ { 10768 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 10769 + if err != nil { 10770 + return err 10771 + } 10772 + 10773 + if !ok { 10774 + // Field doesn't exist on this type, so ignore it 10775 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 10776 + return err 10777 + } 10778 + continue 10779 + } 10780 + 10781 + switch string(nameBuf[:nameLen]) { 10782 + // t.Name (string) (string) 10783 + case "name": 10784 + 10785 + { 10786 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10787 + if err != nil { 10788 + return err 10789 + } 10790 + 10791 + t.Name = string(sval) 10792 + } 10793 + // t.LexiconTypeID (string) (string) 10794 + case "$type": 10795 + 10796 + { 10797 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10798 + if err != nil { 10799 + return err 10800 + } 10801 + 10802 + t.LexiconTypeID = string(sval) 10803 + } 10804 + // t.Status (string) (string) 10805 + case "status": 10806 + 10807 + { 10808 + b, err := cr.ReadByte() 10809 + if err != nil { 10810 + return err 10811 + } 10812 + if b != cbg.CborNull[0] { 10813 + if err := cr.UnreadByte(); err != nil { 10814 + return err 10815 + } 10816 + 10817 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10818 + if err != nil { 10819 + return err 10820 + } 10821 + 10822 + t.Status = (*string)(&sval) 10823 + } 10824 + } 10825 + // t.Adapter (string) (string) 10826 + case "adapter": 10827 + 10828 + { 10829 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 10830 + if err != nil { 10831 + return err 10832 + } 10833 + 10834 + t.Adapter = string(sval) 10835 + } 10836 + 10837 + default: 10838 + // Field doesn't exist on this type, so ignore it 10839 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 10840 + return err 10841 + } 10842 + } 10843 + } 10844 + 10845 + return nil 10846 + }
+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 + }