diff --git a/go.mod b/go.mod index 881d0a5fa673d5594a7dd607e17512c0c14db2bf..639d370d014d3baafb3a90f337ada43ac03ffeb5 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.26.4 require ( git.sr.ht/~bitfehler/brant v0.5.1 + github.com/99designs/gqlgen v0.17.94 github.com/alexflint/go-arg v1.6.0 github.com/dolthub/dolt/go v0.40.5-0.20260626152440-45335d44ad79 github.com/fernet/fernet-go v0.0.0-20211208181803-9f70042a33ee @@ -13,11 +14,12 @@ github.com/modelcontextprotocol/go-sdk v1.6.1 github.com/sirupsen/logrus v1.9.4 github.com/stretchr/testify v1.11.1 github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec + github.com/vektah/gqlparser/v2 v2.5.36 go.bigb.es/auxilia v0.7.0 google.golang.org/grpc v1.79.3 gopkg.in/go-jose/go-jose.v2 v2.6.3 sourcecraft.dev/bigbes/sr-ht-core v0.0.0-20260718185800-dd418a200152 - sourcecraft.dev/bigbes/sr-ht-ecore v0.0.0-20260808210553-b6bf6d28db15 + sourcecraft.dev/bigbes/sr-ht-ecore v0.0.0-20260815100501-2e37ec734334 ) require ( @@ -32,7 +34,6 @@ cloud.google.com/go/storage v1.50.0 // indirect git.sr.ht/~sircmpwn/dowork v0.0.0-20241216125407-2b00aa42322c // indirect git.sr.ht/~sircmpwn/getopt v1.0.0 // indirect git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9 // indirect - github.com/99designs/gqlgen v0.17.36 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect @@ -44,7 +45,7 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0 // indirect github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect github.com/Masterminds/squirrel v1.5.4 // indirect github.com/ProtonMail/go-crypto v1.3.0 // indirect - github.com/agnivade/levenshtein v1.1.1 // indirect + github.com/agnivade/levenshtein v1.2.1 // indirect github.com/alexflint/go-scalar v1.2.0 // indirect github.com/aliyun/aliyun-oss-go-sdk v2.2.5+incompatible // indirect github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect @@ -74,6 +75,7 @@ github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cloudflare/circl v1.6.0 // indirect github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 // indirect github.com/cockroachdb/apd/v3 v3.2.3 // indirect + github.com/coder/websocket v1.8.15 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/denisbrodbeck/machineid v1.0.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect @@ -102,6 +104,7 @@ github.com/go-jose/go-jose/v4 v4.1.4 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-redis/redis/v8 v8.11.5 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect @@ -112,7 +115,6 @@ github.com/google/s2a-go v0.1.9 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect github.com/googleapis/gax-go/v2 v2.14.2 // indirect - github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d // indirect @@ -124,10 +126,9 @@ github.com/kylelemons/godebug v1.1.0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/lestrrat-go/strftime v1.2.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-isatty v0.0.21 // indirect github.com/mfridman/interpolate v0.0.2 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mohae/uvarint v0.0.0-20160208145430-c3f9e62bf2b0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oracle/oci-go-sdk/v65 v65.55.0 // indirect @@ -142,8 +143,8 @@ github.com/prometheus/procfs v0.16.1 // indirect github.com/segmentio/asm v1.1.3 // indirect github.com/segmentio/encoding v0.5.4 // indirect github.com/sony/gobreaker v0.5.0 // indirect + github.com/sosodev/duration v1.4.0 // indirect github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect - github.com/vektah/gqlparser/v2 v2.5.8 // indirect github.com/xtaci/smux v1.5.56 // indirect github.com/yosida95/uritemplate/v3 v3.0.2 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect @@ -159,14 +160,14 @@ go.opentelemetry.io/otel/trace v1.43.0 // indirect go.uber.org/multierr v1.10.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/crypto v0.52.0 // indirect - golang.org/x/net v0.54.0 // indirect + golang.org/x/crypto v0.54.0 // indirect + golang.org/x/net v0.57.0 // indirect golang.org/x/oauth2 v0.35.0 // indirect - golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.45.0 // indirect - golang.org/x/text v0.37.0 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/sys v0.47.0 // indirect + golang.org/x/text v0.40.0 // indirect golang.org/x/time v0.12.0 // indirect - golang.org/x/tools v0.45.0 // indirect + golang.org/x/tools v0.48.0 // indirect google.golang.org/api v0.241.0 // indirect google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect diff --git a/go.sum b/go.sum index fa288fcb6000476da070de1590d13ae7ce0de944..444b00849b09709496629bb425c9ec8220f303fa 100644 --- a/go.sum +++ b/go.sum @@ -32,8 +32,8 @@ git.sr.ht/~sircmpwn/getopt v1.0.0 h1:/pRHjO6/OCbBF4puqD98n6xtPEgE//oq5U8NXjP7ROc= git.sr.ht/~sircmpwn/getopt v1.0.0/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9 h1:Ahny8Ud1LjVMMAlt8utUFKhhxJtwBAualvsbc/Sk7cE= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= -github.com/99designs/gqlgen v0.17.36 h1:u/o/rv2SZ9s5280dyUOOrkpIIkr/7kITMXYD3rkJ9go= -github.com/99designs/gqlgen v0.17.36/go.mod h1:6RdyY8puhCoWAQVr2qzF2OMVfudQzc8ACxzpzluoQm4= +github.com/99designs/gqlgen v0.17.94 h1:+3EUDVgX/8gDyDL+7NUqCo4cy2ylylwW0GvR1dGiEsA= +github.com/99designs/gqlgen v0.17.94/go.mod h1:o+XaAMpPA/AX4rqeiK03tZUb/5T+WCgpRDD4aujgdas= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4= @@ -70,8 +70,8 @@ github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw= github.com/ProtonMail/go-crypto v1.3.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db h1:CjPUSXOiYptLbTdr1RceuZgSFDQ7U15ITERUGrUORx8= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= -github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= -github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= +github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= +github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw= github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= @@ -153,6 +153,8 @@ github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 h1:6xNmx7iTtyBRev0+D/Tv1FZd4SCg8axKApyNyRsAt/w= github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5/go.mod h1:KdCmV+x/BuvyMxRnYBlmVaq4OLiKW6iRQfvC62cvdkI= github.com/cockroachdb/apd/v3 v3.2.3 h1:4Zx+I3R35bFXMnltzmjP79i2cravE4jTRL6ps9Aux80= github.com/cockroachdb/apd/v3 v3.2.3/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= +github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA= +github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -162,8 +164,8 @@ github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ= github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= -github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= +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/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12 h1:IdqX7J8vi/Kn3T3Ee0VzqnLqwFmgA2hr8WZETPcQjfM= github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12/go.mod h1:rN7X8BHwkjPcfMQQ2QTAq/xM3leUSGLfb+1Js7Y6TVo= github.com/dolthub/dolt/go v0.40.5-0.20260626152440-45335d44ad79 h1:jglYHtNhgm90ePaU8JQGREbI8oZXuMuZnocUF8047LI= @@ -245,6 +247,8 @@ github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gocraft/dbr/v2 v2.7.2 h1:ccUxMuz6RdZvD7VPhMRRMSS/ECF3gytPhPtcavjktHk= @@ -252,8 +256,6 @@ github.com/gocraft/dbr/v2 v2.7.2/go.mod h1:5bCqyIXO5fYn3jEp/L06QF4K1siFdhxChMjdNu6YJrg= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= -github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= @@ -298,8 +300,6 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4= github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA= github.com/googleapis/gax-go/v2 v2.14.2 h1:eBLnkZ9635krYIPD+ag1USrOAI0Nr0QYF3+/3GqO0k0= github.com/googleapis/gax-go/v2 v2.14.2/go.mod h1:ON64QhlJkhVtSqp4v1uaK92VyZ2gmvDQsweuyLV+8+w= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= @@ -342,20 +342,17 @@ github.com/lestrrat-go/strftime v1.2.0/go.mod h1:GtsIA/7ddIGJjEdfadUafEb1sbutvlvpMdPCMglykYo= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.21 h1:xYae+lCNBP7QuW4PUnNG61ffM4hVIfm+zUzDuSzYLGs= +github.com/mattn/go-isatty v0.0.21/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modelcontextprotocol/go-sdk v1.6.1 h1:0zOSupjKUxPKSocPT1Wtago+mUHU2/uZ4xSOY0FGReU= github.com/modelcontextprotocol/go-sdk v1.6.1/go.mod h1:kzm3kzFL1/+AziGOE0nUs3gvPoNxMCvkxokMkuFapXQ= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -422,8 +419,8 @@ github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc= github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg= github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0= github.com/segmentio/encoding v0.5.4/go.mod h1:HS1ZKa3kSN32ZHVZ7ZLPLXWvOVIiZtyJnO1gPH1sKt0= -github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= -github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= @@ -432,6 +429,8 @@ github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= github.com/sony/gobreaker v0.5.0 h1:dRCvqm0P490vZPmy7ppEk2qCnCieBooFJ+YoXGYB+yg= github.com/sony/gobreaker v0.5.0/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/sosodev/duration v1.4.0 h1:35ed0KiVFriGHHzZZJaZLgmTEEICIyt8Sx0RQfj9IjE= +github.com/sosodev/duration v1.4.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo= github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -464,8 +463,8 @@ github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec h1:DGmKwyZwEB8dI7tbLt/I/gQuP559o/0FrAkHKlQM/Ks= github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec/go.mod h1:owBmyHYMLkxyrugmfwE/DLJyW8Ro9mkphwuVErQ0iUw= github.com/vbauerster/mpb/v8 v8.0.2 h1:alVQG69Jg5+Ku9Hu1dakDx50uACEHnIzS7i356NQ/Vs= github.com/vbauerster/mpb/v8 v8.0.2/go.mod h1:Z9VJYIzXls7xZwirZjShGsi+14enzJhQfGyb/XZK0ZQ= -github.com/vektah/gqlparser/v2 v2.5.8 h1:pm6WOnGdzFOCfcQo9L3+xzW51mKrlwTEg4Wr7AH1JW4= -github.com/vektah/gqlparser/v2 v2.5.8/go.mod h1:z8xXUff237NntSuH8mLFijZ+1tjV1swDbpDqjJmk6ME= +github.com/vektah/gqlparser/v2 v2.5.36 h1:CN9mKVHgMkc+XftdOWIhb4HEL8wKSYkFAqhf8booa7s= +github.com/vektah/gqlparser/v2 v2.5.36/go.mod h1:cAJ9qwVgPaUkWv6Gn8vn0mqOE0Ui5Pn56wNy5396XWo= github.com/xitongsys/parquet-go v1.6.1 h1:F1snhlfL5U1hC1yE7Op8qLWFIZEzqmM46pCEspu9OC0= github.com/xitongsys/parquet-go v1.6.1/go.mod h1:oNMMTE7vxZkSeV4Y6Q+DSpnR50DdpFM6Jx2CRav1OHI= github.com/xitongsys/parquet-go-source v0.0.0-20211010230925-397910c5e371 h1:RfGiOP/lWKBeNgpXmCeandYGV4pAnZsl42kX50p1UgE= @@ -511,6 +510,8 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -518,8 +519,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988= -golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc= +golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= +golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -536,8 +537,8 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4= -golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ= +golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= +golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -548,10 +549,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.54.0 h1:2zJIZAxAHV/OHCDTCOHAYehQzLfSXuf/5SoL/Dv6w/w= -golang.org/x/net v0.54.0/go.mod h1:Sj4oj8jK6XmHpBZU/zWHw3BV3abl4Kvi+Ut7cQcY+cQ= -golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= -golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= +golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -560,8 +559,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -577,7 +576,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -585,10 +583,10 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= -golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/telemetry v0.0.0-20260508192327-42602be52be6 h1:HjU6IWBiAgRIdAJ9/y1rwCn+UELEmwV+VsTLzj/W4sE= -golang.org/x/telemetry v0.0.0-20260508192327-42602be52be6/go.mod h1:Eqhaxk/wZsWEH8CRxLwj6xzEJbz7k1EFGqx7nyCoabE= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/telemetry v0.0.0-20260708182218-49f421fb7959 h1:RJhm5l6Fo4rmEIcndxDllNhhf/fAx8qIm4t6A7vpm2A= +golang.org/x/telemetry v0.0.0-20260708182218-49f421fb7959/go.mod h1:LV7u5Oco+Z/g6XI7PqN+EUUUGGkEcmB1uj2ceI0fOVg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -596,8 +594,8 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= -golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= -golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -607,8 +605,8 @@ golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= -golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -618,8 +616,8 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8= -golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= +golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= +golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -681,5 +679,5 @@ modernc.org/sqlite v1.38.2/go.mod h1:cPTJYSlgg3Sfg046yBShXENNtPrWrDX8bsbAQBzgQ5E= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= sourcecraft.dev/bigbes/sr-ht-core v0.0.0-20260718185800-dd418a200152 h1:9kQC+tDO2CO8avlKadb9Z0if4a6vJuEK80+4zcb6/fU= sourcecraft.dev/bigbes/sr-ht-core v0.0.0-20260718185800-dd418a200152/go.mod h1:Mu1Vx39ws/OTKWGoVERXvkdRSPLBdhuFTYv0ftVV31c= -sourcecraft.dev/bigbes/sr-ht-ecore v0.0.0-20260808210553-b6bf6d28db15 h1:zVtZHaKHtdD5Q2Stw8OwuMENl6xvzp32IoHikrB0QWM= -sourcecraft.dev/bigbes/sr-ht-ecore v0.0.0-20260808210553-b6bf6d28db15/go.mod h1:JjrjFxb+PSG0AT9waiK7teFbpZmBPisX3MuqI7Z+ZO8= +sourcecraft.dev/bigbes/sr-ht-ecore v0.0.0-20260815100501-2e37ec734334 h1:xpY9JZpz+T924BI2VRiZcY8mFnZ7LtyrIAI8hjLsBzc= +sourcecraft.dev/bigbes/sr-ht-ecore v0.0.0-20260815100501-2e37ec734334/go.mod h1:JjrjFxb+PSG0AT9waiK7teFbpZmBPisX3MuqI7Z+ZO8= diff --git a/graph/api/generated.go b/graph/api/generated.go new file mode 100644 index 0000000000000000000000000000000000000000..c83e8d99eeb627c0e6331788364723efde82e83c --- /dev/null +++ b/graph/api/generated.go @@ -0,0 +1,5213 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package api + +import ( + "bytes" + "context" + "errors" + "fmt" + "math" + "strconv" + "sync/atomic" + "time" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + gqlparser "github.com/vektah/gqlparser/v2" + "github.com/vektah/gqlparser/v2/ast" + "sourcecraft.dev/bigbes/sr-ht-core/model" + model1 "sourcecraft.dev/bigbes/sr-ht-dolt/graph/model" +) + +// region ***************************** api!.gotpl ***************************** + +// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. +func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { + return &executableSchema{SchemaData: cfg.Schema, Resolvers: cfg.Resolvers, Directives: cfg.Directives, ComplexityRoot: cfg.Complexity} +} + +type Config = graphql.Config[ResolverRoot, DirectiveRoot, ComplexityRoot] + +type ResolverRoot interface { + Database() DatabaseResolver + Query() QueryResolver +} + +type DirectiveRoot struct { +} + +type ComplexityRoot struct { + ACLEntry struct { + Mode func(childComplexity int) int + User func(childComplexity int) int + } + + Branch struct { + Head func(childComplexity int) int + Name func(childComplexity int) int + } + + Column struct { + Name func(childComplexity int) int + Nullable func(childComplexity int) int + PrimaryKey func(childComplexity int) int + Type func(childComplexity int) int + } + + Commit struct { + Author func(childComplexity int) int + Date func(childComplexity int) int + Email func(childComplexity int) int + Hash func(childComplexity int) int + Message func(childComplexity int) int + Parents func(childComplexity int) int + } + + CommitCursor struct { + Cursor func(childComplexity int) int + Results func(childComplexity int) int + } + + Database struct { + ACL func(childComplexity int) int + Branches func(childComplexity int) int + Created func(childComplexity int) int + DefaultBranch func(childComplexity int) int + Description func(childComplexity int) int + ID func(childComplexity int) int + Log func(childComplexity int, ref *string, from *model.Cursor, limit *int) int + Name func(childComplexity int) int + Owner func(childComplexity int) int + Tables func(childComplexity int, ref *string) int + Updated func(childComplexity int) int + Visibility func(childComplexity int) int + } + + DatabaseCursor struct { + Cursor func(childComplexity int) int + Results func(childComplexity int) int + } + + Query struct { + Database func(childComplexity int, owner string, name string) int + Databases func(childComplexity int, cursor *model.Cursor, filter *model.Filter) int + DatabasesByOwner func(childComplexity int, owner string, cursor *model.Cursor, filter *model.Filter) int + Me func(childComplexity int) int + } + + Table struct { + Columns func(childComplexity int) int + Name func(childComplexity int) int + RowCount func(childComplexity int) int + } + + User struct { + CanonicalName func(childComplexity int) int + Username func(childComplexity int) int + } +} + +// endregion ***************************** api!.gotpl ***************************** + +// region ************************** generated!.gotpl ************************** + +type DatabaseResolver interface { + DefaultBranch(ctx context.Context, obj *model1.Database) (*string, error) + Branches(ctx context.Context, obj *model1.Database) ([]*model1.Branch, error) + Log(ctx context.Context, obj *model1.Database, ref *string, from *model.Cursor, limit *int) (*model1.CommitCursor, error) + Tables(ctx context.Context, obj *model1.Database, ref *string) ([]*model1.Table, error) + ACL(ctx context.Context, obj *model1.Database) ([]*model1.ACLEntry, error) +} +type QueryResolver interface { + Me(ctx context.Context) (*model1.User, error) + Databases(ctx context.Context, cursor *model.Cursor, filter *model.Filter) (*model1.DatabaseCursor, error) + DatabasesByOwner(ctx context.Context, owner string, cursor *model.Cursor, filter *model.Filter) (*model1.DatabaseCursor, error) + Database(ctx context.Context, owner string, name string) (*model1.Database, error) +} + +// endregion ************************** generated!.gotpl ************************** + +// region ************************** internal!.gotpl *************************** + +type executableSchema graphql.ExecutableSchemaState[ResolverRoot, DirectiveRoot, ComplexityRoot] + +func (e *executableSchema) Schema() *ast.Schema { + if e.SchemaData != nil { + return e.SchemaData + } + return parsedSchema +} + +func (e *executableSchema) Complexity(ctx context.Context, typeName, field string, childComplexity int, rawArgs map[string]any) (int, bool) { + ec := newExecutionContext(nil, e, nil) + _ = ec + switch typeName + "." + field { + + case "ACLEntry.mode": + if e.ComplexityRoot.ACLEntry.Mode == nil { + break + } + + return e.ComplexityRoot.ACLEntry.Mode(childComplexity), true + case "ACLEntry.user": + if e.ComplexityRoot.ACLEntry.User == nil { + break + } + + return e.ComplexityRoot.ACLEntry.User(childComplexity), true + + case "Branch.head": + if e.ComplexityRoot.Branch.Head == nil { + break + } + + return e.ComplexityRoot.Branch.Head(childComplexity), true + case "Branch.name": + if e.ComplexityRoot.Branch.Name == nil { + break + } + + return e.ComplexityRoot.Branch.Name(childComplexity), true + + case "Column.name": + if e.ComplexityRoot.Column.Name == nil { + break + } + + return e.ComplexityRoot.Column.Name(childComplexity), true + case "Column.nullable": + if e.ComplexityRoot.Column.Nullable == nil { + break + } + + return e.ComplexityRoot.Column.Nullable(childComplexity), true + case "Column.primaryKey": + if e.ComplexityRoot.Column.PrimaryKey == nil { + break + } + + return e.ComplexityRoot.Column.PrimaryKey(childComplexity), true + case "Column.type": + if e.ComplexityRoot.Column.Type == nil { + break + } + + return e.ComplexityRoot.Column.Type(childComplexity), true + + case "Commit.author": + if e.ComplexityRoot.Commit.Author == nil { + break + } + + return e.ComplexityRoot.Commit.Author(childComplexity), true + case "Commit.date": + if e.ComplexityRoot.Commit.Date == nil { + break + } + + return e.ComplexityRoot.Commit.Date(childComplexity), true + case "Commit.email": + if e.ComplexityRoot.Commit.Email == nil { + break + } + + return e.ComplexityRoot.Commit.Email(childComplexity), true + case "Commit.hash": + if e.ComplexityRoot.Commit.Hash == nil { + break + } + + return e.ComplexityRoot.Commit.Hash(childComplexity), true + case "Commit.message": + if e.ComplexityRoot.Commit.Message == nil { + break + } + + return e.ComplexityRoot.Commit.Message(childComplexity), true + case "Commit.parents": + if e.ComplexityRoot.Commit.Parents == nil { + break + } + + return e.ComplexityRoot.Commit.Parents(childComplexity), true + + case "CommitCursor.cursor": + if e.ComplexityRoot.CommitCursor.Cursor == nil { + break + } + + return e.ComplexityRoot.CommitCursor.Cursor(childComplexity), true + case "CommitCursor.results": + if e.ComplexityRoot.CommitCursor.Results == nil { + break + } + + return e.ComplexityRoot.CommitCursor.Results(childComplexity), true + + case "Database.acl": + if e.ComplexityRoot.Database.ACL == nil { + break + } + + return e.ComplexityRoot.Database.ACL(childComplexity), true + case "Database.branches": + if e.ComplexityRoot.Database.Branches == nil { + break + } + + return e.ComplexityRoot.Database.Branches(childComplexity), true + case "Database.created": + if e.ComplexityRoot.Database.Created == nil { + break + } + + return e.ComplexityRoot.Database.Created(childComplexity), true + case "Database.defaultBranch": + if e.ComplexityRoot.Database.DefaultBranch == nil { + break + } + + return e.ComplexityRoot.Database.DefaultBranch(childComplexity), true + case "Database.description": + if e.ComplexityRoot.Database.Description == nil { + break + } + + return e.ComplexityRoot.Database.Description(childComplexity), true + case "Database.id": + if e.ComplexityRoot.Database.ID == nil { + break + } + + return e.ComplexityRoot.Database.ID(childComplexity), true + case "Database.log": + if e.ComplexityRoot.Database.Log == nil { + break + } + + args, err := ec.field_Database_log_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Database.Log(childComplexity, args["ref"].(*string), args["from"].(*model.Cursor), args["limit"].(*int)), true + case "Database.name": + if e.ComplexityRoot.Database.Name == nil { + break + } + + return e.ComplexityRoot.Database.Name(childComplexity), true + case "Database.owner": + if e.ComplexityRoot.Database.Owner == nil { + break + } + + return e.ComplexityRoot.Database.Owner(childComplexity), true + case "Database.tables": + if e.ComplexityRoot.Database.Tables == nil { + break + } + + args, err := ec.field_Database_tables_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Database.Tables(childComplexity, args["ref"].(*string)), true + case "Database.updated": + if e.ComplexityRoot.Database.Updated == nil { + break + } + + return e.ComplexityRoot.Database.Updated(childComplexity), true + case "Database.visibility": + if e.ComplexityRoot.Database.Visibility == nil { + break + } + + return e.ComplexityRoot.Database.Visibility(childComplexity), true + + case "DatabaseCursor.cursor": + if e.ComplexityRoot.DatabaseCursor.Cursor == nil { + break + } + + return e.ComplexityRoot.DatabaseCursor.Cursor(childComplexity), true + case "DatabaseCursor.results": + if e.ComplexityRoot.DatabaseCursor.Results == nil { + break + } + + return e.ComplexityRoot.DatabaseCursor.Results(childComplexity), true + + case "Query.database": + if e.ComplexityRoot.Query.Database == nil { + break + } + + args, err := ec.field_Query_database_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Database(childComplexity, args["owner"].(string), args["name"].(string)), true + case "Query.databases": + if e.ComplexityRoot.Query.Databases == nil { + break + } + + args, err := ec.field_Query_databases_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Databases(childComplexity, args["cursor"].(*model.Cursor), args["filter"].(*model.Filter)), true + case "Query.databasesByOwner": + if e.ComplexityRoot.Query.DatabasesByOwner == nil { + break + } + + args, err := ec.field_Query_databasesByOwner_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.DatabasesByOwner(childComplexity, args["owner"].(string), args["cursor"].(*model.Cursor), args["filter"].(*model.Filter)), true + + case "Query.me": + if e.ComplexityRoot.Query.Me == nil { + break + } + + return e.ComplexityRoot.Query.Me(childComplexity), true + + case "Table.columns": + if e.ComplexityRoot.Table.Columns == nil { + break + } + + return e.ComplexityRoot.Table.Columns(childComplexity), true + case "Table.name": + if e.ComplexityRoot.Table.Name == nil { + break + } + + return e.ComplexityRoot.Table.Name(childComplexity), true + case "Table.rowCount": + if e.ComplexityRoot.Table.RowCount == nil { + break + } + + return e.ComplexityRoot.Table.RowCount(childComplexity), true + + case "User.canonicalName": + if e.ComplexityRoot.User.CanonicalName == nil { + break + } + + return e.ComplexityRoot.User.CanonicalName(childComplexity), true + case "User.username": + if e.ComplexityRoot.User.Username == nil { + break + } + + return e.ComplexityRoot.User.Username(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + opCtx := graphql.GetOperationContext(ctx) + ec := newExecutionContext(opCtx, e, make(chan graphql.DeferredResult)) + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputFilter, + ) + first := true + + switch opCtx.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.PendingDeferred) > 0 { + result := <-ec.DeferredResults + atomic.AddInt32(&ec.PendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.Deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.PendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.ExecutionContextState[ResolverRoot, DirectiveRoot, ComplexityRoot] +} + +func newExecutionContext( + opCtx *graphql.OperationContext, + execSchema *executableSchema, + deferredResults chan graphql.DeferredResult, +) *executionContext { + return &executionContext{ + ExecutionContextState: graphql.NewExecutionContextState[ResolverRoot, DirectiveRoot, ComplexityRoot]( + opCtx, + (*graphql.ExecutableSchemaState[ResolverRoot, DirectiveRoot, ComplexityRoot])(execSchema), + parsedSchema, + deferredResults, + ), + } +} + +var sources = []*ast.Source{ + {Name: "../schema.graphqls", Input: `# dolt.sr.ht — the read schema. +# +# There are no mutations here, and the reason is the same one spec.sr.ht gives: +# a type federated into api.sr.ht is a consumed contract, expensive to churn, so +# only what has settled is published. Creating, renaming and deleting a database +# each move a metadata row and an on-disk store together, and that pairing is +# young; it stays behind the web UI until it is not. +# +# Rows and diffs are absent for a different reason. They exist on /mcp, where a +# read that had to be clipped says so in its own answer — a shape this schema +# would have to reproduce field by field to stay honest. Until it does, a client +# that wants table contents should ask /mcp, and this schema stops at the +# structure: what databases exist, what branches and commits they carry, and +# what tables live at a ref. +# +# Everything below is read through the same db/ store and browse/ session the +# web pages and the MCP tools use, so the three surfaces cannot disagree about +# what a database is. + +""" +An RFC-3339 timestamp. +""" +scalar Time + +""" +An opaque pagination cursor. Pass it back into the same field to fetch the next +page; it is null when there are no further results. +""" +scalar Cursor + +""" +Who may see a database, and how it is listed. + +PUBLIC is listed to everyone including anonymous callers. UNLISTED is reachable +by direct address but never appears in a listing to a stranger. PRIVATE is +neither: to a caller who may not see it, it does not exist — this schema answers +null rather than an authorization error, exactly as the web UI answers "no such +database" rather than "forbidden". +""" +enum Visibility { + PUBLIC + UNLISTED + PRIVATE +} + +""" +An ACL grant: read-only (browse and clone) or read-write (and push). +""" +enum AccessMode { + RO + RW +} + +""" +A SourceHut account, mirrored from meta.sr.ht. +""" +type User { + """ + The username with no leading "~". This is the name that addresses the account + in ` + "`" + `database(owner:)` + "`" + ` and in a clone URL's path. + """ + username: String! + + """ + The username with its leading "~", as SourceHut writes it in prose and in the + web UI. + """ + canonicalName: String! +} + +""" +A hosted Dolt database: one metadata row and one bare chunk store. +""" +type Database { + id: Int! + name: String! + owner: User! + + """ + The description shown in listings. Empty rather than null when unset: a + companion of a git repository mirrors that repository's description, and "no + description" and "the empty description" are the same state here. + """ + description: String! + visibility: Visibility! + created: Time! + updated: Time! + + """ + The branch a reader lands on: "main" when it exists, else the first branch by + name. Null for a database nothing has been pushed to yet — a store with no + commits has no branches, which is a state and not a failure. + """ + defaultBranch: String + + """ + Every branch, the default one first and the rest by name. Empty for a database + nothing has been pushed to. + """ + branches: [Branch!]! + + """ + The commit log of ` + "`" + `ref` + "`" + `, newest first. ` + "`" + `ref` + "`" + ` is a branch name or a commit + hash, defaulting to ` + "`" + `defaultBranch` + "`" + `; ` + "`" + `from` + "`" + ` continues a previous page from the + hash it returned as ` + "`" + `cursor` + "`" + `. + """ + log(ref: String, from: Cursor, limit: Int): CommitCursor! + + """ + The tables of the committed root at ` + "`" + `ref` + "`" + ` (a branch name or a commit hash, + defaulting to ` + "`" + `defaultBranch` + "`" + `), each with its columns and row count. + """ + tables(ref: String): [Table!]! + + """ + Who else may read or write this database. Owner-only: to anybody else it is + the empty list, because the collaborator list of a database you do not own is + not yours to enumerate. + """ + acl: [ACLEntry!]! +} + +""" +A branch and the commit it points at. +""" +type Branch { + name: String! + head: String! +} + +""" +One commit of a database's history. +""" +type Commit { + hash: String! + author: String! + email: String! + date: Time! + message: String! + parents: [String!]! +} + +""" +A column of a table, as the stored schema declares it. +""" +type Column { + name: String! + type: String! + primaryKey: Boolean! + nullable: Boolean! +} + +""" +A table at a ref: its schema and how many rows it holds there. +""" +type Table { + name: String! + columns: [Column!]! + rowCount: Int! +} + +""" +An access grant on a database. +""" +type ACLEntry { + user: User! + mode: AccessMode! +} + +""" +How a listing is paged. It is git.sr.ht's ` + "`" + `Filter` + "`" + ` minus ` + "`" + `search` + "`" + `: nothing here +searches yet, and declaring a field this schema would ignore is a worse answer +than not declaring it. +""" +input Filter { + """ + How many results one page holds, capped at 100. It travels in the cursor the + page returns, so it is given once and kept for the rest of the walk. + """ + count: Int = 25 +} + +type DatabaseCursor { + results: [Database!]! + cursor: Cursor +} + +type CommitCursor { + results: [Commit!]! + cursor: Cursor +} + +type Query { + """ + The caller, or null for an anonymous one. Anonymous is a normal caller on this + schema — it reads what an anonymous visitor reads — so a null here is an + answer and not an error. + """ + me: User + + """ + Every database the caller may be shown, newest first, across all owners. + + This is the listing rule and not the read rule: PUBLIC to everyone, plus + whatever the caller owns or holds an ACL entry on. An UNLISTED database of + somebody else is absent here and still readable through ` + "`" + `database` + "`" + `. + """ + databases(cursor: Cursor, filter: Filter): DatabaseCursor! + + """ + One owner's databases, under the same listing rule as ` + "`" + `databases` + "`" + `. ` + "`" + `owner` + "`" + ` + carries no leading "~". + """ + databasesByOwner(owner: String!, cursor: Cursor, filter: Filter): DatabaseCursor! + + """ + One database by owner and name, neither carrying a leading "~". Null when + there is no such database *or* when the caller may not see it — the two are + deliberately one answer, so that a PRIVATE database cannot be discovered by + the shape of the refusal. + """ + database(owner: String!, name: String!): Database +} +`, BuiltIn: false}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// childFields_* functions provide shared child field context lookups. +// Each function is generated once per unique object type, deduplicating the +// switch statements that were previously inlined in every fieldContext_* function. + +func (ec *executionContext) childFields_ACLEntry(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "user": + return ec.fieldContext_ACLEntry_user(ctx, field) + case "mode": + return ec.fieldContext_ACLEntry_mode(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ACLEntry", field.Name) +} + +func (ec *executionContext) childFields_Branch(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Branch_name(ctx, field) + case "head": + return ec.fieldContext_Branch_head(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Branch", field.Name) +} + +func (ec *executionContext) childFields_Column(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Column_name(ctx, field) + case "type": + return ec.fieldContext_Column_type(ctx, field) + case "primaryKey": + return ec.fieldContext_Column_primaryKey(ctx, field) + case "nullable": + return ec.fieldContext_Column_nullable(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Column", field.Name) +} + +func (ec *executionContext) childFields_Commit(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hash": + return ec.fieldContext_Commit_hash(ctx, field) + case "author": + return ec.fieldContext_Commit_author(ctx, field) + case "email": + return ec.fieldContext_Commit_email(ctx, field) + case "date": + return ec.fieldContext_Commit_date(ctx, field) + case "message": + return ec.fieldContext_Commit_message(ctx, field) + case "parents": + return ec.fieldContext_Commit_parents(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Commit", field.Name) +} + +func (ec *executionContext) childFields_CommitCursor(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "results": + return ec.fieldContext_CommitCursor_results(ctx, field) + case "cursor": + return ec.fieldContext_CommitCursor_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CommitCursor", field.Name) +} + +func (ec *executionContext) childFields_Database(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Database_id(ctx, field) + case "name": + return ec.fieldContext_Database_name(ctx, field) + case "owner": + return ec.fieldContext_Database_owner(ctx, field) + case "description": + return ec.fieldContext_Database_description(ctx, field) + case "visibility": + return ec.fieldContext_Database_visibility(ctx, field) + case "created": + return ec.fieldContext_Database_created(ctx, field) + case "updated": + return ec.fieldContext_Database_updated(ctx, field) + case "defaultBranch": + return ec.fieldContext_Database_defaultBranch(ctx, field) + case "branches": + return ec.fieldContext_Database_branches(ctx, field) + case "log": + return ec.fieldContext_Database_log(ctx, field) + case "tables": + return ec.fieldContext_Database_tables(ctx, field) + case "acl": + return ec.fieldContext_Database_acl(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Database", field.Name) +} + +func (ec *executionContext) childFields_DatabaseCursor(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "results": + return ec.fieldContext_DatabaseCursor_results(ctx, field) + case "cursor": + return ec.fieldContext_DatabaseCursor_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DatabaseCursor", field.Name) +} + +func (ec *executionContext) childFields_Table(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Table_name(ctx, field) + case "columns": + return ec.fieldContext_Table_columns(ctx, field) + case "rowCount": + return ec.fieldContext_Table_rowCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Table", field.Name) +} + +func (ec *executionContext) childFields_User(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "username": + return ec.fieldContext_User_username(ctx, field) + case "canonicalName": + return ec.fieldContext_User_canonicalName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) +} + +func (ec *executionContext) childFields___Directive(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) +} + +func (ec *executionContext) childFields___EnumValue(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) +} + +func (ec *executionContext) childFields___Field(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) +} + +func (ec *executionContext) childFields___InputValue(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) +} + +func (ec *executionContext) childFields___Schema(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) +} + +func (ec *executionContext) childFields___Type(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) +} + +// endregion ************************** internal!.gotpl *************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) field_Database_log_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, "ref", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) + if err != nil { + return nil, err + } + args["ref"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "from", + func(ctx context.Context, v any) (*model.Cursor, error) { + return ec.unmarshalOCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["from"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "limit", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["limit"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Database_tables_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, "ref", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) + if err != nil { + return nil, err + } + args["ref"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query___type_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, "name", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_database_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, "owner", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["owner"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "name", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["name"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_databasesByOwner_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, "owner", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["owner"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "cursor", + func(ctx context.Context, v any) (*model.Cursor, error) { + return ec.unmarshalOCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["cursor"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*model.Filter, error) { + return ec.unmarshalOFilter2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐFilter(ctx, v) + }) + if err != nil { + return nil, err + } + args["filter"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_databases_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, "cursor", + func(ctx context.Context, v any) (*model.Cursor, error) { + return ec.unmarshalOCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["cursor"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*model.Filter, error) { + return ec.unmarshalOFilter2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐFilter(ctx, v) + }) + if err != nil { + return nil, err + } + args["filter"] = arg1 + return args, nil +} + +func (ec *executionContext) field___Directive_args_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, "includeDeprecated", + func(ctx context.Context, v any) (*bool, error) { + return ec.unmarshalOBoolean2ᚖbool(ctx, v) + }) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Field_args_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, "includeDeprecated", + func(ctx context.Context, v any) (*bool, error) { + return ec.unmarshalOBoolean2ᚖbool(ctx, v) + }) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_enumValues_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, "includeDeprecated", + func(ctx context.Context, v any) (bool, error) { + return ec.unmarshalOBoolean2bool(ctx, v) + }) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_fields_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, "includeDeprecated", + func(ctx context.Context, v any) (bool, error) { + return ec.unmarshalOBoolean2bool(ctx, v) + }) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _ACLEntry_user(ctx context.Context, field graphql.CollectedField, obj *model1.ACLEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ACLEntry_user(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.User, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model1.User) graphql.Marshaler { + return ec.marshalNUser2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐUser(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_ACLEntry_user(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ACLEntry", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_User(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _ACLEntry_mode(ctx context.Context, field graphql.CollectedField, obj *model1.ACLEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ACLEntry_mode(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Mode, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v model1.AccessMode) graphql.Marshaler { + return ec.marshalNAccessMode2sourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐAccessMode(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_ACLEntry_mode(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ACLEntry", field, false, false, errors.New("field of type AccessMode does not have child fields")) +} + +func (ec *executionContext) _Branch_name(ctx context.Context, field graphql.CollectedField, obj *model1.Branch) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Branch_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Branch_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Branch", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Branch_head(ctx context.Context, field graphql.CollectedField, obj *model1.Branch) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Branch_head(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Head, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Branch_head(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Branch", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Column_name(ctx context.Context, field graphql.CollectedField, obj *model1.Column) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Column_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Column_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Column", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Column_type(ctx context.Context, field graphql.CollectedField, obj *model1.Column) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Column_type(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Type, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Column_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Column", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Column_primaryKey(ctx context.Context, field graphql.CollectedField, obj *model1.Column) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Column_primaryKey(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.PrimaryKey, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Column_primaryKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Column", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _Column_nullable(ctx context.Context, field graphql.CollectedField, obj *model1.Column) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Column_nullable(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Nullable, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Column_nullable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Column", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _Commit_hash(ctx context.Context, field graphql.CollectedField, obj *model1.Commit) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Commit_hash(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Hash, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Commit_hash(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Commit", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Commit_author(ctx context.Context, field graphql.CollectedField, obj *model1.Commit) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Commit_author(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Author, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Commit_author(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Commit", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Commit_email(ctx context.Context, field graphql.CollectedField, obj *model1.Commit) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Commit_email(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Email, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Commit_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Commit", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Commit_date(ctx context.Context, field graphql.CollectedField, obj *model1.Commit) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Commit_date(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Date, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Commit_date(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Commit", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _Commit_message(ctx context.Context, field graphql.CollectedField, obj *model1.Commit) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Commit_message(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Message, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Commit_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Commit", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Commit_parents(ctx context.Context, field graphql.CollectedField, obj *model1.Commit) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Commit_parents(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Parents, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalNString2ᚕstringᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Commit_parents(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Commit", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _CommitCursor_results(ctx context.Context, field graphql.CollectedField, obj *model1.CommitCursor) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CommitCursor_results(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Results, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model1.Commit) graphql.Marshaler { + return ec.marshalNCommit2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐCommitᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_CommitCursor_results(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CommitCursor", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Commit(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _CommitCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model1.CommitCursor) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CommitCursor_cursor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Cursor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model.Cursor) graphql.Marshaler { + return ec.marshalOCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐCursor(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_CommitCursor_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("CommitCursor", field, false, false, errors.New("field of type Cursor does not have child fields")) +} + +func (ec *executionContext) _Database_id(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Database", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _Database_name(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Database", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Database_owner(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_owner(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Owner, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model1.User) graphql.Marshaler { + return ec.marshalNUser2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐUser(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Database", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_User(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Database_description(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_description(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Description, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Database", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Database_visibility(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_visibility(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Visibility, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v model1.Visibility) graphql.Marshaler { + return ec.marshalNVisibility2sourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐVisibility(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_visibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Database", field, false, false, errors.New("field of type Visibility does not have child fields")) +} + +func (ec *executionContext) _Database_created(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_created(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Created, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_created(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Database", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _Database_updated(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_updated(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Updated, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_updated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Database", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _Database_defaultBranch(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_defaultBranch(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Database().DefaultBranch(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Database_defaultBranch(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Database", field, true, true, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Database_branches(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_branches(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Database().Branches(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model1.Branch) graphql.Marshaler { + return ec.marshalNBranch2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐBranchᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_branches(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Database", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Branch(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Database_log(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_log(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Database().Log(ctx, obj, fc.Args["ref"].(*string), fc.Args["from"].(*model.Cursor), fc.Args["limit"].(*int)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model1.CommitCursor) graphql.Marshaler { + return ec.marshalNCommitCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐCommitCursor(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_log(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Database", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_CommitCursor(ctx, field) + }, + } + 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_Database_log_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Database_tables(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_tables(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Database().Tables(ctx, obj, fc.Args["ref"].(*string)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model1.Table) graphql.Marshaler { + return ec.marshalNTable2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐTableᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_tables(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Database", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Table(ctx, field) + }, + } + 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_Database_tables_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Database_acl(ctx context.Context, field graphql.CollectedField, obj *model1.Database) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Database_acl(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Database().ACL(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model1.ACLEntry) graphql.Marshaler { + return ec.marshalNACLEntry2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐACLEntryᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Database_acl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Database", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_ACLEntry(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _DatabaseCursor_results(ctx context.Context, field graphql.CollectedField, obj *model1.DatabaseCursor) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DatabaseCursor_results(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Results, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model1.Database) graphql.Marshaler { + return ec.marshalNDatabase2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabaseᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_DatabaseCursor_results(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DatabaseCursor", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Database(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _DatabaseCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model1.DatabaseCursor) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DatabaseCursor_cursor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Cursor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model.Cursor) graphql.Marshaler { + return ec.marshalOCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐCursor(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_DatabaseCursor_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("DatabaseCursor", field, false, false, errors.New("field of type Cursor does not have child fields")) +} + +func (ec *executionContext) _Query_me(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_me(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Query().Me(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model1.User) graphql.Marshaler { + return ec.marshalOUser2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐUser(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query_me(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_User(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_databases(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_databases(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Databases(ctx, fc.Args["cursor"].(*model.Cursor), fc.Args["filter"].(*model.Filter)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model1.DatabaseCursor) graphql.Marshaler { + return ec.marshalNDatabaseCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabaseCursor(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_databases(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_DatabaseCursor(ctx, field) + }, + } + 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_databases_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_databasesByOwner(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_databasesByOwner(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().DatabasesByOwner(ctx, fc.Args["owner"].(string), fc.Args["cursor"].(*model.Cursor), fc.Args["filter"].(*model.Filter)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model1.DatabaseCursor) graphql.Marshaler { + return ec.marshalNDatabaseCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabaseCursor(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_databasesByOwner(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_DatabaseCursor(ctx, field) + }, + } + 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_databasesByOwner_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_database(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_database(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Database(ctx, fc.Args["owner"].(string), fc.Args["name"].(string)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model1.Database) graphql.Marshaler { + return ec.marshalODatabase2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabase(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query_database(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Database(ctx, field) + }, + } + 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_database_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query___type(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.IntrospectType(fc.Args["name"].(string)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + 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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query___schema(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.IntrospectSchema() + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Schema(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Table_name(ctx context.Context, field graphql.CollectedField, obj *model1.Table) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Table_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Table_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Table", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Table_columns(ctx context.Context, field graphql.CollectedField, obj *model1.Table) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Table_columns(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Columns, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model1.Column) graphql.Marshaler { + return ec.marshalNColumn2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐColumnᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Table_columns(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Table", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Column(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Table_rowCount(ctx context.Context, field graphql.CollectedField, obj *model1.Table) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Table_rowCount(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.RowCount, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Table_rowCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Table", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _User_username(ctx context.Context, field graphql.CollectedField, obj *model1.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_User_username(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Username, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_User_username(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("User", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _User_canonicalName(ctx context.Context, field graphql.CollectedField, obj *model1.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_User_canonicalName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CanonicalName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_User_canonicalName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("User", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Directive", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_description(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Directive", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_isRepeatable(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.IsRepeatable, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Directive", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_locations(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Locations, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Directive", field, false, false, errors.New("field of type __DirectiveLocation does not have child fields")) +} + +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_args(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Args, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___InputValue(ctx, field) + }, + } + 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___Directive_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___EnumValue_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__EnumValue", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___EnumValue_description(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__EnumValue", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.IsDeprecated(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__EnumValue", field, true, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.DeprecationReason(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__EnumValue", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Field", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_description(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Field", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_args(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Args, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___InputValue(ctx, field) + }, + } + 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___Field_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_type(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Type, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_isDeprecated(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.IsDeprecated(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Field", field, true, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_deprecationReason(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.DeprecationReason(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Field", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__InputValue", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_description(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__InputValue", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_type(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Type, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_defaultValue(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.DefaultValue, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__InputValue", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.IsDeprecated(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___InputValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__InputValue", field, true, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.DeprecationReason(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__InputValue", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_description(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Schema", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_types(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Types(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_queryType(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.QueryType(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_mutationType(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.MutationType(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_subscriptionType(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.SubscriptionType(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_directives(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Directives(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Directive(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_kind(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Kind(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalN__TypeKind2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type __TypeKind does not have child fields")) +} + +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_description(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_specifiedByURL(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.SpecifiedByURL(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_fields(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Field(ctx, field) + }, + } + 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___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_interfaces(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Interfaces(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_possibleTypes(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.PossibleTypes(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_enumValues(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___EnumValue(ctx, field) + }, + } + 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___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_inputFields(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.InputFields(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___InputValue(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_ofType(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.OfType(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_isOneOf(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.IsOneOf(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalOBoolean2bool(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type Boolean does not have child fields")) +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputFilter(ctx context.Context, obj any) (model.Filter, error) { + var it model.Filter + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["count"]; !present { + asMap["count"] = 25 + } + + fieldsInOrder := [...]string{"count"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "count": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Count = data + } + } + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var aCLEntryImplementors = []string{"ACLEntry"} + +func (ec *executionContext) _ACLEntry(ctx context.Context, sel ast.SelectionSet, obj *model1.ACLEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, aCLEntryImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ACLEntry") + case "user": + out.Values[i] = ec._ACLEntry_user(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mode": + out.Values[i] = ec._ACLEntry_mode(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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var branchImplementors = []string{"Branch"} + +func (ec *executionContext) _Branch(ctx context.Context, sel ast.SelectionSet, obj *model1.Branch) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, branchImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Branch") + case "name": + out.Values[i] = ec._Branch_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "head": + out.Values[i] = ec._Branch_head(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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var columnImplementors = []string{"Column"} + +func (ec *executionContext) _Column(ctx context.Context, sel ast.SelectionSet, obj *model1.Column) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, columnImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Column") + case "name": + out.Values[i] = ec._Column_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec._Column_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "primaryKey": + out.Values[i] = ec._Column_primaryKey(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "nullable": + out.Values[i] = ec._Column_nullable(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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var commitImplementors = []string{"Commit"} + +func (ec *executionContext) _Commit(ctx context.Context, sel ast.SelectionSet, obj *model1.Commit) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, commitImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Commit") + case "hash": + out.Values[i] = ec._Commit_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "author": + out.Values[i] = ec._Commit_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "email": + out.Values[i] = ec._Commit_email(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "date": + out.Values[i] = ec._Commit_date(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._Commit_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "parents": + out.Values[i] = ec._Commit_parents(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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var commitCursorImplementors = []string{"CommitCursor"} + +func (ec *executionContext) _CommitCursor(ctx context.Context, sel ast.SelectionSet, obj *model1.CommitCursor) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, commitCursorImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CommitCursor") + case "results": + out.Values[i] = ec._CommitCursor_results(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "cursor": + out.Values[i] = ec._CommitCursor_cursor(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + 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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var databaseImplementors = []string{"Database"} + +func (ec *executionContext) _Database(ctx context.Context, sel ast.SelectionSet, obj *model1.Database) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, databaseImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Database") + case "id": + out.Values[i] = ec._Database_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "name": + out.Values[i] = ec._Database_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "owner": + out.Values[i] = ec._Database_owner(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "description": + out.Values[i] = ec._Database_description(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "visibility": + out.Values[i] = ec._Database_visibility(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "created": + out.Values[i] = ec._Database_created(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "updated": + out.Values[i] = ec._Database_updated(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "defaultBranch": + 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._Database_defaultBranch(ctx, field, obj) + if res == graphql.RequiredNull { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.IsDeferred() { + deferredFieldSet.AddField(field) + fieldIndex := len(deferredFieldSet.Values) - 1 + deferredFieldSet.Concurrently(fieldIndex, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, deferredFieldSet) + }) + + for _, deferrable := range field.Deferrables { + view, ok := deferLabelToView[deferrable.Label] + if !ok { + view = deferredFieldSet.NewView() + deferLabelToView[deferrable.Label] = view + } + view.AddIndices(fieldIndex) + } + + // 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 "branches": + 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._Database_branches(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.IsDeferred() { + deferredFieldSet.AddField(field) + fieldIndex := len(deferredFieldSet.Values) - 1 + deferredFieldSet.Concurrently(fieldIndex, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, deferredFieldSet) + }) + + for _, deferrable := range field.Deferrables { + view, ok := deferLabelToView[deferrable.Label] + if !ok { + view = deferredFieldSet.NewView() + deferLabelToView[deferrable.Label] = view + } + view.AddIndices(fieldIndex) + } + + // 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 "log": + 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._Database_log(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.IsDeferred() { + deferredFieldSet.AddField(field) + fieldIndex := len(deferredFieldSet.Values) - 1 + deferredFieldSet.Concurrently(fieldIndex, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, deferredFieldSet) + }) + + for _, deferrable := range field.Deferrables { + view, ok := deferLabelToView[deferrable.Label] + if !ok { + view = deferredFieldSet.NewView() + deferLabelToView[deferrable.Label] = view + } + view.AddIndices(fieldIndex) + } + + // 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 "tables": + 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._Database_tables(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.IsDeferred() { + deferredFieldSet.AddField(field) + fieldIndex := len(deferredFieldSet.Values) - 1 + deferredFieldSet.Concurrently(fieldIndex, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, deferredFieldSet) + }) + + for _, deferrable := range field.Deferrables { + view, ok := deferLabelToView[deferrable.Label] + if !ok { + view = deferredFieldSet.NewView() + deferLabelToView[deferrable.Label] = view + } + view.AddIndices(fieldIndex) + } + + // 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 "acl": + 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._Database_acl(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.IsDeferred() { + deferredFieldSet.AddField(field) + fieldIndex := len(deferredFieldSet.Values) - 1 + deferredFieldSet.Concurrently(fieldIndex, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, deferredFieldSet) + }) + + for _, deferrable := range field.Deferrables { + view, ok := deferLabelToView[deferrable.Label] + if !ok { + view = deferredFieldSet.NewView() + deferLabelToView[deferrable.Label] = view + } + view.AddIndices(fieldIndex) + } + + // 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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var databaseCursorImplementors = []string{"DatabaseCursor"} + +func (ec *executionContext) _DatabaseCursor(ctx context.Context, sel ast.SelectionSet, obj *model1.DatabaseCursor) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, databaseCursorImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DatabaseCursor") + case "results": + out.Values[i] = ec._DatabaseCursor_results(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "cursor": + out.Values[i] = ec._DatabaseCursor_cursor(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + 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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var queryImplementors = []string{"Query"} + +func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "me": + 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_me(ctx, field) + if res == graphql.RequiredNull { + 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 "databases": + 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_databases(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 "databasesByOwner": + 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_databasesByOwner(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 "database": + 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_database(ctx, field) + if res == graphql.RequiredNull { + 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 "__type": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___type(ctx, field) + }) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___schema(ctx, field) + }) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var tableImplementors = []string{"Table"} + +func (ec *executionContext) _Table(ctx context.Context, sel ast.SelectionSet, obj *model1.Table) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, tableImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Table") + case "name": + out.Values[i] = ec._Table_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "columns": + out.Values[i] = ec._Table_columns(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "rowCount": + out.Values[i] = ec._Table_rowCount(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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var userImplementors = []string{"User"} + +func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *model1.User) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("User") + case "username": + out.Values[i] = ec._User_username(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "canonicalName": + out.Values[i] = ec._User_canonicalName(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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var __DirectiveImplementors = []string{"__Directive"} + +func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Directive") + case "name": + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Directive_description(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "locations": + out.Values[i] = ec.___Directive_locations(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + out.Values[i] = ec.___Directive_args(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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var __EnumValueImplementors = []string{"__EnumValue"} + +func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__EnumValue") + case "name": + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + 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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var __FieldImplementors = []string{"__Field"} + +func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Field") + case "name": + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Field_description(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "args": + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + 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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var __InputValueImplementors = []string{"__InputValue"} + +func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ec.___InputValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "type": + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___InputValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___InputValue_deprecationReason(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + 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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var __SchemaImplementors = []string{"__Schema"} + +func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Schema") + case "description": + out.Values[i] = ec.___Schema_description(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "types": + out.Values[i] = ec.___Schema_types(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "queryType": + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "subscriptionType": + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "directives": + out.Values[i] = ec.___Schema_directives(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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var __TypeImplementors = []string{"__Type"} + +func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ec.___Type_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.___Type_name(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Type_description(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "specifiedByURL": + out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "fields": + out.Values[i] = ec.___Type_fields(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "interfaces": + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "possibleTypes": + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "enumValues": + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "inputFields": + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "ofType": + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "isOneOf": + out.Values[i] = ec.___Type_isOneOf(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + 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(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) marshalNACLEntry2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐACLEntryᚄ(ctx context.Context, sel ast.SelectionSet, v []*model1.ACLEntry) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNACLEntry2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐACLEntry(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNACLEntry2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐACLEntry(ctx context.Context, sel ast.SelectionSet, v *model1.ACLEntry) 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._ACLEntry(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNAccessMode2sourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐAccessMode(ctx context.Context, v any) (model1.AccessMode, error) { + var res model1.AccessMode + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNAccessMode2sourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐAccessMode(ctx context.Context, sel ast.SelectionSet, v model1.AccessMode) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v any) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + _ = sel + res := graphql.MarshalBoolean(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNBranch2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐBranchᚄ(ctx context.Context, sel ast.SelectionSet, v []*model1.Branch) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNBranch2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐBranch(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNBranch2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐBranch(ctx context.Context, sel ast.SelectionSet, v *model1.Branch) 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._Branch(ctx, sel, v) +} + +func (ec *executionContext) marshalNColumn2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐColumnᚄ(ctx context.Context, sel ast.SelectionSet, v []*model1.Column) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNColumn2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐColumn(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNColumn2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐColumn(ctx context.Context, sel ast.SelectionSet, v *model1.Column) 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._Column(ctx, sel, v) +} + +func (ec *executionContext) marshalNCommit2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐCommitᚄ(ctx context.Context, sel ast.SelectionSet, v []*model1.Commit) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNCommit2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐCommit(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNCommit2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐCommit(ctx context.Context, sel ast.SelectionSet, v *model1.Commit) 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._Commit(ctx, sel, v) +} + +func (ec *executionContext) marshalNCommitCursor2sourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐCommitCursor(ctx context.Context, sel ast.SelectionSet, v model1.CommitCursor) graphql.Marshaler { + return ec._CommitCursor(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCommitCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐCommitCursor(ctx context.Context, sel ast.SelectionSet, v *model1.CommitCursor) 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._CommitCursor(ctx, sel, v) +} + +func (ec *executionContext) marshalNDatabase2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabaseᚄ(ctx context.Context, sel ast.SelectionSet, v []*model1.Database) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNDatabase2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabase(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNDatabase2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabase(ctx context.Context, sel ast.SelectionSet, v *model1.Database) 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._Database(ctx, sel, v) +} + +func (ec *executionContext) marshalNDatabaseCursor2sourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabaseCursor(ctx context.Context, sel ast.SelectionSet, v model1.DatabaseCursor) graphql.Marshaler { + return ec._DatabaseCursor(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDatabaseCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabaseCursor(ctx context.Context, sel ast.SelectionSet, v *model1.DatabaseCursor) 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._DatabaseCursor(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v any) (int, error) { + res, err := graphql.UnmarshalInt(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { + _ = sel + res := graphql.MarshalInt(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { + vSlice := graphql.CoerceList(v) + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNString2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTable2ᚕᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐTableᚄ(ctx context.Context, sel ast.SelectionSet, v []*model1.Table) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNTable2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐTable(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTable2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐTable(ctx context.Context, sel ast.SelectionSet, v *model1.Table) 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._Table(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v any) (time.Time, error) { + res, err := graphql.UnmarshalTime(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { + _ = sel + res := graphql.MarshalTime(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNUser2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model1.User) 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._User(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNVisibility2sourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐVisibility(ctx context.Context, v any) (model1.Visibility, error) { + var res model1.Visibility + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNVisibility2sourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐVisibility(ctx context.Context, sel ast.SelectionSet, v model1.Visibility) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ec.___Directive(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { + vSlice := graphql.CoerceList(v) + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ec.___EnumValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ec.___Field(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ec.___InputValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ec.___Type(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) 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.___Type(ctx, sel, v) +} + +func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v any) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + _ = sel + _ = ctx + res := graphql.MarshalBoolean(v) + return res +} + +func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v any) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalBoolean(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalBoolean(*v) + return res +} + +func (ec *executionContext) unmarshalOCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐCursor(ctx context.Context, v any) (*model.Cursor, error) { + if v == nil { + return nil, nil + } + var res = new(model.Cursor) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOCursor2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐCursor(ctx context.Context, sel ast.SelectionSet, v *model.Cursor) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) marshalODatabase2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐDatabase(ctx context.Context, sel ast.SelectionSet, v *model1.Database) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Database(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOFilter2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑcoreᚋmodelᚐFilter(ctx context.Context, v any) (*model.Filter, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputFilter(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v any) (*int, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalInt(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalInt(*v) + return res +} + +func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v any) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalString(*v) + return res +} + +func (ec *executionContext) marshalOUser2ᚖsourcecraftᚗdevᚋbigbesᚋsrᚑhtᚑdoltᚋgraphᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model1.User) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._User(ctx, sel, v) +} + +func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Schema(ctx, sel, v) +} + +func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/graph/generate.go b/graph/generate.go new file mode 100644 index 0000000000000000000000000000000000000000..c8a01d5d67023cdde18751b4b67e5e6c725b4c19 --- /dev/null +++ b/graph/generate.go @@ -0,0 +1,20 @@ +package graph + +// Code generation. gqlgen reads gqlgen.yml in this directory and rewrites +// api/generated.go, model/models_gen.go and the stubs in schema.resolvers.go; +// implementations already in that file are carried through untouched. +// +// It is pinned to the same version this module requires, and run as a +// module-independent `go run …@v`, so the codegen dependency tree — a CLI +// framework, the Go analysis packages — stays out of this service's go.mod and +// go.sum entirely. +// +// That form does not work with every gqlgen: spec.sr.ht records that +// v0.17.36 cannot be run this way, and it still cannot — its module pins +// golang.org/x/tools v0.9.3, which this toolchain refuses to compile ("invalid +// array length -delta * delta"). v0.17.94 pins a version that does. If a bump +// ever brings that failure back, the fallback is `go get -tool` and `go tool +// gqlgen`, which resolves the tool through this module's own graph at the cost +// of a tool block in go.mod. +// +//go:generate go run github.com/99designs/gqlgen@v0.17.94 generate diff --git a/graph/gqlgen.yml b/graph/gqlgen.yml new file mode 100644 index 0000000000000000000000000000000000000000..9574a772dfb1351cc341dae2985b43c97cddab41 --- /dev/null +++ b/graph/gqlgen.yml @@ -0,0 +1,61 @@ +# gqlgen configuration. Run `go generate ./graph` from the repository root, or +# `gqlgen` from this directory; every path below is relative to this file. +# +# The layout is spec.sr.ht's, which is git.sr.ht's api/: the schema beside the +# resolvers, the executable schema in its own package so nothing but the server +# touches it, and the models autobound by name. +schema: + - schema.graphqls + +exec: + filename: api/generated.go + package: api + +model: + filename: model/models_gen.go + package: model + +resolver: + layout: follow-schema + dir: . + package: graph + +# Federating into api.sr.ht is a config line on the gateway — `api-origin=` +# pointing at our own /query — and not a build-time decision here. Nothing in +# this schema depends on the gateway existing. + +autobind: + - "sourcecraft.dev/bigbes/sr-ht-dolt/graph/model" + +models: + # Everything a database's own store or a second query answers is a field + # resolver, never a struct field: a listing must not open one bare store per + # row to answer a query that asked for names. model.Database is hand-written + # for the same reason — see the comment there. + Database: + fields: + defaultBranch: {resolver: true} + branches: {resolver: true} + log: {resolver: true} + tables: {resolver: true} + acl: {resolver: true} + # core-go's cursor, so pagination here is opaque and encrypted exactly as it + # is on every other service of the instance rather than being a page number + # this schema would then have to keep honest. + Cursor: + model: + - sourcecraft.dev/bigbes/sr-ht-core/model.Cursor + # And core-go's filter beside it, so "count" means here what it means on + # every other service of the instance. + Filter: + model: + - sourcecraft.dev/bigbes/sr-ht-core/model.Filter + # Ids are the repository table's serial; Int is 32-bit in GraphQL and the + # column is a 32-bit serial, so the Go type is int and not int64. + Int: + model: + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + +omit_getters: true diff --git a/graph/graph_test.go b/graph/graph_test.go new file mode 100644 index 0000000000000000000000000000000000000000..8e9d6533d6dd235f50063b931f052fb49216355c --- /dev/null +++ b/graph/graph_test.go @@ -0,0 +1,787 @@ +package graph + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "net/http" + "net/http/httptest" + "strings" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "sourcecraft.dev/bigbes/sr-ht-core/auth" + + "sourcecraft.dev/bigbes/sr-ht-ecore/ecoretest" + + "sourcecraft.dev/bigbes/sr-ht-dolt/authn" + "sourcecraft.dev/bigbes/sr-ht-dolt/browse" + "sourcecraft.dev/bigbes/sr-ht-dolt/core" + "sourcecraft.dev/bigbes/sr-ht-dolt/db" +) + +// TestMain seeds the process-global crypto state: the pagination cursor is +// core-go's, which encrypts itself with the instance keys. +func TestMain(m *testing.M) { + ecoretest.InitCrypto() + m.Run() +} + +// --- fakes ------------------------------------------------------------------- + +type fakeRepos struct { + repos map[string]*core.Repo // "owner/name" + order []*core.Repo // listing order, newest first + acls map[int]map[int]core.AccessMode + names map[int]string // user id -> username, for ListACL + + listErr error + getErr error + accessErr error +} + +func newFakeRepos() *fakeRepos { + return &fakeRepos{ + repos: map[string]*core.Repo{}, + acls: map[int]map[int]core.AccessMode{}, + names: map[int]string{}, + } +} + +func (f *fakeRepos) add(r *core.Repo) *core.Repo { + r.ID = len(f.order) + 1 + r.Path = "/var/lib/dolt/~" + r.OwnerName + "/" + r.Name + if r.Created.IsZero() { + r.Created = time.Date(2026, 8, 15, 12, 0, 0, 0, time.UTC) + r.Updated = r.Created + } + f.repos[r.OwnerName+"/"+r.Name] = r + // Newest first, as the store's ORDER BY created DESC, id DESC yields. + f.order = append([]*core.Repo{r}, f.order...) + f.names[r.OwnerID] = r.OwnerName + return r +} + +func (f *fakeRepos) grant(repoID, userID int, mode core.AccessMode, username string) { + if f.acls[repoID] == nil { + f.acls[repoID] = map[int]core.AccessMode{} + } + f.acls[repoID][userID] = mode + f.names[userID] = username +} + +func (f *fakeRepos) GetRepoByOwnerAndName(_ context.Context, owner, name string) (*core.Repo, error) { + if f.getErr != nil { + return nil, f.getErr + } + r, ok := f.repos[owner+"/"+name] + if !ok { + return nil, db.ErrNotFound + } + return r, nil +} + +// visible mirrors db.Store's listing rule: PUBLIC to everyone, plus whatever the +// viewer owns or holds an ACL entry on. +func (f *fakeRepos) visible(r *core.Repo, viewer *core.Caller) bool { + if r.Visibility == core.VisibilityPublic { + return true + } + if viewer == nil { + return false + } + if viewer.UserID == r.OwnerID { + return true + } + _, ok := f.acls[r.ID][viewer.UserID] + return ok +} + +func (f *fakeRepos) ListReposForViewer(_ context.Context, viewer *core.Caller) ([]*core.Repo, error) { + if f.listErr != nil { + return nil, f.listErr + } + var out []*core.Repo + for _, r := range f.order { + if f.visible(r, viewer) { + out = append(out, r) + } + } + return out, nil +} + +func (f *fakeRepos) ListReposByOwner(ctx context.Context, owner string, viewer *core.Caller) ([]*core.Repo, error) { + all, err := f.ListReposForViewer(ctx, viewer) + if err != nil { + return nil, err + } + var out []*core.Repo + for _, r := range all { + if r.OwnerName == owner { + out = append(out, r) + } + } + return out, nil +} + +func (f *fakeRepos) EffectiveAccess(_ context.Context, userID, repoID int) (*core.AccessMode, error) { + if f.accessErr != nil { + return nil, f.accessErr + } + mode, ok := f.acls[repoID][userID] + if !ok { + return nil, nil + } + return &mode, nil +} + +func (f *fakeRepos) ListACL(_ context.Context, repoID int) ([]*db.ACLEntry, error) { + var out []*db.ACLEntry + for uid, mode := range f.acls[repoID] { + out = append(out, &db.ACLEntry{RepoID: repoID, UserID: uid, Username: f.names[uid], Mode: mode}) + } + return out, nil +} + +type fakeSession struct { + branches []browse.Branch + commits []browse.CommitInfo + next string + tables []browse.TableInfo + err error + + logRef string + logFrom string + logLimit int + closed bool +} + +func (s *fakeSession) Branches(context.Context) ([]browse.Branch, error) { + return s.branches, s.err +} + +func (s *fakeSession) Log(_ context.Context, ref, from string, limit int) ([]browse.CommitInfo, string, error) { + s.logRef, s.logFrom, s.logLimit = ref, from, limit + return s.commits, s.next, s.err +} + +func (s *fakeSession) Tables(context.Context, string) ([]browse.TableInfo, error) { + return s.tables, s.err +} + +func (s *fakeSession) Close() error { s.closed = true; return nil } + +type fakeOpener struct { + sess *fakeSession + openErr error + + mu sync.Mutex + opens []string +} + +func (o *fakeOpener) Open(_ context.Context, diskPath string) (BrowseSession, error) { + o.mu.Lock() + o.opens = append(o.opens, diskPath) + o.mu.Unlock() + if o.openErr != nil { + return nil, o.openErr + } + if o.sess == nil { + o.sess = &fakeSession{} + } + return o.sess, nil +} + +func (o *fakeOpener) count() int { + o.mu.Lock() + defer o.mu.Unlock() + return len(o.opens) +} + +// --- harness ----------------------------------------------------------------- + +type harness struct { + server *Server + repos *fakeRepos + opener *fakeOpener +} + +func newHarness(t *testing.T) *harness { + t.Helper() + repos, opener := newFakeRepos(), &fakeOpener{} + srv, err := New(Options{Repos: repos, Browse: opener}) + require.NoError(t, err) + return &harness{server: srv, repos: repos, opener: opener} +} + +// gqlResponse is the GraphQL envelope: data and errors travel together, and a +// resolver that refused shows up in errors with data still present. +type gqlResponse struct { + Data json.RawMessage `json:"data"` + Errors []struct { + Message string `json:"message"` + Path []any `json:"path"` + } `json:"errors"` +} + +// query POSTs a query as caller (nil for anonymous) and returns the raw +// recorder plus the decoded envelope. +func (h *harness) query(t *testing.T, caller *auth.AuthContext, q string) (*httptest.ResponseRecorder, gqlResponse) { + t.Helper() + + body, err := json.Marshal(map[string]any{"query": q}) + require.NoError(t, err) + + req := httptest.NewRequest(http.MethodPost, "/query", strings.NewReader(string(body))) + req.Header.Set("Content-Type", "application/json") + if caller != nil { + req = req.WithContext(authn.WithCaller(req.Context(), caller)) + } + + rec := httptest.NewRecorder() + h.server.ServeHTTP(rec, req) + + var out gqlResponse + if rec.Body.Len() > 0 && strings.HasPrefix(rec.Header().Get("Content-Type"), "application/json") { + require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &out), "body: %s", rec.Body.String()) + } + return rec, out +} + +// ok asserts the query succeeded and unmarshals data into v. +func (h *harness) ok(t *testing.T, caller *auth.AuthContext, q string, v any) { + t.Helper() + rec, resp := h.query(t, caller, q) + require.Equal(t, http.StatusOK, rec.Code) + require.Empty(t, resp.Errors, "unexpected GraphQL errors: %+v", resp.Errors) + require.NoError(t, json.Unmarshal(resp.Data, v)) +} + +func testCaller(id int, name string) *auth.AuthContext { + return &auth.AuthContext{UserID: id, Username: name, UserType: auth.USER_TYPE_USER} +} + +// seed is one instance: alice owns a public, an unlisted and a private +// database; bob owns a public one and holds RO on alice's private one. +func (h *harness) seed() { + h.repos.add(&core.Repo{Name: "widgets", OwnerID: 1, OwnerName: "alice", + Description: "public things", Visibility: core.VisibilityPublic}) + h.repos.add(&core.Repo{Name: "drafts", OwnerID: 1, OwnerName: "alice", + Visibility: core.VisibilityUnlisted}) + priv := h.repos.add(&core.Repo{Name: "secrets", OwnerID: 1, OwnerName: "alice", + Visibility: core.VisibilityPrivate}) + h.repos.add(&core.Repo{Name: "gadgets", OwnerID: 2, OwnerName: "bob", + Visibility: core.VisibilityPublic}) + h.repos.grant(priv.ID, 2, core.AccessRO, "bob") + h.repos.names[1] = "alice" +} + +// --- the listing -------------------------------------------------------------- + +// The query that started this: what an anonymous caller and each user see from +// the same endpoint. The listing rule is the store's, and the schema must not +// widen it. +func TestDatabasesListsWhatTheCallerMaySee(t *testing.T) { + type listing struct { + Databases struct { + Results []struct { + Name string `json:"name"` + Visibility string `json:"visibility"` + Owner struct { + Username string `json:"username"` + CanonicalName string `json:"canonicalName"` + } `json:"owner"` + } `json:"results"` + Cursor *string `json:"cursor"` + } `json:"databases"` + } + const q = `{ databases { results { name visibility owner { username canonicalName } } cursor } }` + + for _, tc := range []struct { + name string + caller *auth.AuthContext + want []string + }{ + {"anonymous sees only PUBLIC", nil, []string{"gadgets", "widgets"}}, + {"a stranger sees the same as anonymous", testCaller(9, "carol"), []string{"gadgets", "widgets"}}, + {"the owner sees all of their own", testCaller(1, "alice"), []string{"gadgets", "secrets", "drafts", "widgets"}}, + {"an ACL holder additionally sees what they were granted", testCaller(2, "bob"), []string{"gadgets", "secrets", "widgets"}}, + } { + t.Run(tc.name, func(t *testing.T) { + h := newHarness(t) + h.seed() + + var got listing + h.ok(t, tc.caller, q, &got) + + var names []string + for _, r := range got.Databases.Results { + names = append(names, r.Name) + } + assert.Equal(t, tc.want, names) + assert.Nil(t, got.Databases.Cursor, "one page holds this instance") + + for _, r := range got.Databases.Results { + assert.Equal(t, "~"+r.Owner.Username, r.Owner.CanonicalName) + } + }) + } +} + +// A listing must not open a single bare store. This is what the hand-written +// model and the resolver:true fields in gqlgen.yml buy, and it is the kind of +// thing that regresses silently the day someone adds a field to the struct. +func TestAMetadataQueryOpensNoStore(t *testing.T) { + h := newHarness(t) + h.seed() + + var got struct{} + h.ok(t, testCaller(1, "alice"), `{ databases { results { name visibility description created } } }`, &got) + + assert.Zero(t, h.opener.count(), "a metadata-only query opened a store") +} + +func TestDatabasesByOwner(t *testing.T) { + h := newHarness(t) + h.seed() + + var got struct { + DatabasesByOwner struct { + Results []struct { + Name string `json:"name"` + } `json:"results"` + } `json:"databasesByOwner"` + } + h.ok(t, nil, `{ databasesByOwner(owner: "alice") { results { name } } }`, &got) + + require.Len(t, got.DatabasesByOwner.Results, 1) + assert.Equal(t, "widgets", got.DatabasesByOwner.Results[0].Name) +} + +// --- one database ------------------------------------------------------------ + +// A database the caller may not see is null and not an error: the two answers +// are one, so its existence cannot be read out of the shape of the refusal. +func TestDatabaseHidesWhatTheCallerMayNotSee(t *testing.T) { + const q = `{ database(owner: "alice", name: "%s") { name visibility } }` + + for _, tc := range []struct { + name string + caller *auth.AuthContext + db string + want bool + }{ + {"a private database is invisible to a stranger", testCaller(9, "carol"), "secrets", false}, + {"and to an anonymous caller", nil, "secrets", false}, + {"an unlisted one is readable by direct address", nil, "drafts", true}, + {"the owner reads their private one", testCaller(1, "alice"), "secrets", true}, + {"an ACL holder reads it too", testCaller(2, "bob"), "secrets", true}, + {"a database that does not exist", testCaller(1, "alice"), "nope", false}, + } { + t.Run(tc.name, func(t *testing.T) { + h := newHarness(t) + h.seed() + + rec, resp := h.query(t, tc.caller, fmt.Sprintf(q, tc.db)) + require.Equal(t, http.StatusOK, rec.Code) + require.Empty(t, resp.Errors, "a refusal must be null, not an error: %+v", resp.Errors) + + var got struct { + Database *struct { + Name string `json:"name"` + } `json:"database"` + } + require.NoError(t, json.Unmarshal(resp.Data, &got)) + if tc.want { + require.NotNil(t, got.Database) + assert.Equal(t, tc.db, got.Database.Name) + } else { + assert.Nil(t, got.Database) + } + }) + } +} + +// The ACL of a database you do not own is not yours to enumerate. It is the +// empty list rather than an error, so asking is not a way to learn who is on it. +func TestACLIsOwnerOnly(t *testing.T) { + const q = `{ database(owner: "alice", name: "secrets") { acl { mode user { username } } } }` + + h := newHarness(t) + h.seed() + + var owner struct { + Database struct { + ACL []struct { + Mode string `json:"mode"` + User struct { + Username string `json:"username"` + } `json:"user"` + } `json:"acl"` + } `json:"database"` + } + h.ok(t, testCaller(1, "alice"), q, &owner) + require.Len(t, owner.Database.ACL, 1) + assert.Equal(t, "bob", owner.Database.ACL[0].User.Username) + assert.Equal(t, "RO", owner.Database.ACL[0].Mode) + + // bob may READ the database — he holds the grant — and still may not see + // who else does. + var grantee struct { + Database struct { + ACL []json.RawMessage `json:"acl"` + } `json:"database"` + } + h.ok(t, testCaller(2, "bob"), q, &grantee) + assert.Empty(t, grantee.Database.ACL) +} + +func TestMeIsTheCallerOrNull(t *testing.T) { + h := newHarness(t) + h.seed() + + var anon struct { + Me *struct{} `json:"me"` + } + h.ok(t, nil, `{ me { username } }`, &anon) + assert.Nil(t, anon.Me, "anonymous is an answer here, not an error") + + var known struct { + Me struct { + Username string `json:"username"` + CanonicalName string `json:"canonicalName"` + } `json:"me"` + } + h.ok(t, testCaller(1, "alice"), `{ me { username canonicalName } }`, &known) + assert.Equal(t, "alice", known.Me.Username) + assert.Equal(t, "~alice", known.Me.CanonicalName) +} + +// --- the browse fields -------------------------------------------------------- + +func TestBranchesLogAndTables(t *testing.T) { + h := newHarness(t) + h.seed() + when := time.Date(2026, 8, 14, 9, 30, 0, 0, time.UTC) + h.opener.sess = &fakeSession{ + branches: []browse.Branch{{Name: "main", Head: "abc"}, {Name: "topic", Head: "def"}}, + commits: []browse.CommitInfo{{ + Hash: "abc", Author: "alice", Email: "a@b.test", Date: when, + Message: "init", ParentHashes: []string{"aaa"}, + }}, + next: "older", + tables: []browse.TableInfo{{ + Name: "issues", + RowCount: 7, + Columns: []browse.ColumnInfo{{Name: "id", Type: "int", PrimaryKey: true}}, + }}, + } + + var got struct { + Database struct { + DefaultBranch string `json:"defaultBranch"` + Branches []struct { + Name string `json:"name"` + Head string `json:"head"` + } `json:"branches"` + Log struct { + Results []struct { + Hash string `json:"hash"` + Author string `json:"author"` + Date time.Time `json:"date"` + Parents []string `json:"parents"` + } `json:"results"` + Cursor *string `json:"cursor"` + } `json:"log"` + Tables []struct { + Name string `json:"name"` + RowCount int `json:"rowCount"` + Columns []struct { + Name string `json:"name"` + PrimaryKey bool `json:"primaryKey"` + } `json:"columns"` + } `json:"tables"` + } `json:"database"` + } + h.ok(t, nil, `{ database(owner: "alice", name: "widgets") { + defaultBranch + branches { name head } + log { results { hash author date parents } cursor } + tables { name rowCount columns { name primaryKey } } + } }`, &got) + + assert.Equal(t, "main", got.Database.DefaultBranch) + require.Len(t, got.Database.Branches, 2) + assert.Equal(t, "abc", got.Database.Branches[0].Head) + + require.Len(t, got.Database.Log.Results, 1) + assert.Equal(t, when, got.Database.Log.Results[0].Date) + assert.Equal(t, []string{"aaa"}, got.Database.Log.Results[0].Parents) + assert.NotNil(t, got.Database.Log.Cursor, "browse reported more history, so the page must carry a cursor") + + require.Len(t, got.Database.Tables, 1) + assert.Equal(t, 7, got.Database.Tables[0].RowCount) + assert.True(t, got.Database.Tables[0].Columns[0].PrimaryKey) + + // The default branch is what a field with no ref reads. + assert.Equal(t, "main", h.opener.sess.logRef) + assert.Equal(t, defaultLogLimit, h.opener.sess.logLimit) + assert.True(t, h.opener.sess.closed, "every session a resolver opens is closed") +} + +// A database nothing has been pushed to has no branches. That is a state, not a +// failure, and every field says so in its own vocabulary rather than erroring. +func TestAnEmptyDatabaseIsAStateAndNotAFailure(t *testing.T) { + h := newHarness(t) + h.seed() + h.opener.sess = &fakeSession{} // no branches, no commits, no tables + + var got struct { + Database struct { + DefaultBranch *string `json:"defaultBranch"` + Branches []any `json:"branches"` + Log struct { + Results []any `json:"results"` + Cursor *string `json:"cursor"` + } `json:"log"` + Tables []any `json:"tables"` + } `json:"database"` + } + h.ok(t, nil, `{ database(owner: "alice", name: "widgets") { + defaultBranch branches { name } log { results { hash } cursor } tables { name } + } }`, &got) + + assert.Nil(t, got.Database.DefaultBranch) + assert.Empty(t, got.Database.Branches) + assert.Empty(t, got.Database.Log.Results) + assert.Nil(t, got.Database.Log.Cursor) + assert.Empty(t, got.Database.Tables) +} + +// A store that will not open is an error on that field — the database exists and +// the caller may read it — and the store layer's own text, which carries the +// on-disk path, never travels with it. +func TestAStoreThatWillNotOpenIsAnErrorAndSaysNothingAboutDisk(t *testing.T) { + h := newHarness(t) + h.seed() + h.opener.openErr = errors.New("open /var/lib/dolt/~alice/widgets: manifest is corrupt") + + rec, resp := h.query(t, nil, `{ database(owner: "alice", name: "widgets") { name branches { name } } }`) + require.Equal(t, http.StatusOK, rec.Code) + require.NotEmpty(t, resp.Errors) + + body := rec.Body.String() + assert.Contains(t, body, "could not be read") + assert.NotContains(t, body, "/var/lib/dolt", "the store's path must not reach the reader") + assert.NotContains(t, body, "manifest is corrupt") +} + +// The metadata store being unreachable is not "there is nothing here". A +// listing that answered an empty set on a failed query would tell a client a +// false fact about the instance. +func TestAnUnreachableStoreIsAnErrorAndNotAnEmptyListing(t *testing.T) { + h := newHarness(t) + h.seed() + h.repos.listErr = errors.New("dial tcp 10.0.0.5:5432: connect: connection refused") + + rec, resp := h.query(t, nil, `{ databases { results { name } } }`) + require.Equal(t, http.StatusOK, rec.Code) + require.NotEmpty(t, resp.Errors) + assert.NotContains(t, rec.Body.String(), "10.0.0.5", "the connection string must not reach the reader") +} + +// An ACL lookup that fails is an error, not a fall-through to visibility: a +// caller holding a grant must never be told the database is not there because +// the grant could not be checked. +func TestAnUncheckableGrantIsNotADenial(t *testing.T) { + h := newHarness(t) + h.seed() + h.repos.accessErr = errors.New("dial tcp: connection refused") + + rec, resp := h.query(t, testCaller(2, "bob"), `{ database(owner: "alice", name: "secrets") { name } }`) + require.Equal(t, http.StatusOK, rec.Code) + require.NotEmpty(t, resp.Errors, "an unreadable grant answered as 'no such database'") +} + +// --- paging ------------------------------------------------------------------- + +// The cursor is opaque and encrypted, so a test walks it exactly as a client +// does: read a page, hand the cursor back, and check the pages tile the listing +// without gaps or repeats. +func TestTheListingPagesWithItsOwnCursor(t *testing.T) { + h := newHarness(t) + for i := range 5 { + h.repos.add(&core.Repo{ + Name: fmt.Sprintf("db%d", i), OwnerID: 1, OwnerName: "alice", + Visibility: core.VisibilityPublic, + }) + } + + type pageResp struct { + Databases struct { + Results []struct { + Name string `json:"name"` + } `json:"results"` + Cursor *string `json:"cursor"` + } `json:"databases"` + } + + var got pageResp + h.ok(t, nil, `{ databases { results { name } cursor } }`, &got) + require.Len(t, got.Databases.Results, 5, "the default page holds this instance") + assert.Nil(t, got.Databases.Cursor) + + // Walk it two at a time, exactly as a client does: the page size is given + // once, and every later page is addressed by the cursor the previous one + // returned. + var seen []string + var pages int + h.ok(t, nil, `{ databases(filter: {count: 2}) { results { name } cursor } }`, &got) + for { + pages++ + require.LessOrEqual(t, len(got.Databases.Results), 2, "a page overran the count it was given") + for _, r := range got.Databases.Results { + seen = append(seen, r.Name) + } + if got.Databases.Cursor == nil { + break + } + require.Less(t, pages, 10, "the walk did not terminate") + h.ok(t, nil, fmt.Sprintf(`{ databases(cursor: %q) { results { name } cursor } }`, + *got.Databases.Cursor), &got) + } + + assert.Equal(t, 3, pages, "five rows, two at a time") + assert.Equal(t, []string{"db4", "db3", "db2", "db1", "db0"}, seen, + "the pages tile the listing, newest first, with no gap and no repeat") +} + +// The count is the surface's to cap. A client asking for the whole instance in +// one page gets the cap, not the ask. +func TestThePageSizeIsCapped(t *testing.T) { + h := newHarness(t) + for i := range maxPageSize + 10 { + h.repos.add(&core.Repo{ + Name: fmt.Sprintf("db%d", i), OwnerID: 1, OwnerName: "alice", + Visibility: core.VisibilityPublic, + }) + } + + var got struct { + Databases struct { + Results []struct { + Name string `json:"name"` + } `json:"results"` + Cursor *string `json:"cursor"` + } `json:"databases"` + } + h.ok(t, nil, `{ databases(filter: {count: 100000}) { results { name } cursor } }`, &got) + + assert.Len(t, got.Databases.Results, maxPageSize) + assert.NotNil(t, got.Databases.Cursor, "the rest is still reachable, one page at a time") +} + +// A cursor whose row is gone — deleted, or made invisible to this caller — +// resumes at the next row rather than failing or silently starting over. +func TestAStaleCursorResumesRatherThanRestarting(t *testing.T) { + h := newHarness(t) + for i := range 4 { + h.repos.add(&core.Repo{ + Name: fmt.Sprintf("db%d", i), OwnerID: 1, OwnerName: "alice", + Visibility: core.VisibilityPublic, + }) + } + + var got struct { + Databases struct { + Results []struct { + Name string `json:"name"` + } `json:"results"` + Cursor *string `json:"cursor"` + } `json:"databases"` + } + h.ok(t, nil, `{ databases(filter: {count: 2}) { results { name } cursor } }`, &got) + require.NotNil(t, got.Databases.Cursor) + next := *got.Databases.Cursor + + // db1 is the row that cursor points at; drop it between the two pages. + delete(h.repos.repos, "alice/db1") + kept := h.repos.order[:0] + for _, r := range h.repos.order { + if r.Name != "db1" { + kept = append(kept, r) + } + } + h.repos.order = kept + + h.ok(t, nil, fmt.Sprintf(`{ databases(cursor: %q) { results { name } cursor } }`, next), &got) + + var names []string + for _, r := range got.Databases.Results { + names = append(names, r.Name) + } + assert.Equal(t, []string{"db0"}, names, + "the page resumes past the vanished row instead of restarting at the newest") +} + +// --- the credential plane ----------------------------------------------------- + +// A credential this endpoint cannot verify is refused, and refused with the +// challenge, so a client knows what to present. This is /mcp's middleware and +// the arms are the same. +func TestABadTokenIsRefusedWithAChallenge(t *testing.T) { + h := newHarness(t) + + req := httptest.NewRequest(http.MethodPost, "/query", + strings.NewReader(`{"query":"{ __typename }"}`)) + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Authorization", "Bearer not-a-real-token") + + rec := httptest.NewRecorder() + h.server.ServeHTTP(rec, req) + + require.Equal(t, http.StatusUnauthorized, rec.Code) + assert.NotEmpty(t, rec.Header().Get("WWW-Authenticate")) + assert.Contains(t, rec.Body.String(), "refused") +} + +// Introspection is deliberately on: a client that cannot introspect cannot +// generate a typed client, and every field is gated per caller anyway. +func TestIntrospectionAnswers(t *testing.T) { + h := newHarness(t) + + var got struct { + Schema struct { + QueryType struct { + Name string `json:"name"` + } `json:"queryType"` + } `json:"__schema"` + } + h.ok(t, nil, `{ __schema { queryType { name } } }`, &got) + assert.Equal(t, "Query", got.Schema.QueryType.Name) +} + +// A GET is not a transport this endpoint offers: a query in a URL is a +// cross-origin-readable address for data that is often private. +func TestGetIsNotATransport(t *testing.T) { + h := newHarness(t) + + rec := httptest.NewRecorder() + h.server.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/query?query={__typename}", nil)) + assert.NotEqual(t, http.StatusOK, rec.Code) +} + +func TestNewRequiresItsSeams(t *testing.T) { + _, err := New(Options{Browse: &fakeOpener{}}) + require.Error(t, err) + assert.Contains(t, err.Error(), "Repos") + + _, err = New(Options{Repos: newFakeRepos()}) + require.Error(t, err) + assert.Contains(t, err.Error(), "BrowseOpener") +} diff --git a/graph/model/database.go b/graph/model/database.go new file mode 100644 index 0000000000000000000000000000000000000000..fc92639234b0fc599798b4e18b6ece54a10fd0a1 --- /dev/null +++ b/graph/model/database.go @@ -0,0 +1,56 @@ +package model + +import ( + "time" + + "sourcecraft.dev/bigbes/sr-ht-dolt/core" +) + +// Database is hand-written rather than generated for one reason: the fields it +// does NOT carry. branches, log, tables and defaultBranch each open the bare +// store on disk, and acl is a second query against Postgres — as generated +// struct fields they would be computed for every database in a listing, whether +// or not the query asked for them. Absent here, gqlgen makes them field +// resolvers, so `{ databases { results { name visibility } } }` opens nothing. +// +// Repo is what those resolvers need and the schema never exposes: the row's id +// for an ACL lookup and its on-disk path for a browse session. +type Database struct { + ID int + Name string + Description string + Visibility Visibility + Created time.Time + Updated time.Time + Owner *User + + Repo *core.Repo +} + +// NewDatabase adapts a metadata row to the schema's type. The visibility enum +// is the same string the column holds, so it is converted and not mapped: a +// value the schema does not declare would be a value the database does not +// hold either. +func NewDatabase(repo *core.Repo) *Database { + return &Database{ + ID: repo.ID, + Name: repo.Name, + Description: repo.Description, + Visibility: Visibility(repo.Visibility), + Created: repo.Created, + Updated: repo.Updated, + Owner: NewUser(repo.OwnerName), + Repo: repo, + } +} + +// NewUser builds the schema's account type from a username with no leading "~". +// Both spellings are carried because both are asked for: the bare name +// addresses the account in a query and in a clone URL, and the canonical one is +// how SourceHut writes it everywhere else. +func NewUser(username string) *User { + if username == "" { + return nil + } + return &User{Username: username, CanonicalName: "~" + username} +} diff --git a/graph/model/doc.go b/graph/model/doc.go new file mode 100644 index 0000000000000000000000000000000000000000..43fb9e8d023a9ddf216c8e70c0e019c9198a7345 --- /dev/null +++ b/graph/model/doc.go @@ -0,0 +1,4 @@ +// Package model holds the GraphQL types of dolt.sr.ht's read schema. Most of it +// is generated from schema.graphqls (models_gen.go); this file exists so the +// package can be autobound before that file has been written for the first time. +package model diff --git a/graph/model/models_gen.go b/graph/model/models_gen.go new file mode 100644 index 0000000000000000000000000000000000000000..17aae87872af163fdde3322da6e957fbf03b67bb --- /dev/null +++ b/graph/model/models_gen.go @@ -0,0 +1,193 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package model + +import ( + "bytes" + "fmt" + "io" + "strconv" + "time" + + "sourcecraft.dev/bigbes/sr-ht-core/model" +) + +// An access grant on a database. +type ACLEntry struct { + User *User `json:"user"` + Mode AccessMode `json:"mode"` +} + +// A branch and the commit it points at. +type Branch struct { + Name string `json:"name"` + Head string `json:"head"` +} + +// A column of a table, as the stored schema declares it. +type Column struct { + Name string `json:"name"` + Type string `json:"type"` + PrimaryKey bool `json:"primaryKey"` + Nullable bool `json:"nullable"` +} + +// One commit of a database's history. +type Commit struct { + Hash string `json:"hash"` + Author string `json:"author"` + Email string `json:"email"` + Date time.Time `json:"date"` + Message string `json:"message"` + Parents []string `json:"parents"` +} + +type CommitCursor struct { + Results []*Commit `json:"results"` + Cursor *model.Cursor `json:"cursor,omitempty"` +} + +type DatabaseCursor struct { + Results []*Database `json:"results"` + Cursor *model.Cursor `json:"cursor,omitempty"` +} + +type Query struct { +} + +// A table at a ref: its schema and how many rows it holds there. +type Table struct { + Name string `json:"name"` + Columns []*Column `json:"columns"` + RowCount int `json:"rowCount"` +} + +// A SourceHut account, mirrored from meta.sr.ht. +type User struct { + // The username with no leading "~". This is the name that addresses the account + // in `database(owner:)` and in a clone URL's path. + Username string `json:"username"` + // The username with its leading "~", as SourceHut writes it in prose and in the + // web UI. + CanonicalName string `json:"canonicalName"` +} + +// An ACL grant: read-only (browse and clone) or read-write (and push). +type AccessMode string + +const ( + AccessModeRo AccessMode = "RO" + AccessModeRw AccessMode = "RW" +) + +var AllAccessMode = []AccessMode{ + AccessModeRo, + AccessModeRw, +} + +func (e AccessMode) IsValid() bool { + switch e { + case AccessModeRo, AccessModeRw: + return true + } + return false +} + +func (e AccessMode) String() string { + return string(e) +} + +func (e *AccessMode) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = AccessMode(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid AccessMode", str) + } + return nil +} + +func (e AccessMode) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *AccessMode) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e AccessMode) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} + +// Who may see a database, and how it is listed. +// +// PUBLIC is listed to everyone including anonymous callers. UNLISTED is reachable +// by direct address but never appears in a listing to a stranger. PRIVATE is +// neither: to a caller who may not see it, it does not exist — this schema answers +// null rather than an authorization error, exactly as the web UI answers "no such +// database" rather than "forbidden". +type Visibility string + +const ( + VisibilityPublic Visibility = "PUBLIC" + VisibilityUnlisted Visibility = "UNLISTED" + VisibilityPrivate Visibility = "PRIVATE" +) + +var AllVisibility = []Visibility{ + VisibilityPublic, + VisibilityUnlisted, + VisibilityPrivate, +} + +func (e Visibility) IsValid() bool { + switch e { + case VisibilityPublic, VisibilityUnlisted, VisibilityPrivate: + return true + } + return false +} + +func (e Visibility) String() string { + return string(e) +} + +func (e *Visibility) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Visibility(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Visibility", str) + } + return nil +} + +func (e Visibility) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *Visibility) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e Visibility) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} diff --git a/graph/paging.go b/graph/paging.go new file mode 100644 index 0000000000000000000000000000000000000000..f93e74d9ffe09dfb6190db80ce45d464cb98aba4 --- /dev/null +++ b/graph/paging.go @@ -0,0 +1,127 @@ +package graph + +import ( + "context" + "strconv" + + coremodel "sourcecraft.dev/bigbes/sr-ht-core/model" + + "sourcecraft.dev/bigbes/sr-ht-dolt/browse" + "sourcecraft.dev/bigbes/sr-ht-dolt/core" + "sourcecraft.dev/bigbes/sr-ht-dolt/graph/model" +) + +// Page sizes for the database listings. The count travels in the cursor, as it +// does on every other sr.ht service, so a client that asked for a page size +// keeps it across pages without repeating itself. +const ( + defaultPageSize = 25 + maxPageSize = 100 +) + +// page slices one page out of a listing the store has already filtered to what +// the caller may see, and mints the cursor for the next one. +// +// The slicing is in memory rather than in SQL, which is a real limit and not an +// oversight: ListReposForViewer's rule spans three tables and the listings it +// answers are instance-sized (tens of rows), so the whole set is fetched and cut +// here. A listing that outgrows that wants a keyset query in db/, and this is +// the function that would then become a thin wrapper over it. +// +// The cursor carries the id of the first row of the next page and the page size. +// Resuming starts at the first row whose id is at or below it, so a cursor whose +// row was deleted — or made invisible to this caller — between two pages resumes +// at the next row instead of failing or, worse, silently starting over. +func page(repos []*core.Repo, cursor *coremodel.Cursor, filter *coremodel.Filter) *model.DatabaseCursor { + count := defaultPageSize + start := 0 + if cursor != nil { + if cursor.Count > 0 { + count = cursor.Count + } + if after, err := strconv.Atoi(cursor.Next); err == nil { + start = len(repos) + for i, repo := range repos { + if repo.ID <= after { + start = i + break + } + } + } + } + // A filter given on this call wins over what the cursor remembers, so a + // client can change the page size mid-walk without minting a new cursor. + if filter != nil && filter.Count != nil && *filter.Count > 0 { + count = *filter.Count + } + if count > maxPageSize { + count = maxPageSize + } + + end := start + count + if end > len(repos) { + end = len(repos) + } + + out := make([]*model.Database, 0, end-start) + for _, repo := range repos[start:end] { + out = append(out, model.NewDatabase(repo)) + } + + page := &model.DatabaseCursor{Results: out} + if end < len(repos) { + page.Cursor = &coremodel.Cursor{ + Next: strconv.Itoa(repos[end].ID), + Count: count, + } + } + return page +} + +// logLimit bounds how many commits one Database.log answers. The cap is the +// surface's, not the client's: a log page is a walk of the on-disk store. +func logLimit(limit *int) int { + if limit == nil || *limit <= 0 { + return defaultLogLimit + } + if *limit > maxLogLimit { + return maxLogLimit + } + return *limit +} + +// cursorNext is the commit hash a log page resumes from, or "" to start at the +// ref's head. +func cursorNext(from *coremodel.Cursor) string { + if from == nil { + return "" + } + return from.Next +} + +// nextCursor wraps browse's "next hash" in the schema's cursor, or nil when the +// walk reached the root commit. +func nextCursor(next string) *coremodel.Cursor { + if next == "" { + return nil + } + return &coremodel.Cursor{Next: next} +} + +// resolveRef answers the ref a field should read: the one the query named, or +// the database's default branch. It returns "" — and no error — for a store +// with no branches at all, which is a database nothing has been pushed to yet; +// the caller turns that into the empty answer for its own field. +func resolveRef(ctx context.Context, sess BrowseSession, ref *string) (string, error) { + if ref != nil && *ref != "" { + return *ref, nil + } + branches, err := sess.Branches(ctx) + if err != nil { + return "", internalError("Database.ref", err) + } + if len(branches) == 0 { + return "", nil + } + return browse.DefaultBranch(branches), nil +} diff --git a/graph/ports.go b/graph/ports.go new file mode 100644 index 0000000000000000000000000000000000000000..8b8d71ee05c91f34a1acff3f5f53a1bd5068ab16 --- /dev/null +++ b/graph/ports.go @@ -0,0 +1,75 @@ +package graph + +import ( + "context" + + "sourcecraft.dev/bigbes/sr-ht-dolt/browse" + "sourcecraft.dev/bigbes/sr-ht-dolt/core" + "sourcecraft.dev/bigbes/sr-ht-dolt/db" +) + +// The seams this package calls, declared consumer-side — the house style +// web/deps.go sets and mcpsrv/ports.go repeats — so the schema can be exercised +// over fakes, with no Postgres and no store on disk. +// +// What is absent from them is this schema's read-only design made structural +// rather than remembered, exactly as on the MCP surface: no StoreManager, so +// nothing here can create, move or delete a store; no repository create, update +// or delete, and no ACL mutation, so the only writes dolt.sr.ht performs stay +// behind the web UI; no key management, because a surface reached with one +// credential has no business enumerating another; no SQL engine, because a bare +// store has no working set to run one against. +// +// Adding a mutation to this schema therefore means widening this file first, +// which is a diff a reviewer sees. + +// Repos is the metadata store as this schema reads it. +// +// It is spelled with db.Store's own signatures, so *db.Store satisfies it as +// written and production binds it through the same request-scoped adapter web +// and mcpsrv use. +// +// Visibility is not applied by GetRepoByOwnerAndName and must not be assumed +// from it: what the caller may see is decided afterwards by core.Allowed over +// the grant EffectiveAccess returns. The listings are the exception and carry +// their rule in their own documentation. +type Repos interface { + // GetRepoByOwnerAndName resolves a database by its owner's username (no + // leading "~") and name, or reports db.ErrNotFound. + GetRepoByOwnerAndName(ctx context.Context, ownerUsername, name string) (*core.Repo, error) + + // ListReposForViewer lists every database viewer may be shown, across all + // owners, newest first: PUBLIC to everyone, plus whatever viewer owns or + // holds an ACL entry on. viewer is nil for an anonymous caller, and + // anonymous is a normal caller here — it gets the PUBLIC set. + ListReposForViewer(ctx context.Context, viewer *core.Caller) ([]*core.Repo, error) + + // ListReposByOwner is ListReposForViewer's rule narrowed to one owner. + ListReposByOwner(ctx context.Context, ownerUsername string, viewer *core.Caller) ([]*core.Repo, error) + + // EffectiveAccess resolves the caller's ACL grant on a repository, or + // (nil, nil) when there is none. A nil grant is not a denial: it is a + // fall-through to visibility, which is what core.Allowed does with it. + EffectiveAccess(ctx context.Context, userID, repoID int) (*core.AccessMode, error) + + // ListACL lists the grants on a repository. The schema exposes it to the + // owner alone. + ListACL(ctx context.Context, repoID int) ([]*db.ACLEntry, error) +} + +// BrowseSession is the read-only view of one bare store this schema needs: a +// strict subset of mcpsrv's, because rows and diffs are not published here. +type BrowseSession interface { + Branches(ctx context.Context) ([]browse.Branch, error) + Log(ctx context.Context, refStr, fromHash string, limit int) ([]browse.CommitInfo, string, error) + Tables(ctx context.Context, refStr string) ([]browse.TableInfo, error) + Close() error +} + +// BrowseOpener opens a session over the bare store at diskPath. Open is paired +// with Close by the resolver that called it: a session is one fresh read of the +// on-disk manifest, so nothing is cached between calls and a resolver sees the +// commits a push landed a moment ago. +type BrowseOpener interface { + Open(ctx context.Context, diskPath string) (BrowseSession, error) +} diff --git a/graph/resolver.go b/graph/resolver.go new file mode 100644 index 0000000000000000000000000000000000000000..05e30ba8215f1fdabcb05fe29bef7dca765a3446 --- /dev/null +++ b/graph/resolver.go @@ -0,0 +1,101 @@ +package graph + +import ( + "context" + "errors" + "fmt" + "log/slog" + + "go.bigb.es/auxilia/scribe" + + "sourcecraft.dev/bigbes/sr-ht-dolt/authn" + "sourcecraft.dev/bigbes/sr-ht-dolt/core" + "sourcecraft.dev/bigbes/sr-ht-dolt/db" +) + +// Resolver holds what every field of the schema resolves through. It is built +// once by New and is safe for concurrent use: it owns no per-request state, and +// the caller is read from the context the transport installed. +type Resolver struct { + repos Repos + opener BrowseOpener +} + +// defaultLogLimit is how many commits Database.log answers when the query names +// no limit, and maxLogLimit is the most it will answer for any limit. The cap is +// the surface's and not the client's: a log page is a walk of the on-disk store, +// and an unbounded limit is a way to ask this service to walk all of history in +// one request. +const ( + defaultLogLimit = 20 + maxLogLimit = 200 +) + +// errUnavailable is what a resolver answers when it could not read, as opposed +// to when there was nothing to read. The two are never merged: "I could not +// check" reported as "there is none" is how a client learns a false fact about +// the instance and acts on it. +var errUnavailable = errors.New("the database could not be read, try again") + +// internalError logs the cause against the field that produced it and returns +// the sentence a client sees. The cause never travels: the store layer's errors +// carry on-disk paths and the metadata layer's carry connection strings. +func internalError(field string, err error) error { + slog.Error("a GraphQL field could not be resolved", + "component", "graph", "field", field, scribe.Err(err)) + return errUnavailable +} + +// callerOf is the request's principal as the access matrix wants it: nil for an +// anonymous caller, which is a normal caller on this schema. +func callerOf(ctx context.Context) *core.Caller { + return authn.AsCoreCaller(authn.CallerFromContext(ctx)) +} + +// resolveDatabase turns an owner and a name into a row the caller may read, or +// into (nil, nil) — "no such database" — which is the schema's single refusal. +// +// It is the browse handlers' dance call for call (web's loadRepoForBrowse, +// mcpsrv's resolveDatabase): the row, the caller's ACL grant, core.Allowed for +// OpBrowse. Like the MCP surface and unlike the web, there is no forbidden arm: +// a caller who may not read a database is told it does not exist, so its +// existence cannot be read out of the shape of the refusal. +// +// An ACL lookup that fails is an error rather than a fall-through to +// visibility. On a page that degradation costs a signed-in user a rendering; +// here it would tell a client that a database it holds a grant on is not there. +func (r *Resolver) resolveDatabase(ctx context.Context, owner, name string) (*core.Repo, error) { + caller := callerOf(ctx) + + repo, err := r.repos.GetRepoByOwnerAndName(ctx, owner, name) + if err != nil { + if errors.Is(err, db.ErrNotFound) { + return nil, nil + } + return nil, internalError("database", err) + } + + // An anonymous caller holds no ACL entry and there is no user id to look one + // up by; visibility decides alone, which is what core.Allowed does with a + // nil grant. + var mode *core.AccessMode + if caller != nil { + if mode, err = r.repos.EffectiveAccess(ctx, caller.UserID, repo.ID); err != nil { + return nil, internalError("database", err) + } + } + if !core.Allowed(caller, repo, mode, core.OpBrowse) { + return nil, nil + } + return repo, nil +} + +// openStore opens the bare store of a database whose row the caller has already +// been allowed to read. The caller closes the session. +func (r *Resolver) openStore(ctx context.Context, field string, repo *core.Repo) (BrowseSession, error) { + sess, err := r.opener.Open(ctx, repo.Path) + if err != nil { + return nil, internalError(fmt.Sprintf("Database.%s", field), err) + } + return sess, nil +} diff --git a/graph/schema.graphqls b/graph/schema.graphqls new file mode 100644 index 0000000000000000000000000000000000000000..f8500130a5914aa5e602ece9034711bf741d5e7f --- /dev/null +++ b/graph/schema.graphqls @@ -0,0 +1,223 @@ +# dolt.sr.ht — the read schema. +# +# There are no mutations here, and the reason is the same one spec.sr.ht gives: +# a type federated into api.sr.ht is a consumed contract, expensive to churn, so +# only what has settled is published. Creating, renaming and deleting a database +# each move a metadata row and an on-disk store together, and that pairing is +# young; it stays behind the web UI until it is not. +# +# Rows and diffs are absent for a different reason. They exist on /mcp, where a +# read that had to be clipped says so in its own answer — a shape this schema +# would have to reproduce field by field to stay honest. Until it does, a client +# that wants table contents should ask /mcp, and this schema stops at the +# structure: what databases exist, what branches and commits they carry, and +# what tables live at a ref. +# +# Everything below is read through the same db/ store and browse/ session the +# web pages and the MCP tools use, so the three surfaces cannot disagree about +# what a database is. + +""" +An RFC-3339 timestamp. +""" +scalar Time + +""" +An opaque pagination cursor. Pass it back into the same field to fetch the next +page; it is null when there are no further results. +""" +scalar Cursor + +""" +Who may see a database, and how it is listed. + +PUBLIC is listed to everyone including anonymous callers. UNLISTED is reachable +by direct address but never appears in a listing to a stranger. PRIVATE is +neither: to a caller who may not see it, it does not exist — this schema answers +null rather than an authorization error, exactly as the web UI answers "no such +database" rather than "forbidden". +""" +enum Visibility { + PUBLIC + UNLISTED + PRIVATE +} + +""" +An ACL grant: read-only (browse and clone) or read-write (and push). +""" +enum AccessMode { + RO + RW +} + +""" +A SourceHut account, mirrored from meta.sr.ht. +""" +type User { + """ + The username with no leading "~". This is the name that addresses the account + in `database(owner:)` and in a clone URL's path. + """ + username: String! + + """ + The username with its leading "~", as SourceHut writes it in prose and in the + web UI. + """ + canonicalName: String! +} + +""" +A hosted Dolt database: one metadata row and one bare chunk store. +""" +type Database { + id: Int! + name: String! + owner: User! + + """ + The description shown in listings. Empty rather than null when unset: a + companion of a git repository mirrors that repository's description, and "no + description" and "the empty description" are the same state here. + """ + description: String! + visibility: Visibility! + created: Time! + updated: Time! + + """ + The branch a reader lands on: "main" when it exists, else the first branch by + name. Null for a database nothing has been pushed to yet — a store with no + commits has no branches, which is a state and not a failure. + """ + defaultBranch: String + + """ + Every branch, the default one first and the rest by name. Empty for a database + nothing has been pushed to. + """ + branches: [Branch!]! + + """ + The commit log of `ref`, newest first. `ref` is a branch name or a commit + hash, defaulting to `defaultBranch`; `from` continues a previous page from the + hash it returned as `cursor`. + """ + log(ref: String, from: Cursor, limit: Int): CommitCursor! + + """ + The tables of the committed root at `ref` (a branch name or a commit hash, + defaulting to `defaultBranch`), each with its columns and row count. + """ + tables(ref: String): [Table!]! + + """ + Who else may read or write this database. Owner-only: to anybody else it is + the empty list, because the collaborator list of a database you do not own is + not yours to enumerate. + """ + acl: [ACLEntry!]! +} + +""" +A branch and the commit it points at. +""" +type Branch { + name: String! + head: String! +} + +""" +One commit of a database's history. +""" +type Commit { + hash: String! + author: String! + email: String! + date: Time! + message: String! + parents: [String!]! +} + +""" +A column of a table, as the stored schema declares it. +""" +type Column { + name: String! + type: String! + primaryKey: Boolean! + nullable: Boolean! +} + +""" +A table at a ref: its schema and how many rows it holds there. +""" +type Table { + name: String! + columns: [Column!]! + rowCount: Int! +} + +""" +An access grant on a database. +""" +type ACLEntry { + user: User! + mode: AccessMode! +} + +""" +How a listing is paged. It is git.sr.ht's `Filter` minus `search`: nothing here +searches yet, and declaring a field this schema would ignore is a worse answer +than not declaring it. +""" +input Filter { + """ + How many results one page holds, capped at 100. It travels in the cursor the + page returns, so it is given once and kept for the rest of the walk. + """ + count: Int = 25 +} + +type DatabaseCursor { + results: [Database!]! + cursor: Cursor +} + +type CommitCursor { + results: [Commit!]! + cursor: Cursor +} + +type Query { + """ + The caller, or null for an anonymous one. Anonymous is a normal caller on this + schema — it reads what an anonymous visitor reads — so a null here is an + answer and not an error. + """ + me: User + + """ + Every database the caller may be shown, newest first, across all owners. + + This is the listing rule and not the read rule: PUBLIC to everyone, plus + whatever the caller owns or holds an ACL entry on. An UNLISTED database of + somebody else is absent here and still readable through `database`. + """ + databases(cursor: Cursor, filter: Filter): DatabaseCursor! + + """ + One owner's databases, under the same listing rule as `databases`. `owner` + carries no leading "~". + """ + databasesByOwner(owner: String!, cursor: Cursor, filter: Filter): DatabaseCursor! + + """ + One database by owner and name, neither carrying a leading "~". Null when + there is no such database *or* when the caller may not see it — the two are + deliberately one answer, so that a PRIVATE database cannot be discovered by + the shape of the refusal. + """ + database(owner: String!, name: String!): Database +} diff --git a/graph/schema.resolvers.go b/graph/schema.resolvers.go new file mode 100644 index 0000000000000000000000000000000000000000..0dfc4362266dc78e40676d441b1d4a9d358ae960 --- /dev/null +++ b/graph/schema.resolvers.go @@ -0,0 +1,203 @@ +package graph + +// This file will be automatically regenerated based on the schema, any resolver +// implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.94 + +import ( + "context" + + model1 "sourcecraft.dev/bigbes/sr-ht-core/model" + "sourcecraft.dev/bigbes/sr-ht-dolt/browse" + "sourcecraft.dev/bigbes/sr-ht-dolt/graph/api" + "sourcecraft.dev/bigbes/sr-ht-dolt/graph/model" +) + +// DefaultBranch is the resolver for the defaultBranch field. +func (r *databaseResolver) DefaultBranch(ctx context.Context, obj *model.Database) (*string, error) { + sess, err := r.openStore(ctx, "defaultBranch", obj.Repo) + if err != nil { + return nil, err + } + defer sess.Close() + + branches, err := sess.Branches(ctx) + if err != nil { + return nil, internalError("Database.defaultBranch", err) + } + // A store nothing has been pushed to has no branches, and that is a state + // rather than a failure: null, not an error. + if len(branches) == 0 { + return nil, nil + } + name := browse.DefaultBranch(branches) + return &name, nil +} + +// Branches is the resolver for the branches field. +func (r *databaseResolver) Branches(ctx context.Context, obj *model.Database) ([]*model.Branch, error) { + sess, err := r.openStore(ctx, "branches", obj.Repo) + if err != nil { + return nil, err + } + defer sess.Close() + + branches, err := sess.Branches(ctx) + if err != nil { + return nil, internalError("Database.branches", err) + } + out := make([]*model.Branch, 0, len(branches)) + for _, b := range branches { + out = append(out, &model.Branch{Name: b.Name, Head: b.Head}) + } + return out, nil +} + +// Log is the resolver for the log field. +func (r *databaseResolver) Log(ctx context.Context, obj *model.Database, ref *string, from *model1.Cursor, limit *int) (*model.CommitCursor, error) { + sess, err := r.openStore(ctx, "log", obj.Repo) + if err != nil { + return nil, err + } + defer sess.Close() + + refStr, err := resolveRef(ctx, sess, ref) + if err != nil { + return nil, err + } + // No branches at all: an empty log, not an error, for the same reason + // defaultBranch answers null. + if refStr == "" { + return &model.CommitCursor{Results: []*model.Commit{}}, nil + } + + commits, next, err := sess.Log(ctx, refStr, cursorNext(from), logLimit(limit)) + if err != nil { + return nil, internalError("Database.log", err) + } + + out := make([]*model.Commit, 0, len(commits)) + for _, c := range commits { + out = append(out, &model.Commit{ + Hash: c.Hash, + Author: c.Author, + Email: c.Email, + Date: c.Date, + Message: c.Message, + Parents: c.ParentHashes, + }) + } + return &model.CommitCursor{Results: out, Cursor: nextCursor(next)}, nil +} + +// Tables is the resolver for the tables field. +func (r *databaseResolver) Tables(ctx context.Context, obj *model.Database, ref *string) ([]*model.Table, error) { + sess, err := r.openStore(ctx, "tables", obj.Repo) + if err != nil { + return nil, err + } + defer sess.Close() + + refStr, err := resolveRef(ctx, sess, ref) + if err != nil { + return nil, err + } + if refStr == "" { + return []*model.Table{}, nil + } + + tables, err := sess.Tables(ctx, refStr) + if err != nil { + return nil, internalError("Database.tables", err) + } + out := make([]*model.Table, 0, len(tables)) + for _, t := range tables { + columns := make([]*model.Column, 0, len(t.Columns)) + for _, c := range t.Columns { + columns = append(columns, &model.Column{ + Name: c.Name, + Type: c.Type, + PrimaryKey: c.PrimaryKey, + Nullable: c.Nullable, + }) + } + out = append(out, &model.Table{ + Name: t.Name, + Columns: columns, + RowCount: int(t.RowCount), + }) + } + return out, nil +} + +// ACL is the resolver for the acl field. +func (r *databaseResolver) ACL(ctx context.Context, obj *model.Database) ([]*model.ACLEntry, error) { + // Owner-only, and the empty list rather than an error for everybody else: + // who collaborates on a database you do not own is not yours to enumerate, + // and a refusal here would answer a question the caller may not ask. + caller := callerOf(ctx) + if caller == nil || caller.UserID != obj.Repo.OwnerID { + return []*model.ACLEntry{}, nil + } + + entries, err := r.repos.ListACL(ctx, obj.Repo.ID) + if err != nil { + return nil, internalError("Database.acl", err) + } + out := make([]*model.ACLEntry, 0, len(entries)) + for _, e := range entries { + out = append(out, &model.ACLEntry{ + User: model.NewUser(e.Username), + Mode: model.AccessMode(e.Mode), + }) + } + return out, nil +} + +// Me is the resolver for the me field. +func (r *queryResolver) Me(ctx context.Context) (*model.User, error) { + caller := callerOf(ctx) + if caller == nil { + return nil, nil + } + return model.NewUser(caller.Username), nil +} + +// Databases is the resolver for the databases field. +func (r *queryResolver) Databases(ctx context.Context, cursor *model1.Cursor, filter *model1.Filter) (*model.DatabaseCursor, error) { + repos, err := r.repos.ListReposForViewer(ctx, callerOf(ctx)) + if err != nil { + return nil, internalError("databases", err) + } + return page(repos, cursor, filter), nil +} + +// DatabasesByOwner is the resolver for the databasesByOwner field. +func (r *queryResolver) DatabasesByOwner(ctx context.Context, owner string, cursor *model1.Cursor, filter *model1.Filter) (*model.DatabaseCursor, error) { + repos, err := r.repos.ListReposByOwner(ctx, owner, callerOf(ctx)) + if err != nil { + return nil, internalError("databasesByOwner", err) + } + return page(repos, cursor, filter), nil +} + +// Database is the resolver for the database field. +func (r *queryResolver) Database(ctx context.Context, owner string, name string) (*model.Database, error) { + repo, err := r.resolveDatabase(ctx, owner, name) + if err != nil || repo == nil { + return nil, err + } + return model.NewDatabase(repo), nil +} + +// Database returns api.DatabaseResolver implementation. +func (r *Resolver) Database() api.DatabaseResolver { return &databaseResolver{r} } + +// Query returns api.QueryResolver implementation. +func (r *Resolver) Query() api.QueryResolver { return &queryResolver{r} } + +type ( + databaseResolver struct{ *Resolver } + queryResolver struct{ *Resolver } +) diff --git a/graph/server.go b/graph/server.go new file mode 100644 index 0000000000000000000000000000000000000000..d7a0b7777bb828ab0c2346125acf86204394ed43 --- /dev/null +++ b/graph/server.go @@ -0,0 +1,217 @@ +// Package graph is dolt.sr.ht's GraphQL read schema, served at /query. +// +// # Why a GraphQL surface at all +// +// Everything on this instance that already speaks SourceHut GraphQL — hut, a +// script written against git.sr.ht's API, api.sr.ht itself — can read this +// service the moment it has a /query, and could not before it. Federating into +// api.sr.ht is then one `api-origin=` line on the gateway that nothing here +// depends on. +// +// # Read only, deliberately +// +// There are no mutations, for spec.sr.ht's reason: a type federated into the +// gateway is a consumed contract, expensive to churn, so only what has settled +// is published. Creating, renaming and deleting a database each move a metadata +// row and an on-disk store together, and that pairing is young. Rows and diffs +// are absent for a different reason — they live on /mcp, where a read that had +// to be clipped says so in its own answer. +// +// # Who may read what +// +// Not spec.sr.ht's single-owner gate: dolt.sr.ht is multi-user, and its +// visibility rules already exist. The endpoint therefore answers anyone, and +// every field applies the same access matrix the web pages and the MCP tools do: +// +// - The credential is the bearer plane /mcp already defines — a meta personal +// access token scoped `dolt.sr.ht/repos:RO`, or a tokens.sr.ht working token +// carrying `dolt:read`. No cookie: an API client is not a browser, and this +// endpoint is deliberately outside web's same-origin group. +// - Anonymous is a normal caller. It reads what an anonymous visitor reads, +// which is why /query is mounted on the anonymous router: core-go's own auth +// middleware 401s an un-cookied request, and a public database is public. +// - A database the caller may not see resolves to null, never to an +// authorization error, so its existence cannot be read out of the shape of +// the refusal. +// +// # What the cmd layer wires +// +// gql, err := graph.New(graph.Options{ +// Repos: dbAdapter, // request-scoped, over db.Store +// Browse: browseAdapter, // over browse.Open +// Validator: validator, // may be nil: no tokens.sr.ht on the instance +// }) +// if err != nil { return err } +// router.Handle("/query", gql) +// +// Server installs its own credential middleware, so it can be mounted on a +// router that resolves none. +package graph + +import ( + "context" + "errors" + "log/slog" + "net/http" + + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/transport" + + "go.bigb.es/auxilia/culpa" + "go.bigb.es/auxilia/scribe" + + "sourcecraft.dev/bigbes/sr-ht-ecore/bearer" + + "sourcecraft.dev/bigbes/sr-ht-dolt/authn" + "sourcecraft.dev/bigbes/sr-ht-dolt/core" + "sourcecraft.dev/bigbes/sr-ht-dolt/graph/api" +) + +// ServiceName is what this service calls itself in a bearer challenge. +const ServiceName = "dolt.sr.ht" + +var bearerChallenge = bearer.Challenge(ServiceName) + +// Options is everything a Server needs. New says which one is missing rather +// than failing later inside a resolver. +type Options struct { + // Repos is the metadata store. In production it is the same request-scoped + // adapter web and mcpsrv use. + Repos Repos + + // Browse opens read-only sessions over the bare stores. + Browse BrowseOpener + + // Validator verifies a tokens.sr.ht working token. It may be nil — an + // instance that runs no tokens.sr.ht is a supported configuration — and then + // a working token is refused while meta PATs and anonymous callers keep + // working, exactly as on /mcp. + Validator authn.InstanceValidator +} + +// Server is the /query endpoint: the executable schema behind the credential +// gate. It is built once at startup and is safe for concurrent use. +type Server struct { + http http.Handler +} + +// New builds the endpoint. Repos and Browse are required: a surface that +// answered every query "could not be read" because a seam was never wired would +// be a daemon that starts and does not work. +func New(opts Options) (*Server, error) { + if opts.Repos == nil { + return nil, culpa.New("graph: nil Repos") + } + if opts.Browse == nil { + return nil, culpa.New("graph: nil BrowseOpener") + } + + srv := handler.New(api.NewExecutableSchema(api.Config{ + Resolvers: &Resolver{repos: opts.Repos, opener: opts.Browse}, + })) + // POST alone: this schema is read-only but its transport is not a GET API. + // A GET query would be a cross-origin-readable URL for data that is often + // private, and there is no cookie plane here to make that safe. + srv.AddTransport(transport.POST{}) + // Introspection is on: a client that cannot introspect cannot generate a + // typed client, and everything this schema describes is already gated per + // field by the access matrix. + srv.Use(extension.Introspection{}) + + return &Server{ + http: resolveCaller(opts.Validator, requireReadGrant(srv)), + }, nil +} + +// ServeHTTP serves /query behind the chain New built. +func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { s.http.ServeHTTP(w, r) } + +// resolveCaller turns the presented bearer credential into the request's +// principal, or refuses the request. It is /mcp's middleware, arm for arm, +// because it is the same credential plane and a second reading of it would be a +// second thing to keep in agreement: +// +// no credential anonymous — a normal caller here +// ErrMissingGrant 403, the credential is good and the caller is known +// ErrInvalidToken 401 + the challenge — forged, expired, revoked, or a +// working token on an instance with no tokens.sr.ht to +// verify it against +// anything else 503 — the credential could not be *checked*, which is not +// "your token is bad": answering 401 to a restart of +// meta.sr.ht tells every client to re-mint credentials that +// were never broken. +// +// The messages are written here from what the caller already knows, never from +// the error's own text: authn's errors name usernames, hosts and token ids. +func resolveCaller(v authn.InstanceValidator, next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + presented := authn.ParseBearer(r) + if presented == "" { + next.ServeHTTP(w, r) + return + } + + bc, err := authn.ResolveBearer(r.Context(), v, presented) + if err != nil { + switch { + case errors.Is(err, authn.ErrMissingGrant): + // Asked before ErrInvalidToken: ResolveBearer joins the two, so + // a caller that can say 403 asks for this sentinel first. + http.Error(w, "this credential does not grant read access to "+ServiceName+" databases", + http.StatusForbidden) + case errors.Is(err, authn.ErrInvalidToken): + w.Header().Set("WWW-Authenticate", bearerChallenge) + http.Error(w, "the bearer token presented was refused", http.StatusUnauthorized) + default: + slog.Error("a bearer credential could not be checked", + "component", "graph", scribe.Err(err)) + http.Error(w, "the credential could not be verified, try again", + http.StatusServiceUnavailable) + } + return + } + + ctx := authn.WithCaller(r.Context(), bc.AuthContext) + ctx = withBearerCaller(ctx, bc) + next.ServeHTTP(w, r.WithContext(ctx)) + }) +} + +// requireReadGrant is one check at the boundary rather than one per field, +// because every field of this schema is a read, so the surface has exactly one +// action. A mutation added here must NOT rely on it: it would be admitted by a +// read grant, which is not what a read grant says. +// +// A meta PAT and an anonymous caller pass, and neither is a hole: a PAT carries +// no tokens.sr.ht grants at all — the vocabularies do not overlap — and its own +// scoping was applied when it resolved, while an anonymous caller is held to +// visibility by every resolver. +func requireReadGrant(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if bc := bearerCallerFrom(r.Context()); bc != nil { + if err := bc.Authorize(core.GrantRead); err != nil { + http.Error(w, "this token does not carry the "+core.GrantRead+" grant", + http.StatusForbidden) + return + } + } + next.ServeHTTP(w, r) + }) +} + +type contextKey struct{ name string } + +// bearerCallerKey holds the resolved *authn.BearerCaller for the grant gate. +// The identity itself goes where the rest of the service looks for it +// (authn.WithCaller); what has no house-wide home is the tokens.sr.ht grant set. +var bearerCallerKey = contextKey{"graph.bearerCaller"} + +func withBearerCaller(ctx context.Context, bc *authn.BearerCaller) context.Context { + return context.WithValue(ctx, bearerCallerKey, bc) +} + +func bearerCallerFrom(ctx context.Context) *authn.BearerCaller { + bc, _ := ctx.Value(bearerCallerKey).(*authn.BearerCaller) + return bc +}