diff --git a/CLAUDE.md b/CLAUDE.md index 6c6d7c9be..ffa9033e0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -79,6 +79,12 @@ cargo fmt 2. **Code Generation**: Run `go generate ./...` after modifying ent schemas, GraphQL, or frontend 3. **Rust Formatting**: Always run `cargo fmt` - CI will fail without it 4. **Linear History**: Use squash merge for PRs +5. **Generated Files**: Never manually edit generated files. Key generated files include: + - `tavern/internal/graphql/models/gqlgen_models.go` (generated by gqlgen) + - `tavern/internal/graphql/generated/*.go` (generated by gqlgen) + - `tavern/internal/ent/*.go` (generated by ent) + - `tavern/internal/builder/builderpb/*.pb.go` (generated by protoc) + - Run `go generate ./tavern/...` to regenerate after schema changes ## Documentation Structure diff --git a/go.mod b/go.mod index f29997710..fe122c28d 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/99designs/gqlgen v0.17.86 github.com/caddyserver/certmagic v0.25.1 github.com/cloudflare/circl v1.6.1 + github.com/docker/docker v28.5.2+incompatible github.com/go-sql-driver/mysql v1.9.3 github.com/golang-jwt/jwt/v5 v5.3.1 github.com/google/go-cmp v0.7.0 @@ -26,7 +27,7 @@ require ( github.com/vektah/gqlparser/v2 v2.5.31 go.opencensus.io v0.24.0 golang.org/x/crypto v0.47.0 - golang.org/x/net v0.48.0 + golang.org/x/net v0.49.0 golang.org/x/oauth2 v0.32.0 golang.org/x/sync v0.19.0 google.golang.org/api v0.247.0 @@ -45,7 +46,13 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/ProtonMail/go-crypto v1.1.6 // indirect github.com/caddyserver/zerossl v0.1.4 // indirect + github.com/containerd/errdefs v1.0.0 // indirect + github.com/containerd/errdefs/pkg v0.3.0 // indirect + github.com/containerd/log v0.1.0 // indirect github.com/cyphar/filepath-securejoin v0.4.1 // indirect + github.com/distribution/reference v0.6.0 // indirect + github.com/docker/go-connections v0.6.0 // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect @@ -68,8 +75,15 @@ require ( github.com/libdns/libdns v1.1.1 // indirect github.com/mholt/acmez/v3 v3.1.4 // indirect github.com/miekg/dns v1.1.69 // indirect + github.com/moby/docker-image-spec v1.3.1 // indirect + github.com/moby/sys/atomicwriter v0.1.0 // indirect + github.com/moby/term v0.5.2 // indirect + github.com/morikuni/aec v1.1.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.1 // indirect github.com/pjbgf/sha1cd v0.3.2 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/statsd_exporter v0.22.7 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/skeema/knownhosts v1.3.1 // indirect @@ -79,18 +93,19 @@ require ( go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect - go.opentelemetry.io/otel v1.38.0 // indirect - go.opentelemetry.io/otel/metric v1.38.0 // indirect - go.opentelemetry.io/otel/sdk v1.38.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect - go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.opentelemetry.io/otel v1.40.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 // indirect + go.opentelemetry.io/otel/metric v1.40.0 // indirect + go.opentelemetry.io/otel/sdk v1.40.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.40.0 // indirect + go.opentelemetry.io/otel/trace v1.40.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.1 // indirect go.uber.org/zap/exp v0.3.0 // indirect golang.org/x/time v0.12.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect google.golang.org/genproto v0.0.0-20250715232539-7130f93afb79 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) @@ -128,5 +143,5 @@ require ( golang.org/x/sys v0.40.0 // indirect golang.org/x/text v0.33.0 // indirect golang.org/x/tools v0.40.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect ) diff --git a/go.sum b/go.sum index 86a329071..8cfef2219 100644 --- a/go.sum +++ b/go.sum @@ -61,6 +61,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/gqlgen v0.17.86 h1:C8N3UTa5heXX6twl+b0AJyGkTwYL6dNmFrgZNLRcU6w= github.com/99designs/gqlgen v0.17.86/go.mod h1:KTrPl+vHA1IUzNlh4EYkl7+tcErL3MgKnhHrBcV74Fw= +github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg= +github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= @@ -128,6 +130,8 @@ github.com/caddyserver/certmagic v0.25.1 h1:4sIKKbOt5pg6+sL7tEwymE1x2bj6CHr80da1 github.com/caddyserver/certmagic v0.25.1/go.mod h1:VhyvndxtVton/Fo/wKhRoC46Rbw1fmjvQ3GjHYSQTEY= github.com/caddyserver/zerossl v0.1.4 h1:CVJOE3MZeFisCERZjkxIcsqIH4fnFdlYWnPYeFtBHRw= github.com/caddyserver/zerossl v0.1.4/go.mod h1:CxA0acn7oEGO6//4rtrRjYgEoa4MFw/XofZnrYwGqG4= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -142,6 +146,12 @@ github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f h1:Y8xYupdHxryycyPlc9Y+bSQAYZnetRJ70VMVKm5CKI0= github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f/go.mod h1:HlzOvOjVBOfTGSRXRyY0OiCS/3J1akRGQQpRO/7zyF4= +github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= +github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= +github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= +github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= @@ -152,6 +162,14 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7cNTs5R6Hk4V2lcmLz2NsG2VnInyNo= github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM= +github.com/docker/docker v28.5.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94= +github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o= github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= @@ -290,6 +308,8 @@ github.com/googleapis/gax-go/v2 v2.15.0 h1:SyjDc1mGgZU5LncH8gimWo9lW1DtIfPibOG81 github.com/googleapis/gax-go/v2 v2.15.0/go.mod h1:zVVkkxAQHa1RQpg9z2AUCMnKhi0Qld9rcmyfL1OZhoc= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -343,17 +363,31 @@ github.com/miekg/dns v1.1.69 h1:Kb7Y/1Jo+SG+a2GtfoFUfDkG//csdRPwRLkCsxDG9Sc= github.com/miekg/dns v1.1.69/go.mod h1:7OyjD9nEba5OkqQ/hB4fy3PIoxafSZJtducccIelz3g= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= +github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw= +github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs= +github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= +github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= +github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= +github.com/moby/term v0.5.2/go.mod h1:d3djjFCrjnB+fl8NJux+EJzu0msscUP+f8it8hPkFLc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/morikuni/aec v1.1.0 h1:vBBl0pUnvi/Je71dsRrhMBtreIqNMYErSAbEeb8jrXQ= +github.com/morikuni/aec v1.1.0/go.mod h1:xDRgiq/iw5l+zkao76YTKzKttOp2cwPEne25HDkJnBw= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= +github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4= github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -412,6 +446,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= @@ -471,16 +507,22 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.6 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0/go.mod h1:ru6KHrNtNHxM4nD/vd6QrLVWgKhxPYgblq4VAtNawTQ= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0/go.mod h1:NfchwuyNoMcZ5MLHwPrODwUF1HWCXWrL31s8gSAdIKY= -go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= -go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= -go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= -go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= -go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= -go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= -go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= -go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= -go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= -go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms= +go.opentelemetry.io/otel v1.40.0/go.mod h1:IMb+uXZUKkMXdPddhwAHm6UfOwJyh4ct1ybIlV14J0g= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 h1:QKdN8ly8zEMrByybbQgv8cWBcdAarwmIPZ6FThrWXJs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0/go.mod h1:bTdK1nhqF76qiPoCCdyFIV+N/sRHYXYCTQc+3VCi3MI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 h1:wVZXIWjQSeSmMoxF74LzAnpVQOAFDo3pPji9Y4SOFKc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0/go.mod h1:khvBS2IggMFNwZK/6lEeHg/W57h/IX6J4URh57fuI40= +go.opentelemetry.io/otel/metric v1.40.0 h1:rcZe317KPftE2rstWIBitCdVp89A2HqjkxR3c11+p9g= +go.opentelemetry.io/otel/metric v1.40.0/go.mod h1:ib/crwQH7N3r5kfiBZQbwrTge743UDc7DTFVZrrXnqc= +go.opentelemetry.io/otel/sdk v1.40.0 h1:KHW/jUzgo6wsPh9At46+h4upjtccTmuZCFAc9OJ71f8= +go.opentelemetry.io/otel/sdk v1.40.0/go.mod h1:Ph7EFdYvxq72Y8Li9q8KebuYUr2KoeyHx0DRMKrYBUE= +go.opentelemetry.io/otel/sdk/metric v1.40.0 h1:mtmdVqgQkeRxHgRv4qhyJduP3fYJRMX4AtAlbuWdCYw= +go.opentelemetry.io/otel/sdk/metric v1.40.0/go.mod h1:4Z2bGMf0KSK3uRjlczMOeMhKU2rhUqdWNoKcYrtcBPg= +go.opentelemetry.io/otel/trace v1.40.0 h1:WA4etStDttCSYuhwvEa8OP8I5EWu24lkOzp+ZYblVjw= +go.opentelemetry.io/otel/trace v1.40.0/go.mod h1:zeAhriXecNGP/s2SEG3+Y8X9ujcJOTqQ5RgdEJcawiA= +go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= +go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -567,8 +609,8 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= -golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= +golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -758,10 +800,10 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20250715232539-7130f93afb79 h1:Nt6z9UHqSlIdIGJdz6KhTIs2VRx/iOsA5iE8bmQNcxs= google.golang.org/genproto v0.0.0-20250715232539-7130f93afb79/go.mod h1:kTmlBHMPqR5uCZPBvwa2B18mvubkjyY3CRLI0c6fj0s= -google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda h1:+2XxjfsAu6vqFxwGBRcHiMaDCuZiqXGDUDVWVtrFAnE= -google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda h1:i/Q+bfisr7gq6feoJnS/DlpdwEL4ihp41fvRiM3Ork0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409/go.mod h1:fl8J1IvUjCilwZzQowmw2b7HQB2eAuYBabMXzWurF+I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/tavern/app.go b/tavern/app.go index 98d2f5226..1f73f6276 100644 --- a/tavern/app.go +++ b/tavern/app.go @@ -27,6 +27,7 @@ import ( "realm.pub/tavern/internal/auth" "realm.pub/tavern/internal/builder" "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/builder/executor" "realm.pub/tavern/internal/c2" "realm.pub/tavern/internal/c2/c2pb" "realm.pub/tavern/internal/cdn" @@ -163,7 +164,12 @@ func newApp(ctx context.Context) (app *cli.App) { "supported_targets", cfg.SupportedTargets, ) - return builder.Run(ctx, cfg) + exec, err := executor.NewDockerExecutorFromEnv(ctx) + if err != nil { + return fmt.Errorf("failed to create docker executor: %w", err) + } + + return builder.Run(ctx, cfg, exec) }, }, } @@ -266,6 +272,14 @@ func NewServer(ctx context.Context, options ...func(*Config)) (*Server, error) { return nil, fmt.Errorf("failed to initialize builder CA: %w", err) } + // Get server X25519 public key for agent builds + serverX25519PubKey, err := GetPubKey() + if err != nil { + client.Close() + return nil, fmt.Errorf("failed to get server X25519 public key: %w", err) + } + serverPubkeyB64 := base64.StdEncoding.EncodeToString(serverX25519PubKey.Bytes()) + // Initialize Test Data if cfg.IsTestDataEnabled() { createTestData(ctx, client) @@ -337,7 +351,7 @@ func NewServer(ctx context.Context, options ...func(*Config)) (*Server, error) { Handler: newPortalGRPCHandler(client, portalMux), }, "/builder.Builder/": tavernhttp.Endpoint{ - Handler: newBuilderGRPCHandler(client, builderCACert), + Handler: newBuilderGRPCHandler(client, builderCACert, serverPubkeyB64), AllowUnauthenticated: true, AllowUnactivated: true, }, @@ -584,14 +598,17 @@ func newPortalGRPCHandler(graph *ent.Client, portalMux *mux.Mux) http.Handler { }) } -func newBuilderGRPCHandler(client *ent.Client, caCert *x509.Certificate) http.Handler { - builderSrv := builder.New(client) +func newBuilderGRPCHandler(client *ent.Client, caCert *x509.Certificate, serverPubkey string) http.Handler { + builderSrv := builder.New(client, serverPubkey) grpcSrv := grpc.NewServer( grpc.ChainUnaryInterceptor( builder.NewMTLSAuthInterceptor(caCert, client), grpcWithUnaryMetrics, ), - grpc.StreamInterceptor(grpcWithStreamMetrics), + grpc.ChainStreamInterceptor( + builder.NewMTLSStreamAuthInterceptor(caCert, client), + grpcWithStreamMetrics, + ), ) builderpb.RegisterBuilderServer(grpcSrv, builderSrv) return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/tavern/internal/builder/README.md b/tavern/internal/builder/README.md index 1d914a279..cfc6e6e06 100644 --- a/tavern/internal/builder/README.md +++ b/tavern/internal/builder/README.md @@ -6,7 +6,9 @@ The builder package orchestrates agent compilation for target platforms. It conn - **Registration**: Builders register with Tavern via the `registerBuilder` GraphQL mutation, which returns an mTLS certificate signed by the Tavern Builder CA and a YAML configuration file. - **mTLS Authentication**: All gRPC requests are authenticated using application-level mTLS. The builder presents its CA-signed certificate and a signed timestamp in gRPC metadata on each request. The server verifies the certificate chain, proof of private key possession, and looks up the builder by the identifier embedded in the certificate CN. -- **gRPC API**: Builders communicate with Tavern over gRPC at the `/builder.Builder/` route. Currently supports a `Ping` health check endpoint. +- **gRPC API**: Builders communicate with Tavern over gRPC at the `/builder.Builder/` route. Supports `ClaimBuildTasks` (poll for unclaimed tasks), `StreamBuildTaskOutput` (stream build output and exit code incrementally), and `UploadBuildArtifact` (upload compiled binaries). +- **Builder Management**: Builders are queryable via the `builders` GraphQL query (paginated, filterable, orderable by `LAST_SEEN_AT`) and removable via `deleteBuilder`. Deleting a builder cascade-deletes its build tasks. The `last_seen_at` field is updated on each `ClaimBuildTasks` call. +- **Executor**: Build tasks are executed via the `executor.Executor` interface. The `DockerExecutor` runs builds inside Docker containers; the `MockExecutor` is used in tests. - **CLI**: Run a builder using the `builder` subcommand with a `--config` flag pointing to a YAML configuration file. ## Configuration @@ -54,15 +56,92 @@ upstream: go run ./tavern builder --config /path/to/builder-config.yaml ``` +## Streaming Build Output + +The `StreamBuildTaskOutput` RPC uses client-streaming to send build output incrementally. +The builder sends one message per output/error line as the executor produces them, and each +message is flushed to the database immediately. The final message sets `finished=true` and +includes the container's `exit_code` to signal completion. The server persists both +`finished_at` and `exit_code` on the build task. The `started_at` timestamp is set when +the first message is received. If the stream is interrupted before `finished=true`, partial +output is preserved but `finished_at` and `exit_code` are not set. + +## Build Task Defaults + +The `createBuildTask` mutation requires only `targetOS`. All other fields have sensible +defaults resolved server-side: + +| Field | Default | Notes | +|-------|---------|-------| +| `targetFormat` | `BIN` | Can also be `CDYLIB` or `WINDOWS_SERVICE` (Windows only) | +| `buildImage` | `spellshift/devcontainer:main` | Docker image for the build container | +| `callbackURI` | `http://127.0.0.1:8000` | IMIX agent callback address | +| `interval` | `5` | Callback interval in seconds | +| `transportType` | `TRANSPORT_GRPC` | IMIX agent transport | +| `artifactPath` | Derived from `targetOS` | Path inside the container to extract the compiled binary | + +## Artifact Extraction + +Build tasks can specify an `artifact_path` field — the path inside the container where the +compiled binary or output file is written. If not specified, it is derived from the target +OS (e.g. `/home/vscode/realm/implants/target/x86_64-unknown-linux-musl/release/imix` for +Linux). When the build finishes successfully, the `DockerExecutor` copies the file from +the stopped container using Docker's `CopyFromContainer` API (which returns a tar archive), +extracts the first regular file, and returns the bytes in `BuildResult`. The builder client +then streams the artifact to Tavern via the `UploadBuildArtifact` RPC in 1 MB chunks. The +server creates an `Asset` entity. The artifact is downloadable via the existing CDN endpoint +at `GET /assets/download/{name}`. + + +### Fix +- Debug why the second job in a parallel set of builds never finished + +### Architectural +- Add a way for the server to interrupt and cancel a build. +- Add support for build caching between jobs (will speed up rust builds a lot) +- Instead of assuming `/home/vscode` create a correctly permissioned build dir +- Add support for mulitple transports in the builder + + +### future +- Register redirectors so bulider callback uri can be a drop down. +- Modifying the agent IMIX_CONFIG currently requires changes to both imix and tavern code bases now. Is there a way to codegen a YAML spec from tavern to the agent? +- De-dupe agent builds should the API stop builds that have the same params and point to the existing build? Or is this a UI thing? + + +### Planning +- Change exit Code to a bool and rename to errored to make API querying easier +- Change exit Code to a bool and rename to errored to +- Where should realm source code be pulled? + - which version'd copy of the code to checkout + - Can we automatically determine which version / main,edge the server is and pass that ot the build script. + - Ship tavern with imix source code embedded? + - Hard for teams to bring their own changes. + +- Update schema for UX + - Target OS + Target Format ---> rust target + - TargetOS's only support certain formats + - where to get the realm source code from - pull public repo? + - Currentt pattern with arbitrary bulid script is RCE as a service. Scope and limit this to just build configuration options. + - upstream should be free form + - pubkey can be set by the server + + ## Package Structure | File | Purpose | |------|---------| -| `auth.go` | gRPC unary interceptor for mTLS authentication | +| `auth.go` | gRPC unary and stream interceptors for mTLS authentication | +| `build_config.go` | Build defaults, target formats, IMIX config, build script generation | | `ca.go` | Builder CA generation, persistence, and certificate signing | -| `client.go` | Builder client with `PerRPCCredentials` for mTLS auth | +| `client.go` | Builder client: mTLS credentials, polling loop, task execution | | `config.go` | YAML configuration parsing and validation | -| `server.go` | gRPC server implementation (Ping) | +| `server.go` | gRPC server: `ClaimBuildTasks`, `StreamBuildTaskOutput`, `UploadBuildArtifact` | +| `rollback.go` | Transaction rollback helper (matches c2 pattern) | +| `executor/executor.go` | `Executor` interface, `BuildSpec`, and `BuildResult` definitions | +| `executor/docker.go` | `DockerExecutor`: runs builds in Docker containers | +| `executor/mock.go` | `MockExecutor`: test double for unit tests | | `proto/builder.proto` | Protobuf service definition | | `builderpb/` | Generated protobuf Go code | -| `integration_test.go` | End-to-end test covering registration, mTLS auth, and unauthenticated rejection | +| `integration_test.go` | End-to-end test: registration, mTLS auth, task claiming | +| `executor_integration_test.go` | End-to-end test: claim → execute → submit flow | diff --git a/tavern/internal/builder/auth.go b/tavern/internal/builder/auth.go index eb85a6a6a..9059bd467 100644 --- a/tavern/internal/builder/auth.go +++ b/tavern/internal/builder/auth.go @@ -39,6 +39,79 @@ func BuilderFromContext(ctx context.Context) (*ent.Builder, bool) { return b, ok } +// authenticateBuilder extracts and validates mTLS credentials from gRPC metadata, +// returning a context enriched with the authenticated builder entity. +func authenticateBuilder(ctx context.Context, caCert *x509.Certificate, graph *ent.Client) (context.Context, error) { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil, status.Error(codes.Unauthenticated, "missing metadata") + } + + // Extract metadata values. + // Binary metadata (keys ending in "-bin") is automatically base64 decoded by gRPC. + certDER := getMetadataValue(md, mdKeyBuilderCert) + signature := getMetadataValue(md, mdKeyBuilderSignature) + timestamp := getMetadataValue(md, mdKeyBuilderTimestamp) + + if certDER == "" || signature == "" || timestamp == "" { + return nil, status.Error(codes.Unauthenticated, "missing builder credentials") + } + + // Parse the certificate + cert, err := x509.ParseCertificate([]byte(certDER)) + if err != nil { + return nil, status.Error(codes.Unauthenticated, "invalid certificate") + } + + // Verify certificate was signed by our CA + if err := cert.CheckSignatureFrom(caCert); err != nil { + return nil, status.Error(codes.Unauthenticated, "certificate not signed by trusted CA") + } + + // Verify certificate validity period + now := time.Now() + if now.Before(cert.NotBefore) || now.After(cert.NotAfter) { + return nil, status.Error(codes.Unauthenticated, "certificate expired or not yet valid") + } + + // Verify timestamp freshness + ts, err := time.Parse(time.RFC3339Nano, timestamp) + if err != nil { + return nil, status.Error(codes.Unauthenticated, "invalid timestamp format") + } + if now.Sub(ts).Abs() > maxTimestampAge { + return nil, status.Error(codes.Unauthenticated, "timestamp too old or too far in the future") + } + + // Verify signature (proof of private key possession) + pubKey, ok := cert.PublicKey.(ed25519.PublicKey) + if !ok { + return nil, status.Error(codes.Unauthenticated, "certificate does not contain ED25519 public key") + } + if !ed25519.Verify(pubKey, []byte(timestamp), []byte(signature)) { + return nil, status.Error(codes.Unauthenticated, "invalid signature") + } + + // Extract builder identifier from CN + cn := cert.Subject.CommonName + if !strings.HasPrefix(cn, builderCNPrefix) { + return nil, status.Error(codes.Unauthenticated, "invalid certificate CN format") + } + identifier := strings.TrimPrefix(cn, builderCNPrefix) + + // Look up builder in database + b, err := graph.Builder.Query().Where(entbuilder.IdentifierEQ(identifier)).Only(ctx) + if err != nil { + slog.WarnContext(ctx, "builder authentication failed: builder not found", "identifier", identifier, "error", err) + return nil, status.Error(codes.Unauthenticated, "builder not found") + } + + slog.InfoContext(ctx, "builder authenticated", "builder_id", b.ID, "identifier", identifier) + + // Store builder in context for downstream handlers + return context.WithValue(ctx, builderContextKey{}, b), nil +} + // NewMTLSAuthInterceptor creates a gRPC unary server interceptor that validates // builder mTLS credentials. It verifies: // 1. The certificate was signed by the provided CA @@ -47,76 +120,34 @@ func BuilderFromContext(ctx context.Context) (*ent.Builder, bool) { // 4. The builder identifier from the CN exists in the database func NewMTLSAuthInterceptor(caCert *x509.Certificate, graph *ent.Client) grpc.UnaryServerInterceptor { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - md, ok := metadata.FromIncomingContext(ctx) - if !ok { - return nil, status.Error(codes.Unauthenticated, "missing metadata") - } - - // Extract metadata values. - // Binary metadata (keys ending in "-bin") is automatically base64 decoded by gRPC. - certDER := getMetadataValue(md, mdKeyBuilderCert) - signature := getMetadataValue(md, mdKeyBuilderSignature) - timestamp := getMetadataValue(md, mdKeyBuilderTimestamp) - - if certDER == "" || signature == "" || timestamp == "" { - return nil, status.Error(codes.Unauthenticated, "missing builder credentials") - } - - // Parse the certificate - cert, err := x509.ParseCertificate([]byte(certDER)) - if err != nil { - return nil, status.Error(codes.Unauthenticated, "invalid certificate") - } - - // Verify certificate was signed by our CA - if err := cert.CheckSignatureFrom(caCert); err != nil { - return nil, status.Error(codes.Unauthenticated, "certificate not signed by trusted CA") - } - - // Verify certificate validity period - now := time.Now() - if now.Before(cert.NotBefore) || now.After(cert.NotAfter) { - return nil, status.Error(codes.Unauthenticated, "certificate expired or not yet valid") - } - - // Verify timestamp freshness - ts, err := time.Parse(time.RFC3339Nano, timestamp) + authCtx, err := authenticateBuilder(ctx, caCert, graph) if err != nil { - return nil, status.Error(codes.Unauthenticated, "invalid timestamp format") + return nil, err } - if now.Sub(ts).Abs() > maxTimestampAge { - return nil, status.Error(codes.Unauthenticated, "timestamp too old or too far in the future") - } - - // Verify signature (proof of private key possession) - pubKey, ok := cert.PublicKey.(ed25519.PublicKey) - if !ok { - return nil, status.Error(codes.Unauthenticated, "certificate does not contain ED25519 public key") - } - if !ed25519.Verify(pubKey, []byte(timestamp), []byte(signature)) { - return nil, status.Error(codes.Unauthenticated, "invalid signature") - } - - // Extract builder identifier from CN - cn := cert.Subject.CommonName - if !strings.HasPrefix(cn, builderCNPrefix) { - return nil, status.Error(codes.Unauthenticated, "invalid certificate CN format") - } - identifier := strings.TrimPrefix(cn, builderCNPrefix) + return handler(authCtx, req) + } +} - // Look up builder in database - b, err := graph.Builder.Query().Where(entbuilder.IdentifierEQ(identifier)).Only(ctx) +// NewMTLSStreamAuthInterceptor creates a gRPC stream server interceptor that validates +// builder mTLS credentials. It uses the same authentication logic as the unary interceptor. +func NewMTLSStreamAuthInterceptor(caCert *x509.Certificate, graph *ent.Client) grpc.StreamServerInterceptor { + return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { + authCtx, err := authenticateBuilder(ss.Context(), caCert, graph) if err != nil { - slog.WarnContext(ctx, "builder authentication failed: builder not found", "identifier", identifier, "error", err) - return nil, status.Error(codes.Unauthenticated, "builder not found") + return err } + return handler(srv, &wrappedServerStream{ServerStream: ss, ctx: authCtx}) + } +} - slog.InfoContext(ctx, "builder authenticated", "builder_id", b.ID, "identifier", identifier) +// wrappedServerStream wraps a grpc.ServerStream to override its Context(). +type wrappedServerStream struct { + grpc.ServerStream + ctx context.Context +} - // Store builder in context for downstream handlers - ctx = context.WithValue(ctx, builderContextKey{}, b) - return handler(ctx, req) - } +func (w *wrappedServerStream) Context() context.Context { + return w.ctx } func getMetadataValue(md metadata.MD, key string) string { diff --git a/tavern/internal/builder/build_config.go b/tavern/internal/builder/build_config.go new file mode 100644 index 000000000..f514f487c --- /dev/null +++ b/tavern/internal/builder/build_config.go @@ -0,0 +1,153 @@ +package builder + +import ( + "fmt" + "strings" + + "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/c2/c2pb" +) + +const ( + // DefaultRealmRepoURL is the default git repository URL for building realm agents. + DefaultRealmRepoURL = "https://github.com/spellshift/realm.git" + + // DefaultInterval is the default callback interval in seconds for the IMIX agent. + DefaultInterval = 5 + + // DefaultCallbackURI is the default callback URI for the IMIX agent, + // derived from the IMIX compile-time default (IMIX_CALLBACK_URI). + DefaultCallbackURI = "http://127.0.0.1:8000" + + // DefaultTransportType is the default transport type for the IMIX agent, + // derived from the IMIX default behavior for http:// URIs. + DefaultTransportType = c2pb.Transport_TRANSPORT_GRPC + + // DefaultBuildImage is the default Docker image for building agents. + DefaultBuildImage = "spellshift/devcontainer:main" + + // DefaultTargetFormat is the default output format for builds. + DefaultTargetFormat = builderpb.TargetFormat_TARGET_FORMAT_BIN +) + +// TargetFormat is an alias for builderpb.TargetFormat. +type TargetFormat = builderpb.TargetFormat + +const ( + TargetFormatBin = builderpb.TargetFormat_TARGET_FORMAT_BIN + TargetFormatCdylib = builderpb.TargetFormat_TARGET_FORMAT_CDYLIB + TargetFormatWindowsService = builderpb.TargetFormat_TARGET_FORMAT_WINDOWS_SERVICE +) + +// SupportedFormats maps each target OS to its supported output formats. +var SupportedFormats = map[c2pb.Host_Platform][]TargetFormat{ + c2pb.Host_PLATFORM_LINUX: {TargetFormatBin}, + c2pb.Host_PLATFORM_WINDOWS: {TargetFormatBin, TargetFormatCdylib, TargetFormatWindowsService}, + c2pb.Host_PLATFORM_MACOS: {TargetFormatBin}, +} + +// buildTarget maps target OS to the Rust --target triple. +var buildTarget = map[c2pb.Host_Platform]string{ + c2pb.Host_PLATFORM_LINUX: "x86_64-unknown-linux-musl", + c2pb.Host_PLATFORM_WINDOWS: "x86_64-pc-windows-gnu", + c2pb.Host_PLATFORM_MACOS: "aarch64-apple-darwin", +} + +type buildKey struct { + OS c2pb.Host_Platform + Format TargetFormat +} + +// buildCommands maps (target_os, target_format) -> cargo build command. +var buildCommands = map[buildKey]string{ + {c2pb.Host_PLATFORM_LINUX, TargetFormatBin}: "cargo build --release --bin imix --target=x86_64-unknown-linux-musl", + {c2pb.Host_PLATFORM_MACOS, TargetFormatBin}: "cargo zigbuild --release --target aarch64-apple-darwin", + {c2pb.Host_PLATFORM_WINDOWS, TargetFormatBin}: "cargo build --release --target=x86_64-pc-windows-gnu", + {c2pb.Host_PLATFORM_WINDOWS, TargetFormatWindowsService}: "cargo build --release --features win_service --target=x86_64-pc-windows-gnu", + {c2pb.Host_PLATFORM_WINDOWS, TargetFormatCdylib}: "cargo build --release --lib --target=x86_64-pc-windows-gnu", +} + +// ValidateTargetFormat checks whether the given format is supported for the given OS. +func ValidateTargetFormat(os c2pb.Host_Platform, format TargetFormat) error { + formats, ok := SupportedFormats[os] + if !ok { + return fmt.Errorf("unsupported target OS: %s", os.String()) + } + for _, f := range formats { + if f == format { + return nil + } + } + supported := make([]string, len(formats)) + for i, f := range formats { + supported[i] = f.String() + } + return fmt.Errorf("target format %q is not supported for %s (supported: %s)", format.String(), os.String(), strings.Join(supported, ", ")) +} + +// BuildCommand returns the cargo build command for the given OS and format. +func BuildCommand(os c2pb.Host_Platform, format TargetFormat) (string, error) { + cmd, ok := buildCommands[buildKey{os, format}] + if !ok { + return "", fmt.Errorf("no build command for %s + %s", os.String(), format.String()) + } + return cmd, nil +} + +// TransportTypeToString converts a c2pb.Transport_Type to the lowercase string +// used in the IMIX agent configuration YAML. +func TransportTypeToString(t c2pb.Transport_Type) string { + switch t { + case c2pb.Transport_TRANSPORT_GRPC: + return "grpc" + case c2pb.Transport_TRANSPORT_HTTP1: + return "http" + case c2pb.Transport_TRANSPORT_DNS: + return "dns" + default: + return "unspecified" + } +} + +// ImixTransportConfig represents the transport section of the IMIX configuration. +type ImixTransportConfig struct { + URI string `yaml:"URI"` + Interval int `yaml:"interval"` + Type string `yaml:"type"` + Extra string `yaml:"extra"` +} + +// ImixConfig represents the IMIX agent configuration YAML. +type ImixConfig struct { + ServerPubkey string `yaml:"server_pubkey"` + Transports []ImixTransportConfig `yaml:"transports"` +} + +// DeriveArtifactPath returns the artifact path inside the build container +// based on the target OS. +func DeriveArtifactPath(os c2pb.Host_Platform) string { + target, ok := buildTarget[os] + if !ok { + return "/home/vscode/realm/implants/target/release/imix" + } + return fmt.Sprintf("/home/vscode/realm/implants/target/%s/release/imix", target) +} + +// GenerateBuildScript generates the full build script from the build configuration. +// It clones the repository and runs the build command. The IMIX configuration +// is passed via the IMIX_CONFIG environment variable rather than being written +// to a file in the build script. +func GenerateBuildScript(os c2pb.Host_Platform, format TargetFormat) (string, error) { + buildCmd, err := BuildCommand(os, format) + if err != nil { + return "", err + } + + script := fmt.Sprintf( + `cd /home/vscode && git clone %s realm && cd realm/implants/imix && %s`, + DefaultRealmRepoURL, + buildCmd, + ) + + return script, nil +} diff --git a/tavern/internal/builder/builderpb/builder.pb.go b/tavern/internal/builder/builderpb/builder.pb.go index 40d023ccc..9b043509a 100644 --- a/tavern/internal/builder/builderpb/builder.pb.go +++ b/tavern/internal/builder/builderpb/builder.pb.go @@ -21,26 +21,78 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type PingRequest struct { +type TargetFormat int32 + +const ( + TargetFormat_TARGET_FORMAT_UNSPECIFIED TargetFormat = 0 + TargetFormat_TARGET_FORMAT_BIN TargetFormat = 1 + TargetFormat_TARGET_FORMAT_CDYLIB TargetFormat = 2 + TargetFormat_TARGET_FORMAT_WINDOWS_SERVICE TargetFormat = 3 +) + +// Enum value maps for TargetFormat. +var ( + TargetFormat_name = map[int32]string{ + 0: "TARGET_FORMAT_UNSPECIFIED", + 1: "TARGET_FORMAT_BIN", + 2: "TARGET_FORMAT_CDYLIB", + 3: "TARGET_FORMAT_WINDOWS_SERVICE", + } + TargetFormat_value = map[string]int32{ + "TARGET_FORMAT_UNSPECIFIED": 0, + "TARGET_FORMAT_BIN": 1, + "TARGET_FORMAT_CDYLIB": 2, + "TARGET_FORMAT_WINDOWS_SERVICE": 3, + } +) + +func (x TargetFormat) Enum() *TargetFormat { + p := new(TargetFormat) + *p = x + return p +} + +func (x TargetFormat) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TargetFormat) Descriptor() protoreflect.EnumDescriptor { + return file_builder_proto_enumTypes[0].Descriptor() +} + +func (TargetFormat) Type() protoreflect.EnumType { + return &file_builder_proto_enumTypes[0] +} + +func (x TargetFormat) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TargetFormat.Descriptor instead. +func (TargetFormat) EnumDescriptor() ([]byte, []int) { + return file_builder_proto_rawDescGZIP(), []int{0} +} + +type ClaimBuildTasksRequest struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *PingRequest) Reset() { - *x = PingRequest{} +func (x *ClaimBuildTasksRequest) Reset() { + *x = ClaimBuildTasksRequest{} mi := &file_builder_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *PingRequest) String() string { +func (x *ClaimBuildTasksRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PingRequest) ProtoMessage() {} +func (*ClaimBuildTasksRequest) ProtoMessage() {} -func (x *PingRequest) ProtoReflect() protoreflect.Message { +func (x *ClaimBuildTasksRequest) ProtoReflect() protoreflect.Message { mi := &file_builder_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -52,31 +104,37 @@ func (x *PingRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PingRequest.ProtoReflect.Descriptor instead. -func (*PingRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ClaimBuildTasksRequest.ProtoReflect.Descriptor instead. +func (*ClaimBuildTasksRequest) Descriptor() ([]byte, []int) { return file_builder_proto_rawDescGZIP(), []int{0} } -type PingResponse struct { +type BuildTaskSpec struct { state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + TargetOs string `protobuf:"bytes,2,opt,name=target_os,json=targetOs,proto3" json:"target_os,omitempty"` + BuildImage string `protobuf:"bytes,3,opt,name=build_image,json=buildImage,proto3" json:"build_image,omitempty"` + BuildScript string `protobuf:"bytes,4,opt,name=build_script,json=buildScript,proto3" json:"build_script,omitempty"` + ArtifactPath string `protobuf:"bytes,6,opt,name=artifact_path,json=artifactPath,proto3" json:"artifact_path,omitempty"` + Env []string `protobuf:"bytes,7,rep,name=env,proto3" json:"env,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *PingResponse) Reset() { - *x = PingResponse{} +func (x *BuildTaskSpec) Reset() { + *x = BuildTaskSpec{} mi := &file_builder_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *PingResponse) String() string { +func (x *BuildTaskSpec) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PingResponse) ProtoMessage() {} +func (*BuildTaskSpec) ProtoMessage() {} -func (x *PingResponse) ProtoReflect() protoreflect.Message { +func (x *BuildTaskSpec) ProtoReflect() protoreflect.Message { mi := &file_builder_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -88,25 +146,390 @@ func (x *PingResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PingResponse.ProtoReflect.Descriptor instead. -func (*PingResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use BuildTaskSpec.ProtoReflect.Descriptor instead. +func (*BuildTaskSpec) Descriptor() ([]byte, []int) { return file_builder_proto_rawDescGZIP(), []int{1} } +func (x *BuildTaskSpec) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *BuildTaskSpec) GetTargetOs() string { + if x != nil { + return x.TargetOs + } + return "" +} + +func (x *BuildTaskSpec) GetBuildImage() string { + if x != nil { + return x.BuildImage + } + return "" +} + +func (x *BuildTaskSpec) GetBuildScript() string { + if x != nil { + return x.BuildScript + } + return "" +} + +func (x *BuildTaskSpec) GetArtifactPath() string { + if x != nil { + return x.ArtifactPath + } + return "" +} + +func (x *BuildTaskSpec) GetEnv() []string { + if x != nil { + return x.Env + } + return nil +} + +type ClaimBuildTasksResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tasks []*BuildTaskSpec `protobuf:"bytes,1,rep,name=tasks,proto3" json:"tasks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClaimBuildTasksResponse) Reset() { + *x = ClaimBuildTasksResponse{} + mi := &file_builder_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClaimBuildTasksResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClaimBuildTasksResponse) ProtoMessage() {} + +func (x *ClaimBuildTasksResponse) ProtoReflect() protoreflect.Message { + mi := &file_builder_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClaimBuildTasksResponse.ProtoReflect.Descriptor instead. +func (*ClaimBuildTasksResponse) Descriptor() ([]byte, []int) { + return file_builder_proto_rawDescGZIP(), []int{2} +} + +func (x *ClaimBuildTasksResponse) GetTasks() []*BuildTaskSpec { + if x != nil { + return x.Tasks + } + return nil +} + +type StreamBuildTaskOutputRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` + Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` + Finished bool `protobuf:"varint,4,opt,name=finished,proto3" json:"finished,omitempty"` + ExitCode int64 `protobuf:"varint,5,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StreamBuildTaskOutputRequest) Reset() { + *x = StreamBuildTaskOutputRequest{} + mi := &file_builder_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StreamBuildTaskOutputRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamBuildTaskOutputRequest) ProtoMessage() {} + +func (x *StreamBuildTaskOutputRequest) ProtoReflect() protoreflect.Message { + mi := &file_builder_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamBuildTaskOutputRequest.ProtoReflect.Descriptor instead. +func (*StreamBuildTaskOutputRequest) Descriptor() ([]byte, []int) { + return file_builder_proto_rawDescGZIP(), []int{3} +} + +func (x *StreamBuildTaskOutputRequest) GetTaskId() int64 { + if x != nil { + return x.TaskId + } + return 0 +} + +func (x *StreamBuildTaskOutputRequest) GetOutput() string { + if x != nil { + return x.Output + } + return "" +} + +func (x *StreamBuildTaskOutputRequest) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +func (x *StreamBuildTaskOutputRequest) GetFinished() bool { + if x != nil { + return x.Finished + } + return false +} + +func (x *StreamBuildTaskOutputRequest) GetExitCode() int64 { + if x != nil { + return x.ExitCode + } + return 0 +} + +type StreamBuildTaskOutputResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StreamBuildTaskOutputResponse) Reset() { + *x = StreamBuildTaskOutputResponse{} + mi := &file_builder_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StreamBuildTaskOutputResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamBuildTaskOutputResponse) ProtoMessage() {} + +func (x *StreamBuildTaskOutputResponse) ProtoReflect() protoreflect.Message { + mi := &file_builder_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamBuildTaskOutputResponse.ProtoReflect.Descriptor instead. +func (*StreamBuildTaskOutputResponse) Descriptor() ([]byte, []int) { + return file_builder_proto_rawDescGZIP(), []int{4} +} + +type UploadBuildArtifactRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + ArtifactName string `protobuf:"bytes,2,opt,name=artifact_name,json=artifactName,proto3" json:"artifact_name,omitempty"` + Chunk []byte `protobuf:"bytes,3,opt,name=chunk,proto3" json:"chunk,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UploadBuildArtifactRequest) Reset() { + *x = UploadBuildArtifactRequest{} + mi := &file_builder_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UploadBuildArtifactRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadBuildArtifactRequest) ProtoMessage() {} + +func (x *UploadBuildArtifactRequest) ProtoReflect() protoreflect.Message { + mi := &file_builder_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UploadBuildArtifactRequest.ProtoReflect.Descriptor instead. +func (*UploadBuildArtifactRequest) Descriptor() ([]byte, []int) { + return file_builder_proto_rawDescGZIP(), []int{5} +} + +func (x *UploadBuildArtifactRequest) GetTaskId() int64 { + if x != nil { + return x.TaskId + } + return 0 +} + +func (x *UploadBuildArtifactRequest) GetArtifactName() string { + if x != nil { + return x.ArtifactName + } + return "" +} + +func (x *UploadBuildArtifactRequest) GetChunk() []byte { + if x != nil { + return x.Chunk + } + return nil +} + +type UploadBuildArtifactResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + AssetId int64 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UploadBuildArtifactResponse) Reset() { + *x = UploadBuildArtifactResponse{} + mi := &file_builder_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UploadBuildArtifactResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadBuildArtifactResponse) ProtoMessage() {} + +func (x *UploadBuildArtifactResponse) ProtoReflect() protoreflect.Message { + mi := &file_builder_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UploadBuildArtifactResponse.ProtoReflect.Descriptor instead. +func (*UploadBuildArtifactResponse) Descriptor() ([]byte, []int) { + return file_builder_proto_rawDescGZIP(), []int{6} +} + +func (x *UploadBuildArtifactResponse) GetAssetId() int64 { + if x != nil { + return x.AssetId + } + return 0 +} + var File_builder_proto protoreflect.FileDescriptor var file_builder_proto_rawDesc = string([]byte{ 0x0a, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x22, 0x0d, 0x0a, 0x0b, 0x50, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x0e, 0x0a, 0x0c, 0x50, 0x69, 0x6e, 0x67, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x40, 0x0a, 0x07, 0x42, 0x75, 0x69, 0x6c, 0x64, - 0x65, 0x72, 0x12, 0x35, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x2e, 0x62, 0x75, 0x69, - 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x15, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2d, 0x5a, 0x2b, 0x72, 0x65, 0x61, - 0x6c, 0x6d, 0x2e, 0x70, 0x75, 0x62, 0x2f, 0x74, 0x61, 0x76, 0x65, 0x72, 0x6e, 0x2f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2f, 0x62, - 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x22, 0x18, 0x0a, 0x16, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0xb7, 0x01, 0x0a, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, + 0x53, 0x70, 0x65, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6f, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4f, + 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x53, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, + 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x72, + 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, + 0x76, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, 0x76, 0x22, 0x47, 0x0a, 0x17, + 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, + 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x70, 0x65, 0x63, 0x52, 0x05, + 0x74, 0x61, 0x73, 0x6b, 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x1c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1a, 0x0a, + 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x78, 0x69, + 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x65, 0x78, + 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x1f, 0x0a, 0x1d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x70, 0x0a, 0x1a, 0x55, 0x70, 0x6c, 0x6f, 0x61, + 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x23, + 0x0a, 0x0d, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0x38, 0x0a, 0x1b, 0x55, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x73, 0x73, 0x65, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x73, 0x73, 0x65, + 0x74, 0x49, 0x64, 0x2a, 0x81, 0x01, 0x0a, 0x0c, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x46, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x12, 0x1d, 0x0a, 0x19, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x46, + 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x46, 0x4f, + 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x42, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x54, 0x41, + 0x52, 0x47, 0x45, 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x43, 0x44, 0x59, 0x4c, + 0x49, 0x42, 0x10, 0x02, 0x12, 0x21, 0x0a, 0x1d, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x46, + 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x53, 0x45, + 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x03, 0x32, 0xb3, 0x02, 0x0a, 0x07, 0x42, 0x75, 0x69, 0x6c, + 0x64, 0x65, 0x72, 0x12, 0x56, 0x0a, 0x0f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x75, 0x69, 0x6c, + 0x64, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x1f, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, + 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, + 0x72, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6a, 0x0a, 0x15, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, + 0x74, 0x70, 0x75, 0x74, 0x12, 0x25, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, + 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x69, 0x6c, + 0x64, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x12, 0x64, 0x0a, 0x13, 0x55, 0x70, 0x6c, 0x6f, 0x61, + 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x23, + 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, + 0x75, 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x55, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x42, 0x2d, 0x5a, + 0x2b, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x2e, 0x70, 0x75, 0x62, 0x2f, 0x74, 0x61, 0x76, 0x65, 0x72, + 0x6e, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x65, 0x72, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, }) var ( @@ -121,19 +544,31 @@ func file_builder_proto_rawDescGZIP() []byte { return file_builder_proto_rawDescData } -var file_builder_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_builder_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_builder_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_builder_proto_goTypes = []any{ - (*PingRequest)(nil), // 0: builder.PingRequest - (*PingResponse)(nil), // 1: builder.PingResponse + (TargetFormat)(0), // 0: builder.TargetFormat + (*ClaimBuildTasksRequest)(nil), // 1: builder.ClaimBuildTasksRequest + (*BuildTaskSpec)(nil), // 2: builder.BuildTaskSpec + (*ClaimBuildTasksResponse)(nil), // 3: builder.ClaimBuildTasksResponse + (*StreamBuildTaskOutputRequest)(nil), // 4: builder.StreamBuildTaskOutputRequest + (*StreamBuildTaskOutputResponse)(nil), // 5: builder.StreamBuildTaskOutputResponse + (*UploadBuildArtifactRequest)(nil), // 6: builder.UploadBuildArtifactRequest + (*UploadBuildArtifactResponse)(nil), // 7: builder.UploadBuildArtifactResponse } var file_builder_proto_depIdxs = []int32{ - 0, // 0: builder.Builder.Ping:input_type -> builder.PingRequest - 1, // 1: builder.Builder.Ping:output_type -> builder.PingResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 2, // 0: builder.ClaimBuildTasksResponse.tasks:type_name -> builder.BuildTaskSpec + 1, // 1: builder.Builder.ClaimBuildTasks:input_type -> builder.ClaimBuildTasksRequest + 4, // 2: builder.Builder.StreamBuildTaskOutput:input_type -> builder.StreamBuildTaskOutputRequest + 6, // 3: builder.Builder.UploadBuildArtifact:input_type -> builder.UploadBuildArtifactRequest + 3, // 4: builder.Builder.ClaimBuildTasks:output_type -> builder.ClaimBuildTasksResponse + 5, // 5: builder.Builder.StreamBuildTaskOutput:output_type -> builder.StreamBuildTaskOutputResponse + 7, // 6: builder.Builder.UploadBuildArtifact:output_type -> builder.UploadBuildArtifactResponse + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_builder_proto_init() } @@ -146,13 +581,14 @@ func file_builder_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_builder_proto_rawDesc), len(file_builder_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, + NumEnums: 1, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, GoTypes: file_builder_proto_goTypes, DependencyIndexes: file_builder_proto_depIdxs, + EnumInfos: file_builder_proto_enumTypes, MessageInfos: file_builder_proto_msgTypes, }.Build() File_builder_proto = out.File diff --git a/tavern/internal/builder/builderpb/builder_grpc.pb.go b/tavern/internal/builder/builderpb/builder_grpc.pb.go index febce446b..e1e3e13ca 100644 --- a/tavern/internal/builder/builderpb/builder_grpc.pb.go +++ b/tavern/internal/builder/builderpb/builder_grpc.pb.go @@ -19,14 +19,18 @@ import ( const _ = grpc.SupportPackageIsVersion8 const ( - Builder_Ping_FullMethodName = "/builder.Builder/Ping" + Builder_ClaimBuildTasks_FullMethodName = "/builder.Builder/ClaimBuildTasks" + Builder_StreamBuildTaskOutput_FullMethodName = "/builder.Builder/StreamBuildTaskOutput" + Builder_UploadBuildArtifact_FullMethodName = "/builder.Builder/UploadBuildArtifact" ) // BuilderClient is the client API for Builder service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type BuilderClient interface { - Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) + ClaimBuildTasks(ctx context.Context, in *ClaimBuildTasksRequest, opts ...grpc.CallOption) (*ClaimBuildTasksResponse, error) + StreamBuildTaskOutput(ctx context.Context, opts ...grpc.CallOption) (Builder_StreamBuildTaskOutputClient, error) + UploadBuildArtifact(ctx context.Context, opts ...grpc.CallOption) (Builder_UploadBuildArtifactClient, error) } type builderClient struct { @@ -37,21 +41,93 @@ func NewBuilderClient(cc grpc.ClientConnInterface) BuilderClient { return &builderClient{cc} } -func (c *builderClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) { +func (c *builderClient) ClaimBuildTasks(ctx context.Context, in *ClaimBuildTasksRequest, opts ...grpc.CallOption) (*ClaimBuildTasksResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(PingResponse) - err := c.cc.Invoke(ctx, Builder_Ping_FullMethodName, in, out, cOpts...) + out := new(ClaimBuildTasksResponse) + err := c.cc.Invoke(ctx, Builder_ClaimBuildTasks_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } +func (c *builderClient) StreamBuildTaskOutput(ctx context.Context, opts ...grpc.CallOption) (Builder_StreamBuildTaskOutputClient, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Builder_ServiceDesc.Streams[0], Builder_StreamBuildTaskOutput_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &builderStreamBuildTaskOutputClient{ClientStream: stream} + return x, nil +} + +type Builder_StreamBuildTaskOutputClient interface { + Send(*StreamBuildTaskOutputRequest) error + CloseAndRecv() (*StreamBuildTaskOutputResponse, error) + grpc.ClientStream +} + +type builderStreamBuildTaskOutputClient struct { + grpc.ClientStream +} + +func (x *builderStreamBuildTaskOutputClient) Send(m *StreamBuildTaskOutputRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *builderStreamBuildTaskOutputClient) CloseAndRecv() (*StreamBuildTaskOutputResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(StreamBuildTaskOutputResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *builderClient) UploadBuildArtifact(ctx context.Context, opts ...grpc.CallOption) (Builder_UploadBuildArtifactClient, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Builder_ServiceDesc.Streams[1], Builder_UploadBuildArtifact_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &builderUploadBuildArtifactClient{ClientStream: stream} + return x, nil +} + +type Builder_UploadBuildArtifactClient interface { + Send(*UploadBuildArtifactRequest) error + CloseAndRecv() (*UploadBuildArtifactResponse, error) + grpc.ClientStream +} + +type builderUploadBuildArtifactClient struct { + grpc.ClientStream +} + +func (x *builderUploadBuildArtifactClient) Send(m *UploadBuildArtifactRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *builderUploadBuildArtifactClient) CloseAndRecv() (*UploadBuildArtifactResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(UploadBuildArtifactResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // BuilderServer is the server API for Builder service. // All implementations must embed UnimplementedBuilderServer // for forward compatibility type BuilderServer interface { - Ping(context.Context, *PingRequest) (*PingResponse, error) + ClaimBuildTasks(context.Context, *ClaimBuildTasksRequest) (*ClaimBuildTasksResponse, error) + StreamBuildTaskOutput(Builder_StreamBuildTaskOutputServer) error + UploadBuildArtifact(Builder_UploadBuildArtifactServer) error mustEmbedUnimplementedBuilderServer() } @@ -59,8 +135,14 @@ type BuilderServer interface { type UnimplementedBuilderServer struct { } -func (UnimplementedBuilderServer) Ping(context.Context, *PingRequest) (*PingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +func (UnimplementedBuilderServer) ClaimBuildTasks(context.Context, *ClaimBuildTasksRequest) (*ClaimBuildTasksResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClaimBuildTasks not implemented") +} +func (UnimplementedBuilderServer) StreamBuildTaskOutput(Builder_StreamBuildTaskOutputServer) error { + return status.Errorf(codes.Unimplemented, "method StreamBuildTaskOutput not implemented") +} +func (UnimplementedBuilderServer) UploadBuildArtifact(Builder_UploadBuildArtifactServer) error { + return status.Errorf(codes.Unimplemented, "method UploadBuildArtifact not implemented") } func (UnimplementedBuilderServer) mustEmbedUnimplementedBuilderServer() {} @@ -75,24 +157,76 @@ func RegisterBuilderServer(s grpc.ServiceRegistrar, srv BuilderServer) { s.RegisterService(&Builder_ServiceDesc, srv) } -func _Builder_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PingRequest) +func _Builder_ClaimBuildTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClaimBuildTasksRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(BuilderServer).Ping(ctx, in) + return srv.(BuilderServer).ClaimBuildTasks(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Builder_Ping_FullMethodName, + FullMethod: Builder_ClaimBuildTasks_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).Ping(ctx, req.(*PingRequest)) + return srv.(BuilderServer).ClaimBuildTasks(ctx, req.(*ClaimBuildTasksRequest)) } return interceptor(ctx, in, info, handler) } +func _Builder_StreamBuildTaskOutput_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(BuilderServer).StreamBuildTaskOutput(&builderStreamBuildTaskOutputServer{ServerStream: stream}) +} + +type Builder_StreamBuildTaskOutputServer interface { + SendAndClose(*StreamBuildTaskOutputResponse) error + Recv() (*StreamBuildTaskOutputRequest, error) + grpc.ServerStream +} + +type builderStreamBuildTaskOutputServer struct { + grpc.ServerStream +} + +func (x *builderStreamBuildTaskOutputServer) SendAndClose(m *StreamBuildTaskOutputResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *builderStreamBuildTaskOutputServer) Recv() (*StreamBuildTaskOutputRequest, error) { + m := new(StreamBuildTaskOutputRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Builder_UploadBuildArtifact_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(BuilderServer).UploadBuildArtifact(&builderUploadBuildArtifactServer{ServerStream: stream}) +} + +type Builder_UploadBuildArtifactServer interface { + SendAndClose(*UploadBuildArtifactResponse) error + Recv() (*UploadBuildArtifactRequest, error) + grpc.ServerStream +} + +type builderUploadBuildArtifactServer struct { + grpc.ServerStream +} + +func (x *builderUploadBuildArtifactServer) SendAndClose(m *UploadBuildArtifactResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *builderUploadBuildArtifactServer) Recv() (*UploadBuildArtifactRequest, error) { + m := new(UploadBuildArtifactRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // Builder_ServiceDesc is the grpc.ServiceDesc for Builder service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -101,10 +235,21 @@ var Builder_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*BuilderServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "Ping", - Handler: _Builder_Ping_Handler, + MethodName: "ClaimBuildTasks", + Handler: _Builder_ClaimBuildTasks_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamBuildTaskOutput", + Handler: _Builder_StreamBuildTaskOutput_Handler, + ClientStreams: true, + }, + { + StreamName: "UploadBuildArtifact", + Handler: _Builder_UploadBuildArtifact_Handler, + ClientStreams: true, }, }, - Streams: []grpc.StreamDesc{}, Metadata: "builder.proto", } diff --git a/tavern/internal/builder/builderpb/enum_target_format.go b/tavern/internal/builder/builderpb/enum_target_format.go new file mode 100644 index 000000000..a21c49a2c --- /dev/null +++ b/tavern/internal/builder/builderpb/enum_target_format.go @@ -0,0 +1,64 @@ +package builderpb + +import ( + "database/sql/driver" + "io" + "sort" + + "github.com/99designs/gqlgen/graphql" +) + +// Values provides list valid values for Enum. +func (TargetFormat) Values() []string { + values := make([]string, 0, len(TargetFormat_name)) + for _, name := range TargetFormat_name { + values = append(values, name) + } + sort.Strings(values) + return values +} + +// Value provides the DB a string from int. +func (f TargetFormat) Value() (driver.Value, error) { + return f.String(), nil +} + +// Scan tells our code how to read the enum into our type. +func (f *TargetFormat) Scan(val any) error { + var name string + switch v := val.(type) { + case nil: + return nil + case string: + name = v + case []uint8: + name = string(v) + default: + *f = TargetFormat_TARGET_FORMAT_UNSPECIFIED + return nil + } + + status, ok := TargetFormat_value[name] + if !ok { + *f = TargetFormat_TARGET_FORMAT_UNSPECIFIED + return nil + } + *f = TargetFormat(status) + + return nil +} + +// MarshalGQL writes a formatted string value for GraphQL. +func (f TargetFormat) MarshalGQL(w io.Writer) { + graphql.MarshalString(f.String()).MarshalGQL(w) +} + +// UnmarshalGQL parses a GraphQL string representation into the enum. +func (f *TargetFormat) UnmarshalGQL(v interface{}) error { + str, err := graphql.UnmarshalString(v) + if err != nil { + return err + } + + return f.Scan(str) +} diff --git a/tavern/internal/builder/client.go b/tavern/internal/builder/client.go index 3d310d63d..4bc6d99f7 100644 --- a/tavern/internal/builder/client.go +++ b/tavern/internal/builder/client.go @@ -9,11 +9,24 @@ import ( "log/slog" "time" + "golang.org/x/sync/semaphore" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/builder/executor" +) + +const ( + // taskPollInterval is how often the builder polls for new build tasks. + taskPollInterval = 5 * time.Second + + // maxConcurrentBuilds is the maximum number of builds that can run simultaneously. + maxConcurrentBuilds = 4 + + maxOutputChSize = 64 + maxErrorChSize = 64 ) // builderCredentials implements grpc.PerRPCCredentials for mTLS authentication. @@ -92,8 +105,10 @@ func parseMTLSCredentials(mtlsPEM string) (*builderCredentials, error) { } // Run starts the builder process using the provided configuration. -// It connects to the configured upstream server with mTLS credentials and sends a ping request. -func Run(ctx context.Context, cfg *Config) error { +// It connects to the configured upstream server with mTLS credentials, +// then enters a polling loop to claim and execute build tasks using the +// provided executor. +func Run(ctx context.Context, cfg *Config, exec executor.Executor) error { slog.InfoContext(ctx, "builder started", "id", cfg.ID, "supported_targets", cfg.SupportedTargets, @@ -115,14 +130,208 @@ func Run(ctx context.Context, cfg *Config) error { defer conn.Close() client := builderpb.NewBuilderClient(conn) - _, err = client.Ping(ctx, &builderpb.PingRequest{}) + + // Semaphore limits concurrent builds. + sem := semaphore.NewWeighted(maxConcurrentBuilds) + + // Check for tasks immediately, then poll on interval + if err := claimAndExecuteTasks(ctx, client, exec, sem); err != nil { + slog.ErrorContext(ctx, "error processing build tasks", "error", err) + } + + ticker := time.NewTicker(taskPollInterval) + defer ticker.Stop() + + for { + select { + case <-ctx.Done(): + // Wait for all in-flight builds to finish by acquiring all slots. + //nolint:errcheck // context is already cancelled; use background to drain. + sem.Acquire(context.Background(), maxConcurrentBuilds) + return ctx.Err() + case <-ticker.C: + if err := claimAndExecuteTasks(ctx, client, exec, sem); err != nil { + slog.ErrorContext(ctx, "error processing build tasks", "error", err) + } + } + } +} + +func claimAndExecuteTasks(ctx context.Context, client builderpb.BuilderClient, exec executor.Executor, sem *semaphore.Weighted) error { + resp, err := client.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + if err != nil { + return fmt.Errorf("failed to claim build tasks: %w", err) + } + + for _, task := range resp.Tasks { + slog.InfoContext(ctx, "claimed build task", + "task_id", task.Id, + "target_os", task.TargetOs, + "build_image", task.BuildImage, + ) + + // Acquire semaphore slot (blocks if at max concurrency). + if err := sem.Acquire(ctx, 1); err != nil { + return fmt.Errorf("failed to acquire semaphore: %w", err) + } + go func(t *builderpb.BuildTaskSpec) { + defer sem.Release(1) + executeTask(ctx, client, exec, t) + }(task) + } + + return nil +} + +// executeTask runs a single build task through the executor, streaming output +// and errors back to the server via the StreamBuildTaskOutput RPC. +func executeTask(ctx context.Context, client builderpb.BuilderClient, exec executor.Executor, task *builderpb.BuildTaskSpec) { + stream, err := client.StreamBuildTaskOutput(ctx) + if err != nil { + slog.ErrorContext(ctx, "failed to open build output stream", + "task_id", task.Id, "error", err) + return + } + + outputCh := make(chan string, maxOutputChSize) + errorCh := make(chan string, maxErrorChSize) + + // Stream output and errors to the server in a background goroutine. + var sendErr error + collectorDone := make(chan struct{}) + go func() { + defer close(collectorDone) + outCh, errCh := outputCh, errorCh + for outCh != nil || errCh != nil { + select { + case line, ok := <-outCh: + if !ok { + outCh = nil + continue + } + if err := stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Output: line, + }); err != nil { + sendErr = err + return + } + slog.InfoContext(ctx, "build output", + "task_id", task.Id, "line", line) + case line, ok := <-errCh: + if !ok { + errCh = nil + continue + } + if err := stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Error: line, + }); err != nil { + sendErr = err + return + } + slog.WarnContext(ctx, "build error output", + "task_id", task.Id, "line", line) + } + } + }() + + // Run the build through the executor. + // The executor closes both channels when done. + result, buildErr := exec.Build(ctx, executor.BuildSpec{ + TaskID: task.Id, + TargetOS: task.TargetOs, + BuildImage: task.BuildImage, + BuildScript: task.BuildScript, + ArtifactPath: task.ArtifactPath, + Env: task.Env, + }, outputCh, errorCh) + + // Wait for the collector goroutine to drain remaining channel data. + <-collectorDone + + if sendErr != nil { + slog.ErrorContext(ctx, "stream send failed during build", + "task_id", task.Id, "error", sendErr) + return + } + + // Send the final message signaling completion. + finalMsg := &builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Finished: true, + } + if result != nil { + finalMsg.ExitCode = result.ExitCode + } + if buildErr != nil { + finalMsg.Error = buildErr.Error() + slog.ErrorContext(ctx, "build task failed", + "task_id", task.Id, "error", buildErr) + } + + if err := stream.Send(finalMsg); err != nil { + slog.ErrorContext(ctx, "failed to send final stream message", + "task_id", task.Id, "error", err) + return + } + + if _, err := stream.CloseAndRecv(); err != nil { + slog.ErrorContext(ctx, "failed to close build output stream", + "task_id", task.Id, "error", err) + return + } + + // Upload artifact if the build succeeded and produced one. + if buildErr == nil && result != nil && result.Artifact != nil { + if err := uploadArtifact(ctx, client, task.Id, result); err != nil { + slog.ErrorContext(ctx, "failed to upload build artifact", + "task_id", task.Id, "error", err) + } + } +} + +// uploadArtifact streams the build artifact to the server in chunks via the +// UploadBuildArtifact RPC. +func uploadArtifact(ctx context.Context, client builderpb.BuilderClient, taskID int64, result *executor.BuildResult) error { + stream, err := client.UploadBuildArtifact(ctx) if err != nil { - return fmt.Errorf("failed to ping upstream: %w", err) + return fmt.Errorf("failed to open artifact upload stream: %w", err) } - slog.InfoContext(ctx, "successfully pinged upstream", "upstream", cfg.Upstream) + const chunkSize = 1 * 1024 * 1024 // 1MB chunks + data := result.Artifact + + for i := 0; i < len(data); i += chunkSize { + end := i + chunkSize + if end > len(data) { + end = len(data) + } + + msg := &builderpb.UploadBuildArtifactRequest{ + Chunk: data[i:end], + } + // Set metadata only on the first message. + if i == 0 { + msg.TaskId = taskID + msg.ArtifactName = result.ArtifactName + } + + if err := stream.Send(msg); err != nil { + return fmt.Errorf("failed to send artifact chunk: %w", err) + } + } + + resp, err := stream.CloseAndRecv() + if err != nil { + return fmt.Errorf("failed to close artifact stream: %w", err) + } + + slog.InfoContext(ctx, "artifact uploaded", + "task_id", taskID, + "asset_id", resp.AssetId, + "size", len(data), + ) - // Wait for context cancellation - <-ctx.Done() - return ctx.Err() + return nil } diff --git a/tavern/internal/builder/executor/docker.go b/tavern/internal/builder/executor/docker.go new file mode 100644 index 000000000..66af03492 --- /dev/null +++ b/tavern/internal/builder/executor/docker.go @@ -0,0 +1,203 @@ +package executor + +import ( + "archive/tar" + "bufio" + "context" + "fmt" + "io" + "log/slog" + "path/filepath" + + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" + "github.com/docker/docker/client" + "github.com/docker/docker/pkg/stdcopy" +) + +// DockerExecutor runs build tasks inside Docker containers. +// It pulls the specified image, creates a container using the build script +// as the entrypoint, and streams stdout/stderr over the provided channels. +type DockerExecutor struct { + client client.APIClient +} + +// NewDockerExecutor creates a DockerExecutor using the provided Docker API client. +func NewDockerExecutor(cli client.APIClient) *DockerExecutor { + return &DockerExecutor{client: cli} +} + +// NewDockerExecutorFromEnv creates a DockerExecutor using the default +// Docker client configuration from environment variables. +func NewDockerExecutorFromEnv(ctx context.Context) (*DockerExecutor, error) { + cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) + if err != nil { + return nil, fmt.Errorf("failed to create docker client: %w", err) + } + return &DockerExecutor{client: cli}, nil +} + +// Build pulls the build image, starts a container with the build script as +// the shell entrypoint, and streams output/error lines over the channels. +// After the container exits successfully, if spec.ArtifactPath is set, the +// artifact is copied from the stopped container before removal. +func (d *DockerExecutor) Build(ctx context.Context, spec BuildSpec, outputCh chan<- string, errorCh chan<- string) (*BuildResult, error) { + defer close(outputCh) + defer close(errorCh) + + slog.InfoContext(ctx, "pulling docker image", "image", spec.BuildImage, "task_id", spec.TaskID) + + pullReader, err := d.client.ImagePull(ctx, spec.BuildImage, image.PullOptions{}) + if err != nil { + return nil, fmt.Errorf("failed to pull image %q: %w", spec.BuildImage, err) + } + // Drain and close the pull output to ensure the image is fully downloaded. + if _, err := io.Copy(io.Discard, pullReader); err != nil { + pullReader.Close() + return nil, fmt.Errorf("error reading image pull output: %w", err) + } + pullReader.Close() + + slog.InfoContext(ctx, "creating container", "image", spec.BuildImage, "task_id", spec.TaskID) + + resp, err := d.client.ContainerCreate(ctx, + &container.Config{ + Image: spec.BuildImage, + Entrypoint: []string{"/bin/sh", "-c", spec.BuildScript}, + Env: spec.Env, + }, + nil, // host config + nil, // networking config + nil, // platform + "", // container name (auto-generated) + ) + if err != nil { + return nil, fmt.Errorf("failed to create container: %w", err) + } + containerID := resp.ID + + // Ensure the container is removed when we're done. + defer func() { + removeErr := d.client.ContainerRemove(context.Background(), containerID, container.RemoveOptions{Force: true}) + if removeErr != nil { + slog.Warn("failed to remove container", "container_id", containerID, "error", removeErr) + } + }() + + if err := d.client.ContainerStart(ctx, containerID, container.StartOptions{}); err != nil { + return nil, fmt.Errorf("failed to start container: %w", err) + } + + slog.InfoContext(ctx, "container started", "container_id", containerID, "task_id", spec.TaskID) + + // Attach to container logs to stream stdout and stderr. + logReader, err := d.client.ContainerLogs(ctx, containerID, container.LogsOptions{ + ShowStdout: true, + ShowStderr: true, + Follow: true, + }) + if err != nil { + return nil, fmt.Errorf("failed to attach to container logs: %w", err) + } + defer logReader.Close() + + // Docker multiplexes stdout/stderr into a single stream with headers. + // stdcopy.StdCopy demultiplexes them. + stdoutPR, stdoutPW := io.Pipe() + stderrPR, stderrPW := io.Pipe() + + go func() { + _, err := stdcopy.StdCopy(stdoutPW, stderrPW, logReader) + stdoutPW.CloseWithError(err) + stderrPW.CloseWithError(err) + }() + + // Stream stderr lines over errorCh in a background goroutine. + done := make(chan struct{}) + go func() { + defer close(done) + scanner := bufio.NewScanner(stderrPR) + for scanner.Scan() { + errorCh <- scanner.Text() + } + }() + + scanner := bufio.NewScanner(stdoutPR) + for scanner.Scan() { + outputCh <- scanner.Text() + } + + // Wait for stderr goroutine to finish. + <-done + + // Wait for the container to exit and check its status. + statusCh, errCh := d.client.ContainerWait(ctx, containerID, container.WaitConditionNotRunning) + var exitCode int64 + select { + case err := <-errCh: + if err != nil { + return nil, fmt.Errorf("error waiting for container: %w", err) + } + case result := <-statusCh: + exitCode = result.StatusCode + case <-ctx.Done(): + return nil, ctx.Err() + } + + // Extract artifact from the stopped container (before deferred removal). + buildResult := BuildResult{ExitCode: exitCode} + + if exitCode != ExpectedExitCode { + return &buildResult, fmt.Errorf("container exited with status %d", exitCode) + } + + if spec.ArtifactPath == "" { + return &buildResult, nil + } + + data, name, extractErr := d.extractArtifact(ctx, containerID, spec.ArtifactPath) + if extractErr != nil { + slog.WarnContext(ctx, "artifact extraction failed", + "task_id", spec.TaskID, "path", spec.ArtifactPath, "error", extractErr) + return &buildResult, nil + } + + buildResult.Artifact = data + buildResult.ArtifactName = name + slog.InfoContext(ctx, "artifact extracted", + "task_id", spec.TaskID, "name", name, "size", len(data)) + + return &buildResult, nil +} + +// extractArtifact copies a file from a stopped container using the Docker API. +// CopyFromContainer returns a tar archive; this method extracts the first +// regular file from that archive and returns its contents and basename. +func (d *DockerExecutor) extractArtifact(ctx context.Context, containerID, path string) ([]byte, string, error) { + tarReader, _, err := d.client.CopyFromContainer(ctx, containerID, path) + if err != nil { + return nil, "", fmt.Errorf("CopyFromContainer %q: %w", path, err) + } + defer tarReader.Close() + + tr := tar.NewReader(tarReader) + for { + hdr, err := tr.Next() + if err == io.EOF { + break + } + if err != nil { + return nil, "", fmt.Errorf("reading tar entry: %w", err) + } + if hdr.Typeflag != tar.TypeReg { + continue + } + data, err := io.ReadAll(tr) + if err != nil { + return nil, "", fmt.Errorf("reading artifact data: %w", err) + } + return data, filepath.Base(hdr.Name), nil + } + + return nil, "", fmt.Errorf("no regular file found at %q", path) +} diff --git a/tavern/internal/builder/executor/docker_test.go b/tavern/internal/builder/executor/docker_test.go new file mode 100644 index 000000000..a371aef08 --- /dev/null +++ b/tavern/internal/builder/executor/docker_test.go @@ -0,0 +1,218 @@ +package executor_test + +import ( + "context" + "strings" + "sync" + "testing" + "time" + + "github.com/docker/docker/client" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "realm.pub/tavern/internal/builder/executor" +) + +// skipIfNoDocker skips the test if Docker is not available. +func skipIfNoDocker(t *testing.T) client.APIClient { + t.Helper() + cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) + if err != nil { + t.Skipf("skipping docker test: %v", err) + } + _, err = cli.Ping(context.Background()) + if err != nil { + t.Skipf("skipping docker test: docker not reachable: %v", err) + } + return cli +} + +func TestDockerExecutor_ImplementsInterface(t *testing.T) { + var _ executor.Executor = (*executor.DockerExecutor)(nil) +} + +func TestDockerExecutor_Build_SimpleEcho(t *testing.T) { + cli := skipIfNoDocker(t) + exec := executor.NewDockerExecutor(cli) + + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) + defer cancel() + + spec := executor.BuildSpec{ + TaskID: 1, + TargetOS: "linux", + BuildImage: "alpine:latest", + BuildScript: "echo hello world", + } + + outputCh := make(chan string, 100) + errorCh := make(chan string, 100) + + _, err := exec.Build(ctx, spec, outputCh, errorCh) + require.NoError(t, err) + + var output []string + for line := range outputCh { + output = append(output, line) + } + assert.Contains(t, output, "hello world") +} + +func TestDockerExecutor_Build_MultiLineOutput(t *testing.T) { + cli := skipIfNoDocker(t) + exec := executor.NewDockerExecutor(cli) + + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) + defer cancel() + + spec := executor.BuildSpec{ + TaskID: 2, + TargetOS: "linux", + BuildImage: "alpine:latest", + BuildScript: "echo line1 && echo line2 && echo line3", + } + + outputCh := make(chan string, 100) + errorCh := make(chan string, 100) + + _, err := exec.Build(ctx, spec, outputCh, errorCh) + require.NoError(t, err) + + var output []string + for line := range outputCh { + output = append(output, line) + } + assert.Equal(t, []string{"line1", "line2", "line3"}, output) +} + +func TestDockerExecutor_Build_StderrOutput(t *testing.T) { + cli := skipIfNoDocker(t) + exec := executor.NewDockerExecutor(cli) + + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) + defer cancel() + + spec := executor.BuildSpec{ + TaskID: 3, + TargetOS: "linux", + BuildImage: "alpine:latest", + BuildScript: "echo stdout_line && echo stderr_line >&2", + } + + outputCh := make(chan string, 100) + errorCh := make(chan string, 100) + + _, err := exec.Build(ctx, spec, outputCh, errorCh) + require.NoError(t, err) + + var output []string + for line := range outputCh { + output = append(output, line) + } + var errOutput []string + for line := range errorCh { + errOutput = append(errOutput, line) + } + + assert.Contains(t, output, "stdout_line") + assert.Contains(t, errOutput, "stderr_line") +} + +func TestDockerExecutor_Build_NonZeroExit(t *testing.T) { + cli := skipIfNoDocker(t) + exec := executor.NewDockerExecutor(cli) + + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) + defer cancel() + + spec := executor.BuildSpec{ + TaskID: 4, + TargetOS: "linux", + BuildImage: "alpine:latest", + BuildScript: "echo before_fail && exit 42", + } + + outputCh := make(chan string, 100) + errorCh := make(chan string, 100) + + _, err := exec.Build(ctx, spec, outputCh, errorCh) + require.Error(t, err) + assert.Contains(t, err.Error(), "42") + + var output []string + for line := range outputCh { + output = append(output, line) + } + assert.Contains(t, output, "before_fail") +} + +func TestDockerExecutor_Build_ContextCancellation(t *testing.T) { + cli := skipIfNoDocker(t) + exec := executor.NewDockerExecutor(cli) + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + spec := executor.BuildSpec{ + TaskID: 5, + TargetOS: "linux", + BuildImage: "alpine:latest", + BuildScript: "echo started && sleep 120", + } + + outputCh := make(chan string, 100) + errorCh := make(chan string, 100) + + var buildErr error + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + _, buildErr = exec.Build(ctx, spec, outputCh, errorCh) + }() + + wg.Wait() + + // The build should have been cancelled or errored due to timeout. + require.Error(t, buildErr) +} + +func TestDockerExecutor_Build_StreamsOutputInRealTime(t *testing.T) { + cli := skipIfNoDocker(t) + exec := executor.NewDockerExecutor(cli) + + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) + defer cancel() + + spec := executor.BuildSpec{ + TaskID: 6, + TargetOS: "linux", + BuildImage: "alpine:latest", + BuildScript: "for i in 1 2 3 4 5; do echo line_$i; sleep 0.1; done", + } + + outputCh := make(chan string, 100) + errorCh := make(chan string, 100) + + var wg sync.WaitGroup + wg.Add(1) + + var output []string + go func() { + defer wg.Done() + for line := range outputCh { + output = append(output, line) + } + }() + + _, err := exec.Build(ctx, spec, outputCh, errorCh) + // Build closes outputCh, which unblocks the range loop in the goroutine. + wg.Wait() + + require.NoError(t, err) + require.Len(t, output, 5) + for i, line := range output { + assert.True(t, strings.HasPrefix(line, "line_"), "unexpected line %d: %s", i, line) + } +} diff --git a/tavern/internal/builder/executor/executor.go b/tavern/internal/builder/executor/executor.go new file mode 100644 index 000000000..d17d5ac7c --- /dev/null +++ b/tavern/internal/builder/executor/executor.go @@ -0,0 +1,52 @@ +package executor + +import ( + "context" +) + +const ( + // ExpectedExitCode is the expected container exit code for a successful build. + ExpectedExitCode int64 = 0 +) + +// BuildSpec contains the parameters for a build task execution. +type BuildSpec struct { + TaskID int64 + TargetOS string + BuildImage string + BuildScript string + + // ArtifactPath is the path inside the container to extract after the build. + // If empty, no artifact extraction is performed. + ArtifactPath string + + // Env is a list of environment variables to set in the build container, + // in the form "KEY=VALUE". + Env []string +} + +// BuildResult holds the results of a build execution, including any extracted artifacts. +type BuildResult struct { + // ExitCode is the container's exit status code. + ExitCode int64 + + // Artifact contains the raw bytes of the extracted build artifact. + // nil if no artifact was configured or extraction failed. + Artifact []byte + + // ArtifactName is the filename of the extracted artifact. + ArtifactName string +} + +// Executor defines the interface for build task execution. +// Implementations must stream output and errors over the provided channels +// as the build progresses. Implementations MUST close both outputCh and +// errorCh before returning, regardless of whether an error occurred. +type Executor interface { + // Build executes a build task described by spec. As the build runs, + // stdout lines are sent to outputCh and stderr lines to errorCh. + // Build blocks until the build completes (or the context is cancelled) + // and returns a BuildResult (which may contain extracted artifacts) and + // any execution error. Build must close both channels before returning. + Build(ctx context.Context, spec BuildSpec, outputCh chan<- string, errorCh chan<- string) (*BuildResult, error) +} diff --git a/tavern/internal/builder/executor/mock.go b/tavern/internal/builder/executor/mock.go new file mode 100644 index 000000000..9ac4b7d84 --- /dev/null +++ b/tavern/internal/builder/executor/mock.go @@ -0,0 +1,37 @@ +package executor + +import ( + "context" +) + +// MockExecutor is a test double for the Executor interface. +// It records calls and allows tests to configure the output, errors, +// and return value for each invocation. +type MockExecutor struct { + // BuildCalls records each BuildSpec passed to Build. + BuildCalls []BuildSpec + + // BuildFn, if set, is called for each Build invocation. + // It gives tests full control over what gets sent to the channels + // and what result/error is returned. + BuildFn func(ctx context.Context, spec BuildSpec, outputCh chan<- string, errorCh chan<- string) (*BuildResult, error) +} + +// NewMockExecutor returns a MockExecutor with no configured behavior. +// By default, Build succeeds immediately without producing output. +func NewMockExecutor() *MockExecutor { + return &MockExecutor{} +} + +// Build implements Executor. It records the call, delegates to BuildFn +// if set, and closes both channels before returning. +func (m *MockExecutor) Build(ctx context.Context, spec BuildSpec, outputCh chan<- string, errorCh chan<- string) (*BuildResult, error) { + defer close(outputCh) + defer close(errorCh) + + m.BuildCalls = append(m.BuildCalls, spec) + if m.BuildFn != nil { + return m.BuildFn(ctx, spec, outputCh, errorCh) + } + return &BuildResult{}, nil +} diff --git a/tavern/internal/builder/executor/mock_test.go b/tavern/internal/builder/executor/mock_test.go new file mode 100644 index 000000000..2539c9dd2 --- /dev/null +++ b/tavern/internal/builder/executor/mock_test.go @@ -0,0 +1,184 @@ +package executor_test + +import ( + "context" + "errors" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "realm.pub/tavern/internal/builder/executor" +) + +func TestMockExecutor_DefaultBehavior(t *testing.T) { + mock := executor.NewMockExecutor() + spec := executor.BuildSpec{ + TaskID: 1, + TargetOS: "linux", + BuildImage: "golang:1.21", + BuildScript: "go build ./...", + } + + outputCh := make(chan string, 10) + errorCh := make(chan string, 10) + + _, err := mock.Build(context.Background(), spec, outputCh, errorCh) + require.NoError(t, err) + + // Should have recorded the call. + require.Len(t, mock.BuildCalls, 1) + assert.Equal(t, spec, mock.BuildCalls[0]) + + // No output or errors by default. + assert.Empty(t, outputCh) + assert.Empty(t, errorCh) +} + +func TestMockExecutor_RecordsMultipleCalls(t *testing.T) { + mock := executor.NewMockExecutor() + + specs := []executor.BuildSpec{ + {TaskID: 1, BuildImage: "golang:1.21", BuildScript: "go build ./..."}, + {TaskID: 2, BuildImage: "rust:1.75", BuildScript: "cargo build --release"}, + {TaskID: 3, BuildImage: "node:20", BuildScript: "npm run build"}, + } + + for _, s := range specs { + outputCh := make(chan string, 10) + errorCh := make(chan string, 10) + _, err := mock.Build(context.Background(), s, outputCh, errorCh) + require.NoError(t, err) + } + + require.Len(t, mock.BuildCalls, 3) + for i, s := range specs { + assert.Equal(t, s, mock.BuildCalls[i]) + } +} + +func TestMockExecutor_CustomBuildFn_StreamsOutput(t *testing.T) { + mock := executor.NewMockExecutor() + mock.BuildFn = func(ctx context.Context, spec executor.BuildSpec, outputCh chan<- string, errorCh chan<- string) (*executor.BuildResult, error) { + outputCh <- "Compiling main.go" + outputCh <- "Linking binary" + outputCh <- "Build succeeded" + return &executor.BuildResult{}, nil + } + + outputCh := make(chan string, 10) + errorCh := make(chan string, 10) + + _, err := mock.Build(context.Background(), executor.BuildSpec{TaskID: 1}, outputCh, errorCh) + require.NoError(t, err) + + // Channels are closed by Build; drain them. + var output []string + for line := range outputCh { + output = append(output, line) + } + assert.Equal(t, []string{"Compiling main.go", "Linking binary", "Build succeeded"}, output) + assert.Empty(t, errorCh) +} + +func TestMockExecutor_CustomBuildFn_StreamsErrors(t *testing.T) { + mock := executor.NewMockExecutor() + mock.BuildFn = func(ctx context.Context, spec executor.BuildSpec, outputCh chan<- string, errorCh chan<- string) (*executor.BuildResult, error) { + outputCh <- "Compiling..." + errorCh <- "warning: unused variable" + errorCh <- "error: type mismatch" + return &executor.BuildResult{}, errors.New("build failed with exit code 1") + } + + outputCh := make(chan string, 10) + errorCh := make(chan string, 10) + + _, err := mock.Build(context.Background(), executor.BuildSpec{TaskID: 2}, outputCh, errorCh) + require.Error(t, err) + assert.Contains(t, err.Error(), "build failed") + + // Channels are closed by Build; drain them. + var output []string + for line := range outputCh { + output = append(output, line) + } + assert.Equal(t, []string{"Compiling..."}, output) + + var errs []string + for line := range errorCh { + errs = append(errs, line) + } + assert.Equal(t, []string{"warning: unused variable", "error: type mismatch"}, errs) +} + +func TestMockExecutor_CustomBuildFn_ContextCancellation(t *testing.T) { + mock := executor.NewMockExecutor() + mock.BuildFn = func(ctx context.Context, spec executor.BuildSpec, outputCh chan<- string, errorCh chan<- string) (*executor.BuildResult, error) { + outputCh <- "Starting build..." + <-ctx.Done() + return nil, ctx.Err() + } + + ctx, cancel := context.WithCancel(context.Background()) + outputCh := make(chan string, 10) + errorCh := make(chan string, 10) + + var wg sync.WaitGroup + var buildErr error + wg.Add(1) + go func() { + defer wg.Done() + _, buildErr = mock.Build(ctx, executor.BuildSpec{TaskID: 3}, outputCh, errorCh) + }() + + // Wait for the first output line to confirm Build started. + select { + case line := <-outputCh: + assert.Equal(t, "Starting build...", line) + case <-time.After(2 * time.Second): + t.Fatal("timed out waiting for build to start") + } + + cancel() + wg.Wait() + + require.Error(t, buildErr) + assert.ErrorIs(t, buildErr, context.Canceled) +} + +func TestMockExecutor_CustomBuildFn_InterleavedOutputAndErrors(t *testing.T) { + mock := executor.NewMockExecutor() + mock.BuildFn = func(ctx context.Context, spec executor.BuildSpec, outputCh chan<- string, errorCh chan<- string) (*executor.BuildResult, error) { + outputCh <- "step 1" + errorCh <- "warn 1" + outputCh <- "step 2" + errorCh <- "warn 2" + outputCh <- "step 3" + return &executor.BuildResult{}, nil + } + + outputCh := make(chan string, 10) + errorCh := make(chan string, 10) + + _, err := mock.Build(context.Background(), executor.BuildSpec{TaskID: 4}, outputCh, errorCh) + require.NoError(t, err) + + // Channels are closed by Build; drain them. + var output []string + for line := range outputCh { + output = append(output, line) + } + assert.Equal(t, []string{"step 1", "step 2", "step 3"}, output) + + var errs []string + for line := range errorCh { + errs = append(errs, line) + } + assert.Equal(t, []string{"warn 1", "warn 2"}, errs) +} + +func TestMockExecutor_ImplementsInterface(t *testing.T) { + var _ executor.Executor = (*executor.MockExecutor)(nil) +} diff --git a/tavern/internal/builder/executor_integration_test.go b/tavern/internal/builder/executor_integration_test.go new file mode 100644 index 000000000..e09fd570d --- /dev/null +++ b/tavern/internal/builder/executor_integration_test.go @@ -0,0 +1,723 @@ +package builder_test + +import ( + "context" + "crypto/ed25519" + "crypto/rand" + "errors" + "net" + "testing" + + "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" + _ "github.com/mattn/go-sqlite3" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/test/bufconn" + + "realm.pub/tavern/internal/builder" + "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/builder/executor" + "realm.pub/tavern/internal/c2/c2pb" + "realm.pub/tavern/internal/ent/enttest" + "realm.pub/tavern/internal/graphql" + tavernhttp "realm.pub/tavern/internal/http" + "realm.pub/tavern/tomes" +) + +func TestExecutorIntegration_ClaimAndExecuteWithMock(t *testing.T) { + ctx := context.Background() + + // Full infrastructure setup + graph := enttest.Open(t, "sqlite3", "file:ent_claim_exec?mode=memory&cache=shared&_fk=1") + defer graph.Close() + + _, caPrivKey, err := ed25519.GenerateKey(rand.Reader) + require.NoError(t, err) + caCert, err := builder.CreateCA(caPrivKey) + require.NoError(t, err) + + git := tomes.NewGitImporter(graph) + srv := tavernhttp.NewServer( + tavernhttp.RouteMap{ + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, git, graphql.WithBuilderCA(caCert), graphql.WithBuilderCAKey(caPrivKey))), + }, + tavernhttp.WithAuthenticationBypass(graph), + ) + gqlClient := client.New(srv, client.Path("/graphql")) + + // Register builder + var registerResp struct { + RegisterBuilder struct { + Builder struct{ ID string } + Config string + } + } + err = gqlClient.Post(`mutation registerNewBuilder($input: CreateBuilderInput!) { + registerBuilder(input: $input) { + builder { id } + config + } + }`, ®isterResp, client.Var("input", map[string]any{ + "supportedTargets": []string{"PLATFORM_LINUX"}, + "upstream": "https://tavern.example.com:443", + })) + require.NoError(t, err) + + // Get builder DB entity + builders, err := graph.Builder.Query().All(ctx) + require.NoError(t, err) + require.Len(t, builders, 1) + + // Create a build task + bt := graph.BuildTask.Create(). + SetTargetOs(c2pb.Host_PLATFORM_LINUX). + SetTargetFormat(builderpb.TargetFormat_TARGET_FORMAT_BIN). + SetBuildImage("golang:1.21"). + SetBuildScript("go build ./..."). + SetCallbackURI("https://callback.example.com"). + SetTransportType(c2pb.Transport_TRANSPORT_GRPC). + SetBuilderID(builders[0].ID). + SaveX(ctx) + + // Setup gRPC + lis := bufconn.Listen(1024 * 1024) + grpcSrv := grpc.NewServer( + grpc.ChainUnaryInterceptor( + builder.NewMTLSAuthInterceptor(caCert, graph), + ), + grpc.ChainStreamInterceptor( + builder.NewMTLSStreamAuthInterceptor(caCert, graph), + ), + ) + builderSrv := builder.New(graph, "dGVzdC1wdWJrZXk=") + builderpb.RegisterBuilderServer(grpcSrv, builderSrv) + + go func() { + if err := grpcSrv.Serve(lis); err != nil { + t.Logf("gRPC server exited: %v", err) + } + }() + defer grpcSrv.Stop() + + bufDialer := func(context.Context, string) (net.Conn, error) { + return lis.Dial() + } + + cfg, err := builder.ParseConfigBytes([]byte(registerResp.RegisterBuilder.Config)) + require.NoError(t, err) + + creds, err := builder.NewCredentialsFromConfig(cfg) + require.NoError(t, err) + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithPerRPCCredentials(creds), + ) + require.NoError(t, err) + defer conn.Close() + + authClient := builderpb.NewBuilderClient(conn) + + // Claim the task + claimResp, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + require.NoError(t, err) + require.Len(t, claimResp.Tasks, 1) + assert.Equal(t, int64(bt.ID), claimResp.Tasks[0].Id) + + // Execute using mock executor + mock := executor.NewMockExecutor() + mock.BuildFn = func(ctx context.Context, spec executor.BuildSpec, outputCh chan<- string, errorCh chan<- string) (*executor.BuildResult, error) { + outputCh <- "Building for linux..." + outputCh <- "Success" + return &executor.BuildResult{}, nil + } + + task := claimResp.Tasks[0] + outputCh := make(chan string, 64) + errorCh := make(chan string, 64) + + _, buildErr := mock.Build(ctx, executor.BuildSpec{ + TaskID: task.Id, + TargetOS: task.TargetOs, + BuildImage: task.BuildImage, + BuildScript: task.BuildScript, + }, outputCh, errorCh) + require.NoError(t, buildErr) + + // Channels are closed by Build; drain and stream them. + stream, err := authClient.StreamBuildTaskOutput(ctx) + require.NoError(t, err) + + for line := range outputCh { + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Output: line, + })) + } + + // Send final message + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Finished: true, + })) + + resp, err := stream.CloseAndRecv() + require.NoError(t, err) + require.NotNil(t, resp) + + // Verify the task was updated in the database + reloaded := graph.BuildTask.GetX(ctx, bt.ID) + assert.Equal(t, "Building for linux...\nSuccess", reloaded.Output) + assert.False(t, reloaded.FinishedAt.IsZero()) + assert.Empty(t, reloaded.Error) +} + +func TestExecutorIntegration_ClaimAndExecuteWithMockError(t *testing.T) { + ctx := context.Background() + + graph := enttest.Open(t, "sqlite3", "file:ent_claim_exec_err?mode=memory&cache=shared&_fk=1") + defer graph.Close() + + _, caPrivKey, err := ed25519.GenerateKey(rand.Reader) + require.NoError(t, err) + caCert, err := builder.CreateCA(caPrivKey) + require.NoError(t, err) + + git := tomes.NewGitImporter(graph) + srv := tavernhttp.NewServer( + tavernhttp.RouteMap{ + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, git, graphql.WithBuilderCA(caCert), graphql.WithBuilderCAKey(caPrivKey))), + }, + tavernhttp.WithAuthenticationBypass(graph), + ) + gqlClient := client.New(srv, client.Path("/graphql")) + + var registerResp struct { + RegisterBuilder struct { + Builder struct{ ID string } + Config string + } + } + err = gqlClient.Post(`mutation registerNewBuilder($input: CreateBuilderInput!) { + registerBuilder(input: $input) { + builder { id } + config + } + }`, ®isterResp, client.Var("input", map[string]any{ + "supportedTargets": []string{"PLATFORM_LINUX"}, + "upstream": "https://tavern.example.com:443", + })) + require.NoError(t, err) + + builders, err := graph.Builder.Query().All(ctx) + require.NoError(t, err) + require.Len(t, builders, 1) + + bt := graph.BuildTask.Create(). + SetTargetOs(c2pb.Host_PLATFORM_LINUX). + SetTargetFormat(builderpb.TargetFormat_TARGET_FORMAT_BIN). + SetBuildImage("golang:1.21"). + SetBuildScript("go build ./..."). + SetCallbackURI("https://callback.example.com"). + SetTransportType(c2pb.Transport_TRANSPORT_GRPC). + SetBuilderID(builders[0].ID). + SaveX(ctx) + + lis := bufconn.Listen(1024 * 1024) + grpcSrv := grpc.NewServer( + grpc.ChainUnaryInterceptor( + builder.NewMTLSAuthInterceptor(caCert, graph), + ), + grpc.ChainStreamInterceptor( + builder.NewMTLSStreamAuthInterceptor(caCert, graph), + ), + ) + builderSrv := builder.New(graph, "dGVzdC1wdWJrZXk=") + builderpb.RegisterBuilderServer(grpcSrv, builderSrv) + + go func() { + if err := grpcSrv.Serve(lis); err != nil { + t.Logf("gRPC server exited: %v", err) + } + }() + defer grpcSrv.Stop() + + bufDialer := func(context.Context, string) (net.Conn, error) { + return lis.Dial() + } + + cfg, err := builder.ParseConfigBytes([]byte(registerResp.RegisterBuilder.Config)) + require.NoError(t, err) + + creds, err := builder.NewCredentialsFromConfig(cfg) + require.NoError(t, err) + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithPerRPCCredentials(creds), + ) + require.NoError(t, err) + defer conn.Close() + + authClient := builderpb.NewBuilderClient(conn) + + claimResp, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + require.NoError(t, err) + require.Len(t, claimResp.Tasks, 1) + + // Execute using mock that fails + mock := executor.NewMockExecutor() + mock.BuildFn = func(ctx context.Context, spec executor.BuildSpec, outputCh chan<- string, errorCh chan<- string) (*executor.BuildResult, error) { + outputCh <- "Compiling..." + errorCh <- "fatal: cannot find package" + return &executor.BuildResult{}, errors.New("exit code 1") + } + + task := claimResp.Tasks[0] + outputCh := make(chan string, 64) + errorCh := make(chan string, 64) + + _, buildErr := mock.Build(ctx, executor.BuildSpec{ + TaskID: task.Id, + TargetOS: task.TargetOs, + BuildImage: task.BuildImage, + BuildScript: task.BuildScript, + }, outputCh, errorCh) + require.Error(t, buildErr) + + // Channels are closed by Build; drain and stream them. + stream, err := authClient.StreamBuildTaskOutput(ctx) + require.NoError(t, err) + + for line := range outputCh { + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Output: line, + })) + } + for line := range errorCh { + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Error: line, + })) + } + + // Send final message with build error + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Error: buildErr.Error(), + Finished: true, + })) + + resp, err := stream.CloseAndRecv() + require.NoError(t, err) + require.NotNil(t, resp) + + // Verify the task was updated + reloaded := graph.BuildTask.GetX(ctx, bt.ID) + assert.Equal(t, "Compiling...", reloaded.Output) + assert.Contains(t, reloaded.Error, "fatal: cannot find package") + assert.Contains(t, reloaded.Error, "exit code 1") + assert.False(t, reloaded.FinishedAt.IsZero()) +} + +func TestExecutorIntegration_StreamBuildOutput(t *testing.T) { + ctx := context.Background() + + graph := enttest.Open(t, "sqlite3", "file:ent_stream_output?mode=memory&cache=shared&_fk=1") + defer graph.Close() + + _, caPrivKey, err := ed25519.GenerateKey(rand.Reader) + require.NoError(t, err) + caCert, err := builder.CreateCA(caPrivKey) + require.NoError(t, err) + + git := tomes.NewGitImporter(graph) + srv := tavernhttp.NewServer( + tavernhttp.RouteMap{ + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, git, graphql.WithBuilderCA(caCert), graphql.WithBuilderCAKey(caPrivKey))), + }, + tavernhttp.WithAuthenticationBypass(graph), + ) + gqlClient := client.New(srv, client.Path("/graphql")) + + var registerResp struct { + RegisterBuilder struct { + Builder struct{ ID string } + Config string + } + } + err = gqlClient.Post(`mutation registerNewBuilder($input: CreateBuilderInput!) { + registerBuilder(input: $input) { + builder { id } + config + } + }`, ®isterResp, client.Var("input", map[string]any{ + "supportedTargets": []string{"PLATFORM_LINUX"}, + "upstream": "https://tavern.example.com:443", + })) + require.NoError(t, err) + + builders, err := graph.Builder.Query().All(ctx) + require.NoError(t, err) + require.Len(t, builders, 1) + + bt := graph.BuildTask.Create(). + SetTargetOs(c2pb.Host_PLATFORM_LINUX). + SetTargetFormat(builderpb.TargetFormat_TARGET_FORMAT_BIN). + SetBuildImage("golang:1.21"). + SetBuildScript("go build ./..."). + SetCallbackURI("https://callback.example.com"). + SetTransportType(c2pb.Transport_TRANSPORT_GRPC). + SetBuilderID(builders[0].ID). + SaveX(ctx) + + lis := bufconn.Listen(1024 * 1024) + grpcSrv := grpc.NewServer( + grpc.ChainUnaryInterceptor( + builder.NewMTLSAuthInterceptor(caCert, graph), + ), + grpc.ChainStreamInterceptor( + builder.NewMTLSStreamAuthInterceptor(caCert, graph), + ), + ) + builderSrv := builder.New(graph, "dGVzdC1wdWJrZXk=") + builderpb.RegisterBuilderServer(grpcSrv, builderSrv) + + go func() { + if err := grpcSrv.Serve(lis); err != nil { + t.Logf("gRPC server exited: %v", err) + } + }() + defer grpcSrv.Stop() + + bufDialer := func(context.Context, string) (net.Conn, error) { + return lis.Dial() + } + + cfg, err := builder.ParseConfigBytes([]byte(registerResp.RegisterBuilder.Config)) + require.NoError(t, err) + + creds, err := builder.NewCredentialsFromConfig(cfg) + require.NoError(t, err) + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithPerRPCCredentials(creds), + ) + require.NoError(t, err) + defer conn.Close() + + authClient := builderpb.NewBuilderClient(conn) + + // Claim the task + claimResp, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + require.NoError(t, err) + require.Len(t, claimResp.Tasks, 1) + + task := claimResp.Tasks[0] + + // Open stream + stream, err := authClient.StreamBuildTaskOutput(ctx) + require.NoError(t, err) + + // Send output messages + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Output: "Building for linux...", + })) + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Output: "Compiling main.go", + })) + + // Send final message + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Finished: true, + })) + + // Close and receive response + resp, err := stream.CloseAndRecv() + require.NoError(t, err) + require.NotNil(t, resp) + + // Verify DB state + reloaded := graph.BuildTask.GetX(ctx, bt.ID) + assert.Equal(t, "Building for linux...\nCompiling main.go", reloaded.Output) + assert.False(t, reloaded.FinishedAt.IsZero()) + assert.False(t, reloaded.StartedAt.IsZero()) + assert.Empty(t, reloaded.Error) +} + +func TestExecutorIntegration_StreamBuildOutputWithError(t *testing.T) { + ctx := context.Background() + + graph := enttest.Open(t, "sqlite3", "file:ent_stream_output_err?mode=memory&cache=shared&_fk=1") + defer graph.Close() + + _, caPrivKey, err := ed25519.GenerateKey(rand.Reader) + require.NoError(t, err) + caCert, err := builder.CreateCA(caPrivKey) + require.NoError(t, err) + + git := tomes.NewGitImporter(graph) + srv := tavernhttp.NewServer( + tavernhttp.RouteMap{ + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, git, graphql.WithBuilderCA(caCert), graphql.WithBuilderCAKey(caPrivKey))), + }, + tavernhttp.WithAuthenticationBypass(graph), + ) + gqlClient := client.New(srv, client.Path("/graphql")) + + var registerResp struct { + RegisterBuilder struct { + Builder struct{ ID string } + Config string + } + } + err = gqlClient.Post(`mutation registerNewBuilder($input: CreateBuilderInput!) { + registerBuilder(input: $input) { + builder { id } + config + } + }`, ®isterResp, client.Var("input", map[string]any{ + "supportedTargets": []string{"PLATFORM_LINUX"}, + "upstream": "https://tavern.example.com:443", + })) + require.NoError(t, err) + + builders, err := graph.Builder.Query().All(ctx) + require.NoError(t, err) + require.Len(t, builders, 1) + + bt := graph.BuildTask.Create(). + SetTargetOs(c2pb.Host_PLATFORM_LINUX). + SetTargetFormat(builderpb.TargetFormat_TARGET_FORMAT_BIN). + SetBuildImage("golang:1.21"). + SetBuildScript("go build ./..."). + SetCallbackURI("https://callback.example.com"). + SetTransportType(c2pb.Transport_TRANSPORT_GRPC). + SetBuilderID(builders[0].ID). + SaveX(ctx) + + lis := bufconn.Listen(1024 * 1024) + grpcSrv := grpc.NewServer( + grpc.ChainUnaryInterceptor( + builder.NewMTLSAuthInterceptor(caCert, graph), + ), + grpc.ChainStreamInterceptor( + builder.NewMTLSStreamAuthInterceptor(caCert, graph), + ), + ) + builderSrv := builder.New(graph, "dGVzdC1wdWJrZXk=") + builderpb.RegisterBuilderServer(grpcSrv, builderSrv) + + go func() { + if err := grpcSrv.Serve(lis); err != nil { + t.Logf("gRPC server exited: %v", err) + } + }() + defer grpcSrv.Stop() + + bufDialer := func(context.Context, string) (net.Conn, error) { + return lis.Dial() + } + + cfg, err := builder.ParseConfigBytes([]byte(registerResp.RegisterBuilder.Config)) + require.NoError(t, err) + + creds, err := builder.NewCredentialsFromConfig(cfg) + require.NoError(t, err) + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithPerRPCCredentials(creds), + ) + require.NoError(t, err) + defer conn.Close() + + authClient := builderpb.NewBuilderClient(conn) + + claimResp, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + require.NoError(t, err) + require.Len(t, claimResp.Tasks, 1) + + task := claimResp.Tasks[0] + + // Open stream + stream, err := authClient.StreamBuildTaskOutput(ctx) + require.NoError(t, err) + + // Send output + error lines + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Output: "Compiling...", + })) + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Error: "fatal: cannot find package", + })) + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Error: "exit code 1", + Finished: true, + })) + + resp, err := stream.CloseAndRecv() + require.NoError(t, err) + require.NotNil(t, resp) + + reloaded := graph.BuildTask.GetX(ctx, bt.ID) + assert.Equal(t, "Compiling...", reloaded.Output) + assert.Contains(t, reloaded.Error, "fatal: cannot find package") + assert.Contains(t, reloaded.Error, "exit code 1") + assert.False(t, reloaded.FinishedAt.IsZero()) + assert.False(t, reloaded.StartedAt.IsZero()) +} + +func TestExecutorIntegration_UploadBuildArtifact(t *testing.T) { + ctx := context.Background() + + graph := enttest.Open(t, "sqlite3", "file:ent_upload_artifact?mode=memory&cache=shared&_fk=1") + defer graph.Close() + + _, caPrivKey, err := ed25519.GenerateKey(rand.Reader) + require.NoError(t, err) + caCert, err := builder.CreateCA(caPrivKey) + require.NoError(t, err) + + git := tomes.NewGitImporter(graph) + srv := tavernhttp.NewServer( + tavernhttp.RouteMap{ + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, git, graphql.WithBuilderCA(caCert), graphql.WithBuilderCAKey(caPrivKey))), + }, + tavernhttp.WithAuthenticationBypass(graph), + ) + gqlClient := client.New(srv, client.Path("/graphql")) + + var registerResp struct { + RegisterBuilder struct { + Builder struct{ ID string } + Config string + } + } + err = gqlClient.Post(`mutation registerNewBuilder($input: CreateBuilderInput!) { + registerBuilder(input: $input) { + builder { id } + config + } + }`, ®isterResp, client.Var("input", map[string]any{ + "supportedTargets": []string{"PLATFORM_LINUX"}, + "upstream": "https://tavern.example.com:443", + })) + require.NoError(t, err) + + builders, err := graph.Builder.Query().All(ctx) + require.NoError(t, err) + require.Len(t, builders, 1) + + graph.BuildTask.Create(). + SetTargetOs(c2pb.Host_PLATFORM_LINUX). + SetTargetFormat(builderpb.TargetFormat_TARGET_FORMAT_BIN). + SetBuildImage("golang:1.21"). + SetBuildScript("go build -o /app/output/binary ./..."). + SetCallbackURI("https://callback.example.com"). + SetTransportType(c2pb.Transport_TRANSPORT_GRPC). + SetArtifactPath("/app/output/binary"). + SetBuilderID(builders[0].ID). + SaveX(ctx) + + lis := bufconn.Listen(1024 * 1024) + grpcSrv := grpc.NewServer( + grpc.ChainUnaryInterceptor( + builder.NewMTLSAuthInterceptor(caCert, graph), + ), + grpc.ChainStreamInterceptor( + builder.NewMTLSStreamAuthInterceptor(caCert, graph), + ), + ) + builderSrv := builder.New(graph, "dGVzdC1wdWJrZXk=") + builderpb.RegisterBuilderServer(grpcSrv, builderSrv) + + go func() { + if err := grpcSrv.Serve(lis); err != nil { + t.Logf("gRPC server exited: %v", err) + } + }() + defer grpcSrv.Stop() + + bufDialer := func(context.Context, string) (net.Conn, error) { + return lis.Dial() + } + + cfg, err := builder.ParseConfigBytes([]byte(registerResp.RegisterBuilder.Config)) + require.NoError(t, err) + + creds, err := builder.NewCredentialsFromConfig(cfg) + require.NoError(t, err) + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithPerRPCCredentials(creds), + ) + require.NoError(t, err) + defer conn.Close() + + authClient := builderpb.NewBuilderClient(conn) + + // Claim the task + claimResp, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + require.NoError(t, err) + require.Len(t, claimResp.Tasks, 1) + assert.Equal(t, "/app/output/binary", claimResp.Tasks[0].ArtifactPath) + + task := claimResp.Tasks[0] + + // Stream build output and finish + stream, err := authClient.StreamBuildTaskOutput(ctx) + require.NoError(t, err) + + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Output: "Build completed", + })) + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: task.Id, + Finished: true, + })) + + _, err = stream.CloseAndRecv() + require.NoError(t, err) + + // Upload artifact + artifactData := []byte("fake-binary-content-for-testing") + artifactStream, err := authClient.UploadBuildArtifact(ctx) + require.NoError(t, err) + + require.NoError(t, artifactStream.Send(&builderpb.UploadBuildArtifactRequest{ + TaskId: task.Id, + ArtifactName: "binary", + Chunk: artifactData, + })) + + artifactResp, err := artifactStream.CloseAndRecv() + require.NoError(t, err) + require.NotNil(t, artifactResp) + assert.Greater(t, artifactResp.AssetId, int64(0)) + + // Verify the asset was created + asset, err := graph.Asset.Get(ctx, int(artifactResp.AssetId)) + require.NoError(t, err) + assert.Contains(t, asset.Name, "build/linux/bin/imix-") + assert.Equal(t, artifactData, asset.Content) + assert.Equal(t, len(artifactData), asset.Size) +} diff --git a/tavern/internal/builder/generate.go b/tavern/internal/builder/generate.go new file mode 100644 index 000000000..68087e2e6 --- /dev/null +++ b/tavern/internal/builder/generate.go @@ -0,0 +1,3 @@ +package builder + +//go:generate protoc -I=./proto --go_out=./builderpb --go_opt=paths=source_relative --go-grpc_out=./builderpb --go-grpc_opt=paths=source_relative builder.proto diff --git a/tavern/internal/builder/integration_test.go b/tavern/internal/builder/integration_test.go index 11fefe513..569fce17d 100644 --- a/tavern/internal/builder/integration_test.go +++ b/tavern/internal/builder/integration_test.go @@ -20,6 +20,7 @@ import ( "realm.pub/tavern/internal/builder" "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/c2/c2pb" "realm.pub/tavern/internal/ent/enttest" "realm.pub/tavern/internal/graphql" tavernhttp "realm.pub/tavern/internal/http" @@ -97,8 +98,11 @@ func TestBuilderE2E(t *testing.T) { grpc.ChainUnaryInterceptor( builder.NewMTLSAuthInterceptor(caCert, graph), ), + grpc.ChainStreamInterceptor( + builder.NewMTLSStreamAuthInterceptor(caCert, graph), + ), ) - builderSrv := builder.New(graph) + builderSrv := builder.New(graph, "dGVzdC1wdWJrZXk=") builderpb.RegisterBuilderServer(grpcSrv, builderSrv) go func() { @@ -122,7 +126,7 @@ func TestBuilderE2E(t *testing.T) { defer conn.Close() unauthClient := builderpb.NewBuilderClient(conn) - _, err = unauthClient.Ping(ctx, &builderpb.PingRequest{}) + _, err = unauthClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) require.Error(t, err) assert.Equal(t, codes.Unauthenticated, status.Code(err)) }) @@ -141,8 +145,259 @@ func TestBuilderE2E(t *testing.T) { defer conn.Close() authClient := builderpb.NewBuilderClient(conn) - pingResp, err := authClient.Ping(ctx, &builderpb.PingRequest{}) + claimResp, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + require.NoError(t, err) + require.NotNil(t, claimResp) + }) + + // 10. Test: ClaimBuildTasks returns unclaimed tasks and marks them as claimed + t.Run("ClaimBuildTasks", func(t *testing.T) { + // Create an authenticated client + creds, err := builder.NewCredentialsFromConfig(cfg) + require.NoError(t, err) + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithPerRPCCredentials(creds), + ) + require.NoError(t, err) + defer conn.Close() + + authClient := builderpb.NewBuilderClient(conn) + + // Create a build task assigned to this builder + bt := graph.BuildTask.Create(). + SetTargetOs(c2pb.Host_PLATFORM_LINUX). + SetTargetFormat(builderpb.TargetFormat_TARGET_FORMAT_BIN). + SetBuildImage("golang:1.21"). + SetBuildScript("echo hello && go build ./..."). + SetCallbackURI("https://callback.example.com"). + SetInterval(10). + SetTransportType(c2pb.Transport_TRANSPORT_GRPC). + SetBuilderID(builders[0].ID). + SaveX(ctx) + + // Claim tasks + resp, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) require.NoError(t, err) - require.NotNil(t, pingResp) + require.Len(t, resp.Tasks, 1) + assert.Equal(t, int64(bt.ID), resp.Tasks[0].Id) + assert.Equal(t, "golang:1.21", resp.Tasks[0].BuildImage) + assert.Equal(t, "echo hello && go build ./...", resp.Tasks[0].BuildScript) + + // Verify IMIX_CONFIG env var is set + require.Len(t, resp.Tasks[0].Env, 1) + assert.Contains(t, resp.Tasks[0].Env[0], "IMIX_CONFIG=") + assert.Contains(t, resp.Tasks[0].Env[0], "transports:") + assert.Contains(t, resp.Tasks[0].Env[0], "URI: https://callback.example.com") + assert.Contains(t, resp.Tasks[0].Env[0], "interval: 10") + assert.Contains(t, resp.Tasks[0].Env[0], "type: grpc") + + // Verify claimed_at is set + reloaded := graph.BuildTask.GetX(ctx, bt.ID) + assert.False(t, reloaded.ClaimedAt.IsZero()) + + // Verify builder's last_seen_at was updated + reloadedBuilder := graph.Builder.GetX(ctx, builders[0].ID) + require.NotNil(t, reloadedBuilder.LastSeenAt) + assert.False(t, reloadedBuilder.LastSeenAt.IsZero()) + + // Claim again -> should return empty (already claimed) + resp2, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + require.NoError(t, err) + assert.Empty(t, resp2.Tasks) + }) + + // 11. Test: StreamBuildTaskOutput sets output and finished_at + t.Run("StreamBuildTaskOutput", func(t *testing.T) { + creds, err := builder.NewCredentialsFromConfig(cfg) + require.NoError(t, err) + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithPerRPCCredentials(creds), + ) + require.NoError(t, err) + defer conn.Close() + + authClient := builderpb.NewBuilderClient(conn) + + // Create and claim a build task + bt := graph.BuildTask.Create(). + SetTargetOs(c2pb.Host_PLATFORM_MACOS). + SetTargetFormat(builderpb.TargetFormat_TARGET_FORMAT_BIN). + SetBuildImage("rust:1.75"). + SetBuildScript("cargo build --release"). + SetCallbackURI("https://callback.example.com"). + SetTransportType(c2pb.Transport_TRANSPORT_GRPC). + SetBuilderID(builders[0].ID). + SaveX(ctx) + + // Claim the task + claimResp, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + require.NoError(t, err) + require.Len(t, claimResp.Tasks, 1) + + // Stream output + stream, err := authClient.StreamBuildTaskOutput(ctx) + require.NoError(t, err) + + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: int64(bt.ID), + Output: "build succeeded", + })) + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: int64(bt.ID), + Finished: true, + ExitCode: 0, + })) + + _, err = stream.CloseAndRecv() + require.NoError(t, err) + + // Verify the build task was updated + reloaded := graph.BuildTask.GetX(ctx, bt.ID) + assert.Equal(t, "build succeeded", reloaded.Output) + assert.False(t, reloaded.FinishedAt.IsZero()) + assert.Empty(t, reloaded.Error) + require.NotNil(t, reloaded.ExitCode) + assert.Equal(t, 0, *reloaded.ExitCode) + }) + + // 12. Test: StreamBuildTaskOutput with error + t.Run("StreamBuildTaskOutputWithError", func(t *testing.T) { + creds, err := builder.NewCredentialsFromConfig(cfg) + require.NoError(t, err) + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithPerRPCCredentials(creds), + ) + require.NoError(t, err) + defer conn.Close() + + authClient := builderpb.NewBuilderClient(conn) + + // Create and claim a build task + bt := graph.BuildTask.Create(). + SetTargetOs(c2pb.Host_PLATFORM_LINUX). + SetTargetFormat(builderpb.TargetFormat_TARGET_FORMAT_BIN). + SetBuildImage("golang:1.21"). + SetBuildScript("go build ./..."). + SetCallbackURI("https://callback.example.com"). + SetTransportType(c2pb.Transport_TRANSPORT_GRPC). + SetBuilderID(builders[0].ID). + SaveX(ctx) + + claimResp, err := authClient.ClaimBuildTasks(ctx, &builderpb.ClaimBuildTasksRequest{}) + require.NoError(t, err) + require.Len(t, claimResp.Tasks, 1) + + // Stream output with error + stream, err := authClient.StreamBuildTaskOutput(ctx) + require.NoError(t, err) + + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: int64(bt.ID), + Output: "partial output before failure", + })) + require.NoError(t, stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: int64(bt.ID), + Error: "compilation failed: missing dependency", + Finished: true, + ExitCode: 1, + })) + + _, err = stream.CloseAndRecv() + require.NoError(t, err) + + // Verify the build task has both output and error + reloaded := graph.BuildTask.GetX(ctx, bt.ID) + assert.Equal(t, "partial output before failure", reloaded.Output) + assert.Equal(t, "compilation failed: missing dependency", reloaded.Error) + assert.False(t, reloaded.FinishedAt.IsZero()) + require.NotNil(t, reloaded.ExitCode) + assert.Equal(t, 1, *reloaded.ExitCode) + }) + + // 13. Test: StreamBuildTaskOutput for another builder's task is rejected + t.Run("StreamBuildTaskOutputWrongBuilder", func(t *testing.T) { + // Register a second builder + var registerResp2 struct { + RegisterBuilder struct { + Builder struct { + ID string + } + Config string + } + } + err := gqlClient.Post(`mutation registerNewBuilder($input: CreateBuilderInput!) { + registerBuilder(input: $input) { + builder { id } + config + } + }`, ®isterResp2, client.Var("input", map[string]any{ + "supportedTargets": []string{"PLATFORM_WINDOWS"}, + "upstream": "https://tavern.example.com:443", + })) + require.NoError(t, err) + + cfg2, err := builder.ParseConfigBytes([]byte(registerResp2.RegisterBuilder.Config)) + require.NoError(t, err) + + // Get the second builder's DB entity + allBuilders, err := graph.Builder.Query().All(ctx) + require.NoError(t, err) + require.Len(t, allBuilders, 2) + + var secondBuilder int + for _, b := range allBuilders { + if b.Identifier == cfg2.ID { + secondBuilder = b.ID + } + } + + // Create a build task assigned to the second builder + bt := graph.BuildTask.Create(). + SetTargetOs(c2pb.Host_PLATFORM_WINDOWS). + SetTargetFormat(builderpb.TargetFormat_TARGET_FORMAT_BIN). + SetBuildImage("mcr.microsoft.com/windows:ltsc2022"). + SetBuildScript("msbuild /t:Build"). + SetCallbackURI("https://callback.example.com"). + SetTransportType(c2pb.Transport_TRANSPORT_GRPC). + SetBuilderID(secondBuilder). + SaveX(ctx) + + // Try to stream output using the FIRST builder's credentials + creds, err := builder.NewCredentialsFromConfig(cfg) + require.NoError(t, err) + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithPerRPCCredentials(creds), + ) + require.NoError(t, err) + defer conn.Close() + + authClient := builderpb.NewBuilderClient(conn) + + stream, err := authClient.StreamBuildTaskOutput(ctx) + require.NoError(t, err) + + // Send a message for the wrong builder's task + err = stream.Send(&builderpb.StreamBuildTaskOutputRequest{ + TaskId: int64(bt.ID), + Output: "should not be allowed", + }) + // The send might succeed but the server will reject on recv + if err == nil { + _, err = stream.CloseAndRecv() + } + require.Error(t, err) + assert.Equal(t, codes.PermissionDenied, status.Code(err)) }) } diff --git a/tavern/internal/builder/proto/builder.proto b/tavern/internal/builder/proto/builder.proto index 138641bc3..837585cb6 100644 --- a/tavern/internal/builder/proto/builder.proto +++ b/tavern/internal/builder/proto/builder.proto @@ -4,9 +4,50 @@ package builder; option go_package = "realm.pub/tavern/internal/builder/builderpb"; -message PingRequest {} -message PingResponse {} +enum TargetFormat { + TARGET_FORMAT_UNSPECIFIED = 0; + TARGET_FORMAT_BIN = 1; + TARGET_FORMAT_CDYLIB = 2; + TARGET_FORMAT_WINDOWS_SERVICE = 3; +} + +message ClaimBuildTasksRequest {} + +message BuildTaskSpec { + int64 id = 1; + string target_os = 2; + string build_image = 3; + string build_script = 4; + string artifact_path = 6; + repeated string env = 7; +} + +message ClaimBuildTasksResponse { + repeated BuildTaskSpec tasks = 1; +} + +message StreamBuildTaskOutputRequest { + int64 task_id = 1; + string output = 2; + string error = 3; + bool finished = 4; + int64 exit_code = 5; +} + +message StreamBuildTaskOutputResponse {} + +message UploadBuildArtifactRequest { + int64 task_id = 1; + string artifact_name = 2; + bytes chunk = 3; +} + +message UploadBuildArtifactResponse { + int64 asset_id = 1; +} service Builder { - rpc Ping(PingRequest) returns (PingResponse) {} + rpc ClaimBuildTasks(ClaimBuildTasksRequest) returns (ClaimBuildTasksResponse) {} + rpc StreamBuildTaskOutput(stream StreamBuildTaskOutputRequest) returns (StreamBuildTaskOutputResponse) {} + rpc UploadBuildArtifact(stream UploadBuildArtifactRequest) returns (UploadBuildArtifactResponse) {} } diff --git a/tavern/internal/builder/rollback.go b/tavern/internal/builder/rollback.go new file mode 100644 index 000000000..370ab7c93 --- /dev/null +++ b/tavern/internal/builder/rollback.go @@ -0,0 +1,16 @@ +package builder + +import ( + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "realm.pub/tavern/internal/ent" +) + +func rollback(tx *ent.Tx, err error) error { + if rerr := tx.Rollback(); rerr != nil { + err = fmt.Errorf("%w: %v", err, rerr) + } + return status.Errorf(codes.Internal, "%v", err) +} diff --git a/tavern/internal/builder/server.go b/tavern/internal/builder/server.go index c7f2d4c2c..865958e95 100644 --- a/tavern/internal/builder/server.go +++ b/tavern/internal/builder/server.go @@ -1,28 +1,378 @@ package builder import ( + "bytes" "context" + "crypto/rand" + "encoding/hex" + "fmt" + "io" "log/slog" + "strings" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + yaml "gopkg.in/yaml.v3" "realm.pub/tavern/internal/builder/builderpb" "realm.pub/tavern/internal/ent" + entbuilder "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" ) // Server implements the Builder gRPC service. type Server struct { - graph *ent.Client + graph *ent.Client + serverPubkey string builderpb.UnimplementedBuilderServer } // New creates a new Builder gRPC server. -func New(graph *ent.Client) *Server { +// serverPubkey is the base64-encoded X25519 server public key embedded into agent builds. +func New(graph *ent.Client, serverPubkey string) *Server { return &Server{ - graph: graph, + graph: graph, + serverPubkey: serverPubkey, + } +} + +// ClaimBuildTasks returns unclaimed build tasks assigned to the authenticated builder and marks them as claimed. +func (s *Server) ClaimBuildTasks(ctx context.Context, req *builderpb.ClaimBuildTasksRequest) (*builderpb.ClaimBuildTasksResponse, error) { + now := time.Now() + + // Extract authenticated builder from context + b, ok := BuilderFromContext(ctx) + if !ok { + return nil, status.Error(codes.Unauthenticated, "builder not authenticated") + } + + // Update builder's last_seen_at timestamp + if _, err := s.graph.Builder.UpdateOne(b). + SetLastSeenAt(now). + Save(ctx); err != nil { + slog.ErrorContext(ctx, "failed to update builder last_seen_at", + "builder_id", b.ID, "error", err) + } + + // Load unclaimed build tasks assigned to this builder + tasks, err := s.graph.BuildTask.Query(). + Where( + buildtask.HasBuilderWith(entbuilder.ID(b.ID)), + buildtask.ClaimedAtIsNil(), + ). + All(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to query build tasks: %v", err) + } + + // Prepare transaction for claiming tasks + tx, err := s.graph.Tx(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to initialize transaction: %v", err) + } + client := tx.Client() + + // Rollback transaction if we panic + defer func() { + if v := recover(); v != nil { + tx.Rollback() + panic(v) + } + }() + + // Update all ClaimedAt timestamps to claim tasks + taskIDs := make([]int, 0, len(tasks)) + for _, t := range tasks { + _, err := client.BuildTask.UpdateOne(t). + SetClaimedAt(now). + Save(ctx) + if err != nil { + return nil, rollback(tx, fmt.Errorf("failed to update build task %d: %w", t.ID, err)) + } + taskIDs = append(taskIDs, t.ID) + } + + // Commit the transaction + if err := tx.Commit(); err != nil { + return nil, rollback(tx, fmt.Errorf("failed to commit transaction: %w", err)) + } + + // Load the tasks with our non-transactional client (cannot use transaction after commit) + resp := &builderpb.ClaimBuildTasksResponse{} + resp.Tasks = make([]*builderpb.BuildTaskSpec, 0, len(taskIDs)) + for _, taskID := range taskIDs { + claimedTask, err := s.graph.BuildTask.Get(ctx, taskID) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to load claimed build task (but it was still claimed) %d: %v", taskID, err) + } + + // Derive the IMIX config YAML from the build task's stored fields. + imixCfg := ImixConfig{ + ServerPubkey: s.serverPubkey, + Transports: []ImixTransportConfig{ + { + URI: claimedTask.CallbackURI, + Interval: claimedTask.Interval, + Type: TransportTypeToString(claimedTask.TransportType), + Extra: claimedTask.Extra, + }, + }, + } + cfgBytes, err := yaml.Marshal(imixCfg) + if err != nil { + return nil, fmt.Errorf("failed to marshal IMIX config: %w", err) + } + // string(cfgBytes) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to marshal IMIX config for task %d: %v", taskID, err) + } + + resp.Tasks = append(resp.Tasks, &builderpb.BuildTaskSpec{ + Id: int64(claimedTask.ID), + TargetOs: claimedTask.TargetOs.String(), + BuildImage: claimedTask.BuildImage, + BuildScript: claimedTask.BuildScript, + ArtifactPath: claimedTask.ArtifactPath, + Env: []string{fmt.Sprintf("IMIX_CONFIG=%s", string(cfgBytes))}, + }) + } + + slog.InfoContext(ctx, "builder claimed build tasks", + "builder_id", b.ID, + "task_count", len(resp.Tasks), + ) + + return resp, nil +} + +// StreamBuildTaskOutput receives a stream of build output messages from the builder client. +// Each message is flushed to the database immediately. On the final message (finished=true) +// or stream close, the task is finalized. +func (s *Server) StreamBuildTaskOutput(stream builderpb.Builder_StreamBuildTaskOutputServer) error { + ctx := stream.Context() + + b, ok := BuilderFromContext(ctx) + if !ok { + return status.Error(codes.Unauthenticated, "builder not authenticated") + } + + var ( + taskID int64 + finished bool + ) + + for { + req, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return status.Errorf(codes.Internal, "failed to receive stream message: %v", err) + } + + // First message: validate task ownership and set started_at. + if taskID == 0 { + taskID = req.TaskId + if taskID == 0 { + return status.Error(codes.InvalidArgument, "first message must include task_id") + } + + bt, err := s.graph.BuildTask.Get(ctx, int(taskID)) + if err != nil { + return status.Errorf(codes.NotFound, "build task %d not found: %v", taskID, err) + } + btBuilder, err := bt.QueryBuilder().Only(ctx) + if err != nil { + return status.Errorf(codes.Internal, "failed to query builder for task %d: %v", taskID, err) + } + if btBuilder.ID != b.ID { + return status.Errorf(codes.PermissionDenied, "build task %d is not assigned to this builder", taskID) + } + + // Idempotency: if already finished, return success. + if !bt.FinishedAt.IsZero() { + slog.WarnContext(ctx, "duplicate stream for already-finished build task", + "task_id", taskID, "builder_id", b.ID) + return stream.SendAndClose(&builderpb.StreamBuildTaskOutputResponse{}) + } + + // Set started_at if not already set. + if bt.StartedAt.IsZero() { + if _, err := s.graph.BuildTask.UpdateOne(bt). + SetStartedAt(time.Now()). + Save(ctx); err != nil { + slog.ErrorContext(ctx, "failed to set started_at", + "task_id", taskID, "error", err) + } + } + } + + if req.TaskId != 0 && req.TaskId != taskID { + return status.Errorf(codes.InvalidArgument, "task_id changed mid-stream: got %d, expected %d", req.TaskId, taskID) + } + + if req.Finished { + finished = true + } + + // Flush every message to the database immediately. + if req.Output != "" || req.Error != "" || finished { + if err := s.flushStreamOutput(ctx, int(taskID), req.Output, req.Error, finished, req.ExitCode); err != nil { + return status.Errorf(codes.Internal, "failed to flush build output for task %d: %v", taskID, err) + } + } + + if finished { + break + } } + + if taskID == 0 { + return status.Error(codes.InvalidArgument, "no messages received") + } + + slog.InfoContext(ctx, "build task stream completed", + "task_id", taskID, + "builder_id", b.ID, + "finished", finished, + ) + + return stream.SendAndClose(&builderpb.StreamBuildTaskOutputResponse{}) } -// Ping is a simple health check endpoint. -func (s *Server) Ping(ctx context.Context, req *builderpb.PingRequest) (*builderpb.PingResponse, error) { - slog.Info("ping!") - return &builderpb.PingResponse{}, nil +// UploadBuildArtifact receives a chunked binary artifact stream from the builder client +// and creates an Asset entity. +func (s *Server) UploadBuildArtifact(stream builderpb.Builder_UploadBuildArtifactServer) error { + ctx := stream.Context() + + b, ok := BuilderFromContext(ctx) + if !ok { + return status.Error(codes.Unauthenticated, "builder not authenticated") + } + + var ( + taskID int64 + artifactName string + buf bytes.Buffer + ) + + for { + req, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return status.Errorf(codes.Internal, "failed to receive artifact chunk: %v", err) + } + + // First message: validate task ownership. + if taskID == 0 { + taskID = req.TaskId + if taskID == 0 { + return status.Error(codes.InvalidArgument, "first message must include task_id") + } + artifactName = req.ArtifactName + if artifactName == "" { + artifactName = fmt.Sprintf("artifact-%d", taskID) + } + + bt, err := s.graph.BuildTask.Get(ctx, int(taskID)) + if err != nil { + return status.Errorf(codes.NotFound, "build task %d not found: %v", taskID, err) + } + btBuilder, err := bt.QueryBuilder().Only(ctx) + if err != nil { + return status.Errorf(codes.Internal, "failed to query builder for task %d: %v", taskID, err) + } + if btBuilder.ID != b.ID { + return status.Errorf(codes.PermissionDenied, "build task %d is not assigned to this builder", taskID) + } + } + + buf.Write(req.Chunk) + } + + if taskID == 0 { + return status.Error(codes.InvalidArgument, "no messages received") + } + + if buf.Len() == 0 { + return status.Error(codes.InvalidArgument, "empty artifact") + } + + // Load build task to get target_os and target_format for the asset name. + bt, err := s.graph.BuildTask.Get(ctx, int(taskID)) + if err != nil { + return status.Errorf(codes.Internal, "failed to load build task for asset naming: %v", err) + } + + // Generate 6 random bytes for a unique suffix. + randomBytes := make([]byte, 3) + if _, err := rand.Read(randomBytes); err != nil { + return status.Errorf(codes.Internal, "failed to generate random suffix: %v", err) + } + randomSuffix := hex.EncodeToString(randomBytes) + + osName := strings.ToLower(strings.TrimPrefix(bt.TargetOs.String(), "PLATFORM_")) + formatName := strings.ToLower(strings.TrimPrefix(bt.TargetFormat.String(), "TARGET_FORMAT_")) + assetName := fmt.Sprintf("build/%s/%s/imix-%s", osName, formatName, randomSuffix) + asset, err := s.graph.Asset.Create(). + SetName(assetName). + SetContent(buf.Bytes()). + Save(ctx) + if err != nil { + return status.Errorf(codes.Internal, "failed to create asset: %v", err) + } + + slog.InfoContext(ctx, "build artifact uploaded", + "task_id", taskID, + "builder_id", b.ID, + "asset_id", asset.ID, + "size", buf.Len(), + ) + + return stream.SendAndClose(&builderpb.UploadBuildArtifactResponse{ + AssetId: int64(asset.ID), + }) +} + +// flushStreamOutput appends output and error to the build task in the database. +// If finished is true, it also sets finished_at and exit_code to mark the task as complete. +func (s *Server) flushStreamOutput(ctx context.Context, taskID int, output string, errMsg string, finished bool, exitCode int64) error { + bt, err := s.graph.BuildTask.Get(ctx, taskID) + if err != nil { + return fmt.Errorf("failed to load build task %d: %w", taskID, err) + } + + // Append new content to any existing output already stored from previous flushes. + newOutput := output + if bt.Output != "" && newOutput != "" { + newOutput = bt.Output + "\n" + newOutput + } else if bt.Output != "" { + newOutput = bt.Output + } + + newError := errMsg + if bt.Error != "" && newError != "" { + newError = bt.Error + "\n" + newError + } else if bt.Error != "" { + newError = bt.Error + } + + update := s.graph.BuildTask.UpdateOne(bt). + SetOutput(newOutput) + if newError != "" { + update = update.SetError(newError) + } + if finished { + update = update.SetFinishedAt(time.Now()). + SetExitCode(int(exitCode)) + } + + if _, err := update.Save(ctx); err != nil { + return fmt.Errorf("failed to update build task %d: %w", taskID, err) + } + + return nil } diff --git a/tavern/internal/ent/builder.go b/tavern/internal/ent/builder.go index 527ec31a2..8baf8c211 100644 --- a/tavern/internal/ent/builder.go +++ b/tavern/internal/ent/builder.go @@ -28,10 +28,37 @@ type Builder struct { // The platforms this builder can build agents for. SupportedTargets []c2pb.Host_Platform `json:"supported_targets,omitempty"` // The server address that the builder should connect to. - Upstream string `json:"upstream,omitempty"` + Upstream string `json:"upstream,omitempty"` + // Timestamp of the builder's last ClaimBuildTasks call. Null if never seen. + LastSeenAt *time.Time `json:"last_seen_at,omitempty"` + // Edges holds the relations/edges for other nodes in the graph. + // The values are being populated by the BuilderQuery when eager-loading is set. + Edges BuilderEdges `json:"edges"` selectValues sql.SelectValues } +// BuilderEdges holds the relations/edges for other nodes in the graph. +type BuilderEdges struct { + // Build tasks assigned to this builder. + BuildTasks []*BuildTask `json:"build_tasks,omitempty"` + // loadedTypes holds the information for reporting if a + // type was loaded (or requested) in eager-loading or not. + loadedTypes [1]bool + // totalCount holds the count of the edges above. + totalCount [1]map[string]int + + namedBuildTasks map[string][]*BuildTask +} + +// BuildTasksOrErr returns the BuildTasks value or an error if the edge +// was not loaded in eager-loading. +func (e BuilderEdges) BuildTasksOrErr() ([]*BuildTask, error) { + if e.loadedTypes[0] { + return e.BuildTasks, nil + } + return nil, &NotLoadedError{edge: "build_tasks"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*Builder) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) @@ -43,7 +70,7 @@ func (*Builder) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullInt64) case builder.FieldIdentifier, builder.FieldUpstream: values[i] = new(sql.NullString) - case builder.FieldCreatedAt, builder.FieldLastModifiedAt: + case builder.FieldCreatedAt, builder.FieldLastModifiedAt, builder.FieldLastSeenAt: values[i] = new(sql.NullTime) default: values[i] = new(sql.UnknownType) @@ -98,6 +125,13 @@ func (b *Builder) assignValues(columns []string, values []any) error { } else if value.Valid { b.Upstream = value.String } + case builder.FieldLastSeenAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field last_seen_at", values[i]) + } else if value.Valid { + b.LastSeenAt = new(time.Time) + *b.LastSeenAt = value.Time + } default: b.selectValues.Set(columns[i], values[i]) } @@ -111,6 +145,11 @@ func (b *Builder) Value(name string) (ent.Value, error) { return b.selectValues.Get(name) } +// QueryBuildTasks queries the "build_tasks" edge of the Builder entity. +func (b *Builder) QueryBuildTasks() *BuildTaskQuery { + return NewBuilderClient(b.config).QueryBuildTasks(b) +} + // Update returns a builder for updating this Builder. // Note that you need to call Builder.Unwrap() before calling this method if this Builder // was returned from a transaction, and the transaction was committed or rolled back. @@ -148,9 +187,38 @@ func (b *Builder) String() string { builder.WriteString(", ") builder.WriteString("upstream=") builder.WriteString(b.Upstream) + builder.WriteString(", ") + if v := b.LastSeenAt; v != nil { + builder.WriteString("last_seen_at=") + builder.WriteString(v.Format(time.ANSIC)) + } builder.WriteByte(')') return builder.String() } +// NamedBuildTasks returns the BuildTasks named value or an error if the edge was not +// loaded in eager-loading with this name. +func (b *Builder) NamedBuildTasks(name string) ([]*BuildTask, error) { + if b.Edges.namedBuildTasks == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := b.Edges.namedBuildTasks[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (b *Builder) appendNamedBuildTasks(name string, edges ...*BuildTask) { + if b.Edges.namedBuildTasks == nil { + b.Edges.namedBuildTasks = make(map[string][]*BuildTask) + } + if len(edges) == 0 { + b.Edges.namedBuildTasks[name] = []*BuildTask{} + } else { + b.Edges.namedBuildTasks[name] = append(b.Edges.namedBuildTasks[name], edges...) + } +} + // Builders is a parsable slice of Builder. type Builders []*Builder diff --git a/tavern/internal/ent/builder/builder.go b/tavern/internal/ent/builder/builder.go index 19caff758..eff483ea6 100644 --- a/tavern/internal/ent/builder/builder.go +++ b/tavern/internal/ent/builder/builder.go @@ -6,6 +6,7 @@ import ( "time" "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" ) const ( @@ -23,8 +24,19 @@ const ( FieldSupportedTargets = "supported_targets" // FieldUpstream holds the string denoting the upstream field in the database. FieldUpstream = "upstream" + // FieldLastSeenAt holds the string denoting the last_seen_at field in the database. + FieldLastSeenAt = "last_seen_at" + // EdgeBuildTasks holds the string denoting the build_tasks edge name in mutations. + EdgeBuildTasks = "build_tasks" // Table holds the table name of the builder in the database. Table = "builders" + // BuildTasksTable is the table that holds the build_tasks relation/edge. + BuildTasksTable = "build_tasks" + // BuildTasksInverseTable is the table name for the BuildTask entity. + // It exists in this package in order to avoid circular dependency with the "buildtask" package. + BuildTasksInverseTable = "build_tasks" + // BuildTasksColumn is the table column denoting the build_tasks relation/edge. + BuildTasksColumn = "build_task_builder" ) // Columns holds all SQL columns for builder fields. @@ -35,6 +47,7 @@ var Columns = []string{ FieldIdentifier, FieldSupportedTargets, FieldUpstream, + FieldLastSeenAt, } // ValidColumn reports if the column name is valid (part of the table columns). @@ -87,3 +100,29 @@ func ByIdentifier(opts ...sql.OrderTermOption) OrderOption { func ByUpstream(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpstream, opts...).ToFunc() } + +// ByLastSeenAt orders the results by the last_seen_at field. +func ByLastSeenAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldLastSeenAt, opts...).ToFunc() +} + +// ByBuildTasksCount orders the results by build_tasks count. +func ByBuildTasksCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newBuildTasksStep(), opts...) + } +} + +// ByBuildTasks orders the results by build_tasks terms. +func ByBuildTasks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newBuildTasksStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} +func newBuildTasksStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(BuildTasksInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, BuildTasksTable, BuildTasksColumn), + ) +} diff --git a/tavern/internal/ent/builder/where.go b/tavern/internal/ent/builder/where.go index fcf05be32..bf18a5e59 100644 --- a/tavern/internal/ent/builder/where.go +++ b/tavern/internal/ent/builder/where.go @@ -6,6 +6,7 @@ import ( "time" "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" "realm.pub/tavern/internal/ent/predicate" ) @@ -74,6 +75,11 @@ func Upstream(v string) predicate.Builder { return predicate.Builder(sql.FieldEQ(FieldUpstream, v)) } +// LastSeenAt applies equality check predicate on the "last_seen_at" field. It's identical to LastSeenAtEQ. +func LastSeenAt(v time.Time) predicate.Builder { + return predicate.Builder(sql.FieldEQ(FieldLastSeenAt, v)) +} + // CreatedAtEQ applies the EQ predicate on the "created_at" field. func CreatedAtEQ(v time.Time) predicate.Builder { return predicate.Builder(sql.FieldEQ(FieldCreatedAt, v)) @@ -284,6 +290,79 @@ func UpstreamContainsFold(v string) predicate.Builder { return predicate.Builder(sql.FieldContainsFold(FieldUpstream, v)) } +// LastSeenAtEQ applies the EQ predicate on the "last_seen_at" field. +func LastSeenAtEQ(v time.Time) predicate.Builder { + return predicate.Builder(sql.FieldEQ(FieldLastSeenAt, v)) +} + +// LastSeenAtNEQ applies the NEQ predicate on the "last_seen_at" field. +func LastSeenAtNEQ(v time.Time) predicate.Builder { + return predicate.Builder(sql.FieldNEQ(FieldLastSeenAt, v)) +} + +// LastSeenAtIn applies the In predicate on the "last_seen_at" field. +func LastSeenAtIn(vs ...time.Time) predicate.Builder { + return predicate.Builder(sql.FieldIn(FieldLastSeenAt, vs...)) +} + +// LastSeenAtNotIn applies the NotIn predicate on the "last_seen_at" field. +func LastSeenAtNotIn(vs ...time.Time) predicate.Builder { + return predicate.Builder(sql.FieldNotIn(FieldLastSeenAt, vs...)) +} + +// LastSeenAtGT applies the GT predicate on the "last_seen_at" field. +func LastSeenAtGT(v time.Time) predicate.Builder { + return predicate.Builder(sql.FieldGT(FieldLastSeenAt, v)) +} + +// LastSeenAtGTE applies the GTE predicate on the "last_seen_at" field. +func LastSeenAtGTE(v time.Time) predicate.Builder { + return predicate.Builder(sql.FieldGTE(FieldLastSeenAt, v)) +} + +// LastSeenAtLT applies the LT predicate on the "last_seen_at" field. +func LastSeenAtLT(v time.Time) predicate.Builder { + return predicate.Builder(sql.FieldLT(FieldLastSeenAt, v)) +} + +// LastSeenAtLTE applies the LTE predicate on the "last_seen_at" field. +func LastSeenAtLTE(v time.Time) predicate.Builder { + return predicate.Builder(sql.FieldLTE(FieldLastSeenAt, v)) +} + +// LastSeenAtIsNil applies the IsNil predicate on the "last_seen_at" field. +func LastSeenAtIsNil() predicate.Builder { + return predicate.Builder(sql.FieldIsNull(FieldLastSeenAt)) +} + +// LastSeenAtNotNil applies the NotNil predicate on the "last_seen_at" field. +func LastSeenAtNotNil() predicate.Builder { + return predicate.Builder(sql.FieldNotNull(FieldLastSeenAt)) +} + +// HasBuildTasks applies the HasEdge predicate on the "build_tasks" edge. +func HasBuildTasks() predicate.Builder { + return predicate.Builder(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, BuildTasksTable, BuildTasksColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBuildTasksWith applies the HasEdge predicate on the "build_tasks" edge with a given conditions (other predicates). +func HasBuildTasksWith(preds ...predicate.BuildTask) predicate.Builder { + return predicate.Builder(func(s *sql.Selector) { + step := newBuildTasksStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.Builder) predicate.Builder { return predicate.Builder(sql.AndPredicates(predicates...)) diff --git a/tavern/internal/ent/builder_create.go b/tavern/internal/ent/builder_create.go index 371beb2c0..035cd8fa7 100644 --- a/tavern/internal/ent/builder_create.go +++ b/tavern/internal/ent/builder_create.go @@ -13,6 +13,7 @@ import ( "entgo.io/ent/schema/field" "realm.pub/tavern/internal/c2/c2pb" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" ) // BuilderCreate is the builder for creating a Builder entity. @@ -77,6 +78,35 @@ func (bc *BuilderCreate) SetUpstream(s string) *BuilderCreate { return bc } +// SetLastSeenAt sets the "last_seen_at" field. +func (bc *BuilderCreate) SetLastSeenAt(t time.Time) *BuilderCreate { + bc.mutation.SetLastSeenAt(t) + return bc +} + +// SetNillableLastSeenAt sets the "last_seen_at" field if the given value is not nil. +func (bc *BuilderCreate) SetNillableLastSeenAt(t *time.Time) *BuilderCreate { + if t != nil { + bc.SetLastSeenAt(*t) + } + return bc +} + +// AddBuildTaskIDs adds the "build_tasks" edge to the BuildTask entity by IDs. +func (bc *BuilderCreate) AddBuildTaskIDs(ids ...int) *BuilderCreate { + bc.mutation.AddBuildTaskIDs(ids...) + return bc +} + +// AddBuildTasks adds the "build_tasks" edges to the BuildTask entity. +func (bc *BuilderCreate) AddBuildTasks(b ...*BuildTask) *BuilderCreate { + ids := make([]int, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return bc.AddBuildTaskIDs(ids...) +} + // Mutation returns the BuilderMutation object of the builder. func (bc *BuilderCreate) Mutation() *BuilderMutation { return bc.mutation @@ -195,6 +225,26 @@ func (bc *BuilderCreate) createSpec() (*Builder, *sqlgraph.CreateSpec) { _spec.SetField(builder.FieldUpstream, field.TypeString, value) _node.Upstream = value } + if value, ok := bc.mutation.LastSeenAt(); ok { + _spec.SetField(builder.FieldLastSeenAt, field.TypeTime, value) + _node.LastSeenAt = &value + } + if nodes := bc.mutation.BuildTasksIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: builder.BuildTasksTable, + Columns: []string{builder.BuildTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } @@ -283,6 +333,24 @@ func (u *BuilderUpsert) UpdateUpstream() *BuilderUpsert { return u } +// SetLastSeenAt sets the "last_seen_at" field. +func (u *BuilderUpsert) SetLastSeenAt(v time.Time) *BuilderUpsert { + u.Set(builder.FieldLastSeenAt, v) + return u +} + +// UpdateLastSeenAt sets the "last_seen_at" field to the value that was provided on create. +func (u *BuilderUpsert) UpdateLastSeenAt() *BuilderUpsert { + u.SetExcluded(builder.FieldLastSeenAt) + return u +} + +// ClearLastSeenAt clears the value of the "last_seen_at" field. +func (u *BuilderUpsert) ClearLastSeenAt() *BuilderUpsert { + u.SetNull(builder.FieldLastSeenAt) + return u +} + // UpdateNewValues updates the mutable fields using the new values that were set on create. // Using this option is equivalent to using: // @@ -373,6 +441,27 @@ func (u *BuilderUpsertOne) UpdateUpstream() *BuilderUpsertOne { }) } +// SetLastSeenAt sets the "last_seen_at" field. +func (u *BuilderUpsertOne) SetLastSeenAt(v time.Time) *BuilderUpsertOne { + return u.Update(func(s *BuilderUpsert) { + s.SetLastSeenAt(v) + }) +} + +// UpdateLastSeenAt sets the "last_seen_at" field to the value that was provided on create. +func (u *BuilderUpsertOne) UpdateLastSeenAt() *BuilderUpsertOne { + return u.Update(func(s *BuilderUpsert) { + s.UpdateLastSeenAt() + }) +} + +// ClearLastSeenAt clears the value of the "last_seen_at" field. +func (u *BuilderUpsertOne) ClearLastSeenAt() *BuilderUpsertOne { + return u.Update(func(s *BuilderUpsert) { + s.ClearLastSeenAt() + }) +} + // Exec executes the query. func (u *BuilderUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -629,6 +718,27 @@ func (u *BuilderUpsertBulk) UpdateUpstream() *BuilderUpsertBulk { }) } +// SetLastSeenAt sets the "last_seen_at" field. +func (u *BuilderUpsertBulk) SetLastSeenAt(v time.Time) *BuilderUpsertBulk { + return u.Update(func(s *BuilderUpsert) { + s.SetLastSeenAt(v) + }) +} + +// UpdateLastSeenAt sets the "last_seen_at" field to the value that was provided on create. +func (u *BuilderUpsertBulk) UpdateLastSeenAt() *BuilderUpsertBulk { + return u.Update(func(s *BuilderUpsert) { + s.UpdateLastSeenAt() + }) +} + +// ClearLastSeenAt clears the value of the "last_seen_at" field. +func (u *BuilderUpsertBulk) ClearLastSeenAt() *BuilderUpsertBulk { + return u.Update(func(s *BuilderUpsert) { + s.ClearLastSeenAt() + }) +} + // Exec executes the query. func (u *BuilderUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/tavern/internal/ent/builder_query.go b/tavern/internal/ent/builder_query.go index 71412c4b0..c206e4e13 100644 --- a/tavern/internal/ent/builder_query.go +++ b/tavern/internal/ent/builder_query.go @@ -4,6 +4,7 @@ package ent import ( "context" + "database/sql/driver" "fmt" "math" @@ -12,18 +13,21 @@ import ( "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/predicate" ) // BuilderQuery is the builder for querying Builder entities. type BuilderQuery struct { config - ctx *QueryContext - order []builder.OrderOption - inters []Interceptor - predicates []predicate.Builder - modifiers []func(*sql.Selector) - loadTotal []func(context.Context, []*Builder) error + ctx *QueryContext + order []builder.OrderOption + inters []Interceptor + predicates []predicate.Builder + withBuildTasks *BuildTaskQuery + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*Builder) error + withNamedBuildTasks map[string]*BuildTaskQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -60,6 +64,28 @@ func (bq *BuilderQuery) Order(o ...builder.OrderOption) *BuilderQuery { return bq } +// QueryBuildTasks chains the current query on the "build_tasks" edge. +func (bq *BuilderQuery) QueryBuildTasks() *BuildTaskQuery { + query := (&BuildTaskClient{config: bq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := bq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := bq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(builder.Table, builder.FieldID, selector), + sqlgraph.To(buildtask.Table, buildtask.FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, builder.BuildTasksTable, builder.BuildTasksColumn), + ) + fromU = sqlgraph.SetNeighbors(bq.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first Builder entity from the query. // Returns a *NotFoundError when no Builder was found. func (bq *BuilderQuery) First(ctx context.Context) (*Builder, error) { @@ -247,17 +273,29 @@ func (bq *BuilderQuery) Clone() *BuilderQuery { return nil } return &BuilderQuery{ - config: bq.config, - ctx: bq.ctx.Clone(), - order: append([]builder.OrderOption{}, bq.order...), - inters: append([]Interceptor{}, bq.inters...), - predicates: append([]predicate.Builder{}, bq.predicates...), + config: bq.config, + ctx: bq.ctx.Clone(), + order: append([]builder.OrderOption{}, bq.order...), + inters: append([]Interceptor{}, bq.inters...), + predicates: append([]predicate.Builder{}, bq.predicates...), + withBuildTasks: bq.withBuildTasks.Clone(), // clone intermediate query. sql: bq.sql.Clone(), path: bq.path, } } +// WithBuildTasks tells the query-builder to eager-load the nodes that are connected to +// the "build_tasks" edge. The optional arguments are used to configure the query builder of the edge. +func (bq *BuilderQuery) WithBuildTasks(opts ...func(*BuildTaskQuery)) *BuilderQuery { + query := (&BuildTaskClient{config: bq.config}).Query() + for _, opt := range opts { + opt(query) + } + bq.withBuildTasks = query + return bq +} + // GroupBy is used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -334,8 +372,11 @@ func (bq *BuilderQuery) prepareQuery(ctx context.Context) error { func (bq *BuilderQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Builder, error) { var ( - nodes = []*Builder{} - _spec = bq.querySpec() + nodes = []*Builder{} + _spec = bq.querySpec() + loadedTypes = [1]bool{ + bq.withBuildTasks != nil, + } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*Builder).scanValues(nil, columns) @@ -343,6 +384,7 @@ func (bq *BuilderQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Buil _spec.Assign = func(columns []string, values []any) error { node := &Builder{config: bq.config} nodes = append(nodes, node) + node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(bq.modifiers) > 0 { @@ -357,6 +399,20 @@ func (bq *BuilderQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Buil if len(nodes) == 0 { return nodes, nil } + if query := bq.withBuildTasks; query != nil { + if err := bq.loadBuildTasks(ctx, query, nodes, + func(n *Builder) { n.Edges.BuildTasks = []*BuildTask{} }, + func(n *Builder, e *BuildTask) { n.Edges.BuildTasks = append(n.Edges.BuildTasks, e) }); err != nil { + return nil, err + } + } + for name, query := range bq.withNamedBuildTasks { + if err := bq.loadBuildTasks(ctx, query, nodes, + func(n *Builder) { n.appendNamedBuildTasks(name) }, + func(n *Builder, e *BuildTask) { n.appendNamedBuildTasks(name, e) }); err != nil { + return nil, err + } + } for i := range bq.loadTotal { if err := bq.loadTotal[i](ctx, nodes); err != nil { return nil, err @@ -365,6 +421,38 @@ func (bq *BuilderQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Buil return nodes, nil } +func (bq *BuilderQuery) loadBuildTasks(ctx context.Context, query *BuildTaskQuery, nodes []*Builder, init func(*Builder), assign func(*Builder, *BuildTask)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*Builder) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.BuildTask(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(builder.BuildTasksColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.build_task_builder + if fk == nil { + return fmt.Errorf(`foreign-key "build_task_builder" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "build_task_builder" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} + func (bq *BuilderQuery) sqlCount(ctx context.Context) (int, error) { _spec := bq.querySpec() if len(bq.modifiers) > 0 { @@ -449,6 +537,20 @@ func (bq *BuilderQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// WithNamedBuildTasks tells the query-builder to eager-load the nodes that are connected to the "build_tasks" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (bq *BuilderQuery) WithNamedBuildTasks(name string, opts ...func(*BuildTaskQuery)) *BuilderQuery { + query := (&BuildTaskClient{config: bq.config}).Query() + for _, opt := range opts { + opt(query) + } + if bq.withNamedBuildTasks == nil { + bq.withNamedBuildTasks = make(map[string]*BuildTaskQuery) + } + bq.withNamedBuildTasks[name] = query + return bq +} + // BuilderGroupBy is the group-by builder for Builder entities. type BuilderGroupBy struct { selector diff --git a/tavern/internal/ent/builder_update.go b/tavern/internal/ent/builder_update.go index bb70a9a18..64eb1b847 100644 --- a/tavern/internal/ent/builder_update.go +++ b/tavern/internal/ent/builder_update.go @@ -14,6 +14,7 @@ import ( "entgo.io/ent/schema/field" "realm.pub/tavern/internal/c2/c2pb" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/predicate" ) @@ -62,11 +63,67 @@ func (bu *BuilderUpdate) SetNillableUpstream(s *string) *BuilderUpdate { return bu } +// SetLastSeenAt sets the "last_seen_at" field. +func (bu *BuilderUpdate) SetLastSeenAt(t time.Time) *BuilderUpdate { + bu.mutation.SetLastSeenAt(t) + return bu +} + +// SetNillableLastSeenAt sets the "last_seen_at" field if the given value is not nil. +func (bu *BuilderUpdate) SetNillableLastSeenAt(t *time.Time) *BuilderUpdate { + if t != nil { + bu.SetLastSeenAt(*t) + } + return bu +} + +// ClearLastSeenAt clears the value of the "last_seen_at" field. +func (bu *BuilderUpdate) ClearLastSeenAt() *BuilderUpdate { + bu.mutation.ClearLastSeenAt() + return bu +} + +// AddBuildTaskIDs adds the "build_tasks" edge to the BuildTask entity by IDs. +func (bu *BuilderUpdate) AddBuildTaskIDs(ids ...int) *BuilderUpdate { + bu.mutation.AddBuildTaskIDs(ids...) + return bu +} + +// AddBuildTasks adds the "build_tasks" edges to the BuildTask entity. +func (bu *BuilderUpdate) AddBuildTasks(b ...*BuildTask) *BuilderUpdate { + ids := make([]int, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return bu.AddBuildTaskIDs(ids...) +} + // Mutation returns the BuilderMutation object of the builder. func (bu *BuilderUpdate) Mutation() *BuilderMutation { return bu.mutation } +// ClearBuildTasks clears all "build_tasks" edges to the BuildTask entity. +func (bu *BuilderUpdate) ClearBuildTasks() *BuilderUpdate { + bu.mutation.ClearBuildTasks() + return bu +} + +// RemoveBuildTaskIDs removes the "build_tasks" edge to BuildTask entities by IDs. +func (bu *BuilderUpdate) RemoveBuildTaskIDs(ids ...int) *BuilderUpdate { + bu.mutation.RemoveBuildTaskIDs(ids...) + return bu +} + +// RemoveBuildTasks removes "build_tasks" edges to BuildTask entities. +func (bu *BuilderUpdate) RemoveBuildTasks(b ...*BuildTask) *BuilderUpdate { + ids := make([]int, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return bu.RemoveBuildTaskIDs(ids...) +} + // Save executes the query and returns the number of nodes affected by the update operation. func (bu *BuilderUpdate) Save(ctx context.Context) (int, error) { bu.defaults() @@ -126,6 +183,57 @@ func (bu *BuilderUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := bu.mutation.Upstream(); ok { _spec.SetField(builder.FieldUpstream, field.TypeString, value) } + if value, ok := bu.mutation.LastSeenAt(); ok { + _spec.SetField(builder.FieldLastSeenAt, field.TypeTime, value) + } + if bu.mutation.LastSeenAtCleared() { + _spec.ClearField(builder.FieldLastSeenAt, field.TypeTime) + } + if bu.mutation.BuildTasksCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: builder.BuildTasksTable, + Columns: []string{builder.BuildTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := bu.mutation.RemovedBuildTasksIDs(); len(nodes) > 0 && !bu.mutation.BuildTasksCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: builder.BuildTasksTable, + Columns: []string{builder.BuildTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := bu.mutation.BuildTasksIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: builder.BuildTasksTable, + Columns: []string{builder.BuildTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if n, err = sqlgraph.UpdateNodes(ctx, bu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{builder.Label} @@ -178,11 +286,67 @@ func (buo *BuilderUpdateOne) SetNillableUpstream(s *string) *BuilderUpdateOne { return buo } +// SetLastSeenAt sets the "last_seen_at" field. +func (buo *BuilderUpdateOne) SetLastSeenAt(t time.Time) *BuilderUpdateOne { + buo.mutation.SetLastSeenAt(t) + return buo +} + +// SetNillableLastSeenAt sets the "last_seen_at" field if the given value is not nil. +func (buo *BuilderUpdateOne) SetNillableLastSeenAt(t *time.Time) *BuilderUpdateOne { + if t != nil { + buo.SetLastSeenAt(*t) + } + return buo +} + +// ClearLastSeenAt clears the value of the "last_seen_at" field. +func (buo *BuilderUpdateOne) ClearLastSeenAt() *BuilderUpdateOne { + buo.mutation.ClearLastSeenAt() + return buo +} + +// AddBuildTaskIDs adds the "build_tasks" edge to the BuildTask entity by IDs. +func (buo *BuilderUpdateOne) AddBuildTaskIDs(ids ...int) *BuilderUpdateOne { + buo.mutation.AddBuildTaskIDs(ids...) + return buo +} + +// AddBuildTasks adds the "build_tasks" edges to the BuildTask entity. +func (buo *BuilderUpdateOne) AddBuildTasks(b ...*BuildTask) *BuilderUpdateOne { + ids := make([]int, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return buo.AddBuildTaskIDs(ids...) +} + // Mutation returns the BuilderMutation object of the builder. func (buo *BuilderUpdateOne) Mutation() *BuilderMutation { return buo.mutation } +// ClearBuildTasks clears all "build_tasks" edges to the BuildTask entity. +func (buo *BuilderUpdateOne) ClearBuildTasks() *BuilderUpdateOne { + buo.mutation.ClearBuildTasks() + return buo +} + +// RemoveBuildTaskIDs removes the "build_tasks" edge to BuildTask entities by IDs. +func (buo *BuilderUpdateOne) RemoveBuildTaskIDs(ids ...int) *BuilderUpdateOne { + buo.mutation.RemoveBuildTaskIDs(ids...) + return buo +} + +// RemoveBuildTasks removes "build_tasks" edges to BuildTask entities. +func (buo *BuilderUpdateOne) RemoveBuildTasks(b ...*BuildTask) *BuilderUpdateOne { + ids := make([]int, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return buo.RemoveBuildTaskIDs(ids...) +} + // Where appends a list predicates to the BuilderUpdate builder. func (buo *BuilderUpdateOne) Where(ps ...predicate.Builder) *BuilderUpdateOne { buo.mutation.Where(ps...) @@ -272,6 +436,57 @@ func (buo *BuilderUpdateOne) sqlSave(ctx context.Context) (_node *Builder, err e if value, ok := buo.mutation.Upstream(); ok { _spec.SetField(builder.FieldUpstream, field.TypeString, value) } + if value, ok := buo.mutation.LastSeenAt(); ok { + _spec.SetField(builder.FieldLastSeenAt, field.TypeTime, value) + } + if buo.mutation.LastSeenAtCleared() { + _spec.ClearField(builder.FieldLastSeenAt, field.TypeTime) + } + if buo.mutation.BuildTasksCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: builder.BuildTasksTable, + Columns: []string{builder.BuildTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := buo.mutation.RemovedBuildTasksIDs(); len(nodes) > 0 && !buo.mutation.BuildTasksCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: builder.BuildTasksTable, + Columns: []string{builder.BuildTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := buo.mutation.BuildTasksIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: builder.BuildTasksTable, + Columns: []string{builder.BuildTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &Builder{config: buo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/tavern/internal/ent/buildtask.go b/tavern/internal/ent/buildtask.go new file mode 100644 index 000000000..20e24af5c --- /dev/null +++ b/tavern/internal/ent/buildtask.go @@ -0,0 +1,385 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "fmt" + "strings" + "time" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/c2/c2pb" + "realm.pub/tavern/internal/ent/asset" + "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" +) + +// BuildTask is the model entity for the BuildTask schema. +type BuildTask struct { + config `json:"-"` + // ID of the ent. + ID int `json:"id,omitempty"` + // Timestamp of when this ent was created + CreatedAt time.Time `json:"created_at,omitempty"` + // Timestamp of when this ent was last updated + LastModifiedAt time.Time `json:"last_modified_at,omitempty"` + // The target operating system platform for this build. + TargetOs c2pb.Host_Platform `json:"target_os,omitempty"` + // The output format for the build (BIN, CDYLIB, WINDOWS_SERVICE). + TargetFormat builderpb.TargetFormat `json:"target_format,omitempty"` + // Docker container image name to use for the build. + BuildImage string `json:"build_image,omitempty"` + // The derived script to execute inside the build container. + BuildScript string `json:"build_script,omitempty"` + // The callback URI for the IMIX agent to connect to. + CallbackURI string `json:"callback_uri,omitempty"` + // The callback interval in seconds for the IMIX agent. + Interval int `json:"interval,omitempty"` + // The transport type for the IMIX agent. + TransportType c2pb.Transport_Type `json:"transport_type,omitempty"` + // Extra transport configuration for the IMIX agent. + Extra string `json:"extra,omitempty"` + // Timestamp of when a builder claimed this task, null if unclaimed. + ClaimedAt time.Time `json:"claimed_at,omitempty"` + // Timestamp of when the build execution started, null if not yet started. + StartedAt time.Time `json:"started_at,omitempty"` + // Timestamp of when the build finished, null if not yet finished. + FinishedAt time.Time `json:"finished_at,omitempty"` + // Output from the build execution. + Output string `json:"output,omitempty"` + // The size of the output in bytes + OutputSize int `json:"output_size,omitempty"` + // Error message if the build failed. + Error string `json:"error,omitempty"` + // The size of the error in bytes + ErrorSize int `json:"error_size,omitempty"` + // Exit code from the build container process. Null if the build has not finished. + ExitCode *int `json:"exit_code,omitempty"` + // Path inside the container where the build artifact is located. Derived from target_os if not set. + ArtifactPath string `json:"artifact_path,omitempty"` + // Edges holds the relations/edges for other nodes in the graph. + // The values are being populated by the BuildTaskQuery when eager-loading is set. + Edges BuildTaskEdges `json:"edges"` + build_task_builder *int + build_task_artifact *int + selectValues sql.SelectValues +} + +// BuildTaskEdges holds the relations/edges for other nodes in the graph. +type BuildTaskEdges struct { + // The builder assigned to execute this build task. + Builder *Builder `json:"builder,omitempty"` + // The compiled artifact produced by this build task, stored as an Asset. + Artifact *Asset `json:"artifact,omitempty"` + // loadedTypes holds the information for reporting if a + // type was loaded (or requested) in eager-loading or not. + loadedTypes [2]bool + // totalCount holds the count of the edges above. + totalCount [2]map[string]int +} + +// BuilderOrErr returns the Builder value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e BuildTaskEdges) BuilderOrErr() (*Builder, error) { + if e.Builder != nil { + return e.Builder, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: builder.Label} + } + return nil, &NotLoadedError{edge: "builder"} +} + +// ArtifactOrErr returns the Artifact value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e BuildTaskEdges) ArtifactOrErr() (*Asset, error) { + if e.Artifact != nil { + return e.Artifact, nil + } else if e.loadedTypes[1] { + return nil, &NotFoundError{label: asset.Label} + } + return nil, &NotLoadedError{edge: "artifact"} +} + +// scanValues returns the types for scanning values from sql.Rows. +func (*BuildTask) scanValues(columns []string) ([]any, error) { + values := make([]any, len(columns)) + for i := range columns { + switch columns[i] { + case buildtask.FieldTargetFormat: + values[i] = new(builderpb.TargetFormat) + case buildtask.FieldTargetOs: + values[i] = new(c2pb.Host_Platform) + case buildtask.FieldTransportType: + values[i] = new(c2pb.Transport_Type) + case buildtask.FieldID, buildtask.FieldInterval, buildtask.FieldOutputSize, buildtask.FieldErrorSize, buildtask.FieldExitCode: + values[i] = new(sql.NullInt64) + case buildtask.FieldBuildImage, buildtask.FieldBuildScript, buildtask.FieldCallbackURI, buildtask.FieldExtra, buildtask.FieldOutput, buildtask.FieldError, buildtask.FieldArtifactPath: + values[i] = new(sql.NullString) + case buildtask.FieldCreatedAt, buildtask.FieldLastModifiedAt, buildtask.FieldClaimedAt, buildtask.FieldStartedAt, buildtask.FieldFinishedAt: + values[i] = new(sql.NullTime) + case buildtask.ForeignKeys[0]: // build_task_builder + values[i] = new(sql.NullInt64) + case buildtask.ForeignKeys[1]: // build_task_artifact + values[i] = new(sql.NullInt64) + default: + values[i] = new(sql.UnknownType) + } + } + return values, nil +} + +// assignValues assigns the values that were returned from sql.Rows (after scanning) +// to the BuildTask fields. +func (bt *BuildTask) assignValues(columns []string, values []any) error { + if m, n := len(values), len(columns); m < n { + return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) + } + for i := range columns { + switch columns[i] { + case buildtask.FieldID: + value, ok := values[i].(*sql.NullInt64) + if !ok { + return fmt.Errorf("unexpected type %T for field id", value) + } + bt.ID = int(value.Int64) + case buildtask.FieldCreatedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field created_at", values[i]) + } else if value.Valid { + bt.CreatedAt = value.Time + } + case buildtask.FieldLastModifiedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field last_modified_at", values[i]) + } else if value.Valid { + bt.LastModifiedAt = value.Time + } + case buildtask.FieldTargetOs: + if value, ok := values[i].(*c2pb.Host_Platform); !ok { + return fmt.Errorf("unexpected type %T for field target_os", values[i]) + } else if value != nil { + bt.TargetOs = *value + } + case buildtask.FieldTargetFormat: + if value, ok := values[i].(*builderpb.TargetFormat); !ok { + return fmt.Errorf("unexpected type %T for field target_format", values[i]) + } else if value != nil { + bt.TargetFormat = *value + } + case buildtask.FieldBuildImage: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field build_image", values[i]) + } else if value.Valid { + bt.BuildImage = value.String + } + case buildtask.FieldBuildScript: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field build_script", values[i]) + } else if value.Valid { + bt.BuildScript = value.String + } + case buildtask.FieldCallbackURI: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field callback_uri", values[i]) + } else if value.Valid { + bt.CallbackURI = value.String + } + case buildtask.FieldInterval: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for field interval", values[i]) + } else if value.Valid { + bt.Interval = int(value.Int64) + } + case buildtask.FieldTransportType: + if value, ok := values[i].(*c2pb.Transport_Type); !ok { + return fmt.Errorf("unexpected type %T for field transport_type", values[i]) + } else if value != nil { + bt.TransportType = *value + } + case buildtask.FieldExtra: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field extra", values[i]) + } else if value.Valid { + bt.Extra = value.String + } + case buildtask.FieldClaimedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field claimed_at", values[i]) + } else if value.Valid { + bt.ClaimedAt = value.Time + } + case buildtask.FieldStartedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field started_at", values[i]) + } else if value.Valid { + bt.StartedAt = value.Time + } + case buildtask.FieldFinishedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field finished_at", values[i]) + } else if value.Valid { + bt.FinishedAt = value.Time + } + case buildtask.FieldOutput: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field output", values[i]) + } else if value.Valid { + bt.Output = value.String + } + case buildtask.FieldOutputSize: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for field output_size", values[i]) + } else if value.Valid { + bt.OutputSize = int(value.Int64) + } + case buildtask.FieldError: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field error", values[i]) + } else if value.Valid { + bt.Error = value.String + } + case buildtask.FieldErrorSize: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for field error_size", values[i]) + } else if value.Valid { + bt.ErrorSize = int(value.Int64) + } + case buildtask.FieldExitCode: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for field exit_code", values[i]) + } else if value.Valid { + bt.ExitCode = new(int) + *bt.ExitCode = int(value.Int64) + } + case buildtask.FieldArtifactPath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field artifact_path", values[i]) + } else if value.Valid { + bt.ArtifactPath = value.String + } + case buildtask.ForeignKeys[0]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field build_task_builder", value) + } else if value.Valid { + bt.build_task_builder = new(int) + *bt.build_task_builder = int(value.Int64) + } + case buildtask.ForeignKeys[1]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field build_task_artifact", value) + } else if value.Valid { + bt.build_task_artifact = new(int) + *bt.build_task_artifact = int(value.Int64) + } + default: + bt.selectValues.Set(columns[i], values[i]) + } + } + return nil +} + +// Value returns the ent.Value that was dynamically selected and assigned to the BuildTask. +// This includes values selected through modifiers, order, etc. +func (bt *BuildTask) Value(name string) (ent.Value, error) { + return bt.selectValues.Get(name) +} + +// QueryBuilder queries the "builder" edge of the BuildTask entity. +func (bt *BuildTask) QueryBuilder() *BuilderQuery { + return NewBuildTaskClient(bt.config).QueryBuilder(bt) +} + +// QueryArtifact queries the "artifact" edge of the BuildTask entity. +func (bt *BuildTask) QueryArtifact() *AssetQuery { + return NewBuildTaskClient(bt.config).QueryArtifact(bt) +} + +// Update returns a builder for updating this BuildTask. +// Note that you need to call BuildTask.Unwrap() before calling this method if this BuildTask +// was returned from a transaction, and the transaction was committed or rolled back. +func (bt *BuildTask) Update() *BuildTaskUpdateOne { + return NewBuildTaskClient(bt.config).UpdateOne(bt) +} + +// Unwrap unwraps the BuildTask entity that was returned from a transaction after it was closed, +// so that all future queries will be executed through the driver which created the transaction. +func (bt *BuildTask) Unwrap() *BuildTask { + _tx, ok := bt.config.driver.(*txDriver) + if !ok { + panic("ent: BuildTask is not a transactional entity") + } + bt.config.driver = _tx.drv + return bt +} + +// String implements the fmt.Stringer. +func (bt *BuildTask) String() string { + var builder strings.Builder + builder.WriteString("BuildTask(") + builder.WriteString(fmt.Sprintf("id=%v, ", bt.ID)) + builder.WriteString("created_at=") + builder.WriteString(bt.CreatedAt.Format(time.ANSIC)) + builder.WriteString(", ") + builder.WriteString("last_modified_at=") + builder.WriteString(bt.LastModifiedAt.Format(time.ANSIC)) + builder.WriteString(", ") + builder.WriteString("target_os=") + builder.WriteString(fmt.Sprintf("%v", bt.TargetOs)) + builder.WriteString(", ") + builder.WriteString("target_format=") + builder.WriteString(fmt.Sprintf("%v", bt.TargetFormat)) + builder.WriteString(", ") + builder.WriteString("build_image=") + builder.WriteString(bt.BuildImage) + builder.WriteString(", ") + builder.WriteString("build_script=") + builder.WriteString(bt.BuildScript) + builder.WriteString(", ") + builder.WriteString("callback_uri=") + builder.WriteString(bt.CallbackURI) + builder.WriteString(", ") + builder.WriteString("interval=") + builder.WriteString(fmt.Sprintf("%v", bt.Interval)) + builder.WriteString(", ") + builder.WriteString("transport_type=") + builder.WriteString(fmt.Sprintf("%v", bt.TransportType)) + builder.WriteString(", ") + builder.WriteString("extra=") + builder.WriteString(bt.Extra) + builder.WriteString(", ") + builder.WriteString("claimed_at=") + builder.WriteString(bt.ClaimedAt.Format(time.ANSIC)) + builder.WriteString(", ") + builder.WriteString("started_at=") + builder.WriteString(bt.StartedAt.Format(time.ANSIC)) + builder.WriteString(", ") + builder.WriteString("finished_at=") + builder.WriteString(bt.FinishedAt.Format(time.ANSIC)) + builder.WriteString(", ") + builder.WriteString("output=") + builder.WriteString(bt.Output) + builder.WriteString(", ") + builder.WriteString("output_size=") + builder.WriteString(fmt.Sprintf("%v", bt.OutputSize)) + builder.WriteString(", ") + builder.WriteString("error=") + builder.WriteString(bt.Error) + builder.WriteString(", ") + builder.WriteString("error_size=") + builder.WriteString(fmt.Sprintf("%v", bt.ErrorSize)) + builder.WriteString(", ") + if v := bt.ExitCode; v != nil { + builder.WriteString("exit_code=") + builder.WriteString(fmt.Sprintf("%v", *v)) + } + builder.WriteString(", ") + builder.WriteString("artifact_path=") + builder.WriteString(bt.ArtifactPath) + builder.WriteByte(')') + return builder.String() +} + +// BuildTasks is a parsable slice of BuildTask. +type BuildTasks []*BuildTask diff --git a/tavern/internal/ent/buildtask/buildtask.go b/tavern/internal/ent/buildtask/buildtask.go new file mode 100644 index 000000000..143fb205e --- /dev/null +++ b/tavern/internal/ent/buildtask/buildtask.go @@ -0,0 +1,339 @@ +// Code generated by ent, DO NOT EDIT. + +package buildtask + +import ( + "fmt" + "time" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "github.com/99designs/gqlgen/graphql" + "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/c2/c2pb" +) + +const ( + // Label holds the string label denoting the buildtask type in the database. + Label = "build_task" + // FieldID holds the string denoting the id field in the database. + FieldID = "id" + // FieldCreatedAt holds the string denoting the created_at field in the database. + FieldCreatedAt = "created_at" + // FieldLastModifiedAt holds the string denoting the last_modified_at field in the database. + FieldLastModifiedAt = "last_modified_at" + // FieldTargetOs holds the string denoting the target_os field in the database. + FieldTargetOs = "target_os" + // FieldTargetFormat holds the string denoting the target_format field in the database. + FieldTargetFormat = "target_format" + // FieldBuildImage holds the string denoting the build_image field in the database. + FieldBuildImage = "build_image" + // FieldBuildScript holds the string denoting the build_script field in the database. + FieldBuildScript = "build_script" + // FieldCallbackURI holds the string denoting the callback_uri field in the database. + FieldCallbackURI = "callback_uri" + // FieldInterval holds the string denoting the interval field in the database. + FieldInterval = "interval" + // FieldTransportType holds the string denoting the transport_type field in the database. + FieldTransportType = "transport_type" + // FieldExtra holds the string denoting the extra field in the database. + FieldExtra = "extra" + // FieldClaimedAt holds the string denoting the claimed_at field in the database. + FieldClaimedAt = "claimed_at" + // FieldStartedAt holds the string denoting the started_at field in the database. + FieldStartedAt = "started_at" + // FieldFinishedAt holds the string denoting the finished_at field in the database. + FieldFinishedAt = "finished_at" + // FieldOutput holds the string denoting the output field in the database. + FieldOutput = "output" + // FieldOutputSize holds the string denoting the output_size field in the database. + FieldOutputSize = "output_size" + // FieldError holds the string denoting the error field in the database. + FieldError = "error" + // FieldErrorSize holds the string denoting the error_size field in the database. + FieldErrorSize = "error_size" + // FieldExitCode holds the string denoting the exit_code field in the database. + FieldExitCode = "exit_code" + // FieldArtifactPath holds the string denoting the artifact_path field in the database. + FieldArtifactPath = "artifact_path" + // EdgeBuilder holds the string denoting the builder edge name in mutations. + EdgeBuilder = "builder" + // EdgeArtifact holds the string denoting the artifact edge name in mutations. + EdgeArtifact = "artifact" + // Table holds the table name of the buildtask in the database. + Table = "build_tasks" + // BuilderTable is the table that holds the builder relation/edge. + BuilderTable = "build_tasks" + // BuilderInverseTable is the table name for the Builder entity. + // It exists in this package in order to avoid circular dependency with the "builder" package. + BuilderInverseTable = "builders" + // BuilderColumn is the table column denoting the builder relation/edge. + BuilderColumn = "build_task_builder" + // ArtifactTable is the table that holds the artifact relation/edge. + ArtifactTable = "build_tasks" + // ArtifactInverseTable is the table name for the Asset entity. + // It exists in this package in order to avoid circular dependency with the "asset" package. + ArtifactInverseTable = "assets" + // ArtifactColumn is the table column denoting the artifact relation/edge. + ArtifactColumn = "build_task_artifact" +) + +// Columns holds all SQL columns for buildtask fields. +var Columns = []string{ + FieldID, + FieldCreatedAt, + FieldLastModifiedAt, + FieldTargetOs, + FieldTargetFormat, + FieldBuildImage, + FieldBuildScript, + FieldCallbackURI, + FieldInterval, + FieldTransportType, + FieldExtra, + FieldClaimedAt, + FieldStartedAt, + FieldFinishedAt, + FieldOutput, + FieldOutputSize, + FieldError, + FieldErrorSize, + FieldExitCode, + FieldArtifactPath, +} + +// ForeignKeys holds the SQL foreign-keys that are owned by the "build_tasks" +// table and are not defined as standalone fields in the schema. +var ForeignKeys = []string{ + "build_task_builder", + "build_task_artifact", +} + +// ValidColumn reports if the column name is valid (part of the table columns). +func ValidColumn(column string) bool { + for i := range Columns { + if column == Columns[i] { + return true + } + } + for i := range ForeignKeys { + if column == ForeignKeys[i] { + return true + } + } + return false +} + +// Note that the variables below are initialized by the runtime +// package on the initialization of the application. Therefore, +// it should be imported in the main as follows: +// +// import _ "realm.pub/tavern/internal/ent/runtime" +var ( + Hooks [1]ent.Hook + // DefaultCreatedAt holds the default value on creation for the "created_at" field. + DefaultCreatedAt func() time.Time + // DefaultLastModifiedAt holds the default value on creation for the "last_modified_at" field. + DefaultLastModifiedAt func() time.Time + // UpdateDefaultLastModifiedAt holds the default value on update for the "last_modified_at" field. + UpdateDefaultLastModifiedAt func() time.Time + // BuildImageValidator is a validator for the "build_image" field. It is called by the builders before save. + BuildImageValidator func(string) error + // BuildScriptValidator is a validator for the "build_script" field. It is called by the builders before save. + BuildScriptValidator func(string) error + // CallbackURIValidator is a validator for the "callback_uri" field. It is called by the builders before save. + CallbackURIValidator func(string) error + // DefaultInterval holds the default value on creation for the "interval" field. + DefaultInterval int + // DefaultOutputSize holds the default value on creation for the "output_size" field. + DefaultOutputSize int + // OutputSizeValidator is a validator for the "output_size" field. It is called by the builders before save. + OutputSizeValidator func(int) error + // DefaultErrorSize holds the default value on creation for the "error_size" field. + DefaultErrorSize int + // ErrorSizeValidator is a validator for the "error_size" field. It is called by the builders before save. + ErrorSizeValidator func(int) error +) + +// TargetOsValidator is a validator for the "target_os" field enum values. It is called by the builders before save. +func TargetOsValidator(to c2pb.Host_Platform) error { + switch to.String() { + case "PLATFORM_BSD", "PLATFORM_LINUX", "PLATFORM_MACOS", "PLATFORM_UNSPECIFIED", "PLATFORM_WINDOWS": + return nil + default: + return fmt.Errorf("buildtask: invalid enum value for target_os field: %q", to) + } +} + +// TargetFormatValidator is a validator for the "target_format" field enum values. It is called by the builders before save. +func TargetFormatValidator(tf builderpb.TargetFormat) error { + switch tf.String() { + case "TARGET_FORMAT_BIN", "TARGET_FORMAT_CDYLIB", "TARGET_FORMAT_UNSPECIFIED", "TARGET_FORMAT_WINDOWS_SERVICE": + return nil + default: + return fmt.Errorf("buildtask: invalid enum value for target_format field: %q", tf) + } +} + +// TransportTypeValidator is a validator for the "transport_type" field enum values. It is called by the builders before save. +func TransportTypeValidator(tt c2pb.Transport_Type) error { + switch tt.String() { + case "TRANSPORT_DNS", "TRANSPORT_GRPC", "TRANSPORT_HTTP1", "TRANSPORT_UNSPECIFIED": + return nil + default: + return fmt.Errorf("buildtask: invalid enum value for transport_type field: %q", tt) + } +} + +// OrderOption defines the ordering options for the BuildTask queries. +type OrderOption func(*sql.Selector) + +// ByID orders the results by the id field. +func ByID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldID, opts...).ToFunc() +} + +// ByCreatedAt orders the results by the created_at field. +func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() +} + +// ByLastModifiedAt orders the results by the last_modified_at field. +func ByLastModifiedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldLastModifiedAt, opts...).ToFunc() +} + +// ByTargetOs orders the results by the target_os field. +func ByTargetOs(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTargetOs, opts...).ToFunc() +} + +// ByTargetFormat orders the results by the target_format field. +func ByTargetFormat(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTargetFormat, opts...).ToFunc() +} + +// ByBuildImage orders the results by the build_image field. +func ByBuildImage(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldBuildImage, opts...).ToFunc() +} + +// ByBuildScript orders the results by the build_script field. +func ByBuildScript(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldBuildScript, opts...).ToFunc() +} + +// ByCallbackURI orders the results by the callback_uri field. +func ByCallbackURI(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCallbackURI, opts...).ToFunc() +} + +// ByInterval orders the results by the interval field. +func ByInterval(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldInterval, opts...).ToFunc() +} + +// ByTransportType orders the results by the transport_type field. +func ByTransportType(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTransportType, opts...).ToFunc() +} + +// ByExtra orders the results by the extra field. +func ByExtra(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldExtra, opts...).ToFunc() +} + +// ByClaimedAt orders the results by the claimed_at field. +func ByClaimedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldClaimedAt, opts...).ToFunc() +} + +// ByStartedAt orders the results by the started_at field. +func ByStartedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldStartedAt, opts...).ToFunc() +} + +// ByFinishedAt orders the results by the finished_at field. +func ByFinishedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldFinishedAt, opts...).ToFunc() +} + +// ByOutput orders the results by the output field. +func ByOutput(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldOutput, opts...).ToFunc() +} + +// ByOutputSize orders the results by the output_size field. +func ByOutputSize(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldOutputSize, opts...).ToFunc() +} + +// ByError orders the results by the error field. +func ByError(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldError, opts...).ToFunc() +} + +// ByErrorSize orders the results by the error_size field. +func ByErrorSize(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldErrorSize, opts...).ToFunc() +} + +// ByExitCode orders the results by the exit_code field. +func ByExitCode(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldExitCode, opts...).ToFunc() +} + +// ByArtifactPath orders the results by the artifact_path field. +func ByArtifactPath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldArtifactPath, opts...).ToFunc() +} + +// ByBuilderField orders the results by builder field. +func ByBuilderField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newBuilderStep(), sql.OrderByField(field, opts...)) + } +} + +// ByArtifactField orders the results by artifact field. +func ByArtifactField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newArtifactStep(), sql.OrderByField(field, opts...)) + } +} +func newBuilderStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(BuilderInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, BuilderTable, BuilderColumn), + ) +} +func newArtifactStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(ArtifactInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, ArtifactTable, ArtifactColumn), + ) +} + +var ( + // c2pb.Host_Platform must implement graphql.Marshaler. + _ graphql.Marshaler = (*c2pb.Host_Platform)(nil) + // c2pb.Host_Platform must implement graphql.Unmarshaler. + _ graphql.Unmarshaler = (*c2pb.Host_Platform)(nil) +) + +var ( + // builderpb.TargetFormat must implement graphql.Marshaler. + _ graphql.Marshaler = (*builderpb.TargetFormat)(nil) + // builderpb.TargetFormat must implement graphql.Unmarshaler. + _ graphql.Unmarshaler = (*builderpb.TargetFormat)(nil) +) + +var ( + // c2pb.Transport_Type must implement graphql.Marshaler. + _ graphql.Marshaler = (*c2pb.Transport_Type)(nil) + // c2pb.Transport_Type must implement graphql.Unmarshaler. + _ graphql.Unmarshaler = (*c2pb.Transport_Type)(nil) +) diff --git a/tavern/internal/ent/buildtask/where.go b/tavern/internal/ent/buildtask/where.go new file mode 100644 index 000000000..2dae145c2 --- /dev/null +++ b/tavern/internal/ent/buildtask/where.go @@ -0,0 +1,1154 @@ +// Code generated by ent, DO NOT EDIT. + +package buildtask + +import ( + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/c2/c2pb" + "realm.pub/tavern/internal/ent/predicate" +) + +// ID filters vertices based on their ID field. +func ID(id int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldID, id)) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldID, id)) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldID, id)) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldID, ids...)) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldID, ids...)) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldID, id)) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldID, id)) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldID, id)) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldID, id)) +} + +// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. +func CreatedAt(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldCreatedAt, v)) +} + +// LastModifiedAt applies equality check predicate on the "last_modified_at" field. It's identical to LastModifiedAtEQ. +func LastModifiedAt(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// BuildImage applies equality check predicate on the "build_image" field. It's identical to BuildImageEQ. +func BuildImage(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldBuildImage, v)) +} + +// BuildScript applies equality check predicate on the "build_script" field. It's identical to BuildScriptEQ. +func BuildScript(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldBuildScript, v)) +} + +// CallbackURI applies equality check predicate on the "callback_uri" field. It's identical to CallbackURIEQ. +func CallbackURI(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldCallbackURI, v)) +} + +// Interval applies equality check predicate on the "interval" field. It's identical to IntervalEQ. +func Interval(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldInterval, v)) +} + +// Extra applies equality check predicate on the "extra" field. It's identical to ExtraEQ. +func Extra(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldExtra, v)) +} + +// ClaimedAt applies equality check predicate on the "claimed_at" field. It's identical to ClaimedAtEQ. +func ClaimedAt(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldClaimedAt, v)) +} + +// StartedAt applies equality check predicate on the "started_at" field. It's identical to StartedAtEQ. +func StartedAt(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldStartedAt, v)) +} + +// FinishedAt applies equality check predicate on the "finished_at" field. It's identical to FinishedAtEQ. +func FinishedAt(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldFinishedAt, v)) +} + +// Output applies equality check predicate on the "output" field. It's identical to OutputEQ. +func Output(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldOutput, v)) +} + +// OutputSize applies equality check predicate on the "output_size" field. It's identical to OutputSizeEQ. +func OutputSize(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldOutputSize, v)) +} + +// Error applies equality check predicate on the "error" field. It's identical to ErrorEQ. +func Error(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldError, v)) +} + +// ErrorSize applies equality check predicate on the "error_size" field. It's identical to ErrorSizeEQ. +func ErrorSize(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldErrorSize, v)) +} + +// ExitCode applies equality check predicate on the "exit_code" field. It's identical to ExitCodeEQ. +func ExitCode(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldExitCode, v)) +} + +// ArtifactPath applies equality check predicate on the "artifact_path" field. It's identical to ArtifactPathEQ. +func ArtifactPath(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldArtifactPath, v)) +} + +// CreatedAtEQ applies the EQ predicate on the "created_at" field. +func CreatedAtEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldCreatedAt, v)) +} + +// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. +func CreatedAtNEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldCreatedAt, v)) +} + +// CreatedAtIn applies the In predicate on the "created_at" field. +func CreatedAtIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldCreatedAt, vs...)) +} + +// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. +func CreatedAtNotIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldCreatedAt, vs...)) +} + +// CreatedAtGT applies the GT predicate on the "created_at" field. +func CreatedAtGT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldCreatedAt, v)) +} + +// CreatedAtGTE applies the GTE predicate on the "created_at" field. +func CreatedAtGTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldCreatedAt, v)) +} + +// CreatedAtLT applies the LT predicate on the "created_at" field. +func CreatedAtLT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldCreatedAt, v)) +} + +// CreatedAtLTE applies the LTE predicate on the "created_at" field. +func CreatedAtLTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldCreatedAt, v)) +} + +// LastModifiedAtEQ applies the EQ predicate on the "last_modified_at" field. +func LastModifiedAtEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtNEQ applies the NEQ predicate on the "last_modified_at" field. +func LastModifiedAtNEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtIn applies the In predicate on the "last_modified_at" field. +func LastModifiedAtIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtNotIn applies the NotIn predicate on the "last_modified_at" field. +func LastModifiedAtNotIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtGT applies the GT predicate on the "last_modified_at" field. +func LastModifiedAtGT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtGTE applies the GTE predicate on the "last_modified_at" field. +func LastModifiedAtGTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLT applies the LT predicate on the "last_modified_at" field. +func LastModifiedAtLT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLTE applies the LTE predicate on the "last_modified_at" field. +func LastModifiedAtLTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldLastModifiedAt, v)) +} + +// TargetOsEQ applies the EQ predicate on the "target_os" field. +func TargetOsEQ(v c2pb.Host_Platform) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldTargetOs, v)) +} + +// TargetOsNEQ applies the NEQ predicate on the "target_os" field. +func TargetOsNEQ(v c2pb.Host_Platform) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldTargetOs, v)) +} + +// TargetOsIn applies the In predicate on the "target_os" field. +func TargetOsIn(vs ...c2pb.Host_Platform) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldTargetOs, vs...)) +} + +// TargetOsNotIn applies the NotIn predicate on the "target_os" field. +func TargetOsNotIn(vs ...c2pb.Host_Platform) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldTargetOs, vs...)) +} + +// TargetFormatEQ applies the EQ predicate on the "target_format" field. +func TargetFormatEQ(v builderpb.TargetFormat) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldTargetFormat, v)) +} + +// TargetFormatNEQ applies the NEQ predicate on the "target_format" field. +func TargetFormatNEQ(v builderpb.TargetFormat) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldTargetFormat, v)) +} + +// TargetFormatIn applies the In predicate on the "target_format" field. +func TargetFormatIn(vs ...builderpb.TargetFormat) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldTargetFormat, vs...)) +} + +// TargetFormatNotIn applies the NotIn predicate on the "target_format" field. +func TargetFormatNotIn(vs ...builderpb.TargetFormat) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldTargetFormat, vs...)) +} + +// BuildImageEQ applies the EQ predicate on the "build_image" field. +func BuildImageEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldBuildImage, v)) +} + +// BuildImageNEQ applies the NEQ predicate on the "build_image" field. +func BuildImageNEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldBuildImage, v)) +} + +// BuildImageIn applies the In predicate on the "build_image" field. +func BuildImageIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldBuildImage, vs...)) +} + +// BuildImageNotIn applies the NotIn predicate on the "build_image" field. +func BuildImageNotIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldBuildImage, vs...)) +} + +// BuildImageGT applies the GT predicate on the "build_image" field. +func BuildImageGT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldBuildImage, v)) +} + +// BuildImageGTE applies the GTE predicate on the "build_image" field. +func BuildImageGTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldBuildImage, v)) +} + +// BuildImageLT applies the LT predicate on the "build_image" field. +func BuildImageLT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldBuildImage, v)) +} + +// BuildImageLTE applies the LTE predicate on the "build_image" field. +func BuildImageLTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldBuildImage, v)) +} + +// BuildImageContains applies the Contains predicate on the "build_image" field. +func BuildImageContains(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContains(FieldBuildImage, v)) +} + +// BuildImageHasPrefix applies the HasPrefix predicate on the "build_image" field. +func BuildImageHasPrefix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasPrefix(FieldBuildImage, v)) +} + +// BuildImageHasSuffix applies the HasSuffix predicate on the "build_image" field. +func BuildImageHasSuffix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasSuffix(FieldBuildImage, v)) +} + +// BuildImageEqualFold applies the EqualFold predicate on the "build_image" field. +func BuildImageEqualFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEqualFold(FieldBuildImage, v)) +} + +// BuildImageContainsFold applies the ContainsFold predicate on the "build_image" field. +func BuildImageContainsFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContainsFold(FieldBuildImage, v)) +} + +// BuildScriptEQ applies the EQ predicate on the "build_script" field. +func BuildScriptEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldBuildScript, v)) +} + +// BuildScriptNEQ applies the NEQ predicate on the "build_script" field. +func BuildScriptNEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldBuildScript, v)) +} + +// BuildScriptIn applies the In predicate on the "build_script" field. +func BuildScriptIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldBuildScript, vs...)) +} + +// BuildScriptNotIn applies the NotIn predicate on the "build_script" field. +func BuildScriptNotIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldBuildScript, vs...)) +} + +// BuildScriptGT applies the GT predicate on the "build_script" field. +func BuildScriptGT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldBuildScript, v)) +} + +// BuildScriptGTE applies the GTE predicate on the "build_script" field. +func BuildScriptGTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldBuildScript, v)) +} + +// BuildScriptLT applies the LT predicate on the "build_script" field. +func BuildScriptLT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldBuildScript, v)) +} + +// BuildScriptLTE applies the LTE predicate on the "build_script" field. +func BuildScriptLTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldBuildScript, v)) +} + +// BuildScriptContains applies the Contains predicate on the "build_script" field. +func BuildScriptContains(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContains(FieldBuildScript, v)) +} + +// BuildScriptHasPrefix applies the HasPrefix predicate on the "build_script" field. +func BuildScriptHasPrefix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasPrefix(FieldBuildScript, v)) +} + +// BuildScriptHasSuffix applies the HasSuffix predicate on the "build_script" field. +func BuildScriptHasSuffix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasSuffix(FieldBuildScript, v)) +} + +// BuildScriptEqualFold applies the EqualFold predicate on the "build_script" field. +func BuildScriptEqualFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEqualFold(FieldBuildScript, v)) +} + +// BuildScriptContainsFold applies the ContainsFold predicate on the "build_script" field. +func BuildScriptContainsFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContainsFold(FieldBuildScript, v)) +} + +// CallbackURIEQ applies the EQ predicate on the "callback_uri" field. +func CallbackURIEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldCallbackURI, v)) +} + +// CallbackURINEQ applies the NEQ predicate on the "callback_uri" field. +func CallbackURINEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldCallbackURI, v)) +} + +// CallbackURIIn applies the In predicate on the "callback_uri" field. +func CallbackURIIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldCallbackURI, vs...)) +} + +// CallbackURINotIn applies the NotIn predicate on the "callback_uri" field. +func CallbackURINotIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldCallbackURI, vs...)) +} + +// CallbackURIGT applies the GT predicate on the "callback_uri" field. +func CallbackURIGT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldCallbackURI, v)) +} + +// CallbackURIGTE applies the GTE predicate on the "callback_uri" field. +func CallbackURIGTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldCallbackURI, v)) +} + +// CallbackURILT applies the LT predicate on the "callback_uri" field. +func CallbackURILT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldCallbackURI, v)) +} + +// CallbackURILTE applies the LTE predicate on the "callback_uri" field. +func CallbackURILTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldCallbackURI, v)) +} + +// CallbackURIContains applies the Contains predicate on the "callback_uri" field. +func CallbackURIContains(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContains(FieldCallbackURI, v)) +} + +// CallbackURIHasPrefix applies the HasPrefix predicate on the "callback_uri" field. +func CallbackURIHasPrefix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasPrefix(FieldCallbackURI, v)) +} + +// CallbackURIHasSuffix applies the HasSuffix predicate on the "callback_uri" field. +func CallbackURIHasSuffix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasSuffix(FieldCallbackURI, v)) +} + +// CallbackURIEqualFold applies the EqualFold predicate on the "callback_uri" field. +func CallbackURIEqualFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEqualFold(FieldCallbackURI, v)) +} + +// CallbackURIContainsFold applies the ContainsFold predicate on the "callback_uri" field. +func CallbackURIContainsFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContainsFold(FieldCallbackURI, v)) +} + +// IntervalEQ applies the EQ predicate on the "interval" field. +func IntervalEQ(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldInterval, v)) +} + +// IntervalNEQ applies the NEQ predicate on the "interval" field. +func IntervalNEQ(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldInterval, v)) +} + +// IntervalIn applies the In predicate on the "interval" field. +func IntervalIn(vs ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldInterval, vs...)) +} + +// IntervalNotIn applies the NotIn predicate on the "interval" field. +func IntervalNotIn(vs ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldInterval, vs...)) +} + +// IntervalGT applies the GT predicate on the "interval" field. +func IntervalGT(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldInterval, v)) +} + +// IntervalGTE applies the GTE predicate on the "interval" field. +func IntervalGTE(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldInterval, v)) +} + +// IntervalLT applies the LT predicate on the "interval" field. +func IntervalLT(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldInterval, v)) +} + +// IntervalLTE applies the LTE predicate on the "interval" field. +func IntervalLTE(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldInterval, v)) +} + +// TransportTypeEQ applies the EQ predicate on the "transport_type" field. +func TransportTypeEQ(v c2pb.Transport_Type) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldTransportType, v)) +} + +// TransportTypeNEQ applies the NEQ predicate on the "transport_type" field. +func TransportTypeNEQ(v c2pb.Transport_Type) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldTransportType, v)) +} + +// TransportTypeIn applies the In predicate on the "transport_type" field. +func TransportTypeIn(vs ...c2pb.Transport_Type) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldTransportType, vs...)) +} + +// TransportTypeNotIn applies the NotIn predicate on the "transport_type" field. +func TransportTypeNotIn(vs ...c2pb.Transport_Type) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldTransportType, vs...)) +} + +// ExtraEQ applies the EQ predicate on the "extra" field. +func ExtraEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldExtra, v)) +} + +// ExtraNEQ applies the NEQ predicate on the "extra" field. +func ExtraNEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldExtra, v)) +} + +// ExtraIn applies the In predicate on the "extra" field. +func ExtraIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldExtra, vs...)) +} + +// ExtraNotIn applies the NotIn predicate on the "extra" field. +func ExtraNotIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldExtra, vs...)) +} + +// ExtraGT applies the GT predicate on the "extra" field. +func ExtraGT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldExtra, v)) +} + +// ExtraGTE applies the GTE predicate on the "extra" field. +func ExtraGTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldExtra, v)) +} + +// ExtraLT applies the LT predicate on the "extra" field. +func ExtraLT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldExtra, v)) +} + +// ExtraLTE applies the LTE predicate on the "extra" field. +func ExtraLTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldExtra, v)) +} + +// ExtraContains applies the Contains predicate on the "extra" field. +func ExtraContains(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContains(FieldExtra, v)) +} + +// ExtraHasPrefix applies the HasPrefix predicate on the "extra" field. +func ExtraHasPrefix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasPrefix(FieldExtra, v)) +} + +// ExtraHasSuffix applies the HasSuffix predicate on the "extra" field. +func ExtraHasSuffix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasSuffix(FieldExtra, v)) +} + +// ExtraIsNil applies the IsNil predicate on the "extra" field. +func ExtraIsNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldIsNull(FieldExtra)) +} + +// ExtraNotNil applies the NotNil predicate on the "extra" field. +func ExtraNotNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotNull(FieldExtra)) +} + +// ExtraEqualFold applies the EqualFold predicate on the "extra" field. +func ExtraEqualFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEqualFold(FieldExtra, v)) +} + +// ExtraContainsFold applies the ContainsFold predicate on the "extra" field. +func ExtraContainsFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContainsFold(FieldExtra, v)) +} + +// ClaimedAtEQ applies the EQ predicate on the "claimed_at" field. +func ClaimedAtEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldClaimedAt, v)) +} + +// ClaimedAtNEQ applies the NEQ predicate on the "claimed_at" field. +func ClaimedAtNEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldClaimedAt, v)) +} + +// ClaimedAtIn applies the In predicate on the "claimed_at" field. +func ClaimedAtIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldClaimedAt, vs...)) +} + +// ClaimedAtNotIn applies the NotIn predicate on the "claimed_at" field. +func ClaimedAtNotIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldClaimedAt, vs...)) +} + +// ClaimedAtGT applies the GT predicate on the "claimed_at" field. +func ClaimedAtGT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldClaimedAt, v)) +} + +// ClaimedAtGTE applies the GTE predicate on the "claimed_at" field. +func ClaimedAtGTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldClaimedAt, v)) +} + +// ClaimedAtLT applies the LT predicate on the "claimed_at" field. +func ClaimedAtLT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldClaimedAt, v)) +} + +// ClaimedAtLTE applies the LTE predicate on the "claimed_at" field. +func ClaimedAtLTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldClaimedAt, v)) +} + +// ClaimedAtIsNil applies the IsNil predicate on the "claimed_at" field. +func ClaimedAtIsNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldIsNull(FieldClaimedAt)) +} + +// ClaimedAtNotNil applies the NotNil predicate on the "claimed_at" field. +func ClaimedAtNotNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotNull(FieldClaimedAt)) +} + +// StartedAtEQ applies the EQ predicate on the "started_at" field. +func StartedAtEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldStartedAt, v)) +} + +// StartedAtNEQ applies the NEQ predicate on the "started_at" field. +func StartedAtNEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldStartedAt, v)) +} + +// StartedAtIn applies the In predicate on the "started_at" field. +func StartedAtIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldStartedAt, vs...)) +} + +// StartedAtNotIn applies the NotIn predicate on the "started_at" field. +func StartedAtNotIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldStartedAt, vs...)) +} + +// StartedAtGT applies the GT predicate on the "started_at" field. +func StartedAtGT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldStartedAt, v)) +} + +// StartedAtGTE applies the GTE predicate on the "started_at" field. +func StartedAtGTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldStartedAt, v)) +} + +// StartedAtLT applies the LT predicate on the "started_at" field. +func StartedAtLT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldStartedAt, v)) +} + +// StartedAtLTE applies the LTE predicate on the "started_at" field. +func StartedAtLTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldStartedAt, v)) +} + +// StartedAtIsNil applies the IsNil predicate on the "started_at" field. +func StartedAtIsNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldIsNull(FieldStartedAt)) +} + +// StartedAtNotNil applies the NotNil predicate on the "started_at" field. +func StartedAtNotNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotNull(FieldStartedAt)) +} + +// FinishedAtEQ applies the EQ predicate on the "finished_at" field. +func FinishedAtEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldFinishedAt, v)) +} + +// FinishedAtNEQ applies the NEQ predicate on the "finished_at" field. +func FinishedAtNEQ(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldFinishedAt, v)) +} + +// FinishedAtIn applies the In predicate on the "finished_at" field. +func FinishedAtIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldFinishedAt, vs...)) +} + +// FinishedAtNotIn applies the NotIn predicate on the "finished_at" field. +func FinishedAtNotIn(vs ...time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldFinishedAt, vs...)) +} + +// FinishedAtGT applies the GT predicate on the "finished_at" field. +func FinishedAtGT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldFinishedAt, v)) +} + +// FinishedAtGTE applies the GTE predicate on the "finished_at" field. +func FinishedAtGTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldFinishedAt, v)) +} + +// FinishedAtLT applies the LT predicate on the "finished_at" field. +func FinishedAtLT(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldFinishedAt, v)) +} + +// FinishedAtLTE applies the LTE predicate on the "finished_at" field. +func FinishedAtLTE(v time.Time) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldFinishedAt, v)) +} + +// FinishedAtIsNil applies the IsNil predicate on the "finished_at" field. +func FinishedAtIsNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldIsNull(FieldFinishedAt)) +} + +// FinishedAtNotNil applies the NotNil predicate on the "finished_at" field. +func FinishedAtNotNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotNull(FieldFinishedAt)) +} + +// OutputEQ applies the EQ predicate on the "output" field. +func OutputEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldOutput, v)) +} + +// OutputNEQ applies the NEQ predicate on the "output" field. +func OutputNEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldOutput, v)) +} + +// OutputIn applies the In predicate on the "output" field. +func OutputIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldOutput, vs...)) +} + +// OutputNotIn applies the NotIn predicate on the "output" field. +func OutputNotIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldOutput, vs...)) +} + +// OutputGT applies the GT predicate on the "output" field. +func OutputGT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldOutput, v)) +} + +// OutputGTE applies the GTE predicate on the "output" field. +func OutputGTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldOutput, v)) +} + +// OutputLT applies the LT predicate on the "output" field. +func OutputLT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldOutput, v)) +} + +// OutputLTE applies the LTE predicate on the "output" field. +func OutputLTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldOutput, v)) +} + +// OutputContains applies the Contains predicate on the "output" field. +func OutputContains(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContains(FieldOutput, v)) +} + +// OutputHasPrefix applies the HasPrefix predicate on the "output" field. +func OutputHasPrefix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasPrefix(FieldOutput, v)) +} + +// OutputHasSuffix applies the HasSuffix predicate on the "output" field. +func OutputHasSuffix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasSuffix(FieldOutput, v)) +} + +// OutputIsNil applies the IsNil predicate on the "output" field. +func OutputIsNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldIsNull(FieldOutput)) +} + +// OutputNotNil applies the NotNil predicate on the "output" field. +func OutputNotNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotNull(FieldOutput)) +} + +// OutputEqualFold applies the EqualFold predicate on the "output" field. +func OutputEqualFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEqualFold(FieldOutput, v)) +} + +// OutputContainsFold applies the ContainsFold predicate on the "output" field. +func OutputContainsFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContainsFold(FieldOutput, v)) +} + +// OutputSizeEQ applies the EQ predicate on the "output_size" field. +func OutputSizeEQ(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldOutputSize, v)) +} + +// OutputSizeNEQ applies the NEQ predicate on the "output_size" field. +func OutputSizeNEQ(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldOutputSize, v)) +} + +// OutputSizeIn applies the In predicate on the "output_size" field. +func OutputSizeIn(vs ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldOutputSize, vs...)) +} + +// OutputSizeNotIn applies the NotIn predicate on the "output_size" field. +func OutputSizeNotIn(vs ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldOutputSize, vs...)) +} + +// OutputSizeGT applies the GT predicate on the "output_size" field. +func OutputSizeGT(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldOutputSize, v)) +} + +// OutputSizeGTE applies the GTE predicate on the "output_size" field. +func OutputSizeGTE(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldOutputSize, v)) +} + +// OutputSizeLT applies the LT predicate on the "output_size" field. +func OutputSizeLT(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldOutputSize, v)) +} + +// OutputSizeLTE applies the LTE predicate on the "output_size" field. +func OutputSizeLTE(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldOutputSize, v)) +} + +// ErrorEQ applies the EQ predicate on the "error" field. +func ErrorEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldError, v)) +} + +// ErrorNEQ applies the NEQ predicate on the "error" field. +func ErrorNEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldError, v)) +} + +// ErrorIn applies the In predicate on the "error" field. +func ErrorIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldError, vs...)) +} + +// ErrorNotIn applies the NotIn predicate on the "error" field. +func ErrorNotIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldError, vs...)) +} + +// ErrorGT applies the GT predicate on the "error" field. +func ErrorGT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldError, v)) +} + +// ErrorGTE applies the GTE predicate on the "error" field. +func ErrorGTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldError, v)) +} + +// ErrorLT applies the LT predicate on the "error" field. +func ErrorLT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldError, v)) +} + +// ErrorLTE applies the LTE predicate on the "error" field. +func ErrorLTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldError, v)) +} + +// ErrorContains applies the Contains predicate on the "error" field. +func ErrorContains(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContains(FieldError, v)) +} + +// ErrorHasPrefix applies the HasPrefix predicate on the "error" field. +func ErrorHasPrefix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasPrefix(FieldError, v)) +} + +// ErrorHasSuffix applies the HasSuffix predicate on the "error" field. +func ErrorHasSuffix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasSuffix(FieldError, v)) +} + +// ErrorIsNil applies the IsNil predicate on the "error" field. +func ErrorIsNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldIsNull(FieldError)) +} + +// ErrorNotNil applies the NotNil predicate on the "error" field. +func ErrorNotNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotNull(FieldError)) +} + +// ErrorEqualFold applies the EqualFold predicate on the "error" field. +func ErrorEqualFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEqualFold(FieldError, v)) +} + +// ErrorContainsFold applies the ContainsFold predicate on the "error" field. +func ErrorContainsFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContainsFold(FieldError, v)) +} + +// ErrorSizeEQ applies the EQ predicate on the "error_size" field. +func ErrorSizeEQ(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldErrorSize, v)) +} + +// ErrorSizeNEQ applies the NEQ predicate on the "error_size" field. +func ErrorSizeNEQ(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldErrorSize, v)) +} + +// ErrorSizeIn applies the In predicate on the "error_size" field. +func ErrorSizeIn(vs ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldErrorSize, vs...)) +} + +// ErrorSizeNotIn applies the NotIn predicate on the "error_size" field. +func ErrorSizeNotIn(vs ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldErrorSize, vs...)) +} + +// ErrorSizeGT applies the GT predicate on the "error_size" field. +func ErrorSizeGT(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldErrorSize, v)) +} + +// ErrorSizeGTE applies the GTE predicate on the "error_size" field. +func ErrorSizeGTE(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldErrorSize, v)) +} + +// ErrorSizeLT applies the LT predicate on the "error_size" field. +func ErrorSizeLT(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldErrorSize, v)) +} + +// ErrorSizeLTE applies the LTE predicate on the "error_size" field. +func ErrorSizeLTE(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldErrorSize, v)) +} + +// ExitCodeEQ applies the EQ predicate on the "exit_code" field. +func ExitCodeEQ(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldExitCode, v)) +} + +// ExitCodeNEQ applies the NEQ predicate on the "exit_code" field. +func ExitCodeNEQ(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldExitCode, v)) +} + +// ExitCodeIn applies the In predicate on the "exit_code" field. +func ExitCodeIn(vs ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldExitCode, vs...)) +} + +// ExitCodeNotIn applies the NotIn predicate on the "exit_code" field. +func ExitCodeNotIn(vs ...int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldExitCode, vs...)) +} + +// ExitCodeGT applies the GT predicate on the "exit_code" field. +func ExitCodeGT(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldExitCode, v)) +} + +// ExitCodeGTE applies the GTE predicate on the "exit_code" field. +func ExitCodeGTE(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldExitCode, v)) +} + +// ExitCodeLT applies the LT predicate on the "exit_code" field. +func ExitCodeLT(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldExitCode, v)) +} + +// ExitCodeLTE applies the LTE predicate on the "exit_code" field. +func ExitCodeLTE(v int) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldExitCode, v)) +} + +// ExitCodeIsNil applies the IsNil predicate on the "exit_code" field. +func ExitCodeIsNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldIsNull(FieldExitCode)) +} + +// ExitCodeNotNil applies the NotNil predicate on the "exit_code" field. +func ExitCodeNotNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotNull(FieldExitCode)) +} + +// ArtifactPathEQ applies the EQ predicate on the "artifact_path" field. +func ArtifactPathEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEQ(FieldArtifactPath, v)) +} + +// ArtifactPathNEQ applies the NEQ predicate on the "artifact_path" field. +func ArtifactPathNEQ(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNEQ(FieldArtifactPath, v)) +} + +// ArtifactPathIn applies the In predicate on the "artifact_path" field. +func ArtifactPathIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldIn(FieldArtifactPath, vs...)) +} + +// ArtifactPathNotIn applies the NotIn predicate on the "artifact_path" field. +func ArtifactPathNotIn(vs ...string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotIn(FieldArtifactPath, vs...)) +} + +// ArtifactPathGT applies the GT predicate on the "artifact_path" field. +func ArtifactPathGT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGT(FieldArtifactPath, v)) +} + +// ArtifactPathGTE applies the GTE predicate on the "artifact_path" field. +func ArtifactPathGTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldGTE(FieldArtifactPath, v)) +} + +// ArtifactPathLT applies the LT predicate on the "artifact_path" field. +func ArtifactPathLT(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLT(FieldArtifactPath, v)) +} + +// ArtifactPathLTE applies the LTE predicate on the "artifact_path" field. +func ArtifactPathLTE(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldLTE(FieldArtifactPath, v)) +} + +// ArtifactPathContains applies the Contains predicate on the "artifact_path" field. +func ArtifactPathContains(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContains(FieldArtifactPath, v)) +} + +// ArtifactPathHasPrefix applies the HasPrefix predicate on the "artifact_path" field. +func ArtifactPathHasPrefix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasPrefix(FieldArtifactPath, v)) +} + +// ArtifactPathHasSuffix applies the HasSuffix predicate on the "artifact_path" field. +func ArtifactPathHasSuffix(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldHasSuffix(FieldArtifactPath, v)) +} + +// ArtifactPathIsNil applies the IsNil predicate on the "artifact_path" field. +func ArtifactPathIsNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldIsNull(FieldArtifactPath)) +} + +// ArtifactPathNotNil applies the NotNil predicate on the "artifact_path" field. +func ArtifactPathNotNil() predicate.BuildTask { + return predicate.BuildTask(sql.FieldNotNull(FieldArtifactPath)) +} + +// ArtifactPathEqualFold applies the EqualFold predicate on the "artifact_path" field. +func ArtifactPathEqualFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldEqualFold(FieldArtifactPath, v)) +} + +// ArtifactPathContainsFold applies the ContainsFold predicate on the "artifact_path" field. +func ArtifactPathContainsFold(v string) predicate.BuildTask { + return predicate.BuildTask(sql.FieldContainsFold(FieldArtifactPath, v)) +} + +// HasBuilder applies the HasEdge predicate on the "builder" edge. +func HasBuilder() predicate.BuildTask { + return predicate.BuildTask(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, BuilderTable, BuilderColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBuilderWith applies the HasEdge predicate on the "builder" edge with a given conditions (other predicates). +func HasBuilderWith(preds ...predicate.Builder) predicate.BuildTask { + return predicate.BuildTask(func(s *sql.Selector) { + step := newBuilderStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasArtifact applies the HasEdge predicate on the "artifact" edge. +func HasArtifact() predicate.BuildTask { + return predicate.BuildTask(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, ArtifactTable, ArtifactColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasArtifactWith applies the HasEdge predicate on the "artifact" edge with a given conditions (other predicates). +func HasArtifactWith(preds ...predicate.Asset) predicate.BuildTask { + return predicate.BuildTask(func(s *sql.Selector) { + step := newArtifactStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// And groups predicates with the AND operator between them. +func And(predicates ...predicate.BuildTask) predicate.BuildTask { + return predicate.BuildTask(sql.AndPredicates(predicates...)) +} + +// Or groups predicates with the OR operator between them. +func Or(predicates ...predicate.BuildTask) predicate.BuildTask { + return predicate.BuildTask(sql.OrPredicates(predicates...)) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.BuildTask) predicate.BuildTask { + return predicate.BuildTask(sql.NotPredicates(p)) +} diff --git a/tavern/internal/ent/buildtask_create.go b/tavern/internal/ent/buildtask_create.go new file mode 100644 index 000000000..b582b38f2 --- /dev/null +++ b/tavern/internal/ent/buildtask_create.go @@ -0,0 +1,1847 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/c2/c2pb" + "realm.pub/tavern/internal/ent/asset" + "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" +) + +// BuildTaskCreate is the builder for creating a BuildTask entity. +type BuildTaskCreate struct { + config + mutation *BuildTaskMutation + hooks []Hook + conflict []sql.ConflictOption +} + +// SetCreatedAt sets the "created_at" field. +func (btc *BuildTaskCreate) SetCreatedAt(t time.Time) *BuildTaskCreate { + btc.mutation.SetCreatedAt(t) + return btc +} + +// SetNillableCreatedAt sets the "created_at" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableCreatedAt(t *time.Time) *BuildTaskCreate { + if t != nil { + btc.SetCreatedAt(*t) + } + return btc +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (btc *BuildTaskCreate) SetLastModifiedAt(t time.Time) *BuildTaskCreate { + btc.mutation.SetLastModifiedAt(t) + return btc +} + +// SetNillableLastModifiedAt sets the "last_modified_at" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableLastModifiedAt(t *time.Time) *BuildTaskCreate { + if t != nil { + btc.SetLastModifiedAt(*t) + } + return btc +} + +// SetTargetOs sets the "target_os" field. +func (btc *BuildTaskCreate) SetTargetOs(cp c2pb.Host_Platform) *BuildTaskCreate { + btc.mutation.SetTargetOs(cp) + return btc +} + +// SetTargetFormat sets the "target_format" field. +func (btc *BuildTaskCreate) SetTargetFormat(bf builderpb.TargetFormat) *BuildTaskCreate { + btc.mutation.SetTargetFormat(bf) + return btc +} + +// SetBuildImage sets the "build_image" field. +func (btc *BuildTaskCreate) SetBuildImage(s string) *BuildTaskCreate { + btc.mutation.SetBuildImage(s) + return btc +} + +// SetBuildScript sets the "build_script" field. +func (btc *BuildTaskCreate) SetBuildScript(s string) *BuildTaskCreate { + btc.mutation.SetBuildScript(s) + return btc +} + +// SetCallbackURI sets the "callback_uri" field. +func (btc *BuildTaskCreate) SetCallbackURI(s string) *BuildTaskCreate { + btc.mutation.SetCallbackURI(s) + return btc +} + +// SetInterval sets the "interval" field. +func (btc *BuildTaskCreate) SetInterval(i int) *BuildTaskCreate { + btc.mutation.SetInterval(i) + return btc +} + +// SetNillableInterval sets the "interval" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableInterval(i *int) *BuildTaskCreate { + if i != nil { + btc.SetInterval(*i) + } + return btc +} + +// SetTransportType sets the "transport_type" field. +func (btc *BuildTaskCreate) SetTransportType(ct c2pb.Transport_Type) *BuildTaskCreate { + btc.mutation.SetTransportType(ct) + return btc +} + +// SetExtra sets the "extra" field. +func (btc *BuildTaskCreate) SetExtra(s string) *BuildTaskCreate { + btc.mutation.SetExtra(s) + return btc +} + +// SetNillableExtra sets the "extra" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableExtra(s *string) *BuildTaskCreate { + if s != nil { + btc.SetExtra(*s) + } + return btc +} + +// SetClaimedAt sets the "claimed_at" field. +func (btc *BuildTaskCreate) SetClaimedAt(t time.Time) *BuildTaskCreate { + btc.mutation.SetClaimedAt(t) + return btc +} + +// SetNillableClaimedAt sets the "claimed_at" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableClaimedAt(t *time.Time) *BuildTaskCreate { + if t != nil { + btc.SetClaimedAt(*t) + } + return btc +} + +// SetStartedAt sets the "started_at" field. +func (btc *BuildTaskCreate) SetStartedAt(t time.Time) *BuildTaskCreate { + btc.mutation.SetStartedAt(t) + return btc +} + +// SetNillableStartedAt sets the "started_at" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableStartedAt(t *time.Time) *BuildTaskCreate { + if t != nil { + btc.SetStartedAt(*t) + } + return btc +} + +// SetFinishedAt sets the "finished_at" field. +func (btc *BuildTaskCreate) SetFinishedAt(t time.Time) *BuildTaskCreate { + btc.mutation.SetFinishedAt(t) + return btc +} + +// SetNillableFinishedAt sets the "finished_at" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableFinishedAt(t *time.Time) *BuildTaskCreate { + if t != nil { + btc.SetFinishedAt(*t) + } + return btc +} + +// SetOutput sets the "output" field. +func (btc *BuildTaskCreate) SetOutput(s string) *BuildTaskCreate { + btc.mutation.SetOutput(s) + return btc +} + +// SetNillableOutput sets the "output" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableOutput(s *string) *BuildTaskCreate { + if s != nil { + btc.SetOutput(*s) + } + return btc +} + +// SetOutputSize sets the "output_size" field. +func (btc *BuildTaskCreate) SetOutputSize(i int) *BuildTaskCreate { + btc.mutation.SetOutputSize(i) + return btc +} + +// SetNillableOutputSize sets the "output_size" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableOutputSize(i *int) *BuildTaskCreate { + if i != nil { + btc.SetOutputSize(*i) + } + return btc +} + +// SetError sets the "error" field. +func (btc *BuildTaskCreate) SetError(s string) *BuildTaskCreate { + btc.mutation.SetError(s) + return btc +} + +// SetNillableError sets the "error" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableError(s *string) *BuildTaskCreate { + if s != nil { + btc.SetError(*s) + } + return btc +} + +// SetErrorSize sets the "error_size" field. +func (btc *BuildTaskCreate) SetErrorSize(i int) *BuildTaskCreate { + btc.mutation.SetErrorSize(i) + return btc +} + +// SetNillableErrorSize sets the "error_size" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableErrorSize(i *int) *BuildTaskCreate { + if i != nil { + btc.SetErrorSize(*i) + } + return btc +} + +// SetExitCode sets the "exit_code" field. +func (btc *BuildTaskCreate) SetExitCode(i int) *BuildTaskCreate { + btc.mutation.SetExitCode(i) + return btc +} + +// SetNillableExitCode sets the "exit_code" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableExitCode(i *int) *BuildTaskCreate { + if i != nil { + btc.SetExitCode(*i) + } + return btc +} + +// SetArtifactPath sets the "artifact_path" field. +func (btc *BuildTaskCreate) SetArtifactPath(s string) *BuildTaskCreate { + btc.mutation.SetArtifactPath(s) + return btc +} + +// SetNillableArtifactPath sets the "artifact_path" field if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableArtifactPath(s *string) *BuildTaskCreate { + if s != nil { + btc.SetArtifactPath(*s) + } + return btc +} + +// SetBuilderID sets the "builder" edge to the Builder entity by ID. +func (btc *BuildTaskCreate) SetBuilderID(id int) *BuildTaskCreate { + btc.mutation.SetBuilderID(id) + return btc +} + +// SetBuilder sets the "builder" edge to the Builder entity. +func (btc *BuildTaskCreate) SetBuilder(b *Builder) *BuildTaskCreate { + return btc.SetBuilderID(b.ID) +} + +// SetArtifactID sets the "artifact" edge to the Asset entity by ID. +func (btc *BuildTaskCreate) SetArtifactID(id int) *BuildTaskCreate { + btc.mutation.SetArtifactID(id) + return btc +} + +// SetNillableArtifactID sets the "artifact" edge to the Asset entity by ID if the given value is not nil. +func (btc *BuildTaskCreate) SetNillableArtifactID(id *int) *BuildTaskCreate { + if id != nil { + btc = btc.SetArtifactID(*id) + } + return btc +} + +// SetArtifact sets the "artifact" edge to the Asset entity. +func (btc *BuildTaskCreate) SetArtifact(a *Asset) *BuildTaskCreate { + return btc.SetArtifactID(a.ID) +} + +// Mutation returns the BuildTaskMutation object of the builder. +func (btc *BuildTaskCreate) Mutation() *BuildTaskMutation { + return btc.mutation +} + +// Save creates the BuildTask in the database. +func (btc *BuildTaskCreate) Save(ctx context.Context) (*BuildTask, error) { + if err := btc.defaults(); err != nil { + return nil, err + } + return withHooks(ctx, btc.sqlSave, btc.mutation, btc.hooks) +} + +// SaveX calls Save and panics if Save returns an error. +func (btc *BuildTaskCreate) SaveX(ctx context.Context) *BuildTask { + v, err := btc.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (btc *BuildTaskCreate) Exec(ctx context.Context) error { + _, err := btc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (btc *BuildTaskCreate) ExecX(ctx context.Context) { + if err := btc.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (btc *BuildTaskCreate) defaults() error { + if _, ok := btc.mutation.CreatedAt(); !ok { + if buildtask.DefaultCreatedAt == nil { + return fmt.Errorf("ent: uninitialized buildtask.DefaultCreatedAt (forgotten import ent/runtime?)") + } + v := buildtask.DefaultCreatedAt() + btc.mutation.SetCreatedAt(v) + } + if _, ok := btc.mutation.LastModifiedAt(); !ok { + if buildtask.DefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized buildtask.DefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := buildtask.DefaultLastModifiedAt() + btc.mutation.SetLastModifiedAt(v) + } + if _, ok := btc.mutation.Interval(); !ok { + v := buildtask.DefaultInterval + btc.mutation.SetInterval(v) + } + if _, ok := btc.mutation.OutputSize(); !ok { + v := buildtask.DefaultOutputSize + btc.mutation.SetOutputSize(v) + } + if _, ok := btc.mutation.ErrorSize(); !ok { + v := buildtask.DefaultErrorSize + btc.mutation.SetErrorSize(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (btc *BuildTaskCreate) check() error { + if _, ok := btc.mutation.CreatedAt(); !ok { + return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "BuildTask.created_at"`)} + } + if _, ok := btc.mutation.LastModifiedAt(); !ok { + return &ValidationError{Name: "last_modified_at", err: errors.New(`ent: missing required field "BuildTask.last_modified_at"`)} + } + if _, ok := btc.mutation.TargetOs(); !ok { + return &ValidationError{Name: "target_os", err: errors.New(`ent: missing required field "BuildTask.target_os"`)} + } + if v, ok := btc.mutation.TargetOs(); ok { + if err := buildtask.TargetOsValidator(v); err != nil { + return &ValidationError{Name: "target_os", err: fmt.Errorf(`ent: validator failed for field "BuildTask.target_os": %w`, err)} + } + } + if _, ok := btc.mutation.TargetFormat(); !ok { + return &ValidationError{Name: "target_format", err: errors.New(`ent: missing required field "BuildTask.target_format"`)} + } + if v, ok := btc.mutation.TargetFormat(); ok { + if err := buildtask.TargetFormatValidator(v); err != nil { + return &ValidationError{Name: "target_format", err: fmt.Errorf(`ent: validator failed for field "BuildTask.target_format": %w`, err)} + } + } + if _, ok := btc.mutation.BuildImage(); !ok { + return &ValidationError{Name: "build_image", err: errors.New(`ent: missing required field "BuildTask.build_image"`)} + } + if v, ok := btc.mutation.BuildImage(); ok { + if err := buildtask.BuildImageValidator(v); err != nil { + return &ValidationError{Name: "build_image", err: fmt.Errorf(`ent: validator failed for field "BuildTask.build_image": %w`, err)} + } + } + if _, ok := btc.mutation.BuildScript(); !ok { + return &ValidationError{Name: "build_script", err: errors.New(`ent: missing required field "BuildTask.build_script"`)} + } + if v, ok := btc.mutation.BuildScript(); ok { + if err := buildtask.BuildScriptValidator(v); err != nil { + return &ValidationError{Name: "build_script", err: fmt.Errorf(`ent: validator failed for field "BuildTask.build_script": %w`, err)} + } + } + if _, ok := btc.mutation.CallbackURI(); !ok { + return &ValidationError{Name: "callback_uri", err: errors.New(`ent: missing required field "BuildTask.callback_uri"`)} + } + if v, ok := btc.mutation.CallbackURI(); ok { + if err := buildtask.CallbackURIValidator(v); err != nil { + return &ValidationError{Name: "callback_uri", err: fmt.Errorf(`ent: validator failed for field "BuildTask.callback_uri": %w`, err)} + } + } + if _, ok := btc.mutation.Interval(); !ok { + return &ValidationError{Name: "interval", err: errors.New(`ent: missing required field "BuildTask.interval"`)} + } + if _, ok := btc.mutation.TransportType(); !ok { + return &ValidationError{Name: "transport_type", err: errors.New(`ent: missing required field "BuildTask.transport_type"`)} + } + if v, ok := btc.mutation.TransportType(); ok { + if err := buildtask.TransportTypeValidator(v); err != nil { + return &ValidationError{Name: "transport_type", err: fmt.Errorf(`ent: validator failed for field "BuildTask.transport_type": %w`, err)} + } + } + if _, ok := btc.mutation.OutputSize(); !ok { + return &ValidationError{Name: "output_size", err: errors.New(`ent: missing required field "BuildTask.output_size"`)} + } + if v, ok := btc.mutation.OutputSize(); ok { + if err := buildtask.OutputSizeValidator(v); err != nil { + return &ValidationError{Name: "output_size", err: fmt.Errorf(`ent: validator failed for field "BuildTask.output_size": %w`, err)} + } + } + if _, ok := btc.mutation.ErrorSize(); !ok { + return &ValidationError{Name: "error_size", err: errors.New(`ent: missing required field "BuildTask.error_size"`)} + } + if v, ok := btc.mutation.ErrorSize(); ok { + if err := buildtask.ErrorSizeValidator(v); err != nil { + return &ValidationError{Name: "error_size", err: fmt.Errorf(`ent: validator failed for field "BuildTask.error_size": %w`, err)} + } + } + if len(btc.mutation.BuilderIDs()) == 0 { + return &ValidationError{Name: "builder", err: errors.New(`ent: missing required edge "BuildTask.builder"`)} + } + return nil +} + +func (btc *BuildTaskCreate) sqlSave(ctx context.Context) (*BuildTask, error) { + if err := btc.check(); err != nil { + return nil, err + } + _node, _spec := btc.createSpec() + if err := sqlgraph.CreateNode(ctx, btc.driver, _spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + id := _spec.ID.Value.(int64) + _node.ID = int(id) + btc.mutation.id = &_node.ID + btc.mutation.done = true + return _node, nil +} + +func (btc *BuildTaskCreate) createSpec() (*BuildTask, *sqlgraph.CreateSpec) { + var ( + _node = &BuildTask{config: btc.config} + _spec = sqlgraph.NewCreateSpec(buildtask.Table, sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt)) + ) + _spec.OnConflict = btc.conflict + if value, ok := btc.mutation.CreatedAt(); ok { + _spec.SetField(buildtask.FieldCreatedAt, field.TypeTime, value) + _node.CreatedAt = value + } + if value, ok := btc.mutation.LastModifiedAt(); ok { + _spec.SetField(buildtask.FieldLastModifiedAt, field.TypeTime, value) + _node.LastModifiedAt = value + } + if value, ok := btc.mutation.TargetOs(); ok { + _spec.SetField(buildtask.FieldTargetOs, field.TypeEnum, value) + _node.TargetOs = value + } + if value, ok := btc.mutation.TargetFormat(); ok { + _spec.SetField(buildtask.FieldTargetFormat, field.TypeEnum, value) + _node.TargetFormat = value + } + if value, ok := btc.mutation.BuildImage(); ok { + _spec.SetField(buildtask.FieldBuildImage, field.TypeString, value) + _node.BuildImage = value + } + if value, ok := btc.mutation.BuildScript(); ok { + _spec.SetField(buildtask.FieldBuildScript, field.TypeString, value) + _node.BuildScript = value + } + if value, ok := btc.mutation.CallbackURI(); ok { + _spec.SetField(buildtask.FieldCallbackURI, field.TypeString, value) + _node.CallbackURI = value + } + if value, ok := btc.mutation.Interval(); ok { + _spec.SetField(buildtask.FieldInterval, field.TypeInt, value) + _node.Interval = value + } + if value, ok := btc.mutation.TransportType(); ok { + _spec.SetField(buildtask.FieldTransportType, field.TypeEnum, value) + _node.TransportType = value + } + if value, ok := btc.mutation.Extra(); ok { + _spec.SetField(buildtask.FieldExtra, field.TypeString, value) + _node.Extra = value + } + if value, ok := btc.mutation.ClaimedAt(); ok { + _spec.SetField(buildtask.FieldClaimedAt, field.TypeTime, value) + _node.ClaimedAt = value + } + if value, ok := btc.mutation.StartedAt(); ok { + _spec.SetField(buildtask.FieldStartedAt, field.TypeTime, value) + _node.StartedAt = value + } + if value, ok := btc.mutation.FinishedAt(); ok { + _spec.SetField(buildtask.FieldFinishedAt, field.TypeTime, value) + _node.FinishedAt = value + } + if value, ok := btc.mutation.Output(); ok { + _spec.SetField(buildtask.FieldOutput, field.TypeString, value) + _node.Output = value + } + if value, ok := btc.mutation.OutputSize(); ok { + _spec.SetField(buildtask.FieldOutputSize, field.TypeInt, value) + _node.OutputSize = value + } + if value, ok := btc.mutation.Error(); ok { + _spec.SetField(buildtask.FieldError, field.TypeString, value) + _node.Error = value + } + if value, ok := btc.mutation.ErrorSize(); ok { + _spec.SetField(buildtask.FieldErrorSize, field.TypeInt, value) + _node.ErrorSize = value + } + if value, ok := btc.mutation.ExitCode(); ok { + _spec.SetField(buildtask.FieldExitCode, field.TypeInt, value) + _node.ExitCode = &value + } + if value, ok := btc.mutation.ArtifactPath(); ok { + _spec.SetField(buildtask.FieldArtifactPath, field.TypeString, value) + _node.ArtifactPath = value + } + if nodes := btc.mutation.BuilderIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.BuilderTable, + Columns: []string{buildtask.BuilderColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(builder.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.build_task_builder = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := btc.mutation.ArtifactIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.ArtifactTable, + Columns: []string{buildtask.ArtifactColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.build_task_artifact = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + return _node, _spec +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.BuildTask.Create(). +// SetCreatedAt(v). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.BuildTaskUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (btc *BuildTaskCreate) OnConflict(opts ...sql.ConflictOption) *BuildTaskUpsertOne { + btc.conflict = opts + return &BuildTaskUpsertOne{ + create: btc, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.BuildTask.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (btc *BuildTaskCreate) OnConflictColumns(columns ...string) *BuildTaskUpsertOne { + btc.conflict = append(btc.conflict, sql.ConflictColumns(columns...)) + return &BuildTaskUpsertOne{ + create: btc, + } +} + +type ( + // BuildTaskUpsertOne is the builder for "upsert"-ing + // one BuildTask node. + BuildTaskUpsertOne struct { + create *BuildTaskCreate + } + + // BuildTaskUpsert is the "OnConflict" setter. + BuildTaskUpsert struct { + *sql.UpdateSet + } +) + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *BuildTaskUpsert) SetLastModifiedAt(v time.Time) *BuildTaskUpsert { + u.Set(buildtask.FieldLastModifiedAt, v) + return u +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateLastModifiedAt() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldLastModifiedAt) + return u +} + +// SetTargetOs sets the "target_os" field. +func (u *BuildTaskUpsert) SetTargetOs(v c2pb.Host_Platform) *BuildTaskUpsert { + u.Set(buildtask.FieldTargetOs, v) + return u +} + +// UpdateTargetOs sets the "target_os" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateTargetOs() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldTargetOs) + return u +} + +// SetTargetFormat sets the "target_format" field. +func (u *BuildTaskUpsert) SetTargetFormat(v builderpb.TargetFormat) *BuildTaskUpsert { + u.Set(buildtask.FieldTargetFormat, v) + return u +} + +// UpdateTargetFormat sets the "target_format" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateTargetFormat() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldTargetFormat) + return u +} + +// SetBuildImage sets the "build_image" field. +func (u *BuildTaskUpsert) SetBuildImage(v string) *BuildTaskUpsert { + u.Set(buildtask.FieldBuildImage, v) + return u +} + +// UpdateBuildImage sets the "build_image" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateBuildImage() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldBuildImage) + return u +} + +// SetBuildScript sets the "build_script" field. +func (u *BuildTaskUpsert) SetBuildScript(v string) *BuildTaskUpsert { + u.Set(buildtask.FieldBuildScript, v) + return u +} + +// UpdateBuildScript sets the "build_script" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateBuildScript() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldBuildScript) + return u +} + +// SetCallbackURI sets the "callback_uri" field. +func (u *BuildTaskUpsert) SetCallbackURI(v string) *BuildTaskUpsert { + u.Set(buildtask.FieldCallbackURI, v) + return u +} + +// UpdateCallbackURI sets the "callback_uri" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateCallbackURI() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldCallbackURI) + return u +} + +// SetInterval sets the "interval" field. +func (u *BuildTaskUpsert) SetInterval(v int) *BuildTaskUpsert { + u.Set(buildtask.FieldInterval, v) + return u +} + +// UpdateInterval sets the "interval" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateInterval() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldInterval) + return u +} + +// AddInterval adds v to the "interval" field. +func (u *BuildTaskUpsert) AddInterval(v int) *BuildTaskUpsert { + u.Add(buildtask.FieldInterval, v) + return u +} + +// SetTransportType sets the "transport_type" field. +func (u *BuildTaskUpsert) SetTransportType(v c2pb.Transport_Type) *BuildTaskUpsert { + u.Set(buildtask.FieldTransportType, v) + return u +} + +// UpdateTransportType sets the "transport_type" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateTransportType() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldTransportType) + return u +} + +// SetExtra sets the "extra" field. +func (u *BuildTaskUpsert) SetExtra(v string) *BuildTaskUpsert { + u.Set(buildtask.FieldExtra, v) + return u +} + +// UpdateExtra sets the "extra" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateExtra() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldExtra) + return u +} + +// ClearExtra clears the value of the "extra" field. +func (u *BuildTaskUpsert) ClearExtra() *BuildTaskUpsert { + u.SetNull(buildtask.FieldExtra) + return u +} + +// SetClaimedAt sets the "claimed_at" field. +func (u *BuildTaskUpsert) SetClaimedAt(v time.Time) *BuildTaskUpsert { + u.Set(buildtask.FieldClaimedAt, v) + return u +} + +// UpdateClaimedAt sets the "claimed_at" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateClaimedAt() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldClaimedAt) + return u +} + +// ClearClaimedAt clears the value of the "claimed_at" field. +func (u *BuildTaskUpsert) ClearClaimedAt() *BuildTaskUpsert { + u.SetNull(buildtask.FieldClaimedAt) + return u +} + +// SetStartedAt sets the "started_at" field. +func (u *BuildTaskUpsert) SetStartedAt(v time.Time) *BuildTaskUpsert { + u.Set(buildtask.FieldStartedAt, v) + return u +} + +// UpdateStartedAt sets the "started_at" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateStartedAt() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldStartedAt) + return u +} + +// ClearStartedAt clears the value of the "started_at" field. +func (u *BuildTaskUpsert) ClearStartedAt() *BuildTaskUpsert { + u.SetNull(buildtask.FieldStartedAt) + return u +} + +// SetFinishedAt sets the "finished_at" field. +func (u *BuildTaskUpsert) SetFinishedAt(v time.Time) *BuildTaskUpsert { + u.Set(buildtask.FieldFinishedAt, v) + return u +} + +// UpdateFinishedAt sets the "finished_at" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateFinishedAt() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldFinishedAt) + return u +} + +// ClearFinishedAt clears the value of the "finished_at" field. +func (u *BuildTaskUpsert) ClearFinishedAt() *BuildTaskUpsert { + u.SetNull(buildtask.FieldFinishedAt) + return u +} + +// SetOutput sets the "output" field. +func (u *BuildTaskUpsert) SetOutput(v string) *BuildTaskUpsert { + u.Set(buildtask.FieldOutput, v) + return u +} + +// UpdateOutput sets the "output" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateOutput() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldOutput) + return u +} + +// ClearOutput clears the value of the "output" field. +func (u *BuildTaskUpsert) ClearOutput() *BuildTaskUpsert { + u.SetNull(buildtask.FieldOutput) + return u +} + +// SetOutputSize sets the "output_size" field. +func (u *BuildTaskUpsert) SetOutputSize(v int) *BuildTaskUpsert { + u.Set(buildtask.FieldOutputSize, v) + return u +} + +// UpdateOutputSize sets the "output_size" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateOutputSize() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldOutputSize) + return u +} + +// AddOutputSize adds v to the "output_size" field. +func (u *BuildTaskUpsert) AddOutputSize(v int) *BuildTaskUpsert { + u.Add(buildtask.FieldOutputSize, v) + return u +} + +// SetError sets the "error" field. +func (u *BuildTaskUpsert) SetError(v string) *BuildTaskUpsert { + u.Set(buildtask.FieldError, v) + return u +} + +// UpdateError sets the "error" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateError() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldError) + return u +} + +// ClearError clears the value of the "error" field. +func (u *BuildTaskUpsert) ClearError() *BuildTaskUpsert { + u.SetNull(buildtask.FieldError) + return u +} + +// SetErrorSize sets the "error_size" field. +func (u *BuildTaskUpsert) SetErrorSize(v int) *BuildTaskUpsert { + u.Set(buildtask.FieldErrorSize, v) + return u +} + +// UpdateErrorSize sets the "error_size" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateErrorSize() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldErrorSize) + return u +} + +// AddErrorSize adds v to the "error_size" field. +func (u *BuildTaskUpsert) AddErrorSize(v int) *BuildTaskUpsert { + u.Add(buildtask.FieldErrorSize, v) + return u +} + +// SetExitCode sets the "exit_code" field. +func (u *BuildTaskUpsert) SetExitCode(v int) *BuildTaskUpsert { + u.Set(buildtask.FieldExitCode, v) + return u +} + +// UpdateExitCode sets the "exit_code" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateExitCode() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldExitCode) + return u +} + +// AddExitCode adds v to the "exit_code" field. +func (u *BuildTaskUpsert) AddExitCode(v int) *BuildTaskUpsert { + u.Add(buildtask.FieldExitCode, v) + return u +} + +// ClearExitCode clears the value of the "exit_code" field. +func (u *BuildTaskUpsert) ClearExitCode() *BuildTaskUpsert { + u.SetNull(buildtask.FieldExitCode) + return u +} + +// SetArtifactPath sets the "artifact_path" field. +func (u *BuildTaskUpsert) SetArtifactPath(v string) *BuildTaskUpsert { + u.Set(buildtask.FieldArtifactPath, v) + return u +} + +// UpdateArtifactPath sets the "artifact_path" field to the value that was provided on create. +func (u *BuildTaskUpsert) UpdateArtifactPath() *BuildTaskUpsert { + u.SetExcluded(buildtask.FieldArtifactPath) + return u +} + +// ClearArtifactPath clears the value of the "artifact_path" field. +func (u *BuildTaskUpsert) ClearArtifactPath() *BuildTaskUpsert { + u.SetNull(buildtask.FieldArtifactPath) + return u +} + +// UpdateNewValues updates the mutable fields using the new values that were set on create. +// Using this option is equivalent to using: +// +// client.BuildTask.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *BuildTaskUpsertOne) UpdateNewValues() *BuildTaskUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + if _, exists := u.create.mutation.CreatedAt(); exists { + s.SetIgnore(buildtask.FieldCreatedAt) + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.BuildTask.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *BuildTaskUpsertOne) Ignore() *BuildTaskUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *BuildTaskUpsertOne) DoNothing() *BuildTaskUpsertOne { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the BuildTaskCreate.OnConflict +// documentation for more info. +func (u *BuildTaskUpsertOne) Update(set func(*BuildTaskUpsert)) *BuildTaskUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&BuildTaskUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *BuildTaskUpsertOne) SetLastModifiedAt(v time.Time) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateLastModifiedAt() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetTargetOs sets the "target_os" field. +func (u *BuildTaskUpsertOne) SetTargetOs(v c2pb.Host_Platform) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetTargetOs(v) + }) +} + +// UpdateTargetOs sets the "target_os" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateTargetOs() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateTargetOs() + }) +} + +// SetTargetFormat sets the "target_format" field. +func (u *BuildTaskUpsertOne) SetTargetFormat(v builderpb.TargetFormat) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetTargetFormat(v) + }) +} + +// UpdateTargetFormat sets the "target_format" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateTargetFormat() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateTargetFormat() + }) +} + +// SetBuildImage sets the "build_image" field. +func (u *BuildTaskUpsertOne) SetBuildImage(v string) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetBuildImage(v) + }) +} + +// UpdateBuildImage sets the "build_image" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateBuildImage() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateBuildImage() + }) +} + +// SetBuildScript sets the "build_script" field. +func (u *BuildTaskUpsertOne) SetBuildScript(v string) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetBuildScript(v) + }) +} + +// UpdateBuildScript sets the "build_script" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateBuildScript() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateBuildScript() + }) +} + +// SetCallbackURI sets the "callback_uri" field. +func (u *BuildTaskUpsertOne) SetCallbackURI(v string) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetCallbackURI(v) + }) +} + +// UpdateCallbackURI sets the "callback_uri" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateCallbackURI() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateCallbackURI() + }) +} + +// SetInterval sets the "interval" field. +func (u *BuildTaskUpsertOne) SetInterval(v int) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetInterval(v) + }) +} + +// AddInterval adds v to the "interval" field. +func (u *BuildTaskUpsertOne) AddInterval(v int) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.AddInterval(v) + }) +} + +// UpdateInterval sets the "interval" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateInterval() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateInterval() + }) +} + +// SetTransportType sets the "transport_type" field. +func (u *BuildTaskUpsertOne) SetTransportType(v c2pb.Transport_Type) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetTransportType(v) + }) +} + +// UpdateTransportType sets the "transport_type" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateTransportType() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateTransportType() + }) +} + +// SetExtra sets the "extra" field. +func (u *BuildTaskUpsertOne) SetExtra(v string) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetExtra(v) + }) +} + +// UpdateExtra sets the "extra" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateExtra() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateExtra() + }) +} + +// ClearExtra clears the value of the "extra" field. +func (u *BuildTaskUpsertOne) ClearExtra() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearExtra() + }) +} + +// SetClaimedAt sets the "claimed_at" field. +func (u *BuildTaskUpsertOne) SetClaimedAt(v time.Time) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetClaimedAt(v) + }) +} + +// UpdateClaimedAt sets the "claimed_at" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateClaimedAt() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateClaimedAt() + }) +} + +// ClearClaimedAt clears the value of the "claimed_at" field. +func (u *BuildTaskUpsertOne) ClearClaimedAt() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearClaimedAt() + }) +} + +// SetStartedAt sets the "started_at" field. +func (u *BuildTaskUpsertOne) SetStartedAt(v time.Time) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetStartedAt(v) + }) +} + +// UpdateStartedAt sets the "started_at" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateStartedAt() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateStartedAt() + }) +} + +// ClearStartedAt clears the value of the "started_at" field. +func (u *BuildTaskUpsertOne) ClearStartedAt() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearStartedAt() + }) +} + +// SetFinishedAt sets the "finished_at" field. +func (u *BuildTaskUpsertOne) SetFinishedAt(v time.Time) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetFinishedAt(v) + }) +} + +// UpdateFinishedAt sets the "finished_at" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateFinishedAt() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateFinishedAt() + }) +} + +// ClearFinishedAt clears the value of the "finished_at" field. +func (u *BuildTaskUpsertOne) ClearFinishedAt() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearFinishedAt() + }) +} + +// SetOutput sets the "output" field. +func (u *BuildTaskUpsertOne) SetOutput(v string) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetOutput(v) + }) +} + +// UpdateOutput sets the "output" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateOutput() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateOutput() + }) +} + +// ClearOutput clears the value of the "output" field. +func (u *BuildTaskUpsertOne) ClearOutput() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearOutput() + }) +} + +// SetOutputSize sets the "output_size" field. +func (u *BuildTaskUpsertOne) SetOutputSize(v int) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetOutputSize(v) + }) +} + +// AddOutputSize adds v to the "output_size" field. +func (u *BuildTaskUpsertOne) AddOutputSize(v int) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.AddOutputSize(v) + }) +} + +// UpdateOutputSize sets the "output_size" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateOutputSize() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateOutputSize() + }) +} + +// SetError sets the "error" field. +func (u *BuildTaskUpsertOne) SetError(v string) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetError(v) + }) +} + +// UpdateError sets the "error" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateError() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateError() + }) +} + +// ClearError clears the value of the "error" field. +func (u *BuildTaskUpsertOne) ClearError() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearError() + }) +} + +// SetErrorSize sets the "error_size" field. +func (u *BuildTaskUpsertOne) SetErrorSize(v int) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetErrorSize(v) + }) +} + +// AddErrorSize adds v to the "error_size" field. +func (u *BuildTaskUpsertOne) AddErrorSize(v int) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.AddErrorSize(v) + }) +} + +// UpdateErrorSize sets the "error_size" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateErrorSize() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateErrorSize() + }) +} + +// SetExitCode sets the "exit_code" field. +func (u *BuildTaskUpsertOne) SetExitCode(v int) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetExitCode(v) + }) +} + +// AddExitCode adds v to the "exit_code" field. +func (u *BuildTaskUpsertOne) AddExitCode(v int) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.AddExitCode(v) + }) +} + +// UpdateExitCode sets the "exit_code" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateExitCode() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateExitCode() + }) +} + +// ClearExitCode clears the value of the "exit_code" field. +func (u *BuildTaskUpsertOne) ClearExitCode() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearExitCode() + }) +} + +// SetArtifactPath sets the "artifact_path" field. +func (u *BuildTaskUpsertOne) SetArtifactPath(v string) *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.SetArtifactPath(v) + }) +} + +// UpdateArtifactPath sets the "artifact_path" field to the value that was provided on create. +func (u *BuildTaskUpsertOne) UpdateArtifactPath() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateArtifactPath() + }) +} + +// ClearArtifactPath clears the value of the "artifact_path" field. +func (u *BuildTaskUpsertOne) ClearArtifactPath() *BuildTaskUpsertOne { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearArtifactPath() + }) +} + +// Exec executes the query. +func (u *BuildTaskUpsertOne) Exec(ctx context.Context) error { + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for BuildTaskCreate.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *BuildTaskUpsertOne) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} + +// Exec executes the UPSERT query and returns the inserted/updated ID. +func (u *BuildTaskUpsertOne) ID(ctx context.Context) (id int, err error) { + node, err := u.create.Save(ctx) + if err != nil { + return id, err + } + return node.ID, nil +} + +// IDX is like ID, but panics if an error occurs. +func (u *BuildTaskUpsertOne) IDX(ctx context.Context) int { + id, err := u.ID(ctx) + if err != nil { + panic(err) + } + return id +} + +// BuildTaskCreateBulk is the builder for creating many BuildTask entities in bulk. +type BuildTaskCreateBulk struct { + config + err error + builders []*BuildTaskCreate + conflict []sql.ConflictOption +} + +// Save creates the BuildTask entities in the database. +func (btcb *BuildTaskCreateBulk) Save(ctx context.Context) ([]*BuildTask, error) { + if btcb.err != nil { + return nil, btcb.err + } + specs := make([]*sqlgraph.CreateSpec, len(btcb.builders)) + nodes := make([]*BuildTask, len(btcb.builders)) + mutators := make([]Mutator, len(btcb.builders)) + for i := range btcb.builders { + func(i int, root context.Context) { + builder := btcb.builders[i] + builder.defaults() + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*BuildTaskMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err := builder.check(); err != nil { + return nil, err + } + builder.mutation = mutation + var err error + nodes[i], specs[i] = builder.createSpec() + if i < len(mutators)-1 { + _, err = mutators[i+1].Mutate(root, btcb.builders[i+1].mutation) + } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} + spec.OnConflict = btcb.conflict + // Invoke the actual operation on the latest mutation in the chain. + if err = sqlgraph.BatchCreate(ctx, btcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + } + } + if err != nil { + return nil, err + } + mutation.id = &nodes[i].ID + if specs[i].ID.Value != nil { + id := specs[i].ID.Value.(int64) + nodes[i].ID = int(id) + } + mutation.done = true + return nodes[i], nil + }) + for i := len(builder.hooks) - 1; i >= 0; i-- { + mut = builder.hooks[i](mut) + } + mutators[i] = mut + }(i, ctx) + } + if len(mutators) > 0 { + if _, err := mutators[0].Mutate(ctx, btcb.builders[0].mutation); err != nil { + return nil, err + } + } + return nodes, nil +} + +// SaveX is like Save, but panics if an error occurs. +func (btcb *BuildTaskCreateBulk) SaveX(ctx context.Context) []*BuildTask { + v, err := btcb.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (btcb *BuildTaskCreateBulk) Exec(ctx context.Context) error { + _, err := btcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (btcb *BuildTaskCreateBulk) ExecX(ctx context.Context) { + if err := btcb.Exec(ctx); err != nil { + panic(err) + } +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.BuildTask.CreateBulk(builders...). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.BuildTaskUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (btcb *BuildTaskCreateBulk) OnConflict(opts ...sql.ConflictOption) *BuildTaskUpsertBulk { + btcb.conflict = opts + return &BuildTaskUpsertBulk{ + create: btcb, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.BuildTask.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (btcb *BuildTaskCreateBulk) OnConflictColumns(columns ...string) *BuildTaskUpsertBulk { + btcb.conflict = append(btcb.conflict, sql.ConflictColumns(columns...)) + return &BuildTaskUpsertBulk{ + create: btcb, + } +} + +// BuildTaskUpsertBulk is the builder for "upsert"-ing +// a bulk of BuildTask nodes. +type BuildTaskUpsertBulk struct { + create *BuildTaskCreateBulk +} + +// UpdateNewValues updates the mutable fields using the new values that +// were set on create. Using this option is equivalent to using: +// +// client.BuildTask.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *BuildTaskUpsertBulk) UpdateNewValues() *BuildTaskUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + for _, b := range u.create.builders { + if _, exists := b.mutation.CreatedAt(); exists { + s.SetIgnore(buildtask.FieldCreatedAt) + } + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.BuildTask.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *BuildTaskUpsertBulk) Ignore() *BuildTaskUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *BuildTaskUpsertBulk) DoNothing() *BuildTaskUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the BuildTaskCreateBulk.OnConflict +// documentation for more info. +func (u *BuildTaskUpsertBulk) Update(set func(*BuildTaskUpsert)) *BuildTaskUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&BuildTaskUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *BuildTaskUpsertBulk) SetLastModifiedAt(v time.Time) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateLastModifiedAt() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetTargetOs sets the "target_os" field. +func (u *BuildTaskUpsertBulk) SetTargetOs(v c2pb.Host_Platform) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetTargetOs(v) + }) +} + +// UpdateTargetOs sets the "target_os" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateTargetOs() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateTargetOs() + }) +} + +// SetTargetFormat sets the "target_format" field. +func (u *BuildTaskUpsertBulk) SetTargetFormat(v builderpb.TargetFormat) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetTargetFormat(v) + }) +} + +// UpdateTargetFormat sets the "target_format" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateTargetFormat() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateTargetFormat() + }) +} + +// SetBuildImage sets the "build_image" field. +func (u *BuildTaskUpsertBulk) SetBuildImage(v string) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetBuildImage(v) + }) +} + +// UpdateBuildImage sets the "build_image" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateBuildImage() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateBuildImage() + }) +} + +// SetBuildScript sets the "build_script" field. +func (u *BuildTaskUpsertBulk) SetBuildScript(v string) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetBuildScript(v) + }) +} + +// UpdateBuildScript sets the "build_script" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateBuildScript() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateBuildScript() + }) +} + +// SetCallbackURI sets the "callback_uri" field. +func (u *BuildTaskUpsertBulk) SetCallbackURI(v string) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetCallbackURI(v) + }) +} + +// UpdateCallbackURI sets the "callback_uri" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateCallbackURI() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateCallbackURI() + }) +} + +// SetInterval sets the "interval" field. +func (u *BuildTaskUpsertBulk) SetInterval(v int) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetInterval(v) + }) +} + +// AddInterval adds v to the "interval" field. +func (u *BuildTaskUpsertBulk) AddInterval(v int) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.AddInterval(v) + }) +} + +// UpdateInterval sets the "interval" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateInterval() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateInterval() + }) +} + +// SetTransportType sets the "transport_type" field. +func (u *BuildTaskUpsertBulk) SetTransportType(v c2pb.Transport_Type) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetTransportType(v) + }) +} + +// UpdateTransportType sets the "transport_type" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateTransportType() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateTransportType() + }) +} + +// SetExtra sets the "extra" field. +func (u *BuildTaskUpsertBulk) SetExtra(v string) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetExtra(v) + }) +} + +// UpdateExtra sets the "extra" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateExtra() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateExtra() + }) +} + +// ClearExtra clears the value of the "extra" field. +func (u *BuildTaskUpsertBulk) ClearExtra() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearExtra() + }) +} + +// SetClaimedAt sets the "claimed_at" field. +func (u *BuildTaskUpsertBulk) SetClaimedAt(v time.Time) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetClaimedAt(v) + }) +} + +// UpdateClaimedAt sets the "claimed_at" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateClaimedAt() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateClaimedAt() + }) +} + +// ClearClaimedAt clears the value of the "claimed_at" field. +func (u *BuildTaskUpsertBulk) ClearClaimedAt() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearClaimedAt() + }) +} + +// SetStartedAt sets the "started_at" field. +func (u *BuildTaskUpsertBulk) SetStartedAt(v time.Time) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetStartedAt(v) + }) +} + +// UpdateStartedAt sets the "started_at" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateStartedAt() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateStartedAt() + }) +} + +// ClearStartedAt clears the value of the "started_at" field. +func (u *BuildTaskUpsertBulk) ClearStartedAt() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearStartedAt() + }) +} + +// SetFinishedAt sets the "finished_at" field. +func (u *BuildTaskUpsertBulk) SetFinishedAt(v time.Time) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetFinishedAt(v) + }) +} + +// UpdateFinishedAt sets the "finished_at" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateFinishedAt() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateFinishedAt() + }) +} + +// ClearFinishedAt clears the value of the "finished_at" field. +func (u *BuildTaskUpsertBulk) ClearFinishedAt() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearFinishedAt() + }) +} + +// SetOutput sets the "output" field. +func (u *BuildTaskUpsertBulk) SetOutput(v string) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetOutput(v) + }) +} + +// UpdateOutput sets the "output" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateOutput() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateOutput() + }) +} + +// ClearOutput clears the value of the "output" field. +func (u *BuildTaskUpsertBulk) ClearOutput() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearOutput() + }) +} + +// SetOutputSize sets the "output_size" field. +func (u *BuildTaskUpsertBulk) SetOutputSize(v int) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetOutputSize(v) + }) +} + +// AddOutputSize adds v to the "output_size" field. +func (u *BuildTaskUpsertBulk) AddOutputSize(v int) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.AddOutputSize(v) + }) +} + +// UpdateOutputSize sets the "output_size" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateOutputSize() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateOutputSize() + }) +} + +// SetError sets the "error" field. +func (u *BuildTaskUpsertBulk) SetError(v string) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetError(v) + }) +} + +// UpdateError sets the "error" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateError() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateError() + }) +} + +// ClearError clears the value of the "error" field. +func (u *BuildTaskUpsertBulk) ClearError() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearError() + }) +} + +// SetErrorSize sets the "error_size" field. +func (u *BuildTaskUpsertBulk) SetErrorSize(v int) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetErrorSize(v) + }) +} + +// AddErrorSize adds v to the "error_size" field. +func (u *BuildTaskUpsertBulk) AddErrorSize(v int) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.AddErrorSize(v) + }) +} + +// UpdateErrorSize sets the "error_size" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateErrorSize() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateErrorSize() + }) +} + +// SetExitCode sets the "exit_code" field. +func (u *BuildTaskUpsertBulk) SetExitCode(v int) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetExitCode(v) + }) +} + +// AddExitCode adds v to the "exit_code" field. +func (u *BuildTaskUpsertBulk) AddExitCode(v int) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.AddExitCode(v) + }) +} + +// UpdateExitCode sets the "exit_code" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateExitCode() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateExitCode() + }) +} + +// ClearExitCode clears the value of the "exit_code" field. +func (u *BuildTaskUpsertBulk) ClearExitCode() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearExitCode() + }) +} + +// SetArtifactPath sets the "artifact_path" field. +func (u *BuildTaskUpsertBulk) SetArtifactPath(v string) *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.SetArtifactPath(v) + }) +} + +// UpdateArtifactPath sets the "artifact_path" field to the value that was provided on create. +func (u *BuildTaskUpsertBulk) UpdateArtifactPath() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.UpdateArtifactPath() + }) +} + +// ClearArtifactPath clears the value of the "artifact_path" field. +func (u *BuildTaskUpsertBulk) ClearArtifactPath() *BuildTaskUpsertBulk { + return u.Update(func(s *BuildTaskUpsert) { + s.ClearArtifactPath() + }) +} + +// Exec executes the query. +func (u *BuildTaskUpsertBulk) Exec(ctx context.Context) error { + if u.create.err != nil { + return u.create.err + } + for i, b := range u.create.builders { + if len(b.conflict) != 0 { + return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the BuildTaskCreateBulk instead", i) + } + } + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for BuildTaskCreateBulk.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *BuildTaskUpsertBulk) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/tavern/internal/ent/buildtask_delete.go b/tavern/internal/ent/buildtask_delete.go new file mode 100644 index 000000000..efbc1b352 --- /dev/null +++ b/tavern/internal/ent/buildtask_delete.go @@ -0,0 +1,88 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "realm.pub/tavern/internal/ent/buildtask" + "realm.pub/tavern/internal/ent/predicate" +) + +// BuildTaskDelete is the builder for deleting a BuildTask entity. +type BuildTaskDelete struct { + config + hooks []Hook + mutation *BuildTaskMutation +} + +// Where appends a list predicates to the BuildTaskDelete builder. +func (btd *BuildTaskDelete) Where(ps ...predicate.BuildTask) *BuildTaskDelete { + btd.mutation.Where(ps...) + return btd +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (btd *BuildTaskDelete) Exec(ctx context.Context) (int, error) { + return withHooks(ctx, btd.sqlExec, btd.mutation, btd.hooks) +} + +// ExecX is like Exec, but panics if an error occurs. +func (btd *BuildTaskDelete) ExecX(ctx context.Context) int { + n, err := btd.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (btd *BuildTaskDelete) sqlExec(ctx context.Context) (int, error) { + _spec := sqlgraph.NewDeleteSpec(buildtask.Table, sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt)) + if ps := btd.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + affected, err := sqlgraph.DeleteNodes(ctx, btd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + btd.mutation.done = true + return affected, err +} + +// BuildTaskDeleteOne is the builder for deleting a single BuildTask entity. +type BuildTaskDeleteOne struct { + btd *BuildTaskDelete +} + +// Where appends a list predicates to the BuildTaskDelete builder. +func (btdo *BuildTaskDeleteOne) Where(ps ...predicate.BuildTask) *BuildTaskDeleteOne { + btdo.btd.mutation.Where(ps...) + return btdo +} + +// Exec executes the deletion query. +func (btdo *BuildTaskDeleteOne) Exec(ctx context.Context) error { + n, err := btdo.btd.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{buildtask.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (btdo *BuildTaskDeleteOne) ExecX(ctx context.Context) { + if err := btdo.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/tavern/internal/ent/buildtask_query.go b/tavern/internal/ent/buildtask_query.go new file mode 100644 index 000000000..5fb34e8b4 --- /dev/null +++ b/tavern/internal/ent/buildtask_query.go @@ -0,0 +1,702 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "fmt" + "math" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "realm.pub/tavern/internal/ent/asset" + "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" + "realm.pub/tavern/internal/ent/predicate" +) + +// BuildTaskQuery is the builder for querying BuildTask entities. +type BuildTaskQuery struct { + config + ctx *QueryContext + order []buildtask.OrderOption + inters []Interceptor + predicates []predicate.BuildTask + withBuilder *BuilderQuery + withArtifact *AssetQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*BuildTask) error + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the BuildTaskQuery builder. +func (btq *BuildTaskQuery) Where(ps ...predicate.BuildTask) *BuildTaskQuery { + btq.predicates = append(btq.predicates, ps...) + return btq +} + +// Limit the number of records to be returned by this query. +func (btq *BuildTaskQuery) Limit(limit int) *BuildTaskQuery { + btq.ctx.Limit = &limit + return btq +} + +// Offset to start from. +func (btq *BuildTaskQuery) Offset(offset int) *BuildTaskQuery { + btq.ctx.Offset = &offset + return btq +} + +// Unique configures the query builder to filter duplicate records on query. +// By default, unique is set to true, and can be disabled using this method. +func (btq *BuildTaskQuery) Unique(unique bool) *BuildTaskQuery { + btq.ctx.Unique = &unique + return btq +} + +// Order specifies how the records should be ordered. +func (btq *BuildTaskQuery) Order(o ...buildtask.OrderOption) *BuildTaskQuery { + btq.order = append(btq.order, o...) + return btq +} + +// QueryBuilder chains the current query on the "builder" edge. +func (btq *BuildTaskQuery) QueryBuilder() *BuilderQuery { + query := (&BuilderClient{config: btq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := btq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := btq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(buildtask.Table, buildtask.FieldID, selector), + sqlgraph.To(builder.Table, builder.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, buildtask.BuilderTable, buildtask.BuilderColumn), + ) + fromU = sqlgraph.SetNeighbors(btq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryArtifact chains the current query on the "artifact" edge. +func (btq *BuildTaskQuery) QueryArtifact() *AssetQuery { + query := (&AssetClient{config: btq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := btq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := btq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(buildtask.Table, buildtask.FieldID, selector), + sqlgraph.To(asset.Table, asset.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, buildtask.ArtifactTable, buildtask.ArtifactColumn), + ) + fromU = sqlgraph.SetNeighbors(btq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// First returns the first BuildTask entity from the query. +// Returns a *NotFoundError when no BuildTask was found. +func (btq *BuildTaskQuery) First(ctx context.Context) (*BuildTask, error) { + nodes, err := btq.Limit(1).All(setContextOp(ctx, btq.ctx, ent.OpQueryFirst)) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, &NotFoundError{buildtask.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (btq *BuildTaskQuery) FirstX(ctx context.Context) *BuildTask { + node, err := btq.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first BuildTask ID from the query. +// Returns a *NotFoundError when no BuildTask ID was found. +func (btq *BuildTaskQuery) FirstID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = btq.Limit(1).IDs(setContextOp(ctx, btq.ctx, ent.OpQueryFirstID)); err != nil { + return + } + if len(ids) == 0 { + err = &NotFoundError{buildtask.Label} + return + } + return ids[0], nil +} + +// FirstIDX is like FirstID, but panics if an error occurs. +func (btq *BuildTaskQuery) FirstIDX(ctx context.Context) int { + id, err := btq.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns a single BuildTask entity found by the query, ensuring it only returns one. +// Returns a *NotSingularError when more than one BuildTask entity is found. +// Returns a *NotFoundError when no BuildTask entities are found. +func (btq *BuildTaskQuery) Only(ctx context.Context) (*BuildTask, error) { + nodes, err := btq.Limit(2).All(setContextOp(ctx, btq.ctx, ent.OpQueryOnly)) + if err != nil { + return nil, err + } + switch len(nodes) { + case 1: + return nodes[0], nil + case 0: + return nil, &NotFoundError{buildtask.Label} + default: + return nil, &NotSingularError{buildtask.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (btq *BuildTaskQuery) OnlyX(ctx context.Context) *BuildTask { + node, err := btq.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID is like Only, but returns the only BuildTask ID in the query. +// Returns a *NotSingularError when more than one BuildTask ID is found. +// Returns a *NotFoundError when no entities are found. +func (btq *BuildTaskQuery) OnlyID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = btq.Limit(2).IDs(setContextOp(ctx, btq.ctx, ent.OpQueryOnlyID)); err != nil { + return + } + switch len(ids) { + case 1: + id = ids[0] + case 0: + err = &NotFoundError{buildtask.Label} + default: + err = &NotSingularError{buildtask.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (btq *BuildTaskQuery) OnlyIDX(ctx context.Context) int { + id, err := btq.OnlyID(ctx) + if err != nil { + panic(err) + } + return id +} + +// All executes the query and returns a list of BuildTasks. +func (btq *BuildTaskQuery) All(ctx context.Context) ([]*BuildTask, error) { + ctx = setContextOp(ctx, btq.ctx, ent.OpQueryAll) + if err := btq.prepareQuery(ctx); err != nil { + return nil, err + } + qr := querierAll[[]*BuildTask, *BuildTaskQuery]() + return withInterceptors[[]*BuildTask](ctx, btq, qr, btq.inters) +} + +// AllX is like All, but panics if an error occurs. +func (btq *BuildTaskQuery) AllX(ctx context.Context) []*BuildTask { + nodes, err := btq.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of BuildTask IDs. +func (btq *BuildTaskQuery) IDs(ctx context.Context) (ids []int, err error) { + if btq.ctx.Unique == nil && btq.path != nil { + btq.Unique(true) + } + ctx = setContextOp(ctx, btq.ctx, ent.OpQueryIDs) + if err = btq.Select(buildtask.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (btq *BuildTaskQuery) IDsX(ctx context.Context) []int { + ids, err := btq.IDs(ctx) + if err != nil { + panic(err) + } + return ids +} + +// Count returns the count of the given query. +func (btq *BuildTaskQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, btq.ctx, ent.OpQueryCount) + if err := btq.prepareQuery(ctx); err != nil { + return 0, err + } + return withInterceptors[int](ctx, btq, querierCount[*BuildTaskQuery](), btq.inters) +} + +// CountX is like Count, but panics if an error occurs. +func (btq *BuildTaskQuery) CountX(ctx context.Context) int { + count, err := btq.Count(ctx) + if err != nil { + panic(err) + } + return count +} + +// Exist returns true if the query has elements in the graph. +func (btq *BuildTaskQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, btq.ctx, ent.OpQueryExist) + switch _, err := btq.FirstID(ctx); { + case IsNotFound(err): + return false, nil + case err != nil: + return false, fmt.Errorf("ent: check existence: %w", err) + default: + return true, nil + } +} + +// ExistX is like Exist, but panics if an error occurs. +func (btq *BuildTaskQuery) ExistX(ctx context.Context) bool { + exist, err := btq.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the BuildTaskQuery builder, including all associated steps. It can be +// used to prepare common query builders and use them differently after the clone is made. +func (btq *BuildTaskQuery) Clone() *BuildTaskQuery { + if btq == nil { + return nil + } + return &BuildTaskQuery{ + config: btq.config, + ctx: btq.ctx.Clone(), + order: append([]buildtask.OrderOption{}, btq.order...), + inters: append([]Interceptor{}, btq.inters...), + predicates: append([]predicate.BuildTask{}, btq.predicates...), + withBuilder: btq.withBuilder.Clone(), + withArtifact: btq.withArtifact.Clone(), + // clone intermediate query. + sql: btq.sql.Clone(), + path: btq.path, + } +} + +// WithBuilder tells the query-builder to eager-load the nodes that are connected to +// the "builder" edge. The optional arguments are used to configure the query builder of the edge. +func (btq *BuildTaskQuery) WithBuilder(opts ...func(*BuilderQuery)) *BuildTaskQuery { + query := (&BuilderClient{config: btq.config}).Query() + for _, opt := range opts { + opt(query) + } + btq.withBuilder = query + return btq +} + +// WithArtifact tells the query-builder to eager-load the nodes that are connected to +// the "artifact" edge. The optional arguments are used to configure the query builder of the edge. +func (btq *BuildTaskQuery) WithArtifact(opts ...func(*AssetQuery)) *BuildTaskQuery { + query := (&AssetClient{config: btq.config}).Query() + for _, opt := range opts { + opt(query) + } + btq.withArtifact = query + return btq +} + +// GroupBy is used to group vertices by one or more fields/columns. +// It is often used with aggregate functions, like: count, max, mean, min, sum. +// +// Example: +// +// var v []struct { +// CreatedAt time.Time `json:"created_at,omitempty"` +// Count int `json:"count,omitempty"` +// } +// +// client.BuildTask.Query(). +// GroupBy(buildtask.FieldCreatedAt). +// Aggregate(ent.Count()). +// Scan(ctx, &v) +func (btq *BuildTaskQuery) GroupBy(field string, fields ...string) *BuildTaskGroupBy { + btq.ctx.Fields = append([]string{field}, fields...) + grbuild := &BuildTaskGroupBy{build: btq} + grbuild.flds = &btq.ctx.Fields + grbuild.label = buildtask.Label + grbuild.scan = grbuild.Scan + return grbuild +} + +// Select allows the selection one or more fields/columns for the given query, +// instead of selecting all fields in the entity. +// +// Example: +// +// var v []struct { +// CreatedAt time.Time `json:"created_at,omitempty"` +// } +// +// client.BuildTask.Query(). +// Select(buildtask.FieldCreatedAt). +// Scan(ctx, &v) +func (btq *BuildTaskQuery) Select(fields ...string) *BuildTaskSelect { + btq.ctx.Fields = append(btq.ctx.Fields, fields...) + sbuild := &BuildTaskSelect{BuildTaskQuery: btq} + sbuild.label = buildtask.Label + sbuild.flds, sbuild.scan = &btq.ctx.Fields, sbuild.Scan + return sbuild +} + +// Aggregate returns a BuildTaskSelect configured with the given aggregations. +func (btq *BuildTaskQuery) Aggregate(fns ...AggregateFunc) *BuildTaskSelect { + return btq.Select().Aggregate(fns...) +} + +func (btq *BuildTaskQuery) prepareQuery(ctx context.Context) error { + for _, inter := range btq.inters { + if inter == nil { + return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") + } + if trv, ok := inter.(Traverser); ok { + if err := trv.Traverse(ctx, btq); err != nil { + return err + } + } + } + for _, f := range btq.ctx.Fields { + if !buildtask.ValidColumn(f) { + return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + } + if btq.path != nil { + prev, err := btq.path(ctx) + if err != nil { + return err + } + btq.sql = prev + } + return nil +} + +func (btq *BuildTaskQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BuildTask, error) { + var ( + nodes = []*BuildTask{} + withFKs = btq.withFKs + _spec = btq.querySpec() + loadedTypes = [2]bool{ + btq.withBuilder != nil, + btq.withArtifact != nil, + } + ) + if btq.withBuilder != nil || btq.withArtifact != nil { + withFKs = true + } + if withFKs { + _spec.Node.Columns = append(_spec.Node.Columns, buildtask.ForeignKeys...) + } + _spec.ScanValues = func(columns []string) ([]any, error) { + return (*BuildTask).scanValues(nil, columns) + } + _spec.Assign = func(columns []string, values []any) error { + node := &BuildTask{config: btq.config} + nodes = append(nodes, node) + node.Edges.loadedTypes = loadedTypes + return node.assignValues(columns, values) + } + if len(btq.modifiers) > 0 { + _spec.Modifiers = btq.modifiers + } + for i := range hooks { + hooks[i](ctx, _spec) + } + if err := sqlgraph.QueryNodes(ctx, btq.driver, _spec); err != nil { + return nil, err + } + if len(nodes) == 0 { + return nodes, nil + } + if query := btq.withBuilder; query != nil { + if err := btq.loadBuilder(ctx, query, nodes, nil, + func(n *BuildTask, e *Builder) { n.Edges.Builder = e }); err != nil { + return nil, err + } + } + if query := btq.withArtifact; query != nil { + if err := btq.loadArtifact(ctx, query, nodes, nil, + func(n *BuildTask, e *Asset) { n.Edges.Artifact = e }); err != nil { + return nil, err + } + } + for i := range btq.loadTotal { + if err := btq.loadTotal[i](ctx, nodes); err != nil { + return nil, err + } + } + return nodes, nil +} + +func (btq *BuildTaskQuery) loadBuilder(ctx context.Context, query *BuilderQuery, nodes []*BuildTask, init func(*BuildTask), assign func(*BuildTask, *Builder)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*BuildTask) + for i := range nodes { + if nodes[i].build_task_builder == nil { + continue + } + fk := *nodes[i].build_task_builder + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(builder.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "build_task_builder" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (btq *BuildTaskQuery) loadArtifact(ctx context.Context, query *AssetQuery, nodes []*BuildTask, init func(*BuildTask), assign func(*BuildTask, *Asset)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*BuildTask) + for i := range nodes { + if nodes[i].build_task_artifact == nil { + continue + } + fk := *nodes[i].build_task_artifact + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(asset.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "build_task_artifact" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} + +func (btq *BuildTaskQuery) sqlCount(ctx context.Context) (int, error) { + _spec := btq.querySpec() + if len(btq.modifiers) > 0 { + _spec.Modifiers = btq.modifiers + } + _spec.Node.Columns = btq.ctx.Fields + if len(btq.ctx.Fields) > 0 { + _spec.Unique = btq.ctx.Unique != nil && *btq.ctx.Unique + } + return sqlgraph.CountNodes(ctx, btq.driver, _spec) +} + +func (btq *BuildTaskQuery) querySpec() *sqlgraph.QuerySpec { + _spec := sqlgraph.NewQuerySpec(buildtask.Table, buildtask.Columns, sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt)) + _spec.From = btq.sql + if unique := btq.ctx.Unique; unique != nil { + _spec.Unique = *unique + } else if btq.path != nil { + _spec.Unique = true + } + if fields := btq.ctx.Fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, buildtask.FieldID) + for i := range fields { + if fields[i] != buildtask.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) + } + } + } + if ps := btq.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if limit := btq.ctx.Limit; limit != nil { + _spec.Limit = *limit + } + if offset := btq.ctx.Offset; offset != nil { + _spec.Offset = *offset + } + if ps := btq.order; len(ps) > 0 { + _spec.Order = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + return _spec +} + +func (btq *BuildTaskQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(btq.driver.Dialect()) + t1 := builder.Table(buildtask.Table) + columns := btq.ctx.Fields + if len(columns) == 0 { + columns = buildtask.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) + if btq.sql != nil { + selector = btq.sql + selector.Select(selector.Columns(columns...)...) + } + if btq.ctx.Unique != nil && *btq.ctx.Unique { + selector.Distinct() + } + for _, p := range btq.predicates { + p(selector) + } + for _, p := range btq.order { + p(selector) + } + if offset := btq.ctx.Offset; offset != nil { + // limit is mandatory for offset clause. We start + // with default value, and override it below if needed. + selector.Offset(*offset).Limit(math.MaxInt32) + } + if limit := btq.ctx.Limit; limit != nil { + selector.Limit(*limit) + } + return selector +} + +// BuildTaskGroupBy is the group-by builder for BuildTask entities. +type BuildTaskGroupBy struct { + selector + build *BuildTaskQuery +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (btgb *BuildTaskGroupBy) Aggregate(fns ...AggregateFunc) *BuildTaskGroupBy { + btgb.fns = append(btgb.fns, fns...) + return btgb +} + +// Scan applies the selector query and scans the result into the given value. +func (btgb *BuildTaskGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, btgb.build.ctx, ent.OpQueryGroupBy) + if err := btgb.build.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*BuildTaskQuery, *BuildTaskGroupBy](ctx, btgb.build, btgb, btgb.build.inters, v) +} + +func (btgb *BuildTaskGroupBy) sqlScan(ctx context.Context, root *BuildTaskQuery, v any) error { + selector := root.sqlQuery(ctx).Select() + aggregation := make([]string, 0, len(btgb.fns)) + for _, fn := range btgb.fns { + aggregation = append(aggregation, fn(selector)) + } + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(*btgb.flds)+len(btgb.fns)) + for _, f := range *btgb.flds { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) + } + selector.GroupBy(selector.Columns(*btgb.flds...)...) + if err := selector.Err(); err != nil { + return err + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := btgb.build.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} + +// BuildTaskSelect is the builder for selecting fields of BuildTask entities. +type BuildTaskSelect struct { + *BuildTaskQuery + selector +} + +// Aggregate adds the given aggregation functions to the selector query. +func (bts *BuildTaskSelect) Aggregate(fns ...AggregateFunc) *BuildTaskSelect { + bts.fns = append(bts.fns, fns...) + return bts +} + +// Scan applies the selector query and scans the result into the given value. +func (bts *BuildTaskSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, bts.ctx, ent.OpQuerySelect) + if err := bts.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*BuildTaskQuery, *BuildTaskSelect](ctx, bts.BuildTaskQuery, bts, bts.inters, v) +} + +func (bts *BuildTaskSelect) sqlScan(ctx context.Context, root *BuildTaskQuery, v any) error { + selector := root.sqlQuery(ctx) + aggregation := make([]string, 0, len(bts.fns)) + for _, fn := range bts.fns { + aggregation = append(aggregation, fn(selector)) + } + switch n := len(*bts.selector.flds); { + case n == 0 && len(aggregation) > 0: + selector.Select(aggregation...) + case n != 0 && len(aggregation) > 0: + selector.AppendSelect(aggregation...) + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := bts.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} diff --git a/tavern/internal/ent/buildtask_update.go b/tavern/internal/ent/buildtask_update.go new file mode 100644 index 000000000..c87e1211e --- /dev/null +++ b/tavern/internal/ent/buildtask_update.go @@ -0,0 +1,1332 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/c2/c2pb" + "realm.pub/tavern/internal/ent/asset" + "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" + "realm.pub/tavern/internal/ent/predicate" +) + +// BuildTaskUpdate is the builder for updating BuildTask entities. +type BuildTaskUpdate struct { + config + hooks []Hook + mutation *BuildTaskMutation +} + +// Where appends a list predicates to the BuildTaskUpdate builder. +func (btu *BuildTaskUpdate) Where(ps ...predicate.BuildTask) *BuildTaskUpdate { + btu.mutation.Where(ps...) + return btu +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (btu *BuildTaskUpdate) SetLastModifiedAt(t time.Time) *BuildTaskUpdate { + btu.mutation.SetLastModifiedAt(t) + return btu +} + +// SetTargetOs sets the "target_os" field. +func (btu *BuildTaskUpdate) SetTargetOs(cp c2pb.Host_Platform) *BuildTaskUpdate { + btu.mutation.SetTargetOs(cp) + return btu +} + +// SetNillableTargetOs sets the "target_os" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableTargetOs(cp *c2pb.Host_Platform) *BuildTaskUpdate { + if cp != nil { + btu.SetTargetOs(*cp) + } + return btu +} + +// SetTargetFormat sets the "target_format" field. +func (btu *BuildTaskUpdate) SetTargetFormat(bf builderpb.TargetFormat) *BuildTaskUpdate { + btu.mutation.SetTargetFormat(bf) + return btu +} + +// SetNillableTargetFormat sets the "target_format" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableTargetFormat(bf *builderpb.TargetFormat) *BuildTaskUpdate { + if bf != nil { + btu.SetTargetFormat(*bf) + } + return btu +} + +// SetBuildImage sets the "build_image" field. +func (btu *BuildTaskUpdate) SetBuildImage(s string) *BuildTaskUpdate { + btu.mutation.SetBuildImage(s) + return btu +} + +// SetNillableBuildImage sets the "build_image" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableBuildImage(s *string) *BuildTaskUpdate { + if s != nil { + btu.SetBuildImage(*s) + } + return btu +} + +// SetBuildScript sets the "build_script" field. +func (btu *BuildTaskUpdate) SetBuildScript(s string) *BuildTaskUpdate { + btu.mutation.SetBuildScript(s) + return btu +} + +// SetNillableBuildScript sets the "build_script" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableBuildScript(s *string) *BuildTaskUpdate { + if s != nil { + btu.SetBuildScript(*s) + } + return btu +} + +// SetCallbackURI sets the "callback_uri" field. +func (btu *BuildTaskUpdate) SetCallbackURI(s string) *BuildTaskUpdate { + btu.mutation.SetCallbackURI(s) + return btu +} + +// SetNillableCallbackURI sets the "callback_uri" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableCallbackURI(s *string) *BuildTaskUpdate { + if s != nil { + btu.SetCallbackURI(*s) + } + return btu +} + +// SetInterval sets the "interval" field. +func (btu *BuildTaskUpdate) SetInterval(i int) *BuildTaskUpdate { + btu.mutation.ResetInterval() + btu.mutation.SetInterval(i) + return btu +} + +// SetNillableInterval sets the "interval" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableInterval(i *int) *BuildTaskUpdate { + if i != nil { + btu.SetInterval(*i) + } + return btu +} + +// AddInterval adds i to the "interval" field. +func (btu *BuildTaskUpdate) AddInterval(i int) *BuildTaskUpdate { + btu.mutation.AddInterval(i) + return btu +} + +// SetTransportType sets the "transport_type" field. +func (btu *BuildTaskUpdate) SetTransportType(ct c2pb.Transport_Type) *BuildTaskUpdate { + btu.mutation.SetTransportType(ct) + return btu +} + +// SetNillableTransportType sets the "transport_type" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableTransportType(ct *c2pb.Transport_Type) *BuildTaskUpdate { + if ct != nil { + btu.SetTransportType(*ct) + } + return btu +} + +// SetExtra sets the "extra" field. +func (btu *BuildTaskUpdate) SetExtra(s string) *BuildTaskUpdate { + btu.mutation.SetExtra(s) + return btu +} + +// SetNillableExtra sets the "extra" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableExtra(s *string) *BuildTaskUpdate { + if s != nil { + btu.SetExtra(*s) + } + return btu +} + +// ClearExtra clears the value of the "extra" field. +func (btu *BuildTaskUpdate) ClearExtra() *BuildTaskUpdate { + btu.mutation.ClearExtra() + return btu +} + +// SetClaimedAt sets the "claimed_at" field. +func (btu *BuildTaskUpdate) SetClaimedAt(t time.Time) *BuildTaskUpdate { + btu.mutation.SetClaimedAt(t) + return btu +} + +// SetNillableClaimedAt sets the "claimed_at" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableClaimedAt(t *time.Time) *BuildTaskUpdate { + if t != nil { + btu.SetClaimedAt(*t) + } + return btu +} + +// ClearClaimedAt clears the value of the "claimed_at" field. +func (btu *BuildTaskUpdate) ClearClaimedAt() *BuildTaskUpdate { + btu.mutation.ClearClaimedAt() + return btu +} + +// SetStartedAt sets the "started_at" field. +func (btu *BuildTaskUpdate) SetStartedAt(t time.Time) *BuildTaskUpdate { + btu.mutation.SetStartedAt(t) + return btu +} + +// SetNillableStartedAt sets the "started_at" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableStartedAt(t *time.Time) *BuildTaskUpdate { + if t != nil { + btu.SetStartedAt(*t) + } + return btu +} + +// ClearStartedAt clears the value of the "started_at" field. +func (btu *BuildTaskUpdate) ClearStartedAt() *BuildTaskUpdate { + btu.mutation.ClearStartedAt() + return btu +} + +// SetFinishedAt sets the "finished_at" field. +func (btu *BuildTaskUpdate) SetFinishedAt(t time.Time) *BuildTaskUpdate { + btu.mutation.SetFinishedAt(t) + return btu +} + +// SetNillableFinishedAt sets the "finished_at" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableFinishedAt(t *time.Time) *BuildTaskUpdate { + if t != nil { + btu.SetFinishedAt(*t) + } + return btu +} + +// ClearFinishedAt clears the value of the "finished_at" field. +func (btu *BuildTaskUpdate) ClearFinishedAt() *BuildTaskUpdate { + btu.mutation.ClearFinishedAt() + return btu +} + +// SetOutput sets the "output" field. +func (btu *BuildTaskUpdate) SetOutput(s string) *BuildTaskUpdate { + btu.mutation.SetOutput(s) + return btu +} + +// SetNillableOutput sets the "output" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableOutput(s *string) *BuildTaskUpdate { + if s != nil { + btu.SetOutput(*s) + } + return btu +} + +// ClearOutput clears the value of the "output" field. +func (btu *BuildTaskUpdate) ClearOutput() *BuildTaskUpdate { + btu.mutation.ClearOutput() + return btu +} + +// SetOutputSize sets the "output_size" field. +func (btu *BuildTaskUpdate) SetOutputSize(i int) *BuildTaskUpdate { + btu.mutation.ResetOutputSize() + btu.mutation.SetOutputSize(i) + return btu +} + +// SetNillableOutputSize sets the "output_size" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableOutputSize(i *int) *BuildTaskUpdate { + if i != nil { + btu.SetOutputSize(*i) + } + return btu +} + +// AddOutputSize adds i to the "output_size" field. +func (btu *BuildTaskUpdate) AddOutputSize(i int) *BuildTaskUpdate { + btu.mutation.AddOutputSize(i) + return btu +} + +// SetError sets the "error" field. +func (btu *BuildTaskUpdate) SetError(s string) *BuildTaskUpdate { + btu.mutation.SetError(s) + return btu +} + +// SetNillableError sets the "error" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableError(s *string) *BuildTaskUpdate { + if s != nil { + btu.SetError(*s) + } + return btu +} + +// ClearError clears the value of the "error" field. +func (btu *BuildTaskUpdate) ClearError() *BuildTaskUpdate { + btu.mutation.ClearError() + return btu +} + +// SetErrorSize sets the "error_size" field. +func (btu *BuildTaskUpdate) SetErrorSize(i int) *BuildTaskUpdate { + btu.mutation.ResetErrorSize() + btu.mutation.SetErrorSize(i) + return btu +} + +// SetNillableErrorSize sets the "error_size" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableErrorSize(i *int) *BuildTaskUpdate { + if i != nil { + btu.SetErrorSize(*i) + } + return btu +} + +// AddErrorSize adds i to the "error_size" field. +func (btu *BuildTaskUpdate) AddErrorSize(i int) *BuildTaskUpdate { + btu.mutation.AddErrorSize(i) + return btu +} + +// SetExitCode sets the "exit_code" field. +func (btu *BuildTaskUpdate) SetExitCode(i int) *BuildTaskUpdate { + btu.mutation.ResetExitCode() + btu.mutation.SetExitCode(i) + return btu +} + +// SetNillableExitCode sets the "exit_code" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableExitCode(i *int) *BuildTaskUpdate { + if i != nil { + btu.SetExitCode(*i) + } + return btu +} + +// AddExitCode adds i to the "exit_code" field. +func (btu *BuildTaskUpdate) AddExitCode(i int) *BuildTaskUpdate { + btu.mutation.AddExitCode(i) + return btu +} + +// ClearExitCode clears the value of the "exit_code" field. +func (btu *BuildTaskUpdate) ClearExitCode() *BuildTaskUpdate { + btu.mutation.ClearExitCode() + return btu +} + +// SetArtifactPath sets the "artifact_path" field. +func (btu *BuildTaskUpdate) SetArtifactPath(s string) *BuildTaskUpdate { + btu.mutation.SetArtifactPath(s) + return btu +} + +// SetNillableArtifactPath sets the "artifact_path" field if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableArtifactPath(s *string) *BuildTaskUpdate { + if s != nil { + btu.SetArtifactPath(*s) + } + return btu +} + +// ClearArtifactPath clears the value of the "artifact_path" field. +func (btu *BuildTaskUpdate) ClearArtifactPath() *BuildTaskUpdate { + btu.mutation.ClearArtifactPath() + return btu +} + +// SetBuilderID sets the "builder" edge to the Builder entity by ID. +func (btu *BuildTaskUpdate) SetBuilderID(id int) *BuildTaskUpdate { + btu.mutation.SetBuilderID(id) + return btu +} + +// SetBuilder sets the "builder" edge to the Builder entity. +func (btu *BuildTaskUpdate) SetBuilder(b *Builder) *BuildTaskUpdate { + return btu.SetBuilderID(b.ID) +} + +// SetArtifactID sets the "artifact" edge to the Asset entity by ID. +func (btu *BuildTaskUpdate) SetArtifactID(id int) *BuildTaskUpdate { + btu.mutation.SetArtifactID(id) + return btu +} + +// SetNillableArtifactID sets the "artifact" edge to the Asset entity by ID if the given value is not nil. +func (btu *BuildTaskUpdate) SetNillableArtifactID(id *int) *BuildTaskUpdate { + if id != nil { + btu = btu.SetArtifactID(*id) + } + return btu +} + +// SetArtifact sets the "artifact" edge to the Asset entity. +func (btu *BuildTaskUpdate) SetArtifact(a *Asset) *BuildTaskUpdate { + return btu.SetArtifactID(a.ID) +} + +// Mutation returns the BuildTaskMutation object of the builder. +func (btu *BuildTaskUpdate) Mutation() *BuildTaskMutation { + return btu.mutation +} + +// ClearBuilder clears the "builder" edge to the Builder entity. +func (btu *BuildTaskUpdate) ClearBuilder() *BuildTaskUpdate { + btu.mutation.ClearBuilder() + return btu +} + +// ClearArtifact clears the "artifact" edge to the Asset entity. +func (btu *BuildTaskUpdate) ClearArtifact() *BuildTaskUpdate { + btu.mutation.ClearArtifact() + return btu +} + +// Save executes the query and returns the number of nodes affected by the update operation. +func (btu *BuildTaskUpdate) Save(ctx context.Context) (int, error) { + if err := btu.defaults(); err != nil { + return 0, err + } + return withHooks(ctx, btu.sqlSave, btu.mutation, btu.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (btu *BuildTaskUpdate) SaveX(ctx context.Context) int { + affected, err := btu.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (btu *BuildTaskUpdate) Exec(ctx context.Context) error { + _, err := btu.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (btu *BuildTaskUpdate) ExecX(ctx context.Context) { + if err := btu.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (btu *BuildTaskUpdate) defaults() error { + if _, ok := btu.mutation.LastModifiedAt(); !ok { + if buildtask.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized buildtask.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := buildtask.UpdateDefaultLastModifiedAt() + btu.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (btu *BuildTaskUpdate) check() error { + if v, ok := btu.mutation.TargetOs(); ok { + if err := buildtask.TargetOsValidator(v); err != nil { + return &ValidationError{Name: "target_os", err: fmt.Errorf(`ent: validator failed for field "BuildTask.target_os": %w`, err)} + } + } + if v, ok := btu.mutation.TargetFormat(); ok { + if err := buildtask.TargetFormatValidator(v); err != nil { + return &ValidationError{Name: "target_format", err: fmt.Errorf(`ent: validator failed for field "BuildTask.target_format": %w`, err)} + } + } + if v, ok := btu.mutation.BuildImage(); ok { + if err := buildtask.BuildImageValidator(v); err != nil { + return &ValidationError{Name: "build_image", err: fmt.Errorf(`ent: validator failed for field "BuildTask.build_image": %w`, err)} + } + } + if v, ok := btu.mutation.BuildScript(); ok { + if err := buildtask.BuildScriptValidator(v); err != nil { + return &ValidationError{Name: "build_script", err: fmt.Errorf(`ent: validator failed for field "BuildTask.build_script": %w`, err)} + } + } + if v, ok := btu.mutation.CallbackURI(); ok { + if err := buildtask.CallbackURIValidator(v); err != nil { + return &ValidationError{Name: "callback_uri", err: fmt.Errorf(`ent: validator failed for field "BuildTask.callback_uri": %w`, err)} + } + } + if v, ok := btu.mutation.TransportType(); ok { + if err := buildtask.TransportTypeValidator(v); err != nil { + return &ValidationError{Name: "transport_type", err: fmt.Errorf(`ent: validator failed for field "BuildTask.transport_type": %w`, err)} + } + } + if v, ok := btu.mutation.OutputSize(); ok { + if err := buildtask.OutputSizeValidator(v); err != nil { + return &ValidationError{Name: "output_size", err: fmt.Errorf(`ent: validator failed for field "BuildTask.output_size": %w`, err)} + } + } + if v, ok := btu.mutation.ErrorSize(); ok { + if err := buildtask.ErrorSizeValidator(v); err != nil { + return &ValidationError{Name: "error_size", err: fmt.Errorf(`ent: validator failed for field "BuildTask.error_size": %w`, err)} + } + } + if btu.mutation.BuilderCleared() && len(btu.mutation.BuilderIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "BuildTask.builder"`) + } + return nil +} + +func (btu *BuildTaskUpdate) sqlSave(ctx context.Context) (n int, err error) { + if err := btu.check(); err != nil { + return n, err + } + _spec := sqlgraph.NewUpdateSpec(buildtask.Table, buildtask.Columns, sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt)) + if ps := btu.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := btu.mutation.LastModifiedAt(); ok { + _spec.SetField(buildtask.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := btu.mutation.TargetOs(); ok { + _spec.SetField(buildtask.FieldTargetOs, field.TypeEnum, value) + } + if value, ok := btu.mutation.TargetFormat(); ok { + _spec.SetField(buildtask.FieldTargetFormat, field.TypeEnum, value) + } + if value, ok := btu.mutation.BuildImage(); ok { + _spec.SetField(buildtask.FieldBuildImage, field.TypeString, value) + } + if value, ok := btu.mutation.BuildScript(); ok { + _spec.SetField(buildtask.FieldBuildScript, field.TypeString, value) + } + if value, ok := btu.mutation.CallbackURI(); ok { + _spec.SetField(buildtask.FieldCallbackURI, field.TypeString, value) + } + if value, ok := btu.mutation.Interval(); ok { + _spec.SetField(buildtask.FieldInterval, field.TypeInt, value) + } + if value, ok := btu.mutation.AddedInterval(); ok { + _spec.AddField(buildtask.FieldInterval, field.TypeInt, value) + } + if value, ok := btu.mutation.TransportType(); ok { + _spec.SetField(buildtask.FieldTransportType, field.TypeEnum, value) + } + if value, ok := btu.mutation.Extra(); ok { + _spec.SetField(buildtask.FieldExtra, field.TypeString, value) + } + if btu.mutation.ExtraCleared() { + _spec.ClearField(buildtask.FieldExtra, field.TypeString) + } + if value, ok := btu.mutation.ClaimedAt(); ok { + _spec.SetField(buildtask.FieldClaimedAt, field.TypeTime, value) + } + if btu.mutation.ClaimedAtCleared() { + _spec.ClearField(buildtask.FieldClaimedAt, field.TypeTime) + } + if value, ok := btu.mutation.StartedAt(); ok { + _spec.SetField(buildtask.FieldStartedAt, field.TypeTime, value) + } + if btu.mutation.StartedAtCleared() { + _spec.ClearField(buildtask.FieldStartedAt, field.TypeTime) + } + if value, ok := btu.mutation.FinishedAt(); ok { + _spec.SetField(buildtask.FieldFinishedAt, field.TypeTime, value) + } + if btu.mutation.FinishedAtCleared() { + _spec.ClearField(buildtask.FieldFinishedAt, field.TypeTime) + } + if value, ok := btu.mutation.Output(); ok { + _spec.SetField(buildtask.FieldOutput, field.TypeString, value) + } + if btu.mutation.OutputCleared() { + _spec.ClearField(buildtask.FieldOutput, field.TypeString) + } + if value, ok := btu.mutation.OutputSize(); ok { + _spec.SetField(buildtask.FieldOutputSize, field.TypeInt, value) + } + if value, ok := btu.mutation.AddedOutputSize(); ok { + _spec.AddField(buildtask.FieldOutputSize, field.TypeInt, value) + } + if value, ok := btu.mutation.Error(); ok { + _spec.SetField(buildtask.FieldError, field.TypeString, value) + } + if btu.mutation.ErrorCleared() { + _spec.ClearField(buildtask.FieldError, field.TypeString) + } + if value, ok := btu.mutation.ErrorSize(); ok { + _spec.SetField(buildtask.FieldErrorSize, field.TypeInt, value) + } + if value, ok := btu.mutation.AddedErrorSize(); ok { + _spec.AddField(buildtask.FieldErrorSize, field.TypeInt, value) + } + if value, ok := btu.mutation.ExitCode(); ok { + _spec.SetField(buildtask.FieldExitCode, field.TypeInt, value) + } + if value, ok := btu.mutation.AddedExitCode(); ok { + _spec.AddField(buildtask.FieldExitCode, field.TypeInt, value) + } + if btu.mutation.ExitCodeCleared() { + _spec.ClearField(buildtask.FieldExitCode, field.TypeInt) + } + if value, ok := btu.mutation.ArtifactPath(); ok { + _spec.SetField(buildtask.FieldArtifactPath, field.TypeString, value) + } + if btu.mutation.ArtifactPathCleared() { + _spec.ClearField(buildtask.FieldArtifactPath, field.TypeString) + } + if btu.mutation.BuilderCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.BuilderTable, + Columns: []string{buildtask.BuilderColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(builder.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := btu.mutation.BuilderIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.BuilderTable, + Columns: []string{buildtask.BuilderColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(builder.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if btu.mutation.ArtifactCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.ArtifactTable, + Columns: []string{buildtask.ArtifactColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := btu.mutation.ArtifactIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.ArtifactTable, + Columns: []string{buildtask.ArtifactColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if n, err = sqlgraph.UpdateNodes(ctx, btu.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{buildtask.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + btu.mutation.done = true + return n, nil +} + +// BuildTaskUpdateOne is the builder for updating a single BuildTask entity. +type BuildTaskUpdateOne struct { + config + fields []string + hooks []Hook + mutation *BuildTaskMutation +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (btuo *BuildTaskUpdateOne) SetLastModifiedAt(t time.Time) *BuildTaskUpdateOne { + btuo.mutation.SetLastModifiedAt(t) + return btuo +} + +// SetTargetOs sets the "target_os" field. +func (btuo *BuildTaskUpdateOne) SetTargetOs(cp c2pb.Host_Platform) *BuildTaskUpdateOne { + btuo.mutation.SetTargetOs(cp) + return btuo +} + +// SetNillableTargetOs sets the "target_os" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableTargetOs(cp *c2pb.Host_Platform) *BuildTaskUpdateOne { + if cp != nil { + btuo.SetTargetOs(*cp) + } + return btuo +} + +// SetTargetFormat sets the "target_format" field. +func (btuo *BuildTaskUpdateOne) SetTargetFormat(bf builderpb.TargetFormat) *BuildTaskUpdateOne { + btuo.mutation.SetTargetFormat(bf) + return btuo +} + +// SetNillableTargetFormat sets the "target_format" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableTargetFormat(bf *builderpb.TargetFormat) *BuildTaskUpdateOne { + if bf != nil { + btuo.SetTargetFormat(*bf) + } + return btuo +} + +// SetBuildImage sets the "build_image" field. +func (btuo *BuildTaskUpdateOne) SetBuildImage(s string) *BuildTaskUpdateOne { + btuo.mutation.SetBuildImage(s) + return btuo +} + +// SetNillableBuildImage sets the "build_image" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableBuildImage(s *string) *BuildTaskUpdateOne { + if s != nil { + btuo.SetBuildImage(*s) + } + return btuo +} + +// SetBuildScript sets the "build_script" field. +func (btuo *BuildTaskUpdateOne) SetBuildScript(s string) *BuildTaskUpdateOne { + btuo.mutation.SetBuildScript(s) + return btuo +} + +// SetNillableBuildScript sets the "build_script" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableBuildScript(s *string) *BuildTaskUpdateOne { + if s != nil { + btuo.SetBuildScript(*s) + } + return btuo +} + +// SetCallbackURI sets the "callback_uri" field. +func (btuo *BuildTaskUpdateOne) SetCallbackURI(s string) *BuildTaskUpdateOne { + btuo.mutation.SetCallbackURI(s) + return btuo +} + +// SetNillableCallbackURI sets the "callback_uri" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableCallbackURI(s *string) *BuildTaskUpdateOne { + if s != nil { + btuo.SetCallbackURI(*s) + } + return btuo +} + +// SetInterval sets the "interval" field. +func (btuo *BuildTaskUpdateOne) SetInterval(i int) *BuildTaskUpdateOne { + btuo.mutation.ResetInterval() + btuo.mutation.SetInterval(i) + return btuo +} + +// SetNillableInterval sets the "interval" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableInterval(i *int) *BuildTaskUpdateOne { + if i != nil { + btuo.SetInterval(*i) + } + return btuo +} + +// AddInterval adds i to the "interval" field. +func (btuo *BuildTaskUpdateOne) AddInterval(i int) *BuildTaskUpdateOne { + btuo.mutation.AddInterval(i) + return btuo +} + +// SetTransportType sets the "transport_type" field. +func (btuo *BuildTaskUpdateOne) SetTransportType(ct c2pb.Transport_Type) *BuildTaskUpdateOne { + btuo.mutation.SetTransportType(ct) + return btuo +} + +// SetNillableTransportType sets the "transport_type" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableTransportType(ct *c2pb.Transport_Type) *BuildTaskUpdateOne { + if ct != nil { + btuo.SetTransportType(*ct) + } + return btuo +} + +// SetExtra sets the "extra" field. +func (btuo *BuildTaskUpdateOne) SetExtra(s string) *BuildTaskUpdateOne { + btuo.mutation.SetExtra(s) + return btuo +} + +// SetNillableExtra sets the "extra" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableExtra(s *string) *BuildTaskUpdateOne { + if s != nil { + btuo.SetExtra(*s) + } + return btuo +} + +// ClearExtra clears the value of the "extra" field. +func (btuo *BuildTaskUpdateOne) ClearExtra() *BuildTaskUpdateOne { + btuo.mutation.ClearExtra() + return btuo +} + +// SetClaimedAt sets the "claimed_at" field. +func (btuo *BuildTaskUpdateOne) SetClaimedAt(t time.Time) *BuildTaskUpdateOne { + btuo.mutation.SetClaimedAt(t) + return btuo +} + +// SetNillableClaimedAt sets the "claimed_at" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableClaimedAt(t *time.Time) *BuildTaskUpdateOne { + if t != nil { + btuo.SetClaimedAt(*t) + } + return btuo +} + +// ClearClaimedAt clears the value of the "claimed_at" field. +func (btuo *BuildTaskUpdateOne) ClearClaimedAt() *BuildTaskUpdateOne { + btuo.mutation.ClearClaimedAt() + return btuo +} + +// SetStartedAt sets the "started_at" field. +func (btuo *BuildTaskUpdateOne) SetStartedAt(t time.Time) *BuildTaskUpdateOne { + btuo.mutation.SetStartedAt(t) + return btuo +} + +// SetNillableStartedAt sets the "started_at" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableStartedAt(t *time.Time) *BuildTaskUpdateOne { + if t != nil { + btuo.SetStartedAt(*t) + } + return btuo +} + +// ClearStartedAt clears the value of the "started_at" field. +func (btuo *BuildTaskUpdateOne) ClearStartedAt() *BuildTaskUpdateOne { + btuo.mutation.ClearStartedAt() + return btuo +} + +// SetFinishedAt sets the "finished_at" field. +func (btuo *BuildTaskUpdateOne) SetFinishedAt(t time.Time) *BuildTaskUpdateOne { + btuo.mutation.SetFinishedAt(t) + return btuo +} + +// SetNillableFinishedAt sets the "finished_at" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableFinishedAt(t *time.Time) *BuildTaskUpdateOne { + if t != nil { + btuo.SetFinishedAt(*t) + } + return btuo +} + +// ClearFinishedAt clears the value of the "finished_at" field. +func (btuo *BuildTaskUpdateOne) ClearFinishedAt() *BuildTaskUpdateOne { + btuo.mutation.ClearFinishedAt() + return btuo +} + +// SetOutput sets the "output" field. +func (btuo *BuildTaskUpdateOne) SetOutput(s string) *BuildTaskUpdateOne { + btuo.mutation.SetOutput(s) + return btuo +} + +// SetNillableOutput sets the "output" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableOutput(s *string) *BuildTaskUpdateOne { + if s != nil { + btuo.SetOutput(*s) + } + return btuo +} + +// ClearOutput clears the value of the "output" field. +func (btuo *BuildTaskUpdateOne) ClearOutput() *BuildTaskUpdateOne { + btuo.mutation.ClearOutput() + return btuo +} + +// SetOutputSize sets the "output_size" field. +func (btuo *BuildTaskUpdateOne) SetOutputSize(i int) *BuildTaskUpdateOne { + btuo.mutation.ResetOutputSize() + btuo.mutation.SetOutputSize(i) + return btuo +} + +// SetNillableOutputSize sets the "output_size" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableOutputSize(i *int) *BuildTaskUpdateOne { + if i != nil { + btuo.SetOutputSize(*i) + } + return btuo +} + +// AddOutputSize adds i to the "output_size" field. +func (btuo *BuildTaskUpdateOne) AddOutputSize(i int) *BuildTaskUpdateOne { + btuo.mutation.AddOutputSize(i) + return btuo +} + +// SetError sets the "error" field. +func (btuo *BuildTaskUpdateOne) SetError(s string) *BuildTaskUpdateOne { + btuo.mutation.SetError(s) + return btuo +} + +// SetNillableError sets the "error" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableError(s *string) *BuildTaskUpdateOne { + if s != nil { + btuo.SetError(*s) + } + return btuo +} + +// ClearError clears the value of the "error" field. +func (btuo *BuildTaskUpdateOne) ClearError() *BuildTaskUpdateOne { + btuo.mutation.ClearError() + return btuo +} + +// SetErrorSize sets the "error_size" field. +func (btuo *BuildTaskUpdateOne) SetErrorSize(i int) *BuildTaskUpdateOne { + btuo.mutation.ResetErrorSize() + btuo.mutation.SetErrorSize(i) + return btuo +} + +// SetNillableErrorSize sets the "error_size" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableErrorSize(i *int) *BuildTaskUpdateOne { + if i != nil { + btuo.SetErrorSize(*i) + } + return btuo +} + +// AddErrorSize adds i to the "error_size" field. +func (btuo *BuildTaskUpdateOne) AddErrorSize(i int) *BuildTaskUpdateOne { + btuo.mutation.AddErrorSize(i) + return btuo +} + +// SetExitCode sets the "exit_code" field. +func (btuo *BuildTaskUpdateOne) SetExitCode(i int) *BuildTaskUpdateOne { + btuo.mutation.ResetExitCode() + btuo.mutation.SetExitCode(i) + return btuo +} + +// SetNillableExitCode sets the "exit_code" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableExitCode(i *int) *BuildTaskUpdateOne { + if i != nil { + btuo.SetExitCode(*i) + } + return btuo +} + +// AddExitCode adds i to the "exit_code" field. +func (btuo *BuildTaskUpdateOne) AddExitCode(i int) *BuildTaskUpdateOne { + btuo.mutation.AddExitCode(i) + return btuo +} + +// ClearExitCode clears the value of the "exit_code" field. +func (btuo *BuildTaskUpdateOne) ClearExitCode() *BuildTaskUpdateOne { + btuo.mutation.ClearExitCode() + return btuo +} + +// SetArtifactPath sets the "artifact_path" field. +func (btuo *BuildTaskUpdateOne) SetArtifactPath(s string) *BuildTaskUpdateOne { + btuo.mutation.SetArtifactPath(s) + return btuo +} + +// SetNillableArtifactPath sets the "artifact_path" field if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableArtifactPath(s *string) *BuildTaskUpdateOne { + if s != nil { + btuo.SetArtifactPath(*s) + } + return btuo +} + +// ClearArtifactPath clears the value of the "artifact_path" field. +func (btuo *BuildTaskUpdateOne) ClearArtifactPath() *BuildTaskUpdateOne { + btuo.mutation.ClearArtifactPath() + return btuo +} + +// SetBuilderID sets the "builder" edge to the Builder entity by ID. +func (btuo *BuildTaskUpdateOne) SetBuilderID(id int) *BuildTaskUpdateOne { + btuo.mutation.SetBuilderID(id) + return btuo +} + +// SetBuilder sets the "builder" edge to the Builder entity. +func (btuo *BuildTaskUpdateOne) SetBuilder(b *Builder) *BuildTaskUpdateOne { + return btuo.SetBuilderID(b.ID) +} + +// SetArtifactID sets the "artifact" edge to the Asset entity by ID. +func (btuo *BuildTaskUpdateOne) SetArtifactID(id int) *BuildTaskUpdateOne { + btuo.mutation.SetArtifactID(id) + return btuo +} + +// SetNillableArtifactID sets the "artifact" edge to the Asset entity by ID if the given value is not nil. +func (btuo *BuildTaskUpdateOne) SetNillableArtifactID(id *int) *BuildTaskUpdateOne { + if id != nil { + btuo = btuo.SetArtifactID(*id) + } + return btuo +} + +// SetArtifact sets the "artifact" edge to the Asset entity. +func (btuo *BuildTaskUpdateOne) SetArtifact(a *Asset) *BuildTaskUpdateOne { + return btuo.SetArtifactID(a.ID) +} + +// Mutation returns the BuildTaskMutation object of the builder. +func (btuo *BuildTaskUpdateOne) Mutation() *BuildTaskMutation { + return btuo.mutation +} + +// ClearBuilder clears the "builder" edge to the Builder entity. +func (btuo *BuildTaskUpdateOne) ClearBuilder() *BuildTaskUpdateOne { + btuo.mutation.ClearBuilder() + return btuo +} + +// ClearArtifact clears the "artifact" edge to the Asset entity. +func (btuo *BuildTaskUpdateOne) ClearArtifact() *BuildTaskUpdateOne { + btuo.mutation.ClearArtifact() + return btuo +} + +// Where appends a list predicates to the BuildTaskUpdate builder. +func (btuo *BuildTaskUpdateOne) Where(ps ...predicate.BuildTask) *BuildTaskUpdateOne { + btuo.mutation.Where(ps...) + return btuo +} + +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (btuo *BuildTaskUpdateOne) Select(field string, fields ...string) *BuildTaskUpdateOne { + btuo.fields = append([]string{field}, fields...) + return btuo +} + +// Save executes the query and returns the updated BuildTask entity. +func (btuo *BuildTaskUpdateOne) Save(ctx context.Context) (*BuildTask, error) { + if err := btuo.defaults(); err != nil { + return nil, err + } + return withHooks(ctx, btuo.sqlSave, btuo.mutation, btuo.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (btuo *BuildTaskUpdateOne) SaveX(ctx context.Context) *BuildTask { + node, err := btuo.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (btuo *BuildTaskUpdateOne) Exec(ctx context.Context) error { + _, err := btuo.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (btuo *BuildTaskUpdateOne) ExecX(ctx context.Context) { + if err := btuo.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (btuo *BuildTaskUpdateOne) defaults() error { + if _, ok := btuo.mutation.LastModifiedAt(); !ok { + if buildtask.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized buildtask.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := buildtask.UpdateDefaultLastModifiedAt() + btuo.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (btuo *BuildTaskUpdateOne) check() error { + if v, ok := btuo.mutation.TargetOs(); ok { + if err := buildtask.TargetOsValidator(v); err != nil { + return &ValidationError{Name: "target_os", err: fmt.Errorf(`ent: validator failed for field "BuildTask.target_os": %w`, err)} + } + } + if v, ok := btuo.mutation.TargetFormat(); ok { + if err := buildtask.TargetFormatValidator(v); err != nil { + return &ValidationError{Name: "target_format", err: fmt.Errorf(`ent: validator failed for field "BuildTask.target_format": %w`, err)} + } + } + if v, ok := btuo.mutation.BuildImage(); ok { + if err := buildtask.BuildImageValidator(v); err != nil { + return &ValidationError{Name: "build_image", err: fmt.Errorf(`ent: validator failed for field "BuildTask.build_image": %w`, err)} + } + } + if v, ok := btuo.mutation.BuildScript(); ok { + if err := buildtask.BuildScriptValidator(v); err != nil { + return &ValidationError{Name: "build_script", err: fmt.Errorf(`ent: validator failed for field "BuildTask.build_script": %w`, err)} + } + } + if v, ok := btuo.mutation.CallbackURI(); ok { + if err := buildtask.CallbackURIValidator(v); err != nil { + return &ValidationError{Name: "callback_uri", err: fmt.Errorf(`ent: validator failed for field "BuildTask.callback_uri": %w`, err)} + } + } + if v, ok := btuo.mutation.TransportType(); ok { + if err := buildtask.TransportTypeValidator(v); err != nil { + return &ValidationError{Name: "transport_type", err: fmt.Errorf(`ent: validator failed for field "BuildTask.transport_type": %w`, err)} + } + } + if v, ok := btuo.mutation.OutputSize(); ok { + if err := buildtask.OutputSizeValidator(v); err != nil { + return &ValidationError{Name: "output_size", err: fmt.Errorf(`ent: validator failed for field "BuildTask.output_size": %w`, err)} + } + } + if v, ok := btuo.mutation.ErrorSize(); ok { + if err := buildtask.ErrorSizeValidator(v); err != nil { + return &ValidationError{Name: "error_size", err: fmt.Errorf(`ent: validator failed for field "BuildTask.error_size": %w`, err)} + } + } + if btuo.mutation.BuilderCleared() && len(btuo.mutation.BuilderIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "BuildTask.builder"`) + } + return nil +} + +func (btuo *BuildTaskUpdateOne) sqlSave(ctx context.Context) (_node *BuildTask, err error) { + if err := btuo.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(buildtask.Table, buildtask.Columns, sqlgraph.NewFieldSpec(buildtask.FieldID, field.TypeInt)) + id, ok := btuo.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BuildTask.id" for update`)} + } + _spec.Node.ID.Value = id + if fields := btuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, buildtask.FieldID) + for _, f := range fields { + if !buildtask.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != buildtask.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } + if ps := btuo.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := btuo.mutation.LastModifiedAt(); ok { + _spec.SetField(buildtask.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := btuo.mutation.TargetOs(); ok { + _spec.SetField(buildtask.FieldTargetOs, field.TypeEnum, value) + } + if value, ok := btuo.mutation.TargetFormat(); ok { + _spec.SetField(buildtask.FieldTargetFormat, field.TypeEnum, value) + } + if value, ok := btuo.mutation.BuildImage(); ok { + _spec.SetField(buildtask.FieldBuildImage, field.TypeString, value) + } + if value, ok := btuo.mutation.BuildScript(); ok { + _spec.SetField(buildtask.FieldBuildScript, field.TypeString, value) + } + if value, ok := btuo.mutation.CallbackURI(); ok { + _spec.SetField(buildtask.FieldCallbackURI, field.TypeString, value) + } + if value, ok := btuo.mutation.Interval(); ok { + _spec.SetField(buildtask.FieldInterval, field.TypeInt, value) + } + if value, ok := btuo.mutation.AddedInterval(); ok { + _spec.AddField(buildtask.FieldInterval, field.TypeInt, value) + } + if value, ok := btuo.mutation.TransportType(); ok { + _spec.SetField(buildtask.FieldTransportType, field.TypeEnum, value) + } + if value, ok := btuo.mutation.Extra(); ok { + _spec.SetField(buildtask.FieldExtra, field.TypeString, value) + } + if btuo.mutation.ExtraCleared() { + _spec.ClearField(buildtask.FieldExtra, field.TypeString) + } + if value, ok := btuo.mutation.ClaimedAt(); ok { + _spec.SetField(buildtask.FieldClaimedAt, field.TypeTime, value) + } + if btuo.mutation.ClaimedAtCleared() { + _spec.ClearField(buildtask.FieldClaimedAt, field.TypeTime) + } + if value, ok := btuo.mutation.StartedAt(); ok { + _spec.SetField(buildtask.FieldStartedAt, field.TypeTime, value) + } + if btuo.mutation.StartedAtCleared() { + _spec.ClearField(buildtask.FieldStartedAt, field.TypeTime) + } + if value, ok := btuo.mutation.FinishedAt(); ok { + _spec.SetField(buildtask.FieldFinishedAt, field.TypeTime, value) + } + if btuo.mutation.FinishedAtCleared() { + _spec.ClearField(buildtask.FieldFinishedAt, field.TypeTime) + } + if value, ok := btuo.mutation.Output(); ok { + _spec.SetField(buildtask.FieldOutput, field.TypeString, value) + } + if btuo.mutation.OutputCleared() { + _spec.ClearField(buildtask.FieldOutput, field.TypeString) + } + if value, ok := btuo.mutation.OutputSize(); ok { + _spec.SetField(buildtask.FieldOutputSize, field.TypeInt, value) + } + if value, ok := btuo.mutation.AddedOutputSize(); ok { + _spec.AddField(buildtask.FieldOutputSize, field.TypeInt, value) + } + if value, ok := btuo.mutation.Error(); ok { + _spec.SetField(buildtask.FieldError, field.TypeString, value) + } + if btuo.mutation.ErrorCleared() { + _spec.ClearField(buildtask.FieldError, field.TypeString) + } + if value, ok := btuo.mutation.ErrorSize(); ok { + _spec.SetField(buildtask.FieldErrorSize, field.TypeInt, value) + } + if value, ok := btuo.mutation.AddedErrorSize(); ok { + _spec.AddField(buildtask.FieldErrorSize, field.TypeInt, value) + } + if value, ok := btuo.mutation.ExitCode(); ok { + _spec.SetField(buildtask.FieldExitCode, field.TypeInt, value) + } + if value, ok := btuo.mutation.AddedExitCode(); ok { + _spec.AddField(buildtask.FieldExitCode, field.TypeInt, value) + } + if btuo.mutation.ExitCodeCleared() { + _spec.ClearField(buildtask.FieldExitCode, field.TypeInt) + } + if value, ok := btuo.mutation.ArtifactPath(); ok { + _spec.SetField(buildtask.FieldArtifactPath, field.TypeString, value) + } + if btuo.mutation.ArtifactPathCleared() { + _spec.ClearField(buildtask.FieldArtifactPath, field.TypeString) + } + if btuo.mutation.BuilderCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.BuilderTable, + Columns: []string{buildtask.BuilderColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(builder.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := btuo.mutation.BuilderIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.BuilderTable, + Columns: []string{buildtask.BuilderColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(builder.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if btuo.mutation.ArtifactCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.ArtifactTable, + Columns: []string{buildtask.ArtifactColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := btuo.mutation.ArtifactIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: buildtask.ArtifactTable, + Columns: []string{buildtask.ArtifactColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + _node = &BuildTask{config: btuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues + if err = sqlgraph.UpdateNode(ctx, btuo.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{buildtask.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + btuo.mutation.done = true + return _node, nil +} diff --git a/tavern/internal/ent/client.go b/tavern/internal/ent/client.go index e0db6a50b..fc8a9e5b2 100644 --- a/tavern/internal/ent/client.go +++ b/tavern/internal/ent/client.go @@ -18,6 +18,7 @@ import ( "realm.pub/tavern/internal/ent/asset" "realm.pub/tavern/internal/ent/beacon" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/host" "realm.pub/tavern/internal/ent/hostcredential" "realm.pub/tavern/internal/ent/hostfile" @@ -42,6 +43,8 @@ type Client struct { Asset *AssetClient // Beacon is the client for interacting with the Beacon builders. Beacon *BeaconClient + // BuildTask is the client for interacting with the BuildTask builders. + BuildTask *BuildTaskClient // Builder is the client for interacting with the Builder builders. Builder *BuilderClient // Host is the client for interacting with the Host builders. @@ -85,6 +88,7 @@ func (c *Client) init() { c.Schema = migrate.NewSchema(c.driver) c.Asset = NewAssetClient(c.config) c.Beacon = NewBeaconClient(c.config) + c.BuildTask = NewBuildTaskClient(c.config) c.Builder = NewBuilderClient(c.config) c.Host = NewHostClient(c.config) c.HostCredential = NewHostCredentialClient(c.config) @@ -193,6 +197,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { config: cfg, Asset: NewAssetClient(cfg), Beacon: NewBeaconClient(cfg), + BuildTask: NewBuildTaskClient(cfg), Builder: NewBuilderClient(cfg), Host: NewHostClient(cfg), HostCredential: NewHostCredentialClient(cfg), @@ -228,6 +233,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) config: cfg, Asset: NewAssetClient(cfg), Beacon: NewBeaconClient(cfg), + BuildTask: NewBuildTaskClient(cfg), Builder: NewBuilderClient(cfg), Host: NewHostClient(cfg), HostCredential: NewHostCredentialClient(cfg), @@ -271,7 +277,7 @@ func (c *Client) Close() error { // In order to add hooks to a specific client, call: `client.Node.Use(...)`. func (c *Client) Use(hooks ...Hook) { for _, n := range []interface{ Use(...Hook) }{ - c.Asset, c.Beacon, c.Builder, c.Host, c.HostCredential, c.HostFile, + c.Asset, c.Beacon, c.BuildTask, c.Builder, c.Host, c.HostCredential, c.HostFile, c.HostProcess, c.Link, c.Portal, c.Quest, c.Repository, c.Shell, c.Tag, c.Task, c.Tome, c.User, } { @@ -283,7 +289,7 @@ func (c *Client) Use(hooks ...Hook) { // In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`. func (c *Client) Intercept(interceptors ...Interceptor) { for _, n := range []interface{ Intercept(...Interceptor) }{ - c.Asset, c.Beacon, c.Builder, c.Host, c.HostCredential, c.HostFile, + c.Asset, c.Beacon, c.BuildTask, c.Builder, c.Host, c.HostCredential, c.HostFile, c.HostProcess, c.Link, c.Portal, c.Quest, c.Repository, c.Shell, c.Tag, c.Task, c.Tome, c.User, } { @@ -298,6 +304,8 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { return c.Asset.mutate(ctx, m) case *BeaconMutation: return c.Beacon.mutate(ctx, m) + case *BuildTaskMutation: + return c.BuildTask.mutate(ctx, m) case *BuilderMutation: return c.Builder.mutate(ctx, m) case *HostMutation: @@ -694,6 +702,172 @@ func (c *BeaconClient) mutate(ctx context.Context, m *BeaconMutation) (Value, er } } +// BuildTaskClient is a client for the BuildTask schema. +type BuildTaskClient struct { + config +} + +// NewBuildTaskClient returns a client for the BuildTask from the given config. +func NewBuildTaskClient(c config) *BuildTaskClient { + return &BuildTaskClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `buildtask.Hooks(f(g(h())))`. +func (c *BuildTaskClient) Use(hooks ...Hook) { + c.hooks.BuildTask = append(c.hooks.BuildTask, hooks...) +} + +// Intercept adds a list of query interceptors to the interceptors stack. +// A call to `Intercept(f, g, h)` equals to `buildtask.Intercept(f(g(h())))`. +func (c *BuildTaskClient) Intercept(interceptors ...Interceptor) { + c.inters.BuildTask = append(c.inters.BuildTask, interceptors...) +} + +// Create returns a builder for creating a BuildTask entity. +func (c *BuildTaskClient) Create() *BuildTaskCreate { + mutation := newBuildTaskMutation(c.config, OpCreate) + return &BuildTaskCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// CreateBulk returns a builder for creating a bulk of BuildTask entities. +func (c *BuildTaskClient) CreateBulk(builders ...*BuildTaskCreate) *BuildTaskCreateBulk { + return &BuildTaskCreateBulk{config: c.config, builders: builders} +} + +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *BuildTaskClient) MapCreateBulk(slice any, setFunc func(*BuildTaskCreate, int)) *BuildTaskCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &BuildTaskCreateBulk{err: fmt.Errorf("calling to BuildTaskClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*BuildTaskCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &BuildTaskCreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for BuildTask. +func (c *BuildTaskClient) Update() *BuildTaskUpdate { + mutation := newBuildTaskMutation(c.config, OpUpdate) + return &BuildTaskUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *BuildTaskClient) UpdateOne(bt *BuildTask) *BuildTaskUpdateOne { + mutation := newBuildTaskMutation(c.config, OpUpdateOne, withBuildTask(bt)) + return &BuildTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *BuildTaskClient) UpdateOneID(id int) *BuildTaskUpdateOne { + mutation := newBuildTaskMutation(c.config, OpUpdateOne, withBuildTaskID(id)) + return &BuildTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for BuildTask. +func (c *BuildTaskClient) Delete() *BuildTaskDelete { + mutation := newBuildTaskMutation(c.config, OpDelete) + return &BuildTaskDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a builder for deleting the given entity. +func (c *BuildTaskClient) DeleteOne(bt *BuildTask) *BuildTaskDeleteOne { + return c.DeleteOneID(bt.ID) +} + +// DeleteOneID returns a builder for deleting the given entity by its id. +func (c *BuildTaskClient) DeleteOneID(id int) *BuildTaskDeleteOne { + builder := c.Delete().Where(buildtask.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &BuildTaskDeleteOne{builder} +} + +// Query returns a query builder for BuildTask. +func (c *BuildTaskClient) Query() *BuildTaskQuery { + return &BuildTaskQuery{ + config: c.config, + ctx: &QueryContext{Type: TypeBuildTask}, + inters: c.Interceptors(), + } +} + +// Get returns a BuildTask entity by its id. +func (c *BuildTaskClient) Get(ctx context.Context, id int) (*BuildTask, error) { + return c.Query().Where(buildtask.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *BuildTaskClient) GetX(ctx context.Context, id int) *BuildTask { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// QueryBuilder queries the builder edge of a BuildTask. +func (c *BuildTaskClient) QueryBuilder(bt *BuildTask) *BuilderQuery { + query := (&BuilderClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := bt.ID + step := sqlgraph.NewStep( + sqlgraph.From(buildtask.Table, buildtask.FieldID, id), + sqlgraph.To(builder.Table, builder.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, buildtask.BuilderTable, buildtask.BuilderColumn), + ) + fromV = sqlgraph.Neighbors(bt.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryArtifact queries the artifact edge of a BuildTask. +func (c *BuildTaskClient) QueryArtifact(bt *BuildTask) *AssetQuery { + query := (&AssetClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := bt.ID + step := sqlgraph.NewStep( + sqlgraph.From(buildtask.Table, buildtask.FieldID, id), + sqlgraph.To(asset.Table, asset.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, buildtask.ArtifactTable, buildtask.ArtifactColumn), + ) + fromV = sqlgraph.Neighbors(bt.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// Hooks returns the client hooks. +func (c *BuildTaskClient) Hooks() []Hook { + hooks := c.hooks.BuildTask + return append(hooks[:len(hooks):len(hooks)], buildtask.Hooks[:]...) +} + +// Interceptors returns the client interceptors. +func (c *BuildTaskClient) Interceptors() []Interceptor { + return c.inters.BuildTask +} + +func (c *BuildTaskClient) mutate(ctx context.Context, m *BuildTaskMutation) (Value, error) { + switch m.Op() { + case OpCreate: + return (&BuildTaskCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdate: + return (&BuildTaskUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdateOne: + return (&BuildTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpDelete, OpDeleteOne: + return (&BuildTaskDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) + default: + return nil, fmt.Errorf("ent: unknown BuildTask mutation op: %q", m.Op()) + } +} + // BuilderClient is a client for the Builder schema. type BuilderClient struct { config @@ -802,6 +976,22 @@ func (c *BuilderClient) GetX(ctx context.Context, id int) *Builder { return obj } +// QueryBuildTasks queries the build_tasks edge of a Builder. +func (c *BuilderClient) QueryBuildTasks(b *Builder) *BuildTaskQuery { + query := (&BuildTaskClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := b.ID + step := sqlgraph.NewStep( + sqlgraph.From(builder.Table, builder.FieldID, id), + sqlgraph.To(buildtask.Table, buildtask.FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, builder.BuildTasksTable, builder.BuildTasksColumn), + ) + fromV = sqlgraph.Neighbors(b.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *BuilderClient) Hooks() []Hook { return c.hooks.Builder @@ -3203,11 +3393,11 @@ func (c *UserClient) mutate(ctx context.Context, m *UserMutation) (Value, error) // hooks and interceptors per client, for fast access. type ( hooks struct { - Asset, Beacon, Builder, Host, HostCredential, HostFile, HostProcess, Link, - Portal, Quest, Repository, Shell, Tag, Task, Tome, User []ent.Hook + Asset, Beacon, BuildTask, Builder, Host, HostCredential, HostFile, HostProcess, + Link, Portal, Quest, Repository, Shell, Tag, Task, Tome, User []ent.Hook } inters struct { - Asset, Beacon, Builder, Host, HostCredential, HostFile, HostProcess, Link, - Portal, Quest, Repository, Shell, Tag, Task, Tome, User []ent.Interceptor + Asset, Beacon, BuildTask, Builder, Host, HostCredential, HostFile, HostProcess, + Link, Portal, Quest, Repository, Shell, Tag, Task, Tome, User []ent.Interceptor } ) diff --git a/tavern/internal/ent/ent.go b/tavern/internal/ent/ent.go index b3c89e42e..366ea66e3 100644 --- a/tavern/internal/ent/ent.go +++ b/tavern/internal/ent/ent.go @@ -15,6 +15,7 @@ import ( "realm.pub/tavern/internal/ent/asset" "realm.pub/tavern/internal/ent/beacon" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/host" "realm.pub/tavern/internal/ent/hostcredential" "realm.pub/tavern/internal/ent/hostfile" @@ -90,6 +91,7 @@ func checkColumn(table, column string) error { columnCheck = sql.NewColumnCheck(map[string]func(string) bool{ asset.Table: asset.ValidColumn, beacon.Table: beacon.ValidColumn, + buildtask.Table: buildtask.ValidColumn, builder.Table: builder.ValidColumn, host.Table: host.ValidColumn, hostcredential.Table: hostcredential.ValidColumn, diff --git a/tavern/internal/ent/gql_collection.go b/tavern/internal/ent/gql_collection.go index 4b54f9dc5..ba6a8cce7 100644 --- a/tavern/internal/ent/gql_collection.go +++ b/tavern/internal/ent/gql_collection.go @@ -13,6 +13,7 @@ import ( "realm.pub/tavern/internal/ent/asset" "realm.pub/tavern/internal/ent/beacon" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/host" "realm.pub/tavern/internal/ent/hostcredential" "realm.pub/tavern/internal/ent/hostfile" @@ -665,6 +666,213 @@ func newBeaconPaginateArgs(rv map[string]any) *beaconPaginateArgs { return args } +// CollectFields tells the query-builder to eagerly load connected nodes by resolver context. +func (bt *BuildTaskQuery) CollectFields(ctx context.Context, satisfies ...string) (*BuildTaskQuery, error) { + fc := graphql.GetFieldContext(ctx) + if fc == nil { + return bt, nil + } + if err := bt.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { + return nil, err + } + return bt, nil +} + +func (bt *BuildTaskQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { + path = append([]string(nil), path...) + var ( + unknownSeen bool + fieldSeen = make(map[string]struct{}, len(buildtask.Columns)) + selectedFields = []string{buildtask.FieldID} + ) + for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { + switch field.Name { + + case "builder": + var ( + alias = field.Alias + path = append(path, alias) + query = (&BuilderClient{config: bt.config}).Query() + ) + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, builderImplementors)...); err != nil { + return err + } + bt.withBuilder = query + + case "artifact": + var ( + alias = field.Alias + path = append(path, alias) + query = (&AssetClient{config: bt.config}).Query() + ) + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, assetImplementors)...); err != nil { + return err + } + bt.withArtifact = query + case "createdAt": + if _, ok := fieldSeen[buildtask.FieldCreatedAt]; !ok { + selectedFields = append(selectedFields, buildtask.FieldCreatedAt) + fieldSeen[buildtask.FieldCreatedAt] = struct{}{} + } + case "lastModifiedAt": + if _, ok := fieldSeen[buildtask.FieldLastModifiedAt]; !ok { + selectedFields = append(selectedFields, buildtask.FieldLastModifiedAt) + fieldSeen[buildtask.FieldLastModifiedAt] = struct{}{} + } + case "targetOs": + if _, ok := fieldSeen[buildtask.FieldTargetOs]; !ok { + selectedFields = append(selectedFields, buildtask.FieldTargetOs) + fieldSeen[buildtask.FieldTargetOs] = struct{}{} + } + case "targetFormat": + if _, ok := fieldSeen[buildtask.FieldTargetFormat]; !ok { + selectedFields = append(selectedFields, buildtask.FieldTargetFormat) + fieldSeen[buildtask.FieldTargetFormat] = struct{}{} + } + case "buildImage": + if _, ok := fieldSeen[buildtask.FieldBuildImage]; !ok { + selectedFields = append(selectedFields, buildtask.FieldBuildImage) + fieldSeen[buildtask.FieldBuildImage] = struct{}{} + } + case "buildScript": + if _, ok := fieldSeen[buildtask.FieldBuildScript]; !ok { + selectedFields = append(selectedFields, buildtask.FieldBuildScript) + fieldSeen[buildtask.FieldBuildScript] = struct{}{} + } + case "callbackURI": + if _, ok := fieldSeen[buildtask.FieldCallbackURI]; !ok { + selectedFields = append(selectedFields, buildtask.FieldCallbackURI) + fieldSeen[buildtask.FieldCallbackURI] = struct{}{} + } + case "interval": + if _, ok := fieldSeen[buildtask.FieldInterval]; !ok { + selectedFields = append(selectedFields, buildtask.FieldInterval) + fieldSeen[buildtask.FieldInterval] = struct{}{} + } + case "transportType": + if _, ok := fieldSeen[buildtask.FieldTransportType]; !ok { + selectedFields = append(selectedFields, buildtask.FieldTransportType) + fieldSeen[buildtask.FieldTransportType] = struct{}{} + } + case "extra": + if _, ok := fieldSeen[buildtask.FieldExtra]; !ok { + selectedFields = append(selectedFields, buildtask.FieldExtra) + fieldSeen[buildtask.FieldExtra] = struct{}{} + } + case "claimedAt": + if _, ok := fieldSeen[buildtask.FieldClaimedAt]; !ok { + selectedFields = append(selectedFields, buildtask.FieldClaimedAt) + fieldSeen[buildtask.FieldClaimedAt] = struct{}{} + } + case "startedAt": + if _, ok := fieldSeen[buildtask.FieldStartedAt]; !ok { + selectedFields = append(selectedFields, buildtask.FieldStartedAt) + fieldSeen[buildtask.FieldStartedAt] = struct{}{} + } + case "finishedAt": + if _, ok := fieldSeen[buildtask.FieldFinishedAt]; !ok { + selectedFields = append(selectedFields, buildtask.FieldFinishedAt) + fieldSeen[buildtask.FieldFinishedAt] = struct{}{} + } + case "output": + if _, ok := fieldSeen[buildtask.FieldOutput]; !ok { + selectedFields = append(selectedFields, buildtask.FieldOutput) + fieldSeen[buildtask.FieldOutput] = struct{}{} + } + case "outputSize": + if _, ok := fieldSeen[buildtask.FieldOutputSize]; !ok { + selectedFields = append(selectedFields, buildtask.FieldOutputSize) + fieldSeen[buildtask.FieldOutputSize] = struct{}{} + } + case "error": + if _, ok := fieldSeen[buildtask.FieldError]; !ok { + selectedFields = append(selectedFields, buildtask.FieldError) + fieldSeen[buildtask.FieldError] = struct{}{} + } + case "errorSize": + if _, ok := fieldSeen[buildtask.FieldErrorSize]; !ok { + selectedFields = append(selectedFields, buildtask.FieldErrorSize) + fieldSeen[buildtask.FieldErrorSize] = struct{}{} + } + case "exitCode": + if _, ok := fieldSeen[buildtask.FieldExitCode]; !ok { + selectedFields = append(selectedFields, buildtask.FieldExitCode) + fieldSeen[buildtask.FieldExitCode] = struct{}{} + } + case "artifactPath": + if _, ok := fieldSeen[buildtask.FieldArtifactPath]; !ok { + selectedFields = append(selectedFields, buildtask.FieldArtifactPath) + fieldSeen[buildtask.FieldArtifactPath] = struct{}{} + } + case "id": + case "__typename": + default: + unknownSeen = true + } + } + if !unknownSeen { + bt.Select(selectedFields...) + } + return nil +} + +type buildtaskPaginateArgs struct { + first, last *int + after, before *Cursor + opts []BuildTaskPaginateOption +} + +func newBuildTaskPaginateArgs(rv map[string]any) *buildtaskPaginateArgs { + args := &buildtaskPaginateArgs{} + if rv == nil { + return args + } + if v := rv[firstField]; v != nil { + args.first = v.(*int) + } + if v := rv[lastField]; v != nil { + args.last = v.(*int) + } + if v := rv[afterField]; v != nil { + args.after = v.(*Cursor) + } + if v := rv[beforeField]; v != nil { + args.before = v.(*Cursor) + } + if v, ok := rv[orderByField]; ok { + switch v := v.(type) { + case []*BuildTaskOrder: + args.opts = append(args.opts, WithBuildTaskOrder(v)) + case []any: + var orders []*BuildTaskOrder + for i := range v { + mv, ok := v[i].(map[string]any) + if !ok { + continue + } + var ( + err1, err2 error + order = &BuildTaskOrder{Field: &BuildTaskOrderField{}, Direction: entgql.OrderDirectionAsc} + ) + if d, ok := mv[directionField]; ok { + err1 = order.Direction.UnmarshalGQL(d) + } + if f, ok := mv[fieldField]; ok { + err2 = order.Field.UnmarshalGQL(f) + } + if err1 == nil && err2 == nil { + orders = append(orders, order) + } + } + args.opts = append(args.opts, WithBuildTaskOrder(orders)) + } + } + if v, ok := rv[whereField].(*BuildTaskWhereInput); ok { + args.opts = append(args.opts, WithBuildTaskFilter(v.Filter)) + } + return args +} + // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (b *BuilderQuery) CollectFields(ctx context.Context, satisfies ...string) (*BuilderQuery, error) { fc := graphql.GetFieldContext(ctx) @@ -686,6 +894,95 @@ func (b *BuilderQuery) collectField(ctx context.Context, oneNode bool, opCtx *gr ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { + + case "buildTasks": + var ( + alias = field.Alias + path = append(path, alias) + query = (&BuildTaskClient{config: b.config}).Query() + ) + args := newBuildTaskPaginateArgs(fieldArgs(ctx, new(BuildTaskWhereInput), path...)) + if err := validateFirstLast(args.first, args.last); err != nil { + return fmt.Errorf("validate first and last in path %q: %w", path, err) + } + pager, err := newBuildTaskPager(args.opts, args.last != nil) + if err != nil { + return fmt.Errorf("create new pager in path %q: %w", path, err) + } + if query, err = pager.applyFilter(query); err != nil { + return err + } + ignoredEdges := !hasCollectedField(ctx, append(path, edgesField)...) + if hasCollectedField(ctx, append(path, totalCountField)...) || hasCollectedField(ctx, append(path, pageInfoField)...) { + hasPagination := args.after != nil || args.first != nil || args.before != nil || args.last != nil + if hasPagination || ignoredEdges { + query := query.Clone() + b.loadTotal = append(b.loadTotal, func(ctx context.Context, nodes []*Builder) error { + ids := make([]driver.Value, len(nodes)) + for i := range nodes { + ids[i] = nodes[i].ID + } + var v []struct { + NodeID int `sql:"build_task_builder"` + Count int `sql:"count"` + } + query.Where(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(builder.BuildTasksColumn), ids...)) + }) + if err := query.GroupBy(builder.BuildTasksColumn).Aggregate(Count()).Scan(ctx, &v); err != nil { + return err + } + m := make(map[int]int, len(v)) + for i := range v { + m[v[i].NodeID] = v[i].Count + } + for i := range nodes { + n := m[nodes[i].ID] + if nodes[i].Edges.totalCount[0] == nil { + nodes[i].Edges.totalCount[0] = make(map[string]int) + } + nodes[i].Edges.totalCount[0][alias] = n + } + return nil + }) + } else { + b.loadTotal = append(b.loadTotal, func(_ context.Context, nodes []*Builder) error { + for i := range nodes { + n := len(nodes[i].Edges.BuildTasks) + if nodes[i].Edges.totalCount[0] == nil { + nodes[i].Edges.totalCount[0] = make(map[string]int) + } + nodes[i].Edges.totalCount[0][alias] = n + } + return nil + }) + } + } + if ignoredEdges || (args.first != nil && *args.first == 0) || (args.last != nil && *args.last == 0) { + continue + } + if query, err = pager.applyCursors(query, args.after, args.before); err != nil { + return err + } + path = append(path, edgesField, nodeField) + if field := collectedField(ctx, path...); field != nil { + if err := query.collectField(ctx, false, opCtx, *field, path, mayAddCondition(satisfies, buildtaskImplementors)...); err != nil { + return err + } + } + if limit := paginateLimit(args.first, args.last); limit > 0 { + if oneNode { + pager.applyOrder(query.Limit(limit)) + } else { + modify := entgql.LimitPerRow(builder.BuildTasksColumn, limit, pager.orderExpr(query)) + query.modifiers = append(query.modifiers, modify) + } + } else { + query = pager.applyOrder(query) + } + b.WithNamedBuildTasks(alias, func(wq *BuildTaskQuery) { + *wq = *query + }) case "createdAt": if _, ok := fieldSeen[builder.FieldCreatedAt]; !ok { selectedFields = append(selectedFields, builder.FieldCreatedAt) @@ -711,6 +1008,11 @@ func (b *BuilderQuery) collectField(ctx context.Context, oneNode bool, opCtx *gr selectedFields = append(selectedFields, builder.FieldUpstream) fieldSeen[builder.FieldUpstream] = struct{}{} } + case "lastSeenAt": + if _, ok := fieldSeen[builder.FieldLastSeenAt]; !ok { + selectedFields = append(selectedFields, builder.FieldLastSeenAt) + fieldSeen[builder.FieldLastSeenAt] = struct{}{} + } case "id": case "__typename": default: diff --git a/tavern/internal/ent/gql_edge.go b/tavern/internal/ent/gql_edge.go index cd4c63083..878089783 100644 --- a/tavern/internal/ent/gql_edge.go +++ b/tavern/internal/ent/gql_edge.go @@ -108,6 +108,43 @@ func (b *Beacon) Shells( return b.QueryShells().Paginate(ctx, after, first, before, last, opts...) } +func (bt *BuildTask) Builder(ctx context.Context) (*Builder, error) { + result, err := bt.Edges.BuilderOrErr() + if IsNotLoaded(err) { + result, err = bt.QueryBuilder().Only(ctx) + } + return result, err +} + +func (bt *BuildTask) Artifact(ctx context.Context) (*Asset, error) { + result, err := bt.Edges.ArtifactOrErr() + if IsNotLoaded(err) { + result, err = bt.QueryArtifact().Only(ctx) + } + return result, MaskNotFound(err) +} + +func (b *Builder) BuildTasks( + ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, orderBy []*BuildTaskOrder, where *BuildTaskWhereInput, +) (*BuildTaskConnection, error) { + opts := []BuildTaskPaginateOption{ + WithBuildTaskOrder(orderBy), + WithBuildTaskFilter(where.Filter), + } + alias := graphql.GetFieldContext(ctx).Field.Alias + totalCount, hasTotalCount := b.Edges.totalCount[0][alias] + if nodes, err := b.NamedBuildTasks(alias); err == nil || hasTotalCount { + pager, err := newBuildTaskPager(opts, last != nil) + if err != nil { + return nil, err + } + conn := &BuildTaskConnection{Edges: []*BuildTaskEdge{}, TotalCount: totalCount} + conn.build(nodes, pager, after, first, before, last) + return conn, nil + } + return b.QueryBuildTasks().Paginate(ctx, after, first, before, last, opts...) +} + func (h *Host) Tags( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, orderBy []*TagOrder, where *TagWhereInput, ) (*TagConnection, error) { diff --git a/tavern/internal/ent/gql_mutation_input.go b/tavern/internal/ent/gql_mutation_input.go index 13b2bcf7a..5dcc8aa46 100644 --- a/tavern/internal/ent/gql_mutation_input.go +++ b/tavern/internal/ent/gql_mutation_input.go @@ -43,6 +43,7 @@ func (c *BeaconUpdateOne) SetInput(i UpdateBeaconInput) *BeaconUpdateOne { type CreateBuilderInput struct { SupportedTargets []c2pb.Host_Platform Upstream string + BuildTaskIDs []int } // Mutate applies the CreateBuilderInput on the BuilderMutation builder. @@ -51,6 +52,9 @@ func (i *CreateBuilderInput) Mutate(m *BuilderMutation) { m.SetSupportedTargets(v) } m.SetUpstream(i.Upstream) + if v := i.BuildTaskIDs; len(v) > 0 { + m.AddBuildTaskIDs(v...) + } } // SetInput applies the change-set in the CreateBuilderInput on the BuilderCreate builder. diff --git a/tavern/internal/ent/gql_node.go b/tavern/internal/ent/gql_node.go index 1e4248275..db841ccc5 100644 --- a/tavern/internal/ent/gql_node.go +++ b/tavern/internal/ent/gql_node.go @@ -18,6 +18,7 @@ import ( "realm.pub/tavern/internal/ent/asset" "realm.pub/tavern/internal/ent/beacon" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/host" "realm.pub/tavern/internal/ent/hostcredential" "realm.pub/tavern/internal/ent/hostfile" @@ -48,6 +49,11 @@ var beaconImplementors = []string{"Beacon", "Node"} // IsNode implements the Node interface check for GQLGen. func (*Beacon) IsNode() {} +var buildtaskImplementors = []string{"BuildTask", "Node"} + +// IsNode implements the Node interface check for GQLGen. +func (*BuildTask) IsNode() {} + var builderImplementors = []string{"Builder", "Node"} // IsNode implements the Node interface check for GQLGen. @@ -194,6 +200,15 @@ func (c *Client) noder(ctx context.Context, table string, id int) (Noder, error) } } return query.Only(ctx) + case buildtask.Table: + query := c.BuildTask.Query(). + Where(buildtask.ID(id)) + if fc := graphql.GetFieldContext(ctx); fc != nil { + if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, buildtaskImplementors...); err != nil { + return nil, err + } + } + return query.Only(ctx) case builder.Table: query := c.Builder.Query(). Where(builder.ID(id)) @@ -425,6 +440,22 @@ func (c *Client) noders(ctx context.Context, table string, ids []int) ([]Noder, *noder = node } } + case buildtask.Table: + query := c.BuildTask.Query(). + Where(buildtask.IDIn(ids...)) + query, err := query.CollectFields(ctx, buildtaskImplementors...) + if err != nil { + return nil, err + } + nodes, err := query.All(ctx) + if err != nil { + return nil, err + } + for _, node := range nodes { + for _, noder := range idmap[node.ID] { + *noder = node + } + } case builder.Table: query := c.Builder.Query(). Where(builder.IDIn(ids...)) diff --git a/tavern/internal/ent/gql_pagination.go b/tavern/internal/ent/gql_pagination.go index 96107fe76..dfa0c413e 100644 --- a/tavern/internal/ent/gql_pagination.go +++ b/tavern/internal/ent/gql_pagination.go @@ -18,6 +18,7 @@ import ( "realm.pub/tavern/internal/ent/asset" "realm.pub/tavern/internal/ent/beacon" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/host" "realm.pub/tavern/internal/ent/hostcredential" "realm.pub/tavern/internal/ent/hostfile" @@ -903,6 +904,482 @@ func (b *Beacon) ToEdge(order *BeaconOrder) *BeaconEdge { } } +// BuildTaskEdge is the edge representation of BuildTask. +type BuildTaskEdge struct { + Node *BuildTask `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// BuildTaskConnection is the connection containing edges to BuildTask. +type BuildTaskConnection struct { + Edges []*BuildTaskEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} + +func (c *BuildTaskConnection) build(nodes []*BuildTask, pager *buildtaskPager, after *Cursor, first *int, before *Cursor, last *int) { + c.PageInfo.HasNextPage = before != nil + c.PageInfo.HasPreviousPage = after != nil + if first != nil && *first+1 == len(nodes) { + c.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && *last+1 == len(nodes) { + c.PageInfo.HasPreviousPage = true + nodes = nodes[:len(nodes)-1] + } + var nodeAt func(int) *BuildTask + if last != nil { + n := len(nodes) - 1 + nodeAt = func(i int) *BuildTask { + return nodes[n-i] + } + } else { + nodeAt = func(i int) *BuildTask { + return nodes[i] + } + } + c.Edges = make([]*BuildTaskEdge, len(nodes)) + for i := range nodes { + node := nodeAt(i) + c.Edges[i] = &BuildTaskEdge{ + Node: node, + Cursor: pager.toCursor(node), + } + } + if l := len(c.Edges); l > 0 { + c.PageInfo.StartCursor = &c.Edges[0].Cursor + c.PageInfo.EndCursor = &c.Edges[l-1].Cursor + } + if c.TotalCount == 0 { + c.TotalCount = len(nodes) + } +} + +// BuildTaskPaginateOption enables pagination customization. +type BuildTaskPaginateOption func(*buildtaskPager) error + +// WithBuildTaskOrder configures pagination ordering. +func WithBuildTaskOrder(order []*BuildTaskOrder) BuildTaskPaginateOption { + return func(pager *buildtaskPager) error { + for _, o := range order { + if err := o.Direction.Validate(); err != nil { + return err + } + } + pager.order = append(pager.order, order...) + return nil + } +} + +// WithBuildTaskFilter configures pagination filter. +func WithBuildTaskFilter(filter func(*BuildTaskQuery) (*BuildTaskQuery, error)) BuildTaskPaginateOption { + return func(pager *buildtaskPager) error { + if filter == nil { + return errors.New("BuildTaskQuery filter cannot be nil") + } + pager.filter = filter + return nil + } +} + +type buildtaskPager struct { + reverse bool + order []*BuildTaskOrder + filter func(*BuildTaskQuery) (*BuildTaskQuery, error) +} + +func newBuildTaskPager(opts []BuildTaskPaginateOption, reverse bool) (*buildtaskPager, error) { + pager := &buildtaskPager{reverse: reverse} + for _, opt := range opts { + if err := opt(pager); err != nil { + return nil, err + } + } + for i, o := range pager.order { + if i > 0 && o.Field == pager.order[i-1].Field { + return nil, fmt.Errorf("duplicate order direction %q", o.Direction) + } + } + return pager, nil +} + +func (p *buildtaskPager) applyFilter(query *BuildTaskQuery) (*BuildTaskQuery, error) { + if p.filter != nil { + return p.filter(query) + } + return query, nil +} + +func (p *buildtaskPager) toCursor(bt *BuildTask) Cursor { + cs_ := make([]any, 0, len(p.order)) + for _, o_ := range p.order { + cs_ = append(cs_, o_.Field.toCursor(bt).Value) + } + return Cursor{ID: bt.ID, Value: cs_} +} + +func (p *buildtaskPager) applyCursors(query *BuildTaskQuery, after, before *Cursor) (*BuildTaskQuery, error) { + idDirection := entgql.OrderDirectionAsc + if p.reverse { + idDirection = entgql.OrderDirectionDesc + } + fields, directions := make([]string, 0, len(p.order)), make([]OrderDirection, 0, len(p.order)) + for _, o := range p.order { + fields = append(fields, o.Field.column) + direction := o.Direction + if p.reverse { + direction = direction.Reverse() + } + directions = append(directions, direction) + } + predicates, err := entgql.MultiCursorsPredicate(after, before, &entgql.MultiCursorsOptions{ + FieldID: DefaultBuildTaskOrder.Field.column, + DirectionID: idDirection, + Fields: fields, + Directions: directions, + }) + if err != nil { + return nil, err + } + for _, predicate := range predicates { + query = query.Where(predicate) + } + return query, nil +} + +func (p *buildtaskPager) applyOrder(query *BuildTaskQuery) *BuildTaskQuery { + var defaultOrdered bool + for _, o := range p.order { + direction := o.Direction + if p.reverse { + direction = direction.Reverse() + } + query = query.Order(o.Field.toTerm(direction.OrderTermOption())) + if o.Field.column == DefaultBuildTaskOrder.Field.column { + defaultOrdered = true + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(o.Field.column) + } + } + if !defaultOrdered { + direction := entgql.OrderDirectionAsc + if p.reverse { + direction = direction.Reverse() + } + query = query.Order(DefaultBuildTaskOrder.Field.toTerm(direction.OrderTermOption())) + } + return query +} + +func (p *buildtaskPager) orderExpr(query *BuildTaskQuery) sql.Querier { + if len(query.ctx.Fields) > 0 { + for _, o := range p.order { + query.ctx.AppendFieldOnce(o.Field.column) + } + } + return sql.ExprFunc(func(b *sql.Builder) { + for _, o := range p.order { + direction := o.Direction + if p.reverse { + direction = direction.Reverse() + } + b.Ident(o.Field.column).Pad().WriteString(string(direction)) + b.Comma() + } + direction := entgql.OrderDirectionAsc + if p.reverse { + direction = direction.Reverse() + } + b.Ident(DefaultBuildTaskOrder.Field.column).Pad().WriteString(string(direction)) + }) +} + +// Paginate executes the query and returns a relay based cursor connection to BuildTask. +func (bt *BuildTaskQuery) Paginate( + ctx context.Context, after *Cursor, first *int, + before *Cursor, last *int, opts ...BuildTaskPaginateOption, +) (*BuildTaskConnection, error) { + if err := validateFirstLast(first, last); err != nil { + return nil, err + } + pager, err := newBuildTaskPager(opts, last != nil) + if err != nil { + return nil, err + } + if bt, err = pager.applyFilter(bt); err != nil { + return nil, err + } + conn := &BuildTaskConnection{Edges: []*BuildTaskEdge{}} + ignoredEdges := !hasCollectedField(ctx, edgesField) + if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { + hasPagination := after != nil || first != nil || before != nil || last != nil + if hasPagination || ignoredEdges { + c := bt.Clone() + c.ctx.Fields = nil + if conn.TotalCount, err = c.Count(ctx); err != nil { + return nil, err + } + conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 + conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 + } + } + if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { + return conn, nil + } + if bt, err = pager.applyCursors(bt, after, before); err != nil { + return nil, err + } + limit := paginateLimit(first, last) + if limit != 0 { + bt.Limit(limit) + } + if field := collectedField(ctx, edgesField, nodeField); field != nil { + if err := bt.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { + return nil, err + } + } + bt = pager.applyOrder(bt) + nodes, err := bt.All(ctx) + if err != nil { + return nil, err + } + conn.build(nodes, pager, after, first, before, last) + return conn, nil +} + +var ( + // BuildTaskOrderFieldCreatedAt orders BuildTask by created_at. + BuildTaskOrderFieldCreatedAt = &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.CreatedAt, nil + }, + column: buildtask.FieldCreatedAt, + toTerm: buildtask.ByCreatedAt, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ + ID: bt.ID, + Value: bt.CreatedAt, + } + }, + } + // BuildTaskOrderFieldLastModifiedAt orders BuildTask by last_modified_at. + BuildTaskOrderFieldLastModifiedAt = &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.LastModifiedAt, nil + }, + column: buildtask.FieldLastModifiedAt, + toTerm: buildtask.ByLastModifiedAt, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ + ID: bt.ID, + Value: bt.LastModifiedAt, + } + }, + } + // BuildTaskOrderFieldTargetOs orders BuildTask by target_os. + BuildTaskOrderFieldTargetOs = &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.TargetOs, nil + }, + column: buildtask.FieldTargetOs, + toTerm: buildtask.ByTargetOs, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ + ID: bt.ID, + Value: bt.TargetOs, + } + }, + } + // BuildTaskOrderFieldClaimedAt orders BuildTask by claimed_at. + BuildTaskOrderFieldClaimedAt = &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.ClaimedAt, nil + }, + column: buildtask.FieldClaimedAt, + toTerm: buildtask.ByClaimedAt, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ + ID: bt.ID, + Value: bt.ClaimedAt, + } + }, + } + // BuildTaskOrderFieldStartedAt orders BuildTask by started_at. + BuildTaskOrderFieldStartedAt = &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.StartedAt, nil + }, + column: buildtask.FieldStartedAt, + toTerm: buildtask.ByStartedAt, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ + ID: bt.ID, + Value: bt.StartedAt, + } + }, + } + // BuildTaskOrderFieldFinishedAt orders BuildTask by finished_at. + BuildTaskOrderFieldFinishedAt = &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.FinishedAt, nil + }, + column: buildtask.FieldFinishedAt, + toTerm: buildtask.ByFinishedAt, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ + ID: bt.ID, + Value: bt.FinishedAt, + } + }, + } + // BuildTaskOrderFieldOutputSize orders BuildTask by output_size. + BuildTaskOrderFieldOutputSize = &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.OutputSize, nil + }, + column: buildtask.FieldOutputSize, + toTerm: buildtask.ByOutputSize, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ + ID: bt.ID, + Value: bt.OutputSize, + } + }, + } + // BuildTaskOrderFieldErrorSize orders BuildTask by error_size. + BuildTaskOrderFieldErrorSize = &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.ErrorSize, nil + }, + column: buildtask.FieldErrorSize, + toTerm: buildtask.ByErrorSize, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ + ID: bt.ID, + Value: bt.ErrorSize, + } + }, + } + // BuildTaskOrderFieldExitCode orders BuildTask by exit_code. + BuildTaskOrderFieldExitCode = &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.ExitCode, nil + }, + column: buildtask.FieldExitCode, + toTerm: buildtask.ByExitCode, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ + ID: bt.ID, + Value: bt.ExitCode, + } + }, + } +) + +// String implement fmt.Stringer interface. +func (f BuildTaskOrderField) String() string { + var str string + switch f.column { + case BuildTaskOrderFieldCreatedAt.column: + str = "CREATED_AT" + case BuildTaskOrderFieldLastModifiedAt.column: + str = "LAST_MODIFIED_AT" + case BuildTaskOrderFieldTargetOs.column: + str = "TARGET_OS" + case BuildTaskOrderFieldClaimedAt.column: + str = "CLAIMED_AT" + case BuildTaskOrderFieldStartedAt.column: + str = "STARTED_AT" + case BuildTaskOrderFieldFinishedAt.column: + str = "FINISHED_AT" + case BuildTaskOrderFieldOutputSize.column: + str = "OUTPUT_SIZE" + case BuildTaskOrderFieldErrorSize.column: + str = "ERROR_SIZE" + case BuildTaskOrderFieldExitCode.column: + str = "EXIT_CODE" + } + return str +} + +// MarshalGQL implements graphql.Marshaler interface. +func (f BuildTaskOrderField) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(f.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (f *BuildTaskOrderField) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("BuildTaskOrderField %T must be a string", v) + } + switch str { + case "CREATED_AT": + *f = *BuildTaskOrderFieldCreatedAt + case "LAST_MODIFIED_AT": + *f = *BuildTaskOrderFieldLastModifiedAt + case "TARGET_OS": + *f = *BuildTaskOrderFieldTargetOs + case "CLAIMED_AT": + *f = *BuildTaskOrderFieldClaimedAt + case "STARTED_AT": + *f = *BuildTaskOrderFieldStartedAt + case "FINISHED_AT": + *f = *BuildTaskOrderFieldFinishedAt + case "OUTPUT_SIZE": + *f = *BuildTaskOrderFieldOutputSize + case "ERROR_SIZE": + *f = *BuildTaskOrderFieldErrorSize + case "EXIT_CODE": + *f = *BuildTaskOrderFieldExitCode + default: + return fmt.Errorf("%s is not a valid BuildTaskOrderField", str) + } + return nil +} + +// BuildTaskOrderField defines the ordering field of BuildTask. +type BuildTaskOrderField struct { + // Value extracts the ordering value from the given BuildTask. + Value func(*BuildTask) (ent.Value, error) + column string // field or computed. + toTerm func(...sql.OrderTermOption) buildtask.OrderOption + toCursor func(*BuildTask) Cursor +} + +// BuildTaskOrder defines the ordering of BuildTask. +type BuildTaskOrder struct { + Direction OrderDirection `json:"direction"` + Field *BuildTaskOrderField `json:"field"` +} + +// DefaultBuildTaskOrder is the default ordering of BuildTask. +var DefaultBuildTaskOrder = &BuildTaskOrder{ + Direction: entgql.OrderDirectionAsc, + Field: &BuildTaskOrderField{ + Value: func(bt *BuildTask) (ent.Value, error) { + return bt.ID, nil + }, + column: buildtask.FieldID, + toTerm: buildtask.ByID, + toCursor: func(bt *BuildTask) Cursor { + return Cursor{ID: bt.ID} + }, + }, +} + +// ToEdge converts BuildTask into BuildTaskEdge. +func (bt *BuildTask) ToEdge(order *BuildTaskOrder) *BuildTaskEdge { + if order == nil { + order = DefaultBuildTaskOrder + } + return &BuildTaskEdge{ + Node: bt, + Cursor: order.Field.toCursor(bt), + } +} + // BuilderEdge is the edge representation of Builder. type BuilderEdge struct { Node *Builder `json:"node"` @@ -1176,6 +1653,20 @@ var ( } }, } + // BuilderOrderFieldLastSeenAt orders Builder by last_seen_at. + BuilderOrderFieldLastSeenAt = &BuilderOrderField{ + Value: func(b *Builder) (ent.Value, error) { + return b.LastSeenAt, nil + }, + column: builder.FieldLastSeenAt, + toTerm: builder.ByLastSeenAt, + toCursor: func(b *Builder) Cursor { + return Cursor{ + ID: b.ID, + Value: b.LastSeenAt, + } + }, + } ) // String implement fmt.Stringer interface. @@ -1186,6 +1677,8 @@ func (f BuilderOrderField) String() string { str = "CREATED_AT" case BuilderOrderFieldLastModifiedAt.column: str = "LAST_MODIFIED_AT" + case BuilderOrderFieldLastSeenAt.column: + str = "LAST_SEEN_AT" } return str } @@ -1206,6 +1699,8 @@ func (f *BuilderOrderField) UnmarshalGQL(v interface{}) error { *f = *BuilderOrderFieldCreatedAt case "LAST_MODIFIED_AT": *f = *BuilderOrderFieldLastModifiedAt + case "LAST_SEEN_AT": + *f = *BuilderOrderFieldLastSeenAt default: return fmt.Errorf("%s is not a valid BuilderOrderField", str) } diff --git a/tavern/internal/ent/gql_where_input.go b/tavern/internal/ent/gql_where_input.go index dc6db4529..46cd7f7d1 100644 --- a/tavern/internal/ent/gql_where_input.go +++ b/tavern/internal/ent/gql_where_input.go @@ -7,11 +7,13 @@ import ( "fmt" "time" + "realm.pub/tavern/internal/builder/builderpb" "realm.pub/tavern/internal/c2/c2pb" "realm.pub/tavern/internal/c2/epb" "realm.pub/tavern/internal/ent/asset" "realm.pub/tavern/internal/ent/beacon" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/host" "realm.pub/tavern/internal/ent/hostcredential" "realm.pub/tavern/internal/ent/hostfile" @@ -1062,6 +1064,976 @@ func (i *BeaconWhereInput) P() (predicate.Beacon, error) { } } +// BuildTaskWhereInput represents a where input for filtering BuildTask queries. +type BuildTaskWhereInput struct { + Predicates []predicate.BuildTask `json:"-"` + Not *BuildTaskWhereInput `json:"not,omitempty"` + Or []*BuildTaskWhereInput `json:"or,omitempty"` + And []*BuildTaskWhereInput `json:"and,omitempty"` + + // "id" field predicates. + ID *int `json:"id,omitempty"` + IDNEQ *int `json:"idNEQ,omitempty"` + IDIn []int `json:"idIn,omitempty"` + IDNotIn []int `json:"idNotIn,omitempty"` + IDGT *int `json:"idGT,omitempty"` + IDGTE *int `json:"idGTE,omitempty"` + IDLT *int `json:"idLT,omitempty"` + IDLTE *int `json:"idLTE,omitempty"` + + // "created_at" field predicates. + CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` + CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` + CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` + CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` + CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` + CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` + CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` + + // "last_modified_at" field predicates. + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAtNEQ *time.Time `json:"lastModifiedAtNEQ,omitempty"` + LastModifiedAtIn []time.Time `json:"lastModifiedAtIn,omitempty"` + LastModifiedAtNotIn []time.Time `json:"lastModifiedAtNotIn,omitempty"` + LastModifiedAtGT *time.Time `json:"lastModifiedAtGT,omitempty"` + LastModifiedAtGTE *time.Time `json:"lastModifiedAtGTE,omitempty"` + LastModifiedAtLT *time.Time `json:"lastModifiedAtLT,omitempty"` + LastModifiedAtLTE *time.Time `json:"lastModifiedAtLTE,omitempty"` + + // "target_os" field predicates. + TargetOs *c2pb.Host_Platform `json:"targetOs,omitempty"` + TargetOsNEQ *c2pb.Host_Platform `json:"targetOsNEQ,omitempty"` + TargetOsIn []c2pb.Host_Platform `json:"targetOsIn,omitempty"` + TargetOsNotIn []c2pb.Host_Platform `json:"targetOsNotIn,omitempty"` + + // "target_format" field predicates. + TargetFormat *builderpb.TargetFormat `json:"targetFormat,omitempty"` + TargetFormatNEQ *builderpb.TargetFormat `json:"targetFormatNEQ,omitempty"` + TargetFormatIn []builderpb.TargetFormat `json:"targetFormatIn,omitempty"` + TargetFormatNotIn []builderpb.TargetFormat `json:"targetFormatNotIn,omitempty"` + + // "build_image" field predicates. + BuildImage *string `json:"buildImage,omitempty"` + BuildImageNEQ *string `json:"buildImageNEQ,omitempty"` + BuildImageIn []string `json:"buildImageIn,omitempty"` + BuildImageNotIn []string `json:"buildImageNotIn,omitempty"` + BuildImageGT *string `json:"buildImageGT,omitempty"` + BuildImageGTE *string `json:"buildImageGTE,omitempty"` + BuildImageLT *string `json:"buildImageLT,omitempty"` + BuildImageLTE *string `json:"buildImageLTE,omitempty"` + BuildImageContains *string `json:"buildImageContains,omitempty"` + BuildImageHasPrefix *string `json:"buildImageHasPrefix,omitempty"` + BuildImageHasSuffix *string `json:"buildImageHasSuffix,omitempty"` + BuildImageEqualFold *string `json:"buildImageEqualFold,omitempty"` + BuildImageContainsFold *string `json:"buildImageContainsFold,omitempty"` + + // "build_script" field predicates. + BuildScript *string `json:"buildScript,omitempty"` + BuildScriptNEQ *string `json:"buildScriptNEQ,omitempty"` + BuildScriptIn []string `json:"buildScriptIn,omitempty"` + BuildScriptNotIn []string `json:"buildScriptNotIn,omitempty"` + BuildScriptGT *string `json:"buildScriptGT,omitempty"` + BuildScriptGTE *string `json:"buildScriptGTE,omitempty"` + BuildScriptLT *string `json:"buildScriptLT,omitempty"` + BuildScriptLTE *string `json:"buildScriptLTE,omitempty"` + BuildScriptContains *string `json:"buildScriptContains,omitempty"` + BuildScriptHasPrefix *string `json:"buildScriptHasPrefix,omitempty"` + BuildScriptHasSuffix *string `json:"buildScriptHasSuffix,omitempty"` + BuildScriptEqualFold *string `json:"buildScriptEqualFold,omitempty"` + BuildScriptContainsFold *string `json:"buildScriptContainsFold,omitempty"` + + // "callback_uri" field predicates. + CallbackURI *string `json:"callbackURI,omitempty"` + CallbackURINEQ *string `json:"callbackURINEQ,omitempty"` + CallbackURIIn []string `json:"callbackURIIn,omitempty"` + CallbackURINotIn []string `json:"callbackURINotIn,omitempty"` + CallbackURIGT *string `json:"callbackURIGT,omitempty"` + CallbackURIGTE *string `json:"callbackURIGTE,omitempty"` + CallbackURILT *string `json:"callbackURILT,omitempty"` + CallbackURILTE *string `json:"callbackURILTE,omitempty"` + CallbackURIContains *string `json:"callbackURIContains,omitempty"` + CallbackURIHasPrefix *string `json:"callbackURIHasPrefix,omitempty"` + CallbackURIHasSuffix *string `json:"callbackURIHasSuffix,omitempty"` + CallbackURIEqualFold *string `json:"callbackURIEqualFold,omitempty"` + CallbackURIContainsFold *string `json:"callbackURIContainsFold,omitempty"` + + // "interval" field predicates. + Interval *int `json:"interval,omitempty"` + IntervalNEQ *int `json:"intervalNEQ,omitempty"` + IntervalIn []int `json:"intervalIn,omitempty"` + IntervalNotIn []int `json:"intervalNotIn,omitempty"` + IntervalGT *int `json:"intervalGT,omitempty"` + IntervalGTE *int `json:"intervalGTE,omitempty"` + IntervalLT *int `json:"intervalLT,omitempty"` + IntervalLTE *int `json:"intervalLTE,omitempty"` + + // "transport_type" field predicates. + TransportType *c2pb.Transport_Type `json:"transportType,omitempty"` + TransportTypeNEQ *c2pb.Transport_Type `json:"transportTypeNEQ,omitempty"` + TransportTypeIn []c2pb.Transport_Type `json:"transportTypeIn,omitempty"` + TransportTypeNotIn []c2pb.Transport_Type `json:"transportTypeNotIn,omitempty"` + + // "extra" field predicates. + Extra *string `json:"extra,omitempty"` + ExtraNEQ *string `json:"extraNEQ,omitempty"` + ExtraIn []string `json:"extraIn,omitempty"` + ExtraNotIn []string `json:"extraNotIn,omitempty"` + ExtraGT *string `json:"extraGT,omitempty"` + ExtraGTE *string `json:"extraGTE,omitempty"` + ExtraLT *string `json:"extraLT,omitempty"` + ExtraLTE *string `json:"extraLTE,omitempty"` + ExtraContains *string `json:"extraContains,omitempty"` + ExtraHasPrefix *string `json:"extraHasPrefix,omitempty"` + ExtraHasSuffix *string `json:"extraHasSuffix,omitempty"` + ExtraIsNil bool `json:"extraIsNil,omitempty"` + ExtraNotNil bool `json:"extraNotNil,omitempty"` + ExtraEqualFold *string `json:"extraEqualFold,omitempty"` + ExtraContainsFold *string `json:"extraContainsFold,omitempty"` + + // "claimed_at" field predicates. + ClaimedAt *time.Time `json:"claimedAt,omitempty"` + ClaimedAtNEQ *time.Time `json:"claimedAtNEQ,omitempty"` + ClaimedAtIn []time.Time `json:"claimedAtIn,omitempty"` + ClaimedAtNotIn []time.Time `json:"claimedAtNotIn,omitempty"` + ClaimedAtGT *time.Time `json:"claimedAtGT,omitempty"` + ClaimedAtGTE *time.Time `json:"claimedAtGTE,omitempty"` + ClaimedAtLT *time.Time `json:"claimedAtLT,omitempty"` + ClaimedAtLTE *time.Time `json:"claimedAtLTE,omitempty"` + ClaimedAtIsNil bool `json:"claimedAtIsNil,omitempty"` + ClaimedAtNotNil bool `json:"claimedAtNotNil,omitempty"` + + // "started_at" field predicates. + StartedAt *time.Time `json:"startedAt,omitempty"` + StartedAtNEQ *time.Time `json:"startedAtNEQ,omitempty"` + StartedAtIn []time.Time `json:"startedAtIn,omitempty"` + StartedAtNotIn []time.Time `json:"startedAtNotIn,omitempty"` + StartedAtGT *time.Time `json:"startedAtGT,omitempty"` + StartedAtGTE *time.Time `json:"startedAtGTE,omitempty"` + StartedAtLT *time.Time `json:"startedAtLT,omitempty"` + StartedAtLTE *time.Time `json:"startedAtLTE,omitempty"` + StartedAtIsNil bool `json:"startedAtIsNil,omitempty"` + StartedAtNotNil bool `json:"startedAtNotNil,omitempty"` + + // "finished_at" field predicates. + FinishedAt *time.Time `json:"finishedAt,omitempty"` + FinishedAtNEQ *time.Time `json:"finishedAtNEQ,omitempty"` + FinishedAtIn []time.Time `json:"finishedAtIn,omitempty"` + FinishedAtNotIn []time.Time `json:"finishedAtNotIn,omitempty"` + FinishedAtGT *time.Time `json:"finishedAtGT,omitempty"` + FinishedAtGTE *time.Time `json:"finishedAtGTE,omitempty"` + FinishedAtLT *time.Time `json:"finishedAtLT,omitempty"` + FinishedAtLTE *time.Time `json:"finishedAtLTE,omitempty"` + FinishedAtIsNil bool `json:"finishedAtIsNil,omitempty"` + FinishedAtNotNil bool `json:"finishedAtNotNil,omitempty"` + + // "output" field predicates. + Output *string `json:"output,omitempty"` + OutputNEQ *string `json:"outputNEQ,omitempty"` + OutputIn []string `json:"outputIn,omitempty"` + OutputNotIn []string `json:"outputNotIn,omitempty"` + OutputGT *string `json:"outputGT,omitempty"` + OutputGTE *string `json:"outputGTE,omitempty"` + OutputLT *string `json:"outputLT,omitempty"` + OutputLTE *string `json:"outputLTE,omitempty"` + OutputContains *string `json:"outputContains,omitempty"` + OutputHasPrefix *string `json:"outputHasPrefix,omitempty"` + OutputHasSuffix *string `json:"outputHasSuffix,omitempty"` + OutputIsNil bool `json:"outputIsNil,omitempty"` + OutputNotNil bool `json:"outputNotNil,omitempty"` + OutputEqualFold *string `json:"outputEqualFold,omitempty"` + OutputContainsFold *string `json:"outputContainsFold,omitempty"` + + // "output_size" field predicates. + OutputSize *int `json:"outputSize,omitempty"` + OutputSizeNEQ *int `json:"outputSizeNEQ,omitempty"` + OutputSizeIn []int `json:"outputSizeIn,omitempty"` + OutputSizeNotIn []int `json:"outputSizeNotIn,omitempty"` + OutputSizeGT *int `json:"outputSizeGT,omitempty"` + OutputSizeGTE *int `json:"outputSizeGTE,omitempty"` + OutputSizeLT *int `json:"outputSizeLT,omitempty"` + OutputSizeLTE *int `json:"outputSizeLTE,omitempty"` + + // "error" field predicates. + Error *string `json:"error,omitempty"` + ErrorNEQ *string `json:"errorNEQ,omitempty"` + ErrorIn []string `json:"errorIn,omitempty"` + ErrorNotIn []string `json:"errorNotIn,omitempty"` + ErrorGT *string `json:"errorGT,omitempty"` + ErrorGTE *string `json:"errorGTE,omitempty"` + ErrorLT *string `json:"errorLT,omitempty"` + ErrorLTE *string `json:"errorLTE,omitempty"` + ErrorContains *string `json:"errorContains,omitempty"` + ErrorHasPrefix *string `json:"errorHasPrefix,omitempty"` + ErrorHasSuffix *string `json:"errorHasSuffix,omitempty"` + ErrorIsNil bool `json:"errorIsNil,omitempty"` + ErrorNotNil bool `json:"errorNotNil,omitempty"` + ErrorEqualFold *string `json:"errorEqualFold,omitempty"` + ErrorContainsFold *string `json:"errorContainsFold,omitempty"` + + // "error_size" field predicates. + ErrorSize *int `json:"errorSize,omitempty"` + ErrorSizeNEQ *int `json:"errorSizeNEQ,omitempty"` + ErrorSizeIn []int `json:"errorSizeIn,omitempty"` + ErrorSizeNotIn []int `json:"errorSizeNotIn,omitempty"` + ErrorSizeGT *int `json:"errorSizeGT,omitempty"` + ErrorSizeGTE *int `json:"errorSizeGTE,omitempty"` + ErrorSizeLT *int `json:"errorSizeLT,omitempty"` + ErrorSizeLTE *int `json:"errorSizeLTE,omitempty"` + + // "exit_code" field predicates. + ExitCode *int `json:"exitCode,omitempty"` + ExitCodeNEQ *int `json:"exitCodeNEQ,omitempty"` + ExitCodeIn []int `json:"exitCodeIn,omitempty"` + ExitCodeNotIn []int `json:"exitCodeNotIn,omitempty"` + ExitCodeGT *int `json:"exitCodeGT,omitempty"` + ExitCodeGTE *int `json:"exitCodeGTE,omitempty"` + ExitCodeLT *int `json:"exitCodeLT,omitempty"` + ExitCodeLTE *int `json:"exitCodeLTE,omitempty"` + ExitCodeIsNil bool `json:"exitCodeIsNil,omitempty"` + ExitCodeNotNil bool `json:"exitCodeNotNil,omitempty"` + + // "artifact_path" field predicates. + ArtifactPath *string `json:"artifactPath,omitempty"` + ArtifactPathNEQ *string `json:"artifactPathNEQ,omitempty"` + ArtifactPathIn []string `json:"artifactPathIn,omitempty"` + ArtifactPathNotIn []string `json:"artifactPathNotIn,omitempty"` + ArtifactPathGT *string `json:"artifactPathGT,omitempty"` + ArtifactPathGTE *string `json:"artifactPathGTE,omitempty"` + ArtifactPathLT *string `json:"artifactPathLT,omitempty"` + ArtifactPathLTE *string `json:"artifactPathLTE,omitempty"` + ArtifactPathContains *string `json:"artifactPathContains,omitempty"` + ArtifactPathHasPrefix *string `json:"artifactPathHasPrefix,omitempty"` + ArtifactPathHasSuffix *string `json:"artifactPathHasSuffix,omitempty"` + ArtifactPathIsNil bool `json:"artifactPathIsNil,omitempty"` + ArtifactPathNotNil bool `json:"artifactPathNotNil,omitempty"` + ArtifactPathEqualFold *string `json:"artifactPathEqualFold,omitempty"` + ArtifactPathContainsFold *string `json:"artifactPathContainsFold,omitempty"` + + // "builder" edge predicates. + HasBuilder *bool `json:"hasBuilder,omitempty"` + HasBuilderWith []*BuilderWhereInput `json:"hasBuilderWith,omitempty"` + + // "artifact" edge predicates. + HasArtifact *bool `json:"hasArtifact,omitempty"` + HasArtifactWith []*AssetWhereInput `json:"hasArtifactWith,omitempty"` +} + +// AddPredicates adds custom predicates to the where input to be used during the filtering phase. +func (i *BuildTaskWhereInput) AddPredicates(predicates ...predicate.BuildTask) { + i.Predicates = append(i.Predicates, predicates...) +} + +// Filter applies the BuildTaskWhereInput filter on the BuildTaskQuery builder. +func (i *BuildTaskWhereInput) Filter(q *BuildTaskQuery) (*BuildTaskQuery, error) { + if i == nil { + return q, nil + } + p, err := i.P() + if err != nil { + if err == ErrEmptyBuildTaskWhereInput { + return q, nil + } + return nil, err + } + return q.Where(p), nil +} + +// ErrEmptyBuildTaskWhereInput is returned in case the BuildTaskWhereInput is empty. +var ErrEmptyBuildTaskWhereInput = errors.New("ent: empty predicate BuildTaskWhereInput") + +// P returns a predicate for filtering buildtasks. +// An error is returned if the input is empty or invalid. +func (i *BuildTaskWhereInput) P() (predicate.BuildTask, error) { + var predicates []predicate.BuildTask + if i.Not != nil { + p, err := i.Not.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'not'", err) + } + predicates = append(predicates, buildtask.Not(p)) + } + switch n := len(i.Or); { + case n == 1: + p, err := i.Or[0].P() + if err != nil { + return nil, fmt.Errorf("%w: field 'or'", err) + } + predicates = append(predicates, p) + case n > 1: + or := make([]predicate.BuildTask, 0, n) + for _, w := range i.Or { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'or'", err) + } + or = append(or, p) + } + predicates = append(predicates, buildtask.Or(or...)) + } + switch n := len(i.And); { + case n == 1: + p, err := i.And[0].P() + if err != nil { + return nil, fmt.Errorf("%w: field 'and'", err) + } + predicates = append(predicates, p) + case n > 1: + and := make([]predicate.BuildTask, 0, n) + for _, w := range i.And { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'and'", err) + } + and = append(and, p) + } + predicates = append(predicates, buildtask.And(and...)) + } + predicates = append(predicates, i.Predicates...) + if i.ID != nil { + predicates = append(predicates, buildtask.IDEQ(*i.ID)) + } + if i.IDNEQ != nil { + predicates = append(predicates, buildtask.IDNEQ(*i.IDNEQ)) + } + if len(i.IDIn) > 0 { + predicates = append(predicates, buildtask.IDIn(i.IDIn...)) + } + if len(i.IDNotIn) > 0 { + predicates = append(predicates, buildtask.IDNotIn(i.IDNotIn...)) + } + if i.IDGT != nil { + predicates = append(predicates, buildtask.IDGT(*i.IDGT)) + } + if i.IDGTE != nil { + predicates = append(predicates, buildtask.IDGTE(*i.IDGTE)) + } + if i.IDLT != nil { + predicates = append(predicates, buildtask.IDLT(*i.IDLT)) + } + if i.IDLTE != nil { + predicates = append(predicates, buildtask.IDLTE(*i.IDLTE)) + } + if i.CreatedAt != nil { + predicates = append(predicates, buildtask.CreatedAtEQ(*i.CreatedAt)) + } + if i.CreatedAtNEQ != nil { + predicates = append(predicates, buildtask.CreatedAtNEQ(*i.CreatedAtNEQ)) + } + if len(i.CreatedAtIn) > 0 { + predicates = append(predicates, buildtask.CreatedAtIn(i.CreatedAtIn...)) + } + if len(i.CreatedAtNotIn) > 0 { + predicates = append(predicates, buildtask.CreatedAtNotIn(i.CreatedAtNotIn...)) + } + if i.CreatedAtGT != nil { + predicates = append(predicates, buildtask.CreatedAtGT(*i.CreatedAtGT)) + } + if i.CreatedAtGTE != nil { + predicates = append(predicates, buildtask.CreatedAtGTE(*i.CreatedAtGTE)) + } + if i.CreatedAtLT != nil { + predicates = append(predicates, buildtask.CreatedAtLT(*i.CreatedAtLT)) + } + if i.CreatedAtLTE != nil { + predicates = append(predicates, buildtask.CreatedAtLTE(*i.CreatedAtLTE)) + } + if i.LastModifiedAt != nil { + predicates = append(predicates, buildtask.LastModifiedAtEQ(*i.LastModifiedAt)) + } + if i.LastModifiedAtNEQ != nil { + predicates = append(predicates, buildtask.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + } + if len(i.LastModifiedAtIn) > 0 { + predicates = append(predicates, buildtask.LastModifiedAtIn(i.LastModifiedAtIn...)) + } + if len(i.LastModifiedAtNotIn) > 0 { + predicates = append(predicates, buildtask.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + } + if i.LastModifiedAtGT != nil { + predicates = append(predicates, buildtask.LastModifiedAtGT(*i.LastModifiedAtGT)) + } + if i.LastModifiedAtGTE != nil { + predicates = append(predicates, buildtask.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + } + if i.LastModifiedAtLT != nil { + predicates = append(predicates, buildtask.LastModifiedAtLT(*i.LastModifiedAtLT)) + } + if i.LastModifiedAtLTE != nil { + predicates = append(predicates, buildtask.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + } + if i.TargetOs != nil { + predicates = append(predicates, buildtask.TargetOsEQ(*i.TargetOs)) + } + if i.TargetOsNEQ != nil { + predicates = append(predicates, buildtask.TargetOsNEQ(*i.TargetOsNEQ)) + } + if len(i.TargetOsIn) > 0 { + predicates = append(predicates, buildtask.TargetOsIn(i.TargetOsIn...)) + } + if len(i.TargetOsNotIn) > 0 { + predicates = append(predicates, buildtask.TargetOsNotIn(i.TargetOsNotIn...)) + } + if i.TargetFormat != nil { + predicates = append(predicates, buildtask.TargetFormatEQ(*i.TargetFormat)) + } + if i.TargetFormatNEQ != nil { + predicates = append(predicates, buildtask.TargetFormatNEQ(*i.TargetFormatNEQ)) + } + if len(i.TargetFormatIn) > 0 { + predicates = append(predicates, buildtask.TargetFormatIn(i.TargetFormatIn...)) + } + if len(i.TargetFormatNotIn) > 0 { + predicates = append(predicates, buildtask.TargetFormatNotIn(i.TargetFormatNotIn...)) + } + if i.BuildImage != nil { + predicates = append(predicates, buildtask.BuildImageEQ(*i.BuildImage)) + } + if i.BuildImageNEQ != nil { + predicates = append(predicates, buildtask.BuildImageNEQ(*i.BuildImageNEQ)) + } + if len(i.BuildImageIn) > 0 { + predicates = append(predicates, buildtask.BuildImageIn(i.BuildImageIn...)) + } + if len(i.BuildImageNotIn) > 0 { + predicates = append(predicates, buildtask.BuildImageNotIn(i.BuildImageNotIn...)) + } + if i.BuildImageGT != nil { + predicates = append(predicates, buildtask.BuildImageGT(*i.BuildImageGT)) + } + if i.BuildImageGTE != nil { + predicates = append(predicates, buildtask.BuildImageGTE(*i.BuildImageGTE)) + } + if i.BuildImageLT != nil { + predicates = append(predicates, buildtask.BuildImageLT(*i.BuildImageLT)) + } + if i.BuildImageLTE != nil { + predicates = append(predicates, buildtask.BuildImageLTE(*i.BuildImageLTE)) + } + if i.BuildImageContains != nil { + predicates = append(predicates, buildtask.BuildImageContains(*i.BuildImageContains)) + } + if i.BuildImageHasPrefix != nil { + predicates = append(predicates, buildtask.BuildImageHasPrefix(*i.BuildImageHasPrefix)) + } + if i.BuildImageHasSuffix != nil { + predicates = append(predicates, buildtask.BuildImageHasSuffix(*i.BuildImageHasSuffix)) + } + if i.BuildImageEqualFold != nil { + predicates = append(predicates, buildtask.BuildImageEqualFold(*i.BuildImageEqualFold)) + } + if i.BuildImageContainsFold != nil { + predicates = append(predicates, buildtask.BuildImageContainsFold(*i.BuildImageContainsFold)) + } + if i.BuildScript != nil { + predicates = append(predicates, buildtask.BuildScriptEQ(*i.BuildScript)) + } + if i.BuildScriptNEQ != nil { + predicates = append(predicates, buildtask.BuildScriptNEQ(*i.BuildScriptNEQ)) + } + if len(i.BuildScriptIn) > 0 { + predicates = append(predicates, buildtask.BuildScriptIn(i.BuildScriptIn...)) + } + if len(i.BuildScriptNotIn) > 0 { + predicates = append(predicates, buildtask.BuildScriptNotIn(i.BuildScriptNotIn...)) + } + if i.BuildScriptGT != nil { + predicates = append(predicates, buildtask.BuildScriptGT(*i.BuildScriptGT)) + } + if i.BuildScriptGTE != nil { + predicates = append(predicates, buildtask.BuildScriptGTE(*i.BuildScriptGTE)) + } + if i.BuildScriptLT != nil { + predicates = append(predicates, buildtask.BuildScriptLT(*i.BuildScriptLT)) + } + if i.BuildScriptLTE != nil { + predicates = append(predicates, buildtask.BuildScriptLTE(*i.BuildScriptLTE)) + } + if i.BuildScriptContains != nil { + predicates = append(predicates, buildtask.BuildScriptContains(*i.BuildScriptContains)) + } + if i.BuildScriptHasPrefix != nil { + predicates = append(predicates, buildtask.BuildScriptHasPrefix(*i.BuildScriptHasPrefix)) + } + if i.BuildScriptHasSuffix != nil { + predicates = append(predicates, buildtask.BuildScriptHasSuffix(*i.BuildScriptHasSuffix)) + } + if i.BuildScriptEqualFold != nil { + predicates = append(predicates, buildtask.BuildScriptEqualFold(*i.BuildScriptEqualFold)) + } + if i.BuildScriptContainsFold != nil { + predicates = append(predicates, buildtask.BuildScriptContainsFold(*i.BuildScriptContainsFold)) + } + if i.CallbackURI != nil { + predicates = append(predicates, buildtask.CallbackURIEQ(*i.CallbackURI)) + } + if i.CallbackURINEQ != nil { + predicates = append(predicates, buildtask.CallbackURINEQ(*i.CallbackURINEQ)) + } + if len(i.CallbackURIIn) > 0 { + predicates = append(predicates, buildtask.CallbackURIIn(i.CallbackURIIn...)) + } + if len(i.CallbackURINotIn) > 0 { + predicates = append(predicates, buildtask.CallbackURINotIn(i.CallbackURINotIn...)) + } + if i.CallbackURIGT != nil { + predicates = append(predicates, buildtask.CallbackURIGT(*i.CallbackURIGT)) + } + if i.CallbackURIGTE != nil { + predicates = append(predicates, buildtask.CallbackURIGTE(*i.CallbackURIGTE)) + } + if i.CallbackURILT != nil { + predicates = append(predicates, buildtask.CallbackURILT(*i.CallbackURILT)) + } + if i.CallbackURILTE != nil { + predicates = append(predicates, buildtask.CallbackURILTE(*i.CallbackURILTE)) + } + if i.CallbackURIContains != nil { + predicates = append(predicates, buildtask.CallbackURIContains(*i.CallbackURIContains)) + } + if i.CallbackURIHasPrefix != nil { + predicates = append(predicates, buildtask.CallbackURIHasPrefix(*i.CallbackURIHasPrefix)) + } + if i.CallbackURIHasSuffix != nil { + predicates = append(predicates, buildtask.CallbackURIHasSuffix(*i.CallbackURIHasSuffix)) + } + if i.CallbackURIEqualFold != nil { + predicates = append(predicates, buildtask.CallbackURIEqualFold(*i.CallbackURIEqualFold)) + } + if i.CallbackURIContainsFold != nil { + predicates = append(predicates, buildtask.CallbackURIContainsFold(*i.CallbackURIContainsFold)) + } + if i.Interval != nil { + predicates = append(predicates, buildtask.IntervalEQ(*i.Interval)) + } + if i.IntervalNEQ != nil { + predicates = append(predicates, buildtask.IntervalNEQ(*i.IntervalNEQ)) + } + if len(i.IntervalIn) > 0 { + predicates = append(predicates, buildtask.IntervalIn(i.IntervalIn...)) + } + if len(i.IntervalNotIn) > 0 { + predicates = append(predicates, buildtask.IntervalNotIn(i.IntervalNotIn...)) + } + if i.IntervalGT != nil { + predicates = append(predicates, buildtask.IntervalGT(*i.IntervalGT)) + } + if i.IntervalGTE != nil { + predicates = append(predicates, buildtask.IntervalGTE(*i.IntervalGTE)) + } + if i.IntervalLT != nil { + predicates = append(predicates, buildtask.IntervalLT(*i.IntervalLT)) + } + if i.IntervalLTE != nil { + predicates = append(predicates, buildtask.IntervalLTE(*i.IntervalLTE)) + } + if i.TransportType != nil { + predicates = append(predicates, buildtask.TransportTypeEQ(*i.TransportType)) + } + if i.TransportTypeNEQ != nil { + predicates = append(predicates, buildtask.TransportTypeNEQ(*i.TransportTypeNEQ)) + } + if len(i.TransportTypeIn) > 0 { + predicates = append(predicates, buildtask.TransportTypeIn(i.TransportTypeIn...)) + } + if len(i.TransportTypeNotIn) > 0 { + predicates = append(predicates, buildtask.TransportTypeNotIn(i.TransportTypeNotIn...)) + } + if i.Extra != nil { + predicates = append(predicates, buildtask.ExtraEQ(*i.Extra)) + } + if i.ExtraNEQ != nil { + predicates = append(predicates, buildtask.ExtraNEQ(*i.ExtraNEQ)) + } + if len(i.ExtraIn) > 0 { + predicates = append(predicates, buildtask.ExtraIn(i.ExtraIn...)) + } + if len(i.ExtraNotIn) > 0 { + predicates = append(predicates, buildtask.ExtraNotIn(i.ExtraNotIn...)) + } + if i.ExtraGT != nil { + predicates = append(predicates, buildtask.ExtraGT(*i.ExtraGT)) + } + if i.ExtraGTE != nil { + predicates = append(predicates, buildtask.ExtraGTE(*i.ExtraGTE)) + } + if i.ExtraLT != nil { + predicates = append(predicates, buildtask.ExtraLT(*i.ExtraLT)) + } + if i.ExtraLTE != nil { + predicates = append(predicates, buildtask.ExtraLTE(*i.ExtraLTE)) + } + if i.ExtraContains != nil { + predicates = append(predicates, buildtask.ExtraContains(*i.ExtraContains)) + } + if i.ExtraHasPrefix != nil { + predicates = append(predicates, buildtask.ExtraHasPrefix(*i.ExtraHasPrefix)) + } + if i.ExtraHasSuffix != nil { + predicates = append(predicates, buildtask.ExtraHasSuffix(*i.ExtraHasSuffix)) + } + if i.ExtraIsNil { + predicates = append(predicates, buildtask.ExtraIsNil()) + } + if i.ExtraNotNil { + predicates = append(predicates, buildtask.ExtraNotNil()) + } + if i.ExtraEqualFold != nil { + predicates = append(predicates, buildtask.ExtraEqualFold(*i.ExtraEqualFold)) + } + if i.ExtraContainsFold != nil { + predicates = append(predicates, buildtask.ExtraContainsFold(*i.ExtraContainsFold)) + } + if i.ClaimedAt != nil { + predicates = append(predicates, buildtask.ClaimedAtEQ(*i.ClaimedAt)) + } + if i.ClaimedAtNEQ != nil { + predicates = append(predicates, buildtask.ClaimedAtNEQ(*i.ClaimedAtNEQ)) + } + if len(i.ClaimedAtIn) > 0 { + predicates = append(predicates, buildtask.ClaimedAtIn(i.ClaimedAtIn...)) + } + if len(i.ClaimedAtNotIn) > 0 { + predicates = append(predicates, buildtask.ClaimedAtNotIn(i.ClaimedAtNotIn...)) + } + if i.ClaimedAtGT != nil { + predicates = append(predicates, buildtask.ClaimedAtGT(*i.ClaimedAtGT)) + } + if i.ClaimedAtGTE != nil { + predicates = append(predicates, buildtask.ClaimedAtGTE(*i.ClaimedAtGTE)) + } + if i.ClaimedAtLT != nil { + predicates = append(predicates, buildtask.ClaimedAtLT(*i.ClaimedAtLT)) + } + if i.ClaimedAtLTE != nil { + predicates = append(predicates, buildtask.ClaimedAtLTE(*i.ClaimedAtLTE)) + } + if i.ClaimedAtIsNil { + predicates = append(predicates, buildtask.ClaimedAtIsNil()) + } + if i.ClaimedAtNotNil { + predicates = append(predicates, buildtask.ClaimedAtNotNil()) + } + if i.StartedAt != nil { + predicates = append(predicates, buildtask.StartedAtEQ(*i.StartedAt)) + } + if i.StartedAtNEQ != nil { + predicates = append(predicates, buildtask.StartedAtNEQ(*i.StartedAtNEQ)) + } + if len(i.StartedAtIn) > 0 { + predicates = append(predicates, buildtask.StartedAtIn(i.StartedAtIn...)) + } + if len(i.StartedAtNotIn) > 0 { + predicates = append(predicates, buildtask.StartedAtNotIn(i.StartedAtNotIn...)) + } + if i.StartedAtGT != nil { + predicates = append(predicates, buildtask.StartedAtGT(*i.StartedAtGT)) + } + if i.StartedAtGTE != nil { + predicates = append(predicates, buildtask.StartedAtGTE(*i.StartedAtGTE)) + } + if i.StartedAtLT != nil { + predicates = append(predicates, buildtask.StartedAtLT(*i.StartedAtLT)) + } + if i.StartedAtLTE != nil { + predicates = append(predicates, buildtask.StartedAtLTE(*i.StartedAtLTE)) + } + if i.StartedAtIsNil { + predicates = append(predicates, buildtask.StartedAtIsNil()) + } + if i.StartedAtNotNil { + predicates = append(predicates, buildtask.StartedAtNotNil()) + } + if i.FinishedAt != nil { + predicates = append(predicates, buildtask.FinishedAtEQ(*i.FinishedAt)) + } + if i.FinishedAtNEQ != nil { + predicates = append(predicates, buildtask.FinishedAtNEQ(*i.FinishedAtNEQ)) + } + if len(i.FinishedAtIn) > 0 { + predicates = append(predicates, buildtask.FinishedAtIn(i.FinishedAtIn...)) + } + if len(i.FinishedAtNotIn) > 0 { + predicates = append(predicates, buildtask.FinishedAtNotIn(i.FinishedAtNotIn...)) + } + if i.FinishedAtGT != nil { + predicates = append(predicates, buildtask.FinishedAtGT(*i.FinishedAtGT)) + } + if i.FinishedAtGTE != nil { + predicates = append(predicates, buildtask.FinishedAtGTE(*i.FinishedAtGTE)) + } + if i.FinishedAtLT != nil { + predicates = append(predicates, buildtask.FinishedAtLT(*i.FinishedAtLT)) + } + if i.FinishedAtLTE != nil { + predicates = append(predicates, buildtask.FinishedAtLTE(*i.FinishedAtLTE)) + } + if i.FinishedAtIsNil { + predicates = append(predicates, buildtask.FinishedAtIsNil()) + } + if i.FinishedAtNotNil { + predicates = append(predicates, buildtask.FinishedAtNotNil()) + } + if i.Output != nil { + predicates = append(predicates, buildtask.OutputEQ(*i.Output)) + } + if i.OutputNEQ != nil { + predicates = append(predicates, buildtask.OutputNEQ(*i.OutputNEQ)) + } + if len(i.OutputIn) > 0 { + predicates = append(predicates, buildtask.OutputIn(i.OutputIn...)) + } + if len(i.OutputNotIn) > 0 { + predicates = append(predicates, buildtask.OutputNotIn(i.OutputNotIn...)) + } + if i.OutputGT != nil { + predicates = append(predicates, buildtask.OutputGT(*i.OutputGT)) + } + if i.OutputGTE != nil { + predicates = append(predicates, buildtask.OutputGTE(*i.OutputGTE)) + } + if i.OutputLT != nil { + predicates = append(predicates, buildtask.OutputLT(*i.OutputLT)) + } + if i.OutputLTE != nil { + predicates = append(predicates, buildtask.OutputLTE(*i.OutputLTE)) + } + if i.OutputContains != nil { + predicates = append(predicates, buildtask.OutputContains(*i.OutputContains)) + } + if i.OutputHasPrefix != nil { + predicates = append(predicates, buildtask.OutputHasPrefix(*i.OutputHasPrefix)) + } + if i.OutputHasSuffix != nil { + predicates = append(predicates, buildtask.OutputHasSuffix(*i.OutputHasSuffix)) + } + if i.OutputIsNil { + predicates = append(predicates, buildtask.OutputIsNil()) + } + if i.OutputNotNil { + predicates = append(predicates, buildtask.OutputNotNil()) + } + if i.OutputEqualFold != nil { + predicates = append(predicates, buildtask.OutputEqualFold(*i.OutputEqualFold)) + } + if i.OutputContainsFold != nil { + predicates = append(predicates, buildtask.OutputContainsFold(*i.OutputContainsFold)) + } + if i.OutputSize != nil { + predicates = append(predicates, buildtask.OutputSizeEQ(*i.OutputSize)) + } + if i.OutputSizeNEQ != nil { + predicates = append(predicates, buildtask.OutputSizeNEQ(*i.OutputSizeNEQ)) + } + if len(i.OutputSizeIn) > 0 { + predicates = append(predicates, buildtask.OutputSizeIn(i.OutputSizeIn...)) + } + if len(i.OutputSizeNotIn) > 0 { + predicates = append(predicates, buildtask.OutputSizeNotIn(i.OutputSizeNotIn...)) + } + if i.OutputSizeGT != nil { + predicates = append(predicates, buildtask.OutputSizeGT(*i.OutputSizeGT)) + } + if i.OutputSizeGTE != nil { + predicates = append(predicates, buildtask.OutputSizeGTE(*i.OutputSizeGTE)) + } + if i.OutputSizeLT != nil { + predicates = append(predicates, buildtask.OutputSizeLT(*i.OutputSizeLT)) + } + if i.OutputSizeLTE != nil { + predicates = append(predicates, buildtask.OutputSizeLTE(*i.OutputSizeLTE)) + } + if i.Error != nil { + predicates = append(predicates, buildtask.ErrorEQ(*i.Error)) + } + if i.ErrorNEQ != nil { + predicates = append(predicates, buildtask.ErrorNEQ(*i.ErrorNEQ)) + } + if len(i.ErrorIn) > 0 { + predicates = append(predicates, buildtask.ErrorIn(i.ErrorIn...)) + } + if len(i.ErrorNotIn) > 0 { + predicates = append(predicates, buildtask.ErrorNotIn(i.ErrorNotIn...)) + } + if i.ErrorGT != nil { + predicates = append(predicates, buildtask.ErrorGT(*i.ErrorGT)) + } + if i.ErrorGTE != nil { + predicates = append(predicates, buildtask.ErrorGTE(*i.ErrorGTE)) + } + if i.ErrorLT != nil { + predicates = append(predicates, buildtask.ErrorLT(*i.ErrorLT)) + } + if i.ErrorLTE != nil { + predicates = append(predicates, buildtask.ErrorLTE(*i.ErrorLTE)) + } + if i.ErrorContains != nil { + predicates = append(predicates, buildtask.ErrorContains(*i.ErrorContains)) + } + if i.ErrorHasPrefix != nil { + predicates = append(predicates, buildtask.ErrorHasPrefix(*i.ErrorHasPrefix)) + } + if i.ErrorHasSuffix != nil { + predicates = append(predicates, buildtask.ErrorHasSuffix(*i.ErrorHasSuffix)) + } + if i.ErrorIsNil { + predicates = append(predicates, buildtask.ErrorIsNil()) + } + if i.ErrorNotNil { + predicates = append(predicates, buildtask.ErrorNotNil()) + } + if i.ErrorEqualFold != nil { + predicates = append(predicates, buildtask.ErrorEqualFold(*i.ErrorEqualFold)) + } + if i.ErrorContainsFold != nil { + predicates = append(predicates, buildtask.ErrorContainsFold(*i.ErrorContainsFold)) + } + if i.ErrorSize != nil { + predicates = append(predicates, buildtask.ErrorSizeEQ(*i.ErrorSize)) + } + if i.ErrorSizeNEQ != nil { + predicates = append(predicates, buildtask.ErrorSizeNEQ(*i.ErrorSizeNEQ)) + } + if len(i.ErrorSizeIn) > 0 { + predicates = append(predicates, buildtask.ErrorSizeIn(i.ErrorSizeIn...)) + } + if len(i.ErrorSizeNotIn) > 0 { + predicates = append(predicates, buildtask.ErrorSizeNotIn(i.ErrorSizeNotIn...)) + } + if i.ErrorSizeGT != nil { + predicates = append(predicates, buildtask.ErrorSizeGT(*i.ErrorSizeGT)) + } + if i.ErrorSizeGTE != nil { + predicates = append(predicates, buildtask.ErrorSizeGTE(*i.ErrorSizeGTE)) + } + if i.ErrorSizeLT != nil { + predicates = append(predicates, buildtask.ErrorSizeLT(*i.ErrorSizeLT)) + } + if i.ErrorSizeLTE != nil { + predicates = append(predicates, buildtask.ErrorSizeLTE(*i.ErrorSizeLTE)) + } + if i.ExitCode != nil { + predicates = append(predicates, buildtask.ExitCodeEQ(*i.ExitCode)) + } + if i.ExitCodeNEQ != nil { + predicates = append(predicates, buildtask.ExitCodeNEQ(*i.ExitCodeNEQ)) + } + if len(i.ExitCodeIn) > 0 { + predicates = append(predicates, buildtask.ExitCodeIn(i.ExitCodeIn...)) + } + if len(i.ExitCodeNotIn) > 0 { + predicates = append(predicates, buildtask.ExitCodeNotIn(i.ExitCodeNotIn...)) + } + if i.ExitCodeGT != nil { + predicates = append(predicates, buildtask.ExitCodeGT(*i.ExitCodeGT)) + } + if i.ExitCodeGTE != nil { + predicates = append(predicates, buildtask.ExitCodeGTE(*i.ExitCodeGTE)) + } + if i.ExitCodeLT != nil { + predicates = append(predicates, buildtask.ExitCodeLT(*i.ExitCodeLT)) + } + if i.ExitCodeLTE != nil { + predicates = append(predicates, buildtask.ExitCodeLTE(*i.ExitCodeLTE)) + } + if i.ExitCodeIsNil { + predicates = append(predicates, buildtask.ExitCodeIsNil()) + } + if i.ExitCodeNotNil { + predicates = append(predicates, buildtask.ExitCodeNotNil()) + } + if i.ArtifactPath != nil { + predicates = append(predicates, buildtask.ArtifactPathEQ(*i.ArtifactPath)) + } + if i.ArtifactPathNEQ != nil { + predicates = append(predicates, buildtask.ArtifactPathNEQ(*i.ArtifactPathNEQ)) + } + if len(i.ArtifactPathIn) > 0 { + predicates = append(predicates, buildtask.ArtifactPathIn(i.ArtifactPathIn...)) + } + if len(i.ArtifactPathNotIn) > 0 { + predicates = append(predicates, buildtask.ArtifactPathNotIn(i.ArtifactPathNotIn...)) + } + if i.ArtifactPathGT != nil { + predicates = append(predicates, buildtask.ArtifactPathGT(*i.ArtifactPathGT)) + } + if i.ArtifactPathGTE != nil { + predicates = append(predicates, buildtask.ArtifactPathGTE(*i.ArtifactPathGTE)) + } + if i.ArtifactPathLT != nil { + predicates = append(predicates, buildtask.ArtifactPathLT(*i.ArtifactPathLT)) + } + if i.ArtifactPathLTE != nil { + predicates = append(predicates, buildtask.ArtifactPathLTE(*i.ArtifactPathLTE)) + } + if i.ArtifactPathContains != nil { + predicates = append(predicates, buildtask.ArtifactPathContains(*i.ArtifactPathContains)) + } + if i.ArtifactPathHasPrefix != nil { + predicates = append(predicates, buildtask.ArtifactPathHasPrefix(*i.ArtifactPathHasPrefix)) + } + if i.ArtifactPathHasSuffix != nil { + predicates = append(predicates, buildtask.ArtifactPathHasSuffix(*i.ArtifactPathHasSuffix)) + } + if i.ArtifactPathIsNil { + predicates = append(predicates, buildtask.ArtifactPathIsNil()) + } + if i.ArtifactPathNotNil { + predicates = append(predicates, buildtask.ArtifactPathNotNil()) + } + if i.ArtifactPathEqualFold != nil { + predicates = append(predicates, buildtask.ArtifactPathEqualFold(*i.ArtifactPathEqualFold)) + } + if i.ArtifactPathContainsFold != nil { + predicates = append(predicates, buildtask.ArtifactPathContainsFold(*i.ArtifactPathContainsFold)) + } + + if i.HasBuilder != nil { + p := buildtask.HasBuilder() + if !*i.HasBuilder { + p = buildtask.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasBuilderWith) > 0 { + with := make([]predicate.Builder, 0, len(i.HasBuilderWith)) + for _, w := range i.HasBuilderWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasBuilderWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, buildtask.HasBuilderWith(with...)) + } + if i.HasArtifact != nil { + p := buildtask.HasArtifact() + if !*i.HasArtifact { + p = buildtask.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasArtifactWith) > 0 { + with := make([]predicate.Asset, 0, len(i.HasArtifactWith)) + for _, w := range i.HasArtifactWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasArtifactWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, buildtask.HasArtifactWith(with...)) + } + switch len(predicates) { + case 0: + return nil, ErrEmptyBuildTaskWhereInput + case 1: + return predicates[0], nil + default: + return buildtask.And(predicates...), nil + } +} + // BuilderWhereInput represents a where input for filtering Builder queries. type BuilderWhereInput struct { Predicates []predicate.Builder `json:"-"` @@ -1128,6 +2100,22 @@ type BuilderWhereInput struct { UpstreamHasSuffix *string `json:"upstreamHasSuffix,omitempty"` UpstreamEqualFold *string `json:"upstreamEqualFold,omitempty"` UpstreamContainsFold *string `json:"upstreamContainsFold,omitempty"` + + // "last_seen_at" field predicates. + LastSeenAt *time.Time `json:"lastSeenAt,omitempty"` + LastSeenAtNEQ *time.Time `json:"lastSeenAtNEQ,omitempty"` + LastSeenAtIn []time.Time `json:"lastSeenAtIn,omitempty"` + LastSeenAtNotIn []time.Time `json:"lastSeenAtNotIn,omitempty"` + LastSeenAtGT *time.Time `json:"lastSeenAtGT,omitempty"` + LastSeenAtGTE *time.Time `json:"lastSeenAtGTE,omitempty"` + LastSeenAtLT *time.Time `json:"lastSeenAtLT,omitempty"` + LastSeenAtLTE *time.Time `json:"lastSeenAtLTE,omitempty"` + LastSeenAtIsNil bool `json:"lastSeenAtIsNil,omitempty"` + LastSeenAtNotNil bool `json:"lastSeenAtNotNil,omitempty"` + + // "build_tasks" edge predicates. + HasBuildTasks *bool `json:"hasBuildTasks,omitempty"` + HasBuildTasksWith []*BuildTaskWhereInput `json:"hasBuildTasksWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. @@ -1351,7 +2339,55 @@ func (i *BuilderWhereInput) P() (predicate.Builder, error) { if i.UpstreamContainsFold != nil { predicates = append(predicates, builder.UpstreamContainsFold(*i.UpstreamContainsFold)) } + if i.LastSeenAt != nil { + predicates = append(predicates, builder.LastSeenAtEQ(*i.LastSeenAt)) + } + if i.LastSeenAtNEQ != nil { + predicates = append(predicates, builder.LastSeenAtNEQ(*i.LastSeenAtNEQ)) + } + if len(i.LastSeenAtIn) > 0 { + predicates = append(predicates, builder.LastSeenAtIn(i.LastSeenAtIn...)) + } + if len(i.LastSeenAtNotIn) > 0 { + predicates = append(predicates, builder.LastSeenAtNotIn(i.LastSeenAtNotIn...)) + } + if i.LastSeenAtGT != nil { + predicates = append(predicates, builder.LastSeenAtGT(*i.LastSeenAtGT)) + } + if i.LastSeenAtGTE != nil { + predicates = append(predicates, builder.LastSeenAtGTE(*i.LastSeenAtGTE)) + } + if i.LastSeenAtLT != nil { + predicates = append(predicates, builder.LastSeenAtLT(*i.LastSeenAtLT)) + } + if i.LastSeenAtLTE != nil { + predicates = append(predicates, builder.LastSeenAtLTE(*i.LastSeenAtLTE)) + } + if i.LastSeenAtIsNil { + predicates = append(predicates, builder.LastSeenAtIsNil()) + } + if i.LastSeenAtNotNil { + predicates = append(predicates, builder.LastSeenAtNotNil()) + } + if i.HasBuildTasks != nil { + p := builder.HasBuildTasks() + if !*i.HasBuildTasks { + p = builder.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasBuildTasksWith) > 0 { + with := make([]predicate.BuildTask, 0, len(i.HasBuildTasksWith)) + for _, w := range i.HasBuildTasksWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasBuildTasksWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, builder.HasBuildTasksWith(with...)) + } switch len(predicates) { case 0: return nil, ErrEmptyBuilderWhereInput diff --git a/tavern/internal/ent/hook/hook.go b/tavern/internal/ent/hook/hook.go index 6c3f39320..8d5218863 100644 --- a/tavern/internal/ent/hook/hook.go +++ b/tavern/internal/ent/hook/hook.go @@ -33,6 +33,18 @@ func (f BeaconFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, erro return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BeaconMutation", m) } +// The BuildTaskFunc type is an adapter to allow the use of ordinary +// function as BuildTask mutator. +type BuildTaskFunc func(context.Context, *ent.BuildTaskMutation) (ent.Value, error) + +// Mutate calls f(ctx, m). +func (f BuildTaskFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if mv, ok := m.(*ent.BuildTaskMutation); ok { + return f(ctx, mv) + } + return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BuildTaskMutation", m) +} + // The BuilderFunc type is an adapter to allow the use of ordinary // function as Builder mutator. type BuilderFunc func(context.Context, *ent.BuilderMutation) (ent.Value, error) diff --git a/tavern/internal/ent/migrate/schema.go b/tavern/internal/ent/migrate/schema.go index 2cc90f21b..474e706b5 100644 --- a/tavern/internal/ent/migrate/schema.go +++ b/tavern/internal/ent/migrate/schema.go @@ -63,6 +63,51 @@ var ( }, }, } + // BuildTasksColumns holds the columns for the "build_tasks" table. + BuildTasksColumns = []*schema.Column{ + {Name: "id", Type: field.TypeInt, Increment: true}, + {Name: "created_at", Type: field.TypeTime}, + {Name: "last_modified_at", Type: field.TypeTime}, + {Name: "target_os", Type: field.TypeEnum, Enums: []string{"PLATFORM_BSD", "PLATFORM_LINUX", "PLATFORM_MACOS", "PLATFORM_UNSPECIFIED", "PLATFORM_WINDOWS"}}, + {Name: "target_format", Type: field.TypeEnum, Enums: []string{"TARGET_FORMAT_BIN", "TARGET_FORMAT_CDYLIB", "TARGET_FORMAT_UNSPECIFIED", "TARGET_FORMAT_WINDOWS_SERVICE"}}, + {Name: "build_image", Type: field.TypeString}, + {Name: "build_script", Type: field.TypeString, Size: 2147483647, SchemaType: map[string]string{"mysql": "LONGTEXT"}}, + {Name: "callback_uri", Type: field.TypeString}, + {Name: "interval", Type: field.TypeInt, Default: 5}, + {Name: "transport_type", Type: field.TypeEnum, Enums: []string{"TRANSPORT_DNS", "TRANSPORT_GRPC", "TRANSPORT_HTTP1", "TRANSPORT_UNSPECIFIED"}}, + {Name: "extra", Type: field.TypeString, Nullable: true}, + {Name: "claimed_at", Type: field.TypeTime, Nullable: true}, + {Name: "started_at", Type: field.TypeTime, Nullable: true}, + {Name: "finished_at", Type: field.TypeTime, Nullable: true}, + {Name: "output", Type: field.TypeString, Nullable: true, Size: 2147483647, SchemaType: map[string]string{"mysql": "LONGTEXT"}}, + {Name: "output_size", Type: field.TypeInt, Default: 0}, + {Name: "error", Type: field.TypeString, Nullable: true, Size: 2147483647, SchemaType: map[string]string{"mysql": "LONGTEXT"}}, + {Name: "error_size", Type: field.TypeInt, Default: 0}, + {Name: "exit_code", Type: field.TypeInt, Nullable: true}, + {Name: "artifact_path", Type: field.TypeString, Nullable: true}, + {Name: "build_task_builder", Type: field.TypeInt}, + {Name: "build_task_artifact", Type: field.TypeInt, Nullable: true}, + } + // BuildTasksTable holds the schema information for the "build_tasks" table. + BuildTasksTable = &schema.Table{ + Name: "build_tasks", + Columns: BuildTasksColumns, + PrimaryKey: []*schema.Column{BuildTasksColumns[0]}, + ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "build_tasks_builders_builder", + Columns: []*schema.Column{BuildTasksColumns[20]}, + RefColumns: []*schema.Column{BuildersColumns[0]}, + OnDelete: schema.Cascade, + }, + { + Symbol: "build_tasks_assets_artifact", + Columns: []*schema.Column{BuildTasksColumns[21]}, + RefColumns: []*schema.Column{AssetsColumns[0]}, + OnDelete: schema.SetNull, + }, + }, + } // BuildersColumns holds the columns for the "builders" table. BuildersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, @@ -71,6 +116,7 @@ var ( {Name: "identifier", Type: field.TypeString, Unique: true}, {Name: "supported_targets", Type: field.TypeJSON}, {Name: "upstream", Type: field.TypeString}, + {Name: "last_seen_at", Type: field.TypeTime, Nullable: true}, } // BuildersTable holds the schema information for the "builders" table. BuildersTable = &schema.Table{ @@ -582,6 +628,7 @@ var ( Tables = []*schema.Table{ AssetsTable, BeaconsTable, + BuildTasksTable, BuildersTable, HostsTable, HostCredentialsTable, @@ -611,6 +658,11 @@ func init() { BeaconsTable.Annotation = &entsql.Annotation{ Collation: "utf8mb4_general_ci", } + BuildTasksTable.ForeignKeys[0].RefTable = BuildersTable + BuildTasksTable.ForeignKeys[1].RefTable = AssetsTable + BuildTasksTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } BuildersTable.Annotation = &entsql.Annotation{ Collation: "utf8mb4_general_ci", } diff --git a/tavern/internal/ent/mutation.go b/tavern/internal/ent/mutation.go index 0090293fe..5fab9f704 100644 --- a/tavern/internal/ent/mutation.go +++ b/tavern/internal/ent/mutation.go @@ -11,11 +11,13 @@ import ( "entgo.io/ent" "entgo.io/ent/dialect/sql" + "realm.pub/tavern/internal/builder/builderpb" "realm.pub/tavern/internal/c2/c2pb" "realm.pub/tavern/internal/c2/epb" "realm.pub/tavern/internal/ent/asset" "realm.pub/tavern/internal/ent/beacon" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/host" "realm.pub/tavern/internal/ent/hostcredential" "realm.pub/tavern/internal/ent/hostfile" @@ -43,6 +45,7 @@ const ( // Node types. TypeAsset = "Asset" TypeBeacon = "Beacon" + TypeBuildTask = "BuildTask" TypeBuilder = "Builder" TypeHost = "Host" TypeHostCredential = "HostCredential" @@ -2108,6 +2111,1721 @@ func (m *BeaconMutation) ResetEdge(name string) error { return fmt.Errorf("unknown Beacon edge %s", name) } +// BuildTaskMutation represents an operation that mutates the BuildTask nodes in the graph. +type BuildTaskMutation struct { + config + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + target_os *c2pb.Host_Platform + target_format *builderpb.TargetFormat + build_image *string + build_script *string + callback_uri *string + interval *int + addinterval *int + transport_type *c2pb.Transport_Type + extra *string + claimed_at *time.Time + started_at *time.Time + finished_at *time.Time + output *string + output_size *int + addoutput_size *int + error *string + error_size *int + adderror_size *int + exit_code *int + addexit_code *int + artifact_path *string + clearedFields map[string]struct{} + builder *int + clearedbuilder bool + artifact *int + clearedartifact bool + done bool + oldValue func(context.Context) (*BuildTask, error) + predicates []predicate.BuildTask +} + +var _ ent.Mutation = (*BuildTaskMutation)(nil) + +// buildtaskOption allows management of the mutation configuration using functional options. +type buildtaskOption func(*BuildTaskMutation) + +// newBuildTaskMutation creates new mutation for the BuildTask entity. +func newBuildTaskMutation(c config, op Op, opts ...buildtaskOption) *BuildTaskMutation { + m := &BuildTaskMutation{ + config: c, + op: op, + typ: TypeBuildTask, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withBuildTaskID sets the ID field of the mutation. +func withBuildTaskID(id int) buildtaskOption { + return func(m *BuildTaskMutation) { + var ( + err error + once sync.Once + value *BuildTask + ) + m.oldValue = func(ctx context.Context) (*BuildTask, error) { + once.Do(func() { + if m.done { + err = errors.New("querying old values post mutation is not allowed") + } else { + value, err = m.Client().BuildTask.Get(ctx, id) + } + }) + return value, err + } + m.id = &id + } +} + +// withBuildTask sets the old BuildTask of the mutation. +func withBuildTask(node *BuildTask) buildtaskOption { + return func(m *BuildTaskMutation) { + m.oldValue = func(context.Context) (*BuildTask, error) { + return node, nil + } + m.id = &node.ID + } +} + +// Client returns a new `ent.Client` from the mutation. If the mutation was +// executed in a transaction (ent.Tx), a transactional client is returned. +func (m BuildTaskMutation) Client() *Client { + client := &Client{config: m.config} + client.init() + return client +} + +// Tx returns an `ent.Tx` for mutations that were executed in transactions; +// it returns an error otherwise. +func (m BuildTaskMutation) Tx() (*Tx, error) { + if _, ok := m.driver.(*txDriver); !ok { + return nil, errors.New("ent: mutation is not running in a transaction") + } + tx := &Tx{config: m.config} + tx.init() + return tx, nil +} + +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. +func (m *BuildTaskMutation) ID() (id int, exists bool) { + if m.id == nil { + return + } + return *m.id, true +} + +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *BuildTaskMutation) IDs(ctx context.Context) ([]int, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []int{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().BuildTask.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + +// SetCreatedAt sets the "created_at" field. +func (m *BuildTaskMutation) SetCreatedAt(t time.Time) { + m.created_at = &t +} + +// CreatedAt returns the value of the "created_at" field in the mutation. +func (m *BuildTaskMutation) CreatedAt() (r time.Time, exists bool) { + v := m.created_at + if v == nil { + return + } + return *v, true +} + +// OldCreatedAt returns the old "created_at" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) + } + return oldValue.CreatedAt, nil +} + +// ResetCreatedAt resets all changes to the "created_at" field. +func (m *BuildTaskMutation) ResetCreatedAt() { + m.created_at = nil +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (m *BuildTaskMutation) SetLastModifiedAt(t time.Time) { + m.last_modified_at = &t +} + +// LastModifiedAt returns the value of the "last_modified_at" field in the mutation. +func (m *BuildTaskMutation) LastModifiedAt() (r time.Time, exists bool) { + v := m.last_modified_at + if v == nil { + return + } + return *v, true +} + +// OldLastModifiedAt returns the old "last_modified_at" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldLastModifiedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldLastModifiedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldLastModifiedAt: %w", err) + } + return oldValue.LastModifiedAt, nil +} + +// ResetLastModifiedAt resets all changes to the "last_modified_at" field. +func (m *BuildTaskMutation) ResetLastModifiedAt() { + m.last_modified_at = nil +} + +// SetTargetOs sets the "target_os" field. +func (m *BuildTaskMutation) SetTargetOs(cp c2pb.Host_Platform) { + m.target_os = &cp +} + +// TargetOs returns the value of the "target_os" field in the mutation. +func (m *BuildTaskMutation) TargetOs() (r c2pb.Host_Platform, exists bool) { + v := m.target_os + if v == nil { + return + } + return *v, true +} + +// OldTargetOs returns the old "target_os" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldTargetOs(ctx context.Context) (v c2pb.Host_Platform, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTargetOs is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTargetOs requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTargetOs: %w", err) + } + return oldValue.TargetOs, nil +} + +// ResetTargetOs resets all changes to the "target_os" field. +func (m *BuildTaskMutation) ResetTargetOs() { + m.target_os = nil +} + +// SetTargetFormat sets the "target_format" field. +func (m *BuildTaskMutation) SetTargetFormat(bf builderpb.TargetFormat) { + m.target_format = &bf +} + +// TargetFormat returns the value of the "target_format" field in the mutation. +func (m *BuildTaskMutation) TargetFormat() (r builderpb.TargetFormat, exists bool) { + v := m.target_format + if v == nil { + return + } + return *v, true +} + +// OldTargetFormat returns the old "target_format" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldTargetFormat(ctx context.Context) (v builderpb.TargetFormat, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTargetFormat is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTargetFormat requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTargetFormat: %w", err) + } + return oldValue.TargetFormat, nil +} + +// ResetTargetFormat resets all changes to the "target_format" field. +func (m *BuildTaskMutation) ResetTargetFormat() { + m.target_format = nil +} + +// SetBuildImage sets the "build_image" field. +func (m *BuildTaskMutation) SetBuildImage(s string) { + m.build_image = &s +} + +// BuildImage returns the value of the "build_image" field in the mutation. +func (m *BuildTaskMutation) BuildImage() (r string, exists bool) { + v := m.build_image + if v == nil { + return + } + return *v, true +} + +// OldBuildImage returns the old "build_image" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldBuildImage(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldBuildImage is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldBuildImage requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldBuildImage: %w", err) + } + return oldValue.BuildImage, nil +} + +// ResetBuildImage resets all changes to the "build_image" field. +func (m *BuildTaskMutation) ResetBuildImage() { + m.build_image = nil +} + +// SetBuildScript sets the "build_script" field. +func (m *BuildTaskMutation) SetBuildScript(s string) { + m.build_script = &s +} + +// BuildScript returns the value of the "build_script" field in the mutation. +func (m *BuildTaskMutation) BuildScript() (r string, exists bool) { + v := m.build_script + if v == nil { + return + } + return *v, true +} + +// OldBuildScript returns the old "build_script" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldBuildScript(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldBuildScript is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldBuildScript requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldBuildScript: %w", err) + } + return oldValue.BuildScript, nil +} + +// ResetBuildScript resets all changes to the "build_script" field. +func (m *BuildTaskMutation) ResetBuildScript() { + m.build_script = nil +} + +// SetCallbackURI sets the "callback_uri" field. +func (m *BuildTaskMutation) SetCallbackURI(s string) { + m.callback_uri = &s +} + +// CallbackURI returns the value of the "callback_uri" field in the mutation. +func (m *BuildTaskMutation) CallbackURI() (r string, exists bool) { + v := m.callback_uri + if v == nil { + return + } + return *v, true +} + +// OldCallbackURI returns the old "callback_uri" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldCallbackURI(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCallbackURI is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCallbackURI requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCallbackURI: %w", err) + } + return oldValue.CallbackURI, nil +} + +// ResetCallbackURI resets all changes to the "callback_uri" field. +func (m *BuildTaskMutation) ResetCallbackURI() { + m.callback_uri = nil +} + +// SetInterval sets the "interval" field. +func (m *BuildTaskMutation) SetInterval(i int) { + m.interval = &i + m.addinterval = nil +} + +// Interval returns the value of the "interval" field in the mutation. +func (m *BuildTaskMutation) Interval() (r int, exists bool) { + v := m.interval + if v == nil { + return + } + return *v, true +} + +// OldInterval returns the old "interval" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldInterval(ctx context.Context) (v int, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldInterval is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldInterval requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldInterval: %w", err) + } + return oldValue.Interval, nil +} + +// AddInterval adds i to the "interval" field. +func (m *BuildTaskMutation) AddInterval(i int) { + if m.addinterval != nil { + *m.addinterval += i + } else { + m.addinterval = &i + } +} + +// AddedInterval returns the value that was added to the "interval" field in this mutation. +func (m *BuildTaskMutation) AddedInterval() (r int, exists bool) { + v := m.addinterval + if v == nil { + return + } + return *v, true +} + +// ResetInterval resets all changes to the "interval" field. +func (m *BuildTaskMutation) ResetInterval() { + m.interval = nil + m.addinterval = nil +} + +// SetTransportType sets the "transport_type" field. +func (m *BuildTaskMutation) SetTransportType(ct c2pb.Transport_Type) { + m.transport_type = &ct +} + +// TransportType returns the value of the "transport_type" field in the mutation. +func (m *BuildTaskMutation) TransportType() (r c2pb.Transport_Type, exists bool) { + v := m.transport_type + if v == nil { + return + } + return *v, true +} + +// OldTransportType returns the old "transport_type" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldTransportType(ctx context.Context) (v c2pb.Transport_Type, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTransportType is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTransportType requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTransportType: %w", err) + } + return oldValue.TransportType, nil +} + +// ResetTransportType resets all changes to the "transport_type" field. +func (m *BuildTaskMutation) ResetTransportType() { + m.transport_type = nil +} + +// SetExtra sets the "extra" field. +func (m *BuildTaskMutation) SetExtra(s string) { + m.extra = &s +} + +// Extra returns the value of the "extra" field in the mutation. +func (m *BuildTaskMutation) Extra() (r string, exists bool) { + v := m.extra + if v == nil { + return + } + return *v, true +} + +// OldExtra returns the old "extra" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldExtra(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldExtra is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldExtra requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldExtra: %w", err) + } + return oldValue.Extra, nil +} + +// ClearExtra clears the value of the "extra" field. +func (m *BuildTaskMutation) ClearExtra() { + m.extra = nil + m.clearedFields[buildtask.FieldExtra] = struct{}{} +} + +// ExtraCleared returns if the "extra" field was cleared in this mutation. +func (m *BuildTaskMutation) ExtraCleared() bool { + _, ok := m.clearedFields[buildtask.FieldExtra] + return ok +} + +// ResetExtra resets all changes to the "extra" field. +func (m *BuildTaskMutation) ResetExtra() { + m.extra = nil + delete(m.clearedFields, buildtask.FieldExtra) +} + +// SetClaimedAt sets the "claimed_at" field. +func (m *BuildTaskMutation) SetClaimedAt(t time.Time) { + m.claimed_at = &t +} + +// ClaimedAt returns the value of the "claimed_at" field in the mutation. +func (m *BuildTaskMutation) ClaimedAt() (r time.Time, exists bool) { + v := m.claimed_at + if v == nil { + return + } + return *v, true +} + +// OldClaimedAt returns the old "claimed_at" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldClaimedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldClaimedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldClaimedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldClaimedAt: %w", err) + } + return oldValue.ClaimedAt, nil +} + +// ClearClaimedAt clears the value of the "claimed_at" field. +func (m *BuildTaskMutation) ClearClaimedAt() { + m.claimed_at = nil + m.clearedFields[buildtask.FieldClaimedAt] = struct{}{} +} + +// ClaimedAtCleared returns if the "claimed_at" field was cleared in this mutation. +func (m *BuildTaskMutation) ClaimedAtCleared() bool { + _, ok := m.clearedFields[buildtask.FieldClaimedAt] + return ok +} + +// ResetClaimedAt resets all changes to the "claimed_at" field. +func (m *BuildTaskMutation) ResetClaimedAt() { + m.claimed_at = nil + delete(m.clearedFields, buildtask.FieldClaimedAt) +} + +// SetStartedAt sets the "started_at" field. +func (m *BuildTaskMutation) SetStartedAt(t time.Time) { + m.started_at = &t +} + +// StartedAt returns the value of the "started_at" field in the mutation. +func (m *BuildTaskMutation) StartedAt() (r time.Time, exists bool) { + v := m.started_at + if v == nil { + return + } + return *v, true +} + +// OldStartedAt returns the old "started_at" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldStartedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStartedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStartedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStartedAt: %w", err) + } + return oldValue.StartedAt, nil +} + +// ClearStartedAt clears the value of the "started_at" field. +func (m *BuildTaskMutation) ClearStartedAt() { + m.started_at = nil + m.clearedFields[buildtask.FieldStartedAt] = struct{}{} +} + +// StartedAtCleared returns if the "started_at" field was cleared in this mutation. +func (m *BuildTaskMutation) StartedAtCleared() bool { + _, ok := m.clearedFields[buildtask.FieldStartedAt] + return ok +} + +// ResetStartedAt resets all changes to the "started_at" field. +func (m *BuildTaskMutation) ResetStartedAt() { + m.started_at = nil + delete(m.clearedFields, buildtask.FieldStartedAt) +} + +// SetFinishedAt sets the "finished_at" field. +func (m *BuildTaskMutation) SetFinishedAt(t time.Time) { + m.finished_at = &t +} + +// FinishedAt returns the value of the "finished_at" field in the mutation. +func (m *BuildTaskMutation) FinishedAt() (r time.Time, exists bool) { + v := m.finished_at + if v == nil { + return + } + return *v, true +} + +// OldFinishedAt returns the old "finished_at" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldFinishedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldFinishedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldFinishedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldFinishedAt: %w", err) + } + return oldValue.FinishedAt, nil +} + +// ClearFinishedAt clears the value of the "finished_at" field. +func (m *BuildTaskMutation) ClearFinishedAt() { + m.finished_at = nil + m.clearedFields[buildtask.FieldFinishedAt] = struct{}{} +} + +// FinishedAtCleared returns if the "finished_at" field was cleared in this mutation. +func (m *BuildTaskMutation) FinishedAtCleared() bool { + _, ok := m.clearedFields[buildtask.FieldFinishedAt] + return ok +} + +// ResetFinishedAt resets all changes to the "finished_at" field. +func (m *BuildTaskMutation) ResetFinishedAt() { + m.finished_at = nil + delete(m.clearedFields, buildtask.FieldFinishedAt) +} + +// SetOutput sets the "output" field. +func (m *BuildTaskMutation) SetOutput(s string) { + m.output = &s +} + +// Output returns the value of the "output" field in the mutation. +func (m *BuildTaskMutation) Output() (r string, exists bool) { + v := m.output + if v == nil { + return + } + return *v, true +} + +// OldOutput returns the old "output" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldOutput(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldOutput is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldOutput requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldOutput: %w", err) + } + return oldValue.Output, nil +} + +// ClearOutput clears the value of the "output" field. +func (m *BuildTaskMutation) ClearOutput() { + m.output = nil + m.clearedFields[buildtask.FieldOutput] = struct{}{} +} + +// OutputCleared returns if the "output" field was cleared in this mutation. +func (m *BuildTaskMutation) OutputCleared() bool { + _, ok := m.clearedFields[buildtask.FieldOutput] + return ok +} + +// ResetOutput resets all changes to the "output" field. +func (m *BuildTaskMutation) ResetOutput() { + m.output = nil + delete(m.clearedFields, buildtask.FieldOutput) +} + +// SetOutputSize sets the "output_size" field. +func (m *BuildTaskMutation) SetOutputSize(i int) { + m.output_size = &i + m.addoutput_size = nil +} + +// OutputSize returns the value of the "output_size" field in the mutation. +func (m *BuildTaskMutation) OutputSize() (r int, exists bool) { + v := m.output_size + if v == nil { + return + } + return *v, true +} + +// OldOutputSize returns the old "output_size" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldOutputSize(ctx context.Context) (v int, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldOutputSize is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldOutputSize requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldOutputSize: %w", err) + } + return oldValue.OutputSize, nil +} + +// AddOutputSize adds i to the "output_size" field. +func (m *BuildTaskMutation) AddOutputSize(i int) { + if m.addoutput_size != nil { + *m.addoutput_size += i + } else { + m.addoutput_size = &i + } +} + +// AddedOutputSize returns the value that was added to the "output_size" field in this mutation. +func (m *BuildTaskMutation) AddedOutputSize() (r int, exists bool) { + v := m.addoutput_size + if v == nil { + return + } + return *v, true +} + +// ResetOutputSize resets all changes to the "output_size" field. +func (m *BuildTaskMutation) ResetOutputSize() { + m.output_size = nil + m.addoutput_size = nil +} + +// SetError sets the "error" field. +func (m *BuildTaskMutation) SetError(s string) { + m.error = &s +} + +// Error returns the value of the "error" field in the mutation. +func (m *BuildTaskMutation) Error() (r string, exists bool) { + v := m.error + if v == nil { + return + } + return *v, true +} + +// OldError returns the old "error" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldError(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldError is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldError requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldError: %w", err) + } + return oldValue.Error, nil +} + +// ClearError clears the value of the "error" field. +func (m *BuildTaskMutation) ClearError() { + m.error = nil + m.clearedFields[buildtask.FieldError] = struct{}{} +} + +// ErrorCleared returns if the "error" field was cleared in this mutation. +func (m *BuildTaskMutation) ErrorCleared() bool { + _, ok := m.clearedFields[buildtask.FieldError] + return ok +} + +// ResetError resets all changes to the "error" field. +func (m *BuildTaskMutation) ResetError() { + m.error = nil + delete(m.clearedFields, buildtask.FieldError) +} + +// SetErrorSize sets the "error_size" field. +func (m *BuildTaskMutation) SetErrorSize(i int) { + m.error_size = &i + m.adderror_size = nil +} + +// ErrorSize returns the value of the "error_size" field in the mutation. +func (m *BuildTaskMutation) ErrorSize() (r int, exists bool) { + v := m.error_size + if v == nil { + return + } + return *v, true +} + +// OldErrorSize returns the old "error_size" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldErrorSize(ctx context.Context) (v int, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldErrorSize is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldErrorSize requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldErrorSize: %w", err) + } + return oldValue.ErrorSize, nil +} + +// AddErrorSize adds i to the "error_size" field. +func (m *BuildTaskMutation) AddErrorSize(i int) { + if m.adderror_size != nil { + *m.adderror_size += i + } else { + m.adderror_size = &i + } +} + +// AddedErrorSize returns the value that was added to the "error_size" field in this mutation. +func (m *BuildTaskMutation) AddedErrorSize() (r int, exists bool) { + v := m.adderror_size + if v == nil { + return + } + return *v, true +} + +// ResetErrorSize resets all changes to the "error_size" field. +func (m *BuildTaskMutation) ResetErrorSize() { + m.error_size = nil + m.adderror_size = nil +} + +// SetExitCode sets the "exit_code" field. +func (m *BuildTaskMutation) SetExitCode(i int) { + m.exit_code = &i + m.addexit_code = nil +} + +// ExitCode returns the value of the "exit_code" field in the mutation. +func (m *BuildTaskMutation) ExitCode() (r int, exists bool) { + v := m.exit_code + if v == nil { + return + } + return *v, true +} + +// OldExitCode returns the old "exit_code" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldExitCode(ctx context.Context) (v *int, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldExitCode is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldExitCode requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldExitCode: %w", err) + } + return oldValue.ExitCode, nil +} + +// AddExitCode adds i to the "exit_code" field. +func (m *BuildTaskMutation) AddExitCode(i int) { + if m.addexit_code != nil { + *m.addexit_code += i + } else { + m.addexit_code = &i + } +} + +// AddedExitCode returns the value that was added to the "exit_code" field in this mutation. +func (m *BuildTaskMutation) AddedExitCode() (r int, exists bool) { + v := m.addexit_code + if v == nil { + return + } + return *v, true +} + +// ClearExitCode clears the value of the "exit_code" field. +func (m *BuildTaskMutation) ClearExitCode() { + m.exit_code = nil + m.addexit_code = nil + m.clearedFields[buildtask.FieldExitCode] = struct{}{} +} + +// ExitCodeCleared returns if the "exit_code" field was cleared in this mutation. +func (m *BuildTaskMutation) ExitCodeCleared() bool { + _, ok := m.clearedFields[buildtask.FieldExitCode] + return ok +} + +// ResetExitCode resets all changes to the "exit_code" field. +func (m *BuildTaskMutation) ResetExitCode() { + m.exit_code = nil + m.addexit_code = nil + delete(m.clearedFields, buildtask.FieldExitCode) +} + +// SetArtifactPath sets the "artifact_path" field. +func (m *BuildTaskMutation) SetArtifactPath(s string) { + m.artifact_path = &s +} + +// ArtifactPath returns the value of the "artifact_path" field in the mutation. +func (m *BuildTaskMutation) ArtifactPath() (r string, exists bool) { + v := m.artifact_path + if v == nil { + return + } + return *v, true +} + +// OldArtifactPath returns the old "artifact_path" field's value of the BuildTask entity. +// If the BuildTask object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuildTaskMutation) OldArtifactPath(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldArtifactPath is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldArtifactPath requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldArtifactPath: %w", err) + } + return oldValue.ArtifactPath, nil +} + +// ClearArtifactPath clears the value of the "artifact_path" field. +func (m *BuildTaskMutation) ClearArtifactPath() { + m.artifact_path = nil + m.clearedFields[buildtask.FieldArtifactPath] = struct{}{} +} + +// ArtifactPathCleared returns if the "artifact_path" field was cleared in this mutation. +func (m *BuildTaskMutation) ArtifactPathCleared() bool { + _, ok := m.clearedFields[buildtask.FieldArtifactPath] + return ok +} + +// ResetArtifactPath resets all changes to the "artifact_path" field. +func (m *BuildTaskMutation) ResetArtifactPath() { + m.artifact_path = nil + delete(m.clearedFields, buildtask.FieldArtifactPath) +} + +// SetBuilderID sets the "builder" edge to the Builder entity by id. +func (m *BuildTaskMutation) SetBuilderID(id int) { + m.builder = &id +} + +// ClearBuilder clears the "builder" edge to the Builder entity. +func (m *BuildTaskMutation) ClearBuilder() { + m.clearedbuilder = true +} + +// BuilderCleared reports if the "builder" edge to the Builder entity was cleared. +func (m *BuildTaskMutation) BuilderCleared() bool { + return m.clearedbuilder +} + +// BuilderID returns the "builder" edge ID in the mutation. +func (m *BuildTaskMutation) BuilderID() (id int, exists bool) { + if m.builder != nil { + return *m.builder, true + } + return +} + +// BuilderIDs returns the "builder" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// BuilderID instead. It exists only for internal usage by the builders. +func (m *BuildTaskMutation) BuilderIDs() (ids []int) { + if id := m.builder; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetBuilder resets all changes to the "builder" edge. +func (m *BuildTaskMutation) ResetBuilder() { + m.builder = nil + m.clearedbuilder = false +} + +// SetArtifactID sets the "artifact" edge to the Asset entity by id. +func (m *BuildTaskMutation) SetArtifactID(id int) { + m.artifact = &id +} + +// ClearArtifact clears the "artifact" edge to the Asset entity. +func (m *BuildTaskMutation) ClearArtifact() { + m.clearedartifact = true +} + +// ArtifactCleared reports if the "artifact" edge to the Asset entity was cleared. +func (m *BuildTaskMutation) ArtifactCleared() bool { + return m.clearedartifact +} + +// ArtifactID returns the "artifact" edge ID in the mutation. +func (m *BuildTaskMutation) ArtifactID() (id int, exists bool) { + if m.artifact != nil { + return *m.artifact, true + } + return +} + +// ArtifactIDs returns the "artifact" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// ArtifactID instead. It exists only for internal usage by the builders. +func (m *BuildTaskMutation) ArtifactIDs() (ids []int) { + if id := m.artifact; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetArtifact resets all changes to the "artifact" edge. +func (m *BuildTaskMutation) ResetArtifact() { + m.artifact = nil + m.clearedartifact = false +} + +// Where appends a list predicates to the BuildTaskMutation builder. +func (m *BuildTaskMutation) Where(ps ...predicate.BuildTask) { + m.predicates = append(m.predicates, ps...) +} + +// WhereP appends storage-level predicates to the BuildTaskMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *BuildTaskMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.BuildTask, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *BuildTaskMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *BuildTaskMutation) SetOp(op Op) { + m.op = op +} + +// Type returns the node type of this mutation (BuildTask). +func (m *BuildTaskMutation) Type() string { + return m.typ +} + +// Fields returns all fields that were changed during this mutation. Note that in +// order to get all numeric fields that were incremented/decremented, call +// AddedFields(). +func (m *BuildTaskMutation) Fields() []string { + fields := make([]string, 0, 19) + if m.created_at != nil { + fields = append(fields, buildtask.FieldCreatedAt) + } + if m.last_modified_at != nil { + fields = append(fields, buildtask.FieldLastModifiedAt) + } + if m.target_os != nil { + fields = append(fields, buildtask.FieldTargetOs) + } + if m.target_format != nil { + fields = append(fields, buildtask.FieldTargetFormat) + } + if m.build_image != nil { + fields = append(fields, buildtask.FieldBuildImage) + } + if m.build_script != nil { + fields = append(fields, buildtask.FieldBuildScript) + } + if m.callback_uri != nil { + fields = append(fields, buildtask.FieldCallbackURI) + } + if m.interval != nil { + fields = append(fields, buildtask.FieldInterval) + } + if m.transport_type != nil { + fields = append(fields, buildtask.FieldTransportType) + } + if m.extra != nil { + fields = append(fields, buildtask.FieldExtra) + } + if m.claimed_at != nil { + fields = append(fields, buildtask.FieldClaimedAt) + } + if m.started_at != nil { + fields = append(fields, buildtask.FieldStartedAt) + } + if m.finished_at != nil { + fields = append(fields, buildtask.FieldFinishedAt) + } + if m.output != nil { + fields = append(fields, buildtask.FieldOutput) + } + if m.output_size != nil { + fields = append(fields, buildtask.FieldOutputSize) + } + if m.error != nil { + fields = append(fields, buildtask.FieldError) + } + if m.error_size != nil { + fields = append(fields, buildtask.FieldErrorSize) + } + if m.exit_code != nil { + fields = append(fields, buildtask.FieldExitCode) + } + if m.artifact_path != nil { + fields = append(fields, buildtask.FieldArtifactPath) + } + return fields +} + +// Field returns the value of a field with the given name. The second boolean +// return value indicates that this field was not set, or was not defined in the +// schema. +func (m *BuildTaskMutation) Field(name string) (ent.Value, bool) { + switch name { + case buildtask.FieldCreatedAt: + return m.CreatedAt() + case buildtask.FieldLastModifiedAt: + return m.LastModifiedAt() + case buildtask.FieldTargetOs: + return m.TargetOs() + case buildtask.FieldTargetFormat: + return m.TargetFormat() + case buildtask.FieldBuildImage: + return m.BuildImage() + case buildtask.FieldBuildScript: + return m.BuildScript() + case buildtask.FieldCallbackURI: + return m.CallbackURI() + case buildtask.FieldInterval: + return m.Interval() + case buildtask.FieldTransportType: + return m.TransportType() + case buildtask.FieldExtra: + return m.Extra() + case buildtask.FieldClaimedAt: + return m.ClaimedAt() + case buildtask.FieldStartedAt: + return m.StartedAt() + case buildtask.FieldFinishedAt: + return m.FinishedAt() + case buildtask.FieldOutput: + return m.Output() + case buildtask.FieldOutputSize: + return m.OutputSize() + case buildtask.FieldError: + return m.Error() + case buildtask.FieldErrorSize: + return m.ErrorSize() + case buildtask.FieldExitCode: + return m.ExitCode() + case buildtask.FieldArtifactPath: + return m.ArtifactPath() + } + return nil, false +} + +// OldField returns the old value of the field from the database. An error is +// returned if the mutation operation is not UpdateOne, or the query to the +// database failed. +func (m *BuildTaskMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + switch name { + case buildtask.FieldCreatedAt: + return m.OldCreatedAt(ctx) + case buildtask.FieldLastModifiedAt: + return m.OldLastModifiedAt(ctx) + case buildtask.FieldTargetOs: + return m.OldTargetOs(ctx) + case buildtask.FieldTargetFormat: + return m.OldTargetFormat(ctx) + case buildtask.FieldBuildImage: + return m.OldBuildImage(ctx) + case buildtask.FieldBuildScript: + return m.OldBuildScript(ctx) + case buildtask.FieldCallbackURI: + return m.OldCallbackURI(ctx) + case buildtask.FieldInterval: + return m.OldInterval(ctx) + case buildtask.FieldTransportType: + return m.OldTransportType(ctx) + case buildtask.FieldExtra: + return m.OldExtra(ctx) + case buildtask.FieldClaimedAt: + return m.OldClaimedAt(ctx) + case buildtask.FieldStartedAt: + return m.OldStartedAt(ctx) + case buildtask.FieldFinishedAt: + return m.OldFinishedAt(ctx) + case buildtask.FieldOutput: + return m.OldOutput(ctx) + case buildtask.FieldOutputSize: + return m.OldOutputSize(ctx) + case buildtask.FieldError: + return m.OldError(ctx) + case buildtask.FieldErrorSize: + return m.OldErrorSize(ctx) + case buildtask.FieldExitCode: + return m.OldExitCode(ctx) + case buildtask.FieldArtifactPath: + return m.OldArtifactPath(ctx) + } + return nil, fmt.Errorf("unknown BuildTask field %s", name) +} + +// SetField sets the value of a field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *BuildTaskMutation) SetField(name string, value ent.Value) error { + switch name { + case buildtask.FieldCreatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedAt(v) + return nil + case buildtask.FieldLastModifiedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetLastModifiedAt(v) + return nil + case buildtask.FieldTargetOs: + v, ok := value.(c2pb.Host_Platform) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTargetOs(v) + return nil + case buildtask.FieldTargetFormat: + v, ok := value.(builderpb.TargetFormat) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTargetFormat(v) + return nil + case buildtask.FieldBuildImage: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetBuildImage(v) + return nil + case buildtask.FieldBuildScript: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetBuildScript(v) + return nil + case buildtask.FieldCallbackURI: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCallbackURI(v) + return nil + case buildtask.FieldInterval: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetInterval(v) + return nil + case buildtask.FieldTransportType: + v, ok := value.(c2pb.Transport_Type) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTransportType(v) + return nil + case buildtask.FieldExtra: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetExtra(v) + return nil + case buildtask.FieldClaimedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetClaimedAt(v) + return nil + case buildtask.FieldStartedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStartedAt(v) + return nil + case buildtask.FieldFinishedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetFinishedAt(v) + return nil + case buildtask.FieldOutput: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetOutput(v) + return nil + case buildtask.FieldOutputSize: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetOutputSize(v) + return nil + case buildtask.FieldError: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetError(v) + return nil + case buildtask.FieldErrorSize: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetErrorSize(v) + return nil + case buildtask.FieldExitCode: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetExitCode(v) + return nil + case buildtask.FieldArtifactPath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetArtifactPath(v) + return nil + } + return fmt.Errorf("unknown BuildTask field %s", name) +} + +// AddedFields returns all numeric fields that were incremented/decremented during +// this mutation. +func (m *BuildTaskMutation) AddedFields() []string { + var fields []string + if m.addinterval != nil { + fields = append(fields, buildtask.FieldInterval) + } + if m.addoutput_size != nil { + fields = append(fields, buildtask.FieldOutputSize) + } + if m.adderror_size != nil { + fields = append(fields, buildtask.FieldErrorSize) + } + if m.addexit_code != nil { + fields = append(fields, buildtask.FieldExitCode) + } + return fields +} + +// AddedField returns the numeric value that was incremented/decremented on a field +// with the given name. The second boolean return value indicates that this field +// was not set, or was not defined in the schema. +func (m *BuildTaskMutation) AddedField(name string) (ent.Value, bool) { + switch name { + case buildtask.FieldInterval: + return m.AddedInterval() + case buildtask.FieldOutputSize: + return m.AddedOutputSize() + case buildtask.FieldErrorSize: + return m.AddedErrorSize() + case buildtask.FieldExitCode: + return m.AddedExitCode() + } + return nil, false +} + +// AddField adds the value to the field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *BuildTaskMutation) AddField(name string, value ent.Value) error { + switch name { + case buildtask.FieldInterval: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.AddInterval(v) + return nil + case buildtask.FieldOutputSize: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.AddOutputSize(v) + return nil + case buildtask.FieldErrorSize: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.AddErrorSize(v) + return nil + case buildtask.FieldExitCode: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.AddExitCode(v) + return nil + } + return fmt.Errorf("unknown BuildTask numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared during this +// mutation. +func (m *BuildTaskMutation) ClearedFields() []string { + var fields []string + if m.FieldCleared(buildtask.FieldExtra) { + fields = append(fields, buildtask.FieldExtra) + } + if m.FieldCleared(buildtask.FieldClaimedAt) { + fields = append(fields, buildtask.FieldClaimedAt) + } + if m.FieldCleared(buildtask.FieldStartedAt) { + fields = append(fields, buildtask.FieldStartedAt) + } + if m.FieldCleared(buildtask.FieldFinishedAt) { + fields = append(fields, buildtask.FieldFinishedAt) + } + if m.FieldCleared(buildtask.FieldOutput) { + fields = append(fields, buildtask.FieldOutput) + } + if m.FieldCleared(buildtask.FieldError) { + fields = append(fields, buildtask.FieldError) + } + if m.FieldCleared(buildtask.FieldExitCode) { + fields = append(fields, buildtask.FieldExitCode) + } + if m.FieldCleared(buildtask.FieldArtifactPath) { + fields = append(fields, buildtask.FieldArtifactPath) + } + return fields +} + +// FieldCleared returns a boolean indicating if a field with the given name was +// cleared in this mutation. +func (m *BuildTaskMutation) FieldCleared(name string) bool { + _, ok := m.clearedFields[name] + return ok +} + +// ClearField clears the value of the field with the given name. It returns an +// error if the field is not defined in the schema. +func (m *BuildTaskMutation) ClearField(name string) error { + switch name { + case buildtask.FieldExtra: + m.ClearExtra() + return nil + case buildtask.FieldClaimedAt: + m.ClearClaimedAt() + return nil + case buildtask.FieldStartedAt: + m.ClearStartedAt() + return nil + case buildtask.FieldFinishedAt: + m.ClearFinishedAt() + return nil + case buildtask.FieldOutput: + m.ClearOutput() + return nil + case buildtask.FieldError: + m.ClearError() + return nil + case buildtask.FieldExitCode: + m.ClearExitCode() + return nil + case buildtask.FieldArtifactPath: + m.ClearArtifactPath() + return nil + } + return fmt.Errorf("unknown BuildTask nullable field %s", name) +} + +// ResetField resets all changes in the mutation for the field with the given name. +// It returns an error if the field is not defined in the schema. +func (m *BuildTaskMutation) ResetField(name string) error { + switch name { + case buildtask.FieldCreatedAt: + m.ResetCreatedAt() + return nil + case buildtask.FieldLastModifiedAt: + m.ResetLastModifiedAt() + return nil + case buildtask.FieldTargetOs: + m.ResetTargetOs() + return nil + case buildtask.FieldTargetFormat: + m.ResetTargetFormat() + return nil + case buildtask.FieldBuildImage: + m.ResetBuildImage() + return nil + case buildtask.FieldBuildScript: + m.ResetBuildScript() + return nil + case buildtask.FieldCallbackURI: + m.ResetCallbackURI() + return nil + case buildtask.FieldInterval: + m.ResetInterval() + return nil + case buildtask.FieldTransportType: + m.ResetTransportType() + return nil + case buildtask.FieldExtra: + m.ResetExtra() + return nil + case buildtask.FieldClaimedAt: + m.ResetClaimedAt() + return nil + case buildtask.FieldStartedAt: + m.ResetStartedAt() + return nil + case buildtask.FieldFinishedAt: + m.ResetFinishedAt() + return nil + case buildtask.FieldOutput: + m.ResetOutput() + return nil + case buildtask.FieldOutputSize: + m.ResetOutputSize() + return nil + case buildtask.FieldError: + m.ResetError() + return nil + case buildtask.FieldErrorSize: + m.ResetErrorSize() + return nil + case buildtask.FieldExitCode: + m.ResetExitCode() + return nil + case buildtask.FieldArtifactPath: + m.ResetArtifactPath() + return nil + } + return fmt.Errorf("unknown BuildTask field %s", name) +} + +// AddedEdges returns all edge names that were set/added in this mutation. +func (m *BuildTaskMutation) AddedEdges() []string { + edges := make([]string, 0, 2) + if m.builder != nil { + edges = append(edges, buildtask.EdgeBuilder) + } + if m.artifact != nil { + edges = append(edges, buildtask.EdgeArtifact) + } + return edges +} + +// AddedIDs returns all IDs (to other nodes) that were added for the given edge +// name in this mutation. +func (m *BuildTaskMutation) AddedIDs(name string) []ent.Value { + switch name { + case buildtask.EdgeBuilder: + if id := m.builder; id != nil { + return []ent.Value{*id} + } + case buildtask.EdgeArtifact: + if id := m.artifact; id != nil { + return []ent.Value{*id} + } + } + return nil +} + +// RemovedEdges returns all edge names that were removed in this mutation. +func (m *BuildTaskMutation) RemovedEdges() []string { + edges := make([]string, 0, 2) + return edges +} + +// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with +// the given name in this mutation. +func (m *BuildTaskMutation) RemovedIDs(name string) []ent.Value { + return nil +} + +// ClearedEdges returns all edge names that were cleared in this mutation. +func (m *BuildTaskMutation) ClearedEdges() []string { + edges := make([]string, 0, 2) + if m.clearedbuilder { + edges = append(edges, buildtask.EdgeBuilder) + } + if m.clearedartifact { + edges = append(edges, buildtask.EdgeArtifact) + } + return edges +} + +// EdgeCleared returns a boolean which indicates if the edge with the given name +// was cleared in this mutation. +func (m *BuildTaskMutation) EdgeCleared(name string) bool { + switch name { + case buildtask.EdgeBuilder: + return m.clearedbuilder + case buildtask.EdgeArtifact: + return m.clearedartifact + } + return false +} + +// ClearEdge clears the value of the edge with the given name. It returns an error +// if that edge is not defined in the schema. +func (m *BuildTaskMutation) ClearEdge(name string) error { + switch name { + case buildtask.EdgeBuilder: + m.ClearBuilder() + return nil + case buildtask.EdgeArtifact: + m.ClearArtifact() + return nil + } + return fmt.Errorf("unknown BuildTask unique edge %s", name) +} + +// ResetEdge resets all changes to the edge with the given name in this mutation. +// It returns an error if the edge is not defined in the schema. +func (m *BuildTaskMutation) ResetEdge(name string) error { + switch name { + case buildtask.EdgeBuilder: + m.ResetBuilder() + return nil + case buildtask.EdgeArtifact: + m.ResetArtifact() + return nil + } + return fmt.Errorf("unknown BuildTask edge %s", name) +} + // BuilderMutation represents an operation that mutates the Builder nodes in the graph. type BuilderMutation struct { config @@ -2120,7 +3838,11 @@ type BuilderMutation struct { supported_targets *[]c2pb.Host_Platform appendsupported_targets []c2pb.Host_Platform upstream *string + last_seen_at *time.Time clearedFields map[string]struct{} + build_tasks map[int]struct{} + removedbuild_tasks map[int]struct{} + clearedbuild_tasks bool done bool oldValue func(context.Context) (*Builder, error) predicates []predicate.Builder @@ -2419,6 +4141,109 @@ func (m *BuilderMutation) ResetUpstream() { m.upstream = nil } +// SetLastSeenAt sets the "last_seen_at" field. +func (m *BuilderMutation) SetLastSeenAt(t time.Time) { + m.last_seen_at = &t +} + +// LastSeenAt returns the value of the "last_seen_at" field in the mutation. +func (m *BuilderMutation) LastSeenAt() (r time.Time, exists bool) { + v := m.last_seen_at + if v == nil { + return + } + return *v, true +} + +// OldLastSeenAt returns the old "last_seen_at" field's value of the Builder entity. +// If the Builder object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BuilderMutation) OldLastSeenAt(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldLastSeenAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldLastSeenAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldLastSeenAt: %w", err) + } + return oldValue.LastSeenAt, nil +} + +// ClearLastSeenAt clears the value of the "last_seen_at" field. +func (m *BuilderMutation) ClearLastSeenAt() { + m.last_seen_at = nil + m.clearedFields[builder.FieldLastSeenAt] = struct{}{} +} + +// LastSeenAtCleared returns if the "last_seen_at" field was cleared in this mutation. +func (m *BuilderMutation) LastSeenAtCleared() bool { + _, ok := m.clearedFields[builder.FieldLastSeenAt] + return ok +} + +// ResetLastSeenAt resets all changes to the "last_seen_at" field. +func (m *BuilderMutation) ResetLastSeenAt() { + m.last_seen_at = nil + delete(m.clearedFields, builder.FieldLastSeenAt) +} + +// AddBuildTaskIDs adds the "build_tasks" edge to the BuildTask entity by ids. +func (m *BuilderMutation) AddBuildTaskIDs(ids ...int) { + if m.build_tasks == nil { + m.build_tasks = make(map[int]struct{}) + } + for i := range ids { + m.build_tasks[ids[i]] = struct{}{} + } +} + +// ClearBuildTasks clears the "build_tasks" edge to the BuildTask entity. +func (m *BuilderMutation) ClearBuildTasks() { + m.clearedbuild_tasks = true +} + +// BuildTasksCleared reports if the "build_tasks" edge to the BuildTask entity was cleared. +func (m *BuilderMutation) BuildTasksCleared() bool { + return m.clearedbuild_tasks +} + +// RemoveBuildTaskIDs removes the "build_tasks" edge to the BuildTask entity by IDs. +func (m *BuilderMutation) RemoveBuildTaskIDs(ids ...int) { + if m.removedbuild_tasks == nil { + m.removedbuild_tasks = make(map[int]struct{}) + } + for i := range ids { + delete(m.build_tasks, ids[i]) + m.removedbuild_tasks[ids[i]] = struct{}{} + } +} + +// RemovedBuildTasks returns the removed IDs of the "build_tasks" edge to the BuildTask entity. +func (m *BuilderMutation) RemovedBuildTasksIDs() (ids []int) { + for id := range m.removedbuild_tasks { + ids = append(ids, id) + } + return +} + +// BuildTasksIDs returns the "build_tasks" edge IDs in the mutation. +func (m *BuilderMutation) BuildTasksIDs() (ids []int) { + for id := range m.build_tasks { + ids = append(ids, id) + } + return +} + +// ResetBuildTasks resets all changes to the "build_tasks" edge. +func (m *BuilderMutation) ResetBuildTasks() { + m.build_tasks = nil + m.clearedbuild_tasks = false + m.removedbuild_tasks = nil +} + // Where appends a list predicates to the BuilderMutation builder. func (m *BuilderMutation) Where(ps ...predicate.Builder) { m.predicates = append(m.predicates, ps...) @@ -2453,7 +4278,7 @@ func (m *BuilderMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *BuilderMutation) Fields() []string { - fields := make([]string, 0, 5) + fields := make([]string, 0, 6) if m.created_at != nil { fields = append(fields, builder.FieldCreatedAt) } @@ -2469,6 +4294,9 @@ func (m *BuilderMutation) Fields() []string { if m.upstream != nil { fields = append(fields, builder.FieldUpstream) } + if m.last_seen_at != nil { + fields = append(fields, builder.FieldLastSeenAt) + } return fields } @@ -2487,6 +4315,8 @@ func (m *BuilderMutation) Field(name string) (ent.Value, bool) { return m.SupportedTargets() case builder.FieldUpstream: return m.Upstream() + case builder.FieldLastSeenAt: + return m.LastSeenAt() } return nil, false } @@ -2506,6 +4336,8 @@ func (m *BuilderMutation) OldField(ctx context.Context, name string) (ent.Value, return m.OldSupportedTargets(ctx) case builder.FieldUpstream: return m.OldUpstream(ctx) + case builder.FieldLastSeenAt: + return m.OldLastSeenAt(ctx) } return nil, fmt.Errorf("unknown Builder field %s", name) } @@ -2550,6 +4382,13 @@ func (m *BuilderMutation) SetField(name string, value ent.Value) error { } m.SetUpstream(v) return nil + case builder.FieldLastSeenAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetLastSeenAt(v) + return nil } return fmt.Errorf("unknown Builder field %s", name) } @@ -2579,7 +4418,11 @@ func (m *BuilderMutation) AddField(name string, value ent.Value) error { // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *BuilderMutation) ClearedFields() []string { - return nil + var fields []string + if m.FieldCleared(builder.FieldLastSeenAt) { + fields = append(fields, builder.FieldLastSeenAt) + } + return fields } // FieldCleared returns a boolean indicating if a field with the given name was @@ -2592,6 +4435,11 @@ func (m *BuilderMutation) FieldCleared(name string) bool { // ClearField clears the value of the field with the given name. It returns an // error if the field is not defined in the schema. func (m *BuilderMutation) ClearField(name string) error { + switch name { + case builder.FieldLastSeenAt: + m.ClearLastSeenAt() + return nil + } return fmt.Errorf("unknown Builder nullable field %s", name) } @@ -2614,55 +4462,94 @@ func (m *BuilderMutation) ResetField(name string) error { case builder.FieldUpstream: m.ResetUpstream() return nil + case builder.FieldLastSeenAt: + m.ResetLastSeenAt() + return nil } return fmt.Errorf("unknown Builder field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *BuilderMutation) AddedEdges() []string { - edges := make([]string, 0, 0) + edges := make([]string, 0, 1) + if m.build_tasks != nil { + edges = append(edges, builder.EdgeBuildTasks) + } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *BuilderMutation) AddedIDs(name string) []ent.Value { + switch name { + case builder.EdgeBuildTasks: + ids := make([]ent.Value, 0, len(m.build_tasks)) + for id := range m.build_tasks { + ids = append(ids, id) + } + return ids + } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *BuilderMutation) RemovedEdges() []string { - edges := make([]string, 0, 0) + edges := make([]string, 0, 1) + if m.removedbuild_tasks != nil { + edges = append(edges, builder.EdgeBuildTasks) + } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. func (m *BuilderMutation) RemovedIDs(name string) []ent.Value { + switch name { + case builder.EdgeBuildTasks: + ids := make([]ent.Value, 0, len(m.removedbuild_tasks)) + for id := range m.removedbuild_tasks { + ids = append(ids, id) + } + return ids + } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *BuilderMutation) ClearedEdges() []string { - edges := make([]string, 0, 0) + edges := make([]string, 0, 1) + if m.clearedbuild_tasks { + edges = append(edges, builder.EdgeBuildTasks) + } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *BuilderMutation) EdgeCleared(name string) bool { + switch name { + case builder.EdgeBuildTasks: + return m.clearedbuild_tasks + } return false } // ClearEdge clears the value of the edge with the given name. It returns an error // if that edge is not defined in the schema. func (m *BuilderMutation) ClearEdge(name string) error { + switch name { + } return fmt.Errorf("unknown Builder unique edge %s", name) } // ResetEdge resets all changes to the edge with the given name in this mutation. // It returns an error if the edge is not defined in the schema. func (m *BuilderMutation) ResetEdge(name string) error { + switch name { + case builder.EdgeBuildTasks: + m.ResetBuildTasks() + return nil + } return fmt.Errorf("unknown Builder edge %s", name) } diff --git a/tavern/internal/ent/predicate/predicate.go b/tavern/internal/ent/predicate/predicate.go index 307d53f64..664394ea2 100644 --- a/tavern/internal/ent/predicate/predicate.go +++ b/tavern/internal/ent/predicate/predicate.go @@ -12,6 +12,9 @@ type Asset func(*sql.Selector) // Beacon is the predicate function for beacon builders. type Beacon func(*sql.Selector) +// BuildTask is the predicate function for buildtask builders. +type BuildTask func(*sql.Selector) + // Builder is the predicate function for builder builders. type Builder func(*sql.Selector) diff --git a/tavern/internal/ent/privacy/privacy.go b/tavern/internal/ent/privacy/privacy.go index 28cc3463a..02362ab95 100644 --- a/tavern/internal/ent/privacy/privacy.go +++ b/tavern/internal/ent/privacy/privacy.go @@ -158,6 +158,30 @@ func (f BeaconMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.BeaconMutation", m) } +// The BuildTaskQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type BuildTaskQueryRuleFunc func(context.Context, *ent.BuildTaskQuery) error + +// EvalQuery return f(ctx, q). +func (f BuildTaskQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.BuildTaskQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.BuildTaskQuery", q) +} + +// The BuildTaskMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type BuildTaskMutationRuleFunc func(context.Context, *ent.BuildTaskMutation) error + +// EvalMutation calls f(ctx, m). +func (f BuildTaskMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.BuildTaskMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.BuildTaskMutation", m) +} + // The BuilderQueryRuleFunc type is an adapter to allow the use of ordinary // functions as a query rule. type BuilderQueryRuleFunc func(context.Context, *ent.BuilderQuery) error diff --git a/tavern/internal/ent/runtime/runtime.go b/tavern/internal/ent/runtime/runtime.go index b6a41a928..cec37f06c 100644 --- a/tavern/internal/ent/runtime/runtime.go +++ b/tavern/internal/ent/runtime/runtime.go @@ -8,6 +8,7 @@ import ( "realm.pub/tavern/internal/ent/asset" "realm.pub/tavern/internal/ent/beacon" "realm.pub/tavern/internal/ent/builder" + "realm.pub/tavern/internal/ent/buildtask" "realm.pub/tavern/internal/ent/host" "realm.pub/tavern/internal/ent/hostcredential" "realm.pub/tavern/internal/ent/hostfile" @@ -94,6 +95,51 @@ func init() { beaconDescAgentIdentifier := beaconFields[3].Descriptor() // beacon.AgentIdentifierValidator is a validator for the "agent_identifier" field. It is called by the builders before save. beacon.AgentIdentifierValidator = beaconDescAgentIdentifier.Validators[0].(func(string) error) + buildtaskMixin := schema.BuildTask{}.Mixin() + buildtaskHooks := schema.BuildTask{}.Hooks() + buildtask.Hooks[0] = buildtaskHooks[0] + buildtaskMixinFields0 := buildtaskMixin[0].Fields() + _ = buildtaskMixinFields0 + buildtaskFields := schema.BuildTask{}.Fields() + _ = buildtaskFields + // buildtaskDescCreatedAt is the schema descriptor for created_at field. + buildtaskDescCreatedAt := buildtaskMixinFields0[0].Descriptor() + // buildtask.DefaultCreatedAt holds the default value on creation for the created_at field. + buildtask.DefaultCreatedAt = buildtaskDescCreatedAt.Default.(func() time.Time) + // buildtaskDescLastModifiedAt is the schema descriptor for last_modified_at field. + buildtaskDescLastModifiedAt := buildtaskMixinFields0[1].Descriptor() + // buildtask.DefaultLastModifiedAt holds the default value on creation for the last_modified_at field. + buildtask.DefaultLastModifiedAt = buildtaskDescLastModifiedAt.Default.(func() time.Time) + // buildtask.UpdateDefaultLastModifiedAt holds the default value on update for the last_modified_at field. + buildtask.UpdateDefaultLastModifiedAt = buildtaskDescLastModifiedAt.UpdateDefault.(func() time.Time) + // buildtaskDescBuildImage is the schema descriptor for build_image field. + buildtaskDescBuildImage := buildtaskFields[2].Descriptor() + // buildtask.BuildImageValidator is a validator for the "build_image" field. It is called by the builders before save. + buildtask.BuildImageValidator = buildtaskDescBuildImage.Validators[0].(func(string) error) + // buildtaskDescBuildScript is the schema descriptor for build_script field. + buildtaskDescBuildScript := buildtaskFields[3].Descriptor() + // buildtask.BuildScriptValidator is a validator for the "build_script" field. It is called by the builders before save. + buildtask.BuildScriptValidator = buildtaskDescBuildScript.Validators[0].(func(string) error) + // buildtaskDescCallbackURI is the schema descriptor for callback_uri field. + buildtaskDescCallbackURI := buildtaskFields[4].Descriptor() + // buildtask.CallbackURIValidator is a validator for the "callback_uri" field. It is called by the builders before save. + buildtask.CallbackURIValidator = buildtaskDescCallbackURI.Validators[0].(func(string) error) + // buildtaskDescInterval is the schema descriptor for interval field. + buildtaskDescInterval := buildtaskFields[5].Descriptor() + // buildtask.DefaultInterval holds the default value on creation for the interval field. + buildtask.DefaultInterval = buildtaskDescInterval.Default.(int) + // buildtaskDescOutputSize is the schema descriptor for output_size field. + buildtaskDescOutputSize := buildtaskFields[12].Descriptor() + // buildtask.DefaultOutputSize holds the default value on creation for the output_size field. + buildtask.DefaultOutputSize = buildtaskDescOutputSize.Default.(int) + // buildtask.OutputSizeValidator is a validator for the "output_size" field. It is called by the builders before save. + buildtask.OutputSizeValidator = buildtaskDescOutputSize.Validators[0].(func(int) error) + // buildtaskDescErrorSize is the schema descriptor for error_size field. + buildtaskDescErrorSize := buildtaskFields[14].Descriptor() + // buildtask.DefaultErrorSize holds the default value on creation for the error_size field. + buildtask.DefaultErrorSize = buildtaskDescErrorSize.Default.(int) + // buildtask.ErrorSizeValidator is a validator for the "error_size" field. It is called by the builders before save. + buildtask.ErrorSizeValidator = buildtaskDescErrorSize.Validators[0].(func(int) error) builderMixin := schema.Builder{}.Mixin() builderMixinFields0 := builderMixin[0].Fields() _ = builderMixinFields0 diff --git a/tavern/internal/ent/schema/build_task.go b/tavern/internal/ent/schema/build_task.go new file mode 100644 index 000000000..3179dd116 --- /dev/null +++ b/tavern/internal/ent/schema/build_task.go @@ -0,0 +1,193 @@ +package schema + +import ( + "context" + "fmt" + + "entgo.io/contrib/entgql" + "entgo.io/ent" + "entgo.io/ent/dialect" + "entgo.io/ent/dialect/entsql" + "entgo.io/ent/schema" + "entgo.io/ent/schema/edge" + "entgo.io/ent/schema/field" + "realm.pub/tavern/internal/builder/builderpb" + "realm.pub/tavern/internal/c2/c2pb" + "realm.pub/tavern/internal/ent/hook" +) + +// BuildTask holds the schema definition for the BuildTask entity. +type BuildTask struct { + ent.Schema +} + +// Fields of the BuildTask. +func (BuildTask) Fields() []ent.Field { + return []ent.Field{ + field.Enum("target_os"). + GoType(c2pb.Host_Platform(0)). + Annotations( + entgql.Type("HostPlatform"), + entgql.OrderField("TARGET_OS"), + ). + Comment("The target operating system platform for this build."), + field.Enum("target_format"). + GoType(builderpb.TargetFormat(0)). + Annotations( + entgql.Type("BuildTaskTargetFormat"), + ). + Comment("The output format for the build (BIN, CDYLIB, WINDOWS_SERVICE)."), + field.String("build_image"). + NotEmpty(). + Comment("Docker container image name to use for the build."), + field.Text("build_script"). + NotEmpty(). + SchemaType(map[string]string{ + dialect.MySQL: "LONGTEXT", + }). + Annotations( + entgql.Skip(entgql.SkipMutationCreateInput), + ). + Comment("The derived script to execute inside the build container."), + field.String("callback_uri"). + NotEmpty(). + Comment("The callback URI for the IMIX agent to connect to."), + field.Int("interval"). + Default(5). + Comment("The callback interval in seconds for the IMIX agent."), + field.Enum("transport_type"). + GoType(c2pb.Transport_Type(0)). + Annotations( + entgql.Type("BeaconTransport_Type"), + ). + Comment("The transport type for the IMIX agent."), + field.String("extra"). + Optional(). + Comment("Extra transport configuration for the IMIX agent."), + field.Time("claimed_at"). + Optional(). + Annotations( + entgql.OrderField("CLAIMED_AT"), + ). + Comment("Timestamp of when a builder claimed this task, null if unclaimed."), + field.Time("started_at"). + Optional(). + Annotations( + entgql.OrderField("STARTED_AT"), + ). + Comment("Timestamp of when the build execution started, null if not yet started."), + field.Time("finished_at"). + Optional(). + Annotations( + entgql.OrderField("FINISHED_AT"), + ). + Comment("Timestamp of when the build finished, null if not yet finished."), + field.Text("output"). + Optional(). + SchemaType(map[string]string{ + dialect.MySQL: "LONGTEXT", + }). + Comment("Output from the build execution."), + field.Int("output_size"). + Default(0). + Min(0). + Annotations( + entgql.OrderField("OUTPUT_SIZE"), + ). + Comment("The size of the output in bytes"), + field.Text("error"). + Optional(). + SchemaType(map[string]string{ + dialect.MySQL: "LONGTEXT", + }). + Comment("Error message if the build failed."), + field.Int("error_size"). + Default(0). + Min(0). + Annotations( + entgql.OrderField("ERROR_SIZE"), + ). + Comment("The size of the error in bytes"), + field.Int("exit_code"). + Optional(). + Nillable(). + Annotations( + entgql.OrderField("EXIT_CODE"), + ). + Comment("Exit code from the build container process. Null if the build has not finished."), + field.String("artifact_path"). + Optional(). + Annotations( + entgql.Skip(entgql.SkipMutationCreateInput), + ). + Comment("Path inside the container where the build artifact is located. Derived from target_os if not set."), + } +} + +// Edges of the BuildTask. +func (BuildTask) Edges() []ent.Edge { + return []ent.Edge{ + edge.To("builder", Builder.Type). + Annotations( + entsql.OnDelete(entsql.Cascade), + ). + Required(). + Unique(). + Comment("The builder assigned to execute this build task."), + edge.To("artifact", Asset.Type). + Unique(). + Comment("The compiled artifact produced by this build task, stored as an Asset."), + } +} + +// Annotations describes additional information for the ent. +func (BuildTask) Annotations() []schema.Annotation { + return []schema.Annotation{ + entgql.RelayConnection(), + entgql.MultiOrder(), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, + } +} + +// Mixin defines common shared properties for the ent. +func (BuildTask) Mixin() []ent.Mixin { + return []ent.Mixin{ + MixinHistory{}, // created_at, last_modified_at + } +} + +// Hooks defines middleware for mutations for the ent. +func (BuildTask) Hooks() []ent.Hook { + return []ent.Hook{ + hook.On(HookDeriveBuildTaskInfo(), ent.OpCreate|ent.OpUpdate|ent.OpUpdateOne), + } +} + +// HookDeriveBuildTaskInfo will update build task info (e.g. output_size, error_size) whenever it is mutated. +func HookDeriveBuildTaskInfo() ent.Hook { + type btMutation interface { + Output() (string, bool) + SetOutputSize(i int) + Error() (string, bool) + SetErrorSize(i int) + } + + return func(next ent.Mutator) ent.Mutator { + return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { + bt, ok := m.(btMutation) + if !ok { + return nil, fmt.Errorf("expected build task mutation in schema hook, got: %+v", m) + } + + output, _ := bt.Output() + bt.SetOutputSize(len([]byte(output))) + + errStr, _ := bt.Error() + bt.SetErrorSize(len([]byte(errStr))) + + return next.Mutate(ctx, m) + }) + } +} diff --git a/tavern/internal/ent/schema/builder.go b/tavern/internal/ent/schema/builder.go index 7fee66808..8a495fe59 100644 --- a/tavern/internal/ent/schema/builder.go +++ b/tavern/internal/ent/schema/builder.go @@ -7,6 +7,7 @@ import ( "entgo.io/ent" "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" + "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "realm.pub/tavern/internal/c2/c2pb" ) @@ -20,7 +21,7 @@ type Builder struct { func (Builder) Fields() []ent.Field { return []ent.Field{ field.String("identifier"). - DefaultFunc(uuid.New().String). + DefaultFunc(func() string { return uuid.New().String() }). NotEmpty(). Unique(). Immutable(). @@ -35,12 +36,28 @@ func (Builder) Fields() []ent.Field { Comment("The platforms this builder can build agents for."), field.String("upstream"). Comment("The server address that the builder should connect to."), + field.Time("last_seen_at"). + Optional(). + Nillable(). + Annotations( + entgql.OrderField("LAST_SEEN_AT"), + entgql.Skip(entgql.SkipMutationCreateInput), + ). + Comment("Timestamp of the builder's last ClaimBuildTasks call. Null if never seen."), } } // Edges of the Builder. func (Builder) Edges() []ent.Edge { - return nil + return []ent.Edge{ + edge.From("build_tasks", BuildTask.Type). + Ref("builder"). + Annotations( + entgql.RelayConnection(), + entgql.MultiOrder(), + ). + Comment("Build tasks assigned to this builder."), + } } // Annotations describes additional information for the ent. diff --git a/tavern/internal/ent/tx.go b/tavern/internal/ent/tx.go index 1fb27f5b7..7fa50213a 100644 --- a/tavern/internal/ent/tx.go +++ b/tavern/internal/ent/tx.go @@ -16,6 +16,8 @@ type Tx struct { Asset *AssetClient // Beacon is the client for interacting with the Beacon builders. Beacon *BeaconClient + // BuildTask is the client for interacting with the BuildTask builders. + BuildTask *BuildTaskClient // Builder is the client for interacting with the Builder builders. Builder *BuilderClient // Host is the client for interacting with the Host builders. @@ -177,6 +179,7 @@ func (tx *Tx) Client() *Client { func (tx *Tx) init() { tx.Asset = NewAssetClient(tx.config) tx.Beacon = NewBeaconClient(tx.config) + tx.BuildTask = NewBuildTaskClient(tx.config) tx.Builder = NewBuilderClient(tx.config) tx.Host = NewHostClient(tx.config) tx.HostCredential = NewHostCredentialClient(tx.config) diff --git a/tavern/internal/graphql/build_task_test.go b/tavern/internal/graphql/build_task_test.go new file mode 100644 index 000000000..d90526559 --- /dev/null +++ b/tavern/internal/graphql/build_task_test.go @@ -0,0 +1,298 @@ +package graphql_test + +import ( + "context" + "testing" + + "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" + _ "github.com/mattn/go-sqlite3" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "realm.pub/tavern/internal/c2/c2pb" + "realm.pub/tavern/internal/ent/enttest" + "realm.pub/tavern/internal/graphql" + tavernhttp "realm.pub/tavern/internal/http" + "realm.pub/tavern/tomes" +) + +func TestCreateBuildTask(t *testing.T) { + ctx := context.Background() + graph := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1") + defer graph.Close() + + git := tomes.NewGitImporter(graph) + srv := tavernhttp.NewServer( + tavernhttp.RouteMap{ + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, git)), + }, + tavernhttp.WithAuthenticationBypass(graph), + ) + gqlClient := client.New(srv, client.Path("/graphql")) + + mutFull := `mutation createBuildTask($input: CreateBuildTaskInput!) { + createBuildTask(input: $input) { + id + targetOs + targetFormat + buildImage + buildScript + callbackURI + interval + transportType + artifactPath + builder { id } + } + }` + mutIDOnly := `mutation createBuildTask($input: CreateBuildTaskInput!) { + createBuildTask(input: $input) { + id + } + }` + + t.Run("NoBuilders", func(t *testing.T) { + var resp struct { + CreateBuildTask struct { + ID string + } + } + err := gqlClient.Post(mutIDOnly, &resp, client.Var("input", map[string]any{ + "targetOS": "PLATFORM_LINUX", + })) + require.Error(t, err) + assert.Contains(t, err.Error(), "no builder available") + }) + + t.Run("NoMatchingBuilder", func(t *testing.T) { + // Create a builder that only supports Windows + graph.Builder.Create(). + SetSupportedTargets([]c2pb.Host_Platform{c2pb.Host_PLATFORM_WINDOWS}). + SetUpstream("https://example.com"). + SaveX(ctx) + + var resp struct { + CreateBuildTask struct { + ID string + } + } + err := gqlClient.Post(mutIDOnly, &resp, client.Var("input", map[string]any{ + "targetOS": "PLATFORM_LINUX", + })) + require.Error(t, err) + assert.Contains(t, err.Error(), "no builder available") + }) + + t.Run("SingleMatchingBuilder", func(t *testing.T) { + // Clean up previous builders + graph.BuildTask.Delete().ExecX(ctx) + graph.Builder.Delete().ExecX(ctx) + + linuxBuilder := graph.Builder.Create(). + SetSupportedTargets([]c2pb.Host_Platform{c2pb.Host_PLATFORM_LINUX}). + SetUpstream("https://example.com"). + SaveX(ctx) + + var resp struct { + CreateBuildTask struct { + ID string + TargetOs string + TargetFormat string + BuildImage string + BuildScript string + CallbackURI string + Interval int + TransportType string + ArtifactPath string + Builder struct { + ID string + } + } + } + err := gqlClient.Post(mutFull, &resp, client.Var("input", map[string]any{ + "targetOS": "PLATFORM_LINUX", + "callbackURI": "https://callback.example.com", + })) + require.NoError(t, err) + require.NotEmpty(t, resp.CreateBuildTask.ID) + assert.Equal(t, "PLATFORM_LINUX", resp.CreateBuildTask.TargetOs) + assert.Equal(t, "TARGET_FORMAT_BIN", resp.CreateBuildTask.TargetFormat) + assert.Equal(t, "spellshift/devcontainer:main", resp.CreateBuildTask.BuildImage) + assert.Contains(t, resp.CreateBuildTask.BuildScript, "cargo build") + assert.Equal(t, "https://callback.example.com", resp.CreateBuildTask.CallbackURI) + assert.Equal(t, 5, resp.CreateBuildTask.Interval) + assert.Equal(t, "TRANSPORT_GRPC", resp.CreateBuildTask.TransportType) + assert.Contains(t, resp.CreateBuildTask.ArtifactPath, "x86_64-unknown-linux-musl") + + // Verify the builder edge + bt := graph.BuildTask.GetX(ctx, convertID(resp.CreateBuildTask.ID)) + assignedBuilder := bt.QueryBuilder().OnlyX(ctx) + assert.Equal(t, linuxBuilder.ID, assignedBuilder.ID) + }) + + t.Run("DefaultsApplied", func(t *testing.T) { + // Clean up + graph.BuildTask.Delete().ExecX(ctx) + graph.Builder.Delete().ExecX(ctx) + + graph.Builder.Create(). + SetSupportedTargets([]c2pb.Host_Platform{c2pb.Host_PLATFORM_LINUX}). + SetUpstream("https://example.com"). + SaveX(ctx) + + var resp struct { + CreateBuildTask struct { + ID string + TargetFormat string + BuildImage string + CallbackURI string + Interval int + TransportType string + ArtifactPath string + } + } + // Only specify targetOS; all other fields should get defaults. + err := gqlClient.Post(`mutation createBuildTask($input: CreateBuildTaskInput!) { + createBuildTask(input: $input) { + id + targetFormat + buildImage + callbackURI + interval + transportType + artifactPath + } + }`, &resp, client.Var("input", map[string]any{ + "targetOS": "PLATFORM_LINUX", + })) + require.NoError(t, err) + assert.Equal(t, "TARGET_FORMAT_BIN", resp.CreateBuildTask.TargetFormat) + assert.Equal(t, "spellshift/devcontainer:main", resp.CreateBuildTask.BuildImage) + assert.Equal(t, "http://127.0.0.1:8000", resp.CreateBuildTask.CallbackURI) + assert.Equal(t, 5, resp.CreateBuildTask.Interval) + assert.Equal(t, "TRANSPORT_GRPC", resp.CreateBuildTask.TransportType) + assert.Contains(t, resp.CreateBuildTask.ArtifactPath, "x86_64-unknown-linux-musl") + }) + + t.Run("CustomArtifactPath", func(t *testing.T) { + // Clean up + graph.BuildTask.Delete().ExecX(ctx) + graph.Builder.Delete().ExecX(ctx) + + graph.Builder.Create(). + SetSupportedTargets([]c2pb.Host_Platform{c2pb.Host_PLATFORM_LINUX}). + SetUpstream("https://example.com"). + SaveX(ctx) + + var resp struct { + CreateBuildTask struct { + ID string + ArtifactPath string + } + } + err := gqlClient.Post(`mutation createBuildTask($input: CreateBuildTaskInput!) { + createBuildTask(input: $input) { + id + artifactPath + } + }`, &resp, client.Var("input", map[string]any{ + "targetOS": "PLATFORM_LINUX", + "artifactPath": "/custom/path/to/binary", + })) + require.NoError(t, err) + assert.Equal(t, "/custom/path/to/binary", resp.CreateBuildTask.ArtifactPath) + }) + + t.Run("MultipleMatchingBuilders", func(t *testing.T) { + // Clean up + graph.BuildTask.Delete().ExecX(ctx) + graph.Builder.Delete().ExecX(ctx) + + // Create 3 builders that all support Linux + builders := make(map[int]bool) + for i := 0; i < 3; i++ { + b := graph.Builder.Create(). + SetSupportedTargets([]c2pb.Host_Platform{c2pb.Host_PLATFORM_LINUX}). + SetUpstream("https://example.com"). + SaveX(ctx) + builders[b.ID] = true + } + + // Create 20 build tasks and track which builders get selected + selectedBuilders := make(map[int]bool) + for i := 0; i < 20; i++ { + var resp struct { + CreateBuildTask struct { + ID string + } + } + err := gqlClient.Post(mutIDOnly, &resp, client.Var("input", map[string]any{ + "targetOS": "PLATFORM_LINUX", + })) + require.NoError(t, err) + + bt := graph.BuildTask.GetX(ctx, convertID(resp.CreateBuildTask.ID)) + assignedBuilder := bt.QueryBuilder().OnlyX(ctx) + assert.True(t, builders[assignedBuilder.ID], "selected builder should be one of the candidates") + selectedBuilders[assignedBuilder.ID] = true + } + + // With 3 builders and 20 attempts, we should see at least 2 different builders selected + assert.Greater(t, len(selectedBuilders), 1, "expected random selection across multiple builders") + }) + + t.Run("InvalidTargetFormat", func(t *testing.T) { + // Clean up + graph.BuildTask.Delete().ExecX(ctx) + graph.Builder.Delete().ExecX(ctx) + + graph.Builder.Create(). + SetSupportedTargets([]c2pb.Host_Platform{c2pb.Host_PLATFORM_LINUX}). + SetUpstream("https://example.com"). + SaveX(ctx) + + var resp struct { + CreateBuildTask struct { + ID string + } + } + // cdylib is not supported on Linux + err := gqlClient.Post(mutIDOnly, &resp, client.Var("input", map[string]any{ + "targetOS": "PLATFORM_LINUX", + "targetFormat": "TARGET_FORMAT_CDYLIB", + })) + require.Error(t, err) + assert.Contains(t, err.Error(), "not supported") + }) + + t.Run("WindowsServiceFormat", func(t *testing.T) { + // Clean up + graph.BuildTask.Delete().ExecX(ctx) + graph.Builder.Delete().ExecX(ctx) + + graph.Builder.Create(). + SetSupportedTargets([]c2pb.Host_Platform{c2pb.Host_PLATFORM_WINDOWS}). + SetUpstream("https://example.com"). + SaveX(ctx) + + var resp struct { + CreateBuildTask struct { + ID string + TargetFormat string + BuildScript string + } + } + err := gqlClient.Post(`mutation createBuildTask($input: CreateBuildTaskInput!) { + createBuildTask(input: $input) { + id + targetFormat + buildScript + } + }`, &resp, client.Var("input", map[string]any{ + "targetOS": "PLATFORM_WINDOWS", + "targetFormat": "TARGET_FORMAT_WINDOWS_SERVICE", + })) + require.NoError(t, err) + assert.Equal(t, "TARGET_FORMAT_WINDOWS_SERVICE", resp.CreateBuildTask.TargetFormat) + assert.Contains(t, resp.CreateBuildTask.BuildScript, "win_service") + }) +} diff --git a/tavern/internal/graphql/generated/ent.generated.go b/tavern/internal/graphql/generated/ent.generated.go index 7c953ef9a..e95a1f73e 100644 --- a/tavern/internal/graphql/generated/ent.generated.go +++ b/tavern/internal/graphql/generated/ent.generated.go @@ -13,6 +13,7 @@ import ( "entgo.io/contrib/entgql" "github.com/99designs/gqlgen/graphql" "github.com/vektah/gqlparser/v2/ast" + "realm.pub/tavern/internal/builder/builderpb" "realm.pub/tavern/internal/c2/c2pb" "realm.pub/tavern/internal/c2/epb" "realm.pub/tavern/internal/ent" @@ -36,6 +37,8 @@ type QueryResolver interface { Users(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.UserOrder, where *ent.UserWhereInput) (*ent.UserConnection, error) Portals(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.PortalOrder, where *ent.PortalWhereInput) (*ent.PortalConnection, error) Shells(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ShellOrder, where *ent.ShellWhereInput) (*ent.ShellConnection, error) + BuildTasks(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.BuildTaskOrder, where *ent.BuildTaskWhereInput) (*ent.BuildTaskConnection, error) + Builders(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.BuilderOrder, where *ent.BuilderWhereInput) (*ent.BuilderConnection, error) Me(ctx context.Context) (*ent.User, error) } @@ -187,6 +190,42 @@ func (ec *executionContext) field_Beacon_tasks_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Builder_buildTasks_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + if err != nil { + return nil, err + } + args["after"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + if err != nil { + return nil, err + } + args["before"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["last"] = arg3 + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOBuildTaskOrder2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskOrderᚄ) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOBuildTaskWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInput) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + func (ec *executionContext) field_Host_beacons_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -486,6 +525,78 @@ func (ec *executionContext) field_Query_beacons_args(ctx context.Context, rawArg return args, nil } +func (ec *executionContext) field_Query_buildTasks_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + if err != nil { + return nil, err + } + args["after"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + if err != nil { + return nil, err + } + args["before"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["last"] = arg3 + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOBuildTaskOrder2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskOrderᚄ) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOBuildTaskWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInput) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + +func (ec *executionContext) field_Query_builders_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + if err != nil { + return nil, err + } + args["after"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + if err != nil { + return nil, err + } + args["before"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["last"] = arg3 + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOBuilderOrder2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderOrderᚄ) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOBuilderWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderWhereInput) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + func (ec *executionContext) field_Query_hosts_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -2439,12 +2550,12 @@ func (ec *executionContext) fieldContext_BeaconEdge_cursor(_ context.Context, fi return fc, nil } -func (ec *executionContext) _Builder_id(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_id(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Builder_id, + ec.fieldContext_BuildTask_id, func(ctx context.Context) (any, error) { return obj.ID, nil }, @@ -2455,9 +2566,9 @@ func (ec *executionContext) _Builder_id(ctx context.Context, field graphql.Colle ) } -func (ec *executionContext) fieldContext_Builder_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Builder", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, @@ -2468,12 +2579,12 @@ func (ec *executionContext) fieldContext_Builder_id(_ context.Context, field gra return fc, nil } -func (ec *executionContext) _Builder_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Builder_createdAt, + ec.fieldContext_BuildTask_createdAt, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil }, @@ -2484,9 +2595,9 @@ func (ec *executionContext) _Builder_createdAt(ctx context.Context, field graphq ) } -func (ec *executionContext) fieldContext_Builder_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Builder", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, @@ -2497,12 +2608,12 @@ func (ec *executionContext) fieldContext_Builder_createdAt(_ context.Context, fi return fc, nil } -func (ec *executionContext) _Builder_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Builder_lastModifiedAt, + ec.fieldContext_BuildTask_lastModifiedAt, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil }, @@ -2513,9 +2624,9 @@ func (ec *executionContext) _Builder_lastModifiedAt(ctx context.Context, field g ) } -func (ec *executionContext) fieldContext_Builder_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Builder", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, @@ -2526,72 +2637,72 @@ func (ec *executionContext) fieldContext_Builder_lastModifiedAt(_ context.Contex return fc, nil } -func (ec *executionContext) _Builder_identifier(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_targetOs(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Builder_identifier, + ec.fieldContext_BuildTask_targetOs, func(ctx context.Context) (any, error) { - return obj.Identifier, nil + return obj.TargetOs, nil }, nil, - ec.marshalNString2string, + ec.marshalNHostPlatform2realmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform, true, true, ) } -func (ec *executionContext) fieldContext_Builder_identifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_targetOs(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Builder", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type HostPlatform does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Builder_supportedTargets(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_targetFormat(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Builder_supportedTargets, + ec.fieldContext_BuildTask_targetFormat, func(ctx context.Context) (any, error) { - return obj.SupportedTargets, nil + return obj.TargetFormat, nil }, nil, - ec.marshalNHostPlatform2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platformᚄ, + ec.marshalNBuildTaskTargetFormat2realmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat, true, true, ) } -func (ec *executionContext) fieldContext_Builder_supportedTargets(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_targetFormat(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Builder", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type HostPlatform does not have child fields") + return nil, errors.New("field of type BuildTaskTargetFormat does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Builder_upstream(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_buildImage(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Builder_upstream, + ec.fieldContext_BuildTask_buildImage, func(ctx context.Context) (any, error) { - return obj.Upstream, nil + return obj.BuildImage, nil }, nil, ec.marshalNString2string, @@ -2600,9 +2711,9 @@ func (ec *executionContext) _Builder_upstream(ctx context.Context, field graphql ) } -func (ec *executionContext) fieldContext_Builder_upstream(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_buildImage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Builder", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, @@ -2613,88 +2724,72 @@ func (ec *executionContext) fieldContext_Builder_upstream(_ context.Context, fie return fc, nil } -func (ec *executionContext) _BuilderConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_buildScript(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_BuilderConnection_edges, + ec.fieldContext_BuildTask_buildScript, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.BuildScript, nil }, nil, - ec.marshalOBuilderEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderEdge, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext_BuilderConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_buildScript(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "BuilderConnection", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_BuilderEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_BuilderEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type BuilderEdge", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _BuilderConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_callbackURI(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_BuilderConnection_pageInfo, + ec.fieldContext_BuildTask_callbackURI, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.CallbackURI, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext_BuilderConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_callbackURI(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "BuilderConnection", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _BuilderConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_interval(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_BuilderConnection_totalCount, + ec.fieldContext_BuildTask_interval, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.Interval, nil }, nil, ec.marshalNInt2int, @@ -2703,9 +2798,9 @@ func (ec *executionContext) _BuilderConnection_totalCount(ctx context.Context, f ) } -func (ec *executionContext) fieldContext_BuilderConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_interval(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "BuilderConnection", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, @@ -2716,126 +2811,112 @@ func (ec *executionContext) fieldContext_BuilderConnection_totalCount(_ context. return fc, nil } -func (ec *executionContext) _BuilderEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_transportType(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_BuilderEdge_node, + ec.fieldContext_BuildTask_transportType, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.TransportType, nil }, nil, - ec.marshalOBuilder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilder, + ec.marshalNBeaconTransport_Type2realmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Type, + true, true, - false, ) } -func (ec *executionContext) fieldContext_BuilderEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_transportType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "BuilderEdge", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Builder_id(ctx, field) - case "createdAt": - return ec.fieldContext_Builder_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Builder_lastModifiedAt(ctx, field) - case "identifier": - return ec.fieldContext_Builder_identifier(ctx, field) - case "supportedTargets": - return ec.fieldContext_Builder_supportedTargets(ctx, field) - case "upstream": - return ec.fieldContext_Builder_upstream(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Builder", field.Name) + return nil, errors.New("field of type BeaconTransport_Type does not have child fields") }, } return fc, nil } -func (ec *executionContext) _BuilderEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_extra(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_BuilderEdge_cursor, + ec.fieldContext_BuildTask_extra, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.Extra, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_BuilderEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_extra(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "BuilderEdge", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Host_id(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_claimedAt(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_id, + ec.fieldContext_BuildTask_claimedAt, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.ClaimedAt, nil }, nil, - ec.marshalNID2int, - true, + ec.marshalOTime2timeᚐTime, true, + false, ) } -func (ec *executionContext) fieldContext_Host_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_claimedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Host_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_startedAt(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_createdAt, + ec.fieldContext_BuildTask_startedAt, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.StartedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, - true, + ec.marshalOTime2timeᚐTime, true, + false, ) } -func (ec *executionContext) fieldContext_Host_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_startedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, @@ -2846,25 +2927,25 @@ func (ec *executionContext) fieldContext_Host_createdAt(_ context.Context, field return fc, nil } -func (ec *executionContext) _Host_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_finishedAt(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_lastModifiedAt, + ec.fieldContext_BuildTask_finishedAt, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.FinishedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, - true, + ec.marshalOTime2timeᚐTime, true, + false, ) } -func (ec *executionContext) fieldContext_Host_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_finishedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, @@ -2875,25 +2956,25 @@ func (ec *executionContext) fieldContext_Host_lastModifiedAt(_ context.Context, return fc, nil } -func (ec *executionContext) _Host_identifier(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_output(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_identifier, + ec.fieldContext_BuildTask_output, func(ctx context.Context) (any, error) { - return obj.Identifier, nil + return obj.Output, nil }, nil, - ec.marshalNString2string, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_Host_identifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_output(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, @@ -2904,43 +2985,43 @@ func (ec *executionContext) fieldContext_Host_identifier(_ context.Context, fiel return fc, nil } -func (ec *executionContext) _Host_name(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_outputSize(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_name, + ec.fieldContext_BuildTask_outputSize, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.OutputSize, nil }, nil, - ec.marshalOString2string, + ec.marshalNInt2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Host_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_outputSize(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Host_primaryIP(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_error(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_primaryIP, + ec.fieldContext_BuildTask_error, func(ctx context.Context) (any, error) { - return obj.PrimaryIP, nil + return obj.Error, nil }, nil, ec.marshalOString2string, @@ -2949,9 +3030,9 @@ func (ec *executionContext) _Host_primaryIP(ctx context.Context, field graphql.C ) } -func (ec *executionContext) fieldContext_Host_primaryIP(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_error(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, @@ -2962,565 +3043,549 @@ func (ec *executionContext) fieldContext_Host_primaryIP(_ context.Context, field return fc, nil } -func (ec *executionContext) _Host_externalIP(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_errorSize(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_externalIP, + ec.fieldContext_BuildTask_errorSize, func(ctx context.Context) (any, error) { - return obj.ExternalIP, nil + return obj.ErrorSize, nil }, nil, - ec.marshalOString2string, + ec.marshalNInt2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Host_externalIP(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_errorSize(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Host_platform(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_exitCode(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_platform, + ec.fieldContext_BuildTask_exitCode, func(ctx context.Context) (any, error) { - return obj.Platform, nil + return obj.ExitCode, nil }, nil, - ec.marshalNHostPlatform2realmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform, - true, + ec.marshalOInt2ᚖint, true, + false, ) } -func (ec *executionContext) fieldContext_Host_platform(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_exitCode(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type HostPlatform does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Host_lastSeenAt(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_artifactPath(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_lastSeenAt, + ec.fieldContext_BuildTask_artifactPath, func(ctx context.Context) (any, error) { - return obj.LastSeenAt, nil + return obj.ArtifactPath, nil }, nil, - ec.marshalOTime2timeᚐTime, + ec.marshalOString2string, true, false, ) } -func (ec *executionContext) fieldContext_Host_lastSeenAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_artifactPath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Host_nextSeenAt(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_builder(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_nextSeenAt, + ec.fieldContext_BuildTask_builder, func(ctx context.Context) (any, error) { - return obj.NextSeenAt, nil + return obj.Builder(ctx) }, nil, - ec.marshalOTime2timeᚐTime, + ec.marshalNBuilder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilder, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Host_nextSeenAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_builder(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Builder_id(ctx, field) + case "createdAt": + return ec.fieldContext_Builder_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Builder_lastModifiedAt(ctx, field) + case "identifier": + return ec.fieldContext_Builder_identifier(ctx, field) + case "supportedTargets": + return ec.fieldContext_Builder_supportedTargets(ctx, field) + case "upstream": + return ec.fieldContext_Builder_upstream(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Builder_lastSeenAt(ctx, field) + case "buildTasks": + return ec.fieldContext_Builder_buildTasks(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Builder", field.Name) }, } return fc, nil } -func (ec *executionContext) _Host_tags(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTask_artifact(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTask) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_tags, + ec.fieldContext_BuildTask_artifact, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Tags(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TagOrder), fc.Args["where"].(*ent.TagWhereInput)) + return obj.Artifact(ctx) }, nil, - ec.marshalNTagConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTagConnection, - true, + ec.marshalOAsset2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAsset, true, + false, ) } -func (ec *executionContext) fieldContext_Host_tags(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTask_artifact(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTask", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_TagConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_TagConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_TagConnection_totalCount(ctx, field) + case "id": + return ec.fieldContext_Asset_id(ctx, field) + case "createdAt": + return ec.fieldContext_Asset_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Asset_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Asset_name(ctx, field) + case "size": + return ec.fieldContext_Asset_size(ctx, field) + case "hash": + return ec.fieldContext_Asset_hash(ctx, field) + case "tomes": + return ec.fieldContext_Asset_tomes(ctx, field) + case "links": + return ec.fieldContext_Asset_links(ctx, field) + case "creator": + return ec.fieldContext_Asset_creator(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type TagConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Asset", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Host_tags_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Host_beacons(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTaskConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTaskConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_beacons, + ec.fieldContext_BuildTaskConnection_edges, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Beacons(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.BeaconOrder), fc.Args["where"].(*ent.BeaconWhereInput)) + return obj.Edges, nil }, nil, - ec.marshalNBeaconConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconConnection, - true, + ec.marshalOBuildTaskEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskEdge, true, + false, ) } -func (ec *executionContext) fieldContext_Host_beacons(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTaskConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTaskConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_BeaconConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_BeaconConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_BeaconConnection_totalCount(ctx, field) + case "node": + return ec.fieldContext_BuildTaskEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_BuildTaskEdge_cursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type BeaconConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type BuildTaskEdge", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Host_beacons_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Host_files(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTaskConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTaskConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_files, + ec.fieldContext_BuildTaskConnection_pageInfo, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Files(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostFileOrder), fc.Args["where"].(*ent.HostFileWhereInput)) + return obj.PageInfo, nil }, nil, - ec.marshalNHostFileConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileConnection, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, true, true, ) } -func (ec *executionContext) fieldContext_Host_files(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTaskConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTaskConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_HostFileConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_HostFileConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_HostFileConnection_totalCount(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type HostFileConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Host_files_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Host_processes(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTaskConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTaskConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_processes, + ec.fieldContext_BuildTaskConnection_totalCount, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Processes(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostProcessOrder), fc.Args["where"].(*ent.HostProcessWhereInput)) + return obj.TotalCount, nil }, nil, - ec.marshalNHostProcessConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessConnection, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext_Host_processes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTaskConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTaskConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_HostProcessConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_HostProcessConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_HostProcessConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostProcessConnection", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Host_processes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Host_credentials(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTaskEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTaskEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Host_credentials, + ec.fieldContext_BuildTaskEdge_node, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Credentials(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostCredentialOrder), fc.Args["where"].(*ent.HostCredentialWhereInput)) + return obj.Node, nil }, nil, - ec.marshalNHostCredentialConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialConnection, - true, + ec.marshalOBuildTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTask, true, + false, ) } -func (ec *executionContext) fieldContext_Host_credentials(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTaskEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Host", + Object: "BuildTaskEdge", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_HostCredentialConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_HostCredentialConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_HostCredentialConnection_totalCount(ctx, field) + case "id": + return ec.fieldContext_BuildTask_id(ctx, field) + case "createdAt": + return ec.fieldContext_BuildTask_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_BuildTask_lastModifiedAt(ctx, field) + case "targetOs": + return ec.fieldContext_BuildTask_targetOs(ctx, field) + case "targetFormat": + return ec.fieldContext_BuildTask_targetFormat(ctx, field) + case "buildImage": + return ec.fieldContext_BuildTask_buildImage(ctx, field) + case "buildScript": + return ec.fieldContext_BuildTask_buildScript(ctx, field) + case "callbackURI": + return ec.fieldContext_BuildTask_callbackURI(ctx, field) + case "interval": + return ec.fieldContext_BuildTask_interval(ctx, field) + case "transportType": + return ec.fieldContext_BuildTask_transportType(ctx, field) + case "extra": + return ec.fieldContext_BuildTask_extra(ctx, field) + case "claimedAt": + return ec.fieldContext_BuildTask_claimedAt(ctx, field) + case "startedAt": + return ec.fieldContext_BuildTask_startedAt(ctx, field) + case "finishedAt": + return ec.fieldContext_BuildTask_finishedAt(ctx, field) + case "output": + return ec.fieldContext_BuildTask_output(ctx, field) + case "outputSize": + return ec.fieldContext_BuildTask_outputSize(ctx, field) + case "error": + return ec.fieldContext_BuildTask_error(ctx, field) + case "errorSize": + return ec.fieldContext_BuildTask_errorSize(ctx, field) + case "exitCode": + return ec.fieldContext_BuildTask_exitCode(ctx, field) + case "artifactPath": + return ec.fieldContext_BuildTask_artifactPath(ctx, field) + case "builder": + return ec.fieldContext_BuildTask_builder(ctx, field) + case "artifact": + return ec.fieldContext_BuildTask_artifact(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type HostCredentialConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type BuildTask", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Host_credentials_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _HostConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.HostConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _BuildTaskEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.BuildTaskEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostConnection_edges, + ec.fieldContext_BuildTaskEdge_cursor, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.Cursor, nil }, nil, - ec.marshalOHostEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostEdge, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuildTaskEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostConnection", + Object: "BuildTaskEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_HostEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_HostEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostEdge", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.HostConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Builder_id(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostConnection_pageInfo, + ec.fieldContext_Builder_id, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.ID, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + ec.marshalNID2int, true, true, ) } -func (ec *executionContext) fieldContext_HostConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Builder_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostConnection", + Object: "Builder", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.HostConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Builder_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostConnection_totalCount, + ec.fieldContext_Builder_createdAt, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.CreatedAt, nil }, nil, - ec.marshalNInt2int, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_HostConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Builder_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostConnection", + Object: "Builder", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostCredential_id(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { +func (ec *executionContext) _Builder_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredential_id, + ec.fieldContext_Builder_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalNID2int, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_HostCredential_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Builder_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredential", + Object: "Builder", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostCredential_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { +func (ec *executionContext) _Builder_identifier(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredential_createdAt, + ec.fieldContext_Builder_identifier, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.Identifier, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext_HostCredential_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Builder_identifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredential", + Object: "Builder", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostCredential_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { +func (ec *executionContext) _Builder_supportedTargets(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredential_lastModifiedAt, + ec.fieldContext_Builder_supportedTargets, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.SupportedTargets, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNHostPlatform2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platformᚄ, true, true, ) } -func (ec *executionContext) fieldContext_HostCredential_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Builder_supportedTargets(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredential", + Object: "Builder", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type HostPlatform does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostCredential_principal(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { +func (ec *executionContext) _Builder_upstream(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredential_principal, + ec.fieldContext_Builder_upstream, func(ctx context.Context) (any, error) { - return obj.Principal, nil + return obj.Upstream, nil }, nil, ec.marshalNString2string, @@ -3529,9 +3594,9 @@ func (ec *executionContext) _HostCredential_principal(ctx context.Context, field ) } -func (ec *executionContext) fieldContext_HostCredential_principal(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Builder_upstream(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredential", + Object: "Builder", Field: field, IsMethod: false, IsResolver: false, @@ -3542,879 +3607,839 @@ func (ec *executionContext) fieldContext_HostCredential_principal(_ context.Cont return fc, nil } -func (ec *executionContext) _HostCredential_secret(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { +func (ec *executionContext) _Builder_lastSeenAt(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredential_secret, + ec.fieldContext_Builder_lastSeenAt, func(ctx context.Context) (any, error) { - return obj.Secret, nil + return obj.LastSeenAt, nil }, nil, - ec.marshalNString2string, - true, + ec.marshalOTime2ᚖtimeᚐTime, true, + false, ) } -func (ec *executionContext) fieldContext_HostCredential_secret(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Builder_lastSeenAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredential", + Object: "Builder", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostCredential_kind(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { +func (ec *executionContext) _Builder_buildTasks(ctx context.Context, field graphql.CollectedField, obj *ent.Builder) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredential_kind, + ec.fieldContext_Builder_buildTasks, func(ctx context.Context) (any, error) { - return obj.Kind, nil + fc := graphql.GetFieldContext(ctx) + return obj.BuildTasks(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.BuildTaskOrder), fc.Args["where"].(*ent.BuildTaskWhereInput)) }, nil, - ec.marshalNHostCredentialKind2realmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kind, + ec.marshalNBuildTaskConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskConnection, true, true, ) } -func (ec *executionContext) fieldContext_HostCredential_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Builder_buildTasks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredential", + Object: "Builder", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type HostCredentialKind does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_BuildTaskConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_BuildTaskConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_BuildTaskConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BuildTaskConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Builder_buildTasks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _HostCredential_host(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { +func (ec *executionContext) _BuilderConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredential_host, + ec.fieldContext_BuilderConnection_edges, func(ctx context.Context) (any, error) { - return obj.Host(ctx) + return obj.Edges, nil }, nil, - ec.marshalNHost2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHost, - true, + ec.marshalOBuilderEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderEdge, true, + false, ) } -func (ec *executionContext) fieldContext_HostCredential_host(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuilderConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredential", + Object: "BuilderConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Host_id(ctx, field) - case "createdAt": - return ec.fieldContext_Host_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Host_lastModifiedAt(ctx, field) - case "identifier": - return ec.fieldContext_Host_identifier(ctx, field) - case "name": - return ec.fieldContext_Host_name(ctx, field) - case "primaryIP": - return ec.fieldContext_Host_primaryIP(ctx, field) - case "externalIP": - return ec.fieldContext_Host_externalIP(ctx, field) - case "platform": - return ec.fieldContext_Host_platform(ctx, field) - case "lastSeenAt": - return ec.fieldContext_Host_lastSeenAt(ctx, field) - case "nextSeenAt": - return ec.fieldContext_Host_nextSeenAt(ctx, field) - case "tags": - return ec.fieldContext_Host_tags(ctx, field) - case "beacons": - return ec.fieldContext_Host_beacons(ctx, field) - case "files": - return ec.fieldContext_Host_files(ctx, field) - case "processes": - return ec.fieldContext_Host_processes(ctx, field) - case "credentials": - return ec.fieldContext_Host_credentials(ctx, field) + case "node": + return ec.fieldContext_BuilderEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_BuilderEdge_cursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Host", field.Name) + return nil, fmt.Errorf("no field named %q was found under type BuilderEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _HostCredential_task(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { +func (ec *executionContext) _BuilderConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredential_task, + ec.fieldContext_BuilderConnection_pageInfo, func(ctx context.Context) (any, error) { - return obj.Task(ctx) + return obj.PageInfo, nil }, nil, - ec.marshalOTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostCredential_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuilderConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredential", + Object: "BuilderConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Task_id(ctx, field) - case "createdAt": - return ec.fieldContext_Task_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Task_lastModifiedAt(ctx, field) - case "claimedAt": - return ec.fieldContext_Task_claimedAt(ctx, field) - case "execStartedAt": - return ec.fieldContext_Task_execStartedAt(ctx, field) - case "execFinishedAt": - return ec.fieldContext_Task_execFinishedAt(ctx, field) - case "output": - return ec.fieldContext_Task_output(ctx, field) - case "outputSize": - return ec.fieldContext_Task_outputSize(ctx, field) - case "error": - return ec.fieldContext_Task_error(ctx, field) - case "quest": - return ec.fieldContext_Task_quest(ctx, field) - case "beacon": - return ec.fieldContext_Task_beacon(ctx, field) - case "reportedFiles": - return ec.fieldContext_Task_reportedFiles(ctx, field) - case "reportedProcesses": - return ec.fieldContext_Task_reportedProcesses(ctx, field) - case "reportedCredentials": - return ec.fieldContext_Task_reportedCredentials(ctx, field) - case "shells": - return ec.fieldContext_Task_shells(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _HostCredentialConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _BuilderConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredentialConnection_edges, + ec.fieldContext_BuilderConnection_totalCount, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.TotalCount, nil }, nil, - ec.marshalOHostCredentialEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialEdge, + ec.marshalNInt2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostCredentialConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuilderConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredentialConnection", + Object: "BuilderConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_HostCredentialEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_HostCredentialEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostCredentialEdge", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostCredentialConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _BuilderEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredentialConnection_pageInfo, + ec.fieldContext_BuilderEdge_node, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.Node, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, - true, + ec.marshalOBuilder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilder, true, + false, ) } -func (ec *executionContext) fieldContext_HostCredentialConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuilderEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredentialConnection", + Object: "BuilderEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) + case "id": + return ec.fieldContext_Builder_id(ctx, field) + case "createdAt": + return ec.fieldContext_Builder_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Builder_lastModifiedAt(ctx, field) + case "identifier": + return ec.fieldContext_Builder_identifier(ctx, field) + case "supportedTargets": + return ec.fieldContext_Builder_supportedTargets(ctx, field) + case "upstream": + return ec.fieldContext_Builder_upstream(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Builder_lastSeenAt(ctx, field) + case "buildTasks": + return ec.fieldContext_Builder_buildTasks(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Builder", field.Name) }, } return fc, nil } -func (ec *executionContext) _HostCredentialConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _BuilderEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.BuilderEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredentialConnection_totalCount, + ec.fieldContext_BuilderEdge_cursor, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.Cursor, nil }, nil, - ec.marshalNInt2int, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, true, true, ) } -func (ec *executionContext) fieldContext_HostCredentialConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BuilderEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredentialConnection", + Object: "BuilderEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostCredentialEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_id(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredentialEdge_node, + ec.fieldContext_Host_id, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.ID, nil }, nil, - ec.marshalOHostCredential2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredential, + ec.marshalNID2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostCredentialEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredentialEdge", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_HostCredential_id(ctx, field) - case "createdAt": - return ec.fieldContext_HostCredential_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_HostCredential_lastModifiedAt(ctx, field) - case "principal": - return ec.fieldContext_HostCredential_principal(ctx, field) - case "secret": - return ec.fieldContext_HostCredential_secret(ctx, field) - case "kind": - return ec.fieldContext_HostCredential_kind(ctx, field) - case "host": - return ec.fieldContext_HostCredential_host(ctx, field) - case "task": - return ec.fieldContext_HostCredential_task(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostCredential", field.Name) + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostCredentialEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostCredentialEdge_cursor, + ec.fieldContext_Host_createdAt, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.CreatedAt, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_HostCredentialEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostCredentialEdge", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.HostEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostEdge_node, + ec.fieldContext_Host_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalOHost2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHost, + ec.marshalNTime2timeᚐTime, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostEdge", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Host_id(ctx, field) - case "createdAt": - return ec.fieldContext_Host_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Host_lastModifiedAt(ctx, field) - case "identifier": - return ec.fieldContext_Host_identifier(ctx, field) - case "name": - return ec.fieldContext_Host_name(ctx, field) - case "primaryIP": - return ec.fieldContext_Host_primaryIP(ctx, field) - case "externalIP": - return ec.fieldContext_Host_externalIP(ctx, field) - case "platform": - return ec.fieldContext_Host_platform(ctx, field) - case "lastSeenAt": - return ec.fieldContext_Host_lastSeenAt(ctx, field) - case "nextSeenAt": - return ec.fieldContext_Host_nextSeenAt(ctx, field) - case "tags": - return ec.fieldContext_Host_tags(ctx, field) - case "beacons": - return ec.fieldContext_Host_beacons(ctx, field) - case "files": - return ec.fieldContext_Host_files(ctx, field) - case "processes": - return ec.fieldContext_Host_processes(ctx, field) - case "credentials": - return ec.fieldContext_Host_credentials(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Host", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.HostEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_identifier(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostEdge_cursor, + ec.fieldContext_Host_identifier, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.Identifier, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext_HostEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_identifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostEdge", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostFile_id(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_name(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_id, + ec.fieldContext_Host_name, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Name, nil }, nil, - ec.marshalNID2int, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_HostFile_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostFile_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_primaryIP(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_createdAt, + ec.fieldContext_Host_primaryIP, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.PrimaryIP, nil }, nil, - ec.marshalNTime2timeᚐTime, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_HostFile_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_primaryIP(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostFile_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_externalIP(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_lastModifiedAt, + ec.fieldContext_Host_externalIP, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.ExternalIP, nil }, nil, - ec.marshalNTime2timeᚐTime, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_HostFile_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_externalIP(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostFile_path(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_platform(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_path, + ec.fieldContext_Host_platform, func(ctx context.Context) (any, error) { - return obj.Path, nil + return obj.Platform, nil }, nil, - ec.marshalNString2string, + ec.marshalNHostPlatform2realmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform, true, true, ) } -func (ec *executionContext) fieldContext_HostFile_path(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_platform(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type HostPlatform does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostFile_owner(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_lastSeenAt(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_owner, + ec.fieldContext_Host_lastSeenAt, func(ctx context.Context) (any, error) { - return obj.Owner, nil + return obj.LastSeenAt, nil }, nil, - ec.marshalOString2string, + ec.marshalOTime2timeᚐTime, true, false, ) } -func (ec *executionContext) fieldContext_HostFile_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_lastSeenAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostFile_group(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_nextSeenAt(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_group, + ec.fieldContext_Host_nextSeenAt, func(ctx context.Context) (any, error) { - return obj.Group, nil + return obj.NextSeenAt, nil }, nil, - ec.marshalOString2string, + ec.marshalOTime2timeᚐTime, true, false, ) } -func (ec *executionContext) fieldContext_HostFile_group(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_nextSeenAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostFile_permissions(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_tags(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_permissions, + ec.fieldContext_Host_tags, func(ctx context.Context) (any, error) { - return obj.Permissions, nil + fc := graphql.GetFieldContext(ctx) + return obj.Tags(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TagOrder), fc.Args["where"].(*ent.TagWhereInput)) }, nil, - ec.marshalOString2string, + ec.marshalNTagConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTagConnection, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostFile_permissions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_tags(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_TagConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_TagConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_TagConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TagConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Host_tags_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _HostFile_size(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_beacons(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_size, + ec.fieldContext_Host_beacons, func(ctx context.Context) (any, error) { - return obj.Size, nil + fc := graphql.GetFieldContext(ctx) + return obj.Beacons(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.BeaconOrder), fc.Args["where"].(*ent.BeaconWhereInput)) }, nil, - ec.marshalNUint642uint64, + ec.marshalNBeaconConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconConnection, true, true, ) } -func (ec *executionContext) fieldContext_HostFile_size(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_beacons(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Uint64 does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_BeaconConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_BeaconConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_BeaconConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BeaconConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Host_beacons_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _HostFile_hash(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_files(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_hash, + ec.fieldContext_Host_files, func(ctx context.Context) (any, error) { - return obj.Hash, nil + fc := graphql.GetFieldContext(ctx) + return obj.Files(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostFileOrder), fc.Args["where"].(*ent.HostFileWhereInput)) }, nil, - ec.marshalOString2string, + ec.marshalNHostFileConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileConnection, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostFile_hash(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_files(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_HostFileConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_HostFileConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_HostFileConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostFileConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Host_files_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _HostFile_host(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_processes(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_host, + ec.fieldContext_Host_processes, func(ctx context.Context) (any, error) { - return obj.Host(ctx) + fc := graphql.GetFieldContext(ctx) + return obj.Processes(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostProcessOrder), fc.Args["where"].(*ent.HostProcessWhereInput)) }, nil, - ec.marshalNHost2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHost, + ec.marshalNHostProcessConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessConnection, true, true, ) } -func (ec *executionContext) fieldContext_HostFile_host(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_processes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Host_id(ctx, field) - case "createdAt": - return ec.fieldContext_Host_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Host_lastModifiedAt(ctx, field) - case "identifier": - return ec.fieldContext_Host_identifier(ctx, field) - case "name": - return ec.fieldContext_Host_name(ctx, field) - case "primaryIP": - return ec.fieldContext_Host_primaryIP(ctx, field) - case "externalIP": - return ec.fieldContext_Host_externalIP(ctx, field) - case "platform": - return ec.fieldContext_Host_platform(ctx, field) - case "lastSeenAt": - return ec.fieldContext_Host_lastSeenAt(ctx, field) - case "nextSeenAt": - return ec.fieldContext_Host_nextSeenAt(ctx, field) - case "tags": - return ec.fieldContext_Host_tags(ctx, field) - case "beacons": - return ec.fieldContext_Host_beacons(ctx, field) - case "files": - return ec.fieldContext_Host_files(ctx, field) - case "processes": - return ec.fieldContext_Host_processes(ctx, field) - case "credentials": - return ec.fieldContext_Host_credentials(ctx, field) + case "edges": + return ec.fieldContext_HostProcessConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_HostProcessConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_HostProcessConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Host", field.Name) + return nil, fmt.Errorf("no field named %q was found under type HostProcessConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Host_processes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _HostFile_task(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { +func (ec *executionContext) _Host_credentials(ctx context.Context, field graphql.CollectedField, obj *ent.Host) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFile_task, + ec.fieldContext_Host_credentials, func(ctx context.Context) (any, error) { - return obj.Task(ctx) + fc := graphql.GetFieldContext(ctx) + return obj.Credentials(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostCredentialOrder), fc.Args["where"].(*ent.HostCredentialWhereInput)) }, nil, - ec.marshalNTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, + ec.marshalNHostCredentialConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialConnection, true, true, ) } -func (ec *executionContext) fieldContext_HostFile_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Host_credentials(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFile", + Object: "Host", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Task_id(ctx, field) - case "createdAt": - return ec.fieldContext_Task_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Task_lastModifiedAt(ctx, field) - case "claimedAt": - return ec.fieldContext_Task_claimedAt(ctx, field) - case "execStartedAt": - return ec.fieldContext_Task_execStartedAt(ctx, field) - case "execFinishedAt": - return ec.fieldContext_Task_execFinishedAt(ctx, field) - case "output": - return ec.fieldContext_Task_output(ctx, field) - case "outputSize": - return ec.fieldContext_Task_outputSize(ctx, field) - case "error": - return ec.fieldContext_Task_error(ctx, field) - case "quest": - return ec.fieldContext_Task_quest(ctx, field) - case "beacon": - return ec.fieldContext_Task_beacon(ctx, field) - case "reportedFiles": - return ec.fieldContext_Task_reportedFiles(ctx, field) - case "reportedProcesses": - return ec.fieldContext_Task_reportedProcesses(ctx, field) - case "reportedCredentials": - return ec.fieldContext_Task_reportedCredentials(ctx, field) - case "shells": - return ec.fieldContext_Task_shells(ctx, field) + case "edges": + return ec.fieldContext_HostCredentialConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_HostCredentialConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_HostCredentialConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) + return nil, fmt.Errorf("no field named %q was found under type HostCredentialConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Host_credentials_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _HostFileConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.HostConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFileConnection_edges, + ec.fieldContext_HostConnection_edges, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - ec.marshalOHostFileEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileEdge, + ec.marshalOHostEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostEdge, true, false, ) } -func (ec *executionContext) fieldContext_HostFileConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFileConnection", + Object: "HostConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "node": - return ec.fieldContext_HostFileEdge_node(ctx, field) + return ec.fieldContext_HostEdge_node(ctx, field) case "cursor": - return ec.fieldContext_HostFileEdge_cursor(ctx, field) + return ec.fieldContext_HostEdge_cursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type HostFileEdge", field.Name) + return nil, fmt.Errorf("no field named %q was found under type HostEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _HostFileConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.HostConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFileConnection_pageInfo, + ec.fieldContext_HostConnection_pageInfo, func(ctx context.Context) (any, error) { return obj.PageInfo, nil }, @@ -4425,9 +4450,9 @@ func (ec *executionContext) _HostFileConnection_pageInfo(ctx context.Context, fi ) } -func (ec *executionContext) fieldContext_HostFileConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFileConnection", + Object: "HostConnection", Field: field, IsMethod: false, IsResolver: false, @@ -4448,12 +4473,12 @@ func (ec *executionContext) fieldContext_HostFileConnection_pageInfo(_ context.C return fc, nil } -func (ec *executionContext) _HostFileConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.HostConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFileConnection_totalCount, + ec.fieldContext_HostConnection_totalCount, func(ctx context.Context) (any, error) { return obj.TotalCount, nil }, @@ -4464,9 +4489,9 @@ func (ec *executionContext) _HostFileConnection_totalCount(ctx context.Context, ) } -func (ec *executionContext) fieldContext_HostFileConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFileConnection", + Object: "HostConnection", Field: field, IsMethod: false, IsResolver: false, @@ -4477,457 +4502,502 @@ func (ec *executionContext) fieldContext_HostFileConnection_totalCount(_ context return fc, nil } -func (ec *executionContext) _HostFileEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredential_id(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFileEdge_node, + ec.fieldContext_HostCredential_id, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.ID, nil }, nil, - ec.marshalOHostFile2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFile, + ec.marshalNID2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostFileEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredential_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFileEdge", + Object: "HostCredential", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_HostFile_id(ctx, field) - case "createdAt": - return ec.fieldContext_HostFile_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_HostFile_lastModifiedAt(ctx, field) - case "path": - return ec.fieldContext_HostFile_path(ctx, field) - case "owner": - return ec.fieldContext_HostFile_owner(ctx, field) - case "group": - return ec.fieldContext_HostFile_group(ctx, field) - case "permissions": - return ec.fieldContext_HostFile_permissions(ctx, field) - case "size": - return ec.fieldContext_HostFile_size(ctx, field) - case "hash": - return ec.fieldContext_HostFile_hash(ctx, field) - case "host": - return ec.fieldContext_HostFile_host(ctx, field) - case "task": - return ec.fieldContext_HostFile_task(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostFile", field.Name) + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostFileEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredential_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostFileEdge_cursor, + ec.fieldContext_HostCredential_createdAt, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.CreatedAt, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_HostFileEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredential_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostFileEdge", + Object: "HostCredential", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcess_id(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredential_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_id, + ec.fieldContext_HostCredential_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalNID2int, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_HostProcess_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredential_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredential", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcess_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredential_principal(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_createdAt, + ec.fieldContext_HostCredential_principal, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.Principal, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext_HostProcess_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredential_principal(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredential", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcess_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredential_secret(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_lastModifiedAt, + ec.fieldContext_HostCredential_secret, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.Secret, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext_HostProcess_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredential_secret(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredential", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcess_pid(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredential_kind(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_pid, + ec.fieldContext_HostCredential_kind, func(ctx context.Context) (any, error) { - return obj.Pid, nil + return obj.Kind, nil }, nil, - ec.marshalNUint642uint64, + ec.marshalNHostCredentialKind2realmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kind, true, true, ) } -func (ec *executionContext) fieldContext_HostProcess_pid(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredential_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredential", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Uint64 does not have child fields") + return nil, errors.New("field of type HostCredentialKind does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcess_ppid(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredential_host(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_ppid, + ec.fieldContext_HostCredential_host, func(ctx context.Context) (any, error) { - return obj.Ppid, nil + return obj.Host(ctx) }, nil, - ec.marshalNUint642uint64, + ec.marshalNHost2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHost, true, true, ) } -func (ec *executionContext) fieldContext_HostProcess_ppid(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredential_host(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredential", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Uint64 does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Host_id(ctx, field) + case "createdAt": + return ec.fieldContext_Host_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Host_lastModifiedAt(ctx, field) + case "identifier": + return ec.fieldContext_Host_identifier(ctx, field) + case "name": + return ec.fieldContext_Host_name(ctx, field) + case "primaryIP": + return ec.fieldContext_Host_primaryIP(ctx, field) + case "externalIP": + return ec.fieldContext_Host_externalIP(ctx, field) + case "platform": + return ec.fieldContext_Host_platform(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Host_lastSeenAt(ctx, field) + case "nextSeenAt": + return ec.fieldContext_Host_nextSeenAt(ctx, field) + case "tags": + return ec.fieldContext_Host_tags(ctx, field) + case "beacons": + return ec.fieldContext_Host_beacons(ctx, field) + case "files": + return ec.fieldContext_Host_files(ctx, field) + case "processes": + return ec.fieldContext_Host_processes(ctx, field) + case "credentials": + return ec.fieldContext_Host_credentials(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Host", field.Name) }, } return fc, nil } -func (ec *executionContext) _HostProcess_name(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredential_task(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredential) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_name, + ec.fieldContext_HostCredential_task, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.Task(ctx) }, nil, - ec.marshalNString2string, - true, + ec.marshalOTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, true, + false, ) } -func (ec *executionContext) fieldContext_HostProcess_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredential_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredential", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Task_id(ctx, field) + case "createdAt": + return ec.fieldContext_Task_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Task_lastModifiedAt(ctx, field) + case "claimedAt": + return ec.fieldContext_Task_claimedAt(ctx, field) + case "execStartedAt": + return ec.fieldContext_Task_execStartedAt(ctx, field) + case "execFinishedAt": + return ec.fieldContext_Task_execFinishedAt(ctx, field) + case "output": + return ec.fieldContext_Task_output(ctx, field) + case "outputSize": + return ec.fieldContext_Task_outputSize(ctx, field) + case "error": + return ec.fieldContext_Task_error(ctx, field) + case "quest": + return ec.fieldContext_Task_quest(ctx, field) + case "beacon": + return ec.fieldContext_Task_beacon(ctx, field) + case "reportedFiles": + return ec.fieldContext_Task_reportedFiles(ctx, field) + case "reportedProcesses": + return ec.fieldContext_Task_reportedProcesses(ctx, field) + case "reportedCredentials": + return ec.fieldContext_Task_reportedCredentials(ctx, field) + case "shells": + return ec.fieldContext_Task_shells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) }, } return fc, nil } -func (ec *executionContext) _HostProcess_principal(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredentialConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_principal, + ec.fieldContext_HostCredentialConnection_edges, func(ctx context.Context) (any, error) { - return obj.Principal, nil + return obj.Edges, nil }, nil, - ec.marshalNString2string, - true, + ec.marshalOHostCredentialEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialEdge, true, + false, ) } -func (ec *executionContext) fieldContext_HostProcess_principal(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredentialConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredentialConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _HostProcess_path(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_HostProcess_path, - func(ctx context.Context) (any, error) { - return obj.Path, nil - }, - nil, - ec.marshalOString2string, - true, - false, - ) -} - -func (ec *executionContext) fieldContext_HostProcess_path(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "HostProcess", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "node": + return ec.fieldContext_HostCredentialEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_HostCredentialEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostCredentialEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _HostProcess_cmd(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredentialConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_cmd, + ec.fieldContext_HostCredentialConnection_pageInfo, func(ctx context.Context) (any, error) { - return obj.Cmd, nil + return obj.PageInfo, nil }, nil, - ec.marshalOString2string, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostProcess_cmd(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredentialConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredentialConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _HostProcess_env(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredentialConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_env, + ec.fieldContext_HostCredentialConnection_totalCount, func(ctx context.Context) (any, error) { - return obj.Env, nil + return obj.TotalCount, nil }, nil, - ec.marshalOString2string, + ec.marshalNInt2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostProcess_env(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredentialConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredentialConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcess_cwd(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredentialEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_cwd, + ec.fieldContext_HostCredentialEdge_node, func(ctx context.Context) (any, error) { - return obj.Cwd, nil + return obj.Node, nil }, nil, - ec.marshalOString2string, + ec.marshalOHostCredential2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredential, true, false, ) } -func (ec *executionContext) fieldContext_HostProcess_cwd(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredentialEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredentialEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_HostCredential_id(ctx, field) + case "createdAt": + return ec.fieldContext_HostCredential_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_HostCredential_lastModifiedAt(ctx, field) + case "principal": + return ec.fieldContext_HostCredential_principal(ctx, field) + case "secret": + return ec.fieldContext_HostCredential_secret(ctx, field) + case "kind": + return ec.fieldContext_HostCredential_kind(ctx, field) + case "host": + return ec.fieldContext_HostCredential_host(ctx, field) + case "task": + return ec.fieldContext_HostCredential_task(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostCredential", field.Name) }, } return fc, nil } -func (ec *executionContext) _HostProcess_status(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostCredentialEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.HostCredentialEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_status, + ec.fieldContext_HostCredentialEdge_cursor, func(ctx context.Context) (any, error) { - return obj.Status, nil + return obj.Cursor, nil }, nil, - ec.marshalNHostProcessStatus2realmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Status, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, true, true, ) } -func (ec *executionContext) fieldContext_HostProcess_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostCredentialEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostCredentialEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type HostProcessStatus does not have child fields") + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcess_host(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.HostEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_host, + ec.fieldContext_HostEdge_node, func(ctx context.Context) (any, error) { - return obj.Host(ctx) + return obj.Node, nil }, nil, - ec.marshalNHost2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHost, - true, + ec.marshalOHost2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHost, true, + false, ) } -func (ec *executionContext) fieldContext_HostProcess_host(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostEdge", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { @@ -4968,364 +5038,286 @@ func (ec *executionContext) fieldContext_HostProcess_host(_ context.Context, fie return fc, nil } -func (ec *executionContext) _HostProcess_task(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { +func (ec *executionContext) _HostEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.HostEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcess_task, + ec.fieldContext_HostEdge_cursor, func(ctx context.Context) (any, error) { - return obj.Task(ctx) + return obj.Cursor, nil }, nil, - ec.marshalNTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, true, true, ) } -func (ec *executionContext) fieldContext_HostProcess_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcess", + Object: "HostEdge", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Task_id(ctx, field) - case "createdAt": - return ec.fieldContext_Task_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Task_lastModifiedAt(ctx, field) - case "claimedAt": - return ec.fieldContext_Task_claimedAt(ctx, field) - case "execStartedAt": - return ec.fieldContext_Task_execStartedAt(ctx, field) - case "execFinishedAt": - return ec.fieldContext_Task_execFinishedAt(ctx, field) - case "output": - return ec.fieldContext_Task_output(ctx, field) - case "outputSize": - return ec.fieldContext_Task_outputSize(ctx, field) - case "error": - return ec.fieldContext_Task_error(ctx, field) - case "quest": - return ec.fieldContext_Task_quest(ctx, field) - case "beacon": - return ec.fieldContext_Task_beacon(ctx, field) - case "reportedFiles": - return ec.fieldContext_Task_reportedFiles(ctx, field) - case "reportedProcesses": - return ec.fieldContext_Task_reportedProcesses(ctx, field) - case "reportedCredentials": - return ec.fieldContext_Task_reportedCredentials(ctx, field) - case "shells": - return ec.fieldContext_Task_shells(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcessConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_id(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcessConnection_edges, + ec.fieldContext_HostFile_id, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.ID, nil }, nil, - ec.marshalOHostProcessEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessEdge, + ec.marshalNID2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostProcessConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcessConnection", + Object: "HostFile", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_HostProcessEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_HostProcessEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostProcessEdge", field.Name) + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcessConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcessConnection_pageInfo, + ec.fieldContext_HostFile_createdAt, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.CreatedAt, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_HostProcessConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcessConnection", + Object: "HostFile", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcessConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcessConnection_totalCount, + ec.fieldContext_HostFile_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalNInt2int, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_HostProcessConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcessConnection", + Object: "HostFile", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcessEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_path(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcessEdge_node, + ec.fieldContext_HostFile_path, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.Path, nil }, nil, - ec.marshalOHostProcess2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcess, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext_HostProcessEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_path(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcessEdge", + Object: "HostFile", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_HostProcess_id(ctx, field) - case "createdAt": - return ec.fieldContext_HostProcess_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_HostProcess_lastModifiedAt(ctx, field) - case "pid": - return ec.fieldContext_HostProcess_pid(ctx, field) - case "ppid": - return ec.fieldContext_HostProcess_ppid(ctx, field) - case "name": - return ec.fieldContext_HostProcess_name(ctx, field) - case "principal": - return ec.fieldContext_HostProcess_principal(ctx, field) - case "path": - return ec.fieldContext_HostProcess_path(ctx, field) - case "cmd": - return ec.fieldContext_HostProcess_cmd(ctx, field) - case "env": - return ec.fieldContext_HostProcess_env(ctx, field) - case "cwd": - return ec.fieldContext_HostProcess_cwd(ctx, field) - case "status": - return ec.fieldContext_HostProcess_status(ctx, field) - case "host": - return ec.fieldContext_HostProcess_host(ctx, field) - case "task": - return ec.fieldContext_HostProcess_task(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostProcess", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _HostProcessEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_owner(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_HostProcessEdge_cursor, + ec.fieldContext_HostFile_owner, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.Owner, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_HostProcessEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "HostProcessEdge", + Object: "HostFile", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Link_id(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_group(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Link_id, + ec.fieldContext_HostFile_group, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Group, nil }, nil, - ec.marshalNID2int, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_Link_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_group(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Link", + Object: "HostFile", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Link_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_permissions(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Link_createdAt, + ec.fieldContext_HostFile_permissions, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.Permissions, nil }, nil, - ec.marshalNTime2timeᚐTime, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_Link_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_permissions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Link", + Object: "HostFile", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Link_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_size(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Link_lastModifiedAt, + ec.fieldContext_HostFile_size, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.Size, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNUint642uint64, true, true, ) } -func (ec *executionContext) fieldContext_Link_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_size(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Link", + Object: "HostFile", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type Uint64 does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Link_path(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_hash(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Link_path, + ec.fieldContext_HostFile_hash, func(ctx context.Context) (any, error) { - return obj.Path, nil + return obj.Hash, nil }, nil, - ec.marshalNString2string, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_Link_path(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_hash(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Link", + Object: "HostFile", Field: field, IsMethod: false, IsResolver: false, @@ -5336,606 +5328,728 @@ func (ec *executionContext) fieldContext_Link_path(_ context.Context, field grap return fc, nil } -func (ec *executionContext) _Link_expiresAt(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_host(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Link_expiresAt, + ec.fieldContext_HostFile_host, func(ctx context.Context) (any, error) { - return obj.ExpiresAt, nil + return obj.Host(ctx) }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNHost2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHost, true, true, ) } -func (ec *executionContext) fieldContext_Link_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_host(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Link", + Object: "HostFile", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Host_id(ctx, field) + case "createdAt": + return ec.fieldContext_Host_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Host_lastModifiedAt(ctx, field) + case "identifier": + return ec.fieldContext_Host_identifier(ctx, field) + case "name": + return ec.fieldContext_Host_name(ctx, field) + case "primaryIP": + return ec.fieldContext_Host_primaryIP(ctx, field) + case "externalIP": + return ec.fieldContext_Host_externalIP(ctx, field) + case "platform": + return ec.fieldContext_Host_platform(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Host_lastSeenAt(ctx, field) + case "nextSeenAt": + return ec.fieldContext_Host_nextSeenAt(ctx, field) + case "tags": + return ec.fieldContext_Host_tags(ctx, field) + case "beacons": + return ec.fieldContext_Host_beacons(ctx, field) + case "files": + return ec.fieldContext_Host_files(ctx, field) + case "processes": + return ec.fieldContext_Host_processes(ctx, field) + case "credentials": + return ec.fieldContext_Host_credentials(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Host", field.Name) }, } return fc, nil } -func (ec *executionContext) _Link_downloadLimit(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFile_task(ctx context.Context, field graphql.CollectedField, obj *ent.HostFile) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Link_downloadLimit, + ec.fieldContext_HostFile_task, func(ctx context.Context) (any, error) { - return obj.DownloadLimit, nil + return obj.Task(ctx) }, nil, - ec.marshalOInt2ᚖint, + ec.marshalNTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Link_downloadLimit(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFile_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Link", + Object: "HostFile", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Task_id(ctx, field) + case "createdAt": + return ec.fieldContext_Task_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Task_lastModifiedAt(ctx, field) + case "claimedAt": + return ec.fieldContext_Task_claimedAt(ctx, field) + case "execStartedAt": + return ec.fieldContext_Task_execStartedAt(ctx, field) + case "execFinishedAt": + return ec.fieldContext_Task_execFinishedAt(ctx, field) + case "output": + return ec.fieldContext_Task_output(ctx, field) + case "outputSize": + return ec.fieldContext_Task_outputSize(ctx, field) + case "error": + return ec.fieldContext_Task_error(ctx, field) + case "quest": + return ec.fieldContext_Task_quest(ctx, field) + case "beacon": + return ec.fieldContext_Task_beacon(ctx, field) + case "reportedFiles": + return ec.fieldContext_Task_reportedFiles(ctx, field) + case "reportedProcesses": + return ec.fieldContext_Task_reportedProcesses(ctx, field) + case "reportedCredentials": + return ec.fieldContext_Task_reportedCredentials(ctx, field) + case "shells": + return ec.fieldContext_Task_shells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) }, } return fc, nil } -func (ec *executionContext) _Link_downloads(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFileConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Link_downloads, + ec.fieldContext_HostFileConnection_edges, func(ctx context.Context) (any, error) { - return obj.Downloads, nil + return obj.Edges, nil }, nil, - ec.marshalNInt2int, - true, + ec.marshalOHostFileEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileEdge, true, + false, ) } -func (ec *executionContext) fieldContext_Link_downloads(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFileConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Link", + Object: "HostFileConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "node": + return ec.fieldContext_HostFileEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_HostFileEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostFileEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _Link_asset(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFileConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Link_asset, + ec.fieldContext_HostFileConnection_pageInfo, func(ctx context.Context) (any, error) { - return obj.Asset(ctx) + return obj.PageInfo, nil }, nil, - ec.marshalNAsset2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAsset, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, true, true, ) } -func (ec *executionContext) fieldContext_Link_asset(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFileConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Link", + Object: "HostFileConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Asset_id(ctx, field) - case "createdAt": - return ec.fieldContext_Asset_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Asset_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Asset_name(ctx, field) - case "size": - return ec.fieldContext_Asset_size(ctx, field) - case "hash": - return ec.fieldContext_Asset_hash(ctx, field) - case "tomes": - return ec.fieldContext_Asset_tomes(ctx, field) - case "links": - return ec.fieldContext_Asset_links(ctx, field) - case "creator": - return ec.fieldContext_Asset_creator(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Asset", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _Link_creator(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFileConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Link_creator, + ec.fieldContext_HostFileConnection_totalCount, func(ctx context.Context) (any, error) { - return obj.Creator(ctx) + return obj.TotalCount, nil }, nil, - ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + ec.marshalNInt2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Link_creator(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFileConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Link", + Object: "HostFileConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "photoURL": - return ec.fieldContext_User_photoURL(ctx, field) - case "isActivated": - return ec.fieldContext_User_isActivated(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) - case "tomes": - return ec.fieldContext_User_tomes(ctx, field) - case "activeShells": - return ec.fieldContext_User_activeShells(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LinkConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.LinkConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFileEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_LinkConnection_edges, + ec.fieldContext_HostFileEdge_node, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.Node, nil }, nil, - ec.marshalOLinkEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐLinkEdge, + ec.marshalOHostFile2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFile, true, false, ) } -func (ec *executionContext) fieldContext_LinkConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFileEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LinkConnection", + Object: "HostFileEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "node": - return ec.fieldContext_LinkEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_LinkEdge_cursor(ctx, field) + case "id": + return ec.fieldContext_HostFile_id(ctx, field) + case "createdAt": + return ec.fieldContext_HostFile_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_HostFile_lastModifiedAt(ctx, field) + case "path": + return ec.fieldContext_HostFile_path(ctx, field) + case "owner": + return ec.fieldContext_HostFile_owner(ctx, field) + case "group": + return ec.fieldContext_HostFile_group(ctx, field) + case "permissions": + return ec.fieldContext_HostFile_permissions(ctx, field) + case "size": + return ec.fieldContext_HostFile_size(ctx, field) + case "hash": + return ec.fieldContext_HostFile_hash(ctx, field) + case "host": + return ec.fieldContext_HostFile_host(ctx, field) + case "task": + return ec.fieldContext_HostFile_task(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type LinkEdge", field.Name) + return nil, fmt.Errorf("no field named %q was found under type HostFile", field.Name) }, } return fc, nil } -func (ec *executionContext) _LinkConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.LinkConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostFileEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.HostFileEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_LinkConnection_pageInfo, + ec.fieldContext_HostFileEdge_cursor, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.Cursor, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, true, true, ) } -func (ec *executionContext) fieldContext_LinkConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostFileEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LinkConnection", + Object: "HostFileEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LinkConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.LinkConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_id(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_LinkConnection_totalCount, + ec.fieldContext_HostProcess_id, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.ID, nil }, nil, - ec.marshalNInt2int, + ec.marshalNID2int, true, true, ) } -func (ec *executionContext) fieldContext_LinkConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LinkConnection", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LinkEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.LinkEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_LinkEdge_node, + ec.fieldContext_HostProcess_createdAt, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.CreatedAt, nil }, nil, - ec.marshalOLink2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐLink, + ec.marshalNTime2timeᚐTime, + true, true, - false, ) } -func (ec *executionContext) fieldContext_LinkEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LinkEdge", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Link_id(ctx, field) - case "createdAt": - return ec.fieldContext_Link_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Link_lastModifiedAt(ctx, field) - case "path": - return ec.fieldContext_Link_path(ctx, field) - case "expiresAt": - return ec.fieldContext_Link_expiresAt(ctx, field) - case "downloadLimit": - return ec.fieldContext_Link_downloadLimit(ctx, field) - case "downloads": - return ec.fieldContext_Link_downloads(ctx, field) - case "asset": - return ec.fieldContext_Link_asset(ctx, field) - case "creator": - return ec.fieldContext_Link_creator(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Link", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LinkEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.LinkEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_LinkEdge_cursor, + ec.fieldContext_HostProcess_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_LinkEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LinkEdge", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_pid(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_hasNextPage, + ec.fieldContext_HostProcess_pid, func(ctx context.Context) (any, error) { - return obj.HasNextPage, nil + return obj.Pid, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNUint642uint64, true, true, ) } -func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_pid(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type Uint64 does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_ppid(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_hasPreviousPage, + ec.fieldContext_HostProcess_ppid, func(ctx context.Context) (any, error) { - return obj.HasPreviousPage, nil + return obj.Ppid, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNUint642uint64, true, true, ) } -func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_ppid(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type Uint64 does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_name(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_startCursor, + ec.fieldContext_HostProcess_name, func(ctx context.Context) (any, error) { - return obj.StartCursor, nil + return obj.Name, nil }, nil, - ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_principal(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_endCursor, + ec.fieldContext_HostProcess_principal, func(ctx context.Context) (any, error) { - return obj.EndCursor, nil + return obj.Principal, nil }, nil, - ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_principal(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Portal_id(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_path(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Portal_id, + ec.fieldContext_HostProcess_path, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Path, nil }, nil, - ec.marshalNID2int, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_Portal_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_path(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Portal", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Portal_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_cmd(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Portal_createdAt, + ec.fieldContext_HostProcess_cmd, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.Cmd, nil }, nil, - ec.marshalNTime2timeᚐTime, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_Portal_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_cmd(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Portal", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Portal_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_env(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Portal_lastModifiedAt, + ec.fieldContext_HostProcess_env, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.Env, nil }, nil, - ec.marshalNTime2timeᚐTime, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_Portal_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_env(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Portal", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Portal_closedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_cwd(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Portal_closedAt, + ec.fieldContext_HostProcess_cwd, func(ctx context.Context) (any, error) { - return obj.ClosedAt, nil + return obj.Cwd, nil }, nil, - ec.marshalOTime2timeᚐTime, + ec.marshalOString2string, true, false, ) } -func (ec *executionContext) fieldContext_Portal_closedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_cwd(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Portal", + Object: "HostProcess", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Portal_task(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcess_status(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Portal_task, + ec.fieldContext_HostProcess_status, + func(ctx context.Context) (any, error) { + return obj.Status, nil + }, + nil, + ec.marshalNHostProcessStatus2realmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Status, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_HostProcess_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "HostProcess", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type HostProcessStatus does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _HostProcess_host(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_HostProcess_host, + func(ctx context.Context) (any, error) { + return obj.Host(ctx) + }, + nil, + ec.marshalNHost2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHost, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_HostProcess_host(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "HostProcess", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Host_id(ctx, field) + case "createdAt": + return ec.fieldContext_Host_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Host_lastModifiedAt(ctx, field) + case "identifier": + return ec.fieldContext_Host_identifier(ctx, field) + case "name": + return ec.fieldContext_Host_name(ctx, field) + case "primaryIP": + return ec.fieldContext_Host_primaryIP(ctx, field) + case "externalIP": + return ec.fieldContext_Host_externalIP(ctx, field) + case "platform": + return ec.fieldContext_Host_platform(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Host_lastSeenAt(ctx, field) + case "nextSeenAt": + return ec.fieldContext_Host_nextSeenAt(ctx, field) + case "tags": + return ec.fieldContext_Host_tags(ctx, field) + case "beacons": + return ec.fieldContext_Host_beacons(ctx, field) + case "files": + return ec.fieldContext_Host_files(ctx, field) + case "processes": + return ec.fieldContext_Host_processes(ctx, field) + case "credentials": + return ec.fieldContext_Host_credentials(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Host", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _HostProcess_task(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcess) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_HostProcess_task, func(ctx context.Context) (any, error) { return obj.Task(ctx) }, @@ -5946,9 +6060,9 @@ func (ec *executionContext) _Portal_task(ctx context.Context, field graphql.Coll ) } -func (ec *executionContext) fieldContext_Portal_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcess_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Portal", + Object: "HostProcess", Field: field, IsMethod: true, IsResolver: false, @@ -5991,1347 +6105,857 @@ func (ec *executionContext) fieldContext_Portal_task(_ context.Context, field gr return fc, nil } -func (ec *executionContext) _Portal_beacon(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcessConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Portal_beacon, + ec.fieldContext_HostProcessConnection_edges, func(ctx context.Context) (any, error) { - return obj.Beacon(ctx) + return obj.Edges, nil }, nil, - ec.marshalNBeacon2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeacon, - true, + ec.marshalOHostProcessEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessEdge, true, + false, ) } -func (ec *executionContext) fieldContext_Portal_beacon(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcessConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Portal", + Object: "HostProcessConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Beacon_id(ctx, field) - case "createdAt": - return ec.fieldContext_Beacon_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Beacon_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Beacon_name(ctx, field) - case "principal": - return ec.fieldContext_Beacon_principal(ctx, field) - case "identifier": - return ec.fieldContext_Beacon_identifier(ctx, field) - case "agentIdentifier": - return ec.fieldContext_Beacon_agentIdentifier(ctx, field) - case "lastSeenAt": - return ec.fieldContext_Beacon_lastSeenAt(ctx, field) - case "nextSeenAt": - return ec.fieldContext_Beacon_nextSeenAt(ctx, field) - case "interval": - return ec.fieldContext_Beacon_interval(ctx, field) - case "transport": - return ec.fieldContext_Beacon_transport(ctx, field) - case "host": - return ec.fieldContext_Beacon_host(ctx, field) - case "tasks": - return ec.fieldContext_Beacon_tasks(ctx, field) - case "shells": - return ec.fieldContext_Beacon_shells(ctx, field) + case "node": + return ec.fieldContext_HostProcessEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_HostProcessEdge_cursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Beacon", field.Name) + return nil, fmt.Errorf("no field named %q was found under type HostProcessEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _Portal_owner(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcessConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Portal_owner, + ec.fieldContext_HostProcessConnection_pageInfo, func(ctx context.Context) (any, error) { - return obj.Owner(ctx) + return obj.PageInfo, nil }, nil, - ec.marshalNUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, true, true, ) } -func (ec *executionContext) fieldContext_Portal_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcessConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Portal", + Object: "HostProcessConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "photoURL": - return ec.fieldContext_User_photoURL(ctx, field) - case "isActivated": - return ec.fieldContext_User_isActivated(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) - case "tomes": - return ec.fieldContext_User_tomes(ctx, field) - case "activeShells": - return ec.fieldContext_User_activeShells(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _Portal_activeUsers(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcessConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Portal_activeUsers, + ec.fieldContext_HostProcessConnection_totalCount, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.ActiveUsers(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.UserOrder), fc.Args["where"].(*ent.UserWhereInput)) + return obj.TotalCount, nil }, nil, - ec.marshalNUserConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserConnection, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext_Portal_activeUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcessConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Portal", + Object: "HostProcessConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_UserConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_UserConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_UserConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type UserConnection", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Portal_activeUsers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _PortalConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.PortalConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcessEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PortalConnection_edges, + ec.fieldContext_HostProcessEdge_node, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.Node, nil }, nil, - ec.marshalOPortalEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐPortalEdge, + ec.marshalOHostProcess2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcess, true, false, ) } -func (ec *executionContext) fieldContext_PortalConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcessEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PortalConnection", + Object: "HostProcessEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "node": - return ec.fieldContext_PortalEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_PortalEdge_cursor(ctx, field) + case "id": + return ec.fieldContext_HostProcess_id(ctx, field) + case "createdAt": + return ec.fieldContext_HostProcess_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_HostProcess_lastModifiedAt(ctx, field) + case "pid": + return ec.fieldContext_HostProcess_pid(ctx, field) + case "ppid": + return ec.fieldContext_HostProcess_ppid(ctx, field) + case "name": + return ec.fieldContext_HostProcess_name(ctx, field) + case "principal": + return ec.fieldContext_HostProcess_principal(ctx, field) + case "path": + return ec.fieldContext_HostProcess_path(ctx, field) + case "cmd": + return ec.fieldContext_HostProcess_cmd(ctx, field) + case "env": + return ec.fieldContext_HostProcess_env(ctx, field) + case "cwd": + return ec.fieldContext_HostProcess_cwd(ctx, field) + case "status": + return ec.fieldContext_HostProcess_status(ctx, field) + case "host": + return ec.fieldContext_HostProcess_host(ctx, field) + case "task": + return ec.fieldContext_HostProcess_task(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type PortalEdge", field.Name) + return nil, fmt.Errorf("no field named %q was found under type HostProcess", field.Name) }, } return fc, nil } -func (ec *executionContext) _PortalConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.PortalConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _HostProcessEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.HostProcessEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PortalConnection_pageInfo, + ec.fieldContext_HostProcessEdge_cursor, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.Cursor, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, true, true, ) } -func (ec *executionContext) fieldContext_PortalConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_HostProcessEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PortalConnection", + Object: "HostProcessEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PortalConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.PortalConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Link_id(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PortalConnection_totalCount, + ec.fieldContext_Link_id, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.ID, nil }, nil, - ec.marshalNInt2int, + ec.marshalNID2int, true, true, ) } -func (ec *executionContext) fieldContext_PortalConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Link_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PortalConnection", + Object: "Link", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PortalEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.PortalEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Link_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PortalEdge_node, + ec.fieldContext_Link_createdAt, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.CreatedAt, nil }, nil, - ec.marshalOPortal2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐPortal, + ec.marshalNTime2timeᚐTime, + true, true, - false, ) } -func (ec *executionContext) fieldContext_PortalEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Link_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PortalEdge", + Object: "Link", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Portal_id(ctx, field) - case "createdAt": - return ec.fieldContext_Portal_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Portal_lastModifiedAt(ctx, field) - case "closedAt": - return ec.fieldContext_Portal_closedAt(ctx, field) - case "task": - return ec.fieldContext_Portal_task(ctx, field) - case "beacon": - return ec.fieldContext_Portal_beacon(ctx, field) - case "owner": - return ec.fieldContext_Portal_owner(ctx, field) - case "activeUsers": - return ec.fieldContext_Portal_activeUsers(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Portal", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PortalEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.PortalEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Link_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PortalEdge_cursor, + ec.fieldContext_Link_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_PortalEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Link_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PortalEdge", + Object: "Link", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Query_node(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Link_path(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_node, + ec.fieldContext_Link_path, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Node(ctx, fc.Args["id"].(int)) + return obj.Path, nil }, nil, - ec.marshalONode2realmᚗpubᚋtavernᚋinternalᚋentᚐNoder, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Query_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Link_path(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Link", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + return nil, errors.New("field of type String does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_node_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_nodes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Link_expiresAt(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_nodes, + ec.fieldContext_Link_expiresAt, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Nodes(ctx, fc.Args["ids"].([]int)) + return obj.ExpiresAt, nil }, nil, - ec.marshalNNode2ᚕrealmᚗpubᚋtavernᚋinternalᚋentᚐNoder, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_Query_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Link_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Link", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + return nil, errors.New("field of type Time does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_nodes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_assets(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Link_downloadLimit(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_assets, + ec.fieldContext_Link_downloadLimit, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Assets(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.AssetOrder), fc.Args["where"].(*ent.AssetWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.AssetConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.AssetConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.DownloadLimit, nil }, - ec.marshalNAssetConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetConnection, - true, + nil, + ec.marshalOInt2ᚖint, true, + false, ) } -func (ec *executionContext) fieldContext_Query_assets(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Link_downloadLimit(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Link", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_AssetConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_AssetConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_AssetConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type AssetConnection", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_assets_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_quests(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Link_downloads(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_quests, + ec.fieldContext_Link_downloads, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Quests(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.QuestOrder), fc.Args["where"].(*ent.QuestWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.QuestConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.QuestConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.Downloads, nil }, - ec.marshalNQuestConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestConnection, + nil, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext_Query_quests(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Link_downloads(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Link", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_QuestConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_QuestConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_QuestConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type QuestConnection", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_quests_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_tasks(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Link_asset(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_tasks, + ec.fieldContext_Link_asset, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Tasks(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TaskOrder), fc.Args["where"].(*ent.TaskWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.TaskConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.TaskConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.Asset(ctx) }, - ec.marshalNTaskConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskConnection, + nil, + ec.marshalNAsset2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAsset, true, true, ) } -func (ec *executionContext) fieldContext_Query_tasks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Link_asset(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Link", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_TaskConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_TaskConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_TaskConnection_totalCount(ctx, field) + case "id": + return ec.fieldContext_Asset_id(ctx, field) + case "createdAt": + return ec.fieldContext_Asset_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Asset_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Asset_name(ctx, field) + case "size": + return ec.fieldContext_Asset_size(ctx, field) + case "hash": + return ec.fieldContext_Asset_hash(ctx, field) + case "tomes": + return ec.fieldContext_Asset_tomes(ctx, field) + case "links": + return ec.fieldContext_Asset_links(ctx, field) + case "creator": + return ec.fieldContext_Asset_creator(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type TaskConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Asset", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_tasks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_repositories(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Link_creator(ctx context.Context, field graphql.CollectedField, obj *ent.Link) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_repositories, + ec.fieldContext_Link_creator, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Repositories(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.RepositoryOrder), fc.Args["where"].(*ent.RepositoryWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.RepositoryConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.RepositoryConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.Creator(ctx) }, - ec.marshalNRepositoryConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryConnection, - true, + nil, + ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, true, + false, ) } -func (ec *executionContext) fieldContext_Query_repositories(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Link_creator(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Link", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_RepositoryConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_RepositoryConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_RepositoryConnection_totalCount(ctx, field) + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + case "activeShells": + return ec.fieldContext_User_activeShells(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type RepositoryConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_repositories_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_beacons(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _LinkConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.LinkConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_beacons, + ec.fieldContext_LinkConnection_edges, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Beacons(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.BeaconOrder), fc.Args["where"].(*ent.BeaconWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.BeaconConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.BeaconConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.Edges, nil }, - ec.marshalNBeaconConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconConnection, - true, + nil, + ec.marshalOLinkEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐLinkEdge, true, + false, ) } -func (ec *executionContext) fieldContext_Query_beacons(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LinkConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "LinkConnection", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_BeaconConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_BeaconConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_BeaconConnection_totalCount(ctx, field) + case "node": + return ec.fieldContext_LinkEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_LinkEdge_cursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type BeaconConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type LinkEdge", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_beacons_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_hosts(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _LinkConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.LinkConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_hosts, + ec.fieldContext_LinkConnection_pageInfo, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Hosts(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostOrder), fc.Args["where"].(*ent.HostWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.HostConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.HostConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.PageInfo, nil }, - ec.marshalNHostConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostConnection, + nil, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, true, true, ) } -func (ec *executionContext) fieldContext_Query_hosts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LinkConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "LinkConnection", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_HostConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_HostConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_HostConnection_totalCount(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type HostConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_hosts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_tags(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _LinkConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.LinkConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_tags, + ec.fieldContext_LinkConnection_totalCount, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Tags(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TagOrder), fc.Args["where"].(*ent.TagWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.TagConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.TagConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.TotalCount, nil }, - ec.marshalNTagConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTagConnection, + nil, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext_Query_tags(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LinkConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "LinkConnection", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_TagConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_TagConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_TagConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TagConnection", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_tags_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_tomes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _LinkEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.LinkEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_tomes, + ec.fieldContext_LinkEdge_node, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Tomes(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TomeOrder), fc.Args["where"].(*ent.TomeWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.TomeConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.TomeConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.Node, nil }, - ec.marshalNTomeConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeConnection, - true, + nil, + ec.marshalOLink2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐLink, true, + false, ) } -func (ec *executionContext) fieldContext_Query_tomes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LinkEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "LinkEdge", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_TomeConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_TomeConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_TomeConnection_totalCount(ctx, field) + case "id": + return ec.fieldContext_Link_id(ctx, field) + case "createdAt": + return ec.fieldContext_Link_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Link_lastModifiedAt(ctx, field) + case "path": + return ec.fieldContext_Link_path(ctx, field) + case "expiresAt": + return ec.fieldContext_Link_expiresAt(ctx, field) + case "downloadLimit": + return ec.fieldContext_Link_downloadLimit(ctx, field) + case "downloads": + return ec.fieldContext_Link_downloads(ctx, field) + case "asset": + return ec.fieldContext_Link_asset(ctx, field) + case "creator": + return ec.fieldContext_Link_creator(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type TomeConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Link", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_tomes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_users(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _LinkEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.LinkEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_users, + ec.fieldContext_LinkEdge_cursor, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Users(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.UserOrder), fc.Args["where"].(*ent.UserWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.UserConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.UserConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.Cursor, nil }, - ec.marshalNUserConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserConnection, + nil, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, true, true, ) } -func (ec *executionContext) fieldContext_Query_users(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LinkEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "LinkEdge", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_UserConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_UserConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_UserConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type UserConnection", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_users_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_portals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_portals, + ec.fieldContext_PageInfo_hasNextPage, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Portals(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.PortalOrder), fc.Args["where"].(*ent.PortalWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.PortalConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.PortalConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.HasNextPage, nil }, - ec.marshalNPortalConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐPortalConnection, + nil, + ec.marshalNBoolean2bool, true, true, ) } -func (ec *executionContext) fieldContext_Query_portals(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "PageInfo", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_PortalConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_PortalConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_PortalConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PortalConnection", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_portals_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_shells(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_shells, + ec.fieldContext_PageInfo_hasPreviousPage, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Shells(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ShellOrder), fc.Args["where"].(*ent.ShellWhereInput)) - }, - func(ctx context.Context, next graphql.Resolver) graphql.Resolver { - directive0 := next - - directive1 := func(ctx context.Context) (any, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") - if err != nil { - var zeroVal *ent.ShellConnection - return zeroVal, err - } - if ec.directives.RequireRole == nil { - var zeroVal *ent.ShellConnection - return zeroVal, errors.New("directive requireRole is not implemented") - } - return ec.directives.RequireRole(ctx, nil, directive0, role) - } - - next = directive1 - return next + return obj.HasPreviousPage, nil }, - ec.marshalNShellConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellConnection, + nil, + ec.marshalNBoolean2bool, true, true, ) } -func (ec *executionContext) fieldContext_Query_shells(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "PageInfo", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ShellConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ShellConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ShellConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ShellConnection", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_shells_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_me(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_me, + ec.fieldContext_PageInfo_startCursor, func(ctx context.Context) (any, error) { - return ec.resolvers.Query().Me(ctx) + return obj.StartCursor, nil }, nil, - ec.marshalNUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, - true, + ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor, true, + false, ) } -func (ec *executionContext) fieldContext_Query_me(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "PageInfo", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "photoURL": - return ec.fieldContext_User_photoURL(ctx, field) - case "isActivated": - return ec.fieldContext_User_isActivated(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) - case "tomes": - return ec.fieldContext_User_tomes(ctx, field) - case "activeShells": - return ec.fieldContext_User_activeShells(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query___type, + ec.fieldContext_PageInfo_endCursor, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.introspectType(fc.Args["name"].(string)) + return obj.EndCursor, nil }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor, true, false, ) } -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "PageInfo", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Portal_id(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query___schema, + ec.fieldContext_Portal_id, func(ctx context.Context) (any, error) { - return ec.introspectSchema() + return obj.ID, nil }, nil, - ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema, + ec.marshalNID2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Portal_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Portal", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "description": - return ec.fieldContext___Schema_description(ctx, field) - case "types": - return ec.fieldContext___Schema_types(ctx, field) - case "queryType": - return ec.fieldContext___Schema_queryType(ctx, field) - case "mutationType": - return ec.fieldContext___Schema_mutationType(ctx, field) - case "subscriptionType": - return ec.fieldContext___Schema_subscriptionType(ctx, field) - case "directives": - return ec.fieldContext___Schema_directives(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Quest_id(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _Portal_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_id, + ec.fieldContext_Portal_createdAt, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.CreatedAt, nil }, nil, - ec.marshalNID2int, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_Quest_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Portal_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "Portal", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Quest_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _Portal_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_createdAt, + ec.fieldContext_Portal_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.LastModifiedAt, nil }, nil, ec.marshalNTime2timeᚐTime, @@ -7340,9 +6964,9 @@ func (ec *executionContext) _Quest_createdAt(ctx context.Context, field graphql. ) } -func (ec *executionContext) fieldContext_Quest_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Portal_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "Portal", Field: field, IsMethod: false, IsResolver: false, @@ -7353,25 +6977,25 @@ func (ec *executionContext) fieldContext_Quest_createdAt(_ context.Context, fiel return fc, nil } -func (ec *executionContext) _Quest_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _Portal_closedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_lastModifiedAt, + ec.fieldContext_Portal_closedAt, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.ClosedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, - true, + ec.marshalOTime2timeᚐTime, true, + false, ) } -func (ec *executionContext) fieldContext_Quest_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Portal_closedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "Portal", Field: field, IsMethod: false, IsResolver: false, @@ -7382,722 +7006,1068 @@ func (ec *executionContext) fieldContext_Quest_lastModifiedAt(_ context.Context, return fc, nil } -func (ec *executionContext) _Quest_name(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _Portal_task(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_name, + ec.fieldContext_Portal_task, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.Task(ctx) }, nil, - ec.marshalNString2string, + ec.marshalNTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, true, true, ) } -func (ec *executionContext) fieldContext_Quest_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Portal_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "Portal", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Task_id(ctx, field) + case "createdAt": + return ec.fieldContext_Task_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Task_lastModifiedAt(ctx, field) + case "claimedAt": + return ec.fieldContext_Task_claimedAt(ctx, field) + case "execStartedAt": + return ec.fieldContext_Task_execStartedAt(ctx, field) + case "execFinishedAt": + return ec.fieldContext_Task_execFinishedAt(ctx, field) + case "output": + return ec.fieldContext_Task_output(ctx, field) + case "outputSize": + return ec.fieldContext_Task_outputSize(ctx, field) + case "error": + return ec.fieldContext_Task_error(ctx, field) + case "quest": + return ec.fieldContext_Task_quest(ctx, field) + case "beacon": + return ec.fieldContext_Task_beacon(ctx, field) + case "reportedFiles": + return ec.fieldContext_Task_reportedFiles(ctx, field) + case "reportedProcesses": + return ec.fieldContext_Task_reportedProcesses(ctx, field) + case "reportedCredentials": + return ec.fieldContext_Task_reportedCredentials(ctx, field) + case "shells": + return ec.fieldContext_Task_shells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) }, } return fc, nil } -func (ec *executionContext) _Quest_parameters(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _Portal_beacon(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_parameters, + ec.fieldContext_Portal_beacon, func(ctx context.Context) (any, error) { - return obj.Parameters, nil + return obj.Beacon(ctx) }, nil, - ec.marshalOString2string, + ec.marshalNBeacon2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeacon, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Quest_parameters(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Portal_beacon(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "Portal", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Beacon_id(ctx, field) + case "createdAt": + return ec.fieldContext_Beacon_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Beacon_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Beacon_name(ctx, field) + case "principal": + return ec.fieldContext_Beacon_principal(ctx, field) + case "identifier": + return ec.fieldContext_Beacon_identifier(ctx, field) + case "agentIdentifier": + return ec.fieldContext_Beacon_agentIdentifier(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Beacon_lastSeenAt(ctx, field) + case "nextSeenAt": + return ec.fieldContext_Beacon_nextSeenAt(ctx, field) + case "interval": + return ec.fieldContext_Beacon_interval(ctx, field) + case "transport": + return ec.fieldContext_Beacon_transport(ctx, field) + case "host": + return ec.fieldContext_Beacon_host(ctx, field) + case "tasks": + return ec.fieldContext_Beacon_tasks(ctx, field) + case "shells": + return ec.fieldContext_Beacon_shells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Beacon", field.Name) }, } return fc, nil } -func (ec *executionContext) _Quest_paramDefsAtCreation(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _Portal_owner(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_paramDefsAtCreation, + ec.fieldContext_Portal_owner, func(ctx context.Context) (any, error) { - return obj.ParamDefsAtCreation, nil + return obj.Owner(ctx) }, nil, - ec.marshalOString2string, + ec.marshalNUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Quest_paramDefsAtCreation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Portal_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "Portal", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + case "activeShells": + return ec.fieldContext_User_activeShells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, } return fc, nil } -func (ec *executionContext) _Quest_eldritchAtCreation(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _Portal_activeUsers(ctx context.Context, field graphql.CollectedField, obj *ent.Portal) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_eldritchAtCreation, + ec.fieldContext_Portal_activeUsers, func(ctx context.Context) (any, error) { - return obj.EldritchAtCreation, nil + fc := graphql.GetFieldContext(ctx) + return obj.ActiveUsers(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.UserOrder), fc.Args["where"].(*ent.UserWhereInput)) }, nil, - ec.marshalOString2string, + ec.marshalNUserConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserConnection, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Quest_eldritchAtCreation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Portal_activeUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "Portal", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_UserConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_UserConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_UserConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Portal_activeUsers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Quest_tome(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _PortalConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.PortalConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_tome, + ec.fieldContext_PortalConnection_edges, func(ctx context.Context) (any, error) { - return obj.Tome(ctx) + return obj.Edges, nil }, nil, - ec.marshalNTome2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTome, - true, + ec.marshalOPortalEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐPortalEdge, true, + false, ) } -func (ec *executionContext) fieldContext_Quest_tome(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PortalConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "PortalConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Tome_id(ctx, field) - case "createdAt": - return ec.fieldContext_Tome_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Tome_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Tome_name(ctx, field) - case "description": - return ec.fieldContext_Tome_description(ctx, field) - case "author": - return ec.fieldContext_Tome_author(ctx, field) - case "supportModel": - return ec.fieldContext_Tome_supportModel(ctx, field) - case "tactic": - return ec.fieldContext_Tome_tactic(ctx, field) - case "runOnNewBeaconCallback": - return ec.fieldContext_Tome_runOnNewBeaconCallback(ctx, field) - case "runOnFirstHostCallback": - return ec.fieldContext_Tome_runOnFirstHostCallback(ctx, field) - case "runOnSchedule": - return ec.fieldContext_Tome_runOnSchedule(ctx, field) - case "paramDefs": - return ec.fieldContext_Tome_paramDefs(ctx, field) - case "eldritch": - return ec.fieldContext_Tome_eldritch(ctx, field) - case "assets": - return ec.fieldContext_Tome_assets(ctx, field) - case "uploader": - return ec.fieldContext_Tome_uploader(ctx, field) - case "repository": - return ec.fieldContext_Tome_repository(ctx, field) - case "scheduledHosts": - return ec.fieldContext_Tome_scheduledHosts(ctx, field) + case "node": + return ec.fieldContext_PortalEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_PortalEdge_cursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PortalEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _Quest_bundle(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _PortalConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.PortalConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_bundle, + ec.fieldContext_PortalConnection_pageInfo, func(ctx context.Context) (any, error) { - return obj.Bundle(ctx) + return obj.PageInfo, nil }, nil, - ec.marshalOAsset2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAsset, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Quest_bundle(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PortalConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "PortalConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Asset_id(ctx, field) - case "createdAt": - return ec.fieldContext_Asset_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Asset_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Asset_name(ctx, field) - case "size": - return ec.fieldContext_Asset_size(ctx, field) - case "hash": - return ec.fieldContext_Asset_hash(ctx, field) - case "tomes": - return ec.fieldContext_Asset_tomes(ctx, field) - case "links": - return ec.fieldContext_Asset_links(ctx, field) - case "creator": - return ec.fieldContext_Asset_creator(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Asset", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _Quest_tasks(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _PortalConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.PortalConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_tasks, + ec.fieldContext_PortalConnection_totalCount, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Tasks(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TaskOrder), fc.Args["where"].(*ent.TaskWhereInput)) + return obj.TotalCount, nil }, nil, - ec.marshalNTaskConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskConnection, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext_Quest_tasks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PortalConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "PortalConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_TaskConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_TaskConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_TaskConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TaskConnection", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Quest_tasks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Quest_creator(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { +func (ec *executionContext) _PortalEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.PortalEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Quest_creator, + ec.fieldContext_PortalEdge_node, func(ctx context.Context) (any, error) { - return obj.Creator(ctx) + return obj.Node, nil }, nil, - ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + ec.marshalOPortal2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐPortal, true, false, ) } -func (ec *executionContext) fieldContext_Quest_creator(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PortalEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Quest", + Object: "PortalEdge", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "photoURL": - return ec.fieldContext_User_photoURL(ctx, field) - case "isActivated": - return ec.fieldContext_User_isActivated(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) - case "tomes": - return ec.fieldContext_User_tomes(ctx, field) - case "activeShells": - return ec.fieldContext_User_activeShells(ctx, field) + return ec.fieldContext_Portal_id(ctx, field) + case "createdAt": + return ec.fieldContext_Portal_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Portal_lastModifiedAt(ctx, field) + case "closedAt": + return ec.fieldContext_Portal_closedAt(ctx, field) + case "task": + return ec.fieldContext_Portal_task(ctx, field) + case "beacon": + return ec.fieldContext_Portal_beacon(ctx, field) + case "owner": + return ec.fieldContext_Portal_owner(ctx, field) + case "activeUsers": + return ec.fieldContext_Portal_activeUsers(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Portal", field.Name) }, } return fc, nil } -func (ec *executionContext) _QuestConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.QuestConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _PortalEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.PortalEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_QuestConnection_edges, + ec.fieldContext_PortalEdge_cursor, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.Cursor, nil }, nil, - ec.marshalOQuestEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestEdge, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + true, true, - false, ) } -func (ec *executionContext) fieldContext_QuestConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PortalEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "QuestConnection", + Object: "PortalEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_QuestEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_QuestEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type QuestEdge", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _QuestConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.QuestConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_node(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_QuestConnection_pageInfo, + ec.fieldContext_Query_node, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Node(ctx, fc.Args["id"].(int)) }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, - true, + ec.marshalONode2realmᚗpubᚋtavernᚋinternalᚋentᚐNoder, true, + false, ) } -func (ec *executionContext) fieldContext_QuestConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "QuestConnection", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_node_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _QuestConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.QuestConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_nodes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_QuestConnection_totalCount, + ec.fieldContext_Query_nodes, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Nodes(ctx, fc.Args["ids"].([]int)) }, nil, - ec.marshalNInt2int, + ec.marshalNNode2ᚕrealmᚗpubᚋtavernᚋinternalᚋentᚐNoder, true, true, ) } -func (ec *executionContext) fieldContext_QuestConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "QuestConnection", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_nodes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _QuestEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.QuestEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_assets(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_QuestEdge_node, + ec.fieldContext_Query_assets, func(ctx context.Context) (any, error) { - return obj.Node, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Assets(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.AssetOrder), fc.Args["where"].(*ent.AssetWhereInput)) }, - nil, - ec.marshalOQuest2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuest, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.AssetConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.AssetConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNAssetConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetConnection, + true, true, - false, ) } -func (ec *executionContext) fieldContext_QuestEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_assets(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "QuestEdge", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Quest_id(ctx, field) - case "createdAt": - return ec.fieldContext_Quest_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Quest_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Quest_name(ctx, field) - case "parameters": - return ec.fieldContext_Quest_parameters(ctx, field) - case "paramDefsAtCreation": - return ec.fieldContext_Quest_paramDefsAtCreation(ctx, field) - case "eldritchAtCreation": - return ec.fieldContext_Quest_eldritchAtCreation(ctx, field) - case "tome": - return ec.fieldContext_Quest_tome(ctx, field) - case "bundle": - return ec.fieldContext_Quest_bundle(ctx, field) - case "tasks": - return ec.fieldContext_Quest_tasks(ctx, field) - case "creator": - return ec.fieldContext_Quest_creator(ctx, field) + case "edges": + return ec.fieldContext_AssetConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_AssetConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_AssetConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Quest", field.Name) + return nil, fmt.Errorf("no field named %q was found under type AssetConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_assets_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _QuestEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.QuestEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_quests(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_QuestEdge_cursor, + ec.fieldContext_Query_quests, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Quests(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.QuestOrder), fc.Args["where"].(*ent.QuestWhereInput)) }, - nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.QuestConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.QuestConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNQuestConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestConnection, true, true, ) } -func (ec *executionContext) fieldContext_QuestEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_quests(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "QuestEdge", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_QuestConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_QuestConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_QuestConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type QuestConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_quests_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Repository_id(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_tasks(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Repository_id, + ec.fieldContext_Query_tasks, func(ctx context.Context) (any, error) { - return obj.ID, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Tasks(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TaskOrder), fc.Args["where"].(*ent.TaskWhereInput)) }, - nil, - ec.marshalNID2int, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.TaskConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.TaskConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNTaskConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskConnection, true, true, ) } -func (ec *executionContext) fieldContext_Repository_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_tasks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Repository", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_TaskConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_TaskConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_TaskConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TaskConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_tasks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Repository_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_repositories(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Repository_createdAt, + ec.fieldContext_Query_repositories, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Repositories(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.RepositoryOrder), fc.Args["where"].(*ent.RepositoryWhereInput)) }, - nil, - ec.marshalNTime2timeᚐTime, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.RepositoryConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.RepositoryConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNRepositoryConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryConnection, true, true, ) } -func (ec *executionContext) fieldContext_Repository_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_repositories(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Repository", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_RepositoryConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_RepositoryConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_RepositoryConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RepositoryConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_repositories_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Repository_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_beacons(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Repository_lastModifiedAt, + ec.fieldContext_Query_beacons, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Beacons(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.BeaconOrder), fc.Args["where"].(*ent.BeaconWhereInput)) }, - nil, - ec.marshalNTime2timeᚐTime, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.BeaconConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.BeaconConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNBeaconConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconConnection, true, true, ) } -func (ec *executionContext) fieldContext_Repository_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_beacons(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Repository", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil + switch field.Name { + case "edges": + return ec.fieldContext_BeaconConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_BeaconConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_BeaconConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BeaconConnection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_beacons_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil } -func (ec *executionContext) _Repository_url(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_hosts(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Repository_url, + ec.fieldContext_Query_hosts, func(ctx context.Context) (any, error) { - return obj.URL, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Hosts(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostOrder), fc.Args["where"].(*ent.HostWhereInput)) }, - nil, - ec.marshalNString2string, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.HostConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.HostConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNHostConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostConnection, true, true, ) } -func (ec *executionContext) fieldContext_Repository_url(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_hosts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Repository", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_HostConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_HostConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_HostConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_hosts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Repository_publicKey(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_tags(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Repository_publicKey, + ec.fieldContext_Query_tags, func(ctx context.Context) (any, error) { - return obj.PublicKey, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Tags(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TagOrder), fc.Args["where"].(*ent.TagWhereInput)) }, - nil, - ec.marshalNString2string, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.TagConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.TagConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNTagConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTagConnection, true, true, ) } -func (ec *executionContext) fieldContext_Repository_publicKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_tags(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Repository", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_TagConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_TagConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_TagConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TagConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_tags_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Repository_lastImportedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_tomes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Repository_lastImportedAt, + ec.fieldContext_Query_tomes, func(ctx context.Context) (any, error) { - return obj.LastImportedAt, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Tomes(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TomeOrder), fc.Args["where"].(*ent.TomeWhereInput)) }, - nil, - ec.marshalOTime2timeᚐTime, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.TomeConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.TomeConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNTomeConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeConnection, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Repository_lastImportedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_tomes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Repository", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_TomeConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_TomeConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_TomeConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TomeConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_tomes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Repository_tomes(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_users(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Repository_tomes, + ec.fieldContext_Query_users, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return obj.Tomes(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TomeOrder), fc.Args["where"].(*ent.TomeWhereInput)) + return ec.resolvers.Query().Users(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.UserOrder), fc.Args["where"].(*ent.UserWhereInput)) }, - nil, - ec.marshalNTomeConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeConnection, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.UserConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.UserConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNUserConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserConnection, true, true, ) } -func (ec *executionContext) fieldContext_Repository_tomes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_users(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Repository", + Object: "Query", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "edges": - return ec.fieldContext_TomeConnection_edges(ctx, field) + return ec.fieldContext_UserConnection_edges(ctx, field) case "pageInfo": - return ec.fieldContext_TomeConnection_pageInfo(ctx, field) + return ec.fieldContext_UserConnection_pageInfo(ctx, field) case "totalCount": - return ec.fieldContext_TomeConnection_totalCount(ctx, field) + return ec.fieldContext_UserConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type TomeConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type UserConnection", field.Name) }, } defer func() { @@ -8107,303 +8077,471 @@ func (ec *executionContext) fieldContext_Repository_tomes(ctx context.Context, f } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Repository_tomes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Query_users_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Repository_owner(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_portals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Repository_owner, + ec.fieldContext_Query_portals, func(ctx context.Context) (any, error) { - return obj.Owner(ctx) + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Portals(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.PortalOrder), fc.Args["where"].(*ent.PortalWhereInput)) }, - nil, - ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, - true, - false, - ) -} + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next -func (ec *executionContext) fieldContext_Repository_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.PortalConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.PortalConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNPortalConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐPortalConnection, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Query_portals(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Repository", + Object: "Query", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "photoURL": - return ec.fieldContext_User_photoURL(ctx, field) - case "isActivated": - return ec.fieldContext_User_isActivated(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) - case "tomes": - return ec.fieldContext_User_tomes(ctx, field) - case "activeShells": - return ec.fieldContext_User_activeShells(ctx, field) + case "edges": + return ec.fieldContext_PortalConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_PortalConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_PortalConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, fmt.Errorf("no field named %q was found under type PortalConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_portals_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _RepositoryConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_shells(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RepositoryConnection_edges, + ec.fieldContext_Query_shells, func(ctx context.Context) (any, error) { - return obj.Edges, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Shells(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ShellOrder), fc.Args["where"].(*ent.ShellWhereInput)) }, - nil, - ec.marshalORepositoryEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryEdge, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.ShellConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.ShellConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNShellConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellConnection, + true, true, - false, ) } -func (ec *executionContext) fieldContext_RepositoryConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_shells(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RepositoryConnection", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "node": - return ec.fieldContext_RepositoryEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_RepositoryEdge_cursor(ctx, field) + case "edges": + return ec.fieldContext_ShellConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ShellConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ShellConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type RepositoryEdge", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ShellConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_shells_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _RepositoryConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_buildTasks(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RepositoryConnection_pageInfo, + ec.fieldContext_Query_buildTasks, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().BuildTasks(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.BuildTaskOrder), fc.Args["where"].(*ent.BuildTaskWhereInput)) }, - nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + var zeroVal *ent.BuildTaskConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.BuildTaskConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNBuildTaskConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskConnection, true, true, ) } -func (ec *executionContext) fieldContext_RepositoryConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_buildTasks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RepositoryConnection", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) + case "edges": + return ec.fieldContext_BuildTaskConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_BuildTaskConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_BuildTaskConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, fmt.Errorf("no field named %q was found under type BuildTaskConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_buildTasks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _RepositoryConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_builders(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RepositoryConnection_totalCount, + ec.fieldContext_Query_builders, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Builders(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.BuilderOrder), fc.Args["where"].(*ent.BuilderWhereInput)) }, - nil, - ec.marshalNInt2int, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "ADMIN") + if err != nil { + var zeroVal *ent.BuilderConnection + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.BuilderConnection + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNBuilderConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderConnection, true, true, ) } -func (ec *executionContext) fieldContext_RepositoryConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_builders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RepositoryConnection", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_BuilderConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_BuilderConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_BuilderConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BuilderConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_builders_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _RepositoryEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_me(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RepositoryEdge_node, + ec.fieldContext_Query_me, func(ctx context.Context) (any, error) { - return obj.Node, nil + return ec.resolvers.Query().Me(ctx) }, nil, - ec.marshalORepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository, + ec.marshalNUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + true, true, - false, ) } -func (ec *executionContext) fieldContext_RepositoryEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_me(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RepositoryEdge", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_Repository_id(ctx, field) - case "createdAt": - return ec.fieldContext_Repository_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Repository_lastModifiedAt(ctx, field) - case "url": - return ec.fieldContext_Repository_url(ctx, field) - case "publicKey": - return ec.fieldContext_Repository_publicKey(ctx, field) - case "lastImportedAt": - return ec.fieldContext_Repository_lastImportedAt(ctx, field) - case "tomes": - return ec.fieldContext_Repository_tomes(ctx, field) - case "owner": - return ec.fieldContext_Repository_owner(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Repository", field.Name) + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + case "activeShells": + return ec.fieldContext_User_activeShells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, } return fc, nil } -func (ec *executionContext) _RepositoryEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RepositoryEdge_cursor, + ec.fieldContext_Query___type, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + fc := graphql.GetFieldContext(ctx) + return ec.introspectType(fc.Args["name"].(string)) }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, - true, + ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, true, + false, ) } -func (ec *executionContext) fieldContext_RepositoryEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RepositoryEdge", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Shell_id(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Shell_id, + ec.fieldContext_Query___schema, func(ctx context.Context) (any, error) { - return obj.ID, nil + return ec.introspectSchema() }, nil, - ec.marshalNID2int, - true, + ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema, true, + false, ) } -func (ec *executionContext) fieldContext_Shell_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Shell", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) }, } return fc, nil } -func (ec *executionContext) _Shell_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { +func (ec *executionContext) _Quest_id(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Shell_createdAt, + ec.fieldContext_Quest_id, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.ID, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNID2int, true, true, ) } -func (ec *executionContext) fieldContext_Shell_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Quest_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Shell", + Object: "Quest", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Shell_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { +func (ec *executionContext) _Quest_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Shell_lastModifiedAt, + ec.fieldContext_Quest_createdAt, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.CreatedAt, nil }, nil, ec.marshalNTime2timeᚐTime, @@ -8412,9 +8550,9 @@ func (ec *executionContext) _Shell_lastModifiedAt(ctx context.Context, field gra ) } -func (ec *executionContext) fieldContext_Shell_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Quest_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Shell", + Object: "Quest", Field: field, IsMethod: false, IsResolver: false, @@ -8425,25 +8563,25 @@ func (ec *executionContext) fieldContext_Shell_lastModifiedAt(_ context.Context, return fc, nil } -func (ec *executionContext) _Shell_closedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { +func (ec *executionContext) _Quest_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Shell_closedAt, + ec.fieldContext_Quest_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.ClosedAt, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalOTime2timeᚐTime, + ec.marshalNTime2timeᚐTime, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Shell_closedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Quest_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Shell", + Object: "Quest", Field: field, IsMethod: false, IsResolver: false, @@ -8454,204 +8592,269 @@ func (ec *executionContext) fieldContext_Shell_closedAt(_ context.Context, field return fc, nil } -func (ec *executionContext) _Shell_task(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { +func (ec *executionContext) _Quest_name(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Shell_task, + ec.fieldContext_Quest_name, func(ctx context.Context) (any, error) { - return obj.Task(ctx) + return obj.Name, nil }, nil, - ec.marshalNTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext_Shell_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Quest_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Shell", + Object: "Quest", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Task_id(ctx, field) - case "createdAt": - return ec.fieldContext_Task_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Task_lastModifiedAt(ctx, field) - case "claimedAt": - return ec.fieldContext_Task_claimedAt(ctx, field) - case "execStartedAt": - return ec.fieldContext_Task_execStartedAt(ctx, field) - case "execFinishedAt": - return ec.fieldContext_Task_execFinishedAt(ctx, field) - case "output": - return ec.fieldContext_Task_output(ctx, field) - case "outputSize": - return ec.fieldContext_Task_outputSize(ctx, field) - case "error": - return ec.fieldContext_Task_error(ctx, field) - case "quest": - return ec.fieldContext_Task_quest(ctx, field) - case "beacon": - return ec.fieldContext_Task_beacon(ctx, field) - case "reportedFiles": - return ec.fieldContext_Task_reportedFiles(ctx, field) - case "reportedProcesses": - return ec.fieldContext_Task_reportedProcesses(ctx, field) - case "reportedCredentials": - return ec.fieldContext_Task_reportedCredentials(ctx, field) - case "shells": - return ec.fieldContext_Task_shells(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Shell_beacon(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { +func (ec *executionContext) _Quest_parameters(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Shell_beacon, + ec.fieldContext_Quest_parameters, func(ctx context.Context) (any, error) { - return obj.Beacon(ctx) + return obj.Parameters, nil }, nil, - ec.marshalNBeacon2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeacon, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_Shell_beacon(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Quest_parameters(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Shell", + Object: "Quest", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Beacon_id(ctx, field) - case "createdAt": - return ec.fieldContext_Beacon_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Beacon_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Beacon_name(ctx, field) - case "principal": - return ec.fieldContext_Beacon_principal(ctx, field) - case "identifier": - return ec.fieldContext_Beacon_identifier(ctx, field) - case "agentIdentifier": - return ec.fieldContext_Beacon_agentIdentifier(ctx, field) - case "lastSeenAt": - return ec.fieldContext_Beacon_lastSeenAt(ctx, field) - case "nextSeenAt": - return ec.fieldContext_Beacon_nextSeenAt(ctx, field) - case "interval": - return ec.fieldContext_Beacon_interval(ctx, field) - case "transport": - return ec.fieldContext_Beacon_transport(ctx, field) - case "host": - return ec.fieldContext_Beacon_host(ctx, field) - case "tasks": - return ec.fieldContext_Beacon_tasks(ctx, field) - case "shells": - return ec.fieldContext_Beacon_shells(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Beacon", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Shell_owner(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { +func (ec *executionContext) _Quest_paramDefsAtCreation(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Shell_owner, + ec.fieldContext_Quest_paramDefsAtCreation, func(ctx context.Context) (any, error) { - return obj.Owner(ctx) + return obj.ParamDefsAtCreation, nil }, nil, - ec.marshalNUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, - true, + ec.marshalOString2string, true, + false, ) } -func (ec *executionContext) fieldContext_Shell_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Quest_paramDefsAtCreation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Shell", + Object: "Quest", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "photoURL": - return ec.fieldContext_User_photoURL(ctx, field) - case "isActivated": - return ec.fieldContext_User_isActivated(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Quest_eldritchAtCreation(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Quest_eldritchAtCreation, + func(ctx context.Context) (any, error) { + return obj.EldritchAtCreation, nil + }, + nil, + ec.marshalOString2string, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Quest_eldritchAtCreation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Quest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Quest_tome(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Quest_tome, + func(ctx context.Context) (any, error) { + return obj.Tome(ctx) + }, + nil, + ec.marshalNTome2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTome, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Quest_tome(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Quest", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Tome_id(ctx, field) + case "createdAt": + return ec.fieldContext_Tome_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Tome_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Tome_name(ctx, field) + case "description": + return ec.fieldContext_Tome_description(ctx, field) + case "author": + return ec.fieldContext_Tome_author(ctx, field) + case "supportModel": + return ec.fieldContext_Tome_supportModel(ctx, field) + case "tactic": + return ec.fieldContext_Tome_tactic(ctx, field) + case "runOnNewBeaconCallback": + return ec.fieldContext_Tome_runOnNewBeaconCallback(ctx, field) + case "runOnFirstHostCallback": + return ec.fieldContext_Tome_runOnFirstHostCallback(ctx, field) + case "runOnSchedule": + return ec.fieldContext_Tome_runOnSchedule(ctx, field) + case "paramDefs": + return ec.fieldContext_Tome_paramDefs(ctx, field) + case "eldritch": + return ec.fieldContext_Tome_eldritch(ctx, field) + case "assets": + return ec.fieldContext_Tome_assets(ctx, field) + case "uploader": + return ec.fieldContext_Tome_uploader(ctx, field) + case "repository": + return ec.fieldContext_Tome_repository(ctx, field) + case "scheduledHosts": + return ec.fieldContext_Tome_scheduledHosts(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Quest_bundle(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Quest_bundle, + func(ctx context.Context) (any, error) { + return obj.Bundle(ctx) + }, + nil, + ec.marshalOAsset2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAsset, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Quest_bundle(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Quest", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Asset_id(ctx, field) + case "createdAt": + return ec.fieldContext_Asset_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Asset_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Asset_name(ctx, field) + case "size": + return ec.fieldContext_Asset_size(ctx, field) + case "hash": + return ec.fieldContext_Asset_hash(ctx, field) case "tomes": - return ec.fieldContext_User_tomes(ctx, field) - case "activeShells": - return ec.fieldContext_User_activeShells(ctx, field) + return ec.fieldContext_Asset_tomes(ctx, field) + case "links": + return ec.fieldContext_Asset_links(ctx, field) + case "creator": + return ec.fieldContext_Asset_creator(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Asset", field.Name) }, } return fc, nil } -func (ec *executionContext) _Shell_activeUsers(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { +func (ec *executionContext) _Quest_tasks(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Shell_activeUsers, + ec.fieldContext_Quest_tasks, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return obj.ActiveUsers(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.UserOrder), fc.Args["where"].(*ent.UserWhereInput)) + return obj.Tasks(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TaskOrder), fc.Args["where"].(*ent.TaskWhereInput)) }, nil, - ec.marshalNUserConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserConnection, + ec.marshalNTaskConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskConnection, true, true, ) } -func (ec *executionContext) fieldContext_Shell_activeUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Quest_tasks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Shell", + Object: "Quest", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "edges": - return ec.fieldContext_UserConnection_edges(ctx, field) + return ec.fieldContext_TaskConnection_edges(ctx, field) case "pageInfo": - return ec.fieldContext_UserConnection_pageInfo(ctx, field) + return ec.fieldContext_TaskConnection_pageInfo(ctx, field) case "totalCount": - return ec.fieldContext_UserConnection_totalCount(ctx, field) + return ec.fieldContext_TaskConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type UserConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type TaskConnection", field.Name) }, } defer func() { @@ -8661,54 +8864,99 @@ func (ec *executionContext) fieldContext_Shell_activeUsers(ctx context.Context, } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Shell_activeUsers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Quest_tasks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _ShellConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ShellConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Quest_creator(ctx context.Context, field graphql.CollectedField, obj *ent.Quest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ShellConnection_edges, + ec.fieldContext_Quest_creator, + func(ctx context.Context) (any, error) { + return obj.Creator(ctx) + }, + nil, + ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Quest_creator(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Quest", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + case "activeShells": + return ec.fieldContext_User_activeShells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _QuestConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.QuestConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_QuestConnection_edges, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - ec.marshalOShellEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellEdge, + ec.marshalOQuestEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestEdge, true, false, ) } -func (ec *executionContext) fieldContext_ShellConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_QuestConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ShellConnection", + Object: "QuestConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "node": - return ec.fieldContext_ShellEdge_node(ctx, field) + return ec.fieldContext_QuestEdge_node(ctx, field) case "cursor": - return ec.fieldContext_ShellEdge_cursor(ctx, field) + return ec.fieldContext_QuestEdge_cursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type ShellEdge", field.Name) + return nil, fmt.Errorf("no field named %q was found under type QuestEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _ShellConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ShellConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _QuestConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.QuestConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ShellConnection_pageInfo, + ec.fieldContext_QuestConnection_pageInfo, func(ctx context.Context) (any, error) { return obj.PageInfo, nil }, @@ -8719,9 +8967,9 @@ func (ec *executionContext) _ShellConnection_pageInfo(ctx context.Context, field ) } -func (ec *executionContext) fieldContext_ShellConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_QuestConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ShellConnection", + Object: "QuestConnection", Field: field, IsMethod: false, IsResolver: false, @@ -8742,12 +8990,12 @@ func (ec *executionContext) fieldContext_ShellConnection_pageInfo(_ context.Cont return fc, nil } -func (ec *executionContext) _ShellConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ShellConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _QuestConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.QuestConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ShellConnection_totalCount, + ec.fieldContext_QuestConnection_totalCount, func(ctx context.Context) (any, error) { return obj.TotalCount, nil }, @@ -8758,9 +9006,9 @@ func (ec *executionContext) _ShellConnection_totalCount(ctx context.Context, fie ) } -func (ec *executionContext) fieldContext_ShellConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_QuestConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ShellConnection", + Object: "QuestConnection", Field: field, IsMethod: false, IsResolver: false, @@ -8771,59 +9019,65 @@ func (ec *executionContext) fieldContext_ShellConnection_totalCount(_ context.Co return fc, nil } -func (ec *executionContext) _ShellEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ShellEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _QuestEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.QuestEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ShellEdge_node, + ec.fieldContext_QuestEdge_node, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - ec.marshalOShell2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShell, + ec.marshalOQuest2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuest, true, false, ) } -func (ec *executionContext) fieldContext_ShellEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_QuestEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ShellEdge", + Object: "QuestEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_Shell_id(ctx, field) + return ec.fieldContext_Quest_id(ctx, field) case "createdAt": - return ec.fieldContext_Shell_createdAt(ctx, field) + return ec.fieldContext_Quest_createdAt(ctx, field) case "lastModifiedAt": - return ec.fieldContext_Shell_lastModifiedAt(ctx, field) - case "closedAt": - return ec.fieldContext_Shell_closedAt(ctx, field) - case "task": - return ec.fieldContext_Shell_task(ctx, field) - case "beacon": - return ec.fieldContext_Shell_beacon(ctx, field) - case "owner": - return ec.fieldContext_Shell_owner(ctx, field) - case "activeUsers": - return ec.fieldContext_Shell_activeUsers(ctx, field) + return ec.fieldContext_Quest_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Quest_name(ctx, field) + case "parameters": + return ec.fieldContext_Quest_parameters(ctx, field) + case "paramDefsAtCreation": + return ec.fieldContext_Quest_paramDefsAtCreation(ctx, field) + case "eldritchAtCreation": + return ec.fieldContext_Quest_eldritchAtCreation(ctx, field) + case "tome": + return ec.fieldContext_Quest_tome(ctx, field) + case "bundle": + return ec.fieldContext_Quest_bundle(ctx, field) + case "tasks": + return ec.fieldContext_Quest_tasks(ctx, field) + case "creator": + return ec.fieldContext_Quest_creator(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Shell", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Quest", field.Name) }, } return fc, nil } -func (ec *executionContext) _ShellEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ShellEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _QuestEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.QuestEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ShellEdge_cursor, + ec.fieldContext_QuestEdge_cursor, func(ctx context.Context) (any, error) { return obj.Cursor, nil }, @@ -8834,9 +9088,9 @@ func (ec *executionContext) _ShellEdge_cursor(ctx context.Context, field graphql ) } -func (ec *executionContext) fieldContext_ShellEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_QuestEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ShellEdge", + Object: "QuestEdge", Field: field, IsMethod: false, IsResolver: false, @@ -8847,12 +9101,12 @@ func (ec *executionContext) fieldContext_ShellEdge_cursor(_ context.Context, fie return fc, nil } -func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { +func (ec *executionContext) _Repository_id(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tag_id, + ec.fieldContext_Repository_id, func(ctx context.Context) (any, error) { return obj.ID, nil }, @@ -8863,9 +9117,9 @@ func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.Collected ) } -func (ec *executionContext) fieldContext_Tag_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tag", + Object: "Repository", Field: field, IsMethod: false, IsResolver: false, @@ -8876,604 +9130,607 @@ func (ec *executionContext) fieldContext_Tag_id(_ context.Context, field graphql return fc, nil } -func (ec *executionContext) _Tag_name(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { +func (ec *executionContext) _Repository_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tag_name, + ec.fieldContext_Repository_createdAt, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.CreatedAt, nil }, nil, - ec.marshalNString2string, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_Tag_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tag", + Object: "Repository", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tag_kind(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { +func (ec *executionContext) _Repository_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tag_kind, + ec.fieldContext_Repository_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.Kind, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalNTagKind2realmᚗpubᚋtavernᚋinternalᚋentᚋtagᚐKind, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_Tag_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tag", + Object: "Repository", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type TagKind does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tag_hosts(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { +func (ec *executionContext) _Repository_url(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tag_hosts, + ec.fieldContext_Repository_url, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Hosts(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostOrder), fc.Args["where"].(*ent.HostWhereInput)) + return obj.URL, nil }, nil, - ec.marshalNHostConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostConnection, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext_Tag_hosts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_url(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tag", + Object: "Repository", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_HostConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_HostConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_HostConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostConnection", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Tag_hosts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _TagConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TagConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Repository_publicKey(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TagConnection_edges, + ec.fieldContext_Repository_publicKey, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.PublicKey, nil }, nil, - ec.marshalOTagEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTagEdge, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext_TagConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_publicKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TagConnection", + Object: "Repository", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_TagEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_TagEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TagEdge", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _TagConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TagConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Repository_lastImportedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TagConnection_pageInfo, + ec.fieldContext_Repository_lastImportedAt, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.LastImportedAt, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, - true, + ec.marshalOTime2timeᚐTime, true, + false, ) } -func (ec *executionContext) fieldContext_TagConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_lastImportedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TagConnection", + Object: "Repository", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _TagConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TagConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Repository_tomes(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TagConnection_totalCount, + ec.fieldContext_Repository_tomes, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + fc := graphql.GetFieldContext(ctx) + return obj.Tomes(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TomeOrder), fc.Args["where"].(*ent.TomeWhereInput)) }, nil, - ec.marshalNInt2int, + ec.marshalNTomeConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeConnection, true, true, ) } -func (ec *executionContext) fieldContext_TagConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_tomes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TagConnection", + Object: "Repository", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_TomeConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_TomeConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_TomeConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TomeConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Repository_tomes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _TagEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TagEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Repository_owner(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TagEdge_node, + ec.fieldContext_Repository_owner, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.Owner(ctx) }, nil, - ec.marshalOTag2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTag, + ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, true, false, ) } -func (ec *executionContext) fieldContext_TagEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TagEdge", + Object: "Repository", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_Tag_id(ctx, field) + return ec.fieldContext_User_id(ctx, field) case "name": - return ec.fieldContext_Tag_name(ctx, field) - case "kind": - return ec.fieldContext_Tag_kind(ctx, field) - case "hosts": - return ec.fieldContext_Tag_hosts(ctx, field) + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + case "activeShells": + return ec.fieldContext_User_activeShells(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Tag", field.Name) + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, } return fc, nil } -func (ec *executionContext) _TagEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TagEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _RepositoryConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TagEdge_cursor, + ec.fieldContext_RepositoryConnection_edges, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.Edges, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, - true, + ec.marshalORepositoryEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryEdge, true, + false, ) } -func (ec *executionContext) fieldContext_TagEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TagEdge", + Object: "RepositoryConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Task_id(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_Task_id, - func(ctx context.Context) (any, error) { - return obj.ID, nil - }, - nil, - ec.marshalNID2int, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_Task_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Task", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + switch field.Name { + case "node": + return ec.fieldContext_RepositoryEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_RepositoryEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RepositoryEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _Task_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _RepositoryConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_createdAt, + ec.fieldContext_RepositoryConnection_pageInfo, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.PageInfo, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, true, true, ) } -func (ec *executionContext) fieldContext_Task_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "RepositoryConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _Task_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _RepositoryConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_lastModifiedAt, + ec.fieldContext_RepositoryConnection_totalCount, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.TotalCount, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext_Task_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "RepositoryConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_claimedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _RepositoryEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_claimedAt, + ec.fieldContext_RepositoryEdge_node, func(ctx context.Context) (any, error) { - return obj.ClaimedAt, nil + return obj.Node, nil }, nil, - ec.marshalOTime2timeᚐTime, + ec.marshalORepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository, true, false, ) } -func (ec *executionContext) fieldContext_Task_claimedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "RepositoryEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Repository_id(ctx, field) + case "createdAt": + return ec.fieldContext_Repository_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Repository_lastModifiedAt(ctx, field) + case "url": + return ec.fieldContext_Repository_url(ctx, field) + case "publicKey": + return ec.fieldContext_Repository_publicKey(ctx, field) + case "lastImportedAt": + return ec.fieldContext_Repository_lastImportedAt(ctx, field) + case "tomes": + return ec.fieldContext_Repository_tomes(ctx, field) + case "owner": + return ec.fieldContext_Repository_owner(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Repository", field.Name) }, } return fc, nil } -func (ec *executionContext) _Task_execStartedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _RepositoryEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_execStartedAt, + ec.fieldContext_RepositoryEdge_cursor, func(ctx context.Context) (any, error) { - return obj.ExecStartedAt, nil + return obj.Cursor, nil }, nil, - ec.marshalOTime2timeᚐTime, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Task_execStartedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "RepositoryEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_execFinishedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _Shell_id(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_execFinishedAt, + ec.fieldContext_Shell_id, func(ctx context.Context) (any, error) { - return obj.ExecFinishedAt, nil + return obj.ID, nil }, nil, - ec.marshalOTime2timeᚐTime, + ec.marshalNID2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Task_execFinishedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Shell_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Shell", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_output(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _Shell_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_output, + ec.fieldContext_Shell_createdAt, func(ctx context.Context) (any, error) { - return obj.Output, nil + return obj.CreatedAt, nil }, nil, - ec.marshalOString2string, + ec.marshalNTime2timeᚐTime, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Task_output(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Shell_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Shell", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_outputSize(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _Shell_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_outputSize, + ec.fieldContext_Shell_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.OutputSize, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalNInt2int, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_Task_outputSize(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Shell_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Shell", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_error(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _Shell_closedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_error, + ec.fieldContext_Shell_closedAt, func(ctx context.Context) (any, error) { - return obj.Error, nil + return obj.ClosedAt, nil }, nil, - ec.marshalOString2string, + ec.marshalOTime2timeᚐTime, true, false, ) } -func (ec *executionContext) fieldContext_Task_error(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Shell_closedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Shell", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_quest(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _Shell_task(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_quest, + ec.fieldContext_Shell_task, func(ctx context.Context) (any, error) { - return obj.Quest(ctx) + return obj.Task(ctx) }, nil, - ec.marshalNQuest2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuest, + ec.marshalNTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, true, true, ) } -func (ec *executionContext) fieldContext_Task_quest(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Shell_task(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Shell", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_Quest_id(ctx, field) + return ec.fieldContext_Task_id(ctx, field) case "createdAt": - return ec.fieldContext_Quest_createdAt(ctx, field) + return ec.fieldContext_Task_createdAt(ctx, field) case "lastModifiedAt": - return ec.fieldContext_Quest_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Quest_name(ctx, field) - case "parameters": - return ec.fieldContext_Quest_parameters(ctx, field) - case "paramDefsAtCreation": - return ec.fieldContext_Quest_paramDefsAtCreation(ctx, field) - case "eldritchAtCreation": - return ec.fieldContext_Quest_eldritchAtCreation(ctx, field) - case "tome": - return ec.fieldContext_Quest_tome(ctx, field) - case "bundle": - return ec.fieldContext_Quest_bundle(ctx, field) - case "tasks": - return ec.fieldContext_Quest_tasks(ctx, field) - case "creator": - return ec.fieldContext_Quest_creator(ctx, field) + return ec.fieldContext_Task_lastModifiedAt(ctx, field) + case "claimedAt": + return ec.fieldContext_Task_claimedAt(ctx, field) + case "execStartedAt": + return ec.fieldContext_Task_execStartedAt(ctx, field) + case "execFinishedAt": + return ec.fieldContext_Task_execFinishedAt(ctx, field) + case "output": + return ec.fieldContext_Task_output(ctx, field) + case "outputSize": + return ec.fieldContext_Task_outputSize(ctx, field) + case "error": + return ec.fieldContext_Task_error(ctx, field) + case "quest": + return ec.fieldContext_Task_quest(ctx, field) + case "beacon": + return ec.fieldContext_Task_beacon(ctx, field) + case "reportedFiles": + return ec.fieldContext_Task_reportedFiles(ctx, field) + case "reportedProcesses": + return ec.fieldContext_Task_reportedProcesses(ctx, field) + case "reportedCredentials": + return ec.fieldContext_Task_reportedCredentials(ctx, field) + case "shells": + return ec.fieldContext_Task_shells(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Quest", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) }, } return fc, nil } -func (ec *executionContext) _Task_beacon(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _Shell_beacon(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_beacon, + ec.fieldContext_Shell_beacon, func(ctx context.Context) (any, error) { return obj.Beacon(ctx) }, @@ -9484,9 +9741,9 @@ func (ec *executionContext) _Task_beacon(ctx context.Context, field graphql.Coll ) } -func (ec *executionContext) fieldContext_Task_beacon(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Shell_beacon(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Shell", Field: field, IsMethod: true, IsResolver: false, @@ -9527,186 +9784,84 @@ func (ec *executionContext) fieldContext_Task_beacon(_ context.Context, field gr return fc, nil } -func (ec *executionContext) _Task_reportedFiles(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _Shell_owner(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_reportedFiles, + ec.fieldContext_Shell_owner, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.ReportedFiles(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostFileOrder), fc.Args["where"].(*ent.HostFileWhereInput)) + return obj.Owner(ctx) }, nil, - ec.marshalNHostFileConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileConnection, + ec.marshalNUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, true, true, ) } -func (ec *executionContext) fieldContext_Task_reportedFiles(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Task", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_HostFileConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_HostFileConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_HostFileConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostFileConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Task_reportedFiles_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Task_reportedProcesses(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_Task_reportedProcesses, - func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.ReportedProcesses(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostProcessOrder), fc.Args["where"].(*ent.HostProcessWhereInput)) - }, - nil, - ec.marshalNHostProcessConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessConnection, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_Task_reportedProcesses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Task", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_HostProcessConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_HostProcessConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_HostProcessConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostProcessConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Task_reportedProcesses_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Task_reportedCredentials(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_Task_reportedCredentials, - func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.ReportedCredentials(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostCredentialOrder), fc.Args["where"].(*ent.HostCredentialWhereInput)) - }, - nil, - ec.marshalNHostCredentialConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialConnection, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_Task_reportedCredentials(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Shell_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Shell", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_HostCredentialConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_HostCredentialConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_HostCredentialConnection_totalCount(ctx, field) + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + case "activeShells": + return ec.fieldContext_User_activeShells(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type HostCredentialConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Task_reportedCredentials_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Task_shells(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { +func (ec *executionContext) _Shell_activeUsers(ctx context.Context, field graphql.CollectedField, obj *ent.Shell) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Task_shells, + ec.fieldContext_Shell_activeUsers, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return obj.Shells(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ShellOrder), fc.Args["where"].(*ent.ShellWhereInput)) + return obj.ActiveUsers(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.UserOrder), fc.Args["where"].(*ent.UserWhereInput)) }, nil, - ec.marshalNShellConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellConnection, + ec.marshalNUserConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserConnection, true, true, ) } -func (ec *executionContext) fieldContext_Task_shells(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Shell_activeUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Shell", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "edges": - return ec.fieldContext_ShellConnection_edges(ctx, field) + return ec.fieldContext_UserConnection_edges(ctx, field) case "pageInfo": - return ec.fieldContext_ShellConnection_pageInfo(ctx, field) + return ec.fieldContext_UserConnection_pageInfo(ctx, field) case "totalCount": - return ec.fieldContext_ShellConnection_totalCount(ctx, field) + return ec.fieldContext_UserConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type ShellConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type UserConnection", field.Name) }, } defer func() { @@ -9716,54 +9871,54 @@ func (ec *executionContext) fieldContext_Task_shells(ctx context.Context, field } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Task_shells_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Shell_activeUsers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _TaskConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ShellConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ShellConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TaskConnection_edges, + ec.fieldContext_ShellConnection_edges, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - ec.marshalOTaskEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskEdge, + ec.marshalOShellEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellEdge, true, false, ) } -func (ec *executionContext) fieldContext_TaskConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShellConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskConnection", + Object: "ShellConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "node": - return ec.fieldContext_TaskEdge_node(ctx, field) + return ec.fieldContext_ShellEdge_node(ctx, field) case "cursor": - return ec.fieldContext_TaskEdge_cursor(ctx, field) + return ec.fieldContext_ShellEdge_cursor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type TaskEdge", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ShellEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _TaskConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ShellConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ShellConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TaskConnection_pageInfo, + ec.fieldContext_ShellConnection_pageInfo, func(ctx context.Context) (any, error) { return obj.PageInfo, nil }, @@ -9774,9 +9929,9 @@ func (ec *executionContext) _TaskConnection_pageInfo(ctx context.Context, field ) } -func (ec *executionContext) fieldContext_TaskConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShellConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskConnection", + Object: "ShellConnection", Field: field, IsMethod: false, IsResolver: false, @@ -9797,12 +9952,12 @@ func (ec *executionContext) fieldContext_TaskConnection_pageInfo(_ context.Conte return fc, nil } -func (ec *executionContext) _TaskConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ShellConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ShellConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TaskConnection_totalCount, + ec.fieldContext_ShellConnection_totalCount, func(ctx context.Context) (any, error) { return obj.TotalCount, nil }, @@ -9813,9 +9968,9 @@ func (ec *executionContext) _TaskConnection_totalCount(ctx context.Context, fiel ) } -func (ec *executionContext) fieldContext_TaskConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShellConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskConnection", + Object: "ShellConnection", Field: field, IsMethod: false, IsResolver: false, @@ -9826,73 +9981,59 @@ func (ec *executionContext) fieldContext_TaskConnection_totalCount(_ context.Con return fc, nil } -func (ec *executionContext) _TaskEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TaskEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ShellEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ShellEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TaskEdge_node, + ec.fieldContext_ShellEdge_node, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - ec.marshalOTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, + ec.marshalOShell2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShell, true, false, ) } -func (ec *executionContext) fieldContext_TaskEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShellEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskEdge", + Object: "ShellEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_Task_id(ctx, field) + return ec.fieldContext_Shell_id(ctx, field) case "createdAt": - return ec.fieldContext_Task_createdAt(ctx, field) + return ec.fieldContext_Shell_createdAt(ctx, field) case "lastModifiedAt": - return ec.fieldContext_Task_lastModifiedAt(ctx, field) - case "claimedAt": - return ec.fieldContext_Task_claimedAt(ctx, field) - case "execStartedAt": - return ec.fieldContext_Task_execStartedAt(ctx, field) - case "execFinishedAt": - return ec.fieldContext_Task_execFinishedAt(ctx, field) - case "output": - return ec.fieldContext_Task_output(ctx, field) - case "outputSize": - return ec.fieldContext_Task_outputSize(ctx, field) - case "error": - return ec.fieldContext_Task_error(ctx, field) - case "quest": - return ec.fieldContext_Task_quest(ctx, field) + return ec.fieldContext_Shell_lastModifiedAt(ctx, field) + case "closedAt": + return ec.fieldContext_Shell_closedAt(ctx, field) + case "task": + return ec.fieldContext_Shell_task(ctx, field) case "beacon": - return ec.fieldContext_Task_beacon(ctx, field) - case "reportedFiles": - return ec.fieldContext_Task_reportedFiles(ctx, field) - case "reportedProcesses": - return ec.fieldContext_Task_reportedProcesses(ctx, field) - case "reportedCredentials": - return ec.fieldContext_Task_reportedCredentials(ctx, field) - case "shells": - return ec.fieldContext_Task_shells(ctx, field) + return ec.fieldContext_Shell_beacon(ctx, field) + case "owner": + return ec.fieldContext_Shell_owner(ctx, field) + case "activeUsers": + return ec.fieldContext_Shell_activeUsers(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Shell", field.Name) }, } return fc, nil } -func (ec *executionContext) _TaskEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TaskEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ShellEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ShellEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TaskEdge_cursor, + ec.fieldContext_ShellEdge_cursor, func(ctx context.Context) (any, error) { return obj.Cursor, nil }, @@ -9903,9 +10044,9 @@ func (ec *executionContext) _TaskEdge_cursor(ctx context.Context, field graphql. ) } -func (ec *executionContext) fieldContext_TaskEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShellEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskEdge", + Object: "ShellEdge", Field: field, IsMethod: false, IsResolver: false, @@ -9916,12 +10057,12 @@ func (ec *executionContext) fieldContext_TaskEdge_cursor(_ context.Context, fiel return fc, nil } -func (ec *executionContext) _Tome_id(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_id, + ec.fieldContext_Tag_id, func(ctx context.Context) (any, error) { return obj.ID, nil }, @@ -9932,9 +10073,9 @@ func (ec *executionContext) _Tome_id(ctx context.Context, field graphql.Collecte ) } -func (ec *executionContext) fieldContext_Tome_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tag_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Tag", Field: field, IsMethod: false, IsResolver: false, @@ -9945,1211 +10086,3726 @@ func (ec *executionContext) fieldContext_Tome_id(_ context.Context, field graphq return fc, nil } -func (ec *executionContext) _Tome_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Tag_name(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_createdAt, + ec.fieldContext_Tag_name, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.Name, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext_Tome_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tag_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Tag", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Tag_kind(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_lastModifiedAt, + ec.fieldContext_Tag_kind, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.Kind, nil }, nil, - ec.marshalNTime2timeᚐTime, + ec.marshalNTagKind2realmᚗpubᚋtavernᚋinternalᚋentᚋtagᚐKind, true, true, ) } -func (ec *executionContext) fieldContext_Tome_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tag_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Tag", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type TagKind does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_name(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Tag_hosts(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_name, + ec.fieldContext_Tag_hosts, func(ctx context.Context) (any, error) { - return obj.Name, nil + fc := graphql.GetFieldContext(ctx) + return obj.Hosts(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostOrder), fc.Args["where"].(*ent.HostWhereInput)) }, nil, - ec.marshalNString2string, + ec.marshalNHostConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostConnection, true, true, ) } -func (ec *executionContext) fieldContext_Tome_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tag_hosts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Tag", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_HostConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_HostConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_HostConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Tag_hosts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Tome_description(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _TagConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TagConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_description, + ec.fieldContext_TagConnection_edges, func(ctx context.Context) (any, error) { - return obj.Description, nil + return obj.Edges, nil }, nil, - ec.marshalNString2string, - true, + ec.marshalOTagEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTagEdge, true, + false, ) } -func (ec *executionContext) fieldContext_Tome_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TagConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TagConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "node": + return ec.fieldContext_TagEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_TagEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TagEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_author(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _TagConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TagConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_author, + ec.fieldContext_TagConnection_pageInfo, func(ctx context.Context) (any, error) { - return obj.Author, nil + return obj.PageInfo, nil }, nil, - ec.marshalNString2string, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, true, true, ) } -func (ec *executionContext) fieldContext_Tome_author(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TagConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TagConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_supportModel(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _TagConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TagConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_supportModel, + ec.fieldContext_TagConnection_totalCount, func(ctx context.Context) (any, error) { - return obj.SupportModel, nil + return obj.TotalCount, nil }, nil, - ec.marshalNTomeSupportModel2realmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐSupportModel, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext_Tome_supportModel(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TagConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TagConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type TomeSupportModel does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_tactic(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _TagEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TagEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_tactic, + ec.fieldContext_TagEdge_node, func(ctx context.Context) (any, error) { - return obj.Tactic, nil + return obj.Node, nil }, nil, - ec.marshalNTomeTactic2realmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐTactic, - true, + ec.marshalOTag2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTag, true, + false, ) } -func (ec *executionContext) fieldContext_Tome_tactic(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TagEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TagEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type TomeTactic does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Tag_id(ctx, field) + case "name": + return ec.fieldContext_Tag_name(ctx, field) + case "kind": + return ec.fieldContext_Tag_kind(ctx, field) + case "hosts": + return ec.fieldContext_Tag_hosts(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Tag", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_runOnNewBeaconCallback(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _TagEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TagEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_runOnNewBeaconCallback, + ec.fieldContext_TagEdge_cursor, func(ctx context.Context) (any, error) { - return obj.RunOnNewBeaconCallback, nil + return obj.Cursor, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, true, true, ) } -func (ec *executionContext) fieldContext_Tome_runOnNewBeaconCallback(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TagEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TagEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_runOnFirstHostCallback(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_id(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_runOnFirstHostCallback, + ec.fieldContext_Task_id, func(ctx context.Context) (any, error) { - return obj.RunOnFirstHostCallback, nil + return obj.ID, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNID2int, true, true, ) } -func (ec *executionContext) fieldContext_Tome_runOnFirstHostCallback(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_runOnSchedule(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_runOnSchedule, + ec.fieldContext_Task_createdAt, func(ctx context.Context) (any, error) { - return obj.RunOnSchedule, nil + return obj.CreatedAt, nil }, nil, - ec.marshalNString2string, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_Tome_runOnSchedule(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_paramDefs(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_paramDefs, + ec.fieldContext_Task_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.ParamDefs, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalOString2string, + ec.marshalNTime2timeᚐTime, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Tome_paramDefs(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_eldritch(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_claimedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_eldritch, + ec.fieldContext_Task_claimedAt, func(ctx context.Context) (any, error) { - return obj.Eldritch, nil + return obj.ClaimedAt, nil }, nil, - ec.marshalNString2string, - true, + ec.marshalOTime2timeᚐTime, true, + false, ) } -func (ec *executionContext) fieldContext_Tome_eldritch(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_claimedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_assets(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_execStartedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_assets, + ec.fieldContext_Task_execStartedAt, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Assets(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.AssetOrder), fc.Args["where"].(*ent.AssetWhereInput)) + return obj.ExecStartedAt, nil }, nil, - ec.marshalNAssetConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetConnection, - true, + ec.marshalOTime2timeᚐTime, true, + false, ) } -func (ec *executionContext) fieldContext_Tome_assets(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_execStartedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_AssetConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_AssetConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_AssetConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type AssetConnection", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Tome_assets_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Tome_uploader(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_execFinishedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_uploader, + ec.fieldContext_Task_execFinishedAt, func(ctx context.Context) (any, error) { - return obj.Uploader(ctx) + return obj.ExecFinishedAt, nil }, nil, - ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + ec.marshalOTime2timeᚐTime, true, false, ) } -func (ec *executionContext) fieldContext_Tome_uploader(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_execFinishedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "photoURL": - return ec.fieldContext_User_photoURL(ctx, field) - case "isActivated": - return ec.fieldContext_User_isActivated(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) - case "tomes": - return ec.fieldContext_User_tomes(ctx, field) - case "activeShells": - return ec.fieldContext_User_activeShells(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_repository(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_output(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_repository, + ec.fieldContext_Task_output, func(ctx context.Context) (any, error) { - return obj.Repository(ctx) + return obj.Output, nil }, nil, - ec.marshalORepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository, + ec.marshalOString2string, true, false, ) } -func (ec *executionContext) fieldContext_Tome_repository(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_output(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Repository_id(ctx, field) - case "createdAt": - return ec.fieldContext_Repository_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Repository_lastModifiedAt(ctx, field) - case "url": - return ec.fieldContext_Repository_url(ctx, field) - case "publicKey": - return ec.fieldContext_Repository_publicKey(ctx, field) - case "lastImportedAt": - return ec.fieldContext_Repository_lastImportedAt(ctx, field) - case "tomes": - return ec.fieldContext_Repository_tomes(ctx, field) - case "owner": - return ec.fieldContext_Repository_owner(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Repository", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_scheduledHosts(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_outputSize(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Tome_scheduledHosts, + ec.fieldContext_Task_outputSize, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.ScheduledHosts(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostOrder), fc.Args["where"].(*ent.HostWhereInput)) + return obj.OutputSize, nil }, nil, - ec.marshalNHostConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostConnection, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext_Tome_scheduledHosts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_outputSize(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_HostConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_HostConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_HostConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostConnection", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Tome_scheduledHosts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _TomeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TomeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_error(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TomeConnection_edges, + ec.fieldContext_Task_error, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.Error, nil }, nil, - ec.marshalOTomeEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeEdge, + ec.marshalOString2string, true, false, ) } -func (ec *executionContext) fieldContext_TomeConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_error(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TomeConnection", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_TomeEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_TomeEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TomeEdge", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _TomeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TomeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_quest(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TomeConnection_pageInfo, + ec.fieldContext_Task_quest, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.Quest(ctx) }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + ec.marshalNQuest2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuest, true, true, ) } -func (ec *executionContext) fieldContext_TomeConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_quest(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TomeConnection", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) + case "id": + return ec.fieldContext_Quest_id(ctx, field) + case "createdAt": + return ec.fieldContext_Quest_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Quest_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Quest_name(ctx, field) + case "parameters": + return ec.fieldContext_Quest_parameters(ctx, field) + case "paramDefsAtCreation": + return ec.fieldContext_Quest_paramDefsAtCreation(ctx, field) + case "eldritchAtCreation": + return ec.fieldContext_Quest_eldritchAtCreation(ctx, field) + case "tome": + return ec.fieldContext_Quest_tome(ctx, field) + case "bundle": + return ec.fieldContext_Quest_bundle(ctx, field) + case "tasks": + return ec.fieldContext_Quest_tasks(ctx, field) + case "creator": + return ec.fieldContext_Quest_creator(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Quest", field.Name) }, } return fc, nil } -func (ec *executionContext) _TomeConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TomeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_beacon(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TomeConnection_totalCount, + ec.fieldContext_Task_beacon, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.Beacon(ctx) }, nil, - ec.marshalNInt2int, + ec.marshalNBeacon2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeacon, true, true, ) } -func (ec *executionContext) fieldContext_TomeConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_beacon(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TomeConnection", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Beacon_id(ctx, field) + case "createdAt": + return ec.fieldContext_Beacon_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Beacon_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Beacon_name(ctx, field) + case "principal": + return ec.fieldContext_Beacon_principal(ctx, field) + case "identifier": + return ec.fieldContext_Beacon_identifier(ctx, field) + case "agentIdentifier": + return ec.fieldContext_Beacon_agentIdentifier(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Beacon_lastSeenAt(ctx, field) + case "nextSeenAt": + return ec.fieldContext_Beacon_nextSeenAt(ctx, field) + case "interval": + return ec.fieldContext_Beacon_interval(ctx, field) + case "transport": + return ec.fieldContext_Beacon_transport(ctx, field) + case "host": + return ec.fieldContext_Beacon_host(ctx, field) + case "tasks": + return ec.fieldContext_Beacon_tasks(ctx, field) + case "shells": + return ec.fieldContext_Beacon_shells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Beacon", field.Name) }, } return fc, nil } -func (ec *executionContext) _TomeEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TomeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_reportedFiles(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TomeEdge_node, + ec.fieldContext_Task_reportedFiles, func(ctx context.Context) (any, error) { - return obj.Node, nil + fc := graphql.GetFieldContext(ctx) + return obj.ReportedFiles(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostFileOrder), fc.Args["where"].(*ent.HostFileWhereInput)) }, nil, - ec.marshalOTome2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTome, + ec.marshalNHostFileConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileConnection, + true, true, - false, ) } -func (ec *executionContext) fieldContext_TomeEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_reportedFiles(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TomeEdge", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Tome_id(ctx, field) - case "createdAt": - return ec.fieldContext_Tome_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Tome_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Tome_name(ctx, field) - case "description": - return ec.fieldContext_Tome_description(ctx, field) - case "author": - return ec.fieldContext_Tome_author(ctx, field) - case "supportModel": - return ec.fieldContext_Tome_supportModel(ctx, field) - case "tactic": - return ec.fieldContext_Tome_tactic(ctx, field) - case "runOnNewBeaconCallback": - return ec.fieldContext_Tome_runOnNewBeaconCallback(ctx, field) - case "runOnFirstHostCallback": - return ec.fieldContext_Tome_runOnFirstHostCallback(ctx, field) - case "runOnSchedule": - return ec.fieldContext_Tome_runOnSchedule(ctx, field) - case "paramDefs": - return ec.fieldContext_Tome_paramDefs(ctx, field) - case "eldritch": - return ec.fieldContext_Tome_eldritch(ctx, field) - case "assets": - return ec.fieldContext_Tome_assets(ctx, field) - case "uploader": - return ec.fieldContext_Tome_uploader(ctx, field) - case "repository": - return ec.fieldContext_Tome_repository(ctx, field) - case "scheduledHosts": - return ec.fieldContext_Tome_scheduledHosts(ctx, field) + case "edges": + return ec.fieldContext_HostFileConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_HostFileConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_HostFileConnection_totalCount(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) + return nil, fmt.Errorf("no field named %q was found under type HostFileConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Task_reportedFiles_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _TomeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TomeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_reportedProcesses(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TomeEdge_cursor, + ec.fieldContext_Task_reportedProcesses, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + fc := graphql.GetFieldContext(ctx) + return obj.ReportedProcesses(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostProcessOrder), fc.Args["where"].(*ent.HostProcessWhereInput)) }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + ec.marshalNHostProcessConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessConnection, true, true, ) } -func (ec *executionContext) fieldContext_TomeEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_reportedProcesses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TomeEdge", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_HostProcessConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_HostProcessConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_HostProcessConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostProcessConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Task_reportedProcesses_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_reportedCredentials(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_id, + ec.fieldContext_Task_reportedCredentials, func(ctx context.Context) (any, error) { - return obj.ID, nil + fc := graphql.GetFieldContext(ctx) + return obj.ReportedCredentials(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostCredentialOrder), fc.Args["where"].(*ent.HostCredentialWhereInput)) }, nil, - ec.marshalNID2int, + ec.marshalNHostCredentialConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialConnection, true, true, ) } -func (ec *executionContext) fieldContext_User_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_reportedCredentials(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_HostCredentialConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_HostCredentialConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_HostCredentialConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostCredentialConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Task_reportedCredentials_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { +func (ec *executionContext) _Task_shells(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_name, + ec.fieldContext_Task_shells, func(ctx context.Context) (any, error) { - return obj.Name, nil + fc := graphql.GetFieldContext(ctx) + return obj.Shells(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ShellOrder), fc.Args["where"].(*ent.ShellWhereInput)) }, nil, - ec.marshalNString2string, + ec.marshalNShellConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellConnection, true, true, ) } -func (ec *executionContext) fieldContext_User_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_shells(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "edges": + return ec.fieldContext_ShellConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ShellConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ShellConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ShellConnection", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Task_shells_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _User_photoURL(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { +func (ec *executionContext) _TaskConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_photoURL, + ec.fieldContext_TaskConnection_edges, func(ctx context.Context) (any, error) { - return obj.PhotoURL, nil + return obj.Edges, nil }, nil, - ec.marshalNString2string, - true, + ec.marshalOTaskEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskEdge, true, + false, ) } -func (ec *executionContext) fieldContext_User_photoURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "TaskConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "node": + return ec.fieldContext_TaskEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_TaskEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TaskEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _User_isActivated(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { +func (ec *executionContext) _TaskConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_isActivated, + ec.fieldContext_TaskConnection_pageInfo, func(ctx context.Context) (any, error) { - return obj.IsActivated, nil + return obj.PageInfo, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, true, true, ) } -func (ec *executionContext) fieldContext_User_isActivated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "TaskConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _User_isAdmin(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { +func (ec *executionContext) _TaskConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_isAdmin, + ec.fieldContext_TaskConnection_totalCount, func(ctx context.Context) (any, error) { - return obj.IsAdmin, nil + return obj.TotalCount, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext_User_isAdmin(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "TaskConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _User_tomes(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { +func (ec *executionContext) _TaskEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TaskEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_tomes, + ec.fieldContext_TaskEdge_node, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Tomes(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TomeOrder), fc.Args["where"].(*ent.TomeWhereInput)) + return obj.Node, nil }, nil, - ec.marshalNTomeConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeConnection, - true, + ec.marshalOTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask, true, + false, ) } -func (ec *executionContext) fieldContext_User_tomes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "TaskEdge", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "edges": - return ec.fieldContext_TomeConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_TomeConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_TomeConnection_totalCount(ctx, field) + case "id": + return ec.fieldContext_Task_id(ctx, field) + case "createdAt": + return ec.fieldContext_Task_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Task_lastModifiedAt(ctx, field) + case "claimedAt": + return ec.fieldContext_Task_claimedAt(ctx, field) + case "execStartedAt": + return ec.fieldContext_Task_execStartedAt(ctx, field) + case "execFinishedAt": + return ec.fieldContext_Task_execFinishedAt(ctx, field) + case "output": + return ec.fieldContext_Task_output(ctx, field) + case "outputSize": + return ec.fieldContext_Task_outputSize(ctx, field) + case "error": + return ec.fieldContext_Task_error(ctx, field) + case "quest": + return ec.fieldContext_Task_quest(ctx, field) + case "beacon": + return ec.fieldContext_Task_beacon(ctx, field) + case "reportedFiles": + return ec.fieldContext_Task_reportedFiles(ctx, field) + case "reportedProcesses": + return ec.fieldContext_Task_reportedProcesses(ctx, field) + case "reportedCredentials": + return ec.fieldContext_Task_reportedCredentials(ctx, field) + case "shells": + return ec.fieldContext_Task_shells(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type TomeConnection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_User_tomes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _User_activeShells(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { +func (ec *executionContext) _TaskEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TaskEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_activeShells, + ec.fieldContext_TaskEdge_cursor, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.ActiveShells(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ShellOrder), fc.Args["where"].(*ent.ShellWhereInput)) + return obj.Cursor, nil }, nil, - ec.marshalNShellConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellConnection, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, true, true, ) } -func (ec *executionContext) fieldContext_User_activeShells(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "TaskEdge", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ShellConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ShellConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ShellConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ShellConnection", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_User_activeShells_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _UserConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.UserConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Tome_id(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UserConnection_edges, + ec.fieldContext_Tome_id, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.ID, nil }, nil, - ec.marshalOUserEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserEdge, + ec.marshalNID2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_UserConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UserConnection", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_UserEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_UserEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type UserEdge", field.Name) + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _UserConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.UserConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Tome_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UserConnection_pageInfo, + ec.fieldContext_Tome_createdAt, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.CreatedAt, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_UserConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UserConnection", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _UserConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.UserConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Tome_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UserConnection_totalCount, + ec.fieldContext_Tome_lastModifiedAt, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalNInt2int, + ec.marshalNTime2timeᚐTime, true, true, ) } -func (ec *executionContext) fieldContext_UserConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UserConnection", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _UserEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.UserEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Tome_name(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UserEdge_node, + ec.fieldContext_Tome_name, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.Name, nil }, nil, - ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext_UserEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UserEdge", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "photoURL": - return ec.fieldContext_User_photoURL(ctx, field) - case "isActivated": - return ec.fieldContext_User_isActivated(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) - case "tomes": - return ec.fieldContext_User_tomes(ctx, field) - case "activeShells": - return ec.fieldContext_User_activeShells(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _UserEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.UserEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Tome_description(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UserEdge_cursor, + ec.fieldContext_Tome_description, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.Description, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext_UserEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UserEdge", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** +func (ec *executionContext) _Tome_author(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_author, + func(ctx context.Context) (any, error) { + return obj.Author, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} -func (ec *executionContext) unmarshalInputAssetOrder(ctx context.Context, obj any) (ent.AssetOrder, error) { - var it ent.AssetOrder - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v +func (ec *executionContext) fieldContext_Tome_author(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, } + return fc, nil +} - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } +func (ec *executionContext) _Tome_supportModel(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_supportModel, + func(ctx context.Context) (any, error) { + return obj.SupportModel, nil + }, + nil, + ec.marshalNTomeSupportModel2realmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐSupportModel, + true, + true, + ) +} - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) - if err != nil { - return it, err - } - it.Direction = data - case "field": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNAssetOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetOrderField(ctx, v) - if err != nil { - return it, err - } - it.Field = data - } +func (ec *executionContext) fieldContext_Tome_supportModel(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type TomeSupportModel does not have child fields") + }, } + return fc, nil +} - return it, nil +func (ec *executionContext) _Tome_tactic(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_tactic, + func(ctx context.Context) (any, error) { + return obj.Tactic, nil + }, + nil, + ec.marshalNTomeTactic2realmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐTactic, + true, + true, + ) } -func (ec *executionContext) unmarshalInputAssetWhereInput(ctx context.Context, obj any) (ent.AssetWhereInput, error) { - var it ent.AssetWhereInput - asMap := map[string]any{} +func (ec *executionContext) fieldContext_Tome_tactic(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type TomeTactic does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_runOnNewBeaconCallback(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_runOnNewBeaconCallback, + func(ctx context.Context) (any, error) { + return obj.RunOnNewBeaconCallback, nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Tome_runOnNewBeaconCallback(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_runOnFirstHostCallback(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_runOnFirstHostCallback, + func(ctx context.Context) (any, error) { + return obj.RunOnFirstHostCallback, nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Tome_runOnFirstHostCallback(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_runOnSchedule(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_runOnSchedule, + func(ctx context.Context) (any, error) { + return obj.RunOnSchedule, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Tome_runOnSchedule(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_paramDefs(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_paramDefs, + func(ctx context.Context) (any, error) { + return obj.ParamDefs, nil + }, + nil, + ec.marshalOString2string, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Tome_paramDefs(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_eldritch(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_eldritch, + func(ctx context.Context) (any, error) { + return obj.Eldritch, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Tome_eldritch(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_assets(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_assets, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.Assets(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.AssetOrder), fc.Args["where"].(*ent.AssetWhereInput)) + }, + nil, + ec.marshalNAssetConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetConnection, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Tome_assets(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_AssetConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_AssetConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_AssetConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AssetConnection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Tome_assets_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Tome_uploader(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_uploader, + func(ctx context.Context) (any, error) { + return obj.Uploader(ctx) + }, + nil, + ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Tome_uploader(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + case "activeShells": + return ec.fieldContext_User_activeShells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_repository(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_repository, + func(ctx context.Context) (any, error) { + return obj.Repository(ctx) + }, + nil, + ec.marshalORepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Tome_repository(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Repository_id(ctx, field) + case "createdAt": + return ec.fieldContext_Repository_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Repository_lastModifiedAt(ctx, field) + case "url": + return ec.fieldContext_Repository_url(ctx, field) + case "publicKey": + return ec.fieldContext_Repository_publicKey(ctx, field) + case "lastImportedAt": + return ec.fieldContext_Repository_lastImportedAt(ctx, field) + case "tomes": + return ec.fieldContext_Repository_tomes(ctx, field) + case "owner": + return ec.fieldContext_Repository_owner(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Repository", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_scheduledHosts(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Tome_scheduledHosts, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.ScheduledHosts(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.HostOrder), fc.Args["where"].(*ent.HostWhereInput)) + }, + nil, + ec.marshalNHostConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostConnection, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Tome_scheduledHosts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_HostConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_HostConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_HostConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostConnection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Tome_scheduledHosts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _TomeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TomeConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_TomeConnection_edges, + func(ctx context.Context) (any, error) { + return obj.Edges, nil + }, + nil, + ec.marshalOTomeEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeEdge, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_TomeConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TomeConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_TomeEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_TomeEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TomeEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TomeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TomeConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_TomeConnection_pageInfo, + func(ctx context.Context) (any, error) { + return obj.PageInfo, nil + }, + nil, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_TomeConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TomeConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TomeConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TomeConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_TomeConnection_totalCount, + func(ctx context.Context) (any, error) { + return obj.TotalCount, nil + }, + nil, + ec.marshalNInt2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_TomeConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TomeConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TomeEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TomeEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_TomeEdge_node, + func(ctx context.Context) (any, error) { + return obj.Node, nil + }, + nil, + ec.marshalOTome2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTome, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_TomeEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TomeEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Tome_id(ctx, field) + case "createdAt": + return ec.fieldContext_Tome_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Tome_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Tome_name(ctx, field) + case "description": + return ec.fieldContext_Tome_description(ctx, field) + case "author": + return ec.fieldContext_Tome_author(ctx, field) + case "supportModel": + return ec.fieldContext_Tome_supportModel(ctx, field) + case "tactic": + return ec.fieldContext_Tome_tactic(ctx, field) + case "runOnNewBeaconCallback": + return ec.fieldContext_Tome_runOnNewBeaconCallback(ctx, field) + case "runOnFirstHostCallback": + return ec.fieldContext_Tome_runOnFirstHostCallback(ctx, field) + case "runOnSchedule": + return ec.fieldContext_Tome_runOnSchedule(ctx, field) + case "paramDefs": + return ec.fieldContext_Tome_paramDefs(ctx, field) + case "eldritch": + return ec.fieldContext_Tome_eldritch(ctx, field) + case "assets": + return ec.fieldContext_Tome_assets(ctx, field) + case "uploader": + return ec.fieldContext_Tome_uploader(ctx, field) + case "repository": + return ec.fieldContext_Tome_repository(ctx, field) + case "scheduledHosts": + return ec.fieldContext_Tome_scheduledHosts(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TomeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TomeEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_TomeEdge_cursor, + func(ctx context.Context) (any, error) { + return obj.Cursor, nil + }, + nil, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_TomeEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TomeEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Cursor does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_User_id, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + ec.marshalNID2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_User_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_User_name, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_User_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_photoURL(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_User_photoURL, + func(ctx context.Context) (any, error) { + return obj.PhotoURL, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_User_photoURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_isActivated(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_User_isActivated, + func(ctx context.Context) (any, error) { + return obj.IsActivated, nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_User_isActivated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_isAdmin(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_User_isAdmin, + func(ctx context.Context) (any, error) { + return obj.IsAdmin, nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_User_isAdmin(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_tomes(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_User_tomes, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.Tomes(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TomeOrder), fc.Args["where"].(*ent.TomeWhereInput)) + }, + nil, + ec.marshalNTomeConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeConnection, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_User_tomes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_TomeConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_TomeConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_TomeConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TomeConnection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_User_tomes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _User_activeShells(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_User_activeShells, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.ActiveShells(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ShellOrder), fc.Args["where"].(*ent.ShellWhereInput)) + }, + nil, + ec.marshalNShellConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellConnection, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_User_activeShells(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ShellConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ShellConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ShellConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ShellConnection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_User_activeShells_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _UserConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.UserConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_UserConnection_edges, + func(ctx context.Context) (any, error) { + return obj.Edges, nil + }, + nil, + ec.marshalOUserEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserEdge, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_UserConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_UserEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_UserEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.UserConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_UserConnection_pageInfo, + func(ctx context.Context) (any, error) { + return obj.PageInfo, nil + }, + nil, + ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_UserConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.UserConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_UserConnection_totalCount, + func(ctx context.Context) (any, error) { + return obj.TotalCount, nil + }, + nil, + ec.marshalNInt2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_UserConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.UserEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_UserEdge_node, + func(ctx context.Context) (any, error) { + return obj.Node, nil + }, + nil, + ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_UserEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + case "activeShells": + return ec.fieldContext_User_activeShells(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.UserEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_UserEdge_cursor, + func(ctx context.Context) (any, error) { + return obj.Cursor, nil + }, + nil, + ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_UserEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Cursor does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputAssetOrder(ctx context.Context, obj any) (ent.AssetOrder, error) { + var it ent.AssetOrder + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNAssetOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputAssetWhereInput(ctx context.Context, obj any) (ent.AssetWhereInput, error) { + var it ent.AssetWhereInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "size", "sizeNEQ", "sizeIn", "sizeNotIn", "sizeGT", "sizeGTE", "sizeLT", "sizeLTE", "hash", "hashNEQ", "hashIn", "hashNotIn", "hashGT", "hashGTE", "hashLT", "hashLTE", "hashContains", "hashHasPrefix", "hashHasSuffix", "hashEqualFold", "hashContainsFold", "hasTomes", "hasTomesWith", "hasLinks", "hasLinksWith", "hasCreator", "hasCreatorWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOAssetWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOAssetWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOAssetWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDNEQ = data + case "idIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDIn = data + case "idNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDNotIn = data + case "idGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGT = data + case "idGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGTE = data + case "idLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLT = data + case "idLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLTE = data + case "createdAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAt = data + case "createdAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNEQ = data + case "createdAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtIn = data + case "createdAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNotIn = data + case "createdAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGT = data + case "createdAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGTE = data + case "createdAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLT = data + case "createdAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLTE = data + case "lastModifiedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAt = data + case "lastModifiedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLTE = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "nameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameNEQ = data + case "nameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameIn = data + case "nameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameNotIn = data + case "nameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGT = data + case "nameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGTE = data + case "nameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLT = data + case "nameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLTE = data + case "nameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContains = data + case "nameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContainsFold = data + case "size": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Size = data + case "sizeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNEQ")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.SizeNEQ = data + case "sizeIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.SizeIn = data + case "sizeNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNotIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.SizeNotIn = data + case "sizeGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.SizeGT = data + case "sizeGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.SizeGTE = data + case "sizeLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.SizeLT = data + case "sizeLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.SizeLTE = data + case "hash": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hash")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Hash = data + case "hashNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashNEQ = data + case "hashIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.HashIn = data + case "hashNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.HashNotIn = data + case "hashGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashGT = data + case "hashGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashGTE = data + case "hashLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashLT = data + case "hashLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashLTE = data + case "hashContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashContains = data + case "hashHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashHasPrefix = data + case "hashHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashHasSuffix = data + case "hashEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashEqualFold = data + case "hashContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.HashContainsFold = data + case "hasTomes": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomes")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasTomes = data + case "hasTomesWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomesWith")) + data, err := ec.unmarshalOTomeWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasTomesWith = data + case "hasLinks": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasLinks")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasLinks = data + case "hasLinksWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasLinksWith")) + data, err := ec.unmarshalOLinkWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐLinkWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasLinksWith = data + case "hasCreator": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreator")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasCreator = data + case "hasCreatorWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreatorWith")) + data, err := ec.unmarshalOUserWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasCreatorWith = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBeaconOrder(ctx context.Context, obj any) (ent.BeaconOrder, error) { + var it ent.BeaconOrder + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNBeaconOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBeaconWhereInput(ctx context.Context, obj any) (ent.BeaconWhereInput, error) { + var it ent.BeaconWhereInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "principal", "principalNEQ", "principalIn", "principalNotIn", "principalGT", "principalGTE", "principalLT", "principalLTE", "principalContains", "principalHasPrefix", "principalHasSuffix", "principalIsNil", "principalNotNil", "principalEqualFold", "principalContainsFold", "identifier", "identifierNEQ", "identifierIn", "identifierNotIn", "identifierGT", "identifierGTE", "identifierLT", "identifierLTE", "identifierContains", "identifierHasPrefix", "identifierHasSuffix", "identifierEqualFold", "identifierContainsFold", "agentIdentifier", "agentIdentifierNEQ", "agentIdentifierIn", "agentIdentifierNotIn", "agentIdentifierGT", "agentIdentifierGTE", "agentIdentifierLT", "agentIdentifierLTE", "agentIdentifierContains", "agentIdentifierHasPrefix", "agentIdentifierHasSuffix", "agentIdentifierIsNil", "agentIdentifierNotNil", "agentIdentifierEqualFold", "agentIdentifierContainsFold", "lastSeenAt", "lastSeenAtNEQ", "lastSeenAtIn", "lastSeenAtNotIn", "lastSeenAtGT", "lastSeenAtGTE", "lastSeenAtLT", "lastSeenAtLTE", "lastSeenAtIsNil", "lastSeenAtNotNil", "nextSeenAt", "nextSeenAtNEQ", "nextSeenAtIn", "nextSeenAtNotIn", "nextSeenAtGT", "nextSeenAtGTE", "nextSeenAtLT", "nextSeenAtLTE", "nextSeenAtIsNil", "nextSeenAtNotNil", "interval", "intervalNEQ", "intervalIn", "intervalNotIn", "intervalGT", "intervalGTE", "intervalLT", "intervalLTE", "intervalIsNil", "intervalNotNil", "transport", "transportNEQ", "transportIn", "transportNotIn", "hasHost", "hasHostWith", "hasTasks", "hasTasksWith", "hasShells", "hasShellsWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOBeaconWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDNEQ = data + case "idIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDIn = data + case "idNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDNotIn = data + case "idGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGT = data + case "idGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGTE = data + case "idLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLT = data + case "idLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLTE = data + case "createdAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAt = data + case "createdAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNEQ = data + case "createdAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtIn = data + case "createdAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNotIn = data + case "createdAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGT = data + case "createdAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGTE = data + case "createdAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLT = data + case "createdAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLTE = data + case "lastModifiedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAt = data + case "lastModifiedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLTE = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "nameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameNEQ = data + case "nameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameIn = data + case "nameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameNotIn = data + case "nameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGT = data + case "nameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGTE = data + case "nameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLT = data + case "nameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLTE = data + case "nameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContains = data + case "nameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContainsFold = data + case "principal": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principal")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Principal = data + case "principalNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalNEQ = data + case "principalIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.PrincipalIn = data + case "principalNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.PrincipalNotIn = data + case "principalGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalGT = data + case "principalGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalGTE = data + case "principalLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalLT = data + case "principalLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalLTE = data + case "principalContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalContains = data + case "principalHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalHasPrefix = data + case "principalHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalHasSuffix = data + case "principalIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.PrincipalIsNil = data + case "principalNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.PrincipalNotNil = data + case "principalEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalEqualFold = data + case "principalContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalContainsFold = data + case "identifier": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifier")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Identifier = data + case "identifierNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierNEQ = data + case "identifierIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.IdentifierIn = data + case "identifierNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.IdentifierNotIn = data + case "identifierGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierGT = data + case "identifierGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierGTE = data + case "identifierLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierLT = data + case "identifierLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierLTE = data + case "identifierContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierContains = data + case "identifierHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierHasPrefix = data + case "identifierHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierHasSuffix = data + case "identifierEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierEqualFold = data + case "identifierContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierContainsFold = data + case "agentIdentifier": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifier")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifier = data + case "agentIdentifierNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierNEQ = data + case "agentIdentifierIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierIn = data + case "agentIdentifierNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierNotIn = data + case "agentIdentifierGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierGT = data + case "agentIdentifierGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierGTE = data + case "agentIdentifierLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierLT = data + case "agentIdentifierLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierLTE = data + case "agentIdentifierContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierContains = data + case "agentIdentifierHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierHasPrefix = data + case "agentIdentifierHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierHasSuffix = data + case "agentIdentifierIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierIsNil = data + case "agentIdentifierNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierNotNil = data + case "agentIdentifierEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierEqualFold = data + case "agentIdentifierContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierContainsFold = data + case "lastSeenAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAt = data + case "lastSeenAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtNEQ = data + case "lastSeenAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtIn = data + case "lastSeenAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtNotIn = data + case "lastSeenAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtGT = data + case "lastSeenAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtGTE = data + case "lastSeenAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtLT = data + case "lastSeenAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtLTE = data + case "lastSeenAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtIsNil = data + case "lastSeenAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtNotNil = data + case "nextSeenAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAt = data + case "nextSeenAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAtNEQ = data + case "nextSeenAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAtIn = data + case "nextSeenAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAtNotIn = data + case "nextSeenAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAtGT = data + case "nextSeenAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAtGTE = data + case "nextSeenAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAtLT = data + case "nextSeenAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAtLTE = data + case "nextSeenAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAtIsNil = data + case "nextSeenAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.NextSeenAtNotNil = data + case "interval": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interval")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + if err != nil { + return it, err + } + it.Interval = data + case "intervalNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNEQ")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + if err != nil { + return it, err + } + it.IntervalNEQ = data + case "intervalIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalIn")) + data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + if err != nil { + return it, err + } + it.IntervalIn = data + case "intervalNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNotIn")) + data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + if err != nil { + return it, err + } + it.IntervalNotIn = data + case "intervalGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGT")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + if err != nil { + return it, err + } + it.IntervalGT = data + case "intervalGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGTE")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + if err != nil { + return it, err + } + it.IntervalGTE = data + case "intervalLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLT")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + if err != nil { + return it, err + } + it.IntervalLT = data + case "intervalLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLTE")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + if err != nil { + return it, err + } + it.IntervalLTE = data + case "intervalIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.IntervalIsNil = data + case "intervalNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.IntervalNotNil = data + case "transport": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transport")) + data, err := ec.unmarshalOBeaconTransport_Type2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Type(ctx, v) + if err != nil { + return it, err + } + it.Transport = data + case "transportNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportNEQ")) + data, err := ec.unmarshalOBeaconTransport_Type2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Type(ctx, v) + if err != nil { + return it, err + } + it.TransportNEQ = data + case "transportIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportIn")) + data, err := ec.unmarshalOBeaconTransport_Type2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Typeᚄ(ctx, v) + if err != nil { + return it, err + } + it.TransportIn = data + case "transportNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportNotIn")) + data, err := ec.unmarshalOBeaconTransport_Type2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Typeᚄ(ctx, v) + if err != nil { + return it, err + } + it.TransportNotIn = data + case "hasHost": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasHost = data + case "hasHostWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) + data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasHostWith = data + case "hasTasks": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasks")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasTasks = data + case "hasTasksWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasksWith")) + data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasTasksWith = data + case "hasShells": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasShells")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasShells = data + case "hasShellsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasShellsWith")) + data, err := ec.unmarshalOShellWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasShellsWith = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBuildTaskOrder(ctx context.Context, obj any) (ent.BuildTaskOrder, error) { + var it ent.BuildTaskOrder + asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "size", "sizeNEQ", "sizeIn", "sizeNotIn", "sizeGT", "sizeGTE", "sizeLT", "sizeLTE", "hash", "hashNEQ", "hashIn", "hashNotIn", "hashGT", "hashGTE", "hashLT", "hashLTE", "hashContains", "hashHasPrefix", "hashHasSuffix", "hashEqualFold", "hashContainsFold", "hasTomes", "hasTomesWith", "hasLinks", "hasLinksWith", "hasCreator", "hasCreatorWith"} + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNBuildTaskOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBuildTaskWhereInput(ctx context.Context, obj any) (ent.BuildTaskWhereInput, error) { + var it ent.BuildTaskWhereInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "targetOs", "targetOsNEQ", "targetOsIn", "targetOsNotIn", "targetFormat", "targetFormatNEQ", "targetFormatIn", "targetFormatNotIn", "buildImage", "buildImageNEQ", "buildImageIn", "buildImageNotIn", "buildImageGT", "buildImageGTE", "buildImageLT", "buildImageLTE", "buildImageContains", "buildImageHasPrefix", "buildImageHasSuffix", "buildImageEqualFold", "buildImageContainsFold", "buildScript", "buildScriptNEQ", "buildScriptIn", "buildScriptNotIn", "buildScriptGT", "buildScriptGTE", "buildScriptLT", "buildScriptLTE", "buildScriptContains", "buildScriptHasPrefix", "buildScriptHasSuffix", "buildScriptEqualFold", "buildScriptContainsFold", "callbackURI", "callbackURINEQ", "callbackURIIn", "callbackURINotIn", "callbackURIGT", "callbackURIGTE", "callbackURILT", "callbackURILTE", "callbackURIContains", "callbackURIHasPrefix", "callbackURIHasSuffix", "callbackURIEqualFold", "callbackURIContainsFold", "interval", "intervalNEQ", "intervalIn", "intervalNotIn", "intervalGT", "intervalGTE", "intervalLT", "intervalLTE", "transportType", "transportTypeNEQ", "transportTypeIn", "transportTypeNotIn", "extra", "extraNEQ", "extraIn", "extraNotIn", "extraGT", "extraGTE", "extraLT", "extraLTE", "extraContains", "extraHasPrefix", "extraHasSuffix", "extraIsNil", "extraNotNil", "extraEqualFold", "extraContainsFold", "claimedAt", "claimedAtNEQ", "claimedAtIn", "claimedAtNotIn", "claimedAtGT", "claimedAtGTE", "claimedAtLT", "claimedAtLTE", "claimedAtIsNil", "claimedAtNotNil", "startedAt", "startedAtNEQ", "startedAtIn", "startedAtNotIn", "startedAtGT", "startedAtGTE", "startedAtLT", "startedAtLTE", "startedAtIsNil", "startedAtNotNil", "finishedAt", "finishedAtNEQ", "finishedAtIn", "finishedAtNotIn", "finishedAtGT", "finishedAtGTE", "finishedAtLT", "finishedAtLTE", "finishedAtIsNil", "finishedAtNotNil", "output", "outputNEQ", "outputIn", "outputNotIn", "outputGT", "outputGTE", "outputLT", "outputLTE", "outputContains", "outputHasPrefix", "outputHasSuffix", "outputIsNil", "outputNotNil", "outputEqualFold", "outputContainsFold", "outputSize", "outputSizeNEQ", "outputSizeIn", "outputSizeNotIn", "outputSizeGT", "outputSizeGTE", "outputSizeLT", "outputSizeLTE", "error", "errorNEQ", "errorIn", "errorNotIn", "errorGT", "errorGTE", "errorLT", "errorLTE", "errorContains", "errorHasPrefix", "errorHasSuffix", "errorIsNil", "errorNotNil", "errorEqualFold", "errorContainsFold", "errorSize", "errorSizeNEQ", "errorSizeIn", "errorSizeNotIn", "errorSizeGT", "errorSizeGTE", "errorSizeLT", "errorSizeLTE", "exitCode", "exitCodeNEQ", "exitCodeIn", "exitCodeNotIn", "exitCodeGT", "exitCodeGTE", "exitCodeLT", "exitCodeLTE", "exitCodeIsNil", "exitCodeNotNil", "artifactPath", "artifactPathNEQ", "artifactPathIn", "artifactPathNotIn", "artifactPathGT", "artifactPathGTE", "artifactPathLT", "artifactPathLTE", "artifactPathContains", "artifactPathHasPrefix", "artifactPathHasSuffix", "artifactPathIsNil", "artifactPathNotNil", "artifactPathEqualFold", "artifactPathContainsFold", "hasBuilder", "hasBuilderWith", "hasArtifact", "hasArtifactWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -11158,21 +13814,21 @@ func (ec *executionContext) unmarshalInputAssetWhereInput(ctx context.Context, o switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOAssetWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetWhereInput(ctx, v) + data, err := ec.unmarshalOBuildTaskWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOAssetWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOBuildTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOAssetWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOBuildTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -11345,1205 +14001,1259 @@ func (ec *executionContext) unmarshalInputAssetWhereInput(ctx context.Context, o return it, err } it.LastModifiedAtLTE = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + case "targetOs": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetOs")) + data, err := ec.unmarshalOHostPlatform2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform(ctx, v) + if err != nil { + return it, err + } + it.TargetOs = data + case "targetOsNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetOsNEQ")) + data, err := ec.unmarshalOHostPlatform2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform(ctx, v) + if err != nil { + return it, err + } + it.TargetOsNEQ = data + case "targetOsIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetOsIn")) + data, err := ec.unmarshalOHostPlatform2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platformᚄ(ctx, v) + if err != nil { + return it, err + } + it.TargetOsIn = data + case "targetOsNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetOsNotIn")) + data, err := ec.unmarshalOHostPlatform2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platformᚄ(ctx, v) + if err != nil { + return it, err + } + it.TargetOsNotIn = data + case "targetFormat": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetFormat")) + data, err := ec.unmarshalOBuildTaskTargetFormat2ᚖrealmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat(ctx, v) + if err != nil { + return it, err + } + it.TargetFormat = data + case "targetFormatNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetFormatNEQ")) + data, err := ec.unmarshalOBuildTaskTargetFormat2ᚖrealmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat(ctx, v) + if err != nil { + return it, err + } + it.TargetFormatNEQ = data + case "targetFormatIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetFormatIn")) + data, err := ec.unmarshalOBuildTaskTargetFormat2ᚕrealmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormatᚄ(ctx, v) + if err != nil { + return it, err + } + it.TargetFormatIn = data + case "targetFormatNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetFormatNotIn")) + data, err := ec.unmarshalOBuildTaskTargetFormat2ᚕrealmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormatᚄ(ctx, v) + if err != nil { + return it, err + } + it.TargetFormatNotIn = data + case "buildImage": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImage")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + it.BuildImage = data + case "buildImageNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + it.BuildImageNEQ = data + case "buildImageIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + it.BuildImageIn = data + case "buildImageNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + it.BuildImageNotIn = data + case "buildImageGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BuildImageGT = data + case "buildImageGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BuildImageGTE = data + case "buildImageLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BuildImageLT = data + case "buildImageLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BuildImageLTE = data + case "buildImageContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + it.BuildImageContains = data + case "buildImageHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + it.BuildImageHasPrefix = data + case "buildImageHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + it.BuildImageHasSuffix = data + case "buildImageEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + it.BuildImageEqualFold = data + case "buildImageContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImageContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + it.BuildImageContainsFold = data + case "buildScript": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScript")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + it.BuildScript = data + case "buildScriptNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.BuildScriptNEQ = data + case "buildScriptIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + it.BuildScriptIn = data + case "buildScriptNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.BuildScriptNotIn = data + case "buildScriptGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "size": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.BuildScriptGT = data + case "buildScriptGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Size = data - case "sizeNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNEQ")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.BuildScriptGTE = data + case "buildScriptLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeNEQ = data - case "sizeIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeIn")) - data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + it.BuildScriptLT = data + case "buildScriptLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeIn = data - case "sizeNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNotIn")) - data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + it.BuildScriptLTE = data + case "buildScriptContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeNotIn = data - case "sizeGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGT")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.BuildScriptContains = data + case "buildScriptHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeGT = data - case "sizeGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGTE")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.BuildScriptHasPrefix = data + case "buildScriptHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeGTE = data - case "sizeLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLT")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.BuildScriptHasSuffix = data + case "buildScriptEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeLT = data - case "sizeLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLTE")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.BuildScriptEqualFold = data + case "buildScriptContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildScriptContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeLTE = data - case "hash": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hash")) + it.BuildScriptContainsFold = data + case "callbackURI": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURI")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Hash = data - case "hashNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNEQ")) + it.CallbackURI = data + case "callbackURINEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURINEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashNEQ = data - case "hashIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashIn")) + it.CallbackURINEQ = data + case "callbackURIIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURIIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.HashIn = data - case "hashNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNotIn")) + it.CallbackURIIn = data + case "callbackURINotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURINotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.HashNotIn = data - case "hashGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGT")) + it.CallbackURINotIn = data + case "callbackURIGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURIGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashGT = data - case "hashGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGTE")) + it.CallbackURIGT = data + case "callbackURIGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURIGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashGTE = data - case "hashLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLT")) + it.CallbackURIGTE = data + case "callbackURILT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURILT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashLT = data - case "hashLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLTE")) + it.CallbackURILT = data + case "callbackURILTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURILTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashLTE = data - case "hashContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContains")) + it.CallbackURILTE = data + case "callbackURIContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURIContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashContains = data - case "hashHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasPrefix")) + it.CallbackURIContains = data + case "callbackURIHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURIHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashHasPrefix = data - case "hashHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasSuffix")) + it.CallbackURIHasPrefix = data + case "callbackURIHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURIHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashHasSuffix = data - case "hashEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashEqualFold")) + it.CallbackURIHasSuffix = data + case "callbackURIEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURIEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashEqualFold = data - case "hashContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContainsFold")) + it.CallbackURIEqualFold = data + case "callbackURIContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURIContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashContainsFold = data - case "hasTomes": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomes")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.CallbackURIContainsFold = data + case "interval": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interval")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.HasTomes = data - case "hasTomesWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomesWith")) - data, err := ec.unmarshalOTomeWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeWhereInputᚄ(ctx, v) + it.Interval = data + case "intervalNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNEQ")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.HasTomesWith = data - case "hasLinks": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasLinks")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.IntervalNEQ = data + case "intervalIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.HasLinks = data - case "hasLinksWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasLinksWith")) - data, err := ec.unmarshalOLinkWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐLinkWhereInputᚄ(ctx, v) + it.IntervalIn = data + case "intervalNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNotIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.HasLinksWith = data - case "hasCreator": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreator")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.IntervalNotIn = data + case "intervalGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.HasCreator = data - case "hasCreatorWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreatorWith")) - data, err := ec.unmarshalOUserWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserWhereInputᚄ(ctx, v) + it.IntervalGT = data + case "intervalGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.HasCreatorWith = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputBeaconOrder(ctx context.Context, obj any) (ent.BeaconOrder, error) { - var it ent.BeaconOrder - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } - - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + it.IntervalGTE = data + case "intervalLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNBeaconOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconOrderField(ctx, v) + it.IntervalLT = data + case "intervalLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.Field = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputBeaconWhereInput(ctx context.Context, obj any) (ent.BeaconWhereInput, error) { - var it ent.BeaconWhereInput - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "principal", "principalNEQ", "principalIn", "principalNotIn", "principalGT", "principalGTE", "principalLT", "principalLTE", "principalContains", "principalHasPrefix", "principalHasSuffix", "principalIsNil", "principalNotNil", "principalEqualFold", "principalContainsFold", "identifier", "identifierNEQ", "identifierIn", "identifierNotIn", "identifierGT", "identifierGTE", "identifierLT", "identifierLTE", "identifierContains", "identifierHasPrefix", "identifierHasSuffix", "identifierEqualFold", "identifierContainsFold", "agentIdentifier", "agentIdentifierNEQ", "agentIdentifierIn", "agentIdentifierNotIn", "agentIdentifierGT", "agentIdentifierGTE", "agentIdentifierLT", "agentIdentifierLTE", "agentIdentifierContains", "agentIdentifierHasPrefix", "agentIdentifierHasSuffix", "agentIdentifierIsNil", "agentIdentifierNotNil", "agentIdentifierEqualFold", "agentIdentifierContainsFold", "lastSeenAt", "lastSeenAtNEQ", "lastSeenAtIn", "lastSeenAtNotIn", "lastSeenAtGT", "lastSeenAtGTE", "lastSeenAtLT", "lastSeenAtLTE", "lastSeenAtIsNil", "lastSeenAtNotNil", "nextSeenAt", "nextSeenAtNEQ", "nextSeenAtIn", "nextSeenAtNotIn", "nextSeenAtGT", "nextSeenAtGTE", "nextSeenAtLT", "nextSeenAtLTE", "nextSeenAtIsNil", "nextSeenAtNotNil", "interval", "intervalNEQ", "intervalIn", "intervalNotIn", "intervalGT", "intervalGTE", "intervalLT", "intervalLTE", "intervalIsNil", "intervalNotNil", "transport", "transportNEQ", "transportIn", "transportNotIn", "hasHost", "hasHostWith", "hasTasks", "hasTasksWith", "hasShells", "hasShellsWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOBeaconWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInput(ctx, v) + it.IntervalLTE = data + case "transportType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportType")) + data, err := ec.unmarshalOBeaconTransport_Type2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Type(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) + it.TransportType = data + case "transportTypeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportTypeNEQ")) + data, err := ec.unmarshalOBeaconTransport_Type2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Type(ctx, v) if err != nil { return it, err } - it.And = data - case "or": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) + it.TransportTypeNEQ = data + case "transportTypeIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportTypeIn")) + data, err := ec.unmarshalOBeaconTransport_Type2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Typeᚄ(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.TransportTypeIn = data + case "transportTypeNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportTypeNotIn")) + data, err := ec.unmarshalOBeaconTransport_Type2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Typeᚄ(ctx, v) + if err != nil { + return it, err + } + it.TransportTypeNotIn = data + case "extra": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extra")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Extra = data + case "extraNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ExtraNEQ = data + case "extraIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.ExtraIn = data + case "extraNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.ExtraNotIn = data + case "extraGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.ExtraGT = data + case "extraGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.ExtraGTE = data + case "extraLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.ExtraLT = data + case "extraLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.ExtraLTE = data + case "extraContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.ExtraContains = data + case "extraHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.ExtraHasPrefix = data + case "extraHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ExtraHasSuffix = data + case "extraIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ExtraIsNil = data + case "extraNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.ExtraNotNil = data + case "extraEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.ExtraEqualFold = data + case "extraContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extraContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + it.ExtraContainsFold = data + case "claimedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAt")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + it.ClaimedAt = data + case "claimedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAtNEQ")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ClaimedAtNEQ = data + case "claimedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ClaimedAtIn = data + case "claimedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "lastModifiedAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + it.ClaimedAtNotIn = data + case "claimedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAtGT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAt = data - case "lastModifiedAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + it.ClaimedAtGT = data + case "claimedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAtGTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNEQ = data - case "lastModifiedAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.ClaimedAtGTE = data + case "claimedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAtIn = data - case "lastModifiedAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.ClaimedAtLT = data + case "claimedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNotIn = data - case "lastModifiedAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ClaimedAtLTE = data + case "claimedAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGT = data - case "lastModifiedAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ClaimedAtIsNil = data + case "claimedAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("claimedAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGTE = data - case "lastModifiedAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + it.ClaimedAtNotNil = data + case "startedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAt")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLT = data - case "lastModifiedAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + it.StartedAt = data + case "startedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAtNEQ")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLTE = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StartedAtNEQ = data + case "startedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StartedAtIn = data + case "startedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.StartedAtNotIn = data + case "startedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.StartedAtGT = data + case "startedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StartedAtGTE = data + case "startedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StartedAtLT = data + case "startedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StartedAtLTE = data + case "startedAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StartedAtIsNil = data + case "startedAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("startedAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StartedAtNotNil = data + case "finishedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.FinishedAt = data + case "finishedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.FinishedAtNEQ = data + case "finishedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.FinishedAtIn = data + case "finishedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.FinishedAtNotIn = data + case "finishedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "principal": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principal")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.FinishedAtGT = data + case "finishedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.Principal = data - case "principalNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.FinishedAtGTE = data + case "finishedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PrincipalNEQ = data - case "principalIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.FinishedAtLT = data + case "finishedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PrincipalIn = data - case "principalNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.FinishedAtLTE = data + case "finishedAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.PrincipalNotIn = data - case "principalGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.FinishedAtIsNil = data + case "finishedAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("finishedAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.PrincipalGT = data - case "principalGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGTE")) + it.FinishedAtNotNil = data + case "output": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("output")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalGTE = data - case "principalLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLT")) + it.Output = data + case "outputNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalLT = data - case "principalLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputNEQ = data + case "outputIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.PrincipalLTE = data - case "principalContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputIn = data + case "outputNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.PrincipalContains = data - case "principalHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasPrefix")) + it.OutputNotIn = data + case "outputGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalHasPrefix = data - case "principalHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasSuffix")) + it.OutputGT = data + case "outputGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalHasSuffix = data - case "principalIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.OutputGTE = data + case "outputLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalIsNil = data - case "principalNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.OutputLT = data + case "outputLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalNotNil = data - case "principalEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalEqualFold")) + it.OutputLTE = data + case "outputContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalEqualFold = data - case "principalContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContainsFold")) + it.OutputContains = data + case "outputHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalContainsFold = data - case "identifier": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifier")) + it.OutputHasPrefix = data + case "outputHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Identifier = data - case "identifierNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputHasSuffix = data + case "outputIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.IdentifierNEQ = data - case "identifierIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.OutputIsNil = data + case "outputNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.IdentifierIn = data - case "identifierNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.OutputNotNil = data + case "outputEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IdentifierNotIn = data - case "identifierGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGT")) + it.OutputEqualFold = data + case "outputContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IdentifierGT = data - case "identifierGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputContainsFold = data + case "outputSize": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputSize")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierGTE = data - case "identifierLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputSize = data + case "outputSizeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputSizeNEQ")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierLT = data - case "identifierLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputSizeNEQ = data + case "outputSizeIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputSizeIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierLTE = data - case "identifierContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputSizeIn = data + case "outputSizeNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputSizeNotIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierContains = data - case "identifierHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputSizeNotIn = data + case "outputSizeGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputSizeGT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierHasPrefix = data - case "identifierHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputSizeGT = data + case "outputSizeGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputSizeGTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierHasSuffix = data - case "identifierEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputSizeGTE = data + case "outputSizeLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputSizeLT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierEqualFold = data - case "identifierContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.OutputSizeLT = data + case "outputSizeLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outputSizeLTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierContainsFold = data - case "agentIdentifier": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifier")) + it.OutputSizeLTE = data + case "error": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("error")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifier = data - case "agentIdentifierNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNEQ")) + it.Error = data + case "errorNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierNEQ = data - case "agentIdentifierIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierIn")) + it.ErrorNEQ = data + case "errorIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.AgentIdentifierIn = data - case "agentIdentifierNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNotIn")) + it.ErrorIn = data + case "errorNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.AgentIdentifierNotIn = data - case "agentIdentifierGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierGT")) + it.ErrorNotIn = data + case "errorGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierGT = data - case "agentIdentifierGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierGTE")) + it.ErrorGT = data + case "errorGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierGTE = data - case "agentIdentifierLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierLT")) + it.ErrorGTE = data + case "errorLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierLT = data - case "agentIdentifierLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierLTE")) + it.ErrorLT = data + case "errorLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierLTE = data - case "agentIdentifierContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierContains")) + it.ErrorLTE = data + case "errorContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierContains = data - case "agentIdentifierHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierHasPrefix")) + it.ErrorContains = data + case "errorHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierHasPrefix = data - case "agentIdentifierHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierHasSuffix")) + it.ErrorHasPrefix = data + case "errorHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierHasSuffix = data - case "agentIdentifierIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierIsNil")) + it.ErrorHasSuffix = data + case "errorIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.AgentIdentifierIsNil = data - case "agentIdentifierNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNotNil")) + it.ErrorIsNil = data + case "errorNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorNotNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.AgentIdentifierNotNil = data - case "agentIdentifierEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierEqualFold")) + it.ErrorNotNil = data + case "errorEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierEqualFold = data - case "agentIdentifierContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierContainsFold")) + it.ErrorEqualFold = data + case "errorContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.AgentIdentifierContainsFold = data - case "lastSeenAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) - if err != nil { - return it, err - } - it.LastSeenAt = data - case "lastSeenAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) - if err != nil { - return it, err - } - it.LastSeenAtNEQ = data - case "lastSeenAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) - if err != nil { - return it, err - } - it.LastSeenAtIn = data - case "lastSeenAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.ErrorContainsFold = data + case "errorSize": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorSize")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err - } - it.LastSeenAtNotIn = data - case "lastSeenAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + } + it.ErrorSize = data + case "errorSizeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorSizeNEQ")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.LastSeenAtGT = data - case "lastSeenAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ErrorSizeNEQ = data + case "errorSizeIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorSizeIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.LastSeenAtGTE = data - case "lastSeenAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ErrorSizeIn = data + case "errorSizeNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorSizeNotIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.LastSeenAtLT = data - case "lastSeenAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ErrorSizeNotIn = data + case "errorSizeGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorSizeGT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.LastSeenAtLTE = data - case "lastSeenAtIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.ErrorSizeGT = data + case "errorSizeGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorSizeGTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.LastSeenAtIsNil = data - case "lastSeenAtNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.ErrorSizeGTE = data + case "errorSizeLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorSizeLT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.LastSeenAtNotNil = data - case "nextSeenAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ErrorSizeLT = data + case "errorSizeLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("errorSizeLTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.NextSeenAt = data - case "nextSeenAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ErrorSizeLTE = data + case "exitCode": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCode")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.NextSeenAtNEQ = data - case "nextSeenAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.ExitCode = data + case "exitCodeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCodeNEQ")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.NextSeenAtIn = data - case "nextSeenAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.ExitCodeNEQ = data + case "exitCodeIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCodeIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.NextSeenAtNotIn = data - case "nextSeenAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ExitCodeIn = data + case "exitCodeNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCodeNotIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.NextSeenAtGT = data - case "nextSeenAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ExitCodeNotIn = data + case "exitCodeGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCodeGT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.NextSeenAtGTE = data - case "nextSeenAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ExitCodeGT = data + case "exitCodeGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCodeGTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.NextSeenAtLT = data - case "nextSeenAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.ExitCodeGTE = data + case "exitCodeLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCodeLT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.NextSeenAtLTE = data - case "nextSeenAtIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.ExitCodeLT = data + case "exitCodeLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCodeLTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.NextSeenAtIsNil = data - case "nextSeenAtNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextSeenAtNotNil")) + it.ExitCodeLTE = data + case "exitCodeIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCodeIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NextSeenAtNotNil = data - case "interval": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interval")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + it.ExitCodeIsNil = data + case "exitCodeNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exitCodeNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.Interval = data - case "intervalNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNEQ")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + it.ExitCodeNotNil = data + case "artifactPath": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPath")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalNEQ = data - case "intervalIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalIn")) - data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + it.ArtifactPath = data + case "artifactPathNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalIn = data - case "intervalNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNotIn")) - data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + it.ArtifactPathNEQ = data + case "artifactPathIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IntervalNotIn = data - case "intervalGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGT")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + it.ArtifactPathIn = data + case "artifactPathNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IntervalGT = data - case "intervalGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGTE")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + it.ArtifactPathNotIn = data + case "artifactPathGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalGTE = data - case "intervalLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLT")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + it.ArtifactPathGT = data + case "artifactPathGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalLT = data - case "intervalLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLTE")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + it.ArtifactPathGTE = data + case "artifactPathLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalLTE = data - case "intervalIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.ArtifactPathLT = data + case "artifactPathLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalIsNil = data - case "intervalNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.ArtifactPathLTE = data + case "artifactPathContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalNotNil = data - case "transport": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transport")) - data, err := ec.unmarshalOBeaconTransport_Type2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Type(ctx, v) + it.ArtifactPathContains = data + case "artifactPathHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Transport = data - case "transportNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportNEQ")) - data, err := ec.unmarshalOBeaconTransport_Type2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Type(ctx, v) + it.ArtifactPathHasPrefix = data + case "artifactPathHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.TransportNEQ = data - case "transportIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportIn")) - data, err := ec.unmarshalOBeaconTransport_Type2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Typeᚄ(ctx, v) + it.ArtifactPathHasSuffix = data + case "artifactPathIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.TransportIn = data - case "transportNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportNotIn")) - data, err := ec.unmarshalOBeaconTransport_Type2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Typeᚄ(ctx, v) + it.ArtifactPathIsNil = data + case "artifactPathNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.TransportNotIn = data - case "hasHost": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.ArtifactPathNotNil = data + case "artifactPathEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasHost = data - case "hasHostWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) - data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) + it.ArtifactPathEqualFold = data + case "artifactPathContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPathContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasHostWith = data - case "hasTasks": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasks")) + it.ArtifactPathContainsFold = data + case "hasBuilder": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBuilder")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasTasks = data - case "hasTasksWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasksWith")) - data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) + it.HasBuilder = data + case "hasBuilderWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBuilderWith")) + data, err := ec.unmarshalOBuilderWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasTasksWith = data - case "hasShells": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasShells")) + it.HasBuilderWith = data + case "hasArtifact": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasArtifact")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasShells = data - case "hasShellsWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasShellsWith")) - data, err := ec.unmarshalOShellWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐShellWhereInputᚄ(ctx, v) + it.HasArtifact = data + case "hasArtifactWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasArtifactWith")) + data, err := ec.unmarshalOAssetWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐAssetWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasShellsWith = data + it.HasArtifactWith = data } } @@ -12595,7 +15305,7 @@ func (ec *executionContext) unmarshalInputBuilderWhereInput(ctx context.Context, asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "identifier", "identifierNEQ", "identifierIn", "identifierNotIn", "identifierGT", "identifierGTE", "identifierLT", "identifierLTE", "identifierContains", "identifierHasPrefix", "identifierHasSuffix", "identifierEqualFold", "identifierContainsFold", "upstream", "upstreamNEQ", "upstreamIn", "upstreamNotIn", "upstreamGT", "upstreamGTE", "upstreamLT", "upstreamLTE", "upstreamContains", "upstreamHasPrefix", "upstreamHasSuffix", "upstreamEqualFold", "upstreamContainsFold"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "identifier", "identifierNEQ", "identifierIn", "identifierNotIn", "identifierGT", "identifierGTE", "identifierLT", "identifierLTE", "identifierContains", "identifierHasPrefix", "identifierHasSuffix", "identifierEqualFold", "identifierContainsFold", "upstream", "upstreamNEQ", "upstreamIn", "upstreamNotIn", "upstreamGT", "upstreamGTE", "upstreamLT", "upstreamLTE", "upstreamContains", "upstreamHasPrefix", "upstreamHasSuffix", "upstreamEqualFold", "upstreamContainsFold", "lastSeenAt", "lastSeenAtNEQ", "lastSeenAtIn", "lastSeenAtNotIn", "lastSeenAtGT", "lastSeenAtGTE", "lastSeenAtLT", "lastSeenAtLTE", "lastSeenAtIsNil", "lastSeenAtNotNil", "hasBuildTasks", "hasBuildTasksWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -12973,6 +15683,90 @@ func (ec *executionContext) unmarshalInputBuilderWhereInput(ctx context.Context, return it, err } it.UpstreamContainsFold = data + case "lastSeenAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAt = data + case "lastSeenAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtNEQ = data + case "lastSeenAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtIn = data + case "lastSeenAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtNotIn = data + case "lastSeenAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtGT = data + case "lastSeenAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtGTE = data + case "lastSeenAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtLT = data + case "lastSeenAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtLTE = data + case "lastSeenAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtIsNil = data + case "lastSeenAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.LastSeenAtNotNil = data + case "hasBuildTasks": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBuildTasks")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasBuildTasks = data + case "hasBuildTasksWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBuildTasksWith")) + data, err := ec.unmarshalOBuildTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasBuildTasksWith = data } } @@ -12986,7 +15780,7 @@ func (ec *executionContext) unmarshalInputCreateBuilderInput(ctx context.Context asMap[k] = v } - fieldsInOrder := [...]string{"supportedTargets", "upstream"} + fieldsInOrder := [...]string{"supportedTargets", "upstream", "buildTaskIDs"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -13007,6 +15801,13 @@ func (ec *executionContext) unmarshalInputCreateBuilderInput(ctx context.Context return it, err } it.Upstream = data + case "buildTaskIDs": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildTaskIDs")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.BuildTaskIDs = data } } @@ -22121,6 +24922,11 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._Builder(ctx, sel, obj) + case *ent.BuildTask: + if obj == nil { + return graphql.Null + } + return ec._BuildTask(ctx, sel, obj) case *ent.Beacon: if obj == nil { return graphql.Null @@ -22161,31 +24967,297 @@ func (ec *executionContext) _Asset(ctx context.Context, sel ast.SelectionSet, ob atomic.AddUint32(&out.Invalids, 1) } case "createdAt": - out.Values[i] = ec._Asset_createdAt(ctx, field, obj) + out.Values[i] = ec._Asset_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "lastModifiedAt": + out.Values[i] = ec._Asset_lastModifiedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "name": + out.Values[i] = ec._Asset_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "size": + out.Values[i] = ec._Asset_size(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "hash": + out.Values[i] = ec._Asset_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "tomes": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Asset_tomes(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "links": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Asset_links(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "creator": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Asset_creator(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var assetConnectionImplementors = []string{"AssetConnection"} + +func (ec *executionContext) _AssetConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.AssetConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, assetConnectionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("AssetConnection") + case "edges": + out.Values[i] = ec._AssetConnection_edges(ctx, field, obj) + case "pageInfo": + out.Values[i] = ec._AssetConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "totalCount": + out.Values[i] = ec._AssetConnection_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var assetEdgeImplementors = []string{"AssetEdge"} + +func (ec *executionContext) _AssetEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.AssetEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, assetEdgeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("AssetEdge") + case "node": + out.Values[i] = ec._AssetEdge_node(ctx, field, obj) + case "cursor": + out.Values[i] = ec._AssetEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var beaconImplementors = []string{"Beacon", "Node"} + +func (ec *executionContext) _Beacon(ctx context.Context, sel ast.SelectionSet, obj *ent.Beacon) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, beaconImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Beacon") + case "id": + out.Values[i] = ec._Beacon_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "createdAt": + out.Values[i] = ec._Beacon_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "lastModifiedAt": - out.Values[i] = ec._Asset_lastModifiedAt(ctx, field, obj) + out.Values[i] = ec._Beacon_lastModifiedAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "name": - out.Values[i] = ec._Asset_name(ctx, field, obj) + out.Values[i] = ec._Beacon_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "size": - out.Values[i] = ec._Asset_size(ctx, field, obj) + case "principal": + out.Values[i] = ec._Beacon_principal(ctx, field, obj) + case "identifier": + out.Values[i] = ec._Beacon_identifier(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "hash": - out.Values[i] = ec._Asset_hash(ctx, field, obj) + case "agentIdentifier": + out.Values[i] = ec._Beacon_agentIdentifier(ctx, field, obj) + case "lastSeenAt": + out.Values[i] = ec._Beacon_lastSeenAt(ctx, field, obj) + case "nextSeenAt": + out.Values[i] = ec._Beacon_nextSeenAt(ctx, field, obj) + case "interval": + out.Values[i] = ec._Beacon_interval(ctx, field, obj) + case "transport": + out.Values[i] = ec._Beacon_transport(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "tomes": + case "host": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -22194,7 +25266,7 @@ func (ec *executionContext) _Asset(ctx context.Context, sel ast.SelectionSet, ob ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Asset_tomes(ctx, field, obj) + res = ec._Beacon_host(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -22221,7 +25293,7 @@ func (ec *executionContext) _Asset(ctx context.Context, sel ast.SelectionSet, ob } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "links": + case "tasks": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -22230,7 +25302,7 @@ func (ec *executionContext) _Asset(ctx context.Context, sel ast.SelectionSet, ob ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Asset_links(ctx, field, obj) + res = ec._Beacon_tasks(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -22257,16 +25329,19 @@ func (ec *executionContext) _Asset(ctx context.Context, sel ast.SelectionSet, ob } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "creator": + case "shells": field := field - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Asset_creator(ctx, field, obj) + res = ec._Beacon_shells(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } return res } @@ -22313,26 +25388,26 @@ func (ec *executionContext) _Asset(ctx context.Context, sel ast.SelectionSet, ob return out } -var assetConnectionImplementors = []string{"AssetConnection"} +var beaconConnectionImplementors = []string{"BeaconConnection"} -func (ec *executionContext) _AssetConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.AssetConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, assetConnectionImplementors) +func (ec *executionContext) _BeaconConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.BeaconConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, beaconConnectionImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("AssetConnection") + out.Values[i] = graphql.MarshalString("BeaconConnection") case "edges": - out.Values[i] = ec._AssetConnection_edges(ctx, field, obj) + out.Values[i] = ec._BeaconConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._AssetConnection_pageInfo(ctx, field, obj) + out.Values[i] = ec._BeaconConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": - out.Values[i] = ec._AssetConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._BeaconConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -22359,21 +25434,21 @@ func (ec *executionContext) _AssetConnection(ctx context.Context, sel ast.Select return out } -var assetEdgeImplementors = []string{"AssetEdge"} +var beaconEdgeImplementors = []string{"BeaconEdge"} -func (ec *executionContext) _AssetEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.AssetEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, assetEdgeImplementors) +func (ec *executionContext) _BeaconEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.BeaconEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, beaconEdgeImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("AssetEdge") + out.Values[i] = graphql.MarshalString("BeaconEdge") case "node": - out.Values[i] = ec._AssetEdge_node(ctx, field, obj) + out.Values[i] = ec._BeaconEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._AssetEdge_cursor(ctx, field, obj) + out.Values[i] = ec._BeaconEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -22400,94 +25475,94 @@ func (ec *executionContext) _AssetEdge(ctx context.Context, sel ast.SelectionSet return out } -var beaconImplementors = []string{"Beacon", "Node"} +var buildTaskImplementors = []string{"BuildTask", "Node"} -func (ec *executionContext) _Beacon(ctx context.Context, sel ast.SelectionSet, obj *ent.Beacon) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, beaconImplementors) +func (ec *executionContext) _BuildTask(ctx context.Context, sel ast.SelectionSet, obj *ent.BuildTask) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, buildTaskImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Beacon") + out.Values[i] = graphql.MarshalString("BuildTask") case "id": - out.Values[i] = ec._Beacon_id(ctx, field, obj) + out.Values[i] = ec._BuildTask_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "createdAt": - out.Values[i] = ec._Beacon_createdAt(ctx, field, obj) + out.Values[i] = ec._BuildTask_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "lastModifiedAt": - out.Values[i] = ec._Beacon_lastModifiedAt(ctx, field, obj) + out.Values[i] = ec._BuildTask_lastModifiedAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "name": - out.Values[i] = ec._Beacon_name(ctx, field, obj) + case "targetOs": + out.Values[i] = ec._BuildTask_targetOs(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "principal": - out.Values[i] = ec._Beacon_principal(ctx, field, obj) - case "identifier": - out.Values[i] = ec._Beacon_identifier(ctx, field, obj) + case "targetFormat": + out.Values[i] = ec._BuildTask_targetFormat(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "buildImage": + out.Values[i] = ec._BuildTask_buildImage(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "buildScript": + out.Values[i] = ec._BuildTask_buildScript(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "callbackURI": + out.Values[i] = ec._BuildTask_callbackURI(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "agentIdentifier": - out.Values[i] = ec._Beacon_agentIdentifier(ctx, field, obj) - case "lastSeenAt": - out.Values[i] = ec._Beacon_lastSeenAt(ctx, field, obj) - case "nextSeenAt": - out.Values[i] = ec._Beacon_nextSeenAt(ctx, field, obj) case "interval": - out.Values[i] = ec._Beacon_interval(ctx, field, obj) - case "transport": - out.Values[i] = ec._Beacon_transport(ctx, field, obj) + out.Values[i] = ec._BuildTask_interval(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "host": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Beacon_host(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res + case "transportType": + out.Values[i] = ec._BuildTask_transportType(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue + case "extra": + out.Values[i] = ec._BuildTask_extra(ctx, field, obj) + case "claimedAt": + out.Values[i] = ec._BuildTask_claimedAt(ctx, field, obj) + case "startedAt": + out.Values[i] = ec._BuildTask_startedAt(ctx, field, obj) + case "finishedAt": + out.Values[i] = ec._BuildTask_finishedAt(ctx, field, obj) + case "output": + out.Values[i] = ec._BuildTask_output(ctx, field, obj) + case "outputSize": + out.Values[i] = ec._BuildTask_outputSize(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "tasks": + case "error": + out.Values[i] = ec._BuildTask_error(ctx, field, obj) + case "errorSize": + out.Values[i] = ec._BuildTask_errorSize(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "exitCode": + out.Values[i] = ec._BuildTask_exitCode(ctx, field, obj) + case "artifactPath": + out.Values[i] = ec._BuildTask_artifactPath(ctx, field, obj) + case "builder": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -22496,7 +25571,7 @@ func (ec *executionContext) _Beacon(ctx context.Context, sel ast.SelectionSet, o ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Beacon_tasks(ctx, field, obj) + res = ec._BuildTask_builder(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -22523,19 +25598,16 @@ func (ec *executionContext) _Beacon(ctx context.Context, sel ast.SelectionSet, o } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "shells": + case "artifact": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Beacon_shells(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } + res = ec._BuildTask_artifact(ctx, field, obj) return res } @@ -22582,26 +25654,26 @@ func (ec *executionContext) _Beacon(ctx context.Context, sel ast.SelectionSet, o return out } -var beaconConnectionImplementors = []string{"BeaconConnection"} +var buildTaskConnectionImplementors = []string{"BuildTaskConnection"} -func (ec *executionContext) _BeaconConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.BeaconConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, beaconConnectionImplementors) +func (ec *executionContext) _BuildTaskConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.BuildTaskConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, buildTaskConnectionImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("BeaconConnection") + out.Values[i] = graphql.MarshalString("BuildTaskConnection") case "edges": - out.Values[i] = ec._BeaconConnection_edges(ctx, field, obj) + out.Values[i] = ec._BuildTaskConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._BeaconConnection_pageInfo(ctx, field, obj) + out.Values[i] = ec._BuildTaskConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": - out.Values[i] = ec._BeaconConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._BuildTaskConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -22628,21 +25700,21 @@ func (ec *executionContext) _BeaconConnection(ctx context.Context, sel ast.Selec return out } -var beaconEdgeImplementors = []string{"BeaconEdge"} +var buildTaskEdgeImplementors = []string{"BuildTaskEdge"} -func (ec *executionContext) _BeaconEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.BeaconEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, beaconEdgeImplementors) +func (ec *executionContext) _BuildTaskEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.BuildTaskEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, buildTaskEdgeImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("BeaconEdge") + out.Values[i] = graphql.MarshalString("BuildTaskEdge") case "node": - out.Values[i] = ec._BeaconEdge_node(ctx, field, obj) + out.Values[i] = ec._BuildTaskEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._BeaconEdge_cursor(ctx, field, obj) + out.Values[i] = ec._BuildTaskEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -22683,33 +25755,71 @@ func (ec *executionContext) _Builder(ctx context.Context, sel ast.SelectionSet, case "id": out.Values[i] = ec._Builder_id(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "createdAt": out.Values[i] = ec._Builder_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "lastModifiedAt": out.Values[i] = ec._Builder_lastModifiedAt(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "identifier": out.Values[i] = ec._Builder_identifier(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "supportedTargets": out.Values[i] = ec._Builder_supportedTargets(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "upstream": out.Values[i] = ec._Builder_upstream(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) + } + case "lastSeenAt": + out.Values[i] = ec._Builder_lastSeenAt(ctx, field, obj) + case "buildTasks": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Builder_buildTasks(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -24543,7 +27653,51 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "beacons": + case "beacons": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_beacons(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "hosts": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_hosts(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "tags": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -24552,7 +27706,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_beacons(ctx, field) + res = ec._Query_tags(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -24565,7 +27719,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "hosts": + case "tomes": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -24574,7 +27728,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_hosts(ctx, field) + res = ec._Query_tomes(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -24587,7 +27741,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "tags": + case "users": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -24596,7 +27750,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_tags(ctx, field) + res = ec._Query_users(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -24609,7 +27763,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "tomes": + case "portals": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -24618,7 +27772,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_tomes(ctx, field) + res = ec._Query_portals(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -24631,7 +27785,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "users": + case "shells": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -24640,7 +27794,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_users(ctx, field) + res = ec._Query_shells(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -24653,7 +27807,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "portals": + case "buildTasks": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -24662,7 +27816,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_portals(ctx, field) + res = ec._Query_buildTasks(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -24675,7 +27829,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "shells": + case "builders": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -24684,7 +27838,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_shells(ctx, field) + res = ec._Query_builders(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -26730,6 +29884,70 @@ func (ec *executionContext) unmarshalNBeaconWhereInput2ᚖrealmᚗpubᚋtavern return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNBuildTask2realmᚗpubᚋtavernᚋinternalᚋentᚐBuildTask(ctx context.Context, sel ast.SelectionSet, v ent.BuildTask) graphql.Marshaler { + return ec._BuildTask(ctx, sel, &v) +} + +func (ec *executionContext) marshalNBuildTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTask(ctx context.Context, sel ast.SelectionSet, v *ent.BuildTask) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._BuildTask(ctx, sel, v) +} + +func (ec *executionContext) marshalNBuildTaskConnection2realmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskConnection(ctx context.Context, sel ast.SelectionSet, v ent.BuildTaskConnection) graphql.Marshaler { + return ec._BuildTaskConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNBuildTaskConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskConnection(ctx context.Context, sel ast.SelectionSet, v *ent.BuildTaskConnection) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._BuildTaskConnection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNBuildTaskOrder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskOrder(ctx context.Context, v any) (*ent.BuildTaskOrder, error) { + res, err := ec.unmarshalInputBuildTaskOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNBuildTaskOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskOrderField(ctx context.Context, v any) (*ent.BuildTaskOrderField, error) { + var res = new(ent.BuildTaskOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBuildTaskOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.BuildTaskOrderField) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return v +} + +func (ec *executionContext) unmarshalNBuildTaskTargetFormat2realmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat(ctx context.Context, v any) (builderpb.TargetFormat, error) { + var res builderpb.TargetFormat + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBuildTaskTargetFormat2realmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat(ctx context.Context, sel ast.SelectionSet, v builderpb.TargetFormat) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNBuildTaskWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInput(ctx context.Context, v any) (*ent.BuildTaskWhereInput, error) { + res, err := ec.unmarshalInputBuildTaskWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNBuilder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilder(ctx context.Context, sel ast.SelectionSet, v *ent.Builder) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -26740,6 +29958,25 @@ func (ec *executionContext) marshalNBuilder2ᚖrealmᚗpubᚋtavernᚋinternal return ec._Builder(ctx, sel, v) } +func (ec *executionContext) marshalNBuilderConnection2realmᚗpubᚋtavernᚋinternalᚋentᚐBuilderConnection(ctx context.Context, sel ast.SelectionSet, v ent.BuilderConnection) graphql.Marshaler { + return ec._BuilderConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNBuilderConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderConnection(ctx context.Context, sel ast.SelectionSet, v *ent.BuilderConnection) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._BuilderConnection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNBuilderOrder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderOrder(ctx context.Context, v any) (*ent.BuilderOrder, error) { + res, err := ec.unmarshalInputBuilderOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalNBuilderOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderOrderField(ctx context.Context, v any) (*ent.BuilderOrderField, error) { var res = new(ent.BuilderOrderField) err := res.UnmarshalGQL(v) @@ -27908,6 +31145,186 @@ func (ec *executionContext) unmarshalOBeaconWhereInput2ᚖrealmᚗpubᚋtavern return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalOBuildTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTask(ctx context.Context, sel ast.SelectionSet, v *ent.BuildTask) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._BuildTask(ctx, sel, v) +} + +func (ec *executionContext) marshalOBuildTaskEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.BuildTaskEdge) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOBuildTaskEdge2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOBuildTaskEdge2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskEdge(ctx context.Context, sel ast.SelectionSet, v *ent.BuildTaskEdge) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._BuildTaskEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOBuildTaskOrder2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskOrderᚄ(ctx context.Context, v any) ([]*ent.BuildTaskOrder, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*ent.BuildTaskOrder, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNBuildTaskOrder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskOrder(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOBuildTaskTargetFormat2ᚕrealmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormatᚄ(ctx context.Context, v any) ([]builderpb.TargetFormat, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]builderpb.TargetFormat, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNBuildTaskTargetFormat2realmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOBuildTaskTargetFormat2ᚕrealmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormatᚄ(ctx context.Context, sel ast.SelectionSet, v []builderpb.TargetFormat) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNBuildTaskTargetFormat2realmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOBuildTaskTargetFormat2ᚖrealmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat(ctx context.Context, v any) (*builderpb.TargetFormat, error) { + if v == nil { + return nil, nil + } + var res = new(builderpb.TargetFormat) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBuildTaskTargetFormat2ᚖrealmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat(ctx context.Context, sel ast.SelectionSet, v *builderpb.TargetFormat) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) unmarshalOBuildTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInputᚄ(ctx context.Context, v any) ([]*ent.BuildTaskWhereInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*ent.BuildTaskWhereInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNBuildTaskWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOBuildTaskWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTaskWhereInput(ctx context.Context, v any) (*ent.BuildTaskWhereInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputBuildTaskWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalOBuilder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilder(ctx context.Context, sel ast.SelectionSet, v *ent.Builder) graphql.Marshaler { if v == nil { return graphql.Null @@ -27963,6 +31380,24 @@ func (ec *executionContext) marshalOBuilderEdge2ᚖrealmᚗpubᚋtavernᚋintern return ec._BuilderEdge(ctx, sel, v) } +func (ec *executionContext) unmarshalOBuilderOrder2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderOrderᚄ(ctx context.Context, v any) ([]*ent.BuilderOrder, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*ent.BuilderOrder, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNBuilderOrder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderOrder(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + func (ec *executionContext) unmarshalOBuilderWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuilderWhereInputᚄ(ctx context.Context, v any) ([]*ent.BuilderWhereInput, error) { if v == nil { return nil, nil diff --git a/tavern/internal/graphql/generated/inputs.generated.go b/tavern/internal/graphql/generated/inputs.generated.go index 0fbd94e21..917159715 100644 --- a/tavern/internal/graphql/generated/inputs.generated.go +++ b/tavern/internal/graphql/generated/inputs.generated.go @@ -64,6 +64,10 @@ func (ec *executionContext) fieldContext_RegisterBuilderOutput_builder(_ context return ec.fieldContext_Builder_supportedTargets(ctx, field) case "upstream": return ec.fieldContext_Builder_upstream(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Builder_lastSeenAt(ctx, field) + case "buildTasks": + return ec.fieldContext_Builder_buildTasks(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Builder", field.Name) }, @@ -202,6 +206,86 @@ func (ec *executionContext) unmarshalInputClaimTasksInput(ctx context.Context, o return it, nil } +func (ec *executionContext) unmarshalInputCreateBuildTaskInput(ctx context.Context, obj any) (models.CreateBuildTaskInput, error) { + var it models.CreateBuildTaskInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["interval"]; !present { + asMap["interval"] = 5 + } + + fieldsInOrder := [...]string{"targetOS", "targetFormat", "buildImage", "callbackURI", "interval", "transportType", "extra", "artifactPath"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "targetOS": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetOS")) + data, err := ec.unmarshalNHostPlatform2realmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform(ctx, v) + if err != nil { + return it, err + } + it.TargetOs = data + case "targetFormat": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetFormat")) + data, err := ec.unmarshalOBuildTaskTargetFormat2ᚖrealmᚗpubᚋtavernᚋinternalᚋbuilderᚋbuilderpbᚐTargetFormat(ctx, v) + if err != nil { + return it, err + } + it.TargetFormat = data + case "buildImage": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("buildImage")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BuildImage = data + case "callbackURI": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURI")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CallbackURI = data + case "interval": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interval")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Interval = data + case "transportType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transportType")) + data, err := ec.unmarshalOBeaconTransport_Type2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐTransport_Type(ctx, v) + if err != nil { + return it, err + } + it.TransportType = data + case "extra": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("extra")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Extra = data + case "artifactPath": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("artifactPath")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ArtifactPath = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputImportRepositoryInput(ctx context.Context, obj any) (models.ImportRepositoryInput, error) { var it models.ImportRepositoryInput asMap := map[string]any{} @@ -345,6 +429,11 @@ func (ec *executionContext) _RegisterBuilderOutput(ctx context.Context, sel ast. // region ***************************** type.gotpl ***************************** +func (ec *executionContext) unmarshalNCreateBuildTaskInput2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐCreateBuildTaskInput(ctx context.Context, v any) (models.CreateBuildTaskInput, error) { + res, err := ec.unmarshalInputCreateBuildTaskInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNRegisterBuilderOutput2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRegisterBuilderOutput(ctx context.Context, sel ast.SelectionSet, v models.RegisterBuilderOutput) graphql.Marshaler { return ec._RegisterBuilderOutput(ctx, sel, &v) } diff --git a/tavern/internal/graphql/generated/mutation.generated.go b/tavern/internal/graphql/generated/mutation.generated.go index 406082cb5..0bc3be874 100644 --- a/tavern/internal/graphql/generated/mutation.generated.go +++ b/tavern/internal/graphql/generated/mutation.generated.go @@ -35,12 +35,25 @@ type MutationResolver interface { UpdateLink(ctx context.Context, linkID int, input ent.UpdateLinkInput) (*ent.Link, error) DisableLink(ctx context.Context, linkID int) (*ent.Link, error) RegisterBuilder(ctx context.Context, input ent.CreateBuilderInput) (*models.RegisterBuilderOutput, error) + DeleteBuilder(ctx context.Context, builderID int) (int, error) + CreateBuildTask(ctx context.Context, input models.CreateBuildTaskInput) (*ent.BuildTask, error) } // endregion ************************** generated!.gotpl ************************** // region ***************************** args.gotpl ***************************** +func (ec *executionContext) field_Mutation_createBuildTask_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateBuildTaskInput2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐCreateBuildTaskInput) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_createCredential_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -112,6 +125,17 @@ func (ec *executionContext) field_Mutation_createTome_args(ctx context.Context, return args, nil } +func (ec *executionContext) field_Mutation_deleteBuilder_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "builderID", ec.unmarshalNID2int) + if err != nil { + return nil, err + } + args["builderID"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_deleteTome_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1572,6 +1596,170 @@ func (ec *executionContext) fieldContext_Mutation_registerBuilder(ctx context.Co return fc, nil } +func (ec *executionContext) _Mutation_deleteBuilder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Mutation_deleteBuilder, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Mutation().DeleteBuilder(ctx, fc.Args["builderID"].(int)) + }, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "ADMIN") + if err != nil { + var zeroVal int + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal int + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNID2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Mutation_deleteBuilder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteBuilder_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createBuildTask(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Mutation_createBuildTask, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Mutation().CreateBuildTask(ctx, fc.Args["input"].(models.CreateBuildTaskInput)) + }, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "ADMIN") + if err != nil { + var zeroVal *ent.BuildTask + return zeroVal, err + } + if ec.directives.RequireRole == nil { + var zeroVal *ent.BuildTask + return zeroVal, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + next = directive1 + return next + }, + ec.marshalNBuildTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBuildTask, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Mutation_createBuildTask(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_BuildTask_id(ctx, field) + case "createdAt": + return ec.fieldContext_BuildTask_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_BuildTask_lastModifiedAt(ctx, field) + case "targetOs": + return ec.fieldContext_BuildTask_targetOs(ctx, field) + case "targetFormat": + return ec.fieldContext_BuildTask_targetFormat(ctx, field) + case "buildImage": + return ec.fieldContext_BuildTask_buildImage(ctx, field) + case "buildScript": + return ec.fieldContext_BuildTask_buildScript(ctx, field) + case "callbackURI": + return ec.fieldContext_BuildTask_callbackURI(ctx, field) + case "interval": + return ec.fieldContext_BuildTask_interval(ctx, field) + case "transportType": + return ec.fieldContext_BuildTask_transportType(ctx, field) + case "extra": + return ec.fieldContext_BuildTask_extra(ctx, field) + case "claimedAt": + return ec.fieldContext_BuildTask_claimedAt(ctx, field) + case "startedAt": + return ec.fieldContext_BuildTask_startedAt(ctx, field) + case "finishedAt": + return ec.fieldContext_BuildTask_finishedAt(ctx, field) + case "output": + return ec.fieldContext_BuildTask_output(ctx, field) + case "outputSize": + return ec.fieldContext_BuildTask_outputSize(ctx, field) + case "error": + return ec.fieldContext_BuildTask_error(ctx, field) + case "errorSize": + return ec.fieldContext_BuildTask_errorSize(ctx, field) + case "exitCode": + return ec.fieldContext_BuildTask_exitCode(ctx, field) + case "artifactPath": + return ec.fieldContext_BuildTask_artifactPath(ctx, field) + case "builder": + return ec.fieldContext_BuildTask_builder(ctx, field) + case "artifact": + return ec.fieldContext_BuildTask_artifact(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BuildTask", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createBuildTask_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + // endregion **************************** field.gotpl ***************************** // region **************************** input.gotpl ***************************** @@ -1716,6 +1904,20 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "deleteBuilder": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteBuilder(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createBuildTask": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createBuildTask(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/tavern/internal/graphql/generated/root_.generated.go b/tavern/internal/graphql/generated/root_.generated.go index e3474e9a5..1d4d6ac2f 100644 --- a/tavern/internal/graphql/generated/root_.generated.go +++ b/tavern/internal/graphql/generated/root_.generated.go @@ -95,11 +95,49 @@ type ComplexityRoot struct { Node func(childComplexity int) int } + BuildTask struct { + Artifact func(childComplexity int) int + ArtifactPath func(childComplexity int) int + BuildImage func(childComplexity int) int + BuildScript func(childComplexity int) int + Builder func(childComplexity int) int + CallbackURI func(childComplexity int) int + ClaimedAt func(childComplexity int) int + CreatedAt func(childComplexity int) int + Error func(childComplexity int) int + ErrorSize func(childComplexity int) int + ExitCode func(childComplexity int) int + Extra func(childComplexity int) int + FinishedAt func(childComplexity int) int + ID func(childComplexity int) int + Interval func(childComplexity int) int + LastModifiedAt func(childComplexity int) int + Output func(childComplexity int) int + OutputSize func(childComplexity int) int + StartedAt func(childComplexity int) int + TargetFormat func(childComplexity int) int + TargetOs func(childComplexity int) int + TransportType func(childComplexity int) int + } + + BuildTaskConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int + } + + BuildTaskEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + Builder struct { + BuildTasks func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.BuildTaskOrder, where *ent.BuildTaskWhereInput) int CreatedAt func(childComplexity int) int ID func(childComplexity int) int Identifier func(childComplexity int) int LastModifiedAt func(childComplexity int) int + LastSeenAt func(childComplexity int) int SupportedTargets func(childComplexity int) int Upstream func(childComplexity int) int } @@ -243,12 +281,14 @@ type ComplexityRoot struct { } Mutation struct { + CreateBuildTask func(childComplexity int, input models.CreateBuildTaskInput) int CreateCredential func(childComplexity int, input ent.CreateHostCredentialInput) int CreateLink func(childComplexity int, input ent.CreateLinkInput) int CreateQuest func(childComplexity int, beaconIDs []int, input ent.CreateQuestInput) int CreateRepository func(childComplexity int, input ent.CreateRepositoryInput) int CreateTag func(childComplexity int, input ent.CreateTagInput) int CreateTome func(childComplexity int, input ent.CreateTomeInput) int + DeleteBuilder func(childComplexity int, builderID int) int DeleteTome func(childComplexity int, tomeID int) int DisableLink func(childComplexity int, linkID int) int DropAllData func(childComplexity int) int @@ -294,6 +334,8 @@ type ComplexityRoot struct { Query struct { Assets func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.AssetOrder, where *ent.AssetWhereInput) int Beacons func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.BeaconOrder, where *ent.BeaconWhereInput) int + BuildTasks func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.BuildTaskOrder, where *ent.BuildTaskWhereInput) int + Builders func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.BuilderOrder, where *ent.BuilderWhereInput) int Hosts func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.HostOrder, where *ent.HostWhereInput) int Me func(childComplexity int) int Node func(childComplexity int, id int) int @@ -753,6 +795,207 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.BeaconEdge.Node(childComplexity), true + case "BuildTask.artifact": + if e.complexity.BuildTask.Artifact == nil { + break + } + + return e.complexity.BuildTask.Artifact(childComplexity), true + + case "BuildTask.artifactPath": + if e.complexity.BuildTask.ArtifactPath == nil { + break + } + + return e.complexity.BuildTask.ArtifactPath(childComplexity), true + + case "BuildTask.buildImage": + if e.complexity.BuildTask.BuildImage == nil { + break + } + + return e.complexity.BuildTask.BuildImage(childComplexity), true + + case "BuildTask.buildScript": + if e.complexity.BuildTask.BuildScript == nil { + break + } + + return e.complexity.BuildTask.BuildScript(childComplexity), true + + case "BuildTask.builder": + if e.complexity.BuildTask.Builder == nil { + break + } + + return e.complexity.BuildTask.Builder(childComplexity), true + + case "BuildTask.callbackURI": + if e.complexity.BuildTask.CallbackURI == nil { + break + } + + return e.complexity.BuildTask.CallbackURI(childComplexity), true + + case "BuildTask.claimedAt": + if e.complexity.BuildTask.ClaimedAt == nil { + break + } + + return e.complexity.BuildTask.ClaimedAt(childComplexity), true + + case "BuildTask.createdAt": + if e.complexity.BuildTask.CreatedAt == nil { + break + } + + return e.complexity.BuildTask.CreatedAt(childComplexity), true + + case "BuildTask.error": + if e.complexity.BuildTask.Error == nil { + break + } + + return e.complexity.BuildTask.Error(childComplexity), true + + case "BuildTask.errorSize": + if e.complexity.BuildTask.ErrorSize == nil { + break + } + + return e.complexity.BuildTask.ErrorSize(childComplexity), true + + case "BuildTask.exitCode": + if e.complexity.BuildTask.ExitCode == nil { + break + } + + return e.complexity.BuildTask.ExitCode(childComplexity), true + + case "BuildTask.extra": + if e.complexity.BuildTask.Extra == nil { + break + } + + return e.complexity.BuildTask.Extra(childComplexity), true + + case "BuildTask.finishedAt": + if e.complexity.BuildTask.FinishedAt == nil { + break + } + + return e.complexity.BuildTask.FinishedAt(childComplexity), true + + case "BuildTask.id": + if e.complexity.BuildTask.ID == nil { + break + } + + return e.complexity.BuildTask.ID(childComplexity), true + + case "BuildTask.interval": + if e.complexity.BuildTask.Interval == nil { + break + } + + return e.complexity.BuildTask.Interval(childComplexity), true + + case "BuildTask.lastModifiedAt": + if e.complexity.BuildTask.LastModifiedAt == nil { + break + } + + return e.complexity.BuildTask.LastModifiedAt(childComplexity), true + + case "BuildTask.output": + if e.complexity.BuildTask.Output == nil { + break + } + + return e.complexity.BuildTask.Output(childComplexity), true + + case "BuildTask.outputSize": + if e.complexity.BuildTask.OutputSize == nil { + break + } + + return e.complexity.BuildTask.OutputSize(childComplexity), true + + case "BuildTask.startedAt": + if e.complexity.BuildTask.StartedAt == nil { + break + } + + return e.complexity.BuildTask.StartedAt(childComplexity), true + + case "BuildTask.targetFormat": + if e.complexity.BuildTask.TargetFormat == nil { + break + } + + return e.complexity.BuildTask.TargetFormat(childComplexity), true + + case "BuildTask.targetOs": + if e.complexity.BuildTask.TargetOs == nil { + break + } + + return e.complexity.BuildTask.TargetOs(childComplexity), true + + case "BuildTask.transportType": + if e.complexity.BuildTask.TransportType == nil { + break + } + + return e.complexity.BuildTask.TransportType(childComplexity), true + + case "BuildTaskConnection.edges": + if e.complexity.BuildTaskConnection.Edges == nil { + break + } + + return e.complexity.BuildTaskConnection.Edges(childComplexity), true + + case "BuildTaskConnection.pageInfo": + if e.complexity.BuildTaskConnection.PageInfo == nil { + break + } + + return e.complexity.BuildTaskConnection.PageInfo(childComplexity), true + + case "BuildTaskConnection.totalCount": + if e.complexity.BuildTaskConnection.TotalCount == nil { + break + } + + return e.complexity.BuildTaskConnection.TotalCount(childComplexity), true + + case "BuildTaskEdge.cursor": + if e.complexity.BuildTaskEdge.Cursor == nil { + break + } + + return e.complexity.BuildTaskEdge.Cursor(childComplexity), true + + case "BuildTaskEdge.node": + if e.complexity.BuildTaskEdge.Node == nil { + break + } + + return e.complexity.BuildTaskEdge.Node(childComplexity), true + + case "Builder.buildTasks": + if e.complexity.Builder.BuildTasks == nil { + break + } + + args, err := ec.field_Builder_buildTasks_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Builder.BuildTasks(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.BuildTaskOrder), args["where"].(*ent.BuildTaskWhereInput)), true + case "Builder.createdAt": if e.complexity.Builder.CreatedAt == nil { break @@ -781,6 +1024,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Builder.LastModifiedAt(childComplexity), true + case "Builder.lastSeenAt": + if e.complexity.Builder.LastSeenAt == nil { + break + } + + return e.complexity.Builder.LastSeenAt(childComplexity), true + case "Builder.supportedTargets": if e.complexity.Builder.SupportedTargets == nil { break @@ -1429,6 +1679,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.LinkEdge.Node(childComplexity), true + case "Mutation.createBuildTask": + if e.complexity.Mutation.CreateBuildTask == nil { + break + } + + args, err := ec.field_Mutation_createBuildTask_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateBuildTask(childComplexity, args["input"].(models.CreateBuildTaskInput)), true + case "Mutation.createCredential": if e.complexity.Mutation.CreateCredential == nil { break @@ -1501,6 +1763,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.CreateTome(childComplexity, args["input"].(ent.CreateTomeInput)), true + case "Mutation.deleteBuilder": + if e.complexity.Mutation.DeleteBuilder == nil { + break + } + + args, err := ec.field_Mutation_deleteBuilder_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteBuilder(childComplexity, args["builderID"].(int)), true + case "Mutation.deleteTome": if e.complexity.Mutation.DeleteTome == nil { break @@ -1776,6 +2050,30 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Query.Beacons(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.BeaconOrder), args["where"].(*ent.BeaconWhereInput)), true + case "Query.buildTasks": + if e.complexity.Query.BuildTasks == nil { + break + } + + args, err := ec.field_Query_buildTasks_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.BuildTasks(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.BuildTaskOrder), args["where"].(*ent.BuildTaskWhereInput)), true + + case "Query.builders": + if e.complexity.Query.Builders == nil { + break + } + + args, err := ec.field_Query_builders_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Builders(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.BuilderOrder), args["where"].(*ent.BuilderWhereInput)), true + case "Query.hosts": if e.complexity.Query.Hosts == nil { break @@ -2743,9 +3041,12 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputAssetWhereInput, ec.unmarshalInputBeaconOrder, ec.unmarshalInputBeaconWhereInput, + ec.unmarshalInputBuildTaskOrder, + ec.unmarshalInputBuildTaskWhereInput, ec.unmarshalInputBuilderOrder, ec.unmarshalInputBuilderWhereInput, ec.unmarshalInputClaimTasksInput, + ec.unmarshalInputCreateBuildTaskInput, ec.unmarshalInputCreateBuilderInput, ec.unmarshalInputCreateHostCredentialInput, ec.unmarshalInputCreateLinkInput, @@ -3475,6 +3776,437 @@ input BeaconWhereInput { hasShells: Boolean hasShellsWith: [ShellWhereInput!] } +type BuildTask implements Node { + id: ID! + """ + Timestamp of when this ent was created + """ + createdAt: Time! + """ + Timestamp of when this ent was last updated + """ + lastModifiedAt: Time! + """ + The target operating system platform for this build. + """ + targetOs: HostPlatform! + """ + The output format for the build (BIN, CDYLIB, WINDOWS_SERVICE). + """ + targetFormat: BuildTaskTargetFormat! + """ + Docker container image name to use for the build. + """ + buildImage: String! + """ + The derived script to execute inside the build container. + """ + buildScript: String! + """ + The callback URI for the IMIX agent to connect to. + """ + callbackURI: String! + """ + The callback interval in seconds for the IMIX agent. + """ + interval: Int! + """ + The transport type for the IMIX agent. + """ + transportType: BeaconTransport_Type! + """ + Extra transport configuration for the IMIX agent. + """ + extra: String + """ + Timestamp of when a builder claimed this task, null if unclaimed. + """ + claimedAt: Time + """ + Timestamp of when the build execution started, null if not yet started. + """ + startedAt: Time + """ + Timestamp of when the build finished, null if not yet finished. + """ + finishedAt: Time + """ + Output from the build execution. + """ + output: String + """ + The size of the output in bytes + """ + outputSize: Int! + """ + Error message if the build failed. + """ + error: String + """ + The size of the error in bytes + """ + errorSize: Int! + """ + Exit code from the build container process. Null if the build has not finished. + """ + exitCode: Int + """ + Path inside the container where the build artifact is located. Derived from target_os if not set. + """ + artifactPath: String + """ + The builder assigned to execute this build task. + """ + builder: Builder! + """ + The compiled artifact produced by this build task, stored as an Asset. + """ + artifact: Asset +} +""" +A connection to a list of items. +""" +type BuildTaskConnection { + """ + A list of edges. + """ + edges: [BuildTaskEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type BuildTaskEdge { + """ + The item at the end of the edge. + """ + node: BuildTask + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +Ordering options for BuildTask connections +""" +input BuildTaskOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order BuildTasks. + """ + field: BuildTaskOrderField! +} +""" +Properties by which BuildTask connections can be ordered. +""" +enum BuildTaskOrderField { + CREATED_AT + LAST_MODIFIED_AT + TARGET_OS + CLAIMED_AT + STARTED_AT + FINISHED_AT + OUTPUT_SIZE + ERROR_SIZE + EXIT_CODE +} +""" +BuildTaskTargetFormat is enum for the field target_format +""" +enum BuildTaskTargetFormat @goModel(model: "realm.pub/tavern/internal/builder/builderpb.TargetFormat") { + TARGET_FORMAT_BIN + TARGET_FORMAT_CDYLIB + TARGET_FORMAT_UNSPECIFIED + TARGET_FORMAT_WINDOWS_SERVICE +} +""" +BuildTaskWhereInput is used for filtering BuildTask objects. +Input was generated by ent. +""" +input BuildTaskWhereInput { + not: BuildTaskWhereInput + and: [BuildTaskWhereInput!] + or: [BuildTaskWhereInput!] + """ + id field predicates + """ + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """ + created_at field predicates + """ + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """ + last_modified_at field predicates + """ + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """ + target_os field predicates + """ + targetOs: HostPlatform + targetOsNEQ: HostPlatform + targetOsIn: [HostPlatform!] + targetOsNotIn: [HostPlatform!] + """ + target_format field predicates + """ + targetFormat: BuildTaskTargetFormat + targetFormatNEQ: BuildTaskTargetFormat + targetFormatIn: [BuildTaskTargetFormat!] + targetFormatNotIn: [BuildTaskTargetFormat!] + """ + build_image field predicates + """ + buildImage: String + buildImageNEQ: String + buildImageIn: [String!] + buildImageNotIn: [String!] + buildImageGT: String + buildImageGTE: String + buildImageLT: String + buildImageLTE: String + buildImageContains: String + buildImageHasPrefix: String + buildImageHasSuffix: String + buildImageEqualFold: String + buildImageContainsFold: String + """ + build_script field predicates + """ + buildScript: String + buildScriptNEQ: String + buildScriptIn: [String!] + buildScriptNotIn: [String!] + buildScriptGT: String + buildScriptGTE: String + buildScriptLT: String + buildScriptLTE: String + buildScriptContains: String + buildScriptHasPrefix: String + buildScriptHasSuffix: String + buildScriptEqualFold: String + buildScriptContainsFold: String + """ + callback_uri field predicates + """ + callbackURI: String + callbackURINEQ: String + callbackURIIn: [String!] + callbackURINotIn: [String!] + callbackURIGT: String + callbackURIGTE: String + callbackURILT: String + callbackURILTE: String + callbackURIContains: String + callbackURIHasPrefix: String + callbackURIHasSuffix: String + callbackURIEqualFold: String + callbackURIContainsFold: String + """ + interval field predicates + """ + interval: Int + intervalNEQ: Int + intervalIn: [Int!] + intervalNotIn: [Int!] + intervalGT: Int + intervalGTE: Int + intervalLT: Int + intervalLTE: Int + """ + transport_type field predicates + """ + transportType: BeaconTransport_Type + transportTypeNEQ: BeaconTransport_Type + transportTypeIn: [BeaconTransport_Type!] + transportTypeNotIn: [BeaconTransport_Type!] + """ + extra field predicates + """ + extra: String + extraNEQ: String + extraIn: [String!] + extraNotIn: [String!] + extraGT: String + extraGTE: String + extraLT: String + extraLTE: String + extraContains: String + extraHasPrefix: String + extraHasSuffix: String + extraIsNil: Boolean + extraNotNil: Boolean + extraEqualFold: String + extraContainsFold: String + """ + claimed_at field predicates + """ + claimedAt: Time + claimedAtNEQ: Time + claimedAtIn: [Time!] + claimedAtNotIn: [Time!] + claimedAtGT: Time + claimedAtGTE: Time + claimedAtLT: Time + claimedAtLTE: Time + claimedAtIsNil: Boolean + claimedAtNotNil: Boolean + """ + started_at field predicates + """ + startedAt: Time + startedAtNEQ: Time + startedAtIn: [Time!] + startedAtNotIn: [Time!] + startedAtGT: Time + startedAtGTE: Time + startedAtLT: Time + startedAtLTE: Time + startedAtIsNil: Boolean + startedAtNotNil: Boolean + """ + finished_at field predicates + """ + finishedAt: Time + finishedAtNEQ: Time + finishedAtIn: [Time!] + finishedAtNotIn: [Time!] + finishedAtGT: Time + finishedAtGTE: Time + finishedAtLT: Time + finishedAtLTE: Time + finishedAtIsNil: Boolean + finishedAtNotNil: Boolean + """ + output field predicates + """ + output: String + outputNEQ: String + outputIn: [String!] + outputNotIn: [String!] + outputGT: String + outputGTE: String + outputLT: String + outputLTE: String + outputContains: String + outputHasPrefix: String + outputHasSuffix: String + outputIsNil: Boolean + outputNotNil: Boolean + outputEqualFold: String + outputContainsFold: String + """ + output_size field predicates + """ + outputSize: Int + outputSizeNEQ: Int + outputSizeIn: [Int!] + outputSizeNotIn: [Int!] + outputSizeGT: Int + outputSizeGTE: Int + outputSizeLT: Int + outputSizeLTE: Int + """ + error field predicates + """ + error: String + errorNEQ: String + errorIn: [String!] + errorNotIn: [String!] + errorGT: String + errorGTE: String + errorLT: String + errorLTE: String + errorContains: String + errorHasPrefix: String + errorHasSuffix: String + errorIsNil: Boolean + errorNotNil: Boolean + errorEqualFold: String + errorContainsFold: String + """ + error_size field predicates + """ + errorSize: Int + errorSizeNEQ: Int + errorSizeIn: [Int!] + errorSizeNotIn: [Int!] + errorSizeGT: Int + errorSizeGTE: Int + errorSizeLT: Int + errorSizeLTE: Int + """ + exit_code field predicates + """ + exitCode: Int + exitCodeNEQ: Int + exitCodeIn: [Int!] + exitCodeNotIn: [Int!] + exitCodeGT: Int + exitCodeGTE: Int + exitCodeLT: Int + exitCodeLTE: Int + exitCodeIsNil: Boolean + exitCodeNotNil: Boolean + """ + artifact_path field predicates + """ + artifactPath: String + artifactPathNEQ: String + artifactPathIn: [String!] + artifactPathNotIn: [String!] + artifactPathGT: String + artifactPathGTE: String + artifactPathLT: String + artifactPathLTE: String + artifactPathContains: String + artifactPathHasPrefix: String + artifactPathHasSuffix: String + artifactPathIsNil: Boolean + artifactPathNotNil: Boolean + artifactPathEqualFold: String + artifactPathContainsFold: String + """ + builder edge predicates + """ + hasBuilder: Boolean + hasBuilderWith: [BuilderWhereInput!] + """ + artifact edge predicates + """ + hasArtifact: Boolean + hasArtifactWith: [AssetWhereInput!] +} type Builder implements Node { id: ID! """ @@ -3497,6 +4229,41 @@ type Builder implements Node { The server address that the builder should connect to. """ upstream: String! + """ + Timestamp of the builder's last ClaimBuildTasks call. Null if never seen. + """ + lastSeenAt: Time + buildTasks( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for BuildTasks returned from the connection. + """ + orderBy: [BuildTaskOrder!] + + """ + Filtering options for BuildTasks returned from the connection. + """ + where: BuildTaskWhereInput + ): BuildTaskConnection! } """ A connection to a list of items. @@ -3547,6 +4314,7 @@ Properties by which Builder connections can be ordered. enum BuilderOrderField { CREATED_AT LAST_MODIFIED_AT + LAST_SEEN_AT } """ BuilderWhereInput is used for filtering Builder objects. @@ -3621,6 +4389,24 @@ input BuilderWhereInput { upstreamHasSuffix: String upstreamEqualFold: String upstreamContainsFold: String + """ + last_seen_at field predicates + """ + lastSeenAt: Time + lastSeenAtNEQ: Time + lastSeenAtIn: [Time!] + lastSeenAtNotIn: [Time!] + lastSeenAtGT: Time + lastSeenAtGTE: Time + lastSeenAtLT: Time + lastSeenAtLTE: Time + lastSeenAtIsNil: Boolean + lastSeenAtNotNil: Boolean + """ + build_tasks edge predicates + """ + hasBuildTasks: Boolean + hasBuildTasksWith: [BuildTaskWhereInput!] } """ CreateBuilderInput is used for create Builder object. @@ -3635,6 +4421,7 @@ input CreateBuilderInput { The server address that the builder should connect to. """ upstream: String! + buildTaskIDs: [ID!] } """ CreateHostCredentialInput is used for create HostCredential object. @@ -4447,7 +5234,7 @@ enum HostOrderField { NEXT_SEEN_AT } """ -HostPlatform is enum for the field platform +HostPlatform is enum for the field target_os """ enum HostPlatform @goModel(model: "realm.pub/tavern/internal/c2/c2pb.Host_Platform") { PLATFORM_BSD @@ -7513,6 +8300,44 @@ scalar Uint64 """Filtering options for Shells returned from the connection.""" where: ShellWhereInput): ShellConnection! @requireRole(role: USER) + buildTasks( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for BuildTasks returned from the connection.""" + orderBy: [BuildTaskOrder!] + + """Filtering options for BuildTasks returned from the connection.""" + where: BuildTaskWhereInput + ): BuildTaskConnection! @requireRole(role: USER) + builders( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for Builders returned from the connection.""" + orderBy: [BuilderOrder!] + + """Filtering options for Builders returned from the connection.""" + where: BuilderWhereInput + ): BuilderConnection! @requireRole(role: ADMIN) me: User! } `, BuiltIn: false}, @@ -7577,6 +8402,12 @@ scalar Uint64 # Builder ### registerBuilder(input: CreateBuilderInput!): RegisterBuilderOutput! @requireRole(role: ADMIN) + deleteBuilder(builderID: ID!): ID! @requireRole(role: ADMIN) + + ### + # BuildTask + ### + createBuildTask(input: CreateBuildTaskInput!): BuildTask! @requireRole(role: ADMIN) } `, BuiltIn: false}, {Name: "../schema/inputs.graphql", Input: `input ClaimTasksInput { @@ -7629,12 +8460,39 @@ input ImportRepositoryInput { includeDirs: [String!] } +"""Input for creating a new build task.""" +input CreateBuildTaskInput { + """The target operating system for the build.""" + targetOS: HostPlatform! + + """The output format for the build. Defaults to BIN.""" + targetFormat: BuildTaskTargetFormat + + """Docker container image name to use for the build. Defaults to spellshift/devcontainer:main.""" + buildImage: String + + """The callback URI for the IMIX agent to connect to. Defaults to http://127.0.0.1:8000.""" + callbackURI: String + + """The callback interval in seconds for the IMIX agent.""" + interval: Int = 5 + + """The transport type for the IMIX agent. Defaults to TRANSPORT_GRPC.""" + transportType: BeaconTransport_Type + + """Extra transport configuration for the IMIX agent.""" + extra: String + + """Path inside the build container to extract the artifact from. Defaults to the derived path based on target OS.""" + artifactPath: String +} + """Output returned when registering a new builder.""" type RegisterBuilderOutput { """The created builder entity.""" builder: Builder! - """mTLS certificate in base64 encoding for the builder to authenticate.""" + """mTLS certificate PEM bundle for the builder to authenticate.""" mtlsCert: String! """YAML-formatted configuration for the builder.""" diff --git a/tavern/internal/graphql/gqlgen.yml b/tavern/internal/graphql/gqlgen.yml index 2c0f1970f..513417e3f 100644 --- a/tavern/internal/graphql/gqlgen.yml +++ b/tavern/internal/graphql/gqlgen.yml @@ -63,3 +63,6 @@ models: Status: model: - realm.pub/tavern/internal/c2/epb.Process_Status + BuildTaskTargetFormat: + model: + - realm.pub/tavern/internal/builder/builderpb.TargetFormat diff --git a/tavern/internal/graphql/models/gqlgen_models.go b/tavern/internal/graphql/models/gqlgen_models.go index b8bffa6ce..cbadd0298 100644 --- a/tavern/internal/graphql/models/gqlgen_models.go +++ b/tavern/internal/graphql/models/gqlgen_models.go @@ -9,6 +9,7 @@ import ( "strconv" "time" + "realm.pub/tavern/internal/builder/builderpb" "realm.pub/tavern/internal/c2/c2pb" "realm.pub/tavern/internal/ent" ) @@ -30,6 +31,26 @@ type ClaimTasksInput struct { AgentIdentifier string `json:"agentIdentifier"` } +// Input for creating a new build task. +type CreateBuildTaskInput struct { + // The target operating system for the build. + TargetOs c2pb.Host_Platform `json:"targetOS"` + // The output format for the build. Defaults to BIN. + TargetFormat *builderpb.TargetFormat `json:"targetFormat,omitempty"` + // Docker container image name to use for the build. Defaults to spellshift/devcontainer:main. + BuildImage *string `json:"buildImage,omitempty"` + // The callback URI for the IMIX agent to connect to. Defaults to http://127.0.0.1:8000. + CallbackURI *string `json:"callbackURI,omitempty"` + // The callback interval in seconds for the IMIX agent. + Interval *int `json:"interval,omitempty"` + // The transport type for the IMIX agent. Defaults to TRANSPORT_GRPC. + TransportType *c2pb.Transport_Type `json:"transportType,omitempty"` + // Extra transport configuration for the IMIX agent. + Extra *string `json:"extra,omitempty"` + // Path inside the build container to extract the artifact from. Defaults to the derived path based on target OS. + ArtifactPath *string `json:"artifactPath,omitempty"` +} + type ImportRepositoryInput struct { // Optionally, specify directories to include. // Only tomes that have a main.eldritch in one of these directory prefixes will be included. @@ -40,7 +61,7 @@ type ImportRepositoryInput struct { type RegisterBuilderOutput struct { // The created builder entity. Builder *ent.Builder `json:"builder"` - // mTLS certificate in base64 encoding for the builder to authenticate. + // mTLS certificate PEM bundle for the builder to authenticate. MtlsCert string `json:"mtlsCert"` // YAML-formatted configuration for the builder. Config string `json:"config"` diff --git a/tavern/internal/graphql/mutation.resolvers.go b/tavern/internal/graphql/mutation.resolvers.go index 058b06a88..6e17e4463 100644 --- a/tavern/internal/graphql/mutation.resolvers.go +++ b/tavern/internal/graphql/mutation.resolvers.go @@ -8,6 +8,7 @@ package graphql import ( "context" "fmt" + "math/rand" "strings" "time" @@ -58,6 +59,9 @@ func (r *mutationResolver) DropAllData(ctx context.Context) (bool, error) { if _, err := client.Tag.Delete().Exec(ctx); err != nil { return false, rollback(tx, fmt.Errorf("failed to delete tags: %w", err)) } + if _, err := client.BuildTask.Delete().Exec(ctx); err != nil { + return false, rollback(tx, fmt.Errorf("failed to delete build tasks: %w", err)) + } if _, err := client.Builder.Delete().Exec(ctx); err != nil { return false, rollback(tx, fmt.Errorf("failed to delete builders: %w", err)) } @@ -335,6 +339,106 @@ func (r *mutationResolver) RegisterBuilder(ctx context.Context, input ent.Create }, nil } +// DeleteBuilder is the resolver for the deleteBuilder field. +func (r *mutationResolver) DeleteBuilder(ctx context.Context, builderID int) (int, error) { + if err := r.client.Builder.DeleteOneID(builderID).Exec(ctx); err != nil { + return 0, err + } + return builderID, nil +} + +// CreateBuildTask is the resolver for the createBuildTask field. +func (r *mutationResolver) CreateBuildTask(ctx context.Context, input models.CreateBuildTaskInput) (*ent.BuildTask, error) { + // 1. Resolve defaults for optional fields + targetFormat := builder.DefaultTargetFormat + if input.TargetFormat != nil { + targetFormat = *input.TargetFormat + } + + buildImage := builder.DefaultBuildImage + if input.BuildImage != nil { + buildImage = *input.BuildImage + } + + interval := builder.DefaultInterval + if input.Interval != nil { + interval = *input.Interval + } + + callbackURI := builder.DefaultCallbackURI + if input.CallbackURI != nil { + callbackURI = *input.CallbackURI + } + + transportType := builder.DefaultTransportType + if input.TransportType != nil { + transportType = *input.TransportType + } + + artifactPath := builder.DeriveArtifactPath(input.TargetOs) + if input.ArtifactPath != nil { + artifactPath = *input.ArtifactPath + } + + // 2. Validate target format for the given OS + if err := builder.ValidateTargetFormat(input.TargetOs, targetFormat); err != nil { + return nil, err + } + + // 3. Derive the build script from configuration + buildScript, err := builder.GenerateBuildScript(input.TargetOs, targetFormat) + if err != nil { + return nil, fmt.Errorf("failed to generate build script: %w", err) + } + + // 4. Query all builders + allBuilders, err := r.client.Builder.Query().All(ctx) + if err != nil { + return nil, fmt.Errorf("failed to query builders: %w", err) + } + + // 5. Filter builders that support the target OS + var candidates []*ent.Builder + for _, b := range allBuilders { + for _, target := range b.SupportedTargets { + if target == input.TargetOs { + candidates = append(candidates, b) + break + } + } + } + + if len(candidates) == 0 { + return nil, fmt.Errorf("no builder available that supports target %s", input.TargetOs.String()) + } + + // 6. Randomly select one builder + selected := candidates[rand.Intn(len(candidates))] + + // 7. Create the build task + create := r.client.BuildTask.Create(). + SetTargetOs(input.TargetOs). + SetTargetFormat(targetFormat). + SetBuildImage(buildImage). + SetBuildScript(buildScript). + SetCallbackURI(callbackURI). + SetInterval(interval). + SetTransportType(transportType). + SetArtifactPath(artifactPath). + SetBuilder(selected) + + if input.Extra != nil { + create = create.SetExtra(*input.Extra) + } + + bt, err := create.Save(ctx) + if err != nil { + return nil, fmt.Errorf("failed to create build task: %w", err) + } + + return bt, nil +} + // Mutation returns generated.MutationResolver implementation. func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} } diff --git a/tavern/internal/graphql/query.resolvers.go b/tavern/internal/graphql/query.resolvers.go index 87870032e..b14f1724e 100644 --- a/tavern/internal/graphql/query.resolvers.go +++ b/tavern/internal/graphql/query.resolvers.go @@ -190,6 +190,38 @@ func (r *queryResolver) Shells(ctx context.Context, after *entgql.Cursor[int], f return query.Paginate(ctx, after, first, before, last, ent.WithShellOrder(orderBy)) } +// BuildTasks is the resolver for the buildTasks field. +func (r *queryResolver) BuildTasks(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.BuildTaskOrder, where *ent.BuildTaskWhereInput) (*ent.BuildTaskConnection, error) { + query, err := r.client.BuildTask.Query().CollectFields(ctx) + if err != nil { + return nil, fmt.Errorf("failed to collect fields: %w", err) + } + if where != nil { + query, err := where.Filter(query) + if err != nil { + return nil, fmt.Errorf("failed to apply filter: %w", err) + } + return query.Paginate(ctx, after, first, before, last, ent.WithBuildTaskOrder(orderBy)) + } + return query.Paginate(ctx, after, first, before, last, ent.WithBuildTaskOrder(orderBy)) +} + +// Builders is the resolver for the builders field. +func (r *queryResolver) Builders(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.BuilderOrder, where *ent.BuilderWhereInput) (*ent.BuilderConnection, error) { + query, err := r.client.Builder.Query().CollectFields(ctx) + if err != nil { + return nil, fmt.Errorf("failed to collect fields: %w", err) + } + if where != nil { + query, err := where.Filter(query) + if err != nil { + return nil, fmt.Errorf("failed to apply filter: %w", err) + } + return query.Paginate(ctx, after, first, before, last, ent.WithBuilderOrder(orderBy)) + } + return query.Paginate(ctx, after, first, before, last, ent.WithBuilderOrder(orderBy)) +} + // Me is the resolver for the me field. func (r *queryResolver) Me(ctx context.Context) (*ent.User, error) { if authUser := auth.UserFromContext(ctx); authUser != nil { diff --git a/tavern/internal/graphql/resolver.go b/tavern/internal/graphql/resolver.go index 470034358..f54907664 100644 --- a/tavern/internal/graphql/resolver.go +++ b/tavern/internal/graphql/resolver.go @@ -30,7 +30,6 @@ type Resolver struct { builderCAKey ed25519.PrivateKey } - func WithBuilderCAKey(builderCAKey ed25519.PrivateKey) Option { return Option(func(resolver *Resolver) { resolver.builderCAKey = builderCAKey @@ -44,7 +43,6 @@ func WithBuilderCA(builderCA *x509.Certificate) Option { } // NewSchema creates a graphql executable schema. -// builderCA *x509.Certificate, builderCAKey ed25519.PrivateKey func NewSchema(client *ent.Client, importer RepoImporter, options ...func(*Resolver)) graphql.ExecutableSchema { resolver := &Resolver{ client: client, diff --git a/tavern/internal/graphql/schema.graphql b/tavern/internal/graphql/schema.graphql index 3970a63e4..6ba84c3a1 100644 --- a/tavern/internal/graphql/schema.graphql +++ b/tavern/internal/graphql/schema.graphql @@ -588,6 +588,437 @@ input BeaconWhereInput { hasShells: Boolean hasShellsWith: [ShellWhereInput!] } +type BuildTask implements Node { + id: ID! + """ + Timestamp of when this ent was created + """ + createdAt: Time! + """ + Timestamp of when this ent was last updated + """ + lastModifiedAt: Time! + """ + The target operating system platform for this build. + """ + targetOs: HostPlatform! + """ + The output format for the build (BIN, CDYLIB, WINDOWS_SERVICE). + """ + targetFormat: BuildTaskTargetFormat! + """ + Docker container image name to use for the build. + """ + buildImage: String! + """ + The derived script to execute inside the build container. + """ + buildScript: String! + """ + The callback URI for the IMIX agent to connect to. + """ + callbackURI: String! + """ + The callback interval in seconds for the IMIX agent. + """ + interval: Int! + """ + The transport type for the IMIX agent. + """ + transportType: BeaconTransport_Type! + """ + Extra transport configuration for the IMIX agent. + """ + extra: String + """ + Timestamp of when a builder claimed this task, null if unclaimed. + """ + claimedAt: Time + """ + Timestamp of when the build execution started, null if not yet started. + """ + startedAt: Time + """ + Timestamp of when the build finished, null if not yet finished. + """ + finishedAt: Time + """ + Output from the build execution. + """ + output: String + """ + The size of the output in bytes + """ + outputSize: Int! + """ + Error message if the build failed. + """ + error: String + """ + The size of the error in bytes + """ + errorSize: Int! + """ + Exit code from the build container process. Null if the build has not finished. + """ + exitCode: Int + """ + Path inside the container where the build artifact is located. Derived from target_os if not set. + """ + artifactPath: String + """ + The builder assigned to execute this build task. + """ + builder: Builder! + """ + The compiled artifact produced by this build task, stored as an Asset. + """ + artifact: Asset +} +""" +A connection to a list of items. +""" +type BuildTaskConnection { + """ + A list of edges. + """ + edges: [BuildTaskEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type BuildTaskEdge { + """ + The item at the end of the edge. + """ + node: BuildTask + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +Ordering options for BuildTask connections +""" +input BuildTaskOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order BuildTasks. + """ + field: BuildTaskOrderField! +} +""" +Properties by which BuildTask connections can be ordered. +""" +enum BuildTaskOrderField { + CREATED_AT + LAST_MODIFIED_AT + TARGET_OS + CLAIMED_AT + STARTED_AT + FINISHED_AT + OUTPUT_SIZE + ERROR_SIZE + EXIT_CODE +} +""" +BuildTaskTargetFormat is enum for the field target_format +""" +enum BuildTaskTargetFormat @goModel(model: "realm.pub/tavern/internal/builder/builderpb.TargetFormat") { + TARGET_FORMAT_BIN + TARGET_FORMAT_CDYLIB + TARGET_FORMAT_UNSPECIFIED + TARGET_FORMAT_WINDOWS_SERVICE +} +""" +BuildTaskWhereInput is used for filtering BuildTask objects. +Input was generated by ent. +""" +input BuildTaskWhereInput { + not: BuildTaskWhereInput + and: [BuildTaskWhereInput!] + or: [BuildTaskWhereInput!] + """ + id field predicates + """ + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """ + created_at field predicates + """ + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """ + last_modified_at field predicates + """ + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """ + target_os field predicates + """ + targetOs: HostPlatform + targetOsNEQ: HostPlatform + targetOsIn: [HostPlatform!] + targetOsNotIn: [HostPlatform!] + """ + target_format field predicates + """ + targetFormat: BuildTaskTargetFormat + targetFormatNEQ: BuildTaskTargetFormat + targetFormatIn: [BuildTaskTargetFormat!] + targetFormatNotIn: [BuildTaskTargetFormat!] + """ + build_image field predicates + """ + buildImage: String + buildImageNEQ: String + buildImageIn: [String!] + buildImageNotIn: [String!] + buildImageGT: String + buildImageGTE: String + buildImageLT: String + buildImageLTE: String + buildImageContains: String + buildImageHasPrefix: String + buildImageHasSuffix: String + buildImageEqualFold: String + buildImageContainsFold: String + """ + build_script field predicates + """ + buildScript: String + buildScriptNEQ: String + buildScriptIn: [String!] + buildScriptNotIn: [String!] + buildScriptGT: String + buildScriptGTE: String + buildScriptLT: String + buildScriptLTE: String + buildScriptContains: String + buildScriptHasPrefix: String + buildScriptHasSuffix: String + buildScriptEqualFold: String + buildScriptContainsFold: String + """ + callback_uri field predicates + """ + callbackURI: String + callbackURINEQ: String + callbackURIIn: [String!] + callbackURINotIn: [String!] + callbackURIGT: String + callbackURIGTE: String + callbackURILT: String + callbackURILTE: String + callbackURIContains: String + callbackURIHasPrefix: String + callbackURIHasSuffix: String + callbackURIEqualFold: String + callbackURIContainsFold: String + """ + interval field predicates + """ + interval: Int + intervalNEQ: Int + intervalIn: [Int!] + intervalNotIn: [Int!] + intervalGT: Int + intervalGTE: Int + intervalLT: Int + intervalLTE: Int + """ + transport_type field predicates + """ + transportType: BeaconTransport_Type + transportTypeNEQ: BeaconTransport_Type + transportTypeIn: [BeaconTransport_Type!] + transportTypeNotIn: [BeaconTransport_Type!] + """ + extra field predicates + """ + extra: String + extraNEQ: String + extraIn: [String!] + extraNotIn: [String!] + extraGT: String + extraGTE: String + extraLT: String + extraLTE: String + extraContains: String + extraHasPrefix: String + extraHasSuffix: String + extraIsNil: Boolean + extraNotNil: Boolean + extraEqualFold: String + extraContainsFold: String + """ + claimed_at field predicates + """ + claimedAt: Time + claimedAtNEQ: Time + claimedAtIn: [Time!] + claimedAtNotIn: [Time!] + claimedAtGT: Time + claimedAtGTE: Time + claimedAtLT: Time + claimedAtLTE: Time + claimedAtIsNil: Boolean + claimedAtNotNil: Boolean + """ + started_at field predicates + """ + startedAt: Time + startedAtNEQ: Time + startedAtIn: [Time!] + startedAtNotIn: [Time!] + startedAtGT: Time + startedAtGTE: Time + startedAtLT: Time + startedAtLTE: Time + startedAtIsNil: Boolean + startedAtNotNil: Boolean + """ + finished_at field predicates + """ + finishedAt: Time + finishedAtNEQ: Time + finishedAtIn: [Time!] + finishedAtNotIn: [Time!] + finishedAtGT: Time + finishedAtGTE: Time + finishedAtLT: Time + finishedAtLTE: Time + finishedAtIsNil: Boolean + finishedAtNotNil: Boolean + """ + output field predicates + """ + output: String + outputNEQ: String + outputIn: [String!] + outputNotIn: [String!] + outputGT: String + outputGTE: String + outputLT: String + outputLTE: String + outputContains: String + outputHasPrefix: String + outputHasSuffix: String + outputIsNil: Boolean + outputNotNil: Boolean + outputEqualFold: String + outputContainsFold: String + """ + output_size field predicates + """ + outputSize: Int + outputSizeNEQ: Int + outputSizeIn: [Int!] + outputSizeNotIn: [Int!] + outputSizeGT: Int + outputSizeGTE: Int + outputSizeLT: Int + outputSizeLTE: Int + """ + error field predicates + """ + error: String + errorNEQ: String + errorIn: [String!] + errorNotIn: [String!] + errorGT: String + errorGTE: String + errorLT: String + errorLTE: String + errorContains: String + errorHasPrefix: String + errorHasSuffix: String + errorIsNil: Boolean + errorNotNil: Boolean + errorEqualFold: String + errorContainsFold: String + """ + error_size field predicates + """ + errorSize: Int + errorSizeNEQ: Int + errorSizeIn: [Int!] + errorSizeNotIn: [Int!] + errorSizeGT: Int + errorSizeGTE: Int + errorSizeLT: Int + errorSizeLTE: Int + """ + exit_code field predicates + """ + exitCode: Int + exitCodeNEQ: Int + exitCodeIn: [Int!] + exitCodeNotIn: [Int!] + exitCodeGT: Int + exitCodeGTE: Int + exitCodeLT: Int + exitCodeLTE: Int + exitCodeIsNil: Boolean + exitCodeNotNil: Boolean + """ + artifact_path field predicates + """ + artifactPath: String + artifactPathNEQ: String + artifactPathIn: [String!] + artifactPathNotIn: [String!] + artifactPathGT: String + artifactPathGTE: String + artifactPathLT: String + artifactPathLTE: String + artifactPathContains: String + artifactPathHasPrefix: String + artifactPathHasSuffix: String + artifactPathIsNil: Boolean + artifactPathNotNil: Boolean + artifactPathEqualFold: String + artifactPathContainsFold: String + """ + builder edge predicates + """ + hasBuilder: Boolean + hasBuilderWith: [BuilderWhereInput!] + """ + artifact edge predicates + """ + hasArtifact: Boolean + hasArtifactWith: [AssetWhereInput!] +} type Builder implements Node { id: ID! """ @@ -610,6 +1041,41 @@ type Builder implements Node { The server address that the builder should connect to. """ upstream: String! + """ + Timestamp of the builder's last ClaimBuildTasks call. Null if never seen. + """ + lastSeenAt: Time + buildTasks( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for BuildTasks returned from the connection. + """ + orderBy: [BuildTaskOrder!] + + """ + Filtering options for BuildTasks returned from the connection. + """ + where: BuildTaskWhereInput + ): BuildTaskConnection! } """ A connection to a list of items. @@ -660,6 +1126,7 @@ Properties by which Builder connections can be ordered. enum BuilderOrderField { CREATED_AT LAST_MODIFIED_AT + LAST_SEEN_AT } """ BuilderWhereInput is used for filtering Builder objects. @@ -734,6 +1201,24 @@ input BuilderWhereInput { upstreamHasSuffix: String upstreamEqualFold: String upstreamContainsFold: String + """ + last_seen_at field predicates + """ + lastSeenAt: Time + lastSeenAtNEQ: Time + lastSeenAtIn: [Time!] + lastSeenAtNotIn: [Time!] + lastSeenAtGT: Time + lastSeenAtGTE: Time + lastSeenAtLT: Time + lastSeenAtLTE: Time + lastSeenAtIsNil: Boolean + lastSeenAtNotNil: Boolean + """ + build_tasks edge predicates + """ + hasBuildTasks: Boolean + hasBuildTasksWith: [BuildTaskWhereInput!] } """ CreateBuilderInput is used for create Builder object. @@ -748,6 +1233,7 @@ input CreateBuilderInput { The server address that the builder should connect to. """ upstream: String! + buildTaskIDs: [ID!] } """ CreateHostCredentialInput is used for create HostCredential object. @@ -1560,7 +2046,7 @@ enum HostOrderField { NEXT_SEEN_AT } """ -HostPlatform is enum for the field platform +HostPlatform is enum for the field target_os """ enum HostPlatform @goModel(model: "realm.pub/tavern/internal/c2/c2pb.Host_Platform") { PLATFORM_BSD @@ -4462,12 +4948,39 @@ input ImportRepositoryInput { includeDirs: [String!] } +"""Input for creating a new build task.""" +input CreateBuildTaskInput { + """The target operating system for the build.""" + targetOS: HostPlatform! + + """The output format for the build. Defaults to BIN.""" + targetFormat: BuildTaskTargetFormat + + """Docker container image name to use for the build. Defaults to spellshift/devcontainer:main.""" + buildImage: String + + """The callback URI for the IMIX agent to connect to. Defaults to http://127.0.0.1:8000.""" + callbackURI: String + + """The callback interval in seconds for the IMIX agent.""" + interval: Int = 5 + + """The transport type for the IMIX agent. Defaults to TRANSPORT_GRPC.""" + transportType: BeaconTransport_Type + + """Extra transport configuration for the IMIX agent.""" + extra: String + + """Path inside the build container to extract the artifact from. Defaults to the derived path based on target OS.""" + artifactPath: String +} + """Output returned when registering a new builder.""" type RegisterBuilderOutput { """The created builder entity.""" builder: Builder! - """mTLS certificate in base64 encoding for the builder to authenticate.""" + """mTLS certificate PEM bundle for the builder to authenticate.""" mtlsCert: String! """YAML-formatted configuration for the builder.""" @@ -4534,6 +5047,12 @@ type Mutation { # Builder ### registerBuilder(input: CreateBuilderInput!): RegisterBuilderOutput! @requireRole(role: ADMIN) + deleteBuilder(builderID: ID!): ID! @requireRole(role: ADMIN) + + ### + # BuildTask + ### + createBuildTask(input: CreateBuildTaskInput!): BuildTask! @requireRole(role: ADMIN) } extend type Query { assets( @@ -4745,6 +5264,44 @@ extend type Query { """Filtering options for Shells returned from the connection.""" where: ShellWhereInput): ShellConnection! @requireRole(role: USER) + buildTasks( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for BuildTasks returned from the connection.""" + orderBy: [BuildTaskOrder!] + + """Filtering options for BuildTasks returned from the connection.""" + where: BuildTaskWhereInput + ): BuildTaskConnection! @requireRole(role: USER) + builders( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for Builders returned from the connection.""" + orderBy: [BuilderOrder!] + + """Filtering options for Builders returned from the connection.""" + where: BuilderWhereInput + ): BuilderConnection! @requireRole(role: ADMIN) me: User! } scalar Time diff --git a/tavern/internal/graphql/schema/ent.graphql b/tavern/internal/graphql/schema/ent.graphql index 6d4cf986d..eb63f0d73 100644 --- a/tavern/internal/graphql/schema/ent.graphql +++ b/tavern/internal/graphql/schema/ent.graphql @@ -583,6 +583,437 @@ input BeaconWhereInput { hasShells: Boolean hasShellsWith: [ShellWhereInput!] } +type BuildTask implements Node { + id: ID! + """ + Timestamp of when this ent was created + """ + createdAt: Time! + """ + Timestamp of when this ent was last updated + """ + lastModifiedAt: Time! + """ + The target operating system platform for this build. + """ + targetOs: HostPlatform! + """ + The output format for the build (BIN, CDYLIB, WINDOWS_SERVICE). + """ + targetFormat: BuildTaskTargetFormat! + """ + Docker container image name to use for the build. + """ + buildImage: String! + """ + The derived script to execute inside the build container. + """ + buildScript: String! + """ + The callback URI for the IMIX agent to connect to. + """ + callbackURI: String! + """ + The callback interval in seconds for the IMIX agent. + """ + interval: Int! + """ + The transport type for the IMIX agent. + """ + transportType: BeaconTransport_Type! + """ + Extra transport configuration for the IMIX agent. + """ + extra: String + """ + Timestamp of when a builder claimed this task, null if unclaimed. + """ + claimedAt: Time + """ + Timestamp of when the build execution started, null if not yet started. + """ + startedAt: Time + """ + Timestamp of when the build finished, null if not yet finished. + """ + finishedAt: Time + """ + Output from the build execution. + """ + output: String + """ + The size of the output in bytes + """ + outputSize: Int! + """ + Error message if the build failed. + """ + error: String + """ + The size of the error in bytes + """ + errorSize: Int! + """ + Exit code from the build container process. Null if the build has not finished. + """ + exitCode: Int + """ + Path inside the container where the build artifact is located. Derived from target_os if not set. + """ + artifactPath: String + """ + The builder assigned to execute this build task. + """ + builder: Builder! + """ + The compiled artifact produced by this build task, stored as an Asset. + """ + artifact: Asset +} +""" +A connection to a list of items. +""" +type BuildTaskConnection { + """ + A list of edges. + """ + edges: [BuildTaskEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type BuildTaskEdge { + """ + The item at the end of the edge. + """ + node: BuildTask + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +Ordering options for BuildTask connections +""" +input BuildTaskOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order BuildTasks. + """ + field: BuildTaskOrderField! +} +""" +Properties by which BuildTask connections can be ordered. +""" +enum BuildTaskOrderField { + CREATED_AT + LAST_MODIFIED_AT + TARGET_OS + CLAIMED_AT + STARTED_AT + FINISHED_AT + OUTPUT_SIZE + ERROR_SIZE + EXIT_CODE +} +""" +BuildTaskTargetFormat is enum for the field target_format +""" +enum BuildTaskTargetFormat @goModel(model: "realm.pub/tavern/internal/builder/builderpb.TargetFormat") { + TARGET_FORMAT_BIN + TARGET_FORMAT_CDYLIB + TARGET_FORMAT_UNSPECIFIED + TARGET_FORMAT_WINDOWS_SERVICE +} +""" +BuildTaskWhereInput is used for filtering BuildTask objects. +Input was generated by ent. +""" +input BuildTaskWhereInput { + not: BuildTaskWhereInput + and: [BuildTaskWhereInput!] + or: [BuildTaskWhereInput!] + """ + id field predicates + """ + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """ + created_at field predicates + """ + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """ + last_modified_at field predicates + """ + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """ + target_os field predicates + """ + targetOs: HostPlatform + targetOsNEQ: HostPlatform + targetOsIn: [HostPlatform!] + targetOsNotIn: [HostPlatform!] + """ + target_format field predicates + """ + targetFormat: BuildTaskTargetFormat + targetFormatNEQ: BuildTaskTargetFormat + targetFormatIn: [BuildTaskTargetFormat!] + targetFormatNotIn: [BuildTaskTargetFormat!] + """ + build_image field predicates + """ + buildImage: String + buildImageNEQ: String + buildImageIn: [String!] + buildImageNotIn: [String!] + buildImageGT: String + buildImageGTE: String + buildImageLT: String + buildImageLTE: String + buildImageContains: String + buildImageHasPrefix: String + buildImageHasSuffix: String + buildImageEqualFold: String + buildImageContainsFold: String + """ + build_script field predicates + """ + buildScript: String + buildScriptNEQ: String + buildScriptIn: [String!] + buildScriptNotIn: [String!] + buildScriptGT: String + buildScriptGTE: String + buildScriptLT: String + buildScriptLTE: String + buildScriptContains: String + buildScriptHasPrefix: String + buildScriptHasSuffix: String + buildScriptEqualFold: String + buildScriptContainsFold: String + """ + callback_uri field predicates + """ + callbackURI: String + callbackURINEQ: String + callbackURIIn: [String!] + callbackURINotIn: [String!] + callbackURIGT: String + callbackURIGTE: String + callbackURILT: String + callbackURILTE: String + callbackURIContains: String + callbackURIHasPrefix: String + callbackURIHasSuffix: String + callbackURIEqualFold: String + callbackURIContainsFold: String + """ + interval field predicates + """ + interval: Int + intervalNEQ: Int + intervalIn: [Int!] + intervalNotIn: [Int!] + intervalGT: Int + intervalGTE: Int + intervalLT: Int + intervalLTE: Int + """ + transport_type field predicates + """ + transportType: BeaconTransport_Type + transportTypeNEQ: BeaconTransport_Type + transportTypeIn: [BeaconTransport_Type!] + transportTypeNotIn: [BeaconTransport_Type!] + """ + extra field predicates + """ + extra: String + extraNEQ: String + extraIn: [String!] + extraNotIn: [String!] + extraGT: String + extraGTE: String + extraLT: String + extraLTE: String + extraContains: String + extraHasPrefix: String + extraHasSuffix: String + extraIsNil: Boolean + extraNotNil: Boolean + extraEqualFold: String + extraContainsFold: String + """ + claimed_at field predicates + """ + claimedAt: Time + claimedAtNEQ: Time + claimedAtIn: [Time!] + claimedAtNotIn: [Time!] + claimedAtGT: Time + claimedAtGTE: Time + claimedAtLT: Time + claimedAtLTE: Time + claimedAtIsNil: Boolean + claimedAtNotNil: Boolean + """ + started_at field predicates + """ + startedAt: Time + startedAtNEQ: Time + startedAtIn: [Time!] + startedAtNotIn: [Time!] + startedAtGT: Time + startedAtGTE: Time + startedAtLT: Time + startedAtLTE: Time + startedAtIsNil: Boolean + startedAtNotNil: Boolean + """ + finished_at field predicates + """ + finishedAt: Time + finishedAtNEQ: Time + finishedAtIn: [Time!] + finishedAtNotIn: [Time!] + finishedAtGT: Time + finishedAtGTE: Time + finishedAtLT: Time + finishedAtLTE: Time + finishedAtIsNil: Boolean + finishedAtNotNil: Boolean + """ + output field predicates + """ + output: String + outputNEQ: String + outputIn: [String!] + outputNotIn: [String!] + outputGT: String + outputGTE: String + outputLT: String + outputLTE: String + outputContains: String + outputHasPrefix: String + outputHasSuffix: String + outputIsNil: Boolean + outputNotNil: Boolean + outputEqualFold: String + outputContainsFold: String + """ + output_size field predicates + """ + outputSize: Int + outputSizeNEQ: Int + outputSizeIn: [Int!] + outputSizeNotIn: [Int!] + outputSizeGT: Int + outputSizeGTE: Int + outputSizeLT: Int + outputSizeLTE: Int + """ + error field predicates + """ + error: String + errorNEQ: String + errorIn: [String!] + errorNotIn: [String!] + errorGT: String + errorGTE: String + errorLT: String + errorLTE: String + errorContains: String + errorHasPrefix: String + errorHasSuffix: String + errorIsNil: Boolean + errorNotNil: Boolean + errorEqualFold: String + errorContainsFold: String + """ + error_size field predicates + """ + errorSize: Int + errorSizeNEQ: Int + errorSizeIn: [Int!] + errorSizeNotIn: [Int!] + errorSizeGT: Int + errorSizeGTE: Int + errorSizeLT: Int + errorSizeLTE: Int + """ + exit_code field predicates + """ + exitCode: Int + exitCodeNEQ: Int + exitCodeIn: [Int!] + exitCodeNotIn: [Int!] + exitCodeGT: Int + exitCodeGTE: Int + exitCodeLT: Int + exitCodeLTE: Int + exitCodeIsNil: Boolean + exitCodeNotNil: Boolean + """ + artifact_path field predicates + """ + artifactPath: String + artifactPathNEQ: String + artifactPathIn: [String!] + artifactPathNotIn: [String!] + artifactPathGT: String + artifactPathGTE: String + artifactPathLT: String + artifactPathLTE: String + artifactPathContains: String + artifactPathHasPrefix: String + artifactPathHasSuffix: String + artifactPathIsNil: Boolean + artifactPathNotNil: Boolean + artifactPathEqualFold: String + artifactPathContainsFold: String + """ + builder edge predicates + """ + hasBuilder: Boolean + hasBuilderWith: [BuilderWhereInput!] + """ + artifact edge predicates + """ + hasArtifact: Boolean + hasArtifactWith: [AssetWhereInput!] +} type Builder implements Node { id: ID! """ @@ -605,6 +1036,41 @@ type Builder implements Node { The server address that the builder should connect to. """ upstream: String! + """ + Timestamp of the builder's last ClaimBuildTasks call. Null if never seen. + """ + lastSeenAt: Time + buildTasks( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for BuildTasks returned from the connection. + """ + orderBy: [BuildTaskOrder!] + + """ + Filtering options for BuildTasks returned from the connection. + """ + where: BuildTaskWhereInput + ): BuildTaskConnection! } """ A connection to a list of items. @@ -655,6 +1121,7 @@ Properties by which Builder connections can be ordered. enum BuilderOrderField { CREATED_AT LAST_MODIFIED_AT + LAST_SEEN_AT } """ BuilderWhereInput is used for filtering Builder objects. @@ -729,6 +1196,24 @@ input BuilderWhereInput { upstreamHasSuffix: String upstreamEqualFold: String upstreamContainsFold: String + """ + last_seen_at field predicates + """ + lastSeenAt: Time + lastSeenAtNEQ: Time + lastSeenAtIn: [Time!] + lastSeenAtNotIn: [Time!] + lastSeenAtGT: Time + lastSeenAtGTE: Time + lastSeenAtLT: Time + lastSeenAtLTE: Time + lastSeenAtIsNil: Boolean + lastSeenAtNotNil: Boolean + """ + build_tasks edge predicates + """ + hasBuildTasks: Boolean + hasBuildTasksWith: [BuildTaskWhereInput!] } """ CreateBuilderInput is used for create Builder object. @@ -743,6 +1228,7 @@ input CreateBuilderInput { The server address that the builder should connect to. """ upstream: String! + buildTaskIDs: [ID!] } """ CreateHostCredentialInput is used for create HostCredential object. @@ -1555,7 +2041,7 @@ enum HostOrderField { NEXT_SEEN_AT } """ -HostPlatform is enum for the field platform +HostPlatform is enum for the field target_os """ enum HostPlatform @goModel(model: "realm.pub/tavern/internal/c2/c2pb.Host_Platform") { PLATFORM_BSD diff --git a/tavern/internal/graphql/schema/inputs.graphql b/tavern/internal/graphql/schema/inputs.graphql index b8f8234b9..8fa2b987f 100644 --- a/tavern/internal/graphql/schema/inputs.graphql +++ b/tavern/internal/graphql/schema/inputs.graphql @@ -48,6 +48,33 @@ input ImportRepositoryInput { includeDirs: [String!] } +"""Input for creating a new build task.""" +input CreateBuildTaskInput { + """The target operating system for the build.""" + targetOS: HostPlatform! + + """The output format for the build. Defaults to BIN.""" + targetFormat: BuildTaskTargetFormat + + """Docker container image name to use for the build. Defaults to spellshift/devcontainer:main.""" + buildImage: String + + """The callback URI for the IMIX agent to connect to. Defaults to http://127.0.0.1:8000.""" + callbackURI: String + + """The callback interval in seconds for the IMIX agent.""" + interval: Int = 5 + + """The transport type for the IMIX agent. Defaults to TRANSPORT_GRPC.""" + transportType: BeaconTransport_Type + + """Extra transport configuration for the IMIX agent.""" + extra: String + + """Path inside the build container to extract the artifact from. Defaults to the derived path based on target OS.""" + artifactPath: String +} + """Output returned when registering a new builder.""" type RegisterBuilderOutput { """The created builder entity.""" diff --git a/tavern/internal/graphql/schema/mutation.graphql b/tavern/internal/graphql/schema/mutation.graphql index e2de39ca3..08b2851aa 100644 --- a/tavern/internal/graphql/schema/mutation.graphql +++ b/tavern/internal/graphql/schema/mutation.graphql @@ -59,4 +59,10 @@ type Mutation { # Builder ### registerBuilder(input: CreateBuilderInput!): RegisterBuilderOutput! @requireRole(role: ADMIN) + deleteBuilder(builderID: ID!): ID! @requireRole(role: ADMIN) + + ### + # BuildTask + ### + createBuildTask(input: CreateBuildTaskInput!): BuildTask! @requireRole(role: ADMIN) } diff --git a/tavern/internal/graphql/schema/query.graphql b/tavern/internal/graphql/schema/query.graphql index 17c2215b7..baff5adca 100644 --- a/tavern/internal/graphql/schema/query.graphql +++ b/tavern/internal/graphql/schema/query.graphql @@ -208,5 +208,43 @@ extend type Query { """Filtering options for Shells returned from the connection.""" where: ShellWhereInput): ShellConnection! @requireRole(role: USER) + buildTasks( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for BuildTasks returned from the connection.""" + orderBy: [BuildTaskOrder!] + + """Filtering options for BuildTasks returned from the connection.""" + where: BuildTaskWhereInput + ): BuildTaskConnection! @requireRole(role: USER) + builders( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for Builders returned from the connection.""" + orderBy: [BuilderOrder!] + + """Filtering options for Builders returned from the connection.""" + where: BuilderWhereInput + ): BuilderConnection! @requireRole(role: ADMIN) me: User! } diff --git a/tavern/internal/www/schema.graphql b/tavern/internal/www/schema.graphql index 3970a63e4..6ba84c3a1 100644 --- a/tavern/internal/www/schema.graphql +++ b/tavern/internal/www/schema.graphql @@ -588,6 +588,437 @@ input BeaconWhereInput { hasShells: Boolean hasShellsWith: [ShellWhereInput!] } +type BuildTask implements Node { + id: ID! + """ + Timestamp of when this ent was created + """ + createdAt: Time! + """ + Timestamp of when this ent was last updated + """ + lastModifiedAt: Time! + """ + The target operating system platform for this build. + """ + targetOs: HostPlatform! + """ + The output format for the build (BIN, CDYLIB, WINDOWS_SERVICE). + """ + targetFormat: BuildTaskTargetFormat! + """ + Docker container image name to use for the build. + """ + buildImage: String! + """ + The derived script to execute inside the build container. + """ + buildScript: String! + """ + The callback URI for the IMIX agent to connect to. + """ + callbackURI: String! + """ + The callback interval in seconds for the IMIX agent. + """ + interval: Int! + """ + The transport type for the IMIX agent. + """ + transportType: BeaconTransport_Type! + """ + Extra transport configuration for the IMIX agent. + """ + extra: String + """ + Timestamp of when a builder claimed this task, null if unclaimed. + """ + claimedAt: Time + """ + Timestamp of when the build execution started, null if not yet started. + """ + startedAt: Time + """ + Timestamp of when the build finished, null if not yet finished. + """ + finishedAt: Time + """ + Output from the build execution. + """ + output: String + """ + The size of the output in bytes + """ + outputSize: Int! + """ + Error message if the build failed. + """ + error: String + """ + The size of the error in bytes + """ + errorSize: Int! + """ + Exit code from the build container process. Null if the build has not finished. + """ + exitCode: Int + """ + Path inside the container where the build artifact is located. Derived from target_os if not set. + """ + artifactPath: String + """ + The builder assigned to execute this build task. + """ + builder: Builder! + """ + The compiled artifact produced by this build task, stored as an Asset. + """ + artifact: Asset +} +""" +A connection to a list of items. +""" +type BuildTaskConnection { + """ + A list of edges. + """ + edges: [BuildTaskEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type BuildTaskEdge { + """ + The item at the end of the edge. + """ + node: BuildTask + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +Ordering options for BuildTask connections +""" +input BuildTaskOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order BuildTasks. + """ + field: BuildTaskOrderField! +} +""" +Properties by which BuildTask connections can be ordered. +""" +enum BuildTaskOrderField { + CREATED_AT + LAST_MODIFIED_AT + TARGET_OS + CLAIMED_AT + STARTED_AT + FINISHED_AT + OUTPUT_SIZE + ERROR_SIZE + EXIT_CODE +} +""" +BuildTaskTargetFormat is enum for the field target_format +""" +enum BuildTaskTargetFormat @goModel(model: "realm.pub/tavern/internal/builder/builderpb.TargetFormat") { + TARGET_FORMAT_BIN + TARGET_FORMAT_CDYLIB + TARGET_FORMAT_UNSPECIFIED + TARGET_FORMAT_WINDOWS_SERVICE +} +""" +BuildTaskWhereInput is used for filtering BuildTask objects. +Input was generated by ent. +""" +input BuildTaskWhereInput { + not: BuildTaskWhereInput + and: [BuildTaskWhereInput!] + or: [BuildTaskWhereInput!] + """ + id field predicates + """ + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """ + created_at field predicates + """ + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """ + last_modified_at field predicates + """ + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """ + target_os field predicates + """ + targetOs: HostPlatform + targetOsNEQ: HostPlatform + targetOsIn: [HostPlatform!] + targetOsNotIn: [HostPlatform!] + """ + target_format field predicates + """ + targetFormat: BuildTaskTargetFormat + targetFormatNEQ: BuildTaskTargetFormat + targetFormatIn: [BuildTaskTargetFormat!] + targetFormatNotIn: [BuildTaskTargetFormat!] + """ + build_image field predicates + """ + buildImage: String + buildImageNEQ: String + buildImageIn: [String!] + buildImageNotIn: [String!] + buildImageGT: String + buildImageGTE: String + buildImageLT: String + buildImageLTE: String + buildImageContains: String + buildImageHasPrefix: String + buildImageHasSuffix: String + buildImageEqualFold: String + buildImageContainsFold: String + """ + build_script field predicates + """ + buildScript: String + buildScriptNEQ: String + buildScriptIn: [String!] + buildScriptNotIn: [String!] + buildScriptGT: String + buildScriptGTE: String + buildScriptLT: String + buildScriptLTE: String + buildScriptContains: String + buildScriptHasPrefix: String + buildScriptHasSuffix: String + buildScriptEqualFold: String + buildScriptContainsFold: String + """ + callback_uri field predicates + """ + callbackURI: String + callbackURINEQ: String + callbackURIIn: [String!] + callbackURINotIn: [String!] + callbackURIGT: String + callbackURIGTE: String + callbackURILT: String + callbackURILTE: String + callbackURIContains: String + callbackURIHasPrefix: String + callbackURIHasSuffix: String + callbackURIEqualFold: String + callbackURIContainsFold: String + """ + interval field predicates + """ + interval: Int + intervalNEQ: Int + intervalIn: [Int!] + intervalNotIn: [Int!] + intervalGT: Int + intervalGTE: Int + intervalLT: Int + intervalLTE: Int + """ + transport_type field predicates + """ + transportType: BeaconTransport_Type + transportTypeNEQ: BeaconTransport_Type + transportTypeIn: [BeaconTransport_Type!] + transportTypeNotIn: [BeaconTransport_Type!] + """ + extra field predicates + """ + extra: String + extraNEQ: String + extraIn: [String!] + extraNotIn: [String!] + extraGT: String + extraGTE: String + extraLT: String + extraLTE: String + extraContains: String + extraHasPrefix: String + extraHasSuffix: String + extraIsNil: Boolean + extraNotNil: Boolean + extraEqualFold: String + extraContainsFold: String + """ + claimed_at field predicates + """ + claimedAt: Time + claimedAtNEQ: Time + claimedAtIn: [Time!] + claimedAtNotIn: [Time!] + claimedAtGT: Time + claimedAtGTE: Time + claimedAtLT: Time + claimedAtLTE: Time + claimedAtIsNil: Boolean + claimedAtNotNil: Boolean + """ + started_at field predicates + """ + startedAt: Time + startedAtNEQ: Time + startedAtIn: [Time!] + startedAtNotIn: [Time!] + startedAtGT: Time + startedAtGTE: Time + startedAtLT: Time + startedAtLTE: Time + startedAtIsNil: Boolean + startedAtNotNil: Boolean + """ + finished_at field predicates + """ + finishedAt: Time + finishedAtNEQ: Time + finishedAtIn: [Time!] + finishedAtNotIn: [Time!] + finishedAtGT: Time + finishedAtGTE: Time + finishedAtLT: Time + finishedAtLTE: Time + finishedAtIsNil: Boolean + finishedAtNotNil: Boolean + """ + output field predicates + """ + output: String + outputNEQ: String + outputIn: [String!] + outputNotIn: [String!] + outputGT: String + outputGTE: String + outputLT: String + outputLTE: String + outputContains: String + outputHasPrefix: String + outputHasSuffix: String + outputIsNil: Boolean + outputNotNil: Boolean + outputEqualFold: String + outputContainsFold: String + """ + output_size field predicates + """ + outputSize: Int + outputSizeNEQ: Int + outputSizeIn: [Int!] + outputSizeNotIn: [Int!] + outputSizeGT: Int + outputSizeGTE: Int + outputSizeLT: Int + outputSizeLTE: Int + """ + error field predicates + """ + error: String + errorNEQ: String + errorIn: [String!] + errorNotIn: [String!] + errorGT: String + errorGTE: String + errorLT: String + errorLTE: String + errorContains: String + errorHasPrefix: String + errorHasSuffix: String + errorIsNil: Boolean + errorNotNil: Boolean + errorEqualFold: String + errorContainsFold: String + """ + error_size field predicates + """ + errorSize: Int + errorSizeNEQ: Int + errorSizeIn: [Int!] + errorSizeNotIn: [Int!] + errorSizeGT: Int + errorSizeGTE: Int + errorSizeLT: Int + errorSizeLTE: Int + """ + exit_code field predicates + """ + exitCode: Int + exitCodeNEQ: Int + exitCodeIn: [Int!] + exitCodeNotIn: [Int!] + exitCodeGT: Int + exitCodeGTE: Int + exitCodeLT: Int + exitCodeLTE: Int + exitCodeIsNil: Boolean + exitCodeNotNil: Boolean + """ + artifact_path field predicates + """ + artifactPath: String + artifactPathNEQ: String + artifactPathIn: [String!] + artifactPathNotIn: [String!] + artifactPathGT: String + artifactPathGTE: String + artifactPathLT: String + artifactPathLTE: String + artifactPathContains: String + artifactPathHasPrefix: String + artifactPathHasSuffix: String + artifactPathIsNil: Boolean + artifactPathNotNil: Boolean + artifactPathEqualFold: String + artifactPathContainsFold: String + """ + builder edge predicates + """ + hasBuilder: Boolean + hasBuilderWith: [BuilderWhereInput!] + """ + artifact edge predicates + """ + hasArtifact: Boolean + hasArtifactWith: [AssetWhereInput!] +} type Builder implements Node { id: ID! """ @@ -610,6 +1041,41 @@ type Builder implements Node { The server address that the builder should connect to. """ upstream: String! + """ + Timestamp of the builder's last ClaimBuildTasks call. Null if never seen. + """ + lastSeenAt: Time + buildTasks( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for BuildTasks returned from the connection. + """ + orderBy: [BuildTaskOrder!] + + """ + Filtering options for BuildTasks returned from the connection. + """ + where: BuildTaskWhereInput + ): BuildTaskConnection! } """ A connection to a list of items. @@ -660,6 +1126,7 @@ Properties by which Builder connections can be ordered. enum BuilderOrderField { CREATED_AT LAST_MODIFIED_AT + LAST_SEEN_AT } """ BuilderWhereInput is used for filtering Builder objects. @@ -734,6 +1201,24 @@ input BuilderWhereInput { upstreamHasSuffix: String upstreamEqualFold: String upstreamContainsFold: String + """ + last_seen_at field predicates + """ + lastSeenAt: Time + lastSeenAtNEQ: Time + lastSeenAtIn: [Time!] + lastSeenAtNotIn: [Time!] + lastSeenAtGT: Time + lastSeenAtGTE: Time + lastSeenAtLT: Time + lastSeenAtLTE: Time + lastSeenAtIsNil: Boolean + lastSeenAtNotNil: Boolean + """ + build_tasks edge predicates + """ + hasBuildTasks: Boolean + hasBuildTasksWith: [BuildTaskWhereInput!] } """ CreateBuilderInput is used for create Builder object. @@ -748,6 +1233,7 @@ input CreateBuilderInput { The server address that the builder should connect to. """ upstream: String! + buildTaskIDs: [ID!] } """ CreateHostCredentialInput is used for create HostCredential object. @@ -1560,7 +2046,7 @@ enum HostOrderField { NEXT_SEEN_AT } """ -HostPlatform is enum for the field platform +HostPlatform is enum for the field target_os """ enum HostPlatform @goModel(model: "realm.pub/tavern/internal/c2/c2pb.Host_Platform") { PLATFORM_BSD @@ -4462,12 +4948,39 @@ input ImportRepositoryInput { includeDirs: [String!] } +"""Input for creating a new build task.""" +input CreateBuildTaskInput { + """The target operating system for the build.""" + targetOS: HostPlatform! + + """The output format for the build. Defaults to BIN.""" + targetFormat: BuildTaskTargetFormat + + """Docker container image name to use for the build. Defaults to spellshift/devcontainer:main.""" + buildImage: String + + """The callback URI for the IMIX agent to connect to. Defaults to http://127.0.0.1:8000.""" + callbackURI: String + + """The callback interval in seconds for the IMIX agent.""" + interval: Int = 5 + + """The transport type for the IMIX agent. Defaults to TRANSPORT_GRPC.""" + transportType: BeaconTransport_Type + + """Extra transport configuration for the IMIX agent.""" + extra: String + + """Path inside the build container to extract the artifact from. Defaults to the derived path based on target OS.""" + artifactPath: String +} + """Output returned when registering a new builder.""" type RegisterBuilderOutput { """The created builder entity.""" builder: Builder! - """mTLS certificate in base64 encoding for the builder to authenticate.""" + """mTLS certificate PEM bundle for the builder to authenticate.""" mtlsCert: String! """YAML-formatted configuration for the builder.""" @@ -4534,6 +5047,12 @@ type Mutation { # Builder ### registerBuilder(input: CreateBuilderInput!): RegisterBuilderOutput! @requireRole(role: ADMIN) + deleteBuilder(builderID: ID!): ID! @requireRole(role: ADMIN) + + ### + # BuildTask + ### + createBuildTask(input: CreateBuildTaskInput!): BuildTask! @requireRole(role: ADMIN) } extend type Query { assets( @@ -4745,6 +5264,44 @@ extend type Query { """Filtering options for Shells returned from the connection.""" where: ShellWhereInput): ShellConnection! @requireRole(role: USER) + buildTasks( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for BuildTasks returned from the connection.""" + orderBy: [BuildTaskOrder!] + + """Filtering options for BuildTasks returned from the connection.""" + where: BuildTaskWhereInput + ): BuildTaskConnection! @requireRole(role: USER) + builders( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for Builders returned from the connection.""" + orderBy: [BuilderOrder!] + + """Filtering options for Builders returned from the connection.""" + where: BuilderWhereInput + ): BuilderConnection! @requireRole(role: ADMIN) me: User! } scalar Time