diff --git a/.github/workflows/ci-integration.yml b/.github/workflows/ci-integration.yml index a60a11b..30b673c 100644 --- a/.github/workflows/ci-integration.yml +++ b/.github/workflows/ci-integration.yml @@ -113,9 +113,23 @@ jobs: go-version: '1.25.x' cache-dependency-path: gitstore-api/go.sum + - name: Start ScyllaDB + run: | + docker run -d --name gitstore-scylla-test \ + -p 9042:9042 \ + scylladb/scylla:5.4 \ + --developer-mode=1 --overprovisioned=1 --smp=1 + timeout 120 sh -c 'until docker exec gitstore-scylla-test cqlsh -e "describe cluster"; do sleep 2; done' + - name: Run ScyllaDB contract tests working-directory: ./gitstore-api - run: go test -tags scylla -v -timeout 10m ./tests/contract/datastore/... ./internal/datastore/scylla/... + env: + GITSTORE_TEST_SCYLLA_ADDR: 127.0.0.1:9042 + run: go test -tags scylla -v -timeout 120s ./tests/contract/datastore/... ./internal/datastore/scylla/... + + - name: Stop ScyllaDB + if: always() + run: docker rm -f gitstore-scylla-test || true grpc-contract-test: name: gRPC Contract Tests (testcontainers) diff --git a/AGENTS.md b/AGENTS.md index 4f8e526..c169757 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,6 +9,8 @@ Auto-generated from all feature plans. Last updated: 2026-03-26 - Rust edition 2021, MSRV 1.82 (required by gix 0.83.0) + `gix 0.83.0` (replaces `git2 0.20.4`), `tokio 1.35`, `axum 0.8`, `tonic 0.14`, `tracing 0.1`, `anyhow 1.0` (007-migrate-gitoxide) - Bare Git repositories on local filesystem (unchanged) (007-migrate-gitoxide) - Rust edition 2021, MSRV 1.82 + `gix 0.83.0`, `gix-packetline` (compatible version), `gix-pack` (compatible version), `gix-protocol` (compatible version), `axum 0.8`, `tokio 1.35`, `tracing 0.1`, `tempfile 3.8` (dev) (008-remove-git-shellouts) +- Go 1.25 (`gitstore-api`) + `gqlgen v0.17.90`, `go-memdb v1.3.5`, `gocqlx/v3 v3.0.4` (ScyllaDB), `go-playground/validator/v10`, `go.uber.org/zap`, `google/uuid` (009-api-namespaces) +- `go-memdb` (development / in-memory backend) / ScyllaDB 5.x+ (production backend) — via the `datastore.Datastore` interface from feature 006 (009-api-namespaces) - (001-git-backed-ecommerce) @@ -21,9 +23,9 @@ Auto-generated from all feature plans. Last updated: 2026-03-26 : Follow standard conventions ## Recent Changes +- 009-api-namespaces: Added Go 1.25 (`gitstore-api`) + `gqlgen v0.17.90`, `go-memdb v1.3.5`, `gocqlx/v3 v3.0.4` (ScyllaDB), `go-playground/validator/v10`, `go.uber.org/zap`, `google/uuid` - 008-remove-git-shellouts: Added Rust edition 2021, MSRV 1.82 + `gix 0.83.0`, `gix-packetline` (compatible version), `gix-pack` (compatible version), `gix-protocol` (compatible version), `axum 0.8`, `tokio 1.35`, `tracing 0.1`, `tempfile 3.8` (dev) - 007-migrate-gitoxide: Added Rust edition 2021, MSRV 1.82 (required by gix 0.83.0) + `gix 0.83.0` (replaces `git2 0.20.4`), `tokio 1.35`, `axum 0.8`, `tonic 0.14`, `tracing 0.1`, `anyhow 1.0` -- 006-api-datastore-abstraction: Added Go 1.25 (`gitstore-api`) diff --git a/docs/architecture.md b/docs/architecture.md index fcbeff3..38e1fb3 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -33,15 +33,42 @@ The API gateway (`gitstore-api`) and the Git server (`gitstore-git-service`) com Key environment variables: -| Service | Variable | Purpose | -|------------------------|----------------------|--------------------------------------------------------| -| `gitstore-api` | `GITSTORE_GIT__GRPC__URI` | gRPC address of git-service (e.g. `dns:///git-service:50051`) | -| `gitstore-api` | `GITSTORE_GIT__WS__URI` | WebSocket URL for catalogue-reload notifications | -| `gitstore-git-service` | `GITSTORE_GRPC__PORT` | Port the gRPC server binds on (default `50051`) | -| `gitstore-git-service` | `GITSTORE_GIT__DATA_DIR` | Path to the bare repository directory | +| Service | Variable | Purpose | +|------------------------|---------------------------|---------------------------------------------------------------| +| `gitstore-api` | `GITSTORE_GIT__GRPC__URI` | gRPC address of git-service (e.g. `dns:///git-service:50051`) | +| `gitstore-api` | `GITSTORE_GIT__WS__URI` | WebSocket URL for catalogue-reload notifications | +| `gitstore-git-service` | `GITSTORE_GRPC__PORT` | Port the gRPC server binds on (default `50051`) | +| `gitstore-git-service` | `GITSTORE_GIT__DATA_DIR` | Path to the bare repository directory | These folders map directly to the control, storage, and distribution planes described below. +### Dynamic GraphQL Schema for CRD-Style Kinds + +The platform supports CRD-style kinds, so GraphQL schema shape cannot be treated as fully static. + +- `gitstore-api` should watch kind/definition registry updates from Git and trigger schema refresh. +- Runtime synthesis should translate JSON Schema-backed kind definitions into GraphQL object types and fields. +- Generated query roots should stay namespaced by domain (for example `query { catalog { product(id: "...") } }`). + +Schema lifecycle should follow a safe publish pattern: + +1. Build a candidate schema from current registry state. +2. Validate and wire resolvers. +3. Atomically publish if valid. +4. Keep the last known-good schema active on failure. + +### Direct Synthesis vs Federation + +For core kinds, prefer direct synthesis inside `gitstore-api` to reduce network hops and keep resolver behaviour predictable. + +Federation is an optional path for externally owned integrations: + +- External apps can expose independent subgraphs and extend shared entities. +- Composition uses federation ownership directives such as `@key`, `@extends`, and `@external`. +- Composition may run through an edge router/gateway when extension boundaries justify service isolation. + +Use federation when an extension owns its own service boundary or datastore and must participate in cross-entity graph relationships. Keep core catalogue/resource kinds on direct synthesis by default. + ### Git Engine — gitoxide (gix) `gitstore-git-service` uses [gitoxide (`gix 0.83.0`)](https://github.com/Byron/gitoxide), a pure-Rust Git implementation, as its only Git library. The `git2` / libgit2 C binding was removed entirely in feature `007-migrate-gitoxide`. @@ -307,3 +334,65 @@ graph TD - Choose **Proposal 2** if strict release control and Git-native operational workflows are the primary priority. - In both cases, Git remains authoritative and KV remains the read-optimised projection layer. +--- + +## Namespace Lifecycle Management (feature 009-api-namespaces) + +Namespaces are the primary isolation boundary for repositories in GitStore. They are managed exclusively through the GraphQL API in `gitstore-api`; `gitstore-git-service` is unchanged (FR-011). + +### Three Tiers + +| Tier | Who can create | Owns repositories | Can have parent enterprise | +|----------------|-----------------------------|-------------------|----------------------------| +| `USER` | Any authenticated caller | Yes | No | +| `ORGANISATION` | Any authenticated caller | Yes | Optional | +| `ENTERPRISE` | Callers with `isAdmin` only | No | No | + +### Global Identifier Uniqueness + +Namespace identifiers are globally unique across all tiers. The same identifier cannot exist as both a user-space and an organisation namespace. Identifiers follow DNS label rules: lowercase alphanumeric + hyphens, 1–63 characters, no leading or trailing hyphen. + +### Authorization Model + +- **`isAdmin`** (JWT claim) is the elevated platform role. Callers with `isAdmin == true` may create enterprise namespaces and delete any namespace. +- **Ownership** for deletion is checked at query time via `CreatedBy == callerUsername || isAdmin`. No mutable ownership state is embedded in the JWT. + +### API Surface + +All namespace operations are GraphQL, consistent with the rest of the domain API. See `shared/schemas/namespace.graphqls` for the full contract. + +```graphql +# Create a user namespace +mutation { + createNamespace(input: { identifier: "acme-corp", tier: USER }) { + namespace { id identifier tier createdAt createdBy } + } +} + +# List all namespaces +query { + namespaces { id identifier tier createdBy } +} + +# Get namespace by identifier +query { + namespace(identifier: "acme-corp") { + id identifier displayName tier parentEnterpriseId + createdAt createdBy updatedAt updatedBy + } +} + +# Delete a namespace (owner or admin only) +mutation { + deleteNamespace(input: { identifier: "acme-corp" }) { + deletedIdentifier + } +} +``` + +### Deletion Guard + +Deletion is blocked when the namespace contains repositories (enforced in the service layer). The guard is a no-op stub in this release (repositories table is out of scope); it will be enforced when the repository spec lands. + +For quickstart examples and `curl`-based testing, see [`specs/009-api-namespaces/quickstart.md`](../specs/009-api-namespaces/quickstart.md). + diff --git a/docs/developer-guide.md b/docs/developer-guide.md index c50a9dc..8b4fae9 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -424,6 +424,15 @@ GITSTORE_LOG__LEVEL=info docker compose -f compose.yml -f compose.scylla.yml up -d scylla scylla-init ``` +Scylla-backed Go tests use an externally managed ScyllaDB instance. Start +ScyllaDB first, then point the tests at its CQL address: + +```bash +cd gitstore-api +GITSTORE_TEST_SCYLLA_ADDR=127.0.0.1:9042 \ + go test -tags scylla -v -timeout 10m ./tests/contract/datastore/... ./internal/datastore/scylla/... +``` + ### Go Licence Headers All Go source files in this repository should include this header near the top of the file: @@ -560,7 +569,7 @@ fn test_create_product_workflow() { wscat -c ws://localhost:8080 # Check API logs -docker-compose logs api | grep websocket +docker compose logs api | grep websocket # Manual cache invalidation # TODO returns 404 diff --git a/docs/implementation/006-api-datastore-abstraction.md b/docs/implementation/006-api-datastore-abstraction.md index 6d2498e..19079ab 100644 --- a/docs/implementation/006-api-datastore-abstraction.md +++ b/docs/implementation/006-api-datastore-abstraction.md @@ -86,15 +86,14 @@ behavioural parity between backends: # memdb (no external services) go test ./tests/contract/datastore/... -# ScyllaDB (testcontainers — pulls image automatically) -go test -tags scylla -timeout 10m ./tests/contract/datastore/... +# ScyllaDB contract tests (requires an external ScyllaDB on 127.0.0.1:9042) +GITSTORE_TEST_SCYLLA_ADDR=127.0.0.1:9042 go test -tags scylla -timeout 10m ./tests/contract/datastore/... # ScyllaDB backend unit tests + migration tests -go test -tags scylla -timeout 10m ./internal/datastore/scylla/... +GITSTORE_TEST_SCYLLA_ADDR=127.0.0.1:9042 go test -tags scylla -timeout 10m ./internal/datastore/scylla/... ``` -To run against a pre-started ScyllaDB instance instead of testcontainers, -start the override compose stack at the repo root: +Start the override compose stack at the repo root before running ScyllaDB tests: ```bash docker compose -f compose.yml -f compose.scylla.yml up -d scylla diff --git a/gitstore-admin/codegen.yml b/gitstore-admin/codegen.yml index 9ec4f1e..9b7922f 100644 --- a/gitstore-admin/codegen.yml +++ b/gitstore-admin/codegen.yml @@ -1,5 +1,5 @@ overwrite: true -schema: ../shared/schemas/*.graphql +schema: ../shared/schemas/*.graphqls documents: 'src/graphql/**/*.graphql' generates: src/graphql/generated.ts: diff --git a/gitstore-api/cmd/server/main.go b/gitstore-api/cmd/server/main.go index b191cfa..0bf9601 100644 --- a/gitstore-api/cmd/server/main.go +++ b/gitstore-api/cmd/server/main.go @@ -78,6 +78,7 @@ func main() { // Create GraphQL resolver resolver := graph.NewResolver(store, gitClient, logger.Log) + resolver.WithAuthMiddleware(authMiddleware) schema := generated.NewExecutableSchema(generated.Config{Resolvers: resolver}) gqlServer := gqlhandler.NewDefaultServer(schema) diff --git a/gitstore-api/gqlgen.yml b/gitstore-api/gqlgen.yml index f463737..42b3646 100644 --- a/gitstore-api/gqlgen.yml +++ b/gitstore-api/gqlgen.yml @@ -1,6 +1,6 @@ # Where are all the schema files located? globs are supported eg src/**/*.graphqls schema: - - ../shared/schemas/*.graphql + - ../shared/schemas/*.graphqls # Where should the generated server code go? exec: diff --git a/gitstore-api/internal/datastore/datastore.go b/gitstore-api/internal/datastore/datastore.go index 774adad..d2238c2 100644 --- a/gitstore-api/internal/datastore/datastore.go +++ b/gitstore-api/internal/datastore/datastore.go @@ -52,6 +52,13 @@ type Datastore interface { UpdateCollection(ctx context.Context, c *Collection) error DeleteCollection(ctx context.Context, id string) error + // Namespace operations + CreateNamespace(ctx context.Context, ns *Namespace) error + GetNamespace(ctx context.Context, id string) (*Namespace, error) + GetNamespaceByIdentifier(ctx context.Context, identifier string) (*Namespace, error) + ListNamespaces(ctx context.Context) ([]*Namespace, error) + DeleteNamespace(ctx context.Context, id string) error + // Lifecycle Close() error } diff --git a/gitstore-api/internal/datastore/entities.go b/gitstore-api/internal/datastore/entities.go index a0646d8..afaad7f 100644 --- a/gitstore-api/internal/datastore/entities.go +++ b/gitstore-api/internal/datastore/entities.go @@ -5,6 +5,28 @@ package datastore import "time" +// NamespaceTier is the enumeration of allowed namespace tiers. +type NamespaceTier string + +const ( + NamespaceTierUser NamespaceTier = "user" + NamespaceTierOrganisation NamespaceTier = "organisation" + NamespaceTierEnterprise NamespaceTier = "enterprise" +) + +// Namespace is the primary isolation boundary for repositories. +type Namespace struct { + ID string + Identifier string + DisplayName string + Tier NamespaceTier + ParentEnterpriseID *string + CreatedAt time.Time + CreatedBy string + UpdatedAt time.Time + UpdatedBy string +} + // Product represents a sellable item in the catalogue. type Product struct { ID string diff --git a/gitstore-api/internal/datastore/instrumented.go b/gitstore-api/internal/datastore/instrumented.go index 7310439..eaf254f 100644 --- a/gitstore-api/internal/datastore/instrumented.go +++ b/gitstore-api/internal/datastore/instrumented.go @@ -181,6 +181,43 @@ func (d *InstrumentedDatastore) DeleteCollection(ctx context.Context, id string) return err } +// ── Namespace ───────────────────────────────────────────────────────────── + +func (d *InstrumentedDatastore) CreateNamespace(ctx context.Context, ns *Namespace) error { + start := time.Now() + err := d.next.CreateNamespace(ctx, ns) + d.observe("CreateNamespace", start, err) + return err +} + +func (d *InstrumentedDatastore) GetNamespace(ctx context.Context, id string) (*Namespace, error) { + start := time.Now() + v, err := d.next.GetNamespace(ctx, id) + d.observe("GetNamespace", start, err) + return v, err +} + +func (d *InstrumentedDatastore) GetNamespaceByIdentifier(ctx context.Context, identifier string) (*Namespace, error) { + start := time.Now() + v, err := d.next.GetNamespaceByIdentifier(ctx, identifier) + d.observe("GetNamespaceByIdentifier", start, err) + return v, err +} + +func (d *InstrumentedDatastore) ListNamespaces(ctx context.Context) ([]*Namespace, error) { + start := time.Now() + v, err := d.next.ListNamespaces(ctx) + d.observe("ListNamespaces", start, err) + return v, err +} + +func (d *InstrumentedDatastore) DeleteNamespace(ctx context.Context, id string) error { + start := time.Now() + err := d.next.DeleteNamespace(ctx, id) + d.observe("DeleteNamespace", start, err) + return err +} + // ── Lifecycle ────────────────────────────────────────────────────────────── func (d *InstrumentedDatastore) Close() error { diff --git a/gitstore-api/internal/datastore/instrumented_test.go b/gitstore-api/internal/datastore/instrumented_test.go index 95467ad..d50a895 100644 --- a/gitstore-api/internal/datastore/instrumented_test.go +++ b/gitstore-api/internal/datastore/instrumented_test.go @@ -76,6 +76,21 @@ func (s *stubDatastore) UpdateCollection(_ context.Context, _ *datastore.Collect func (s *stubDatastore) DeleteCollection(_ context.Context, _ string) error { return s.getProductErr } +func (s *stubDatastore) CreateNamespace(_ context.Context, _ *datastore.Namespace) error { + return s.getProductErr +} +func (s *stubDatastore) GetNamespace(_ context.Context, _ string) (*datastore.Namespace, error) { + return nil, s.getProductErr +} +func (s *stubDatastore) GetNamespaceByIdentifier(_ context.Context, _ string) (*datastore.Namespace, error) { + return nil, s.getProductErr +} +func (s *stubDatastore) ListNamespaces(_ context.Context) ([]*datastore.Namespace, error) { + return nil, s.getProductErr +} +func (s *stubDatastore) DeleteNamespace(_ context.Context, _ string) error { + return s.getProductErr +} func (s *stubDatastore) Close() error { return nil } // newTestInstrumented creates an InstrumentedDatastore with an observer logger diff --git a/gitstore-api/internal/datastore/memdb/backend.go b/gitstore-api/internal/datastore/memdb/backend.go index 25acddf..163c18e 100644 --- a/gitstore-api/internal/datastore/memdb/backend.go +++ b/gitstore-api/internal/datastore/memdb/backend.go @@ -296,3 +296,78 @@ func (m *memdbDatastore) DeleteCollection(_ context.Context, id string) error { txn.Commit() return nil } + +// ── Namespace ───────────────────────────────────────────────────────────────── + +func (m *memdbDatastore) CreateNamespace(_ context.Context, ns *datastore.Namespace) error { + if ns == nil { + return fmt.Errorf("%w: namespace is nil", datastore.ErrInvalidArgument) + } + if ns.ID == "" { + return fmt.Errorf("%w: namespace id is empty", datastore.ErrInvalidArgument) + } + txn := m.db.Txn(true) + if raw, _ := txn.First("namespaces", "id", ns.ID); raw != nil { + txn.Abort() + return fmt.Errorf("%w: namespace id %s", datastore.ErrAlreadyExists, ns.ID) + } + if raw, _ := txn.First("namespaces", "identifier", ns.Identifier); raw != nil { + txn.Abort() + return fmt.Errorf("%w: namespace identifier %s", datastore.ErrAlreadyExists, ns.Identifier) + } + if err := txn.Insert("namespaces", ns); err != nil { + txn.Abort() + return fmt.Errorf("memdb: insert namespace: %w", err) + } + txn.Commit() + return nil +} + +func (m *memdbDatastore) GetNamespace(_ context.Context, id string) (*datastore.Namespace, error) { + txn := m.db.Txn(false) + defer txn.Abort() + raw, err := txn.First("namespaces", "id", id) + if err != nil || raw == nil { + return nil, notFoundOrErr(err) + } + return raw.(*datastore.Namespace), nil +} + +func (m *memdbDatastore) GetNamespaceByIdentifier(_ context.Context, identifier string) (*datastore.Namespace, error) { + txn := m.db.Txn(false) + defer txn.Abort() + raw, err := txn.First("namespaces", "identifier", identifier) + if err != nil || raw == nil { + return nil, notFoundOrErr(err) + } + return raw.(*datastore.Namespace), nil +} + +func (m *memdbDatastore) ListNamespaces(_ context.Context) ([]*datastore.Namespace, error) { + txn := m.db.Txn(false) + defer txn.Abort() + it, err := txn.Get("namespaces", "id") + if err != nil { + return nil, fmt.Errorf("memdb: list namespaces: %w", err) + } + var results []*datastore.Namespace + for obj := it.Next(); obj != nil; obj = it.Next() { + results = append(results, obj.(*datastore.Namespace)) + } + return results, nil +} + +func (m *memdbDatastore) DeleteNamespace(_ context.Context, id string) error { + txn := m.db.Txn(true) + raw, _ := txn.First("namespaces", "id", id) + if raw == nil { + txn.Abort() + return fmt.Errorf("%w: namespace id %s", datastore.ErrNotFound, id) + } + if err := txn.Delete("namespaces", raw); err != nil { + txn.Abort() + return fmt.Errorf("memdb: delete namespace: %w", err) + } + txn.Commit() + return nil +} diff --git a/gitstore-api/internal/datastore/memdb/schema.go b/gitstore-api/internal/datastore/memdb/schema.go index 2f1052b..9816f04 100644 --- a/gitstore-api/internal/datastore/memdb/schema.go +++ b/gitstore-api/internal/datastore/memdb/schema.go @@ -61,5 +61,25 @@ var schema = &memdb.DBSchema{ }, }, }, + "namespaces": { + Name: "namespaces", + Indexes: map[string]*memdb.IndexSchema{ + "id": { + Name: "id", + Unique: true, + Indexer: &memdb.StringFieldIndex{Field: "ID"}, + }, + "identifier": { + Name: "identifier", + Unique: true, + Indexer: &memdb.StringFieldIndex{Field: "Identifier"}, + }, + "tier": { + Name: "tier", + Unique: false, + Indexer: &memdb.StringFieldIndex{Field: "Tier"}, + }, + }, + }, }, } diff --git a/gitstore-api/internal/datastore/scylla/backend.go b/gitstore-api/internal/datastore/scylla/backend.go index e623074..8ab2e7c 100644 --- a/gitstore-api/internal/datastore/scylla/backend.go +++ b/gitstore-api/internal/datastore/scylla/backend.go @@ -26,16 +26,16 @@ import ( type scyllaDatastore struct { session gocqlx.Session log *zap.Logger - keyspace string productTable *table.Table categoryTable *table.Table collectionTable *table.Table + namespaceTable *table.Table } // row structs mirror the CQL columns. type productRow struct { - ID string `db:"id"` + ID gocql.UUID `db:"id"` SKU string `db:"sku"` Title string `db:"title"` Price *inf.Dec `db:"price"` @@ -52,25 +52,37 @@ type productRow struct { } type categoryRow struct { - ID string `db:"id"` - Name string `db:"name"` - Slug string `db:"slug"` - ParentID *string `db:"parent_id"` - DisplayOrder int `db:"display_order"` - CreatedAt int64 `db:"created_at"` - UpdatedAt int64 `db:"updated_at"` - Body string `db:"body"` + ID gocql.UUID `db:"id"` + Name string `db:"name"` + Slug string `db:"slug"` + ParentID *string `db:"parent_id"` + DisplayOrder int `db:"display_order"` + CreatedAt int64 `db:"created_at"` + UpdatedAt int64 `db:"updated_at"` + Body string `db:"body"` } type collectionRow struct { - ID string `db:"id"` - Name string `db:"name"` - Slug string `db:"slug"` - DisplayOrder int `db:"display_order"` - ProductIDs []string `db:"product_ids"` - CreatedAt int64 `db:"created_at"` - UpdatedAt int64 `db:"updated_at"` - Body string `db:"body"` + ID gocql.UUID `db:"id"` + Name string `db:"name"` + Slug string `db:"slug"` + DisplayOrder int `db:"display_order"` + ProductIDs []string `db:"product_ids"` + CreatedAt int64 `db:"created_at"` + UpdatedAt int64 `db:"updated_at"` + Body string `db:"body"` +} + +type namespaceRow struct { + ID gocql.UUID `db:"id"` + Identifier string `db:"identifier"` + DisplayName string `db:"display_name"` + Tier string `db:"tier"` + ParentEnterpriseID *string `db:"parent_enterprise_id"` + CreatedAt int64 `db:"created_at"` + CreatedBy string `db:"created_by"` + UpdatedAt int64 `db:"updated_at"` + UpdatedBy string `db:"updated_by"` } // New opens a ScyllaDB connection, runs pending migrations, and returns a Datastore. @@ -97,42 +109,18 @@ func New(cfg config.ScyllaConfig, log *zap.Logger) (datastore.Datastore, error) } instanceID := uuid.New().String() - if err := RunMigrations(context.Background(), rawSession, instanceID, cfg.Keyspace, log); err != nil { + if err := RunMigrations(context.Background(), rawSession, cfg.Keyspace, instanceID, log); err != nil { rawSession.Close() return nil, fmt.Errorf("scylla: migrations: %w", err) } - ks := cfg.Keyspace return &scyllaDatastore{ - session: gocqlx.NewSession(rawSession), - log: log, - keyspace: ks, - productTable: table.New(table.Metadata{ - Name: ks + ".products", - Columns: []string{ - "id", "sku", "title", "price", "currency", - "inventory_status", "inventory_quantity", - "category_id", "collection_ids", "images", - "metadata", "created_at", "updated_at", "body", - }, - PartKey: []string{"id"}, - }), - categoryTable: table.New(table.Metadata{ - Name: ks + ".categories", - Columns: []string{ - "id", "name", "slug", "parent_id", - "display_order", "created_at", "updated_at", "body", - }, - PartKey: []string{"id"}, - }), - collectionTable: table.New(table.Metadata{ - Name: ks + ".collections", - Columns: []string{ - "id", "name", "slug", "display_order", - "product_ids", "created_at", "updated_at", "body", - }, - PartKey: []string{"id"}, - }), + session: gocqlx.NewSession(rawSession), + log: log, + productTable: Product, + categoryTable: Category, + collectionTable: Collection, + namespaceTable: Namespace, }, nil } @@ -193,7 +181,7 @@ func (s *scyllaDatastore) GetProduct(_ context.Context, id string) (*datastore.P } func (s *scyllaDatastore) GetProductBySKU(_ context.Context, sku string) (*datastore.Product, error) { - stmt, names := qb.Select(s.keyspace + ".products"). + stmt, names := qb.Select("products"). Columns(s.productTable.Metadata().Columns...). Where(qb.Eq("sku")). ToCql() @@ -213,13 +201,13 @@ func (s *scyllaDatastore) ListProducts(_ context.Context, filter datastore.Produ var bindMap qb.M if filter.CategoryID != "" { - stmt, names = qb.Select(s.keyspace + ".products"). + stmt, names = qb.Select("products"). Columns(s.productTable.Metadata().Columns...). Where(qb.Eq("category_id")). ToCql() bindMap = qb.M{"category_id": filter.CategoryID} } else { - stmt, names = qb.Select(s.keyspace + ".products"). + stmt, names = qb.Select("products"). Columns(s.productTable.Metadata().Columns...). ToCql() bindMap = qb.M{} @@ -294,7 +282,7 @@ func (s *scyllaDatastore) GetCategory(_ context.Context, id string) (*datastore. } func (s *scyllaDatastore) GetCategoryBySlug(_ context.Context, slug string) (*datastore.Category, error) { - stmt, names := qb.Select(s.keyspace + ".categories"). + stmt, names := qb.Select("categories"). Columns(s.categoryTable.Metadata().Columns...). Where(qb.Eq("slug")). ToCql() @@ -309,7 +297,7 @@ func (s *scyllaDatastore) GetCategoryBySlug(_ context.Context, slug string) (*da } func (s *scyllaDatastore) ListCategories(_ context.Context) ([]*datastore.Category, error) { - stmt, names := qb.Select(s.keyspace + ".categories"). + stmt, names := qb.Select("categories"). Columns(s.categoryTable.Metadata().Columns...). ToCql() var rows []categoryRow @@ -379,7 +367,7 @@ func (s *scyllaDatastore) GetCollection(_ context.Context, id string) (*datastor } func (s *scyllaDatastore) GetCollectionBySlug(_ context.Context, slug string) (*datastore.Collection, error) { - stmt, names := qb.Select(s.keyspace + ".collections"). + stmt, names := qb.Select("collections"). Columns(s.collectionTable.Metadata().Columns...). Where(qb.Eq("slug")). ToCql() @@ -394,7 +382,7 @@ func (s *scyllaDatastore) GetCollectionBySlug(_ context.Context, slug string) (* } func (s *scyllaDatastore) ListCollections(_ context.Context) ([]*datastore.Collection, error) { - stmt, names := qb.Select(s.keyspace + ".collections"). + stmt, names := qb.Select("collections"). Columns(s.collectionTable.Metadata().Columns...). ToCql() var rows []collectionRow @@ -434,6 +422,82 @@ func (s *scyllaDatastore) DeleteCollection(ctx context.Context, id string) error return nil } +// ── Namespace ───────────────────────────────────────────────────────────────── + +func (s *scyllaDatastore) CreateNamespace(ctx context.Context, ns *datastore.Namespace) error { + if ns == nil { + return fmt.Errorf("%w: namespace is nil", datastore.ErrInvalidArgument) + } + if ns.ID == "" { + return fmt.Errorf("%w: namespace id is empty", datastore.ErrInvalidArgument) + } + if _, err := s.GetNamespace(ctx, ns.ID); err == nil { + return fmt.Errorf("%w: namespace id %s", datastore.ErrAlreadyExists, ns.ID) + } + if existing, err := s.GetNamespaceByIdentifier(ctx, ns.Identifier); err == nil && existing.ID != ns.ID { + return fmt.Errorf("%w: namespace identifier %s", datastore.ErrAlreadyExists, ns.Identifier) + } + row := toNamespaceRow(ns) + stmt, names := s.namespaceTable.Insert() + if err := s.session.Query(stmt, names).BindStruct(row).ExecRelease(); err != nil { + return fmt.Errorf("scylla: create namespace: %w", err) + } + return nil +} + +func (s *scyllaDatastore) GetNamespace(_ context.Context, id string) (*datastore.Namespace, error) { + var row namespaceRow + stmt, names := s.namespaceTable.Get() + if err := s.session.Query(stmt, names).BindMap(qb.M{"id": id}).GetRelease(&row); err != nil { + if errors.Is(err, gocql.ErrNotFound) { + return nil, fmt.Errorf("%w: namespace id %s", datastore.ErrNotFound, id) + } + return nil, fmt.Errorf("scylla: get namespace: %w", err) + } + return fromNamespaceRow(&row), nil +} + +func (s *scyllaDatastore) GetNamespaceByIdentifier(_ context.Context, identifier string) (*datastore.Namespace, error) { + stmt, names := qb.Select("namespaces"). + Columns(s.namespaceTable.Metadata().Columns...). + Where(qb.Eq("identifier")). + ToCql() + var row namespaceRow + if err := s.session.Query(stmt, names).BindMap(qb.M{"identifier": identifier}).GetRelease(&row); err != nil { + if errors.Is(err, gocql.ErrNotFound) { + return nil, fmt.Errorf("%w: namespace identifier %s", datastore.ErrNotFound, identifier) + } + return nil, fmt.Errorf("scylla: get namespace by identifier: %w", err) + } + return fromNamespaceRow(&row), nil +} + +func (s *scyllaDatastore) ListNamespaces(_ context.Context) ([]*datastore.Namespace, error) { + stmt, names := qb.Select("namespaces"). + Columns(s.namespaceTable.Metadata().Columns...). + ToCql() + var rows []namespaceRow + if err := s.session.Query(stmt, names).SelectRelease(&rows); err != nil { + return nil, fmt.Errorf("scylla: list namespaces: %w", err) + } + nss := make([]*datastore.Namespace, len(rows)) + for i := range rows { + nss[i] = fromNamespaceRow(&rows[i]) + } + return nss, nil +} + +func (s *scyllaDatastore) DeleteNamespace(ctx context.Context, id string) error { + if _, err := s.GetNamespace(ctx, id); err != nil { + return err + } + stmt, names := s.namespaceTable.Delete() + if err := s.session.Query(stmt, names).BindMap(qb.M{"id": id}).ExecRelease(); err != nil { + return fmt.Errorf("scylla: delete namespace: %w", err) + } + return nil +} + // ── row conversion helpers ──────────────────────────────────────────────────── func toProductRow(p *datastore.Product) *productRow { @@ -442,7 +506,7 @@ func toProductRow(p *datastore.Product) *productRow { meta[k] = fmt.Sprintf("%v", v) } return &productRow{ - ID: p.ID, + ID: mustParseUUID(p.ID), SKU: p.SKU, Title: p.Title, Price: inf.NewDec(int64(p.Price*1e8), 8), @@ -470,7 +534,7 @@ func fromProductRow(r *productRow) *datastore.Product { price = f } return &datastore.Product{ - ID: r.ID, + ID: r.ID.String(), SKU: r.SKU, Title: r.Title, Price: price, @@ -489,7 +553,7 @@ func fromProductRow(r *productRow) *datastore.Product { func toCategoryRow(c *datastore.Category) *categoryRow { return &categoryRow{ - ID: c.ID, + ID: mustParseUUID(c.ID), Name: c.Name, Slug: c.Slug, ParentID: c.ParentID, @@ -502,7 +566,7 @@ func toCategoryRow(c *datastore.Category) *categoryRow { func fromCategoryRow(r *categoryRow) *datastore.Category { return &datastore.Category{ - ID: r.ID, + ID: r.ID.String(), Name: r.Name, Slug: r.Slug, ParentID: r.ParentID, @@ -515,7 +579,7 @@ func fromCategoryRow(r *categoryRow) *datastore.Category { func toCollectionRow(c *datastore.Collection) *collectionRow { return &collectionRow{ - ID: c.ID, + ID: mustParseUUID(c.ID), Name: c.Name, Slug: c.Slug, DisplayOrder: c.DisplayOrder, @@ -528,7 +592,7 @@ func toCollectionRow(c *datastore.Collection) *collectionRow { func fromCollectionRow(r *collectionRow) *datastore.Collection { return &datastore.Collection{ - ID: r.ID, + ID: r.ID.String(), Name: r.Name, Slug: r.Slug, DisplayOrder: r.DisplayOrder, @@ -538,3 +602,40 @@ func fromCollectionRow(r *collectionRow) *datastore.Collection { Body: r.Body, } } + +func mustParseUUID(s string) gocql.UUID { + u, err := gocql.ParseUUID(s) + if err != nil { + panic(err) + } + return u +} + +func toNamespaceRow(ns *datastore.Namespace) *namespaceRow { + displayName := ns.DisplayName + return &namespaceRow{ + ID: mustParseUUID(ns.ID), + Identifier: ns.Identifier, + DisplayName: displayName, + Tier: string(ns.Tier), + ParentEnterpriseID: ns.ParentEnterpriseID, + CreatedAt: ns.CreatedAt.UnixMilli(), + CreatedBy: ns.CreatedBy, + UpdatedAt: ns.UpdatedAt.UnixMilli(), + UpdatedBy: ns.UpdatedBy, + } +} + +func fromNamespaceRow(r *namespaceRow) *datastore.Namespace { + return &datastore.Namespace{ + ID: r.ID.String(), + Identifier: r.Identifier, + DisplayName: r.DisplayName, + Tier: datastore.NamespaceTier(r.Tier), + ParentEnterpriseID: r.ParentEnterpriseID, + CreatedAt: millisToTime(r.CreatedAt), + CreatedBy: r.CreatedBy, + UpdatedAt: millisToTime(r.UpdatedAt), + UpdatedBy: r.UpdatedBy, + } +} diff --git a/gitstore-api/internal/datastore/scylla/backend_test.go b/gitstore-api/internal/datastore/scylla/backend_test.go index ee3e130..5a59b99 100644 --- a/gitstore-api/internal/datastore/scylla/backend_test.go +++ b/gitstore-api/internal/datastore/scylla/backend_test.go @@ -21,41 +21,25 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/testcontainers/testcontainers-go" - "github.com/testcontainers/testcontainers-go/wait" "go.uber.org/zap" ) -// scyllaAddr holds the host:port of the shared container started by TestMain. -var scyllaAddr string +var ( + scyllaAddr string + scyllaKeyspace string +) func TestMain(m *testing.M) { - ctx := context.Background() - req := testcontainers.ContainerRequest{ - Image: "scylladb/scylla:5.4", - ExposedPorts: []string{"9042/tcp"}, - Cmd: []string{"--developer-mode=1", "--overprovisioned=1", "--smp=1"}, - // ForExec verifies cqlsh can actually connect, not just that the log appeared. - WaitingFor: wait.ForExec([]string{"cqlsh", "-e", "describe cluster"}). - WithStartupTimeout(120 * time.Second), - } - c, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ - ContainerRequest: req, - Started: true, - }) - if err != nil { - panic("failed to start ScyllaDB container: " + err.Error()) + scyllaAddr = os.Getenv("GITSTORE_TEST_SCYLLA_ADDR") + if scyllaAddr == "" { + scyllaAddr = "127.0.0.1:9042" } + scyllaKeyspace = fmt.Sprintf("gitstore_scylla_test_%d", os.Getpid()) - host, _ := c.Host(ctx) - port, _ := c.MappedPort(ctx, "9042") - scyllaAddr = host + ":" + port.Port() - - // Provision keyspace — operator responsibility in production, init step in tests. - provisionKeyspace(scyllaAddr, "gitstore") - + provisionKeyspace(scyllaAddr, scyllaKeyspace) code := m.Run() - _ = c.Terminate(ctx) + dropKeyspace(scyllaAddr, scyllaKeyspace) + os.Exit(code) } @@ -105,11 +89,38 @@ func provisionKeyspace(addr, keyspace string) { } } +func dropKeyspace(addr, keyspace string) { + session, err := openRootSession(addr) + if err != nil { + return + } + defer session.Close() + _ = session.Query(fmt.Sprintf(`DROP KEYSPACE IF EXISTS %s`, keyspace)).Exec() +} + +func openRootSession(addr string) (*gocql.Session, error) { + host, portStr, splitErr := net.SplitHostPort(addr) + if splitErr != nil { + host = addr + portStr = "9042" + } + port, _ := strconv.Atoi(portStr) + cluster := gocql.NewCluster(host) + if port > 0 { + cluster.Port = port + } + cluster.Consistency = gocql.Quorum + cluster.ConnectTimeout = 5 * time.Second + cluster.Timeout = 5 * time.Second + cluster.DisableShardAwarePort = true + return cluster.CreateSession() +} + func newTestStore(t *testing.T) datastore.Datastore { t.Helper() cfg := config.ScyllaConfig{ Hosts: []string{scyllaAddr}, - Keyspace: "gitstore", + Keyspace: scyllaKeyspace, DisableShardAwarePort: true, } store, err := scylla.New(cfg, zap.NewNop()) diff --git a/gitstore-api/internal/datastore/scylla/migration.go b/gitstore-api/internal/datastore/scylla/migration.go index 26cd188..8a5ab47 100644 --- a/gitstore-api/internal/datastore/scylla/migration.go +++ b/gitstore-api/internal/datastore/scylla/migration.go @@ -5,21 +5,17 @@ package scylla import ( "context" - "embed" "errors" "fmt" - "io/fs" "time" + "github.com/gitstore-dev/gitstore/api/internal/datastore/scylla/migrations" "github.com/gocql/gocql" "github.com/scylladb/gocqlx/v3" "github.com/scylladb/gocqlx/v3/migrate" "go.uber.org/zap" ) -//go:embed migrations/*.cql -var migrationFiles embed.FS - const ( lockKey = "migration" lockTTL = 120 // seconds — self-expiry if holder crashes @@ -31,10 +27,13 @@ const ( // LWT lock, applies all pending CQL migrations via gocqlx/migrate, then // releases the lock. The session must already be scoped to the target keyspace. // instanceID should be a unique string per process (e.g. a UUID). -func RunMigrations(ctx context.Context, rawSession *gocql.Session, instanceID, keyspace string, log *zap.Logger) error { +func RunMigrations(ctx context.Context, rawSession *gocql.Session, keyspace, instanceID string, log *zap.Logger) error { if err := rawSession.Query( - `CREATE TABLE IF NOT EXISTS schema_migrations_lock ` + - `(lock_key text PRIMARY KEY, holder text, acquired_at timestamp)`, + `CREATE TABLE IF NOT EXISTS schema_migrations_lock ( + lock_key text PRIMARY KEY, + holder text, + acquired_at timestamp + )`, ).WithContext(ctx).Exec(); err != nil { return fmt.Errorf("create lock table: %w", err) } @@ -54,33 +53,37 @@ func RunMigrations(ctx context.Context, rawSession *gocql.Session, instanceID, k } }() + callbackLog := newMigrationCallbackLogger(log, keyspace) log.Info("running CQL migrations") - // migrate.FromFS expects a flat FS of *.cql files; sub into the migrations/ dir. - migrationsFS, err := fs.Sub(migrationFiles, "migrations") - if err != nil { - return fmt.Errorf("migrations sub-fs: %w", err) - } - - // Register a callback for "-- CALL await_tables;" in the migration file. - // On single-node --developer-mode=1 ScyllaDB, schema agreement returns - // immediately, but the storage engine for new tables may not be ready; - // we poll until a harmless SELECT succeeds on every table in the list. + // Register a callback for "-- CALL log_tables;" in the migration file. reg := migrate.CallbackRegister{} - reg.Add(migrate.CallComment, "await_tables", awaitTablesCallback(rawSession, keyspace, log)) + reg.Add(migrate.CallComment, "log_tables", callbackLog) migrate.Callback = reg.Callback session := gocqlx.NewSession(rawSession) - if err := migrate.FromFS(ctx, session, migrationsFS); err != nil { - migrate.Callback = nil + + pending, err := migrate.Pending(ctx, session, migrations.Files) + if err != nil { + return fmt.Errorf("pending: %w", err) + } + log.Info("pending migrations", zap.Int("count", len(pending))) + + if err := migrate.FromFS(ctx, session, migrations.Files); err != nil { return fmt.Errorf("apply migrations: %w", err) } - migrate.Callback = nil log.Info("migrations complete") return nil } +func newMigrationCallbackLogger(log *zap.Logger, keyspace string) migrate.CallbackFunc { + return func(_ context.Context, _ gocqlx.Session, _ migrate.CallbackEvent, name string) error { + log.Info("migration callback", zap.String("call", name), zap.String("keyspace", keyspace)) + return nil + } +} + func acquireLockWithRetry(ctx context.Context, session *gocql.Session, instanceID string, log *zap.Logger) (bool, error) { for attempt := range lockMaxRetries { applied, err := acquireLock(session, instanceID) @@ -122,45 +125,6 @@ func acquireLock(session *gocql.Session, instanceID string) (bool, error) { return applied, err } -// awaitTablesCallback returns a migrate.CallbackFunc that polls each core table -// with a SELECT COUNT(*) until all of them respond without an error. -// On single-node --developer-mode=1 ScyllaDB, AwaitSchemaAgreement returns -// immediately while the storage engine is still initialising new tables. -func awaitTablesCallback(session *gocql.Session, keyspace string, log *zap.Logger) migrate.CallbackFunc { - tables := []string{ - keyspace + ".products", - keyspace + ".categories", - keyspace + ".collections", - } - return func(ctx context.Context, _ gocqlx.Session, ev migrate.CallbackEvent, _ string) error { - if ev != migrate.CallComment { - return nil - } - deadline := time.Now().Add(30 * time.Second) - for _, tbl := range tables { - for { - var count int - err := session.Query("SELECT COUNT(*) FROM " + tbl). - WithContext(ctx).Scan(&count) - if err == nil { - break - } - if time.Now().After(deadline) { - return fmt.Errorf("await_tables: table %s not ready after 30s: %w", tbl, err) - } - log.Debug("await_tables: table not ready, retrying", - zap.String("table", tbl), zap.Error(err)) - select { - case <-ctx.Done(): - return ctx.Err() - case <-time.After(500 * time.Millisecond): - } - } - } - return nil - } -} - func releaseLock(session *gocql.Session, instanceID string) error { // MapScanCAS handles variable result shapes on conditional DELETE. dest := make(map[string]any) diff --git a/gitstore-api/internal/datastore/scylla/migration_test.go b/gitstore-api/internal/datastore/scylla/migration_test.go index 2966684..c200e7e 100644 --- a/gitstore-api/internal/datastore/scylla/migration_test.go +++ b/gitstore-api/internal/datastore/scylla/migration_test.go @@ -33,7 +33,7 @@ func newRawSession(t *testing.T) *gocql.Session { if port > 0 { cluster.Port = port } - cluster.Keyspace = "gitstore" // keyspace provisioned by TestMain in backend_test.go + cluster.Keyspace = scyllaKeyspace // keyspace provisioned by TestMain in backend_test.go cluster.Consistency = gocql.Quorum cluster.DisableShardAwarePort = true session, sessErr := cluster.CreateSession() @@ -46,21 +46,20 @@ func TestRunMigrations_AppliesSchema(t *testing.T) { session := newRawSession(t) log := zap.NewNop() - err := scylla.RunMigrations(context.Background(), session, uuid.New().String(), "gitstore", log) + err := scylla.RunMigrations(context.Background(), session, scyllaKeyspace, uuid.New().String(), log) require.NoError(t, err) // Verify keyspace exists. var ksName string - err = session.Query( - `SELECT keyspace_name FROM system_schema.keyspaces WHERE keyspace_name = 'gitstore'`, - ).Scan(&ksName) + err = session.Query(`SELECT keyspace_name FROM system_schema.keyspaces WHERE keyspace_name = ?`, scyllaKeyspace).Scan(&ksName) require.NoError(t, err) - assert.Equal(t, "gitstore", ksName) + assert.Equal(t, scyllaKeyspace, ksName) // Verify products table exists. var tblName string err = session.Query( - `SELECT table_name FROM system_schema.tables WHERE keyspace_name = 'gitstore' AND table_name = 'products'`, + `SELECT table_name FROM system_schema.tables WHERE keyspace_name = ? AND table_name = 'products'`, + scyllaKeyspace, ).Scan(&tblName) require.NoError(t, err) assert.Equal(t, "products", tblName) @@ -72,8 +71,8 @@ func TestRunMigrations_Idempotent(t *testing.T) { ctx := context.Background() // Running migrations twice must not return an error. - require.NoError(t, scylla.RunMigrations(ctx, session, uuid.New().String(), "gitstore", log)) - require.NoError(t, scylla.RunMigrations(ctx, session, uuid.New().String(), "gitstore", log)) + require.NoError(t, scylla.RunMigrations(ctx, session, scyllaKeyspace, uuid.New().String(), log)) + require.NoError(t, scylla.RunMigrations(ctx, session, scyllaKeyspace, uuid.New().String(), log)) } func TestRunMigrations_LockReleasedAfterSuccess(t *testing.T) { @@ -81,12 +80,12 @@ func TestRunMigrations_LockReleasedAfterSuccess(t *testing.T) { log := zap.NewNop() ctx := context.Background() - require.NoError(t, scylla.RunMigrations(ctx, session, uuid.New().String(), "gitstore", log)) + require.NoError(t, scylla.RunMigrations(ctx, session, scyllaKeyspace, uuid.New().String(), log)) // After success the lock row must be gone (deleted by releaseLock). var holder string err := session.Query( - `SELECT holder FROM gitstore.schema_migrations_lock WHERE lock_key = 'migration'`, + `SELECT holder FROM schema_migrations_lock WHERE lock_key = 'migration'`, ).Scan(&holder) // ErrNotFound means the row was deleted, which is what we want. assert.ErrorIs(t, err, gocql.ErrNotFound) diff --git a/gitstore-api/internal/datastore/scylla/migrations/001_initial_schema.cql b/gitstore-api/internal/datastore/scylla/migrations/001_initial_schema.cql index 7e13c76..f09918f 100644 --- a/gitstore-api/internal/datastore/scylla/migrations/001_initial_schema.cql +++ b/gitstore-api/internal/datastore/scylla/migrations/001_initial_schema.cql @@ -3,7 +3,7 @@ -- UUID fields use text for Go string compatibility. Price uses decimal; CREATE TABLE IF NOT EXISTS products ( - id text PRIMARY KEY, + id uuid PRIMARY KEY, sku text, title text, price decimal, @@ -20,30 +20,35 @@ CREATE TABLE IF NOT EXISTS products ( ); CREATE TABLE IF NOT EXISTS categories ( - id text PRIMARY KEY, - name text, - slug text, - parent_id text, - display_order int, - created_at timestamp, - updated_at timestamp, - body text + id uuid PRIMARY KEY, + name text, + slug text, + parent_id text, + display_order int, + created_at timestamp, + updated_at timestamp, + body text ); CREATE TABLE IF NOT EXISTS collections ( - id text PRIMARY KEY, - name text, - slug text, - display_order int, - product_ids set, - created_at timestamp, - updated_at timestamp, - body text + id uuid PRIMARY KEY, + name text, + slug text, + display_order int, + product_ids set, + created_at timestamp, + updated_at timestamp, + body text ); --- CALL await_tables; - -CREATE INDEX IF NOT EXISTS products_by_sku ON products (sku); -CREATE INDEX IF NOT EXISTS products_by_category ON products (category_id); -CREATE INDEX IF NOT EXISTS categories_by_slug ON categories(slug); -CREATE INDEX IF NOT EXISTS collections_by_slug ON collections(slug); +CREATE TABLE IF NOT EXISTS namespaces ( + id uuid PRIMARY KEY, + identifier text, + display_name text, + tier text, + parent_enterprise_id text, + created_at bigint, + created_by text, + updated_at bigint, + updated_by text +); diff --git a/gitstore-api/internal/datastore/scylla/migrations/002_add_initial_indices.cql b/gitstore-api/internal/datastore/scylla/migrations/002_add_initial_indices.cql new file mode 100644 index 0000000..47424bb --- /dev/null +++ b/gitstore-api/internal/datastore/scylla/migrations/002_add_initial_indices.cql @@ -0,0 +1,7 @@ +-- CALL log_tables; + +CREATE INDEX IF NOT EXISTS products_by_sku ON products (sku); +CREATE INDEX IF NOT EXISTS products_by_category ON products (category_id); +CREATE INDEX IF NOT EXISTS categories_by_slug ON categories(slug); +CREATE INDEX IF NOT EXISTS collections_by_slug ON collections(slug); +CREATE INDEX IF NOT EXISTS namespaces_by_identifier ON namespaces (identifier); diff --git a/gitstore-api/internal/datastore/scylla/migrations/files.go b/gitstore-api/internal/datastore/scylla/migrations/files.go new file mode 100644 index 0000000..a947941 --- /dev/null +++ b/gitstore-api/internal/datastore/scylla/migrations/files.go @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later +// Copyright (c) 2026 GitStore contributors + +package migrations + +import "embed" + +// Files contains *.cql schema migration files +// +//go:embed *.cql +var Files embed.FS diff --git a/gitstore-api/internal/datastore/scylla/models.go b/gitstore-api/internal/datastore/scylla/models.go new file mode 100644 index 0000000..e7feb9a --- /dev/null +++ b/gitstore-api/internal/datastore/scylla/models.go @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later +// Copyright (c) 2026 GitStore contributors + +package scylla + +import "github.com/scylladb/gocqlx/v3/table" + +// Table models +var ( + Product = table.New(table.Metadata{ + Name: "products", + Columns: []string{ + "id", + "sku", + "title", + "price", + "currency", + "inventory_status", + "inventory_quantity", + "category_id", + "collection_ids", + "images", + "metadata", + "created_at", + "updated_at", + "body", + }, + PartKey: []string{ + "id", + }, + }) + + Category = table.New(table.Metadata{ + Name: "categories", + Columns: []string{ + "id", + "name", + "slug", + "parent_id", + "display_order", + "created_at", + "updated_at", + "body", + }, + PartKey: []string{ + "id", + }, + }) + + Collection = table.New(table.Metadata{ + Name: "collections", + Columns: []string{ + "id", + "name", + "slug", + "display_order", + "product_ids", + "created_at", + "updated_at", + "body", + }, + PartKey: []string{ + "id", + }, + }) + + Namespace = table.New(table.Metadata{ + Name: "namespaces", + Columns: []string{ + "id", + "identifier", + "display_name", + "tier", + "parent_enterprise_id", + "created_at", + "created_by", + "updated_at", + "updated_by", + }, + PartKey: []string{ + "id", + }, + }) +) diff --git a/gitstore-api/internal/graph/auth.resolvers.go b/gitstore-api/internal/graph/auth.resolvers.go index a923ba8..2e6c712 100644 --- a/gitstore-api/internal/graph/auth.resolvers.go +++ b/gitstore-api/internal/graph/auth.resolvers.go @@ -3,26 +3,60 @@ 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.88 +// Code generated by github.com/99designs/gqlgen version v0.17.90 import ( "context" - "fmt" + "time" "github.com/gitstore-dev/gitstore/api/internal/graph/model" + "github.com/vektah/gqlparser/v2/gqlerror" + "go.uber.org/zap" ) // Login is the resolver for the login field. func (r *mutationResolver) Login(ctx context.Context, input model.LoginInput) (*model.LoginPayload, error) { - panic(fmt.Errorf("not implemented: Login - login")) + if r.authMiddleware == nil { + r.logger.Error("auth middleware not configured") + return nil, gqlerror.Errorf("authentication service unavailable") + } + + if !r.authMiddleware.ValidateCredentials(input.Username, input.Password) { + r.logger.Debug("invalid credentials attempt", + zap.String("username", input.Username), + ) + return nil, gqlerror.Errorf("invalid username or password") + } + + token, err := r.authMiddleware.GenerateSessionToken(input.Username, true) + if err != nil { + r.logger.Error("failed to generate session token", + zap.String("username", input.Username), + zap.Error(err), + ) + return nil, gqlerror.Errorf("internal server error") + } + + expiresAt := time.Now().Add(r.authMiddleware.GetTokenDuration()) + return &model.LoginPayload{ + ClientMutationID: input.ClientMutationID, + Session: &model.AuthSession{ + Token: token, + ExpiresAt: expiresAt, + User: &model.User{ + Username: input.Username, + IsAdmin: true, + }, + }, + }, nil } // Logout is the resolver for the logout field. func (r *mutationResolver) Logout(ctx context.Context, input model.LogoutInput) (*model.LogoutPayload, error) { - panic(fmt.Errorf("not implemented: Logout - logout")) + return nil, gqlerror.Errorf("not implemented: Logout") } // RefreshToken is the resolver for the refreshToken field. func (r *mutationResolver) RefreshToken(ctx context.Context, input model.RefreshTokenInput) (*model.RefreshTokenPayload, error) { - panic(fmt.Errorf("not implemented: RefreshToken - refreshToken")) + return nil, gqlerror.Errorf("not implemented: RefreshToken") } diff --git a/gitstore-api/internal/graph/category.resolvers.go b/gitstore-api/internal/graph/category.resolvers.go index 7a44844..817f862 100644 --- a/gitstore-api/internal/graph/category.resolvers.go +++ b/gitstore-api/internal/graph/category.resolvers.go @@ -3,7 +3,7 @@ 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.88 +// Code generated by github.com/99designs/gqlgen version v0.17.90 import ( "context" diff --git a/gitstore-api/internal/graph/collection.resolvers.go b/gitstore-api/internal/graph/collection.resolvers.go index 9dfd451..55d9b29 100644 --- a/gitstore-api/internal/graph/collection.resolvers.go +++ b/gitstore-api/internal/graph/collection.resolvers.go @@ -3,7 +3,7 @@ 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.88 +// Code generated by github.com/99designs/gqlgen version v0.17.90 import ( "context" diff --git a/gitstore-api/internal/graph/converters.go b/gitstore-api/internal/graph/converters.go index 14a38d5..3376b1c 100644 --- a/gitstore-api/internal/graph/converters.go +++ b/gitstore-api/internal/graph/converters.go @@ -7,6 +7,7 @@ package graph import ( "github.com/gitstore-dev/gitstore/api/internal/catalog" + "github.com/gitstore-dev/gitstore/api/internal/datastore" "github.com/gitstore-dev/gitstore/api/internal/graph/model" "github.com/gitstore-dev/gitstore/api/internal/graph/scalar" "github.com/shopspring/decimal" @@ -77,3 +78,37 @@ func CatalogCollectionToGraphQL(c *catalog.Collection) *model.Collection { UpdatedAt: c.UpdatedAt, } } + +// datastoreNamespaceToModel converts a datastore Namespace to a GraphQL model Namespace. +func datastoreNamespaceToModel(ns *datastore.Namespace) *model.Namespace { + if ns == nil { + return nil + } + var displayName *string + if ns.DisplayName != "" { + dn := ns.DisplayName + displayName = &dn + } + return &model.Namespace{ + ID: ns.ID, + Identifier: ns.Identifier, + DisplayName: displayName, + Tier: datastoreNamespaceTierToModel(ns.Tier), + ParentEnterpriseID: ns.ParentEnterpriseID, + CreatedAt: ns.CreatedAt, + CreatedBy: ns.CreatedBy, + UpdatedAt: ns.UpdatedAt, + UpdatedBy: ns.UpdatedBy, + } +} + +func datastoreNamespaceTierToModel(t datastore.NamespaceTier) model.NamespaceTier { + switch t { + case datastore.NamespaceTierOrganisation: + return model.NamespaceTierOrganisation + case datastore.NamespaceTierEnterprise: + return model.NamespaceTierEnterprise + default: + return model.NamespaceTierUser + } +} diff --git a/gitstore-api/internal/graph/generated/generated.go b/gitstore-api/internal/graph/generated/generated.go index c78788d..2c1111f 100644 --- a/gitstore-api/internal/graph/generated/generated.go +++ b/gitstore-api/internal/graph/generated/generated.go @@ -7,6 +7,7 @@ import ( "context" "errors" "fmt" + "math" "strconv" "sync/atomic" "time" @@ -112,6 +113,10 @@ type ComplexityRoot struct { Collection func(childComplexity int) int } + CreateNamespacePayload struct { + Namespace func(childComplexity int) int + } + CreateProductPayload struct { ClientMutationID func(childComplexity int) int Product func(childComplexity int) int @@ -128,6 +133,10 @@ type ComplexityRoot struct { DeletedCollectionID func(childComplexity int) int } + DeleteNamespacePayload struct { + DeletedIdentifier func(childComplexity int) int + } + DeleteProductPayload struct { ClientMutationID func(childComplexity int) int DeletedProductID func(childComplexity int) int @@ -146,9 +155,11 @@ type ComplexityRoot struct { Mutation struct { CreateCategory func(childComplexity int, input model.CreateCategoryInput) int CreateCollection func(childComplexity int, input model.CreateCollectionInput) int + CreateNamespace func(childComplexity int, input model.CreateNamespaceInput) int CreateProduct func(childComplexity int, input model.CreateProductInput) int DeleteCategory func(childComplexity int, input model.DeleteCategoryInput) int DeleteCollection func(childComplexity int, input model.DeleteCollectionInput) int + DeleteNamespace func(childComplexity int, input model.DeleteNamespaceInput) int DeleteProduct func(childComplexity int, input model.DeleteProductInput) int Login func(childComplexity int, input model.LoginInput) int Logout func(childComplexity int, input model.LogoutInput) int @@ -161,6 +172,18 @@ type ComplexityRoot struct { UpdateProduct func(childComplexity int, input model.UpdateProductInput) int } + Namespace struct { + CreatedAt func(childComplexity int) int + CreatedBy func(childComplexity int) int + DisplayName func(childComplexity int) int + ID func(childComplexity int) int + Identifier func(childComplexity int) int + ParentEnterpriseID func(childComplexity int) int + Tier func(childComplexity int) int + UpdatedAt func(childComplexity int) int + UpdatedBy func(childComplexity int) int + } + OptimisticLockConflict struct { AttemptedVersion func(childComplexity int) int Current func(childComplexity int) int @@ -216,6 +239,9 @@ type ComplexityRoot struct { Collection func(childComplexity int, slug string) int CollectionByID func(childComplexity int, id string) int Collections func(childComplexity int) int + Namespace func(childComplexity int, identifier string) int + NamespaceByID func(childComplexity int, id string) int + Namespaces func(childComplexity int) int Node func(childComplexity int, id string) int Nodes func(childComplexity int, ids []string) int Product func(childComplexity int, sku string) int @@ -284,6 +310,8 @@ type MutationResolver interface { Login(ctx context.Context, input model.LoginInput) (*model.LoginPayload, error) Logout(ctx context.Context, input model.LogoutInput) (*model.LogoutPayload, error) RefreshToken(ctx context.Context, input model.RefreshTokenInput) (*model.RefreshTokenPayload, error) + CreateNamespace(ctx context.Context, input model.CreateNamespaceInput) (*model.CreateNamespacePayload, error) + DeleteNamespace(ctx context.Context, input model.DeleteNamespaceInput) (*model.DeleteNamespacePayload, error) } type ProductResolver interface { Category(ctx context.Context, obj *model.Product) (*model.Category, error) @@ -302,6 +330,9 @@ type QueryResolver interface { CollectionByID(ctx context.Context, id string) (*model.Collection, error) Collections(ctx context.Context) ([]*model.Collection, error) CatalogVersion(ctx context.Context) (*model.CatalogVersion, error) + Namespace(ctx context.Context, identifier string) (*model.Namespace, error) + NamespaceByID(ctx context.Context, id string) (*model.Namespace, error) + Namespaces(ctx context.Context) ([]*model.Namespace, error) } type executableSchema graphql.ExecutableSchemaState[ResolverRoot, DirectiveRoot, ComplexityRoot] @@ -607,6 +638,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.CreateCollectionPayload.Collection(childComplexity), true + case "CreateNamespacePayload.namespace": + if e.ComplexityRoot.CreateNamespacePayload.Namespace == nil { + break + } + + return e.ComplexityRoot.CreateNamespacePayload.Namespace(childComplexity), true + case "CreateProductPayload.clientMutationId": if e.ComplexityRoot.CreateProductPayload.ClientMutationID == nil { break @@ -652,6 +690,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.DeleteCollectionPayload.DeletedCollectionID(childComplexity), true + case "DeleteNamespacePayload.deletedIdentifier": + if e.ComplexityRoot.DeleteNamespacePayload.DeletedIdentifier == nil { + break + } + + return e.ComplexityRoot.DeleteNamespacePayload.DeletedIdentifier(childComplexity), true + case "DeleteProductPayload.clientMutationId": if e.ComplexityRoot.DeleteProductPayload.ClientMutationID == nil { break @@ -713,6 +758,17 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin } return e.ComplexityRoot.Mutation.CreateCollection(childComplexity, args["input"].(model.CreateCollectionInput)), true + case "Mutation.createNamespace": + if e.ComplexityRoot.Mutation.CreateNamespace == nil { + break + } + + args, err := ec.field_Mutation_createNamespace_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.CreateNamespace(childComplexity, args["input"].(model.CreateNamespaceInput)), true case "Mutation.createProduct": if e.ComplexityRoot.Mutation.CreateProduct == nil { break @@ -746,6 +802,17 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin } return e.ComplexityRoot.Mutation.DeleteCollection(childComplexity, args["input"].(model.DeleteCollectionInput)), true + case "Mutation.deleteNamespace": + if e.ComplexityRoot.Mutation.DeleteNamespace == nil { + break + } + + args, err := ec.field_Mutation_deleteNamespace_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.DeleteNamespace(childComplexity, args["input"].(model.DeleteNamespaceInput)), true case "Mutation.deleteProduct": if e.ComplexityRoot.Mutation.DeleteProduct == nil { break @@ -857,6 +924,61 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Mutation.UpdateProduct(childComplexity, args["input"].(model.UpdateProductInput)), true + case "Namespace.createdAt": + if e.ComplexityRoot.Namespace.CreatedAt == nil { + break + } + + return e.ComplexityRoot.Namespace.CreatedAt(childComplexity), true + case "Namespace.createdBy": + if e.ComplexityRoot.Namespace.CreatedBy == nil { + break + } + + return e.ComplexityRoot.Namespace.CreatedBy(childComplexity), true + case "Namespace.displayName": + if e.ComplexityRoot.Namespace.DisplayName == nil { + break + } + + return e.ComplexityRoot.Namespace.DisplayName(childComplexity), true + case "Namespace.id": + if e.ComplexityRoot.Namespace.ID == nil { + break + } + + return e.ComplexityRoot.Namespace.ID(childComplexity), true + case "Namespace.identifier": + if e.ComplexityRoot.Namespace.Identifier == nil { + break + } + + return e.ComplexityRoot.Namespace.Identifier(childComplexity), true + case "Namespace.parentEnterpriseId": + if e.ComplexityRoot.Namespace.ParentEnterpriseID == nil { + break + } + + return e.ComplexityRoot.Namespace.ParentEnterpriseID(childComplexity), true + case "Namespace.tier": + if e.ComplexityRoot.Namespace.Tier == nil { + break + } + + return e.ComplexityRoot.Namespace.Tier(childComplexity), true + case "Namespace.updatedAt": + if e.ComplexityRoot.Namespace.UpdatedAt == nil { + break + } + + return e.ComplexityRoot.Namespace.UpdatedAt(childComplexity), true + case "Namespace.updatedBy": + if e.ComplexityRoot.Namespace.UpdatedBy == nil { + break + } + + return e.ComplexityRoot.Namespace.UpdatedBy(childComplexity), true + case "OptimisticLockConflict.attemptedVersion": if e.ComplexityRoot.OptimisticLockConflict.AttemptedVersion == nil { break @@ -1100,6 +1222,34 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Query.Collections(childComplexity), true + case "Query.namespace": + if e.ComplexityRoot.Query.Namespace == nil { + break + } + + args, err := ec.field_Query_namespace_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Namespace(childComplexity, args["identifier"].(string)), true + case "Query.namespaceById": + if e.ComplexityRoot.Query.NamespaceByID == nil { + break + } + + args, err := ec.field_Query_namespaceById_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.NamespaceByID(childComplexity, args["id"].(string)), true + case "Query.namespaces": + if e.ComplexityRoot.Query.Namespaces == nil { + break + } + + return e.ComplexityRoot.Query.Namespaces(childComplexity), true case "Query.node": if e.ComplexityRoot.Query.Node == nil { break @@ -1275,9 +1425,11 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputCreateCategoryInput, ec.unmarshalInputCreateCollectionInput, + ec.unmarshalInputCreateNamespaceInput, ec.unmarshalInputCreateProductInput, ec.unmarshalInputDeleteCategoryInput, ec.unmarshalInputDeleteCollectionInput, + ec.unmarshalInputDeleteNamespaceInput, ec.unmarshalInputDeleteProductInput, ec.unmarshalInputLoginInput, ec.unmarshalInputLogoutInput, @@ -1352,8 +1504,8 @@ func newExecutionContext( opCtx *graphql.OperationContext, execSchema *executableSchema, deferredResults chan graphql.DeferredResult, -) executionContext { - return executionContext{ +) *executionContext { + return &executionContext{ ExecutionContextState: graphql.NewExecutionContextState[ResolverRoot, DirectiveRoot, ComplexityRoot]( opCtx, (*graphql.ExecutableSchemaState[ResolverRoot, DirectiveRoot, ComplexityRoot])(execSchema), @@ -1364,7 +1516,7 @@ func newExecutionContext( } var sources = []*ast.Source{ - {Name: "../../../../shared/schemas/auth.graphql", Input: `# Authentication Types and Mutations + {Name: "../../../../shared/schemas/auth.graphqls", Input: `# Authentication Types and Mutations """ Authenticated user information @@ -1504,7 +1656,7 @@ extend type Mutation { refreshToken(input: RefreshTokenInput!): RefreshTokenPayload! } `, BuiltIn: false}, - {Name: "../../../../shared/schemas/category.graphql", Input: `# Category Entity GraphQL Types + {Name: "../../../../shared/schemas/category.graphqls", Input: `# Category Entity GraphQL Types """ Category represents a hierarchical classification system for products @@ -1800,7 +1952,7 @@ type CategoryOptimisticLockConflict { diff: String! } `, BuiltIn: false}, - {Name: "../../../../shared/schemas/collection.graphql", Input: `# Collection Entity GraphQL Types + {Name: "../../../../shared/schemas/collection.graphqls", Input: `# Collection Entity GraphQL Types """ Collection represents a curated grouping of products (flat, non-hierarchical) @@ -2155,7 +2307,186 @@ type CatalogStats { orphanedReferences: Int! } `, BuiltIn: false}, - {Name: "../../../../shared/schemas/product.graphql", Input: `# Product Entity GraphQL Types + {Name: "../../../../shared/schemas/namespace.graphqls", Input: `# SPDX-License-Identifier: AGPL-3.0-or-later +# Copyright (c) 2026 GitStore contributors + +""" +The tier of a namespace, which determines ownership and repository capabilities. +""" +enum NamespaceTier { + """ + User-space namespace: owned by an individual, directly owns repositories. + Any authenticated user may create one. + """ + USER + + """ + Organisation namespace: owned by a team or company, directly owns repositories. + May declare a parent enterprise at creation time. + Any authenticated user may create one. + """ + ORGANISATION + + """ + Enterprise namespace: organises organisations, does NOT own repositories directly. + Only callers with an elevated platform role (isAdmin) may create one. + """ + ENTERPRISE +} + +""" +A namespace is the primary isolation boundary for repositories in GitStore. +Namespaces are globally unique across all tiers — the same identifier cannot +exist as both a user-space and an organisation namespace. +""" +type Namespace implements Node { + """ + Globally unique system-generated ID (UUID). + """ + id: ID! + + """ + Human-readable identifier, globally unique across all tiers. + DNS label format: lowercase alphanumeric and hyphens, 1–63 characters. + Cannot begin or end with a hyphen. + """ + identifier: String! + + """ + Optional human-friendly display name. + """ + displayName: String + + """ + The tier of this namespace. + """ + tier: NamespaceTier! + + """ + For ORGANISATION tier namespaces: the ID of the parent enterprise namespace, + if one was declared at creation time. + Null for USER and ENTERPRISE tier namespaces. + """ + parentEnterpriseId: ID + + """ + Timestamp when this namespace was created. + """ + createdAt: DateTime! + + """ + Username of the caller who created this namespace. + """ + createdBy: String! + + """ + Timestamp when this namespace was last modified. + """ + updatedAt: DateTime! + + """ + Username of the caller who last modified this namespace. + """ + updatedBy: String! +} + +""" +Input for creating a new namespace. +""" +input CreateNamespaceInput { + """ + The human-readable identifier for the namespace. + Must be globally unique across all tiers. + DNS label format: lowercase alphanumeric and hyphens, 1–63 characters. + Cannot begin or end with a hyphen. Cannot be a reserved name. + """ + identifier: String! + + """ + Optional human-friendly display name. + """ + displayName: String + + """ + The tier of the namespace being created. + USER and ORGANISATION tiers may be created by any authenticated user. + ENTERPRISE tier requires isAdmin == true in the caller's JWT. + """ + tier: NamespaceTier! + + """ + For ORGANISATION tier only: the identifier of the parent enterprise namespace. + The referenced namespace must exist and have tier ENTERPRISE. + Omit for USER and ENTERPRISE tier namespaces. + """ + parentEnterpriseIdentifier: String +} + +""" +Input for deleting a namespace. +""" +input DeleteNamespaceInput { + """ + The identifier of the namespace to delete. + Deletion is blocked if any repositories exist within the namespace. + Requires the caller to be the namespace owner (createdBy) or isAdmin. + """ + identifier: String! +} + +""" +Payload returned after successfully creating a namespace. +""" +type CreateNamespacePayload { + """ + The newly created namespace. + """ + namespace: Namespace! +} + +""" +Payload returned after successfully deleting a namespace. +""" +type DeleteNamespacePayload { + """ + The identifier of the deleted namespace. + """ + deletedIdentifier: String! +} + +extend type Query { + """ + Get a namespace by its human-readable identifier. + """ + namespace(identifier: String!): Namespace + + """ + Get a namespace by its system-generated ID. + """ + namespaceById(id: ID!): Namespace + + """ + List all namespaces. + """ + namespaces: [Namespace!]! +} + +extend type Mutation { + """ + Create a new namespace. + Requires authentication. ENTERPRISE tier requires isAdmin. + """ + createNamespace(input: CreateNamespaceInput!): CreateNamespacePayload! + + """ + Delete a namespace. + Requires authentication. Caller must be the namespace owner or isAdmin. + Deletion is blocked when the namespace contains repositories. + """ + deleteNamespace(input: DeleteNamespaceInput!): DeleteNamespacePayload! +} +`, BuiltIn: false}, + {Name: "../../../../shared/schemas/product.graphqls", Input: `# Product Entity GraphQL Types """ Product represents a sellable item in the catalog @@ -2506,8 +2837,7 @@ type OptimisticLockConflict { diff: String! } `, BuiltIn: false}, - {Name: "../../../../shared/schemas/schema.graphql", Input: `# GitStore GraphQL Schema -# API-First Design: Contract defined before implementation + {Name: "../../../../shared/schemas/schema.graphqls", Input: `# GitStore GraphQL Schema # Relay Specification: Node interface, Connection pattern, Mutation pattern schema { @@ -2768,6 +3098,538 @@ input ProductFilter { } 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_AuthSession(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "token": + return ec.fieldContext_AuthSession_token(ctx, field) + case "expiresAt": + return ec.fieldContext_AuthSession_expiresAt(ctx, field) + case "user": + return ec.fieldContext_AuthSession_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AuthSession", field.Name) +} + +func (ec *executionContext) childFields_CatalogStats(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "productCount": + return ec.fieldContext_CatalogStats_productCount(ctx, field) + case "categoryCount": + return ec.fieldContext_CatalogStats_categoryCount(ctx, field) + case "collectionCount": + return ec.fieldContext_CatalogStats_collectionCount(ctx, field) + case "orphanedReferences": + return ec.fieldContext_CatalogStats_orphanedReferences(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CatalogStats", field.Name) +} + +func (ec *executionContext) childFields_CatalogVersion(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "tag": + return ec.fieldContext_CatalogVersion_tag(ctx, field) + case "commit": + return ec.fieldContext_CatalogVersion_commit(ctx, field) + case "publishedAt": + return ec.fieldContext_CatalogVersion_publishedAt(ctx, field) + case "message": + return ec.fieldContext_CatalogVersion_message(ctx, field) + case "stats": + return ec.fieldContext_CatalogVersion_stats(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CatalogVersion", field.Name) +} + +func (ec *executionContext) childFields_Category(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Category_id(ctx, field) + case "name": + return ec.fieldContext_Category_name(ctx, field) + case "slug": + return ec.fieldContext_Category_slug(ctx, field) + case "parent": + return ec.fieldContext_Category_parent(ctx, field) + case "children": + return ec.fieldContext_Category_children(ctx, field) + case "displayOrder": + return ec.fieldContext_Category_displayOrder(ctx, field) + case "products": + return ec.fieldContext_Category_products(ctx, field) + case "body": + return ec.fieldContext_Category_body(ctx, field) + case "createdAt": + return ec.fieldContext_Category_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Category_updatedAt(ctx, field) + case "path": + return ec.fieldContext_Category_path(ctx, field) + case "depth": + return ec.fieldContext_Category_depth(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) +} + +func (ec *executionContext) childFields_CategoryOptimisticLockConflict(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "currentVersion": + return ec.fieldContext_CategoryOptimisticLockConflict_currentVersion(ctx, field) + case "attemptedVersion": + return ec.fieldContext_CategoryOptimisticLockConflict_attemptedVersion(ctx, field) + case "current": + return ec.fieldContext_CategoryOptimisticLockConflict_current(ctx, field) + case "diff": + return ec.fieldContext_CategoryOptimisticLockConflict_diff(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CategoryOptimisticLockConflict", field.Name) +} + +func (ec *executionContext) childFields_Collection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Collection_id(ctx, field) + case "name": + return ec.fieldContext_Collection_name(ctx, field) + case "slug": + return ec.fieldContext_Collection_slug(ctx, field) + case "displayOrder": + return ec.fieldContext_Collection_displayOrder(ctx, field) + case "products": + return ec.fieldContext_Collection_products(ctx, field) + case "body": + return ec.fieldContext_Collection_body(ctx, field) + case "createdAt": + return ec.fieldContext_Collection_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Collection_updatedAt(ctx, field) + case "productCount": + return ec.fieldContext_Collection_productCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Collection", field.Name) +} + +func (ec *executionContext) childFields_CollectionOptimisticLockConflict(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "currentVersion": + return ec.fieldContext_CollectionOptimisticLockConflict_currentVersion(ctx, field) + case "attemptedVersion": + return ec.fieldContext_CollectionOptimisticLockConflict_attemptedVersion(ctx, field) + case "current": + return ec.fieldContext_CollectionOptimisticLockConflict_current(ctx, field) + case "diff": + return ec.fieldContext_CollectionOptimisticLockConflict_diff(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CollectionOptimisticLockConflict", field.Name) +} + +func (ec *executionContext) childFields_CreateCategoryPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_CreateCategoryPayload_clientMutationId(ctx, field) + case "category": + return ec.fieldContext_CreateCategoryPayload_category(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateCategoryPayload", field.Name) +} + +func (ec *executionContext) childFields_CreateCollectionPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_CreateCollectionPayload_clientMutationId(ctx, field) + case "collection": + return ec.fieldContext_CreateCollectionPayload_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateCollectionPayload", field.Name) +} + +func (ec *executionContext) childFields_CreateNamespacePayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "namespace": + return ec.fieldContext_CreateNamespacePayload_namespace(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateNamespacePayload", field.Name) +} + +func (ec *executionContext) childFields_CreateProductPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_CreateProductPayload_clientMutationId(ctx, field) + case "product": + return ec.fieldContext_CreateProductPayload_product(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateProductPayload", field.Name) +} + +func (ec *executionContext) childFields_DeleteCategoryPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_DeleteCategoryPayload_clientMutationId(ctx, field) + case "deletedCategoryId": + return ec.fieldContext_DeleteCategoryPayload_deletedCategoryId(ctx, field) + case "orphanedProductIds": + return ec.fieldContext_DeleteCategoryPayload_orphanedProductIds(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteCategoryPayload", field.Name) +} + +func (ec *executionContext) childFields_DeleteCollectionPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_DeleteCollectionPayload_clientMutationId(ctx, field) + case "deletedCollectionId": + return ec.fieldContext_DeleteCollectionPayload_deletedCollectionId(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteCollectionPayload", field.Name) +} + +func (ec *executionContext) childFields_DeleteNamespacePayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "deletedIdentifier": + return ec.fieldContext_DeleteNamespacePayload_deletedIdentifier(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteNamespacePayload", field.Name) +} + +func (ec *executionContext) childFields_DeleteProductPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_DeleteProductPayload_clientMutationId(ctx, field) + case "deletedProductId": + return ec.fieldContext_DeleteProductPayload_deletedProductId(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteProductPayload", field.Name) +} + +func (ec *executionContext) childFields_LoginPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_LoginPayload_clientMutationId(ctx, field) + case "session": + return ec.fieldContext_LoginPayload_session(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type LoginPayload", field.Name) +} + +func (ec *executionContext) childFields_LogoutPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_LogoutPayload_clientMutationId(ctx, field) + case "success": + return ec.fieldContext_LogoutPayload_success(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type LogoutPayload", field.Name) +} + +func (ec *executionContext) childFields_Namespace(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Namespace_id(ctx, field) + case "identifier": + return ec.fieldContext_Namespace_identifier(ctx, field) + case "displayName": + return ec.fieldContext_Namespace_displayName(ctx, field) + case "tier": + return ec.fieldContext_Namespace_tier(ctx, field) + case "parentEnterpriseId": + return ec.fieldContext_Namespace_parentEnterpriseId(ctx, field) + case "createdAt": + return ec.fieldContext_Namespace_createdAt(ctx, field) + case "createdBy": + return ec.fieldContext_Namespace_createdBy(ctx, field) + case "updatedAt": + return ec.fieldContext_Namespace_updatedAt(ctx, field) + case "updatedBy": + return ec.fieldContext_Namespace_updatedBy(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Namespace", field.Name) +} + +func (ec *executionContext) childFields_OptimisticLockConflict(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "currentVersion": + return ec.fieldContext_OptimisticLockConflict_currentVersion(ctx, field) + case "attemptedVersion": + return ec.fieldContext_OptimisticLockConflict_attemptedVersion(ctx, field) + case "current": + return ec.fieldContext_OptimisticLockConflict_current(ctx, field) + case "diff": + return ec.fieldContext_OptimisticLockConflict_diff(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type OptimisticLockConflict", field.Name) +} + +func (ec *executionContext) childFields_PageInfo(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) +} + +func (ec *executionContext) childFields_Product(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Product_id(ctx, field) + case "sku": + return ec.fieldContext_Product_sku(ctx, field) + case "title": + return ec.fieldContext_Product_title(ctx, field) + case "body": + return ec.fieldContext_Product_body(ctx, field) + case "price": + return ec.fieldContext_Product_price(ctx, field) + case "currency": + return ec.fieldContext_Product_currency(ctx, field) + case "inventoryStatus": + return ec.fieldContext_Product_inventoryStatus(ctx, field) + case "inventoryQuantity": + return ec.fieldContext_Product_inventoryQuantity(ctx, field) + case "category": + return ec.fieldContext_Product_category(ctx, field) + case "collections": + return ec.fieldContext_Product_collections(ctx, field) + case "images": + return ec.fieldContext_Product_images(ctx, field) + case "metadata": + return ec.fieldContext_Product_metadata(ctx, field) + case "createdAt": + return ec.fieldContext_Product_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Product_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Product", field.Name) +} + +func (ec *executionContext) childFields_ProductConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ProductConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ProductConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ProductConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ProductConnection", field.Name) +} + +func (ec *executionContext) childFields_ProductEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "cursor": + return ec.fieldContext_ProductEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_ProductEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ProductEdge", field.Name) +} + +func (ec *executionContext) childFields_PublishCatalogPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_PublishCatalogPayload_clientMutationId(ctx, field) + case "catalogVersion": + return ec.fieldContext_PublishCatalogPayload_catalogVersion(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PublishCatalogPayload", field.Name) +} + +func (ec *executionContext) childFields_RefreshTokenPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_RefreshTokenPayload_clientMutationId(ctx, field) + case "session": + return ec.fieldContext_RefreshTokenPayload_session(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RefreshTokenPayload", field.Name) +} + +func (ec *executionContext) childFields_ReorderCategoriesPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_ReorderCategoriesPayload_clientMutationId(ctx, field) + case "categories": + return ec.fieldContext_ReorderCategoriesPayload_categories(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ReorderCategoriesPayload", field.Name) +} + +func (ec *executionContext) childFields_ReorderCollectionsPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_ReorderCollectionsPayload_clientMutationId(ctx, field) + case "collections": + return ec.fieldContext_ReorderCollectionsPayload_collections(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ReorderCollectionsPayload", field.Name) +} + +func (ec *executionContext) childFields_UpdateCategoryPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_UpdateCategoryPayload_clientMutationId(ctx, field) + case "category": + return ec.fieldContext_UpdateCategoryPayload_category(ctx, field) + case "conflict": + return ec.fieldContext_UpdateCategoryPayload_conflict(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateCategoryPayload", field.Name) +} + +func (ec *executionContext) childFields_UpdateCollectionPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_UpdateCollectionPayload_clientMutationId(ctx, field) + case "collection": + return ec.fieldContext_UpdateCollectionPayload_collection(ctx, field) + case "conflict": + return ec.fieldContext_UpdateCollectionPayload_conflict(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateCollectionPayload", field.Name) +} + +func (ec *executionContext) childFields_UpdateProductPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clientMutationId": + return ec.fieldContext_UpdateProductPayload_clientMutationId(ctx, field) + case "product": + return ec.fieldContext_UpdateProductPayload_product(ctx, field) + case "conflict": + return ec.fieldContext_UpdateProductPayload_conflict(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateProductPayload", 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 "isAdmin": + return ec.fieldContext_User_isAdmin(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 ************************** generated!.gotpl ************************** // region ***************************** args.gotpl ***************************** @@ -2775,22 +3637,34 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Category_products_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, "first", ec.unmarshalOInt2ᚖint32) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int32, error) { + return ec.unmarshalOInt2ᚖint32(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint32) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int32, error) { + return ec.unmarshalOInt2ᚖint32(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOString2ᚖstring) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) if err != nil { return nil, err } @@ -2801,22 +3675,34 @@ func (ec *executionContext) field_Category_products_args(ctx context.Context, ra func (ec *executionContext) field_Collection_products_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, "first", ec.unmarshalOInt2ᚖint32) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int32, error) { + return ec.unmarshalOInt2ᚖint32(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint32) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int32, error) { + return ec.unmarshalOInt2ᚖint32(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOString2ᚖstring) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) if err != nil { return nil, err } @@ -2827,7 +3713,10 @@ func (ec *executionContext) field_Collection_products_args(ctx context.Context, func (ec *executionContext) field_Mutation_createCategory_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateCategoryInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateCategoryInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.CreateCategoryInput, error) { + return ec.unmarshalNCreateCategoryInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateCategoryInput(ctx, v) + }) if err != nil { return nil, err } @@ -2838,7 +3727,24 @@ func (ec *executionContext) field_Mutation_createCategory_args(ctx context.Conte func (ec *executionContext) field_Mutation_createCollection_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateCollectionInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateCollectionInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.CreateCollectionInput, error) { + return ec.unmarshalNCreateCollectionInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateCollectionInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createNamespace_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.CreateNamespaceInput, error) { + return ec.unmarshalNCreateNamespaceInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateNamespaceInput(ctx, v) + }) if err != nil { return nil, err } @@ -2849,7 +3755,10 @@ func (ec *executionContext) field_Mutation_createCollection_args(ctx context.Con func (ec *executionContext) field_Mutation_createProduct_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateProductInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateProductInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.CreateProductInput, error) { + return ec.unmarshalNCreateProductInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateProductInput(ctx, v) + }) if err != nil { return nil, err } @@ -2860,7 +3769,10 @@ func (ec *executionContext) field_Mutation_createProduct_args(ctx context.Contex func (ec *executionContext) field_Mutation_deleteCategory_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNDeleteCategoryInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteCategoryInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.DeleteCategoryInput, error) { + return ec.unmarshalNDeleteCategoryInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteCategoryInput(ctx, v) + }) if err != nil { return nil, err } @@ -2871,7 +3783,24 @@ func (ec *executionContext) field_Mutation_deleteCategory_args(ctx context.Conte func (ec *executionContext) field_Mutation_deleteCollection_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNDeleteCollectionInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteCollectionInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.DeleteCollectionInput, error) { + return ec.unmarshalNDeleteCollectionInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteCollectionInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteNamespace_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.DeleteNamespaceInput, error) { + return ec.unmarshalNDeleteNamespaceInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteNamespaceInput(ctx, v) + }) if err != nil { return nil, err } @@ -2882,7 +3811,10 @@ func (ec *executionContext) field_Mutation_deleteCollection_args(ctx context.Con func (ec *executionContext) field_Mutation_deleteProduct_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNDeleteProductInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteProductInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.DeleteProductInput, error) { + return ec.unmarshalNDeleteProductInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteProductInput(ctx, v) + }) if err != nil { return nil, err } @@ -2893,7 +3825,10 @@ func (ec *executionContext) field_Mutation_deleteProduct_args(ctx context.Contex func (ec *executionContext) field_Mutation_login_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNLoginInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐLoginInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.LoginInput, error) { + return ec.unmarshalNLoginInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐLoginInput(ctx, v) + }) if err != nil { return nil, err } @@ -2904,7 +3839,10 @@ func (ec *executionContext) field_Mutation_login_args(ctx context.Context, rawAr func (ec *executionContext) field_Mutation_logout_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNLogoutInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐLogoutInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.LogoutInput, error) { + return ec.unmarshalNLogoutInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐLogoutInput(ctx, v) + }) if err != nil { return nil, err } @@ -2915,7 +3853,10 @@ func (ec *executionContext) field_Mutation_logout_args(ctx context.Context, rawA func (ec *executionContext) field_Mutation_publishCatalog_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNPublishCatalogInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐPublishCatalogInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.PublishCatalogInput, error) { + return ec.unmarshalNPublishCatalogInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐPublishCatalogInput(ctx, v) + }) if err != nil { return nil, err } @@ -2926,7 +3867,10 @@ func (ec *executionContext) field_Mutation_publishCatalog_args(ctx context.Conte func (ec *executionContext) field_Mutation_refreshToken_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNRefreshTokenInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐRefreshTokenInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.RefreshTokenInput, error) { + return ec.unmarshalNRefreshTokenInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐRefreshTokenInput(ctx, v) + }) if err != nil { return nil, err } @@ -2937,7 +3881,10 @@ func (ec *executionContext) field_Mutation_refreshToken_args(ctx context.Context func (ec *executionContext) field_Mutation_reorderCategories_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNReorderCategoriesInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐReorderCategoriesInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.ReorderCategoriesInput, error) { + return ec.unmarshalNReorderCategoriesInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐReorderCategoriesInput(ctx, v) + }) if err != nil { return nil, err } @@ -2948,7 +3895,10 @@ func (ec *executionContext) field_Mutation_reorderCategories_args(ctx context.Co func (ec *executionContext) field_Mutation_reorderCollections_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNReorderCollectionsInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐReorderCollectionsInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.ReorderCollectionsInput, error) { + return ec.unmarshalNReorderCollectionsInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐReorderCollectionsInput(ctx, v) + }) if err != nil { return nil, err } @@ -2959,7 +3909,10 @@ func (ec *executionContext) field_Mutation_reorderCollections_args(ctx context.C func (ec *executionContext) field_Mutation_updateCategory_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateCategoryInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateCategoryInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.UpdateCategoryInput, error) { + return ec.unmarshalNUpdateCategoryInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateCategoryInput(ctx, v) + }) if err != nil { return nil, err } @@ -2970,7 +3923,10 @@ func (ec *executionContext) field_Mutation_updateCategory_args(ctx context.Conte func (ec *executionContext) field_Mutation_updateCollection_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateCollectionInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateCollectionInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.UpdateCollectionInput, error) { + return ec.unmarshalNUpdateCollectionInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateCollectionInput(ctx, v) + }) if err != nil { return nil, err } @@ -2981,7 +3937,10 @@ func (ec *executionContext) field_Mutation_updateCollection_args(ctx context.Con func (ec *executionContext) field_Mutation_updateProduct_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateProductInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateProductInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.UpdateProductInput, error) { + return ec.unmarshalNUpdateProductInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateProductInput(ctx, v) + }) if err != nil { return nil, err } @@ -2992,7 +3951,10 @@ func (ec *executionContext) field_Mutation_updateProduct_args(ctx context.Contex 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", ec.unmarshalNString2string) + 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 } @@ -3003,7 +3965,10 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs func (ec *executionContext) field_Query_categoryById_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, "id", ec.unmarshalNID2string) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNID2string(ctx, v) + }) if err != nil { return nil, err } @@ -3014,7 +3979,10 @@ func (ec *executionContext) field_Query_categoryById_args(ctx context.Context, r func (ec *executionContext) field_Query_category_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, "slug", ec.unmarshalNString2string) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "slug", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) if err != nil { return nil, err } @@ -3025,7 +3993,10 @@ func (ec *executionContext) field_Query_category_args(ctx context.Context, rawAr func (ec *executionContext) field_Query_collectionById_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, "id", ec.unmarshalNID2string) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNID2string(ctx, v) + }) if err != nil { return nil, err } @@ -3036,7 +4007,10 @@ func (ec *executionContext) field_Query_collectionById_args(ctx context.Context, func (ec *executionContext) field_Query_collection_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, "slug", ec.unmarshalNString2string) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "slug", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) if err != nil { return nil, err } @@ -3044,10 +4018,41 @@ func (ec *executionContext) field_Query_collection_args(ctx context.Context, raw return args, nil } +func (ec *executionContext) field_Query_namespaceById_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, "id", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNID2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_namespace_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, "identifier", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["identifier"] = arg0 + return args, nil +} + func (ec *executionContext) field_Query_node_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, "id", ec.unmarshalNID2string) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNID2string(ctx, v) + }) if err != nil { return nil, err } @@ -3058,7 +4063,10 @@ func (ec *executionContext) field_Query_node_args(ctx context.Context, rawArgs m func (ec *executionContext) field_Query_nodes_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, "ids", ec.unmarshalNID2ᚕstringᚄ) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "ids", + func(ctx context.Context, v any) ([]string, error) { + return ec.unmarshalNID2ᚕstringᚄ(ctx, v) + }) if err != nil { return nil, err } @@ -3069,7 +4077,10 @@ func (ec *executionContext) field_Query_nodes_args(ctx context.Context, rawArgs func (ec *executionContext) field_Query_productById_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, "id", ec.unmarshalNID2string) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNID2string(ctx, v) + }) if err != nil { return nil, err } @@ -3080,7 +4091,10 @@ func (ec *executionContext) field_Query_productById_args(ctx context.Context, ra func (ec *executionContext) field_Query_product_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, "sku", ec.unmarshalNString2string) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "sku", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) if err != nil { return nil, err } @@ -3091,27 +4105,42 @@ func (ec *executionContext) field_Query_product_args(ctx context.Context, rawArg func (ec *executionContext) field_Query_products_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, "first", ec.unmarshalOInt2ᚖint32) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int32, error) { + return ec.unmarshalOInt2ᚖint32(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOString2ᚖstring) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint32) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int32, error) { + return ec.unmarshalOInt2ᚖint32(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOString2ᚖstring) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "filter", ec.unmarshalOProductFilter2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductFilter) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*model.ProductFilter, error) { + return ec.unmarshalOProductFilter2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductFilter(ctx, v) + }) if err != nil { return nil, err } @@ -3122,7 +4151,10 @@ func (ec *executionContext) field_Query_products_args(ctx context.Context, rawAr 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", ec.unmarshalOBoolean2ᚖbool) + 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 } @@ -3133,7 +4165,10 @@ func (ec *executionContext) field___Directive_args_args(ctx context.Context, raw 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", ec.unmarshalOBoolean2ᚖbool) + 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 } @@ -3144,7 +4179,10 @@ func (ec *executionContext) field___Field_args_args(ctx context.Context, rawArgs 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", ec.unmarshalOBoolean2bool) + 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 } @@ -3155,7 +4193,10 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra 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", ec.unmarshalOBoolean2bool) + 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 } @@ -3176,28 +4217,22 @@ func (ec *executionContext) _AuthSession_token(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_AuthSession_token, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AuthSession_token(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Token, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_AuthSession_token(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "AuthSession", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("AuthSession", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _AuthSession_expiresAt(ctx context.Context, field graphql.CollectedField, obj *model.AuthSession) (ret graphql.Marshaler) { @@ -3205,28 +4240,22 @@ func (ec *executionContext) _AuthSession_expiresAt(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_AuthSession_expiresAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AuthSession_expiresAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ExpiresAt, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_AuthSession_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "AuthSession", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("AuthSession", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _AuthSession_user(ctx context.Context, field graphql.CollectedField, obj *model.AuthSession) (ret graphql.Marshaler) { @@ -3234,17 +4263,20 @@ func (ec *executionContext) _AuthSession_user(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_AuthSession_user, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AuthSession_user(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.User, nil }, nil, - ec.marshalNUser2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUser, + func(ctx context.Context, selections ast.SelectionSet, v *model.User) graphql.Marshaler { + return ec.marshalNUser2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUser(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_AuthSession_user(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AuthSession", @@ -3252,13 +4284,7 @@ func (ec *executionContext) fieldContext_AuthSession_user(_ context.Context, fie IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "username": - return ec.fieldContext_User_username(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return ec.childFields_User(ctx, field) }, } return fc, nil @@ -3269,28 +4295,22 @@ func (ec *executionContext) _CatalogStats_productCount(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_CatalogStats_productCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CatalogStats_productCount(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ProductCount, nil }, nil, - ec.marshalNInt2int32, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CatalogStats_productCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CatalogStats", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CatalogStats", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _CatalogStats_categoryCount(ctx context.Context, field graphql.CollectedField, obj *model.CatalogStats) (ret graphql.Marshaler) { @@ -3298,28 +4318,22 @@ func (ec *executionContext) _CatalogStats_categoryCount(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_CatalogStats_categoryCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CatalogStats_categoryCount(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CategoryCount, nil }, nil, - ec.marshalNInt2int32, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CatalogStats_categoryCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CatalogStats", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CatalogStats", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _CatalogStats_collectionCount(ctx context.Context, field graphql.CollectedField, obj *model.CatalogStats) (ret graphql.Marshaler) { @@ -3327,28 +4341,22 @@ func (ec *executionContext) _CatalogStats_collectionCount(ctx context.Context, f ctx, ec.OperationContext, field, - ec.fieldContext_CatalogStats_collectionCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CatalogStats_collectionCount(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CollectionCount, nil }, nil, - ec.marshalNInt2int32, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CatalogStats_collectionCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CatalogStats", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CatalogStats", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _CatalogStats_orphanedReferences(ctx context.Context, field graphql.CollectedField, obj *model.CatalogStats) (ret graphql.Marshaler) { @@ -3356,28 +4364,22 @@ func (ec *executionContext) _CatalogStats_orphanedReferences(ctx context.Context ctx, ec.OperationContext, field, - ec.fieldContext_CatalogStats_orphanedReferences, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CatalogStats_orphanedReferences(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.OrphanedReferences, nil }, nil, - ec.marshalNInt2int32, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CatalogStats_orphanedReferences(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CatalogStats", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CatalogStats", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _CatalogVersion_tag(ctx context.Context, field graphql.CollectedField, obj *model.CatalogVersion) (ret graphql.Marshaler) { @@ -3385,28 +4387,22 @@ func (ec *executionContext) _CatalogVersion_tag(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_CatalogVersion_tag, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CatalogVersion_tag(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Tag, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CatalogVersion_tag(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CatalogVersion", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CatalogVersion", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _CatalogVersion_commit(ctx context.Context, field graphql.CollectedField, obj *model.CatalogVersion) (ret graphql.Marshaler) { @@ -3414,28 +4410,22 @@ func (ec *executionContext) _CatalogVersion_commit(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_CatalogVersion_commit, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CatalogVersion_commit(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Commit, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CatalogVersion_commit(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CatalogVersion", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CatalogVersion", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _CatalogVersion_publishedAt(ctx context.Context, field graphql.CollectedField, obj *model.CatalogVersion) (ret graphql.Marshaler) { @@ -3443,28 +4433,22 @@ func (ec *executionContext) _CatalogVersion_publishedAt(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_CatalogVersion_publishedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CatalogVersion_publishedAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.PublishedAt, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CatalogVersion_publishedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CatalogVersion", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CatalogVersion", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _CatalogVersion_message(ctx context.Context, field graphql.CollectedField, obj *model.CatalogVersion) (ret graphql.Marshaler) { @@ -3472,28 +4456,22 @@ func (ec *executionContext) _CatalogVersion_message(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_CatalogVersion_message, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CatalogVersion_message(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Message, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_CatalogVersion_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CatalogVersion", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CatalogVersion", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _CatalogVersion_stats(ctx context.Context, field graphql.CollectedField, obj *model.CatalogVersion) (ret graphql.Marshaler) { @@ -3501,17 +4479,20 @@ func (ec *executionContext) _CatalogVersion_stats(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_CatalogVersion_stats, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CatalogVersion_stats(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Stats, nil }, nil, - ec.marshalNCatalogStats2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCatalogStats, + func(ctx context.Context, selections ast.SelectionSet, v *model.CatalogStats) graphql.Marshaler { + return ec.marshalNCatalogStats2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCatalogStats(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CatalogVersion_stats(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "CatalogVersion", @@ -3519,17 +4500,7 @@ func (ec *executionContext) fieldContext_CatalogVersion_stats(_ context.Context, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "productCount": - return ec.fieldContext_CatalogStats_productCount(ctx, field) - case "categoryCount": - return ec.fieldContext_CatalogStats_categoryCount(ctx, field) - case "collectionCount": - return ec.fieldContext_CatalogStats_collectionCount(ctx, field) - case "orphanedReferences": - return ec.fieldContext_CatalogStats_orphanedReferences(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CatalogStats", field.Name) + return ec.childFields_CatalogStats(ctx, field) }, } return fc, nil @@ -3540,28 +4511,22 @@ func (ec *executionContext) _Category_id(ctx context.Context, field graphql.Coll ctx, ec.OperationContext, field, - ec.fieldContext_Category_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNID2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Category", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Category", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _Category_name(ctx context.Context, field graphql.CollectedField, obj *model.Category) (ret graphql.Marshaler) { @@ -3569,28 +4534,22 @@ func (ec *executionContext) _Category_name(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Category_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Category", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Category", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Category_slug(ctx context.Context, field graphql.CollectedField, obj *model.Category) (ret graphql.Marshaler) { @@ -3598,28 +4557,22 @@ func (ec *executionContext) _Category_slug(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Category_slug, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_slug(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Slug, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_slug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Category", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Category", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Category_parent(ctx context.Context, field graphql.CollectedField, obj *model.Category) (ret graphql.Marshaler) { @@ -3627,17 +4580,20 @@ func (ec *executionContext) _Category_parent(ctx context.Context, field graphql. ctx, ec.OperationContext, field, - ec.fieldContext_Category_parent, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_parent(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Parent, nil }, nil, - ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory, + func(ctx context.Context, selections ast.SelectionSet, v *model.Category) graphql.Marshaler { + return ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Category_parent(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Category", @@ -3645,33 +4601,7 @@ func (ec *executionContext) fieldContext_Category_parent(_ context.Context, fiel IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } return fc, nil @@ -3682,17 +4612,20 @@ func (ec *executionContext) _Category_children(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_Category_children, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_children(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Children, nil }, nil, - ec.marshalNCategory2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategoryᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*model.Category) graphql.Marshaler { + return ec.marshalNCategory2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategoryᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_children(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Category", @@ -3700,33 +4633,7 @@ func (ec *executionContext) fieldContext_Category_children(_ context.Context, fi IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } return fc, nil @@ -3737,28 +4644,22 @@ func (ec *executionContext) _Category_displayOrder(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_Category_displayOrder, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_displayOrder(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DisplayOrder, nil }, nil, - ec.marshalNInt2int32, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_displayOrder(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Category", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Category", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _Category_products(ctx context.Context, field graphql.CollectedField, obj *model.Category) (ret graphql.Marshaler) { @@ -3766,18 +4667,21 @@ func (ec *executionContext) _Category_products(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_Category_products, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_products(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Category().Products(ctx, obj, fc.Args["first"].(*int32), fc.Args["after"].(*string), fc.Args["last"].(*int32), fc.Args["before"].(*string)) }, nil, - ec.marshalNProductConnection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductConnection, + func(ctx context.Context, selections ast.SelectionSet, v *model.ProductConnection) graphql.Marshaler { + return ec.marshalNProductConnection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductConnection(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_products(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Category", @@ -3785,15 +4689,7 @@ func (ec *executionContext) fieldContext_Category_products(ctx context.Context, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ProductConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ProductConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ProductConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ProductConnection", field.Name) + return ec.childFields_ProductConnection(ctx, field) }, } defer func() { @@ -3815,28 +4711,22 @@ func (ec *executionContext) _Category_body(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Category_body, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_body(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Body, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Category_body(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Category", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Category", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Category_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Category) (ret graphql.Marshaler) { @@ -3844,28 +4734,22 @@ func (ec *executionContext) _Category_createdAt(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_Category_createdAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Category", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Category", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _Category_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Category) (ret graphql.Marshaler) { @@ -3873,28 +4757,22 @@ func (ec *executionContext) _Category_updatedAt(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_Category_updatedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_updatedAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.UpdatedAt, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Category", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Category", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _Category_path(ctx context.Context, field graphql.CollectedField, obj *model.Category) (ret graphql.Marshaler) { @@ -3902,28 +4780,22 @@ func (ec *executionContext) _Category_path(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Category_path, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_path(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Path, nil }, nil, - ec.marshalNString2ᚕstringᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalNString2ᚕstringᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_path(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Category", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Category", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Category_depth(ctx context.Context, field graphql.CollectedField, obj *model.Category) (ret graphql.Marshaler) { @@ -3931,28 +4803,22 @@ func (ec *executionContext) _Category_depth(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_Category_depth, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Category_depth(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Depth, nil }, nil, - ec.marshalNInt2int32, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Category_depth(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Category", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Category", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _CategoryOptimisticLockConflict_currentVersion(ctx context.Context, field graphql.CollectedField, obj *model.CategoryOptimisticLockConflict) (ret graphql.Marshaler) { @@ -3960,28 +4826,22 @@ func (ec *executionContext) _CategoryOptimisticLockConflict_currentVersion(ctx c ctx, ec.OperationContext, field, - ec.fieldContext_CategoryOptimisticLockConflict_currentVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CategoryOptimisticLockConflict_currentVersion(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CurrentVersion, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CategoryOptimisticLockConflict_currentVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CategoryOptimisticLockConflict", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CategoryOptimisticLockConflict", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _CategoryOptimisticLockConflict_attemptedVersion(ctx context.Context, field graphql.CollectedField, obj *model.CategoryOptimisticLockConflict) (ret graphql.Marshaler) { @@ -3989,28 +4849,22 @@ func (ec *executionContext) _CategoryOptimisticLockConflict_attemptedVersion(ctx ctx, ec.OperationContext, field, - ec.fieldContext_CategoryOptimisticLockConflict_attemptedVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CategoryOptimisticLockConflict_attemptedVersion(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.AttemptedVersion, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CategoryOptimisticLockConflict_attemptedVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CategoryOptimisticLockConflict", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CategoryOptimisticLockConflict", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _CategoryOptimisticLockConflict_current(ctx context.Context, field graphql.CollectedField, obj *model.CategoryOptimisticLockConflict) (ret graphql.Marshaler) { @@ -4018,17 +4872,20 @@ func (ec *executionContext) _CategoryOptimisticLockConflict_current(ctx context. ctx, ec.OperationContext, field, - ec.fieldContext_CategoryOptimisticLockConflict_current, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CategoryOptimisticLockConflict_current(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Current, nil }, nil, - ec.marshalNCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory, + func(ctx context.Context, selections ast.SelectionSet, v *model.Category) graphql.Marshaler { + return ec.marshalNCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CategoryOptimisticLockConflict_current(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "CategoryOptimisticLockConflict", @@ -4036,33 +4893,7 @@ func (ec *executionContext) fieldContext_CategoryOptimisticLockConflict_current( IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } return fc, nil @@ -4073,28 +4904,22 @@ func (ec *executionContext) _CategoryOptimisticLockConflict_diff(ctx context.Con ctx, ec.OperationContext, field, - ec.fieldContext_CategoryOptimisticLockConflict_diff, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CategoryOptimisticLockConflict_diff(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Diff, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CategoryOptimisticLockConflict_diff(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CategoryOptimisticLockConflict", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CategoryOptimisticLockConflict", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Collection_id(ctx context.Context, field graphql.CollectedField, obj *model.Collection) (ret graphql.Marshaler) { @@ -4102,28 +4927,22 @@ func (ec *executionContext) _Collection_id(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Collection_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Collection_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNID2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Collection_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Collection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Collection", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _Collection_name(ctx context.Context, field graphql.CollectedField, obj *model.Collection) (ret graphql.Marshaler) { @@ -4131,28 +4950,22 @@ func (ec *executionContext) _Collection_name(ctx context.Context, field graphql. ctx, ec.OperationContext, field, - ec.fieldContext_Collection_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Collection_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Collection_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Collection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Collection", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Collection_slug(ctx context.Context, field graphql.CollectedField, obj *model.Collection) (ret graphql.Marshaler) { @@ -4160,28 +4973,22 @@ func (ec *executionContext) _Collection_slug(ctx context.Context, field graphql. ctx, ec.OperationContext, field, - ec.fieldContext_Collection_slug, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Collection_slug(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Slug, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Collection_slug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Collection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Collection", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Collection_displayOrder(ctx context.Context, field graphql.CollectedField, obj *model.Collection) (ret graphql.Marshaler) { @@ -4189,28 +4996,22 @@ func (ec *executionContext) _Collection_displayOrder(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Collection_displayOrder, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Collection_displayOrder(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DisplayOrder, nil }, nil, - ec.marshalNInt2int32, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Collection_displayOrder(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Collection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Collection", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _Collection_products(ctx context.Context, field graphql.CollectedField, obj *model.Collection) (ret graphql.Marshaler) { @@ -4218,18 +5019,21 @@ func (ec *executionContext) _Collection_products(ctx context.Context, field grap ctx, ec.OperationContext, field, - ec.fieldContext_Collection_products, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Collection_products(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Collection().Products(ctx, obj, fc.Args["first"].(*int32), fc.Args["after"].(*string), fc.Args["last"].(*int32), fc.Args["before"].(*string)) }, nil, - ec.marshalNProductConnection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductConnection, + func(ctx context.Context, selections ast.SelectionSet, v *model.ProductConnection) graphql.Marshaler { + return ec.marshalNProductConnection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductConnection(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Collection_products(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Collection", @@ -4237,15 +5041,7 @@ func (ec *executionContext) fieldContext_Collection_products(ctx context.Context IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ProductConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ProductConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ProductConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ProductConnection", field.Name) + return ec.childFields_ProductConnection(ctx, field) }, } defer func() { @@ -4267,28 +5063,22 @@ func (ec *executionContext) _Collection_body(ctx context.Context, field graphql. ctx, ec.OperationContext, field, - ec.fieldContext_Collection_body, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Collection_body(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Body, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Collection_body(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Collection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Collection", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Collection_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Collection) (ret graphql.Marshaler) { @@ -4296,28 +5086,22 @@ func (ec *executionContext) _Collection_createdAt(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_Collection_createdAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Collection_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Collection_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Collection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Collection", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _Collection_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Collection) (ret graphql.Marshaler) { @@ -4325,28 +5109,22 @@ func (ec *executionContext) _Collection_updatedAt(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_Collection_updatedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Collection_updatedAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.UpdatedAt, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Collection_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Collection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Collection", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _Collection_productCount(ctx context.Context, field graphql.CollectedField, obj *model.Collection) (ret graphql.Marshaler) { @@ -4354,28 +5132,22 @@ func (ec *executionContext) _Collection_productCount(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Collection_productCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Collection_productCount(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ProductCount, nil }, nil, - ec.marshalNInt2int32, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Collection_productCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Collection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Collection", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _CollectionOptimisticLockConflict_currentVersion(ctx context.Context, field graphql.CollectedField, obj *model.CollectionOptimisticLockConflict) (ret graphql.Marshaler) { @@ -4383,28 +5155,22 @@ func (ec *executionContext) _CollectionOptimisticLockConflict_currentVersion(ctx ctx, ec.OperationContext, field, - ec.fieldContext_CollectionOptimisticLockConflict_currentVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CollectionOptimisticLockConflict_currentVersion(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CurrentVersion, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CollectionOptimisticLockConflict_currentVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CollectionOptimisticLockConflict", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CollectionOptimisticLockConflict", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _CollectionOptimisticLockConflict_attemptedVersion(ctx context.Context, field graphql.CollectedField, obj *model.CollectionOptimisticLockConflict) (ret graphql.Marshaler) { @@ -4412,28 +5178,22 @@ func (ec *executionContext) _CollectionOptimisticLockConflict_attemptedVersion(c ctx, ec.OperationContext, field, - ec.fieldContext_CollectionOptimisticLockConflict_attemptedVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CollectionOptimisticLockConflict_attemptedVersion(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.AttemptedVersion, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CollectionOptimisticLockConflict_attemptedVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CollectionOptimisticLockConflict", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CollectionOptimisticLockConflict", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _CollectionOptimisticLockConflict_current(ctx context.Context, field graphql.CollectedField, obj *model.CollectionOptimisticLockConflict) (ret graphql.Marshaler) { @@ -4441,17 +5201,20 @@ func (ec *executionContext) _CollectionOptimisticLockConflict_current(ctx contex ctx, ec.OperationContext, field, - ec.fieldContext_CollectionOptimisticLockConflict_current, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CollectionOptimisticLockConflict_current(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Current, nil }, nil, - ec.marshalNCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection, + func(ctx context.Context, selections ast.SelectionSet, v *model.Collection) graphql.Marshaler { + return ec.marshalNCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CollectionOptimisticLockConflict_current(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "CollectionOptimisticLockConflict", @@ -4459,27 +5222,7 @@ func (ec *executionContext) fieldContext_CollectionOptimisticLockConflict_curren IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Collection_id(ctx, field) - case "name": - return ec.fieldContext_Collection_name(ctx, field) - case "slug": - return ec.fieldContext_Collection_slug(ctx, field) - case "displayOrder": - return ec.fieldContext_Collection_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Collection_products(ctx, field) - case "body": - return ec.fieldContext_Collection_body(ctx, field) - case "createdAt": - return ec.fieldContext_Collection_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Collection_updatedAt(ctx, field) - case "productCount": - return ec.fieldContext_Collection_productCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Collection", field.Name) + return ec.childFields_Collection(ctx, field) }, } return fc, nil @@ -4490,28 +5233,22 @@ func (ec *executionContext) _CollectionOptimisticLockConflict_diff(ctx context.C ctx, ec.OperationContext, field, - ec.fieldContext_CollectionOptimisticLockConflict_diff, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CollectionOptimisticLockConflict_diff(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Diff, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_CollectionOptimisticLockConflict_diff(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CollectionOptimisticLockConflict", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CollectionOptimisticLockConflict", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _CreateCategoryPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *model.CreateCategoryPayload) (ret graphql.Marshaler) { @@ -4519,28 +5256,22 @@ func (ec *executionContext) _CreateCategoryPayload_clientMutationId(ctx context. ctx, ec.OperationContext, field, - ec.fieldContext_CreateCategoryPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateCategoryPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_CreateCategoryPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CreateCategoryPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CreateCategoryPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _CreateCategoryPayload_category(ctx context.Context, field graphql.CollectedField, obj *model.CreateCategoryPayload) (ret graphql.Marshaler) { @@ -4548,17 +5279,20 @@ func (ec *executionContext) _CreateCategoryPayload_category(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_CreateCategoryPayload_category, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateCategoryPayload_category(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Category, nil }, nil, - ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory, + func(ctx context.Context, selections ast.SelectionSet, v *model.Category) graphql.Marshaler { + return ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_CreateCategoryPayload_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "CreateCategoryPayload", @@ -4566,33 +5300,7 @@ func (ec *executionContext) fieldContext_CreateCategoryPayload_category(_ contex IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } return fc, nil @@ -4603,28 +5311,22 @@ func (ec *executionContext) _CreateCollectionPayload_clientMutationId(ctx contex ctx, ec.OperationContext, field, - ec.fieldContext_CreateCollectionPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateCollectionPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_CreateCollectionPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CreateCollectionPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("CreateCollectionPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _CreateCollectionPayload_collection(ctx context.Context, field graphql.CollectedField, obj *model.CreateCollectionPayload) (ret graphql.Marshaler) { @@ -4632,17 +5334,20 @@ func (ec *executionContext) _CreateCollectionPayload_collection(ctx context.Cont ctx, ec.OperationContext, field, - ec.fieldContext_CreateCollectionPayload_collection, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateCollectionPayload_collection(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Collection, nil }, nil, - ec.marshalOCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection, + func(ctx context.Context, selections ast.SelectionSet, v *model.Collection) graphql.Marshaler { + return ec.marshalOCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_CreateCollectionPayload_collection(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "CreateCollectionPayload", @@ -4650,77 +5355,86 @@ func (ec *executionContext) fieldContext_CreateCollectionPayload_collection(_ co IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Collection_id(ctx, field) - case "name": - return ec.fieldContext_Collection_name(ctx, field) - case "slug": - return ec.fieldContext_Collection_slug(ctx, field) - case "displayOrder": - return ec.fieldContext_Collection_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Collection_products(ctx, field) - case "body": - return ec.fieldContext_Collection_body(ctx, field) - case "createdAt": - return ec.fieldContext_Collection_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Collection_updatedAt(ctx, field) - case "productCount": - return ec.fieldContext_Collection_productCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Collection", field.Name) + return ec.childFields_Collection(ctx, field) }, } return fc, nil } -func (ec *executionContext) _CreateProductPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *model.CreateProductPayload) (ret graphql.Marshaler) { +func (ec *executionContext) _CreateNamespacePayload_namespace(ctx context.Context, field graphql.CollectedField, obj *model.CreateNamespacePayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_CreateProductPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateNamespacePayload_namespace(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ClientMutationID, nil + return obj.Namespace, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *model.Namespace) graphql.Marshaler { + return ec.marshalNNamespace2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespace(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_CreateProductPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_CreateNamespacePayload_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "CreateProductPayload", + Object: "CreateNamespacePayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_Namespace(ctx, field) }, } return fc, nil } +func (ec *executionContext) _CreateProductPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *model.CreateProductPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateProductPayload_clientMutationId(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ClientMutationID, 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_CreateProductPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("CreateProductPayload", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _CreateProductPayload_product(ctx context.Context, field graphql.CollectedField, obj *model.CreateProductPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_CreateProductPayload_product, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateProductPayload_product(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Product, nil }, nil, - ec.marshalOProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct, + func(ctx context.Context, selections ast.SelectionSet, v *model.Product) graphql.Marshaler { + return ec.marshalOProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_CreateProductPayload_product(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "CreateProductPayload", @@ -4728,37 +5442,7 @@ func (ec *executionContext) fieldContext_CreateProductPayload_product(_ context. IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Product_id(ctx, field) - case "sku": - return ec.fieldContext_Product_sku(ctx, field) - case "title": - return ec.fieldContext_Product_title(ctx, field) - case "body": - return ec.fieldContext_Product_body(ctx, field) - case "price": - return ec.fieldContext_Product_price(ctx, field) - case "currency": - return ec.fieldContext_Product_currency(ctx, field) - case "inventoryStatus": - return ec.fieldContext_Product_inventoryStatus(ctx, field) - case "inventoryQuantity": - return ec.fieldContext_Product_inventoryQuantity(ctx, field) - case "category": - return ec.fieldContext_Product_category(ctx, field) - case "collections": - return ec.fieldContext_Product_collections(ctx, field) - case "images": - return ec.fieldContext_Product_images(ctx, field) - case "metadata": - return ec.fieldContext_Product_metadata(ctx, field) - case "createdAt": - return ec.fieldContext_Product_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Product_updatedAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Product", field.Name) + return ec.childFields_Product(ctx, field) }, } return fc, nil @@ -4769,28 +5453,22 @@ func (ec *executionContext) _DeleteCategoryPayload_clientMutationId(ctx context. ctx, ec.OperationContext, field, - ec.fieldContext_DeleteCategoryPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeleteCategoryPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_DeleteCategoryPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeleteCategoryPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("DeleteCategoryPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _DeleteCategoryPayload_deletedCategoryId(ctx context.Context, field graphql.CollectedField, obj *model.DeleteCategoryPayload) (ret graphql.Marshaler) { @@ -4798,28 +5476,22 @@ func (ec *executionContext) _DeleteCategoryPayload_deletedCategoryId(ctx context ctx, ec.OperationContext, field, - ec.fieldContext_DeleteCategoryPayload_deletedCategoryId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeleteCategoryPayload_deletedCategoryId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DeletedCategoryID, nil }, nil, - ec.marshalOID2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOID2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_DeleteCategoryPayload_deletedCategoryId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeleteCategoryPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("DeleteCategoryPayload", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _DeleteCategoryPayload_orphanedProductIds(ctx context.Context, field graphql.CollectedField, obj *model.DeleteCategoryPayload) (ret graphql.Marshaler) { @@ -4827,28 +5499,22 @@ func (ec *executionContext) _DeleteCategoryPayload_orphanedProductIds(ctx contex ctx, ec.OperationContext, field, - ec.fieldContext_DeleteCategoryPayload_orphanedProductIds, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeleteCategoryPayload_orphanedProductIds(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.OrphanedProductIds, nil }, nil, - ec.marshalOID2ᚕstringᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalOID2ᚕstringᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_DeleteCategoryPayload_orphanedProductIds(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeleteCategoryPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("DeleteCategoryPayload", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _DeleteCollectionPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *model.DeleteCollectionPayload) (ret graphql.Marshaler) { @@ -4856,28 +5522,22 @@ func (ec *executionContext) _DeleteCollectionPayload_clientMutationId(ctx contex ctx, ec.OperationContext, field, - ec.fieldContext_DeleteCollectionPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeleteCollectionPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_DeleteCollectionPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeleteCollectionPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("DeleteCollectionPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _DeleteCollectionPayload_deletedCollectionId(ctx context.Context, field graphql.CollectedField, obj *model.DeleteCollectionPayload) (ret graphql.Marshaler) { @@ -4885,28 +5545,45 @@ func (ec *executionContext) _DeleteCollectionPayload_deletedCollectionId(ctx con ctx, ec.OperationContext, field, - ec.fieldContext_DeleteCollectionPayload_deletedCollectionId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeleteCollectionPayload_deletedCollectionId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DeletedCollectionID, nil }, nil, - ec.marshalOID2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOID2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_DeleteCollectionPayload_deletedCollectionId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeleteCollectionPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return graphql.NewScalarFieldContext("DeleteCollectionPayload", field, false, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _DeleteNamespacePayload_deletedIdentifier(ctx context.Context, field graphql.CollectedField, obj *model.DeleteNamespacePayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeleteNamespacePayload_deletedIdentifier(ctx, field) }, - } - return fc, nil + func(ctx context.Context) (any, error) { + return obj.DeletedIdentifier, 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_DeleteNamespacePayload_deletedIdentifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("DeleteNamespacePayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _DeleteProductPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *model.DeleteProductPayload) (ret graphql.Marshaler) { @@ -4914,28 +5591,22 @@ func (ec *executionContext) _DeleteProductPayload_clientMutationId(ctx context.C ctx, ec.OperationContext, field, - ec.fieldContext_DeleteProductPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeleteProductPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_DeleteProductPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeleteProductPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("DeleteProductPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _DeleteProductPayload_deletedProductId(ctx context.Context, field graphql.CollectedField, obj *model.DeleteProductPayload) (ret graphql.Marshaler) { @@ -4943,28 +5614,22 @@ func (ec *executionContext) _DeleteProductPayload_deletedProductId(ctx context.C ctx, ec.OperationContext, field, - ec.fieldContext_DeleteProductPayload_deletedProductId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeleteProductPayload_deletedProductId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DeletedProductID, nil }, nil, - ec.marshalOID2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOID2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_DeleteProductPayload_deletedProductId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeleteProductPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("DeleteProductPayload", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _LoginPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *model.LoginPayload) (ret graphql.Marshaler) { @@ -4972,28 +5637,22 @@ func (ec *executionContext) _LoginPayload_clientMutationId(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_LoginPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_LoginPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_LoginPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "LoginPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("LoginPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _LoginPayload_session(ctx context.Context, field graphql.CollectedField, obj *model.LoginPayload) (ret graphql.Marshaler) { @@ -5001,17 +5660,20 @@ func (ec *executionContext) _LoginPayload_session(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_LoginPayload_session, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_LoginPayload_session(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Session, nil }, nil, - ec.marshalOAuthSession2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐAuthSession, + func(ctx context.Context, selections ast.SelectionSet, v *model.AuthSession) graphql.Marshaler { + return ec.marshalOAuthSession2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐAuthSession(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_LoginPayload_session(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoginPayload", @@ -5019,15 +5681,7 @@ func (ec *executionContext) fieldContext_LoginPayload_session(_ context.Context, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "token": - return ec.fieldContext_AuthSession_token(ctx, field) - case "expiresAt": - return ec.fieldContext_AuthSession_expiresAt(ctx, field) - case "user": - return ec.fieldContext_AuthSession_user(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type AuthSession", field.Name) + return ec.childFields_AuthSession(ctx, field) }, } return fc, nil @@ -5038,28 +5692,22 @@ func (ec *executionContext) _LogoutPayload_clientMutationId(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_LogoutPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_LogoutPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_LogoutPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "LogoutPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("LogoutPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _LogoutPayload_success(ctx context.Context, field graphql.CollectedField, obj *model.LogoutPayload) (ret graphql.Marshaler) { @@ -5067,28 +5715,22 @@ func (ec *executionContext) _LogoutPayload_success(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_LogoutPayload_success, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_LogoutPayload_success(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Success, nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_LogoutPayload_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "LogoutPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("LogoutPayload", field, false, false, errors.New("field of type Boolean does not have child fields")) } func (ec *executionContext) _Mutation_createProduct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -5096,18 +5738,21 @@ func (ec *executionContext) _Mutation_createProduct(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_createProduct, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_createProduct(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().CreateProduct(ctx, fc.Args["input"].(model.CreateProductInput)) }, nil, - ec.marshalNCreateProductPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateProductPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.CreateProductPayload) graphql.Marshaler { + return ec.marshalNCreateProductPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateProductPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_createProduct(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5115,13 +5760,7 @@ func (ec *executionContext) fieldContext_Mutation_createProduct(ctx context.Cont IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_CreateProductPayload_clientMutationId(ctx, field) - case "product": - return ec.fieldContext_CreateProductPayload_product(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CreateProductPayload", field.Name) + return ec.childFields_CreateProductPayload(ctx, field) }, } defer func() { @@ -5143,18 +5782,21 @@ func (ec *executionContext) _Mutation_updateProduct(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_updateProduct, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_updateProduct(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().UpdateProduct(ctx, fc.Args["input"].(model.UpdateProductInput)) }, nil, - ec.marshalNUpdateProductPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateProductPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.UpdateProductPayload) graphql.Marshaler { + return ec.marshalNUpdateProductPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateProductPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_updateProduct(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5162,15 +5804,7 @@ func (ec *executionContext) fieldContext_Mutation_updateProduct(ctx context.Cont IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_UpdateProductPayload_clientMutationId(ctx, field) - case "product": - return ec.fieldContext_UpdateProductPayload_product(ctx, field) - case "conflict": - return ec.fieldContext_UpdateProductPayload_conflict(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type UpdateProductPayload", field.Name) + return ec.childFields_UpdateProductPayload(ctx, field) }, } defer func() { @@ -5192,18 +5826,21 @@ func (ec *executionContext) _Mutation_deleteProduct(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_deleteProduct, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_deleteProduct(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().DeleteProduct(ctx, fc.Args["input"].(model.DeleteProductInput)) }, nil, - ec.marshalNDeleteProductPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteProductPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.DeleteProductPayload) graphql.Marshaler { + return ec.marshalNDeleteProductPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteProductPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_deleteProduct(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5211,13 +5848,7 @@ func (ec *executionContext) fieldContext_Mutation_deleteProduct(ctx context.Cont IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_DeleteProductPayload_clientMutationId(ctx, field) - case "deletedProductId": - return ec.fieldContext_DeleteProductPayload_deletedProductId(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DeleteProductPayload", field.Name) + return ec.childFields_DeleteProductPayload(ctx, field) }, } defer func() { @@ -5239,18 +5870,21 @@ func (ec *executionContext) _Mutation_createCategory(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_createCategory, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_createCategory(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().CreateCategory(ctx, fc.Args["input"].(model.CreateCategoryInput)) }, nil, - ec.marshalNCreateCategoryPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateCategoryPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.CreateCategoryPayload) graphql.Marshaler { + return ec.marshalNCreateCategoryPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateCategoryPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_createCategory(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5258,13 +5892,7 @@ func (ec *executionContext) fieldContext_Mutation_createCategory(ctx context.Con IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_CreateCategoryPayload_clientMutationId(ctx, field) - case "category": - return ec.fieldContext_CreateCategoryPayload_category(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CreateCategoryPayload", field.Name) + return ec.childFields_CreateCategoryPayload(ctx, field) }, } defer func() { @@ -5286,18 +5914,21 @@ func (ec *executionContext) _Mutation_updateCategory(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_updateCategory, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_updateCategory(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().UpdateCategory(ctx, fc.Args["input"].(model.UpdateCategoryInput)) }, nil, - ec.marshalNUpdateCategoryPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateCategoryPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.UpdateCategoryPayload) graphql.Marshaler { + return ec.marshalNUpdateCategoryPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateCategoryPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_updateCategory(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5305,15 +5936,7 @@ func (ec *executionContext) fieldContext_Mutation_updateCategory(ctx context.Con IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_UpdateCategoryPayload_clientMutationId(ctx, field) - case "category": - return ec.fieldContext_UpdateCategoryPayload_category(ctx, field) - case "conflict": - return ec.fieldContext_UpdateCategoryPayload_conflict(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type UpdateCategoryPayload", field.Name) + return ec.childFields_UpdateCategoryPayload(ctx, field) }, } defer func() { @@ -5335,18 +5958,21 @@ func (ec *executionContext) _Mutation_deleteCategory(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_deleteCategory, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_deleteCategory(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().DeleteCategory(ctx, fc.Args["input"].(model.DeleteCategoryInput)) }, nil, - ec.marshalNDeleteCategoryPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteCategoryPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.DeleteCategoryPayload) graphql.Marshaler { + return ec.marshalNDeleteCategoryPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteCategoryPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_deleteCategory(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5354,15 +5980,7 @@ func (ec *executionContext) fieldContext_Mutation_deleteCategory(ctx context.Con IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_DeleteCategoryPayload_clientMutationId(ctx, field) - case "deletedCategoryId": - return ec.fieldContext_DeleteCategoryPayload_deletedCategoryId(ctx, field) - case "orphanedProductIds": - return ec.fieldContext_DeleteCategoryPayload_orphanedProductIds(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DeleteCategoryPayload", field.Name) + return ec.childFields_DeleteCategoryPayload(ctx, field) }, } defer func() { @@ -5384,18 +6002,21 @@ func (ec *executionContext) _Mutation_reorderCategories(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_reorderCategories, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_reorderCategories(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().ReorderCategories(ctx, fc.Args["input"].(model.ReorderCategoriesInput)) }, nil, - ec.marshalNReorderCategoriesPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐReorderCategoriesPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.ReorderCategoriesPayload) graphql.Marshaler { + return ec.marshalNReorderCategoriesPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐReorderCategoriesPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_reorderCategories(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5403,13 +6024,7 @@ func (ec *executionContext) fieldContext_Mutation_reorderCategories(ctx context. IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_ReorderCategoriesPayload_clientMutationId(ctx, field) - case "categories": - return ec.fieldContext_ReorderCategoriesPayload_categories(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ReorderCategoriesPayload", field.Name) + return ec.childFields_ReorderCategoriesPayload(ctx, field) }, } defer func() { @@ -5431,18 +6046,21 @@ func (ec *executionContext) _Mutation_createCollection(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_createCollection, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_createCollection(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().CreateCollection(ctx, fc.Args["input"].(model.CreateCollectionInput)) }, nil, - ec.marshalNCreateCollectionPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateCollectionPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.CreateCollectionPayload) graphql.Marshaler { + return ec.marshalNCreateCollectionPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateCollectionPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_createCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5450,13 +6068,7 @@ func (ec *executionContext) fieldContext_Mutation_createCollection(ctx context.C IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_CreateCollectionPayload_clientMutationId(ctx, field) - case "collection": - return ec.fieldContext_CreateCollectionPayload_collection(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CreateCollectionPayload", field.Name) + return ec.childFields_CreateCollectionPayload(ctx, field) }, } defer func() { @@ -5478,18 +6090,21 @@ func (ec *executionContext) _Mutation_updateCollection(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_updateCollection, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_updateCollection(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().UpdateCollection(ctx, fc.Args["input"].(model.UpdateCollectionInput)) }, nil, - ec.marshalNUpdateCollectionPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateCollectionPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.UpdateCollectionPayload) graphql.Marshaler { + return ec.marshalNUpdateCollectionPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐUpdateCollectionPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_updateCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5497,15 +6112,7 @@ func (ec *executionContext) fieldContext_Mutation_updateCollection(ctx context.C IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_UpdateCollectionPayload_clientMutationId(ctx, field) - case "collection": - return ec.fieldContext_UpdateCollectionPayload_collection(ctx, field) - case "conflict": - return ec.fieldContext_UpdateCollectionPayload_conflict(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type UpdateCollectionPayload", field.Name) + return ec.childFields_UpdateCollectionPayload(ctx, field) }, } defer func() { @@ -5527,18 +6134,21 @@ func (ec *executionContext) _Mutation_deleteCollection(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_deleteCollection, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_deleteCollection(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().DeleteCollection(ctx, fc.Args["input"].(model.DeleteCollectionInput)) }, nil, - ec.marshalNDeleteCollectionPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteCollectionPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.DeleteCollectionPayload) graphql.Marshaler { + return ec.marshalNDeleteCollectionPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteCollectionPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_deleteCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5546,13 +6156,7 @@ func (ec *executionContext) fieldContext_Mutation_deleteCollection(ctx context.C IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_DeleteCollectionPayload_clientMutationId(ctx, field) - case "deletedCollectionId": - return ec.fieldContext_DeleteCollectionPayload_deletedCollectionId(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DeleteCollectionPayload", field.Name) + return ec.childFields_DeleteCollectionPayload(ctx, field) }, } defer func() { @@ -5574,18 +6178,21 @@ func (ec *executionContext) _Mutation_reorderCollections(ctx context.Context, fi ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_reorderCollections, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_reorderCollections(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().ReorderCollections(ctx, fc.Args["input"].(model.ReorderCollectionsInput)) }, nil, - ec.marshalNReorderCollectionsPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐReorderCollectionsPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.ReorderCollectionsPayload) graphql.Marshaler { + return ec.marshalNReorderCollectionsPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐReorderCollectionsPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_reorderCollections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5593,13 +6200,7 @@ func (ec *executionContext) fieldContext_Mutation_reorderCollections(ctx context IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_ReorderCollectionsPayload_clientMutationId(ctx, field) - case "collections": - return ec.fieldContext_ReorderCollectionsPayload_collections(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ReorderCollectionsPayload", field.Name) + return ec.childFields_ReorderCollectionsPayload(ctx, field) }, } defer func() { @@ -5621,18 +6222,21 @@ func (ec *executionContext) _Mutation_publishCatalog(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_publishCatalog, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_publishCatalog(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().PublishCatalog(ctx, fc.Args["input"].(model.PublishCatalogInput)) }, nil, - ec.marshalNPublishCatalogPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐPublishCatalogPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.PublishCatalogPayload) graphql.Marshaler { + return ec.marshalNPublishCatalogPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐPublishCatalogPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_publishCatalog(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5640,13 +6244,7 @@ func (ec *executionContext) fieldContext_Mutation_publishCatalog(ctx context.Con IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_PublishCatalogPayload_clientMutationId(ctx, field) - case "catalogVersion": - return ec.fieldContext_PublishCatalogPayload_catalogVersion(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PublishCatalogPayload", field.Name) + return ec.childFields_PublishCatalogPayload(ctx, field) }, } defer func() { @@ -5668,18 +6266,21 @@ func (ec *executionContext) _Mutation_login(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_login, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_login(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().Login(ctx, fc.Args["input"].(model.LoginInput)) }, nil, - ec.marshalNLoginPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐLoginPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.LoginPayload) graphql.Marshaler { + return ec.marshalNLoginPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐLoginPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_login(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5687,13 +6288,7 @@ func (ec *executionContext) fieldContext_Mutation_login(ctx context.Context, fie IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_LoginPayload_clientMutationId(ctx, field) - case "session": - return ec.fieldContext_LoginPayload_session(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type LoginPayload", field.Name) + return ec.childFields_LoginPayload(ctx, field) }, } defer func() { @@ -5715,18 +6310,21 @@ func (ec *executionContext) _Mutation_logout(ctx context.Context, field graphql. ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_logout, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_logout(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().Logout(ctx, fc.Args["input"].(model.LogoutInput)) }, nil, - ec.marshalNLogoutPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐLogoutPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.LogoutPayload) graphql.Marshaler { + return ec.marshalNLogoutPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐLogoutPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_logout(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5734,13 +6332,7 @@ func (ec *executionContext) fieldContext_Mutation_logout(ctx context.Context, fi IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_LogoutPayload_clientMutationId(ctx, field) - case "success": - return ec.fieldContext_LogoutPayload_success(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type LogoutPayload", field.Name) + return ec.childFields_LogoutPayload(ctx, field) }, } defer func() { @@ -5762,18 +6354,21 @@ func (ec *executionContext) _Mutation_refreshToken(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_refreshToken, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_refreshToken(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().RefreshToken(ctx, fc.Args["input"].(model.RefreshTokenInput)) }, nil, - ec.marshalNRefreshTokenPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐRefreshTokenPayload, + func(ctx context.Context, selections ast.SelectionSet, v *model.RefreshTokenPayload) graphql.Marshaler { + return ec.marshalNRefreshTokenPayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐRefreshTokenPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_refreshToken(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -5781,13 +6376,7 @@ func (ec *executionContext) fieldContext_Mutation_refreshToken(ctx context.Conte IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clientMutationId": - return ec.fieldContext_RefreshTokenPayload_clientMutationId(ctx, field) - case "session": - return ec.fieldContext_RefreshTokenPayload_session(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type RefreshTokenPayload", field.Name) + return ec.childFields_RefreshTokenPayload(ctx, field) }, } defer func() { @@ -5804,266 +6393,492 @@ func (ec *executionContext) fieldContext_Mutation_refreshToken(ctx context.Conte return fc, nil } -func (ec *executionContext) _OptimisticLockConflict_currentVersion(ctx context.Context, field graphql.CollectedField, obj *model.OptimisticLockConflict) (ret graphql.Marshaler) { +func (ec *executionContext) _Mutation_createNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_OptimisticLockConflict_currentVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_createNamespace(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.CurrentVersion, nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().CreateNamespace(ctx, fc.Args["input"].(model.CreateNamespaceInput)) }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v *model.CreateNamespacePayload) graphql.Marshaler { + return ec.marshalNCreateNamespacePayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateNamespacePayload(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_OptimisticLockConflict_currentVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_createNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "OptimisticLockConflict", + Object: "Mutation", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") + return ec.childFields_CreateNamespacePayload(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_Mutation_createNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _OptimisticLockConflict_attemptedVersion(ctx context.Context, field graphql.CollectedField, obj *model.OptimisticLockConflict) (ret graphql.Marshaler) { +func (ec *executionContext) _Mutation_deleteNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_OptimisticLockConflict_attemptedVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_deleteNamespace(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.AttemptedVersion, nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().DeleteNamespace(ctx, fc.Args["input"].(model.DeleteNamespaceInput)) }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v *model.DeleteNamespacePayload) graphql.Marshaler { + return ec.marshalNDeleteNamespacePayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteNamespacePayload(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_OptimisticLockConflict_attemptedVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_deleteNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "OptimisticLockConflict", + Object: "Mutation", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") + return ec.childFields_DeleteNamespacePayload(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_Mutation_deleteNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _OptimisticLockConflict_current(ctx context.Context, field graphql.CollectedField, obj *model.OptimisticLockConflict) (ret graphql.Marshaler) { +func (ec *executionContext) _Namespace_id(ctx context.Context, field graphql.CollectedField, obj *model.Namespace) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_OptimisticLockConflict_current, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Namespace_id(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Current, nil + return obj.ID, nil }, nil, - ec.marshalNProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNID2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_OptimisticLockConflict_current(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "OptimisticLockConflict", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Product_id(ctx, field) - case "sku": - return ec.fieldContext_Product_sku(ctx, field) - case "title": - return ec.fieldContext_Product_title(ctx, field) - case "body": - return ec.fieldContext_Product_body(ctx, field) - case "price": - return ec.fieldContext_Product_price(ctx, field) - case "currency": - return ec.fieldContext_Product_currency(ctx, field) - case "inventoryStatus": - return ec.fieldContext_Product_inventoryStatus(ctx, field) - case "inventoryQuantity": - return ec.fieldContext_Product_inventoryQuantity(ctx, field) - case "category": - return ec.fieldContext_Product_category(ctx, field) - case "collections": - return ec.fieldContext_Product_collections(ctx, field) - case "images": - return ec.fieldContext_Product_images(ctx, field) - case "metadata": - return ec.fieldContext_Product_metadata(ctx, field) - case "createdAt": - return ec.fieldContext_Product_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Product_updatedAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Product", field.Name) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Namespace_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Namespace", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _OptimisticLockConflict_diff(ctx context.Context, field graphql.CollectedField, obj *model.OptimisticLockConflict) (ret graphql.Marshaler) { +func (ec *executionContext) _Namespace_identifier(ctx context.Context, field graphql.CollectedField, obj *model.Namespace) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_OptimisticLockConflict_diff, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Namespace_identifier(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Diff, nil + return obj.Identifier, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_OptimisticLockConflict_diff(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "OptimisticLockConflict", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Namespace_identifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Namespace", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _Namespace_displayName(ctx context.Context, field graphql.CollectedField, obj *model.Namespace) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_hasNextPage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Namespace_displayName(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.HasNextPage, nil + return obj.DisplayName, nil }, nil, - ec.marshalNBoolean2bool, - true, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, + false, ) } - -func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PageInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Namespace_displayName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Namespace", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _Namespace_tier(ctx context.Context, field graphql.CollectedField, obj *model.Namespace) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_hasPreviousPage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Namespace_tier(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.HasPreviousPage, nil + return obj.Tier, nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v model.NamespaceTier) graphql.Marshaler { + return ec.marshalNNamespaceTier2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespaceTier(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_Namespace_tier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Namespace", field, false, false, errors.New("field of type NamespaceTier does not have child fields")) +} -func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PageInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") +func (ec *executionContext) _Namespace_parentEnterpriseId(ctx context.Context, field graphql.CollectedField, obj *model.Namespace) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Namespace_parentEnterpriseId(ctx, field) }, - } - return fc, nil + func(ctx context.Context) (any, error) { + return obj.ParentEnterpriseID, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOID2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Namespace_parentEnterpriseId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Namespace", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _Namespace_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Namespace) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_startCursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Namespace_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.StartCursor, nil + return obj.CreatedAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Namespace_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Namespace", field, false, false, errors.New("field of type DateTime does not have child fields")) +} + +func (ec *executionContext) _Namespace_createdBy(ctx context.Context, field graphql.CollectedField, obj *model.Namespace) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Namespace_createdBy(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CreatedBy, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, true, - false, ) } +func (ec *executionContext) fieldContext_Namespace_createdBy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Namespace", field, false, false, errors.New("field of type String does not have child fields")) +} -func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _Namespace_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Namespace) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Namespace_updatedAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.UpdatedAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Namespace_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Namespace", field, false, false, errors.New("field of type DateTime does not have child fields")) +} + +func (ec *executionContext) _Namespace_updatedBy(ctx context.Context, field graphql.CollectedField, obj *model.Namespace) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Namespace_updatedBy(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.UpdatedBy, 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_Namespace_updatedBy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Namespace", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _OptimisticLockConflict_currentVersion(ctx context.Context, field graphql.CollectedField, obj *model.OptimisticLockConflict) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OptimisticLockConflict_currentVersion(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CurrentVersion, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_OptimisticLockConflict_currentVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OptimisticLockConflict", field, false, false, errors.New("field of type DateTime does not have child fields")) +} + +func (ec *executionContext) _OptimisticLockConflict_attemptedVersion(ctx context.Context, field graphql.CollectedField, obj *model.OptimisticLockConflict) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OptimisticLockConflict_attemptedVersion(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.AttemptedVersion, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_OptimisticLockConflict_attemptedVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OptimisticLockConflict", field, false, false, errors.New("field of type DateTime does not have child fields")) +} + +func (ec *executionContext) _OptimisticLockConflict_current(ctx context.Context, field graphql.CollectedField, obj *model.OptimisticLockConflict) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OptimisticLockConflict_current(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Current, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model.Product) graphql.Marshaler { + return ec.marshalNProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_OptimisticLockConflict_current(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "OptimisticLockConflict", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_Product(ctx, field) }, } return fc, nil } +func (ec *executionContext) _OptimisticLockConflict_diff(ctx context.Context, field graphql.CollectedField, obj *model.OptimisticLockConflict) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OptimisticLockConflict_diff(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Diff, 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_OptimisticLockConflict_diff(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OptimisticLockConflict", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.HasNextPage, 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_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PageInfo", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.HasPreviousPage, 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_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PageInfo", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PageInfo_startCursor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StartCursor, 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_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PageInfo", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_endCursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PageInfo_endCursor(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.EndCursor, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PageInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("PageInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Product_id(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6071,28 +6886,22 @@ func (ec *executionContext) _Product_id(ctx context.Context, field graphql.Colle ctx, ec.OperationContext, field, - ec.fieldContext_Product_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNID2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _Product_sku(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6100,28 +6909,22 @@ func (ec *executionContext) _Product_sku(ctx context.Context, field graphql.Coll ctx, ec.OperationContext, field, - ec.fieldContext_Product_sku, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_sku(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Sku, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_sku(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Product_title(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6129,28 +6932,22 @@ func (ec *executionContext) _Product_title(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Product_title, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_title(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Title, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Product_body(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6158,28 +6955,22 @@ func (ec *executionContext) _Product_body(ctx context.Context, field graphql.Col ctx, ec.OperationContext, field, - ec.fieldContext_Product_body, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_body(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Body, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Product_body(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Product_price(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6187,28 +6978,22 @@ func (ec *executionContext) _Product_price(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Product_price, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_price(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Price, nil }, nil, - ec.marshalNDecimal2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋscalarᚐDecimal, + func(ctx context.Context, selections ast.SelectionSet, v scalar.Decimal) graphql.Marshaler { + return ec.marshalNDecimal2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋscalarᚐDecimal(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_price(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Decimal does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type Decimal does not have child fields")) } func (ec *executionContext) _Product_currency(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6216,28 +7001,22 @@ func (ec *executionContext) _Product_currency(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_Product_currency, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_currency(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Currency, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_currency(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Product_inventoryStatus(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6245,28 +7024,22 @@ func (ec *executionContext) _Product_inventoryStatus(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Product_inventoryStatus, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_inventoryStatus(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.InventoryStatus, nil }, nil, - ec.marshalNInventoryStatus2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐInventoryStatus, + func(ctx context.Context, selections ast.SelectionSet, v model.InventoryStatus) graphql.Marshaler { + return ec.marshalNInventoryStatus2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐInventoryStatus(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_inventoryStatus(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type InventoryStatus does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type InventoryStatus does not have child fields")) } func (ec *executionContext) _Product_inventoryQuantity(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6274,28 +7047,22 @@ func (ec *executionContext) _Product_inventoryQuantity(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_Product_inventoryQuantity, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_inventoryQuantity(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.InventoryQuantity, nil }, nil, - ec.marshalOInt2ᚖint32, + func(ctx context.Context, selections ast.SelectionSet, v *int32) graphql.Marshaler { + return ec.marshalOInt2ᚖint32(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Product_inventoryQuantity(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _Product_category(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6303,17 +7070,20 @@ func (ec *executionContext) _Product_category(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_Product_category, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_category(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.Product().Category(ctx, obj) }, nil, - ec.marshalNCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory, + func(ctx context.Context, selections ast.SelectionSet, v *model.Category) graphql.Marshaler { + return ec.marshalNCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Product", @@ -6321,33 +7091,7 @@ func (ec *executionContext) fieldContext_Product_category(_ context.Context, fie IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } return fc, nil @@ -6358,17 +7102,20 @@ func (ec *executionContext) _Product_collections(ctx context.Context, field grap ctx, ec.OperationContext, field, - ec.fieldContext_Product_collections, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_collections(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.Product().Collections(ctx, obj) }, nil, - ec.marshalNCollection2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollectionᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*model.Collection) graphql.Marshaler { + return ec.marshalNCollection2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollectionᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_collections(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Product", @@ -6376,27 +7123,7 @@ func (ec *executionContext) fieldContext_Product_collections(_ context.Context, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Collection_id(ctx, field) - case "name": - return ec.fieldContext_Collection_name(ctx, field) - case "slug": - return ec.fieldContext_Collection_slug(ctx, field) - case "displayOrder": - return ec.fieldContext_Collection_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Collection_products(ctx, field) - case "body": - return ec.fieldContext_Collection_body(ctx, field) - case "createdAt": - return ec.fieldContext_Collection_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Collection_updatedAt(ctx, field) - case "productCount": - return ec.fieldContext_Collection_productCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Collection", field.Name) + return ec.childFields_Collection(ctx, field) }, } return fc, nil @@ -6407,28 +7134,22 @@ func (ec *executionContext) _Product_images(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_Product_images, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_images(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Images, nil }, nil, - ec.marshalNString2ᚕstringᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalNString2ᚕstringᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_images(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Product_metadata(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6436,28 +7157,22 @@ func (ec *executionContext) _Product_metadata(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_Product_metadata, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_metadata(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Metadata, nil }, nil, - ec.marshalOJSON2map, + func(ctx context.Context, selections ast.SelectionSet, v map[string]any) graphql.Marshaler { + return ec.marshalOJSON2map(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Product_metadata(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type JSON does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type JSON does not have child fields")) } func (ec *executionContext) _Product_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6465,28 +7180,22 @@ func (ec *executionContext) _Product_createdAt(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_Product_createdAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _Product_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { @@ -6494,28 +7203,22 @@ func (ec *executionContext) _Product_updatedAt(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_Product_updatedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Product_updatedAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.UpdatedAt, nil }, nil, - ec.marshalNDateTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNDateTime2timeᚐTime(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Product_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Product", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type DateTime does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Product", field, false, false, errors.New("field of type DateTime does not have child fields")) } func (ec *executionContext) _ProductConnection_edges(ctx context.Context, field graphql.CollectedField, obj *model.ProductConnection) (ret graphql.Marshaler) { @@ -6523,17 +7226,20 @@ func (ec *executionContext) _ProductConnection_edges(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ProductConnection_edges, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ProductConnection_edges(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - ec.marshalNProductEdge2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductEdgeᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*model.ProductEdge) graphql.Marshaler { + return ec.marshalNProductEdge2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductEdgeᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ProductConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ProductConnection", @@ -6541,13 +7247,7 @@ func (ec *executionContext) fieldContext_ProductConnection_edges(_ context.Conte IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "cursor": - return ec.fieldContext_ProductEdge_cursor(ctx, field) - case "node": - return ec.fieldContext_ProductEdge_node(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ProductEdge", field.Name) + return ec.childFields_ProductEdge(ctx, field) }, } return fc, nil @@ -6558,17 +7258,20 @@ func (ec *executionContext) _ProductConnection_pageInfo(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_ProductConnection_pageInfo, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ProductConnection_pageInfo(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.PageInfo, nil }, nil, - ec.marshalNPageInfo2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐPageInfo, + func(ctx context.Context, selections ast.SelectionSet, v *model.PageInfo) graphql.Marshaler { + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐPageInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ProductConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ProductConnection", @@ -6576,17 +7279,7 @@ func (ec *executionContext) fieldContext_ProductConnection_pageInfo(_ context.Co IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return ec.childFields_PageInfo(ctx, field) }, } return fc, nil @@ -6597,28 +7290,22 @@ func (ec *executionContext) _ProductConnection_totalCount(ctx context.Context, f ctx, ec.OperationContext, field, - ec.fieldContext_ProductConnection_totalCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ProductConnection_totalCount(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil }, nil, - ec.marshalNInt2int32, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ProductConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ProductConnection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ProductConnection", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _ProductEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.ProductEdge) (ret graphql.Marshaler) { @@ -6626,28 +7313,22 @@ func (ec *executionContext) _ProductEdge_cursor(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_ProductEdge_cursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ProductEdge_cursor(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Cursor, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ProductEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ProductEdge", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ProductEdge", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ProductEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.ProductEdge) (ret graphql.Marshaler) { @@ -6655,17 +7336,20 @@ func (ec *executionContext) _ProductEdge_node(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_ProductEdge_node, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ProductEdge_node(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - ec.marshalNProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct, + func(ctx context.Context, selections ast.SelectionSet, v *model.Product) graphql.Marshaler { + return ec.marshalNProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ProductEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ProductEdge", @@ -6673,37 +7357,7 @@ func (ec *executionContext) fieldContext_ProductEdge_node(_ context.Context, fie IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Product_id(ctx, field) - case "sku": - return ec.fieldContext_Product_sku(ctx, field) - case "title": - return ec.fieldContext_Product_title(ctx, field) - case "body": - return ec.fieldContext_Product_body(ctx, field) - case "price": - return ec.fieldContext_Product_price(ctx, field) - case "currency": - return ec.fieldContext_Product_currency(ctx, field) - case "inventoryStatus": - return ec.fieldContext_Product_inventoryStatus(ctx, field) - case "inventoryQuantity": - return ec.fieldContext_Product_inventoryQuantity(ctx, field) - case "category": - return ec.fieldContext_Product_category(ctx, field) - case "collections": - return ec.fieldContext_Product_collections(ctx, field) - case "images": - return ec.fieldContext_Product_images(ctx, field) - case "metadata": - return ec.fieldContext_Product_metadata(ctx, field) - case "createdAt": - return ec.fieldContext_Product_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Product_updatedAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Product", field.Name) + return ec.childFields_Product(ctx, field) }, } return fc, nil @@ -6714,28 +7368,22 @@ func (ec *executionContext) _PublishCatalogPayload_clientMutationId(ctx context. ctx, ec.OperationContext, field, - ec.fieldContext_PublishCatalogPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PublishCatalogPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_PublishCatalogPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PublishCatalogPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("PublishCatalogPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _PublishCatalogPayload_catalogVersion(ctx context.Context, field graphql.CollectedField, obj *model.PublishCatalogPayload) (ret graphql.Marshaler) { @@ -6743,17 +7391,20 @@ func (ec *executionContext) _PublishCatalogPayload_catalogVersion(ctx context.Co ctx, ec.OperationContext, field, - ec.fieldContext_PublishCatalogPayload_catalogVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PublishCatalogPayload_catalogVersion(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CatalogVersion, nil }, nil, - ec.marshalOCatalogVersion2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCatalogVersion, + func(ctx context.Context, selections ast.SelectionSet, v *model.CatalogVersion) graphql.Marshaler { + return ec.marshalOCatalogVersion2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCatalogVersion(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_PublishCatalogPayload_catalogVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PublishCatalogPayload", @@ -6761,19 +7412,7 @@ func (ec *executionContext) fieldContext_PublishCatalogPayload_catalogVersion(_ IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "tag": - return ec.fieldContext_CatalogVersion_tag(ctx, field) - case "commit": - return ec.fieldContext_CatalogVersion_commit(ctx, field) - case "publishedAt": - return ec.fieldContext_CatalogVersion_publishedAt(ctx, field) - case "message": - return ec.fieldContext_CatalogVersion_message(ctx, field) - case "stats": - return ec.fieldContext_CatalogVersion_stats(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CatalogVersion", field.Name) + return ec.childFields_CatalogVersion(ctx, field) }, } return fc, nil @@ -6784,18 +7423,21 @@ func (ec *executionContext) _Query_node(ctx context.Context, field graphql.Colle ctx, ec.OperationContext, field, - ec.fieldContext_Query_node, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_node(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Query().Node(ctx, fc.Args["id"].(string)) }, nil, - ec.marshalONode2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNode, + func(ctx context.Context, selections ast.SelectionSet, v model.Node) graphql.Marshaler { + return ec.marshalONode2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNode(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Query_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -6825,18 +7467,21 @@ func (ec *executionContext) _Query_nodes(ctx context.Context, field graphql.Coll ctx, ec.OperationContext, field, - ec.fieldContext_Query_nodes, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_nodes(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Query().Nodes(ctx, fc.Args["ids"].([]string)) }, nil, - ec.marshalNNode2ᚕgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNode, + func(ctx context.Context, selections ast.SelectionSet, v []model.Node) graphql.Marshaler { + return ec.marshalNNode2ᚕgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNode(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Query_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -6866,18 +7511,21 @@ func (ec *executionContext) _Query_product(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Query_product, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_product(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Query().Product(ctx, fc.Args["sku"].(string)) }, nil, - ec.marshalOProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct, + func(ctx context.Context, selections ast.SelectionSet, v *model.Product) graphql.Marshaler { + return ec.marshalOProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Query_product(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -6885,37 +7533,7 @@ func (ec *executionContext) fieldContext_Query_product(ctx context.Context, fiel IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Product_id(ctx, field) - case "sku": - return ec.fieldContext_Product_sku(ctx, field) - case "title": - return ec.fieldContext_Product_title(ctx, field) - case "body": - return ec.fieldContext_Product_body(ctx, field) - case "price": - return ec.fieldContext_Product_price(ctx, field) - case "currency": - return ec.fieldContext_Product_currency(ctx, field) - case "inventoryStatus": - return ec.fieldContext_Product_inventoryStatus(ctx, field) - case "inventoryQuantity": - return ec.fieldContext_Product_inventoryQuantity(ctx, field) - case "category": - return ec.fieldContext_Product_category(ctx, field) - case "collections": - return ec.fieldContext_Product_collections(ctx, field) - case "images": - return ec.fieldContext_Product_images(ctx, field) - case "metadata": - return ec.fieldContext_Product_metadata(ctx, field) - case "createdAt": - return ec.fieldContext_Product_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Product_updatedAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Product", field.Name) + return ec.childFields_Product(ctx, field) }, } defer func() { @@ -6937,18 +7555,21 @@ func (ec *executionContext) _Query_productById(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_Query_productById, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_productById(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Query().ProductByID(ctx, fc.Args["id"].(string)) }, nil, - ec.marshalOProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct, + func(ctx context.Context, selections ast.SelectionSet, v *model.Product) graphql.Marshaler { + return ec.marshalOProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Query_productById(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -6956,37 +7577,7 @@ func (ec *executionContext) fieldContext_Query_productById(ctx context.Context, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Product_id(ctx, field) - case "sku": - return ec.fieldContext_Product_sku(ctx, field) - case "title": - return ec.fieldContext_Product_title(ctx, field) - case "body": - return ec.fieldContext_Product_body(ctx, field) - case "price": - return ec.fieldContext_Product_price(ctx, field) - case "currency": - return ec.fieldContext_Product_currency(ctx, field) - case "inventoryStatus": - return ec.fieldContext_Product_inventoryStatus(ctx, field) - case "inventoryQuantity": - return ec.fieldContext_Product_inventoryQuantity(ctx, field) - case "category": - return ec.fieldContext_Product_category(ctx, field) - case "collections": - return ec.fieldContext_Product_collections(ctx, field) - case "images": - return ec.fieldContext_Product_images(ctx, field) - case "metadata": - return ec.fieldContext_Product_metadata(ctx, field) - case "createdAt": - return ec.fieldContext_Product_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Product_updatedAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Product", field.Name) + return ec.childFields_Product(ctx, field) }, } defer func() { @@ -7008,18 +7599,21 @@ func (ec *executionContext) _Query_products(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_Query_products, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_products(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Query().Products(ctx, fc.Args["first"].(*int32), fc.Args["after"].(*string), fc.Args["last"].(*int32), fc.Args["before"].(*string), fc.Args["filter"].(*model.ProductFilter)) }, nil, - ec.marshalNProductConnection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductConnection, + func(ctx context.Context, selections ast.SelectionSet, v *model.ProductConnection) graphql.Marshaler { + return ec.marshalNProductConnection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProductConnection(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Query_products(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -7027,15 +7621,7 @@ func (ec *executionContext) fieldContext_Query_products(ctx context.Context, fie IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ProductConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ProductConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ProductConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ProductConnection", field.Name) + return ec.childFields_ProductConnection(ctx, field) }, } defer func() { @@ -7057,18 +7643,21 @@ func (ec *executionContext) _Query_category(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_Query_category, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_category(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Query().Category(ctx, fc.Args["slug"].(string)) }, nil, - ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory, + func(ctx context.Context, selections ast.SelectionSet, v *model.Category) graphql.Marshaler { + return ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Query_category(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -7076,33 +7665,7 @@ func (ec *executionContext) fieldContext_Query_category(ctx context.Context, fie IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } defer func() { @@ -7124,18 +7687,21 @@ func (ec *executionContext) _Query_categoryById(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_Query_categoryById, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_categoryById(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Query().CategoryByID(ctx, fc.Args["id"].(string)) }, nil, - ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory, + func(ctx context.Context, selections ast.SelectionSet, v *model.Category) graphql.Marshaler { + return ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Query_categoryById(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -7143,33 +7709,7 @@ func (ec *executionContext) fieldContext_Query_categoryById(ctx context.Context, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } defer func() { @@ -7191,17 +7731,20 @@ func (ec *executionContext) _Query_categories(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_Query_categories, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_categories(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.Query().Categories(ctx) }, nil, - ec.marshalNCategory2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategoryᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*model.Category) graphql.Marshaler { + return ec.marshalNCategory2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategoryᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Query_categories(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -7209,33 +7752,7 @@ func (ec *executionContext) fieldContext_Query_categories(_ context.Context, fie IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } return fc, nil @@ -7246,18 +7763,21 @@ func (ec *executionContext) _Query_collection(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_Query_collection, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_collection(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Query().Collection(ctx, fc.Args["slug"].(string)) }, nil, - ec.marshalOCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection, + func(ctx context.Context, selections ast.SelectionSet, v *model.Collection) graphql.Marshaler { + return ec.marshalOCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Query_collection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -7265,27 +7785,7 @@ func (ec *executionContext) fieldContext_Query_collection(ctx context.Context, f IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Collection_id(ctx, field) - case "name": - return ec.fieldContext_Collection_name(ctx, field) - case "slug": - return ec.fieldContext_Collection_slug(ctx, field) - case "displayOrder": - return ec.fieldContext_Collection_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Collection_products(ctx, field) - case "body": - return ec.fieldContext_Collection_body(ctx, field) - case "createdAt": - return ec.fieldContext_Collection_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Collection_updatedAt(ctx, field) - case "productCount": - return ec.fieldContext_Collection_productCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Collection", field.Name) + return ec.childFields_Collection(ctx, field) }, } defer func() { @@ -7307,18 +7807,21 @@ func (ec *executionContext) _Query_collectionById(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_Query_collectionById, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_collectionById(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Query().CollectionByID(ctx, fc.Args["id"].(string)) }, nil, - ec.marshalOCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection, + func(ctx context.Context, selections ast.SelectionSet, v *model.Collection) graphql.Marshaler { + return ec.marshalOCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Query_collectionById(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -7326,27 +7829,7 @@ func (ec *executionContext) fieldContext_Query_collectionById(ctx context.Contex IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Collection_id(ctx, field) - case "name": - return ec.fieldContext_Collection_name(ctx, field) - case "slug": - return ec.fieldContext_Collection_slug(ctx, field) - case "displayOrder": - return ec.fieldContext_Collection_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Collection_products(ctx, field) - case "body": - return ec.fieldContext_Collection_body(ctx, field) - case "createdAt": - return ec.fieldContext_Collection_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Collection_updatedAt(ctx, field) - case "productCount": - return ec.fieldContext_Collection_productCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Collection", field.Name) + return ec.childFields_Collection(ctx, field) }, } defer func() { @@ -7368,17 +7851,20 @@ func (ec *executionContext) _Query_collections(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_Query_collections, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_collections(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.Query().Collections(ctx) }, nil, - ec.marshalNCollection2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollectionᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*model.Collection) graphql.Marshaler { + return ec.marshalNCollection2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollectionᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Query_collections(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -7386,27 +7872,7 @@ func (ec *executionContext) fieldContext_Query_collections(_ context.Context, fi IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Collection_id(ctx, field) - case "name": - return ec.fieldContext_Collection_name(ctx, field) - case "slug": - return ec.fieldContext_Collection_slug(ctx, field) - case "displayOrder": - return ec.fieldContext_Collection_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Collection_products(ctx, field) - case "body": - return ec.fieldContext_Collection_body(ctx, field) - case "createdAt": - return ec.fieldContext_Collection_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Collection_updatedAt(ctx, field) - case "productCount": - return ec.fieldContext_Collection_productCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Collection", field.Name) + return ec.childFields_Collection(ctx, field) }, } return fc, nil @@ -7417,17 +7883,20 @@ func (ec *executionContext) _Query_catalogVersion(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_Query_catalogVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_catalogVersion(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.Query().CatalogVersion(ctx) }, nil, - ec.marshalNCatalogVersion2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCatalogVersion, + func(ctx context.Context, selections ast.SelectionSet, v *model.CatalogVersion) graphql.Marshaler { + return ec.marshalNCatalogVersion2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCatalogVersion(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Query_catalogVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", @@ -7435,73 +7904,40 @@ func (ec *executionContext) fieldContext_Query_catalogVersion(_ context.Context, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "tag": - return ec.fieldContext_CatalogVersion_tag(ctx, field) - case "commit": - return ec.fieldContext_CatalogVersion_commit(ctx, field) - case "publishedAt": - return ec.fieldContext_CatalogVersion_publishedAt(ctx, field) - case "message": - return ec.fieldContext_CatalogVersion_message(ctx, field) - case "stats": - return ec.fieldContext_CatalogVersion_stats(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CatalogVersion", field.Name) + return ec.childFields_CatalogVersion(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_namespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query___type, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_namespace(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return ec.IntrospectType(fc.Args["name"].(string)) + return ec.Resolvers.Query().Namespace(ctx, fc.Args["identifier"].(string)) }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + func(ctx context.Context, selections ast.SelectionSet, v *model.Namespace) graphql.Marshaler { + return ec.marshalONamespace2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespace(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_namespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields_Namespace(ctx, field) }, } defer func() { @@ -7511,101 +7947,207 @@ func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Query_namespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_namespaceById(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query___schema, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_namespaceById(ctx, field) + }, func(ctx context.Context) (any, error) { - return ec.IntrospectSchema() + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().NamespaceByID(ctx, fc.Args["id"].(string)) }, nil, - ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema, + func(ctx context.Context, selections ast.SelectionSet, v *model.Namespace) graphql.Marshaler { + return ec.marshalONamespace2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespace(ctx, selections, v) + }, true, false, ) } +func (ec *executionContext) fieldContext_Query_namespaceById(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_Namespace(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_namespaceById_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} -func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _Query_namespaces(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_namespaces(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Query().Namespaces(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model.Namespace) graphql.Marshaler { + return ec.marshalNNamespace2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespaceᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_namespaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "description": - return ec.fieldContext___Schema_description(ctx, field) - case "types": - return ec.fieldContext___Schema_types(ctx, field) - case "queryType": - return ec.fieldContext___Schema_queryType(ctx, field) - case "mutationType": - return ec.fieldContext___Schema_mutationType(ctx, field) - case "subscriptionType": - return ec.fieldContext___Schema_subscriptionType(ctx, field) - case "directives": - return ec.fieldContext___Schema_directives(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + return ec.childFields_Namespace(ctx, field) }, } return fc, nil } -func (ec *executionContext) _RefreshTokenPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *model.RefreshTokenPayload) (ret graphql.Marshaler) { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RefreshTokenPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query___type(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ClientMutationID, nil + fc := graphql.GetFieldContext(ctx) + return ec.IntrospectType(fc.Args["name"].(string)) }, nil, - ec.marshalOString2ᚖstring, + 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) fieldContext_RefreshTokenPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +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: "RefreshTokenPayload", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields___Schema(ctx, field) }, } return fc, nil } +func (ec *executionContext) _RefreshTokenPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *model.RefreshTokenPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RefreshTokenPayload_clientMutationId(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ClientMutationID, 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_RefreshTokenPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("RefreshTokenPayload", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _RefreshTokenPayload_session(ctx context.Context, field graphql.CollectedField, obj *model.RefreshTokenPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RefreshTokenPayload_session, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RefreshTokenPayload_session(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Session, nil }, nil, - ec.marshalOAuthSession2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐAuthSession, + func(ctx context.Context, selections ast.SelectionSet, v *model.AuthSession) graphql.Marshaler { + return ec.marshalOAuthSession2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐAuthSession(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_RefreshTokenPayload_session(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "RefreshTokenPayload", @@ -7613,15 +8155,7 @@ func (ec *executionContext) fieldContext_RefreshTokenPayload_session(_ context.C IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "token": - return ec.fieldContext_AuthSession_token(ctx, field) - case "expiresAt": - return ec.fieldContext_AuthSession_expiresAt(ctx, field) - case "user": - return ec.fieldContext_AuthSession_user(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type AuthSession", field.Name) + return ec.childFields_AuthSession(ctx, field) }, } return fc, nil @@ -7632,28 +8166,22 @@ func (ec *executionContext) _ReorderCategoriesPayload_clientMutationId(ctx conte ctx, ec.OperationContext, field, - ec.fieldContext_ReorderCategoriesPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ReorderCategoriesPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ReorderCategoriesPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ReorderCategoriesPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ReorderCategoriesPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ReorderCategoriesPayload_categories(ctx context.Context, field graphql.CollectedField, obj *model.ReorderCategoriesPayload) (ret graphql.Marshaler) { @@ -7661,17 +8189,20 @@ func (ec *executionContext) _ReorderCategoriesPayload_categories(ctx context.Con ctx, ec.OperationContext, field, - ec.fieldContext_ReorderCategoriesPayload_categories, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ReorderCategoriesPayload_categories(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Categories, nil }, nil, - ec.marshalOCategory2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategoryᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*model.Category) graphql.Marshaler { + return ec.marshalOCategory2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategoryᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ReorderCategoriesPayload_categories(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ReorderCategoriesPayload", @@ -7679,33 +8210,7 @@ func (ec *executionContext) fieldContext_ReorderCategoriesPayload_categories(_ c IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } return fc, nil @@ -7716,28 +8221,22 @@ func (ec *executionContext) _ReorderCollectionsPayload_clientMutationId(ctx cont ctx, ec.OperationContext, field, - ec.fieldContext_ReorderCollectionsPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ReorderCollectionsPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ReorderCollectionsPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ReorderCollectionsPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ReorderCollectionsPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ReorderCollectionsPayload_collections(ctx context.Context, field graphql.CollectedField, obj *model.ReorderCollectionsPayload) (ret graphql.Marshaler) { @@ -7745,17 +8244,20 @@ func (ec *executionContext) _ReorderCollectionsPayload_collections(ctx context.C ctx, ec.OperationContext, field, - ec.fieldContext_ReorderCollectionsPayload_collections, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ReorderCollectionsPayload_collections(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Collections, nil }, nil, - ec.marshalOCollection2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollectionᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*model.Collection) graphql.Marshaler { + return ec.marshalOCollection2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollectionᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ReorderCollectionsPayload_collections(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ReorderCollectionsPayload", @@ -7763,27 +8265,7 @@ func (ec *executionContext) fieldContext_ReorderCollectionsPayload_collections(_ IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Collection_id(ctx, field) - case "name": - return ec.fieldContext_Collection_name(ctx, field) - case "slug": - return ec.fieldContext_Collection_slug(ctx, field) - case "displayOrder": - return ec.fieldContext_Collection_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Collection_products(ctx, field) - case "body": - return ec.fieldContext_Collection_body(ctx, field) - case "createdAt": - return ec.fieldContext_Collection_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Collection_updatedAt(ctx, field) - case "productCount": - return ec.fieldContext_Collection_productCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Collection", field.Name) + return ec.childFields_Collection(ctx, field) }, } return fc, nil @@ -7794,28 +8276,22 @@ func (ec *executionContext) _UpdateCategoryPayload_clientMutationId(ctx context. ctx, ec.OperationContext, field, - ec.fieldContext_UpdateCategoryPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateCategoryPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_UpdateCategoryPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "UpdateCategoryPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("UpdateCategoryPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _UpdateCategoryPayload_category(ctx context.Context, field graphql.CollectedField, obj *model.UpdateCategoryPayload) (ret graphql.Marshaler) { @@ -7823,17 +8299,20 @@ func (ec *executionContext) _UpdateCategoryPayload_category(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_UpdateCategoryPayload_category, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateCategoryPayload_category(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Category, nil }, nil, - ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory, + func(ctx context.Context, selections ast.SelectionSet, v *model.Category) graphql.Marshaler { + return ec.marshalOCategory2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategory(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_UpdateCategoryPayload_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "UpdateCategoryPayload", @@ -7841,33 +8320,7 @@ func (ec *executionContext) fieldContext_UpdateCategoryPayload_category(_ contex IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) - case "slug": - return ec.fieldContext_Category_slug(ctx, field) - case "parent": - return ec.fieldContext_Category_parent(ctx, field) - case "children": - return ec.fieldContext_Category_children(ctx, field) - case "displayOrder": - return ec.fieldContext_Category_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Category_products(ctx, field) - case "body": - return ec.fieldContext_Category_body(ctx, field) - case "createdAt": - return ec.fieldContext_Category_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Category_updatedAt(ctx, field) - case "path": - return ec.fieldContext_Category_path(ctx, field) - case "depth": - return ec.fieldContext_Category_depth(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return ec.childFields_Category(ctx, field) }, } return fc, nil @@ -7878,17 +8331,20 @@ func (ec *executionContext) _UpdateCategoryPayload_conflict(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_UpdateCategoryPayload_conflict, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateCategoryPayload_conflict(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Conflict, nil }, nil, - ec.marshalOCategoryOptimisticLockConflict2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategoryOptimisticLockConflict, + func(ctx context.Context, selections ast.SelectionSet, v *model.CategoryOptimisticLockConflict) graphql.Marshaler { + return ec.marshalOCategoryOptimisticLockConflict2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCategoryOptimisticLockConflict(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_UpdateCategoryPayload_conflict(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "UpdateCategoryPayload", @@ -7896,17 +8352,7 @@ func (ec *executionContext) fieldContext_UpdateCategoryPayload_conflict(_ contex IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "currentVersion": - return ec.fieldContext_CategoryOptimisticLockConflict_currentVersion(ctx, field) - case "attemptedVersion": - return ec.fieldContext_CategoryOptimisticLockConflict_attemptedVersion(ctx, field) - case "current": - return ec.fieldContext_CategoryOptimisticLockConflict_current(ctx, field) - case "diff": - return ec.fieldContext_CategoryOptimisticLockConflict_diff(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CategoryOptimisticLockConflict", field.Name) + return ec.childFields_CategoryOptimisticLockConflict(ctx, field) }, } return fc, nil @@ -7917,28 +8363,22 @@ func (ec *executionContext) _UpdateCollectionPayload_clientMutationId(ctx contex ctx, ec.OperationContext, field, - ec.fieldContext_UpdateCollectionPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateCollectionPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_UpdateCollectionPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "UpdateCollectionPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("UpdateCollectionPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _UpdateCollectionPayload_collection(ctx context.Context, field graphql.CollectedField, obj *model.UpdateCollectionPayload) (ret graphql.Marshaler) { @@ -7946,17 +8386,20 @@ func (ec *executionContext) _UpdateCollectionPayload_collection(ctx context.Cont ctx, ec.OperationContext, field, - ec.fieldContext_UpdateCollectionPayload_collection, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateCollectionPayload_collection(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Collection, nil }, nil, - ec.marshalOCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection, + func(ctx context.Context, selections ast.SelectionSet, v *model.Collection) graphql.Marshaler { + return ec.marshalOCollection2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollection(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_UpdateCollectionPayload_collection(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "UpdateCollectionPayload", @@ -7964,27 +8407,7 @@ func (ec *executionContext) fieldContext_UpdateCollectionPayload_collection(_ co IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Collection_id(ctx, field) - case "name": - return ec.fieldContext_Collection_name(ctx, field) - case "slug": - return ec.fieldContext_Collection_slug(ctx, field) - case "displayOrder": - return ec.fieldContext_Collection_displayOrder(ctx, field) - case "products": - return ec.fieldContext_Collection_products(ctx, field) - case "body": - return ec.fieldContext_Collection_body(ctx, field) - case "createdAt": - return ec.fieldContext_Collection_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Collection_updatedAt(ctx, field) - case "productCount": - return ec.fieldContext_Collection_productCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Collection", field.Name) + return ec.childFields_Collection(ctx, field) }, } return fc, nil @@ -7995,17 +8418,20 @@ func (ec *executionContext) _UpdateCollectionPayload_conflict(ctx context.Contex ctx, ec.OperationContext, field, - ec.fieldContext_UpdateCollectionPayload_conflict, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateCollectionPayload_conflict(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Conflict, nil }, nil, - ec.marshalOCollectionOptimisticLockConflict2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollectionOptimisticLockConflict, + func(ctx context.Context, selections ast.SelectionSet, v *model.CollectionOptimisticLockConflict) graphql.Marshaler { + return ec.marshalOCollectionOptimisticLockConflict2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCollectionOptimisticLockConflict(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_UpdateCollectionPayload_conflict(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "UpdateCollectionPayload", @@ -8013,17 +8439,7 @@ func (ec *executionContext) fieldContext_UpdateCollectionPayload_conflict(_ cont IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "currentVersion": - return ec.fieldContext_CollectionOptimisticLockConflict_currentVersion(ctx, field) - case "attemptedVersion": - return ec.fieldContext_CollectionOptimisticLockConflict_attemptedVersion(ctx, field) - case "current": - return ec.fieldContext_CollectionOptimisticLockConflict_current(ctx, field) - case "diff": - return ec.fieldContext_CollectionOptimisticLockConflict_diff(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CollectionOptimisticLockConflict", field.Name) + return ec.childFields_CollectionOptimisticLockConflict(ctx, field) }, } return fc, nil @@ -8034,28 +8450,22 @@ func (ec *executionContext) _UpdateProductPayload_clientMutationId(ctx context.C ctx, ec.OperationContext, field, - ec.fieldContext_UpdateProductPayload_clientMutationId, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateProductPayload_clientMutationId(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientMutationID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_UpdateProductPayload_clientMutationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "UpdateProductPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("UpdateProductPayload", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _UpdateProductPayload_product(ctx context.Context, field graphql.CollectedField, obj *model.UpdateProductPayload) (ret graphql.Marshaler) { @@ -8063,17 +8473,20 @@ func (ec *executionContext) _UpdateProductPayload_product(ctx context.Context, f ctx, ec.OperationContext, field, - ec.fieldContext_UpdateProductPayload_product, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateProductPayload_product(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Product, nil }, nil, - ec.marshalOProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct, + func(ctx context.Context, selections ast.SelectionSet, v *model.Product) graphql.Marshaler { + return ec.marshalOProduct2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐProduct(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_UpdateProductPayload_product(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "UpdateProductPayload", @@ -8081,37 +8494,7 @@ func (ec *executionContext) fieldContext_UpdateProductPayload_product(_ context. IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Product_id(ctx, field) - case "sku": - return ec.fieldContext_Product_sku(ctx, field) - case "title": - return ec.fieldContext_Product_title(ctx, field) - case "body": - return ec.fieldContext_Product_body(ctx, field) - case "price": - return ec.fieldContext_Product_price(ctx, field) - case "currency": - return ec.fieldContext_Product_currency(ctx, field) - case "inventoryStatus": - return ec.fieldContext_Product_inventoryStatus(ctx, field) - case "inventoryQuantity": - return ec.fieldContext_Product_inventoryQuantity(ctx, field) - case "category": - return ec.fieldContext_Product_category(ctx, field) - case "collections": - return ec.fieldContext_Product_collections(ctx, field) - case "images": - return ec.fieldContext_Product_images(ctx, field) - case "metadata": - return ec.fieldContext_Product_metadata(ctx, field) - case "createdAt": - return ec.fieldContext_Product_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Product_updatedAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Product", field.Name) + return ec.childFields_Product(ctx, field) }, } return fc, nil @@ -8122,17 +8505,20 @@ func (ec *executionContext) _UpdateProductPayload_conflict(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_UpdateProductPayload_conflict, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateProductPayload_conflict(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Conflict, nil }, nil, - ec.marshalOOptimisticLockConflict2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐOptimisticLockConflict, + func(ctx context.Context, selections ast.SelectionSet, v *model.OptimisticLockConflict) graphql.Marshaler { + return ec.marshalOOptimisticLockConflict2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐOptimisticLockConflict(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_UpdateProductPayload_conflict(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "UpdateProductPayload", @@ -8140,17 +8526,7 @@ func (ec *executionContext) fieldContext_UpdateProductPayload_conflict(_ context IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "currentVersion": - return ec.fieldContext_OptimisticLockConflict_currentVersion(ctx, field) - case "attemptedVersion": - return ec.fieldContext_OptimisticLockConflict_attemptedVersion(ctx, field) - case "current": - return ec.fieldContext_OptimisticLockConflict_current(ctx, field) - case "diff": - return ec.fieldContext_OptimisticLockConflict_diff(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type OptimisticLockConflict", field.Name) + return ec.childFields_OptimisticLockConflict(ctx, field) }, } return fc, nil @@ -8161,28 +8537,22 @@ func (ec *executionContext) _User_username(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_User_username, + 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, - ec.marshalNString2string, + 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) { - fc = &graphql.FieldContext{ - Object: "User", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("User", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _User_isAdmin(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { @@ -8190,28 +8560,22 @@ func (ec *executionContext) _User_isAdmin(ctx context.Context, field graphql.Col ctx, ec.OperationContext, field, - ec.fieldContext_User_isAdmin, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_User_isAdmin(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.IsAdmin, nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_User_isAdmin(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "User", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("User", field, false, false, errors.New("field of type Boolean does not have child fields")) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { @@ -8219,28 +8583,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext___Directive_name, + 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, - ec.marshalNString2string, + 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) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8248,28 +8606,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___Directive_description, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8277,28 +8629,22 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___Directive_isRepeatable, + 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, - ec.marshalNBoolean2bool, + 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) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + 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) { @@ -8306,28 +8652,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext___Directive_locations, + 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, - ec.marshalN__DirectiveLocation2ᚕstringᚄ, + 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) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __DirectiveLocation does not have child fields") - }, - } - return fc, nil + 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) { @@ -8335,17 +8675,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext___Directive_args, + 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, - ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + 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", @@ -8353,21 +8696,7 @@ func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, f IsMethod: false, IsResolver: false, Child: func(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) + return ec.childFields___InputValue(ctx, field) }, } defer func() { @@ -8389,28 +8718,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_name, + 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, - ec.marshalNString2string, + 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) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8418,28 +8741,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_description, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8447,28 +8764,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_isDeprecated, + 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, - ec.marshalNBoolean2bool, + 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) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + 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) { @@ -8476,28 +8787,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_deprecationReason, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8505,28 +8810,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col ctx, ec.OperationContext, field, - ec.fieldContext___Field_name, + 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, - ec.marshalNString2string, + 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) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8534,28 +8833,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap ctx, ec.OperationContext, field, - ec.fieldContext___Field_description, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8563,17 +8856,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col ctx, ec.OperationContext, field, - ec.fieldContext___Field_args, + 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, - ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + 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", @@ -8581,21 +8877,7 @@ func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field IsMethod: false, IsResolver: false, Child: func(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) + return ec.childFields___InputValue(ctx, field) }, } defer func() { @@ -8617,17 +8899,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col ctx, ec.OperationContext, field, - ec.fieldContext___Field_type, + 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, - ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + 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", @@ -8635,31 +8920,7 @@ func (ec *executionContext) fieldContext___Field_type(_ context.Context, field g IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -8670,28 +8931,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext___Field_isDeprecated, + 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, - ec.marshalNBoolean2bool, - true, - true, - ) -} - -func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) }, - } - return fc, nil + 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) { @@ -8699,28 +8954,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext___Field_deprecationReason, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8728,28 +8977,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_name, + 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, - ec.marshalNString2string, + 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) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8757,28 +9000,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_description, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8786,17 +9023,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_type, + 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, - ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + 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", @@ -8804,31 +9044,7 @@ func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, fi IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -8839,28 +9055,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_defaultValue, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8868,28 +9078,22 @@ func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_isDeprecated, + 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, - ec.marshalNBoolean2bool, + 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) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + 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) { @@ -8897,28 +9101,22 @@ func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_deprecationReason, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8926,28 +9124,22 @@ func (ec *executionContext) ___Schema_description(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext___Schema_description, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -8955,17 +9147,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext___Schema_types, + 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, - ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + 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", @@ -8973,31 +9168,7 @@ func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -9008,17 +9179,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext___Schema_queryType, + 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, - ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + 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", @@ -9026,31 +9200,7 @@ func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, f IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -9061,17 +9211,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext___Schema_mutationType, + 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, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + 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", @@ -9079,31 +9232,7 @@ func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -9114,17 +9243,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext___Schema_subscriptionType, + 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, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + 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", @@ -9132,31 +9264,7 @@ func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Con IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -9167,17 +9275,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap ctx, ec.OperationContext, field, - ec.fieldContext___Schema_directives, + 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, - ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ, + 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", @@ -9185,19 +9296,7 @@ func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, IsMethod: true, IsResolver: false, Child: func(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) + return ec.childFields___Directive(ctx, field) }, } return fc, nil @@ -9208,28 +9307,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll ctx, ec.OperationContext, field, - ec.fieldContext___Type_kind, + 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, - ec.marshalN__TypeKind2string, + 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) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __TypeKind does not have child fields") - }, - } - return fc, nil + 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) { @@ -9237,28 +9330,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll ctx, ec.OperationContext, field, - ec.fieldContext___Type_name, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -9266,28 +9353,22 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext___Type_description, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -9295,28 +9376,22 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext___Type_specifiedByURL, + 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, - ec.marshalOString2ᚖstring, + 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) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + 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) { @@ -9324,18 +9399,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext___Type_fields, + 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, - ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ, + 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", @@ -9343,21 +9421,7 @@ func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, fiel IsMethod: true, IsResolver: false, Child: func(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) + return ec.childFields___Field(ctx, field) }, } defer func() { @@ -9379,17 +9443,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext___Type_interfaces, + 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, - ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + 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", @@ -9397,31 +9464,7 @@ func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, fi IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -9432,17 +9475,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext___Type_possibleTypes, + 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, - ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + 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", @@ -9450,31 +9496,7 @@ func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -9485,18 +9507,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext___Type_enumValues, + 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, - ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ, + 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", @@ -9504,17 +9529,7 @@ func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, IsMethod: true, IsResolver: false, Child: func(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) + return ec.childFields___EnumValue(ctx, field) }, } defer func() { @@ -9536,17 +9551,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext___Type_inputFields, + 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, - ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + 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", @@ -9554,21 +9572,7 @@ func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, f IsMethod: true, IsResolver: false, Child: func(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) + return ec.childFields___InputValue(ctx, field) }, } return fc, nil @@ -9579,17 +9583,20 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext___Type_ofType, + 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, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + 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", @@ -9597,31 +9604,7 @@ func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -9632,28 +9615,22 @@ func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext___Type_isOneOf, + 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, - ec.marshalOBoolean2bool, + 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) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type Boolean does not have child fields")) } // endregion **************************** field.gotpl ***************************** @@ -9790,6 +9767,57 @@ func (ec *executionContext) unmarshalInputCreateCollectionInput(ctx context.Cont return it, nil } +func (ec *executionContext) unmarshalInputCreateNamespaceInput(ctx context.Context, obj any) (model.CreateNamespaceInput, error) { + var it model.CreateNamespaceInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"identifier", "displayName", "tier", "parentEnterpriseIdentifier"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "identifier": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifier")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Identifier = data + case "displayName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.DisplayName = data + case "tier": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tier")) + data, err := ec.unmarshalNNamespaceTier2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespaceTier(ctx, v) + if err != nil { + return it, err + } + it.Tier = data + case "parentEnterpriseIdentifier": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentEnterpriseIdentifier")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ParentEnterpriseIdentifier = data + } + } + return it, nil +} + func (ec *executionContext) unmarshalInputCreateProductInput(ctx context.Context, obj any) (model.CreateProductInput, error) { var it model.CreateProductInput if obj == nil { @@ -9952,20 +9980,50 @@ func (ec *executionContext) unmarshalInputDeleteCollectionInput(ctx context.Cont continue } switch k { - case "clientMutationId": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientMutationId")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.ClientMutationID = data - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalNID2string(ctx, v) + case "clientMutationId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientMutationId")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientMutationID = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalNID2string(ctx, v) + if err != nil { + return it, err + } + it.ID = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputDeleteNamespaceInput(ctx context.Context, obj any) (model.DeleteNamespaceInput, error) { + var it model.DeleteNamespaceInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"identifier"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "identifier": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifier")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.ID = data + it.Identifier = data } } return it, nil @@ -10617,6 +10675,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._Product(ctx, sel, obj) + case model.Namespace: + return ec._Namespace(ctx, sel, &obj) + case *model.Namespace: + if obj == nil { + return graphql.Null + } + return ec._Namespace(ctx, sel, obj) case model.Collection: return ec._Collection(ctx, sel, &obj) case *model.Collection: @@ -10679,7 +10744,7 @@ func (ec *executionContext) _AuthSession(ctx context.Context, sel ast.SelectionS return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -10733,7 +10798,7 @@ func (ec *executionContext) _CatalogStats(ctx context.Context, sel ast.Selection return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -10789,7 +10854,7 @@ func (ec *executionContext) _CatalogVersion(ctx context.Context, sel ast.Selecti return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -10908,7 +10973,7 @@ func (ec *executionContext) _Category(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -10962,7 +11027,7 @@ func (ec *executionContext) _CategoryOptimisticLockConflict(ctx context.Context, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11069,7 +11134,7 @@ func (ec *executionContext) _Collection(ctx context.Context, sel ast.SelectionSe return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11123,7 +11188,7 @@ func (ec *executionContext) _CollectionOptimisticLockConflict(ctx context.Contex return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11161,7 +11226,7 @@ func (ec *executionContext) _CreateCategoryPayload(ctx context.Context, sel ast. return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11199,7 +11264,46 @@ func (ec *executionContext) _CreateCollectionPayload(ctx context.Context, sel as return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var createNamespacePayloadImplementors = []string{"CreateNamespacePayload"} + +func (ec *executionContext) _CreateNamespacePayload(ctx context.Context, sel ast.SelectionSet, obj *model.CreateNamespacePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createNamespacePayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CreateNamespacePayload") + case "namespace": + out.Values[i] = ec._CreateNamespacePayload_namespace(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(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11237,7 +11341,7 @@ func (ec *executionContext) _CreateProductPayload(ctx context.Context, sel ast.S return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11277,7 +11381,7 @@ func (ec *executionContext) _DeleteCategoryPayload(ctx context.Context, sel ast. return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11315,7 +11419,46 @@ func (ec *executionContext) _DeleteCollectionPayload(ctx context.Context, sel as return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var deleteNamespacePayloadImplementors = []string{"DeleteNamespacePayload"} + +func (ec *executionContext) _DeleteNamespacePayload(ctx context.Context, sel ast.SelectionSet, obj *model.DeleteNamespacePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deleteNamespacePayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DeleteNamespacePayload") + case "deletedIdentifier": + out.Values[i] = ec._DeleteNamespacePayload_deletedIdentifier(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(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11353,7 +11496,7 @@ func (ec *executionContext) _DeleteProductPayload(ctx context.Context, sel ast.S return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11391,7 +11534,7 @@ func (ec *executionContext) _LoginPayload(ctx context.Context, sel ast.Selection return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11432,7 +11575,7 @@ func (ec *executionContext) _LogoutPayload(ctx context.Context, sel ast.Selectio return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11570,6 +11713,93 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "createNamespace": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createNamespace(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteNamespace": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteNamespace(ctx, field) + }) + 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(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var namespaceImplementors = []string{"Namespace", "Node"} + +func (ec *executionContext) _Namespace(ctx context.Context, sel ast.SelectionSet, obj *model.Namespace) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, namespaceImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Namespace") + case "id": + out.Values[i] = ec._Namespace_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "identifier": + out.Values[i] = ec._Namespace_identifier(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "displayName": + out.Values[i] = ec._Namespace_displayName(ctx, field, obj) + case "tier": + out.Values[i] = ec._Namespace_tier(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "parentEnterpriseId": + out.Values[i] = ec._Namespace_parentEnterpriseId(ctx, field, obj) + case "createdAt": + out.Values[i] = ec._Namespace_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdBy": + out.Values[i] = ec._Namespace_createdBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedAt": + out.Values[i] = ec._Namespace_updatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedBy": + out.Values[i] = ec._Namespace_updatedBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -11579,7 +11809,7 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11633,7 +11863,7 @@ func (ec *executionContext) _OptimisticLockConflict(ctx context.Context, sel ast return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11681,7 +11911,7 @@ func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11838,7 +12068,7 @@ func (ec *executionContext) _Product(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11887,7 +12117,7 @@ func (ec *executionContext) _ProductConnection(ctx context.Context, sel ast.Sele return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11931,7 +12161,7 @@ func (ec *executionContext) _ProductEdge(ctx context.Context, sel ast.SelectionS return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -11969,7 +12199,7 @@ func (ec *executionContext) _PublishCatalogPayload(ctx context.Context, sel ast. return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12244,6 +12474,66 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "namespace": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_namespace(ctx, field) + 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 "namespaceById": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_namespaceById(ctx, field) + 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 "namespaces": + 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_namespaces(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 "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -12262,7 +12552,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12300,7 +12590,7 @@ func (ec *executionContext) _RefreshTokenPayload(ctx context.Context, sel ast.Se return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12338,7 +12628,7 @@ func (ec *executionContext) _ReorderCategoriesPayload(ctx context.Context, sel a return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12376,7 +12666,7 @@ func (ec *executionContext) _ReorderCollectionsPayload(ctx context.Context, sel return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12416,7 +12706,7 @@ func (ec *executionContext) _UpdateCategoryPayload(ctx context.Context, sel ast. return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12456,7 +12746,7 @@ func (ec *executionContext) _UpdateCollectionPayload(ctx context.Context, sel as return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12496,7 +12786,7 @@ func (ec *executionContext) _UpdateProductPayload(ctx context.Context, sel ast.S return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12540,7 +12830,7 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12596,7 +12886,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12644,7 +12934,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12702,7 +12992,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12757,7 +13047,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12812,7 +13102,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -12871,7 +13161,7 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -13023,6 +13313,25 @@ func (ec *executionContext) marshalNCreateCollectionPayload2ᚖgithubᚗcomᚋgi return ec._CreateCollectionPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNCreateNamespaceInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateNamespaceInput(ctx context.Context, v any) (model.CreateNamespaceInput, error) { + res, err := ec.unmarshalInputCreateNamespaceInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCreateNamespacePayload2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateNamespacePayload(ctx context.Context, sel ast.SelectionSet, v model.CreateNamespacePayload) graphql.Marshaler { + return ec._CreateNamespacePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCreateNamespacePayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateNamespacePayload(ctx context.Context, sel ast.SelectionSet, v *model.CreateNamespacePayload) 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._CreateNamespacePayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNCreateProductInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐCreateProductInput(ctx context.Context, v any) (model.CreateProductInput, error) { res, err := ec.unmarshalInputCreateProductInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -13106,6 +13415,25 @@ func (ec *executionContext) marshalNDeleteCollectionPayload2ᚖgithubᚗcomᚋgi return ec._DeleteCollectionPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNDeleteNamespaceInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteNamespaceInput(ctx context.Context, v any) (model.DeleteNamespaceInput, error) { + res, err := ec.unmarshalInputDeleteNamespaceInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDeleteNamespacePayload2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteNamespacePayload(ctx context.Context, sel ast.SelectionSet, v model.DeleteNamespacePayload) graphql.Marshaler { + return ec._DeleteNamespacePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDeleteNamespacePayload2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteNamespacePayload(ctx context.Context, sel ast.SelectionSet, v *model.DeleteNamespacePayload) 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._DeleteNamespacePayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNDeleteProductInput2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐDeleteProductInput(ctx context.Context, v any) (model.DeleteProductInput, error) { res, err := ec.unmarshalInputDeleteProductInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -13235,6 +13563,42 @@ func (ec *executionContext) marshalNLogoutPayload2ᚖgithubᚗcomᚋgitstoreᚑd return ec._LogoutPayload(ctx, sel, v) } +func (ec *executionContext) marshalNNamespace2ᚕᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespaceᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Namespace) 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.marshalNNamespace2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespace(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNNamespace2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespace(ctx context.Context, sel ast.SelectionSet, v *model.Namespace) 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._Namespace(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNNamespaceTier2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespaceTier(ctx context.Context, v any) (model.NamespaceTier, error) { + var res model.NamespaceTier + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNNamespaceTier2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespaceTier(ctx context.Context, sel ast.SelectionSet, v model.NamespaceTier) graphql.Marshaler { + return v +} + func (ec *executionContext) marshalNNode2ᚕgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNode(ctx context.Context, sel ast.SelectionSet, v []model.Node) graphql.Marshaler { ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) @@ -13867,6 +14231,13 @@ func (ec *executionContext) marshalOJSON2map(ctx context.Context, sel ast.Select return res } +func (ec *executionContext) marshalONamespace2ᚖgithubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNamespace(ctx context.Context, sel ast.SelectionSet, v *model.Namespace) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Namespace(ctx, sel, v) +} + func (ec *executionContext) marshalONode2githubᚗcomᚋgitstoreᚑdevᚋgitstoreᚋapiᚋinternalᚋgraphᚋmodelᚐNode(ctx context.Context, sel ast.SelectionSet, v model.Node) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/gitstore-api/internal/graph/model/models_gen.go b/gitstore-api/internal/graph/model/models_gen.go index 87b2717..ff3f6e5 100644 --- a/gitstore-api/internal/graph/model/models_gen.go +++ b/gitstore-api/internal/graph/model/models_gen.go @@ -187,6 +187,31 @@ type CreateCollectionPayload struct { Collection *Collection `json:"collection,omitempty"` } +// Input for creating a new namespace. +type CreateNamespaceInput struct { + // The human-readable identifier for the namespace. + // Must be globally unique across all tiers. + // DNS label format: lowercase alphanumeric and hyphens, 1–63 characters. + // Cannot begin or end with a hyphen. Cannot be a reserved name. + Identifier string `json:"identifier"` + // Optional human-friendly display name. + DisplayName *string `json:"displayName,omitempty"` + // The tier of the namespace being created. + // USER and ORGANISATION tiers may be created by any authenticated user. + // ENTERPRISE tier requires isAdmin == true in the caller's JWT. + Tier NamespaceTier `json:"tier"` + // For ORGANISATION tier only: the identifier of the parent enterprise namespace. + // The referenced namespace must exist and have tier ENTERPRISE. + // Omit for USER and ENTERPRISE tier namespaces. + ParentEnterpriseIdentifier *string `json:"parentEnterpriseIdentifier,omitempty"` +} + +// Payload returned after successfully creating a namespace. +type CreateNamespacePayload struct { + // The newly created namespace. + Namespace *Namespace `json:"namespace"` +} + // Input for creating a product type CreateProductInput struct { // Client mutation ID (Relay pattern) @@ -257,6 +282,20 @@ type DeleteCollectionPayload struct { DeletedCollectionID *string `json:"deletedCollectionId,omitempty"` } +// Input for deleting a namespace. +type DeleteNamespaceInput struct { + // The identifier of the namespace to delete. + // Deletion is blocked if any repositories exist within the namespace. + // Requires the caller to be the namespace owner (createdBy) or isAdmin. + Identifier string `json:"identifier"` +} + +// Payload returned after successfully deleting a namespace. +type DeleteNamespacePayload struct { + // The identifier of the deleted namespace. + DeletedIdentifier string `json:"deletedIdentifier"` +} + // Input for deleting a product type DeleteProductInput struct { // Client mutation ID (Relay pattern) @@ -308,6 +347,39 @@ type LogoutPayload struct { type Mutation struct { } +// A namespace is the primary isolation boundary for repositories in GitStore. +// Namespaces are globally unique across all tiers — the same identifier cannot +// exist as both a user-space and an organisation namespace. +type Namespace struct { + // Globally unique system-generated ID (UUID). + ID string `json:"id"` + // Human-readable identifier, globally unique across all tiers. + // DNS label format: lowercase alphanumeric and hyphens, 1–63 characters. + // Cannot begin or end with a hyphen. + Identifier string `json:"identifier"` + // Optional human-friendly display name. + DisplayName *string `json:"displayName,omitempty"` + // The tier of this namespace. + Tier NamespaceTier `json:"tier"` + // For ORGANISATION tier namespaces: the ID of the parent enterprise namespace, + // if one was declared at creation time. + // Null for USER and ENTERPRISE tier namespaces. + ParentEnterpriseID *string `json:"parentEnterpriseId,omitempty"` + // Timestamp when this namespace was created. + CreatedAt time.Time `json:"createdAt"` + // Username of the caller who created this namespace. + CreatedBy string `json:"createdBy"` + // Timestamp when this namespace was last modified. + UpdatedAt time.Time `json:"updatedAt"` + // Username of the caller who last modified this namespace. + UpdatedBy string `json:"updatedBy"` +} + +func (Namespace) IsNode() {} + +// Globally unique identifier (format: [type]_[base62]) +func (this Namespace) GetID() string { return this.ID } + // Optimistic lock conflict information type OptimisticLockConflict struct { // Current version in database @@ -647,3 +719,68 @@ func (e InventoryStatus) MarshalJSON() ([]byte, error) { e.MarshalGQL(&buf) return buf.Bytes(), nil } + +// The tier of a namespace, which determines ownership and repository capabilities. +type NamespaceTier string + +const ( + // User-space namespace: owned by an individual, directly owns repositories. + // Any authenticated user may create one. + NamespaceTierUser NamespaceTier = "USER" + // Organisation namespace: owned by a team or company, directly owns repositories. + // May declare a parent enterprise at creation time. + // Any authenticated user may create one. + NamespaceTierOrganisation NamespaceTier = "ORGANISATION" + // Enterprise namespace: organises organisations, does NOT own repositories directly. + // Only callers with an elevated platform role (isAdmin) may create one. + NamespaceTierEnterprise NamespaceTier = "ENTERPRISE" +) + +var AllNamespaceTier = []NamespaceTier{ + NamespaceTierUser, + NamespaceTierOrganisation, + NamespaceTierEnterprise, +} + +func (e NamespaceTier) IsValid() bool { + switch e { + case NamespaceTierUser, NamespaceTierOrganisation, NamespaceTierEnterprise: + return true + } + return false +} + +func (e NamespaceTier) String() string { + return string(e) +} + +func (e *NamespaceTier) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = NamespaceTier(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid NamespaceTier", str) + } + return nil +} + +func (e NamespaceTier) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *NamespaceTier) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e NamespaceTier) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} diff --git a/gitstore-api/internal/graph/namespace.resolvers.go b/gitstore-api/internal/graph/namespace.resolvers.go new file mode 100644 index 0000000..0121a8a --- /dev/null +++ b/gitstore-api/internal/graph/namespace.resolvers.go @@ -0,0 +1,77 @@ +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.90 + +// SPDX-License-Identifier: AGPL-3.0-or-later +// Copyright (c) 2026 GitStore contributors + +import ( + "context" + + "github.com/gitstore-dev/gitstore/api/internal/graph/model" + "github.com/gitstore-dev/gitstore/api/internal/middleware" + "github.com/vektah/gqlparser/v2/gqlerror" +) + +// CreateNamespace is the resolver for the createNamespace field. +func (r *mutationResolver) CreateNamespace(ctx context.Context, input model.CreateNamespaceInput) (*model.CreateNamespacePayload, error) { + user, ok := middleware.GetUserFromContext(ctx) + if !ok || user == nil { + return nil, gqlerror.Errorf("authentication required") + } + + ns, err := r.service.CreateNamespace(ctx, input, user.Username, user.IsAdmin) + if err != nil { + return nil, err + } + + return &model.CreateNamespacePayload{Namespace: datastoreNamespaceToModel(ns)}, nil +} + +// DeleteNamespace is the resolver for the deleteNamespace field. +func (r *mutationResolver) DeleteNamespace(ctx context.Context, input model.DeleteNamespaceInput) (*model.DeleteNamespacePayload, error) { + user, ok := middleware.GetUserFromContext(ctx) + if !ok || user == nil { + return nil, gqlerror.Errorf("authentication required") + } + + if err := r.service.DeleteNamespace(ctx, input.Identifier, user.Username, user.IsAdmin); err != nil { + return nil, err + } + + return &model.DeleteNamespacePayload{DeletedIdentifier: input.Identifier}, nil +} + +// Namespace is the resolver for the namespace field. +func (r *queryResolver) Namespace(ctx context.Context, identifier string) (*model.Namespace, error) { + ns, err := r.service.GetNamespaceByIdentifier(ctx, identifier) + if err != nil { + return nil, err + } + return datastoreNamespaceToModel(ns), nil +} + +// NamespaceByID is the resolver for the namespaceById field. +func (r *queryResolver) NamespaceByID(ctx context.Context, id string) (*model.Namespace, error) { + ns, err := r.service.GetNamespaceByID(ctx, id) + if err != nil { + return nil, err + } + return datastoreNamespaceToModel(ns), nil +} + +// Namespaces is the resolver for the namespaces field. +func (r *queryResolver) Namespaces(ctx context.Context) ([]*model.Namespace, error) { + nss, err := r.service.ListNamespaces(ctx) + if err != nil { + return nil, err + } + result := make([]*model.Namespace, len(nss)) + for i, ns := range nss { + result[i] = datastoreNamespaceToModel(ns) + } + return result, nil +} diff --git a/gitstore-api/internal/graph/namespace_service_test.go b/gitstore-api/internal/graph/namespace_service_test.go new file mode 100644 index 0000000..65ba81f --- /dev/null +++ b/gitstore-api/internal/graph/namespace_service_test.go @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later +// Copyright (c) 2026 GitStore contributors + +package graph_test + +import ( + "context" + "testing" + + "github.com/gitstore-dev/gitstore/api/internal/graph/model" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// ── createNamespace ──────────────────────────────────────────────────────────── + +func TestCreateNamespace_userTier_success(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{ + Identifier: "acme-corp", + Tier: model.NamespaceTierUser, + } + ns, err := svc.CreateNamespace(context.Background(), input, "alice", false) + require.NoError(t, err) + require.NotNil(t, ns) + assert.Equal(t, "acme-corp", ns.Identifier) + assert.Equal(t, "alice", ns.CreatedBy) + assert.NotEmpty(t, ns.ID) +} + +func TestCreateNamespace_orgTier_success(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{ + Identifier: "acme-engineering", + Tier: model.NamespaceTierOrganisation, + } + ns, err := svc.CreateNamespace(context.Background(), input, "bob", false) + require.NoError(t, err) + require.NotNil(t, ns) + assert.Equal(t, "acme-engineering", ns.Identifier) +} + +func TestCreateNamespace_duplicateIdentifier_conflict(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{ + Identifier: "duplicate-ns", + Tier: model.NamespaceTierUser, + } + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + require.NoError(t, err) + + // second call with same identifier + _, err = svc.CreateNamespace(context.Background(), input, "bob", false) + assert.Error(t, err) + assert.Contains(t, err.Error(), "already exists") +} + +func TestCreateNamespace_invalidIdentifier_spaces(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{ + Identifier: "invalid identifier", + Tier: model.NamespaceTierUser, + } + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + assert.Error(t, err) +} + +func TestCreateNamespace_uppercaseIdentifier_normalizedToLowercase(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{ + Identifier: "InvalidNS", + Tier: model.NamespaceTierUser, + } + // uppercase is folded to lowercase before validation; "invalidns" is a valid identifier + ns, err := svc.CreateNamespace(context.Background(), input, "alice", false) + require.NoError(t, err) + assert.Equal(t, "invalidns", ns.Identifier) +} + +func TestCreateNamespace_invalidIdentifier_leadingHyphen(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{ + Identifier: "-leading-hyphen", + Tier: model.NamespaceTierUser, + } + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + assert.Error(t, err) +} + +func TestCreateNamespace_reservedIdentifier_admin(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{ + Identifier: "admin", + Tier: model.NamespaceTierUser, + } + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + assert.Error(t, err) + assert.Contains(t, err.Error(), "reserved") +} + +func TestCreateNamespace_enterpriseTier_withoutAdmin_denied(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{ + Identifier: "acme-enterprise", + Tier: model.NamespaceTierEnterprise, + } + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + assert.Error(t, err) + assert.Contains(t, err.Error(), "elevated permissions") +} + +func TestCreateNamespace_enterpriseTier_withAdmin_succeeds(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{ + Identifier: "acme-enterprise", + Tier: model.NamespaceTierEnterprise, + } + ns, err := svc.CreateNamespace(context.Background(), input, "admin-user", true) + require.NoError(t, err) + require.NotNil(t, ns) +} + +// ── namespaces query ─────────────────────────────────────────────────────────── + +func TestListNamespaces_returnsAll(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + + for _, id := range []string{"ns-alpha", "ns-beta", "ns-gamma"} { + input := model.CreateNamespaceInput{Identifier: id, Tier: model.NamespaceTierUser} + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + require.NoError(t, err) + } + + nss, err := svc.ListNamespaces(context.Background()) + require.NoError(t, err) + assert.GreaterOrEqual(t, len(nss), 3) +} + +// ── namespace query ──────────────────────────────────────────────────────────── + +func TestGetNamespaceByIdentifier_success(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{Identifier: "lookup-me", Tier: model.NamespaceTierUser} + created, err := svc.CreateNamespace(context.Background(), input, "alice", false) + require.NoError(t, err) + + got, err := svc.GetNamespaceByIdentifier(context.Background(), "lookup-me") + require.NoError(t, err) + assert.Equal(t, created.ID, got.ID) +} + +func TestGetNamespaceByIdentifier_notFound(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + _, err := svc.GetNamespaceByIdentifier(context.Background(), "does-not-exist") + assert.Error(t, err) +} + +// ── deleteNamespace ──────────────────────────────────────────────────────────── + +func TestDeleteNamespace_owner_success(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{Identifier: "to-delete", Tier: model.NamespaceTierUser} + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + require.NoError(t, err) + + err = svc.DeleteNamespace(context.Background(), "to-delete", "alice", false) + require.NoError(t, err) + + _, err = svc.GetNamespaceByIdentifier(context.Background(), "to-delete") + assert.Error(t, err) +} + +func TestDeleteNamespace_admin_canDeleteAny(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{Identifier: "owned-by-alice", Tier: model.NamespaceTierUser} + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + require.NoError(t, err) + + // admin deletes alice's namespace + err = svc.DeleteNamespace(context.Background(), "owned-by-alice", "admin-user", true) + require.NoError(t, err) +} + +func TestDeleteNamespace_nonOwner_nonAdmin_denied(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{Identifier: "alices-ns", Tier: model.NamespaceTierUser} + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + require.NoError(t, err) + + err = svc.DeleteNamespace(context.Background(), "alices-ns", "bob", false) + assert.Error(t, err) + assert.Contains(t, err.Error(), "permission denied") +} + +func TestDeleteNamespace_unknownIdentifier_notFound(t *testing.T) { + svc := newTestSvc(t, &mockGitWriter{}) + err := svc.DeleteNamespace(context.Background(), "does-not-exist", "alice", false) + assert.Error(t, err) +} + +func TestDeleteNamespace_unauthenticated(t *testing.T) { + // Unauthenticated check is in the resolver, not service layer. + // Service requires callerUsername — empty caller cannot be owner. + svc := newTestSvc(t, &mockGitWriter{}) + input := model.CreateNamespaceInput{Identifier: "auth-test-ns", Tier: model.NamespaceTierUser} + _, err := svc.CreateNamespace(context.Background(), input, "alice", false) + require.NoError(t, err) + + // empty caller is not the owner and not admin + err = svc.DeleteNamespace(context.Background(), "auth-test-ns", "", false) + assert.Error(t, err) +} diff --git a/gitstore-api/internal/graph/product.resolvers.go b/gitstore-api/internal/graph/product.resolvers.go index 26a34f5..639dd21 100644 --- a/gitstore-api/internal/graph/product.resolvers.go +++ b/gitstore-api/internal/graph/product.resolvers.go @@ -3,7 +3,7 @@ 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.88 +// Code generated by github.com/99designs/gqlgen version v0.17.90 import ( "context" diff --git a/gitstore-api/internal/graph/resolver.go b/gitstore-api/internal/graph/resolver.go index f2c84c1..1486c4e 100644 --- a/gitstore-api/internal/graph/resolver.go +++ b/gitstore-api/internal/graph/resolver.go @@ -10,14 +10,16 @@ import ( "github.com/gitstore-dev/gitstore/api/internal/datastore" "github.com/gitstore-dev/gitstore/api/internal/loader" + "github.com/gitstore-dev/gitstore/api/internal/middleware" "go.uber.org/zap" ) // Resolver is the root GraphQL resolver type Resolver struct { - logger *zap.Logger - store datastore.Datastore - service *Service + logger *zap.Logger + store datastore.Datastore + service *Service + authMiddleware *middleware.AuthMiddleware } // NewResolver creates a new GraphQL resolver. @@ -31,6 +33,11 @@ func NewResolver(store datastore.Datastore, writer GitWriter, logger *zap.Logger } } +// WithAuthMiddleware wires the auth middleware into the resolver (called from main.go). +func (r *Resolver) WithAuthMiddleware(am *middleware.AuthMiddleware) { + r.authMiddleware = am +} + // getLoaders retrieves data loaders from context func (r *Resolver) getLoaders(ctx context.Context) *loader.Loaders { return loader.FromContext(ctx) diff --git a/gitstore-api/internal/graph/schema.resolvers.go b/gitstore-api/internal/graph/schema.resolvers.go index 6c01308..3199d23 100644 --- a/gitstore-api/internal/graph/schema.resolvers.go +++ b/gitstore-api/internal/graph/schema.resolvers.go @@ -3,7 +3,7 @@ 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.88 +// Code generated by github.com/99designs/gqlgen version v0.17.90 import ( "context" diff --git a/gitstore-api/internal/graph/service.go b/gitstore-api/internal/graph/service.go index f7bf923..feea6a0 100644 --- a/gitstore-api/internal/graph/service.go +++ b/gitstore-api/internal/graph/service.go @@ -8,16 +8,35 @@ package graph import ( "context" + "errors" "fmt" + "regexp" + "strings" "time" "github.com/gitstore-dev/gitstore/api/internal/catalog" "github.com/gitstore-dev/gitstore/api/internal/datastore" "github.com/gitstore-dev/gitstore/api/internal/gitclient" + "github.com/gitstore-dev/gitstore/api/internal/graph/model" "github.com/google/uuid" + "github.com/vektah/gqlparser/v2/gqlerror" "go.uber.org/zap" ) +// identifierRegex matches valid namespace identifiers: DNS label, 1-63 chars. +var identifierRegex = regexp.MustCompile(`^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$|^[a-z0-9]$`) + +// reservedIdentifiers is the set of identifiers that cannot be used as namespace names. +var reservedIdentifiers = map[string]struct{}{ + "admin": {}, "root": {}, "system": {}, "default": {}, "api": {}, "git": {}, + "www": {}, "mail": {}, "smtp": {}, "ftp": {}, "org": {}, "orgs": {}, + "static": {}, "assets": {}, "cdn": {}, "docs": {}, "help": {}, "support": {}, + "billing": {}, "status": {}, "health": {}, "internal": {}, "local": {}, + "localhost": {}, "null": {}, "undefined": {}, "true": {}, "false": {}, + "new": {}, "test": {}, "gitstore": {}, "enterprise": {}, "user": {}, + "namespace": {}, "namespaces": {}, "repo": {}, "repos": {}, +} + // Service provides business logic for GraphQL operations type Service struct { store datastore.Datastore @@ -368,6 +387,161 @@ func (s *Service) DeleteCollection(ctx context.Context, id string) error { return s.store.DeleteCollection(ctx, id) } +// ── Namespace ───────────────────────────────────────────────────────────────── + +// CreateNamespace validates and creates a new namespace. +func (s *Service) CreateNamespace(ctx context.Context, input model.CreateNamespaceInput, callerUsername string, isAdmin bool) (*datastore.Namespace, error) { + identifier := strings.ToLower(strings.TrimSpace(input.Identifier)) + + if !identifierRegex.MatchString(identifier) { + return nil, gqlerror.Errorf("invalid identifier: must match DNS label format (lowercase alphanumeric and hyphens, 1–63 chars, no leading/trailing hyphen)") + } + if _, reserved := reservedIdentifiers[identifier]; reserved { + return nil, gqlerror.Errorf("identifier %q is reserved", identifier) + } + + tier := datastoreNamespaceTierFromModel(input.Tier) + if tier == datastore.NamespaceTierEnterprise && !isAdmin { + return nil, gqlerror.Errorf("creating enterprise namespaces requires elevated permissions") + } + + var parentEnterpriseID *string + if input.ParentEnterpriseIdentifier != nil && *input.ParentEnterpriseIdentifier != "" { + if tier != datastore.NamespaceTierOrganisation { + return nil, gqlerror.Errorf("parentEnterpriseIdentifier may only be set for ORGANISATION tier namespaces") + } + parent, err := s.store.GetNamespaceByIdentifier(ctx, *input.ParentEnterpriseIdentifier) + if err != nil { + if errors.Is(err, datastore.ErrNotFound) { + return nil, gqlerror.Errorf("parent enterprise namespace %q not found", *input.ParentEnterpriseIdentifier) + } + return nil, gqlerror.Errorf("failed to resolve parent enterprise namespace") + } + if parent.Tier != datastore.NamespaceTierEnterprise { + return nil, gqlerror.Errorf("parent namespace %q is not an enterprise namespace", *input.ParentEnterpriseIdentifier) + } + parentEnterpriseID = &parent.ID + } + + now := time.Now() + var displayName string + if input.DisplayName != nil { + displayName = *input.DisplayName + } + ns := &datastore.Namespace{ + ID: uuid.New().String(), + Identifier: identifier, + DisplayName: displayName, + Tier: tier, + ParentEnterpriseID: parentEnterpriseID, + CreatedAt: now, + CreatedBy: callerUsername, + UpdatedAt: now, + UpdatedBy: callerUsername, + } + + if err := s.store.CreateNamespace(ctx, ns); err != nil { + if errors.Is(err, datastore.ErrAlreadyExists) { + return nil, gqlerror.Errorf("namespace with identifier %q already exists", identifier) + } + s.logger.Error("failed to create namespace", + zap.String("identifier", identifier), + zap.Error(err), + ) + return nil, gqlerror.Errorf("failed to create namespace") + } + + return ns, nil +} + +// GetNamespaceByIdentifier retrieves a namespace by its identifier. +func (s *Service) GetNamespaceByIdentifier(ctx context.Context, identifier string) (*datastore.Namespace, error) { + ns, err := s.store.GetNamespaceByIdentifier(ctx, identifier) + if err != nil { + if errors.Is(err, datastore.ErrNotFound) { + s.logger.Debug("namespace not found", zap.String("identifier", identifier)) + return nil, gqlerror.Errorf("namespace %q not found", identifier) + } + return nil, gqlerror.Errorf("failed to retrieve namespace") + } + return ns, nil +} + +// GetNamespaceByID retrieves a namespace by its system ID. +func (s *Service) GetNamespaceByID(ctx context.Context, id string) (*datastore.Namespace, error) { + ns, err := s.store.GetNamespace(ctx, id) + if err != nil { + if errors.Is(err, datastore.ErrNotFound) { + s.logger.Debug("namespace not found", zap.String("id", id)) + return nil, gqlerror.Errorf("namespace with id %q not found", id) + } + return nil, gqlerror.Errorf("failed to retrieve namespace") + } + return ns, nil +} + +// ListNamespaces returns all namespaces. +func (s *Service) ListNamespaces(ctx context.Context) ([]*datastore.Namespace, error) { + nss, err := s.store.ListNamespaces(ctx) + if err != nil { + return nil, gqlerror.Errorf("failed to list namespaces") + } + if nss == nil { + return []*datastore.Namespace{}, nil + } + return nss, nil +} + +// DeleteNamespace deletes a namespace after authorisation and safety checks. +func (s *Service) DeleteNamespace(ctx context.Context, identifier string, callerUsername string, isAdmin bool) error { + ns, err := s.store.GetNamespaceByIdentifier(ctx, identifier) + if err != nil { + if errors.Is(err, datastore.ErrNotFound) { + return gqlerror.Errorf("namespace %q not found", identifier) + } + return gqlerror.Errorf("failed to retrieve namespace") + } + + if ns.CreatedBy != callerUsername && !isAdmin { + return gqlerror.Errorf("permission denied: only the namespace owner or an admin may delete this namespace") + } + + // TODO: enforce when repositories table exists + if hasRepositories(ns.ID) { + return gqlerror.Errorf("namespace %q contains repositories and cannot be deleted", identifier) + } + + if err := s.store.DeleteNamespace(ctx, ns.ID); err != nil { + if errors.Is(err, datastore.ErrNotFound) { + return gqlerror.Errorf("namespace %q not found", identifier) + } + s.logger.Error("failed to delete namespace", + zap.String("identifier", identifier), + zap.Error(err), + ) + return gqlerror.Errorf("failed to delete namespace") + } + + return nil +} + +// hasRepositories is a no-op stub; always returns false until the repository table exists. +func hasRepositories(_ string) bool { + // TODO: enforce when repositories table exists + return false +} + +func datastoreNamespaceTierFromModel(t model.NamespaceTier) datastore.NamespaceTier { + switch t { + case model.NamespaceTierOrganisation: + return datastore.NamespaceTierOrganisation + case model.NamespaceTierEnterprise: + return datastore.NamespaceTierEnterprise + default: + return datastore.NamespaceTierUser + } +} + // ── catalog ↔ datastore conversion helpers ──────────────────────────────────── func datastoreProductToCatalog(p *datastore.Product) *catalog.Product { diff --git a/gitstore-api/internal/middleware/auth.go b/gitstore-api/internal/middleware/auth.go index 36f32fa..480ba72 100644 --- a/gitstore-api/internal/middleware/auth.go +++ b/gitstore-api/internal/middleware/auth.go @@ -7,6 +7,7 @@ import ( "context" "net/http" "strings" + "time" "github.com/gitstore-dev/gitstore/api/internal/auth" "golang.org/x/crypto/bcrypt" @@ -138,6 +139,11 @@ func (am *AuthMiddleware) RefreshSessionToken(token string) (string, error) { return am.sessionManager.RefreshToken(token) } +// GetTokenDuration returns the configured token lifetime. +func (am *AuthMiddleware) GetTokenDuration() time.Duration { + return am.sessionManager.GetTokenDuration() +} + // HashPassword generates a bcrypt hash from a plain text password // This is a utility function for generating password hashes func HashPassword(password string) (string, error) { diff --git a/gitstore-api/tests/contract/datastore/contract_test.go b/gitstore-api/tests/contract/datastore/contract_test.go index 76ec72c..1fc6b4b 100644 --- a/gitstore-api/tests/contract/datastore/contract_test.go +++ b/gitstore-api/tests/contract/datastore/contract_test.go @@ -60,6 +60,21 @@ func newCollection() *datastore.Collection { } } +func newNamespace(tier datastore.NamespaceTier) *datastore.Namespace { + now := time.Now() + id := newID() + identifier := "ns-" + newID()[:8] + return &datastore.Namespace{ + ID: id, + Identifier: identifier, + Tier: tier, + CreatedAt: now, + CreatedBy: "test-user", + UpdatedAt: now, + UpdatedBy: "test-user", + } +} + // RunContractSuite runs the full contract suite against any Datastore implementation. // Callers should pass a freshly initialised, empty store. func RunContractSuite(t *testing.T, ds datastore.Datastore) { @@ -334,4 +349,110 @@ func RunContractSuite(t *testing.T, ds datastore.Datastore) { err := ds.DeleteCollection(ctx, newID()) assert.ErrorIs(t, err, datastore.ErrNotFound) }) + + // ── Namespace ───────────────────────────────────────────────────────────── + + t.Run("Namespace/TestCreateNamespace_success", func(t *testing.T) { + ns := newNamespace(datastore.NamespaceTierUser) + require.NoError(t, ds.CreateNamespace(ctx, ns)) + + got, err := ds.GetNamespace(ctx, ns.ID) + require.NoError(t, err) + assert.Equal(t, ns.ID, got.ID) + assert.Equal(t, ns.Identifier, got.Identifier) + assert.Equal(t, ns.Tier, got.Tier) + assert.Equal(t, ns.CreatedBy, got.CreatedBy) + }) + + t.Run("Namespace/TestCreateNamespace_duplicateIdentifier", func(t *testing.T) { + ns := newNamespace(datastore.NamespaceTierOrganisation) + require.NoError(t, ds.CreateNamespace(ctx, ns)) + + ns2 := newNamespace(datastore.NamespaceTierUser) + ns2.Identifier = ns.Identifier // same identifier + err := ds.CreateNamespace(ctx, ns2) + assert.ErrorIs(t, err, datastore.ErrAlreadyExists) + }) + + t.Run("Namespace/TestCreateNamespace_acrossAllTiers", func(t *testing.T) { + ns := newNamespace(datastore.NamespaceTierEnterprise) + require.NoError(t, ds.CreateNamespace(ctx, ns)) + + // same identifier, different tier — must still conflict + nsOrg := newNamespace(datastore.NamespaceTierOrganisation) + nsOrg.Identifier = ns.Identifier + err := ds.CreateNamespace(ctx, nsOrg) + assert.ErrorIs(t, err, datastore.ErrAlreadyExists) + }) + + t.Run("Namespace/TestGetNamespaceByIdentifier_notFound", func(t *testing.T) { + _, err := ds.GetNamespaceByIdentifier(ctx, "does-not-exist-"+newID()[:8]) + assert.ErrorIs(t, err, datastore.ErrNotFound) + }) + + t.Run("Namespace/TestListNamespaces_empty", func(t *testing.T) { + // fresh store or just verify list succeeds + nss, err := ds.ListNamespaces(ctx) + require.NoError(t, err) + assert.NotNil(t, nss) + }) + + t.Run("Namespace/TestListNamespaces_multiple", func(t *testing.T) { + before, err := ds.ListNamespaces(ctx) + require.NoError(t, err) + + ns1 := newNamespace(datastore.NamespaceTierUser) + ns2 := newNamespace(datastore.NamespaceTierOrganisation) + require.NoError(t, ds.CreateNamespace(ctx, ns1)) + require.NoError(t, ds.CreateNamespace(ctx, ns2)) + + after, err := ds.ListNamespaces(ctx) + require.NoError(t, err) + assert.Equal(t, len(before)+2, len(after)) + }) + + t.Run("Namespace/TestGetNamespace_byID_success", func(t *testing.T) { + ns := newNamespace(datastore.NamespaceTierUser) + require.NoError(t, ds.CreateNamespace(ctx, ns)) + + got, err := ds.GetNamespace(ctx, ns.ID) + require.NoError(t, err) + assert.Equal(t, ns.ID, got.ID) + }) + + t.Run("Namespace/TestGetNamespaceByIdentifier_success", func(t *testing.T) { + ns := newNamespace(datastore.NamespaceTierUser) + require.NoError(t, ds.CreateNamespace(ctx, ns)) + + got, err := ds.GetNamespaceByIdentifier(ctx, ns.Identifier) + require.NoError(t, err) + assert.Equal(t, ns.ID, got.ID) + assert.Equal(t, ns.Identifier, got.Identifier) + }) + + t.Run("Namespace/TestDeleteNamespace_success", func(t *testing.T) { + ns := newNamespace(datastore.NamespaceTierUser) + require.NoError(t, ds.CreateNamespace(ctx, ns)) + require.NoError(t, ds.DeleteNamespace(ctx, ns.ID)) + + _, err := ds.GetNamespace(ctx, ns.ID) + assert.ErrorIs(t, err, datastore.ErrNotFound) + }) + + t.Run("Namespace/TestDeleteNamespace_notFound", func(t *testing.T) { + err := ds.DeleteNamespace(ctx, newID()) + assert.ErrorIs(t, err, datastore.ErrNotFound) + }) + + t.Run("Namespace/TestDeleteNamespace_thenGetReturnsNotFound", func(t *testing.T) { + ns := newNamespace(datastore.NamespaceTierOrganisation) + require.NoError(t, ds.CreateNamespace(ctx, ns)) + require.NoError(t, ds.DeleteNamespace(ctx, ns.ID)) + + _, errID := ds.GetNamespace(ctx, ns.ID) + assert.ErrorIs(t, errID, datastore.ErrNotFound) + + _, errIdent := ds.GetNamespaceByIdentifier(ctx, ns.Identifier) + assert.ErrorIs(t, errIdent, datastore.ErrNotFound) + }) } diff --git a/gitstore-api/tests/contract/datastore/scylla_test.go b/gitstore-api/tests/contract/datastore/scylla_test.go index 12a9bb1..57abdeb 100644 --- a/gitstore-api/tests/contract/datastore/scylla_test.go +++ b/gitstore-api/tests/contract/datastore/scylla_test.go @@ -3,13 +3,11 @@ //go:build scylla -// Wires the contract suite against the ScyllaDB backend using testcontainers. -// A single container is started in TestMain and shared across all tests. +// Wires the contract suite against an externally managed ScyllaDB instance. package datastore_contract_test import ( - "context" "fmt" "net" "os" @@ -22,41 +20,25 @@ import ( "github.com/gitstore-dev/gitstore/api/internal/datastore/scylla" "github.com/gocql/gocql" "github.com/stretchr/testify/require" - "github.com/testcontainers/testcontainers-go" - "github.com/testcontainers/testcontainers-go/wait" "go.uber.org/zap" ) -// scyllaContainerAddr is set by TestMain before any test runs. -var scyllaContainerAddr string +var ( + scyllaAddr string + scyllaKeyspace string +) func TestMain(m *testing.M) { - ctx := context.Background() - req := testcontainers.ContainerRequest{ - Image: "scylladb/scylla:5.4", - ExposedPorts: []string{"9042/tcp"}, - Cmd: []string{"--developer-mode=1", "--overprovisioned=1", "--smp=1"}, - // ForExec verifies cqlsh can actually connect, not just that the log appeared. - WaitingFor: wait.ForExec([]string{"cqlsh", "-e", "describe cluster"}). - WithStartupTimeout(120 * time.Second), - } - c, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ - ContainerRequest: req, - Started: true, - }) - if err != nil { - panic("failed to start ScyllaDB container: " + err.Error()) + scyllaAddr = os.Getenv("GITSTORE_TEST_SCYLLA_ADDR") + if scyllaAddr == "" { + scyllaAddr = "127.0.0.1:9042" } + scyllaKeyspace = fmt.Sprintf("gitstore_contract_test_%d", os.Getpid()) - host, _ := c.Host(ctx) - port, _ := c.MappedPort(ctx, "9042") - scyllaContainerAddr = host + ":" + port.Port() - - // Provision keyspace — mirrors the compose scylla-init service. - provisionKeyspace(scyllaContainerAddr, "gitstore") - + provisionKeyspace(scyllaAddr, scyllaKeyspace) code := m.Run() - _ = c.Terminate(ctx) + dropKeyspace(scyllaAddr, scyllaKeyspace) + os.Exit(code) } @@ -102,11 +84,38 @@ func provisionKeyspace(addr, keyspace string) { } } +func dropKeyspace(addr, keyspace string) { + session, err := openRootSession(addr) + if err != nil { + return + } + defer session.Close() + _ = session.Query(fmt.Sprintf(`DROP KEYSPACE IF EXISTS %s`, keyspace)).Exec() +} + +func openRootSession(addr string) (*gocql.Session, error) { + host, portStr, splitErr := net.SplitHostPort(addr) + if splitErr != nil { + host = addr + portStr = "9042" + } + port, _ := strconv.Atoi(portStr) + cluster := gocql.NewCluster(host) + if port > 0 { + cluster.Port = port + } + cluster.Consistency = gocql.Quorum + cluster.ConnectTimeout = 5 * time.Second + cluster.Timeout = 5 * time.Second + cluster.DisableShardAwarePort = true + return cluster.CreateSession() +} + func newScyllaDatastore(t *testing.T) datastore.Datastore { t.Helper() cfg := config.ScyllaConfig{ - Hosts: []string{scyllaContainerAddr}, - Keyspace: "gitstore", + Hosts: []string{scyllaAddr}, + Keyspace: scyllaKeyspace, DisableShardAwarePort: true, } store, err := scylla.New(cfg, zap.NewNop()) diff --git a/gitstore-api/tests/contract/grpc/testmain_test.go b/gitstore-api/tests/contract/grpc/testmain_test.go index 5358a88..90cd341 100644 --- a/gitstore-api/tests/contract/grpc/testmain_test.go +++ b/gitstore-api/tests/contract/grpc/testmain_test.go @@ -42,8 +42,8 @@ func TestMain(m *testing.M) { Image: "gitstore-git-service:latest", ExposedPorts: []string{"9418/tcp", "50051/tcp"}, Env: map[string]string{ - "GITSTORE_DATA_DIR": "/data/repos", - "GITSTORE_GRPC_PORT": "50051", + "GITSTORE_GIT__DATA_DIR": "/data/repos", + "GITSTORE_GRPC__PORT": "50051", }, WaitingFor: wait.ForHTTP("/health").WithPort("9418/tcp"). WithStartupTimeout(60 * time.Second), diff --git a/shared/schemas/auth.graphql b/shared/schemas/auth.graphqls similarity index 100% rename from shared/schemas/auth.graphql rename to shared/schemas/auth.graphqls diff --git a/shared/schemas/category.graphql b/shared/schemas/category.graphqls similarity index 100% rename from shared/schemas/category.graphql rename to shared/schemas/category.graphqls diff --git a/shared/schemas/collection.graphql b/shared/schemas/collection.graphqls similarity index 100% rename from shared/schemas/collection.graphql rename to shared/schemas/collection.graphqls diff --git a/shared/schemas/namespace.graphqls b/shared/schemas/namespace.graphqls new file mode 100644 index 0000000..0bfd72d --- /dev/null +++ b/shared/schemas/namespace.graphqls @@ -0,0 +1,178 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +# Copyright (c) 2026 GitStore contributors + +""" +The tier of a namespace, which determines ownership and repository capabilities. +""" +enum NamespaceTier { + """ + User-space namespace: owned by an individual, directly owns repositories. + Any authenticated user may create one. + """ + USER + + """ + Organisation namespace: owned by a team or company, directly owns repositories. + May declare a parent enterprise at creation time. + Any authenticated user may create one. + """ + ORGANISATION + + """ + Enterprise namespace: organises organisations, does NOT own repositories directly. + Only callers with an elevated platform role (isAdmin) may create one. + """ + ENTERPRISE +} + +""" +A namespace is the primary isolation boundary for repositories in GitStore. +Namespaces are globally unique across all tiers — the same identifier cannot +exist as both a user-space and an organisation namespace. +""" +type Namespace implements Node { + """ + Globally unique system-generated ID (UUID). + """ + id: ID! + + """ + Human-readable identifier, globally unique across all tiers. + DNS label format: lowercase alphanumeric and hyphens, 1–63 characters. + Cannot begin or end with a hyphen. + """ + identifier: String! + + """ + Optional human-friendly display name. + """ + displayName: String + + """ + The tier of this namespace. + """ + tier: NamespaceTier! + + """ + For ORGANISATION tier namespaces: the ID of the parent enterprise namespace, + if one was declared at creation time. + Null for USER and ENTERPRISE tier namespaces. + """ + parentEnterpriseId: ID + + """ + Timestamp when this namespace was created. + """ + createdAt: DateTime! + + """ + Username of the caller who created this namespace. + """ + createdBy: String! + + """ + Timestamp when this namespace was last modified. + """ + updatedAt: DateTime! + + """ + Username of the caller who last modified this namespace. + """ + updatedBy: String! +} + +""" +Input for creating a new namespace. +""" +input CreateNamespaceInput { + """ + The human-readable identifier for the namespace. + Must be globally unique across all tiers. + DNS label format: lowercase alphanumeric and hyphens, 1–63 characters. + Cannot begin or end with a hyphen. Cannot be a reserved name. + """ + identifier: String! + + """ + Optional human-friendly display name. + """ + displayName: String + + """ + The tier of the namespace being created. + USER and ORGANISATION tiers may be created by any authenticated user. + ENTERPRISE tier requires isAdmin == true in the caller's JWT. + """ + tier: NamespaceTier! + + """ + For ORGANISATION tier only: the identifier of the parent enterprise namespace. + The referenced namespace must exist and have tier ENTERPRISE. + Omit for USER and ENTERPRISE tier namespaces. + """ + parentEnterpriseIdentifier: String +} + +""" +Input for deleting a namespace. +""" +input DeleteNamespaceInput { + """ + The identifier of the namespace to delete. + Deletion is blocked if any repositories exist within the namespace. + Requires the caller to be the namespace owner (createdBy) or isAdmin. + """ + identifier: String! +} + +""" +Payload returned after successfully creating a namespace. +""" +type CreateNamespacePayload { + """ + The newly created namespace. + """ + namespace: Namespace! +} + +""" +Payload returned after successfully deleting a namespace. +""" +type DeleteNamespacePayload { + """ + The identifier of the deleted namespace. + """ + deletedIdentifier: String! +} + +extend type Query { + """ + Get a namespace by its human-readable identifier. + """ + namespace(identifier: String!): Namespace + + """ + Get a namespace by its system-generated ID. + """ + namespaceById(id: ID!): Namespace + + """ + List all namespaces. + """ + namespaces: [Namespace!]! +} + +extend type Mutation { + """ + Create a new namespace. + Requires authentication. ENTERPRISE tier requires isAdmin. + """ + createNamespace(input: CreateNamespaceInput!): CreateNamespacePayload! + + """ + Delete a namespace. + Requires authentication. Caller must be the namespace owner or isAdmin. + Deletion is blocked when the namespace contains repositories. + """ + deleteNamespace(input: DeleteNamespaceInput!): DeleteNamespacePayload! +} diff --git a/shared/schemas/product.graphql b/shared/schemas/product.graphqls similarity index 100% rename from shared/schemas/product.graphql rename to shared/schemas/product.graphqls diff --git a/shared/schemas/schema.graphql b/shared/schemas/schema.graphqls similarity index 100% rename from shared/schemas/schema.graphql rename to shared/schemas/schema.graphqls diff --git a/specs/009-api-namespaces/checklists/requirements.md b/specs/009-api-namespaces/checklists/requirements.md new file mode 100644 index 0000000..6b49b5e --- /dev/null +++ b/specs/009-api-namespaces/checklists/requirements.md @@ -0,0 +1,36 @@ +# Specification Quality Checklist: API-Driven Namespace Lifecycle Management + +**Purpose**: Validate specification completeness and quality before proceeding to planning +**Created**: 2026-05-15 +**Feature**: [spec.md](../spec.md) + +## Content Quality + +- [x] No implementation details (languages, frameworks, APIs) +- [x] Focused on user value and business needs +- [x] Written for non-technical stakeholders +- [x] All mandatory sections completed + +## Requirement Completeness + +- [x] No [NEEDS CLARIFICATION] markers remain +- [x] Requirements are testable and unambiguous +- [x] Success criteria are measurable +- [x] Success criteria are technology-agnostic (no implementation details) +- [x] All acceptance scenarios are defined +- [x] Edge cases are identified +- [x] Scope is clearly bounded +- [x] Dependencies and assumptions identified + +## Feature Readiness + +- [x] All functional requirements have clear acceptance criteria +- [x] User scenarios cover primary flows +- [x] Feature meets measurable outcomes defined in Success Criteria +- [x] No implementation details leak into specification + +## Notes + +- All items pass. Spec is ready for `/speckit.plan`. +- FR-011 references `gitstore-api` and `gitstore-git-service` by name — these are project component names, not technology stack choices, so they are acceptable in this context. +- Clarification session 2026-05-15: 5 questions asked and answered. Tier hierarchy, deletion blocking, global identifier uniqueness, enterprise-org membership, and deletion audit scope all resolved. diff --git a/specs/009-api-namespaces/contracts/datastore-extension.go b/specs/009-api-namespaces/contracts/datastore-extension.go new file mode 100644 index 0000000..881adb6 --- /dev/null +++ b/specs/009-api-namespaces/contracts/datastore-extension.go @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later +// Copyright (c) 2026 GitStore contributors + +// Datastore contract extension for feature 009-api-namespaces. +// +// This file is a design artifact — it is NOT compiled. +// The authoritative implementation lives at: +// gitstore-api/internal/datastore/datastore.go (interface) +// gitstore-api/internal/datastore/entities.go (Namespace struct) +// gitstore-api/internal/datastore/memdb/ (memdb backend) +// gitstore-api/internal/datastore/scylla/ (scylla backend) +// gitstore-api/internal/datastore/instrumented.go (wrapper) + +package datastore + +import ( + "context" + "time" +) + +// ─── NamespaceTier ──────────────────────────────────────────────────────────── + +// NamespaceTier is the enumeration of allowed namespace tiers. +type NamespaceTier string + +const ( + NamespaceTierUser NamespaceTier = "user" + NamespaceTierOrganisation NamespaceTier = "organisation" + NamespaceTierEnterprise NamespaceTier = "enterprise" +) + +// ─── Namespace entity ───────────────────────────────────────────────────────── + +// Namespace is the primary isolation boundary for repositories. +// Identifier is globally unique across all tiers. +type Namespace struct { + ID string + Identifier string // DNS label, globally unique, lowercase, 1–63 chars + DisplayName string // optional + Tier NamespaceTier // user | organisation | enterprise + ParentEnterpriseID *string // optional UUID; organisation tier only + CreatedAt time.Time + CreatedBy string // username of creator + UpdatedAt time.Time + UpdatedBy string // username of last modifier +} + +// ─── Datastore interface extension ─────────────────────────────────────────── + +// The following methods are added to the existing Datastore interface. +// They follow the same error contract as all existing methods: +// - ErrNotFound: entity does not exist +// - ErrAlreadyExists: identifier conflict on CreateNamespace +// - ErrInvalidArgument: empty id or nil namespace + +type DatastoreWithNamespaces interface { + Datastore // all existing methods + + // CreateNamespace stores a new namespace. + // Returns ErrAlreadyExists if a namespace with the same identifier already exists. + CreateNamespace(ctx context.Context, ns *Namespace) error + + // GetNamespace retrieves a namespace by its UUID. + // Returns ErrNotFound if the namespace does not exist. + GetNamespace(ctx context.Context, id string) (*Namespace, error) + + // GetNamespaceByIdentifier retrieves a namespace by its human-readable identifier. + // Returns ErrNotFound if no namespace has the given identifier. + GetNamespaceByIdentifier(ctx context.Context, identifier string) (*Namespace, error) + + // ListNamespaces returns all namespaces. Order is implementation-defined. + ListNamespaces(ctx context.Context) ([]*Namespace, error) + + // DeleteNamespace removes a namespace by its UUID. + // Returns ErrNotFound if the namespace does not exist. + // The caller is responsible for verifying the namespace has no repositories + // before calling (enforced at the service layer, not here). + DeleteNamespace(ctx context.Context, id string) error +} + +// ─── memdb schema addition ─────────────────────────────────────────────────── + +// Add to the memdb DBSchema.Tables map in schema.go: +// +// "namespaces": { +// Name: "namespaces", +// Indexes: map[string]*memdb.IndexSchema{ +// "id": { +// Name: "id", +// Unique: true, +// Indexer: &memdb.StringFieldIndex{Field: "ID"}, +// }, +// "identifier": { +// Name: "identifier", +// Unique: true, +// Indexer: &memdb.StringFieldIndex{Field: "Identifier"}, +// }, +// "tier": { +// Name: "tier", +// Unique: false, +// Indexer: &memdb.StringFieldIndex{Field: "Tier"}, +// }, +// }, +// }, diff --git a/specs/009-api-namespaces/contracts/namespace.graphqls b/specs/009-api-namespaces/contracts/namespace.graphqls new file mode 100644 index 0000000..c3d87a2 --- /dev/null +++ b/specs/009-api-namespaces/contracts/namespace.graphqls @@ -0,0 +1,262 @@ +# GraphQL Contract: Namespace Lifecycle Management +# Feature: 009-api-namespaces +# Status: Design artifact — not deployed; add to shared/schemas/ during implementation. +# +# Add the following to shared/schemas/schema.graphql (Query and Mutation roots): +# +# In Query: +# namespace(identifier: String!): Namespace +# namespaceById(id: ID!): Namespace +# namespaces: [Namespace!]! +# +# In Mutation: +# createNamespace(input: CreateNamespaceInput!): CreateNamespacePayload! +# deleteNamespace(input: DeleteNamespaceInput!): DeleteNamespacePayload! + +# ============================================================================ +# Enums +# ============================================================================ + +""" +The tier of a namespace, which determines ownership and repository capabilities. +""" +enum NamespaceTier { + """ + User-space namespace: owned by an individual, directly owns repositories. + Any authenticated user may create one. + """ + USER + + """ + Organisation namespace: owned by a team or company, directly owns repositories. + May declare a parent enterprise at creation time. + Any authenticated user may create one. + """ + ORGANISATION + + """ + Enterprise namespace: organises organisations, does NOT own repositories directly. + Only callers with an elevated platform role (isAdmin) may create one. + """ + ENTERPRISE +} + +# ============================================================================ +# Types +# ============================================================================ + +""" +A namespace is the primary isolation boundary for repositories in GitStore. +Namespaces are globally unique across all tiers — the same identifier cannot +exist as both a user-space and an organisation namespace. +""" +type Namespace implements Node { + """ + Globally unique system-generated ID (UUID). + """ + id: ID! + + """ + Human-readable identifier, globally unique across all tiers. + DNS label format: lowercase alphanumeric and hyphens, 1–63 characters. + Cannot begin or end with a hyphen. + """ + identifier: String! + + """ + Optional human-friendly display name. + """ + displayName: String + + """ + The tier of this namespace. + """ + tier: NamespaceTier! + + """ + For ORGANISATION tier namespaces: the ID of the parent enterprise namespace, + if one was declared at creation time. + Null for USER and ENTERPRISE tier namespaces. + """ + parentEnterpriseId: ID + + """ + Timestamp when this namespace was created. + """ + createdAt: DateTime! + + """ + Username of the caller who created this namespace. + """ + createdBy: String! + + """ + Timestamp when this namespace was last modified. + """ + updatedAt: DateTime! + + """ + Username of the caller who last modified this namespace. + """ + updatedBy: String! +} + +# ============================================================================ +# Inputs +# ============================================================================ + +""" +Input for creating a new namespace. +""" +input CreateNamespaceInput { + """ + The human-readable identifier for the namespace. + Must be globally unique across all tiers. + DNS label format: lowercase alphanumeric and hyphens, 1–63 characters. + Cannot begin or end with a hyphen. Cannot be a reserved name. + """ + identifier: String! + + """ + Optional human-friendly display name. + """ + displayName: String + + """ + The tier of the namespace being created. + USER and ORGANISATION tiers may be created by any authenticated user. + ENTERPRISE tier requires isAdmin == true in the caller's JWT. + """ + tier: NamespaceTier! + + """ + For ORGANISATION tier only: the identifier of the parent enterprise namespace. + The referenced namespace must exist and have tier ENTERPRISE. + Omit for USER and ENTERPRISE tier namespaces. + """ + parentEnterpriseIdentifier: String +} + +""" +Input for deleting a namespace. +""" +input DeleteNamespaceInput { + """ + The identifier of the namespace to delete. + Deletion is blocked if any repositories exist within the namespace. + Requires the caller to be the namespace owner (createdBy) or isAdmin. + """ + identifier: String! +} + +# ============================================================================ +# Payloads +# ============================================================================ + +""" +Payload returned after successfully creating a namespace. +""" +type CreateNamespacePayload { + """ + The newly created namespace. + """ + namespace: Namespace! +} + +""" +Payload returned after successfully deleting a namespace. +""" +type DeleteNamespacePayload { + """ + The identifier of the deleted namespace. + """ + deletedIdentifier: String! +} + +# ============================================================================ +# Example Operations (for documentation) +# ============================================================================ + +# --- Create a user namespace --- +# mutation CreateUserNamespace { +# createNamespace(input: { +# identifier: "acme-corp" +# displayName: "Acme Corporation" +# tier: USER +# }) { +# namespace { +# id +# identifier +# tier +# createdAt +# createdBy +# } +# } +# } + +# --- Create an enterprise namespace (requires isAdmin) --- +# mutation CreateEnterpriseNamespace { +# createNamespace(input: { +# identifier: "acme-enterprise" +# displayName: "Acme Enterprise" +# tier: ENTERPRISE +# }) { +# namespace { +# id +# identifier +# tier +# createdAt +# createdBy +# } +# } +# } + +# --- Create an org namespace with parent enterprise --- +# mutation CreateOrgWithEnterprise { +# createNamespace(input: { +# identifier: "acme-engineering" +# tier: ORGANISATION +# parentEnterpriseIdentifier: "acme-enterprise" +# }) { +# namespace { +# id +# identifier +# tier +# parentEnterpriseId +# } +# } +# } + +# --- List all namespaces --- +# query ListNamespaces { +# namespaces { +# id +# identifier +# displayName +# tier +# createdAt +# createdBy +# } +# } + +# --- Get namespace by identifier --- +# query GetNamespace { +# namespace(identifier: "acme-corp") { +# id +# identifier +# displayName +# tier +# parentEnterpriseId +# createdAt +# createdBy +# updatedAt +# updatedBy +# } +# } + +# --- Delete a namespace --- +# mutation DeleteNamespace { +# deleteNamespace(input: { identifier: "acme-corp" }) { +# deletedIdentifier +# } +# } diff --git a/specs/009-api-namespaces/data-model.md b/specs/009-api-namespaces/data-model.md new file mode 100644 index 0000000..8aedd28 --- /dev/null +++ b/specs/009-api-namespaces/data-model.md @@ -0,0 +1,167 @@ +# Data Model: API-Driven Namespace Lifecycle Management + +**Feature**: `009-api-namespaces` | **Date**: 2026-05-15 + +--- + +## Entities + +### Namespace + +The primary isolation boundary. Uniquely identified by a human-readable `identifier` (globally unique across all tiers) and a system-generated UUID `ID`. + +| Field | Type | Constraints | +|----------------------|-----------------|--------------------------------------------------------------------------------| +| `ID` | `string` (UUID) | Required, system-generated, unique primary key | +| `Identifier` | `string` | Required, globally unique, DNS label (a-z0-9 + hyphens, 1–63 chars), lowercase | +| `DisplayName` | `string` | Optional, max 255 chars | +| `Tier` | `NamespaceTier` | Required, one of: `user`, `organisation`, `enterprise` | +| `ParentEnterpriseID` | `*string` | Optional UUID; set at creation time for `organisation` tier only | +| `CreatedAt` | `time.Time` | Set on create, immutable | +| `CreatedBy` | `string` | Username of the caller who created the namespace; set on create, immutable | +| `UpdatedAt` | `time.Time` | Updated on every write | +| `UpdatedBy` | `string` | Username of the last caller to modify the namespace | + +**Validation rules** (applied in the service layer before persistence): +- `Identifier` MUST match `^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$` (DNS label, 1–63 chars, no leading/trailing hyphen). +- `Identifier` MUST NOT be in the reserved names list (see `research.md` Decision 6). +- `Identifier` MUST be globally unique across all tiers. +- `Tier` MUST be one of the three allowed values. +- `ParentEnterpriseID`, when set, MUST reference an existing namespace with `Tier == "enterprise"`. +- `ParentEnterpriseID` MUST only be set for `organisation` tier namespaces. + +**State transitions**: +- A namespace is created and immediately active; there is no draft/pending state. +- A namespace can be deleted only when it contains no repositories (enforced by service layer). +- `ParentEnterpriseID` cannot be changed after creation (reassignment is out of scope per spec). + +--- + +### NamespaceTier + +Enumeration of allowed namespace tiers. + +| Value | Description | +|----------------|--------------------------------------------------------------------------| +| `user` | Owns repositories directly; created by any authenticated user | +| `organisation` | Owns repositories directly; may declare a parent enterprise at creation | +| `enterprise` | Organises organisation namespaces; does NOT own repositories directly | + +--- + +## Indices + +### memdb + +```go +"namespaces": { + Name: "namespaces", + Indexes: map[string]*memdb.IndexSchema{ + "id": { + Name: "id", + Unique: true, + Indexer: &memdb.StringFieldIndex{Field: "ID"}, + }, + "identifier": { + Name: "identifier", + Unique: true, + Indexer: &memdb.StringFieldIndex{Field: "Identifier"}, + }, + "tier": { + Name: "tier", + Unique: false, + Indexer: &memdb.StringFieldIndex{Field: "Tier"}, + }, + }, +} +``` + +- `id` (unique): Primary key lookup for `GetNamespace(id)`. +- `identifier` (unique): Supports `GetNamespaceByIdentifier(identifier)` and enforces global uniqueness invariant. +- `tier` (non-unique): Supports future `ListNamespacesByTier(tier)` without full scan. + +### ScyllaDB + +```sql +CREATE TABLE IF NOT EXISTS namespaces ( + id text PRIMARY KEY, + identifier text, + display_name text, + tier text, + parent_enterprise_id text, + created_at bigint, + created_by text, + updated_at bigint, + updated_by text +); + +CREATE INDEX IF NOT EXISTS namespaces_by_identifier ON namespaces (identifier); +``` + +- `id` as `text` PRIMARY KEY (consistent with all other tables in the schema). +- `identifier` secondary index with application-enforced uniqueness (read-before-write guard + unique index). +- Timestamps stored as `bigint` (milliseconds via `UnixMilli()`), consistent with `productRow`, `categoryRow`, `collectionRow`. +- `tier` and `parent_enterprise_id` stored as `text`; the Go layer enforces allowed values. + +--- + +## Go Struct + +Located in `gitstore-api/internal/datastore/entities.go` (new addition alongside `Product`, `Category`, `Collection`): + +```go +// NamespaceTier is the enumeration of allowed namespace tiers. +type NamespaceTier string + +const ( + NamespaceTierUser NamespaceTier = "user" + NamespaceTierOrganisation NamespaceTier = "organisation" + NamespaceTierEnterprise NamespaceTier = "enterprise" +) + +// Namespace is the primary isolation boundary for repositories. +type Namespace struct { + ID string + Identifier string + DisplayName string + Tier NamespaceTier + ParentEnterpriseID *string + CreatedAt time.Time + CreatedBy string + UpdatedAt time.Time + UpdatedBy string +} +``` + +--- + +## Datastore Interface Extension + +New methods added to `gitstore-api/internal/datastore/datastore.go`: + +```go +// Namespace operations +CreateNamespace(ctx context.Context, ns *Namespace) error +GetNamespace(ctx context.Context, id string) (*Namespace, error) +GetNamespaceByIdentifier(ctx context.Context, identifier string) (*Namespace, error) +ListNamespaces(ctx context.Context) ([]*Namespace, error) +DeleteNamespace(ctx context.Context, id string) error +``` + +**Error contract** (consistent with existing methods): +- `ErrNotFound`: namespace with the given key does not exist. +- `ErrAlreadyExists`: `identifier` conflict on `CreateNamespace`. +- `ErrInvalidArgument`: empty `id` or nil namespace passed. + +Note: There is no `UpdateNamespace` operation in this spec. The spec supports create, list, get, and delete. `UpdatedAt`/`UpdatedBy` are populated on create (set equal to `CreatedAt`/`CreatedBy`) and will be used when an update operation is added in a future spec. + +--- + +## Query Patterns + +| Operation | Lookup path | Backend implementation | +|-----------------------------------|-------------------------|---------------------------------------------------------------------------------| +| `GetNamespace(id)` | Primary key | memdb: `txn.First("namespaces","id",id)` / ScyllaDB: `SELECT … WHERE id = ?` | +| `GetNamespaceByIdentifier(ident)` | Identifier unique index | memdb: `txn.First("namespaces","identifier",ident)` / ScyllaDB: secondary index | +| `ListNamespaces()` | Full scan | memdb: `txn.Get("namespaces","id")` / ScyllaDB: `SELECT … FROM namespaces` | +| `DeleteNamespace(id)` | Primary key (write) | Existence check first; then delete by `id` | diff --git a/specs/009-api-namespaces/plan.md b/specs/009-api-namespaces/plan.md new file mode 100644 index 0000000..eece106 --- /dev/null +++ b/specs/009-api-namespaces/plan.md @@ -0,0 +1,101 @@ +# Implementation Plan: API-Driven Namespace Lifecycle Management + +**Branch**: `009-api-namespaces` | **Date**: 2026-05-15 | **Spec**: [spec.md](spec.md) +**Input**: Feature specification from `/specs/009-api-namespaces/spec.md` + +**Note**: This plan was filled in by the `/speckit.plan` command. + +## Summary + +Introduce namespace lifecycle management (create, list, get, delete) to `gitstore-api` via GraphQL, backed by the existing datastore abstraction from feature 006. Namespaces are globally-unique isolation boundaries with three tiers (user, organisation, enterprise). Authorization uses the existing `IsAdmin` JWT claim as the "elevated platform role". No changes to `gitstore-git-service`. + +## Technical Context + +**Language/Version**: Go 1.25 (`gitstore-api`) +**Primary Dependencies**: `gqlgen v0.17.90`, `go-memdb v1.3.5`, `gocqlx/v3 v3.0.4` (ScyllaDB), `go-playground/validator/v10`, `go.uber.org/zap`, `google/uuid` +**Storage**: `go-memdb` (development / in-memory backend) / ScyllaDB 5.x+ (production backend) — via the `datastore.Datastore` interface from feature 006 +**Testing**: `go test`, `testify/assert`, `testcontainers-go` (ScyllaDB contract tests) +**Target Platform**: Linux server +**Project Type**: Web service (GraphQL API) +**Performance Goals**: Namespace create/list/get in < 1s under normal load (SC-001); 100% deterministic conflict and success responses (SC-002, SC-004) +**Constraints**: No changes to `gitstore-git-service` (FR-011); namespace logic lives exclusively in `gitstore-api` +**Scale/Scope**: Initial platform setup — namespace count in the hundreds; no pagination needed for list in this spec + +## Constitution Check + +*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.* + +| Principle | Status | Notes | +|-----------------------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------| +| I. Test-First Development | ✅ PASS | Integration tests specified in FR-012; acceptance scenarios drive test-first task ordering | +| II. API-First Design | ✅ PASS | GraphQL contract (`namespace.graphql`) defined before implementation; datastore interface extended before backend code | +| III. Clear Contracts & Versioning | ✅ PASS | GraphQL schema is additive (new types/fields only); no breaking changes to existing schema; datastore interface extended | +| IV. Observability | ✅ PASS | `InstrumentedDatastore` wrapper automatically covers namespace operations once interface is extended; resolver errors logged via zap | +| V. User Story Driven | ✅ PASS | Three user stories (create, list/get, delete) with P1/P2/P3 priority and independent test criteria | +| VI. Incremental Delivery | ✅ PASS | P1 (create) delivers immediate value; P2 (list/get) and P3 (delete) are independently deployable | +| VII. Simplicity | ✅ PASS | No new IAM system; reuses `IsAdmin` as elevated role; no new framework dependencies; deletion guard is a stub pending the repository spec | + +**Post-design re-check** (after Phase 1): +- API contract defined in `contracts/namespace.graphql` before implementation ✅ +- Data model defined in `data-model.md` with all validation rules ✅ +- No new dependencies introduced ✅ +- Complexity justified: `parentEnterpriseIdentifier` lookup on create adds one extra datastore read; justified by FR-001 and spec clarification Q5 ✅ + +## Project Structure + +### Documentation (this feature) + +```text +specs/009-api-namespaces/ +├── plan.md # This file (/speckit.plan command output) +├── research.md # Phase 0 output (/speckit.plan command) +├── data-model.md # Phase 1 output (/speckit.plan command) +├── quickstart.md # Phase 1 output (/speckit.plan command) +├── contracts/ +│ ├── namespace.graphql # GraphQL schema contract (Phase 1) +│ └── datastore-extension.go # Datastore interface extension (Phase 1) +└── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan) +``` + +### Source Code (repository root) + +```text +shared/schemas/ +├── schema.graphqls # MODIFY: add namespace queries/mutations to Query + Mutation roots +└── namespace.graphqls # CREATE: Namespace type, NamespaceTier enum, inputs, payloads + +gitstore-api/ +├── internal/ +│ ├── datastore/ +│ │ ├── entities.go # ADD: Namespace struct, NamespaceTier type +│ │ ├── datastore.go # EXTEND: add 5 namespace methods to Datastore interface +│ │ ├── instrumented.go # EXTEND: add instrumented wrappers for 5 namespace methods +│ │ ├── memdb/ +│ │ │ ├── schema.go # EXTEND: add "namespaces" table schema +│ │ │ └── backend.go # EXTEND: implement 5 namespace methods +│ │ └── scylla/ +│ │ ├── backend.go # EXTEND: implement 5 namespace methods + namespaceRow struct +│ │ └── migrations/ +│ │ └── 002_namespaces.cql # CREATE: namespaces table + identifier index +│ ├── graph/ +│ │ ├── namespace.resolvers.go # CREATE (gqlgen-generated stub, then implemented) +│ │ ├── service.go # EXTEND: add NamespaceService methods +│ │ └── model/ +│ │ └── models_gen.go # AUTO-GENERATED by gqlgen (do not edit manually) +│ └── graph/generated/ +│ └── generated.go # AUTO-GENERATED by gqlgen (do not edit manually) +└── tests/ + └── contract/ + ├── datastore/ + │ ├── contract_test.go # EXTEND: add namespace contract tests + │ ├── memdb_test.go # EXTEND: namespace memdb tests + │ └── scylla_test.go # EXTEND: namespace scylla tests + └── graphql/ # CREATE: namespace GraphQL integration tests + └── namespace_test.go +``` + +**Structure Decision**: Single-service extension. All changes are within `gitstore-api`. The `shared/schemas/` directory holds the GraphQL schema files consumed by gqlgen — a new `namespace.graphqls` is added there and the roots in `schema.graphqls` are extended. `gitstore-git-service` is untouched (FR-011). + +## Complexity Tracking + +No constitution violations. The only non-trivial complexity is the `parentEnterpriseIdentifier` lookup on create (an extra datastore read to resolve identifier → ID), which is justified by FR-001 and the spec clarification that parent enterprise is declared at creation time. diff --git a/specs/009-api-namespaces/quickstart.md b/specs/009-api-namespaces/quickstart.md new file mode 100644 index 0000000..1be3986 --- /dev/null +++ b/specs/009-api-namespaces/quickstart.md @@ -0,0 +1,228 @@ +# Quickstart: API-Driven Namespace Lifecycle Management + +**Feature**: `009-api-namespaces` | **Date**: 2026-05-15 + +This guide shows how to run the namespace API locally and exercise the key operations. + +--- + +## Prerequisites + +- Go 1.25 installed +- `gitstore-git-service` running (or `GITSTORE_GIT_GRPC_URI` pointing to a reachable instance; namespace operations do not require git-service, but the server startup will fail if it cannot dial) +- No ScyllaDB required for local development — the default backend is `memdb` + +--- + +## Start the API Server + +```bash +cd gitstore-api + +# Copy example config (if not already present) +cp config.example.toml config.toml + +# Generate a bcrypt password hash for the admin user +go run ./cmd/hashpw admin123 + +# Set required env vars (or add to config.toml) +export GITSTORE__AUTH__JWT__SECRET="dev-secret-change-me" +export GITSTORE__AUTH__ADMIN__USERNAME="admin" +export GITSTORE__AUTH__ADMIN__PASSWORD_HASH="" + +# Run the server (memdb backend by default) +go run ./cmd/server +``` + +The server starts at `http://localhost:4000`. The GraphQL Playground is at `http://localhost:4000/playground`. + +--- + +## Authenticate + +Namespace mutations require authentication. Obtain a JWT token: + +```bash +curl -s -X POST http://localhost:4000/api/login \ + -H "Content-Type: application/json" \ + -d '{"username":"admin","password":""}' \ + | jq -r '.token' +``` + +Export the token: + +```bash +export TOKEN="" +``` + +--- + +## Create a User-Space Namespace + +```bash +curl -s -X POST http://localhost:4000/graphql \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -d '{ + "query": "mutation { createNamespace(input: { identifier: \"alice\", tier: USER }) { namespace { id identifier tier createdAt createdBy } } }" + }' | jq . +``` + +Expected response: +```json +{ + "data": { + "createNamespace": { + "namespace": { + "id": "", + "identifier": "alice", + "tier": "USER", + "createdAt": "2026-05-15T12:00:00Z", + "createdBy": "admin" + } + } + } +} +``` + +--- + +## Create an Organisation Namespace with a Parent Enterprise + +```bash +# 1. Create the enterprise namespace first (requires isAdmin) +curl -s -X POST http://localhost:4000/graphql \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -d '{ + "query": "mutation { createNamespace(input: { identifier: \"acme-enterprise\", tier: ENTERPRISE, displayName: \"Acme Enterprise\" }) { namespace { id identifier tier } } }" + }' | jq . + +# 2. Create the org namespace with the parent enterprise +curl -s -X POST http://localhost:4000/graphql \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -d '{ + "query": "mutation { createNamespace(input: { identifier: \"acme-engineering\", tier: ORGANISATION, parentEnterpriseIdentifier: \"acme-enterprise\" }) { namespace { id identifier tier parentEnterpriseId } } }" + }' | jq . +``` + +--- + +## List All Namespaces + +```bash +curl -s -X POST http://localhost:4000/graphql \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -d '{ + "query": "query { namespaces { id identifier displayName tier createdAt createdBy } }" + }' | jq . +``` + +--- + +## Get a Namespace by Identifier + +```bash +curl -s -X POST http://localhost:4000/graphql \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -d '{ + "query": "query { namespace(identifier: \"alice\") { id identifier tier createdAt createdBy updatedAt updatedBy } }" + }' | jq . +``` + +--- + +## Delete a Namespace + +```bash +curl -s -X POST http://localhost:4000/graphql \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -d '{ + "query": "mutation { deleteNamespace(input: { identifier: \"alice\" }) { deletedIdentifier } }" + }' | jq . +``` + +Expected: +```json +{ + "data": { + "deleteNamespace": { + "deletedIdentifier": "alice" + } + } +} +``` + +--- + +## Error Cases + +### Duplicate identifier (conflict) + +```bash +# Create "alice" twice — second request returns a conflict error +curl -s -X POST http://localhost:4000/graphql \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -d '{"query": "mutation { createNamespace(input: { identifier: \"alice\", tier: USER }) { namespace { id } } }"}' | jq . +# Expected: errors[0].message contains "already exists" +``` + +### Invalid identifier + +```bash +# Identifier with spaces or uppercase +curl -s -X POST http://localhost:4000/graphql \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -d '{"query": "mutation { createNamespace(input: { identifier: \"Invalid Name!\", tier: USER }) { namespace { id } } }"}' | jq . +# Expected: errors[0].message contains "invalid identifier" +``` + +### Enterprise namespace without admin role + +Any authenticated user attempting to create an `ENTERPRISE` tier namespace when `isAdmin == false` receives a permission-denied error. + +### Delete namespace not found + +```bash +curl -s -X POST http://localhost:4000/graphql \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -d '{"query": "mutation { deleteNamespace(input: { identifier: \"unknown-ns\" }) { deletedIdentifier } }"}' | jq . +# Expected: errors[0].message contains "not found" +``` + +--- + +## Run Integration Tests + +```bash +cd gitstore-api +go test -v -run TestNamespace ./tests/contract/... +``` + +The integration tests use the `memdb` backend by default and do not require Docker or ScyllaDB. + +--- + +## Using ScyllaDB Backend (optional) + +```bash +export GITSTORE__DATASTORE__BACKEND="scylla" +export GITSTORE__DATASTORE__SCYLLA__HOSTS="localhost:9042" +export GITSTORE__DATASTORE__SCYLLA__KEYSPACE="gitstore" + +# Start ScyllaDB +docker run -d -p 9042:9042 scylladb/scylla:5.4 + +# Create keyspace (one-time) +docker exec -it cqlsh -e "CREATE KEYSPACE IF NOT EXISTS gitstore WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};" + +# The server applies migrations automatically on startup +go run ./cmd/server +``` diff --git a/specs/009-api-namespaces/research.md b/specs/009-api-namespaces/research.md new file mode 100644 index 0000000..93cd965 --- /dev/null +++ b/specs/009-api-namespaces/research.md @@ -0,0 +1,133 @@ +# Research: API-Driven Namespace Lifecycle Management + +**Feature**: `009-api-namespaces` | **Phase**: 0 | **Date**: 2026-05-15 + +--- + +## Decision 1: API Surface — GraphQL vs REST + +**Decision**: Expose namespace CRUD exclusively as GraphQL mutations and queries. + +**Rationale**: The entire domain API surface is GraphQL. The `gqlgen.yml` uses `follow-schema` layout with `../shared/schemas/*.graphqls` — adding a `namespace.graphqls` file and running `go generate` is the complete tooling cost. The Relay-compliant pattern (Node interface, Connection pagination, Input/Payload mutation shape) is already established for products, categories, and collections. Namespace operations are authenticated — they belong behind the existing context-based auth chain rather than a separate REST route. + +**Alternatives considered**: +- REST handlers at `/api/namespaces`: Simpler for the server, but would split the client contract between two transports. The gitstore-admin frontend already uses GraphQL. No precedent in the project for domain operations via REST (login/refresh are pre-auth flows, deliberately outside GraphQL). +- Mixed (GraphQL queries, REST mutations): No benefit; adds protocol friction with zero upside. + +--- + +## Decision 2: Authorization Strategy for FR-008 + +**Decision**: Use `claims.IsAdmin == true` as the "elevated platform role" for enterprise namespace creation; use `ns.CreatedBy == claims.Username || claims.IsAdmin` for deletion authorization. No changes to `Claims` struct. + +**Rationale**: The JWT `Claims` struct has exactly two application fields: `Username string` and `IsAdmin bool`. `IsAdmin` already IS the "elevated platform role" — no new field is needed. Namespace ownership for deletion is checked at query time against the stored `CreatedBy` field, which is a simple two-condition check in the service layer and avoids embedding mutable ownership state in a stateless signed token. + +**Alternatives considered**: +- Add `PlatformRole` field to Claims: Correct long-term shape if more than two roles are needed, but premature here. `IsAdmin` is semantically equivalent and backward-compatible. +- Add `OwnedNamespaces []string` to Claims: Embeds mutable state into a signed token; a transferred namespace would require re-issuing tokens. Stale-by-design. + +--- + +## Decision 3: Namespace Identifier Uniqueness Enforcement + +**Decision**: Enforce global uniqueness via a unique secondary index on the `identifier` field in both backends. The application layer checks for conflict using `GetNamespaceByIdentifier` before insert. + +**Rationale**: The spec requires global uniqueness across all tiers (FR-003). The same identifier cannot exist as both a user-space and an organisation namespace. A unique index on `identifier` at the storage level provides the enforcement guarantee even under concurrent writes. + +- **memdb**: `StringFieldIndex{Field: "Identifier", Unique: true}` — memdb enforces uniqueness atomically within a write transaction. +- **ScyllaDB**: `CREATE UNIQUE INDEX namespaces_by_identifier ON namespaces (identifier)` — ScyllaDB enforces the constraint. The application also does a read-before-write guard (consistent with the existing category/collection pattern in `scylla/backend.go`). + +**Alternatives considered**: +- Application-only uniqueness check (no storage-level index): Vulnerable to TOCTOU under concurrent requests. The memdb pattern already uses unique indices for SKU and slug; same guarantee here. + +--- + +## Decision 4: ScyllaDB Schema for Namespaces + +**Decision**: Single table `namespaces` with `id` as `text` PRIMARY KEY, `identifier` as a globally-unique secondary index, `tier` as `text`, timestamps as `bigint` (milliseconds, consistent with all other tables using `int64` in row structs). + +**Rationale**: The existing backend stores timestamps as `int64` (milliseconds via `UnixMilli()`). The `tier` field is stored as `text` and validated at the Go layer, consistent with `inventory_status` in the product table. `parent_enterprise_id` is nullable `text` (maps to `*string`). + +**Migration file**: `002_namespaces.cql` (following the `{NNN}_{description}.cql` convention of `001_initial_schema.cql`). + +```sql +CREATE TABLE IF NOT EXISTS namespaces ( + id text PRIMARY KEY, + identifier text, + display_name text, + tier text, + parent_enterprise_id text, + created_at bigint, + created_by text, + updated_at bigint, + updated_by text +); + +CREATE INDEX IF NOT EXISTS namespaces_by_identifier ON namespaces (identifier); +``` + +--- + +## Decision 5: go-memdb Schema for Namespaces + +**Decision**: Three indices — `id` (unique, primary), `identifier` (unique), `tier` (non-unique for future `ListByTier`). + +```go +"namespaces": { + Name: "namespaces", + Indexes: map[string]*memdb.IndexSchema{ + "id": { + Name: "id", + Unique: true, + Indexer: &memdb.StringFieldIndex{Field: "ID"}, + }, + "identifier": { + Name: "identifier", + Unique: true, + Indexer: &memdb.StringFieldIndex{Field: "Identifier"}, + }, + "tier": { + Name: "tier", + Unique: false, + Indexer: &memdb.StringFieldIndex{Field: "Tier"}, + }, + }, +} +``` + +**Rationale**: `id` is required as the primary key by go-memdb. `identifier` unique index enforces FR-003 at the storage level. `tier` index is cheap and enables future `ListByTier` without a full-scan filter. `parent_enterprise_id` is omitted for now — nullable `*string` requires a custom indexer; add when a `ListByEnterprise` query is needed. + +--- + +## Decision 6: Reserved Namespace Identifiers + +**Decision**: The following identifiers are reserved and MUST be rejected by the validation layer (FR-002): + +``` +admin, root, system, default, api, git, www, mail, smtp, ftp, org, orgs, +static, assets, cdn, docs, help, support, billing, status, health, +internal, local, localhost, null, undefined, true, false, new, test, +gitstore, enterprise, org, user, namespace, namespaces, repo, repos +``` + +**Rationale**: Reserved names prevent conflicts with current and future API path segments, system service names, and common CI/CD tool identifiers. The list follows the GitHub and GitLab namespace reservation precedent. + +--- + +## Decision 7: Namespace Identifier Validation Rules (FR-002) + +**Decision**: Identifier MUST match regex `^[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$` OR be a single character `^[a-z0-9]$` (for length-1 identifiers). Simplified: alphanumeric lowercase + hyphens, no leading/trailing hyphen, 1–63 chars. + +**Rationale**: DNS label conventions (RFC 1123). This is a widely understood standard. Case-folding to lowercase is applied before storage (identifiers are stored lowercase). + +**Validation implementation**: `go-playground/validator/v10` is already a dependency. A custom validator tag `namespace_identifier` will be registered, or a simple regex check in the service layer. + +--- + +## Decision 8: Deletion Guard for Repositories + +**Decision**: Implement the deletion guard at the service layer using a `HasRepositories(ctx, namespaceID)` check against the datastore. Since the `repositories` table does not yet exist (scoped to a future spec), this check will be a no-op stub that always returns `false` in this spec, with a `// TODO: enforce when repositories table exists` comment. + +**Rationale**: FR-007 requires blocking deletion when repositories exist. The repository table is out of scope for this spec. The service layer stub ensures the guard is wired and the code path is correct — it will be filled in when the repository spec lands. + +**The stub is not a test bypass**: Integration tests for deletion will test the empty-namespace case (which the stub allows). The blocked-deletion path (repositories exist) will be tested in the repository spec. diff --git a/specs/009-api-namespaces/spec.md b/specs/009-api-namespaces/spec.md new file mode 100644 index 0000000..8b1d909 --- /dev/null +++ b/specs/009-api-namespaces/spec.md @@ -0,0 +1,143 @@ +# Feature Specification: API-Driven Namespace Lifecycle Management + +**Feature Branch**: `009-api-namespaces` +**Created**: 2026-05-15 +**Status**: Closed +**Input**: User description: "GH#39 contains the details for our next spec. At the gitstore-api level we would introduce the concept of namespaces, gitstore-git-service only needs to know about how to write and read from bare repositories. In a future spec, we would add support for defining namespace via Markdown file with YAML (kubernetes style) frontmatter. In the future we would also add support for gitaly inspired hashed storage for git repositories (the current storage is based on repository names that is not ideal for renames)" + +## Clarifications + +### Session 2026-05-15 + +- Q: What is the relationship between namespace tiers? → A: User and organisation namespaces own repositories directly. Enterprise is a meta-layer that organises organisations and does not own repositories directly (mirrors GitHub model). +- Q: What happens when a namespace deletion is attempted while repositories still exist in it? → A: Block deletion; the caller must remove all repositories from the namespace first. +- Q: Who is permitted to create a namespace at each tier? → A: Tier-owner self-service: any authenticated user can create user-space or organisation namespaces; enterprise namespaces require an elevated platform role. +- Q: Is namespace identifier uniqueness global or per-tier? → A: Globally unique across all tiers — the same identifier cannot exist as both a user namespace and an organisation namespace. +- Q: How is enterprise-organisation membership expressed? → A: An organisation namespace may optionally declare a parent enterprise at creation time; reassignment to a different enterprise is out of scope for this spec. +- Q: Where are namespace deletion audit events stored? → A: Out of scope for this spec. A future spec will introduce namespace-as-file storage (Markdown + YAML frontmatter) where git naturally provides the full audit trail for create, update, and delete operations. + +## User Scenarios & Testing *(mandatory)* + +### User Story 1 - Create a Namespace (Priority: P1) + +An authenticated user or platform administrator wants to create a new namespace. For user-space and organisation namespaces, any authenticated user may create one. For enterprise namespaces, only a caller with an elevated platform role may create one. They provide a namespace identifier and tier, and the system validates, persists, and returns the created namespace. + +**Why this priority**: Namespace creation is the foundational capability. Without it, no other namespace-scoped operations (repository creation, listing, deletion) are possible. + +**Independent Test**: Can be fully tested by submitting a create-namespace request and verifying the namespace is returned in subsequent list/get operations with correct metadata. + +**Acceptance Scenarios**: + +1. **Given** no namespace named `acme-corp` exists, **When** a permitted caller creates a namespace with identifier `acme-corp`, **Then** the namespace is persisted with audit fields (`created_at`, `created_by`) and returned with a success response. +2. **Given** a namespace named `acme-corp` already exists (regardless of tier), **When** a caller attempts to create another namespace with the same identifier at any tier, **Then** the system returns a deterministic conflict error. +3. **Given** a caller provides an invalid namespace identifier (e.g., contains spaces, exceeds max length, or uses a reserved name), **When** the create request is submitted, **Then** the system returns a descriptive validation error. + +--- + +### User Story 2 - List and Retrieve Namespaces (Priority: P2) + +A permitted caller wants to list all existing namespaces or retrieve a specific namespace by identifier, so they can inspect what namespaces are provisioned and their metadata. + +**Why this priority**: Listing and retrieval are essential for clients building integrations or administrators verifying the current state of the platform. + +**Independent Test**: Can be tested independently by creating one or more namespaces and verifying the list and get responses return correct identifiers and metadata. + +**Acceptance Scenarios**: + +1. **Given** several namespaces have been created, **When** a caller requests the list of namespaces, **Then** all namespaces are returned with their identifiers and audit metadata. +2. **Given** a namespace with identifier `acme-corp` exists, **When** a caller retrieves it by identifier, **Then** the namespace's full metadata is returned. +3. **Given** no namespace with identifier `unknown-ns` exists, **When** a caller attempts to retrieve it, **Then** the system returns a not-found error. + +--- + +### User Story 3 - Delete a Namespace (Priority: P3) + +An authorised caller wants to delete a namespace that is no longer needed. The deletion must be auditable and must reject unauthorised requests. + +**Why this priority**: Lifecycle completeness requires deletion. However, creation and listing deliver immediate value for teams onboarding, so deletion is lower priority. + +**Independent Test**: Can be tested by creating a namespace, deleting it, and verifying it no longer appears in list or get responses. + +**Acceptance Scenarios**: + +1. **Given** a namespace `acme-corp` exists with no repositories and the caller is authorised, **When** the caller requests deletion of `acme-corp`, **Then** the namespace is permanently removed. +2. **Given** a namespace `acme-corp` exists with one or more repositories, **When** an authorised caller attempts to delete it, **Then** the system returns an error listing the blocking repositories and the namespace remains intact. +3. **Given** a namespace `acme-corp` exists, **When** an unauthorised caller attempts to delete it, **Then** the system returns a permission-denied error and leaves the namespace intact. +4. **Given** namespace `unknown-ns` does not exist, **When** a caller attempts to delete it, **Then** the system returns a not-found error. + +--- + +### Edge Cases + +- What happens when a namespace identifier matches a reserved word (e.g., `admin`, `root`, `system`, `default`)? +- How does the system handle concurrent create requests for the same namespace identifier? +- What happens when a caller attempts to create a namespace with an identifier exceeding the maximum allowed length? +- How does the system respond when listing namespaces and none exist yet? +- Namespace deletion is blocked if any repositories exist within it; the caller receives a descriptive error indicating which repositories must be removed first. + +## Requirements *(mandatory)* + +### Functional Requirements + +- **FR-001**: System MUST allow permitted callers to create a namespace by providing a unique identifier, tier, optional display name, and (for organisation tier only) an optional parent enterprise identifier set at creation time. +- **FR-002**: System MUST validate namespace identifiers for format (alphanumeric with hyphens allowed, no spaces), minimum length of 1, maximum length of 63 characters, and must not be a reserved name. +- **FR-003**: System MUST enforce namespace identifier uniqueness globally across all tiers — the same identifier MUST NOT exist as both a user-space and an organisation namespace. Duplicate create requests MUST return a deterministic conflict response. +- **FR-004**: System MUST persist audit fields for each namespace: `created_at`, `created_by`, `updated_at`, `updated_by`. +- **FR-005**: System MUST allow permitted callers to list all namespaces with their identifiers and audit metadata. +- **FR-006**: System MUST allow permitted callers to retrieve a single namespace by its identifier. +- **FR-007**: System MUST allow authorised callers to delete a namespace. Deletion MUST be blocked if any repositories still exist within the namespace; the system MUST return a descriptive error identifying the blocking repositories. +- **FR-008**: System MUST enforce tier-scoped authorisation for namespace creation: any authenticated user MAY create user-space or organisation namespaces; only callers with an elevated platform role MAY create enterprise namespaces. Deletion of any namespace requires the same elevated role or namespace ownership. +- **FR-009**: System MUST support three namespace tiers with distinct roles: user-space (owns repositories directly), organisation (owns repositories directly), and enterprise (organises organisations, does not own repositories directly). +- **FR-010**: System MUST ensure namespaces provide full repository isolation — repositories in one namespace are not accessible via another namespace's context. +- **FR-011**: `gitstore-git-service` MUST expose only bare repository read/write capabilities; namespace logic MUST reside exclusively in `gitstore-api`. +- **FR-012**: Integration tests MUST cover create, duplicate-create, list, get, delete, and invalid-input scenarios. +- **FR-013**: API contract for namespace operations MUST be documented with request/response examples in `docs/`. + +### Key Entities + +- **Namespace**: The primary isolation boundary. Attributes: unique identifier (globally unique across all tiers), display name (optional), tier (user/org/enterprise), parent enterprise identifier (optional, applies to organisation tier only, set at creation time), `created_at`, `created_by`, `updated_at`, `updated_by`. +- **Namespace Tier**: Enumeration of `user`, `organisation`, `enterprise`. User and organisation namespaces own repositories directly. Enterprise namespaces organise organisations and do not own repositories directly. +- **Audit Event**: Out of scope for this spec. A future spec introducing namespace-as-file storage (Markdown + YAML frontmatter) will leverage git history as the audit trail for namespace lifecycle events. + +## Success Criteria *(mandatory)* + +### Measurable Outcomes + +- **SC-001**: A permitted caller can create a new namespace in under 1 second under normal load. +- **SC-002**: Duplicate create requests consistently return a conflict response (100% deterministic, not flaky). +- **SC-003**: Namespace list and get operations return accurate results for all existing namespaces with no omissions. +- **SC-004**: Namespace deletion consistently returns success when the namespace is empty and the caller is authorised (100% deterministic). +- **SC-005**: Unauthorised callers are rejected 100% of the time for create and delete operations. +- **SC-006**: Integration test suite achieves full coverage of the acceptance scenarios defined in this spec, running to completion in under 2 minutes. + +## Scope & Boundaries + +**In scope**: +- Namespace create, list, get, and delete via API. +- Namespace identifier validation (format, uniqueness, reserved names). +- Three namespace tiers: user, organisation, enterprise. +- Audit fields on namespace records. +- Simple authorisation enforcement for create/delete. +- Integration tests and API documentation. + +**Out of scope (future specs)**: +- Declarative namespace creation via Markdown files with YAML frontmatter (tracked in GH#40). +- Gitaly-inspired hashed storage for bare repositories (current name-based storage is unchanged in this spec). +- Cross-namespace repository sharing or federation. +- Reassignment of an organisation namespace from one enterprise to another. +- Namespace deletion auditing (deferred to a future spec that will leverage git history once namespace-as-file storage is introduced). +- Full enterprise IAM integration beyond current authorisation capabilities (tracked in GH#44, #45, #50). +- UI workflows for namespace management. + +## Assumptions + +- The current authorisation model in `gitstore-api` is sufficient to express "permitted to create/delete namespaces" without requiring a new IAM subsystem. +- Namespace identifiers follow DNS label conventions (alphanumeric + hyphens, max 63 chars) — a widely understood standard requiring no additional specification. +- `gitstore-git-service` already supports bare repository read/write; no changes to its storage layout are required by this spec. +- The datastore abstraction introduced in feature 006 is available and supports the persistence of namespace records. + +## Dependencies + +- Feature `006-api-datastore-abstraction`: datastore layer in `gitstore-api` for persisting namespace records. +- GH#39 (Initiative: Namespaces) and GH#119 (API-Driven Namespace Creation and Lifecycle) — parent initiative. +- GH#67 — supported by this feature (repository creation scoped to a namespace). diff --git a/specs/009-api-namespaces/tasks.md b/specs/009-api-namespaces/tasks.md new file mode 100644 index 0000000..2c5ab96 --- /dev/null +++ b/specs/009-api-namespaces/tasks.md @@ -0,0 +1,202 @@ +# Tasks: API-Driven Namespace Lifecycle Management + +**Input**: Design documents from `/specs/009-api-namespaces/` +**Branch**: `009-api-namespaces` + +**Tests**: Test-First Development (Constitution Principle I — NON-NEGOTIABLE). Test tasks within each story MUST be written before implementation tasks and verified to fail before proceeding. + +**Organization**: Tasks are grouped by user story to enable independent implementation and testing. + +## Format: `[ID] [P?] [Story] Description` + +- **[P]**: Can run in parallel (different files, no dependencies on incomplete tasks) +- **[Story]**: Which user story this task belongs to (US1, US2, US3) +- Exact file paths are given in each task description + +## Key decisions (from research.md) + +- GraphQL schema uses `extend type Query` / `extend type Mutation` — do NOT modify `schema.graphqls` +- Schema files use `.graphqls` extension (see `gqlgen.yml`) +- ScyllaDB: modify existing `001_initial_schema.cql` — no new migration file (early alpha, no backwards-compat guarantee) +- Auth: `IsAdmin` is the elevated platform role; ownership checked via `CreatedBy` at query time — no changes to `Claims` struct +- Deletion guard for repositories is a no-op stub (repository table does not exist yet) + +--- + +## Phase 1: Setup + +**Purpose**: Create the GraphQL schema contract and regenerate gqlgen code; polish the existing auth resolver. + +- [X] T001 Create `shared/schemas/namespace.graphqls` with `NamespaceTier` enum, `Namespace` type (implementing `Node`), `CreateNamespaceInput`, `DeleteNamespaceInput`, `CreateNamespacePayload`, `DeleteNamespacePayload`, and `extend type Query` / `extend type Mutation` entries (do NOT touch `schema.graphqls`; follow the `auth.graphqls` `extend type` pattern) +- [X] T002 Run `cd gitstore-api && go generate ./...` to regenerate `internal/graph/generated/generated.go`, `internal/graph/model/models_gen.go`, and the `namespace.resolvers.go` resolver stub +- [X] T003 [P] Polish `gitstore-api/internal/graph/auth.resolvers.go`: replace the naive implementation with proper structured logging (`r.logger`), `gqlerror.Errorf` error responses, correct sentinel-error mapping (`ErrNotFound` → not-found, `ErrInvalidCredentials` → unauthenticated), and remove any `panic` stubs — consistent with the `handler.NewLoginHandler` pattern in `internal/handler/login.go` + +**Checkpoint**: GraphQL schema is defined; gqlgen artifacts reflect the new types; auth resolver is production-quality. + +--- + +## Phase 2: Foundational (Blocking Prerequisites) + +**Purpose**: Persistence layer support for namespaces — must be complete before any user story can be implemented. + +**⚠️ CRITICAL**: No user story work can begin until this phase is complete. + +- [X] T004 [P] Add `NamespaceTier` type and constants (`user`, `organisation`, `enterprise`) plus the `Namespace` struct (all fields from `data-model.md`) to `gitstore-api/internal/datastore/entities.go` +- [X] T005 Extend the `Datastore` interface in `gitstore-api/internal/datastore/datastore.go` with five namespace methods: `CreateNamespace`, `GetNamespace`, `GetNamespaceByIdentifier`, `ListNamespaces`, `DeleteNamespace` — following the existing error contract (`ErrNotFound`, `ErrAlreadyExists`, `ErrInvalidArgument`) +- [X] T006 [P] Add the namespaces table and identifier index to `gitstore-api/internal/datastore/scylla/migrations/001_initial_schema.cql` (append after the collections index block — no new migration file): `CREATE TABLE IF NOT EXISTS namespaces` with columns `id text PRIMARY KEY`, `identifier text`, `display_name text`, `tier text`, `parent_enterprise_id text`, `created_at timestamp`, `created_by text`, `updated_at timestamp`, `updated_by text`; and `CREATE INDEX IF NOT EXISTS namespaces_by_identifier ON namespaces (identifier)` +- [X] T007 Add the `"namespaces"` table to the memdb `DBSchema` in `gitstore-api/internal/datastore/memdb/schema.go` with three indices: `id` (unique, `StringFieldIndex{Field: "ID"}`), `identifier` (unique, `StringFieldIndex{Field: "Identifier"}`), `tier` (non-unique, `StringFieldIndex{Field: "Tier"}`) +- [X] T008 Implement `CreateNamespace`, `GetNamespace`, `GetNamespaceByIdentifier`, `ListNamespaces`, `DeleteNamespace` on `memdbDatastore` in `gitstore-api/internal/datastore/memdb/backend.go` — follow the existing `CreateCategory`/`GetCategoryBySlug`/`ListCategories`/`DeleteCategory` pattern; `CreateNamespace` must check both `id` and `identifier` uniqueness within the same write transaction +- [X] T009 Add `namespaceRow` struct with `db:""` tags, `namespaceTable *table.Table` field to `scyllaDatastore`, initialize the table in `New()`, and implement `CreateNamespace`, `GetNamespace`, `GetNamespaceByIdentifier`, `ListNamespaces`, `DeleteNamespace` in `gitstore-api/internal/datastore/scylla/backend.go` — follow the `CreateCategory`/`GetCategoryBySlug`/`ListCategories`/`DeleteCategory` pattern; timestamps use `time.Time` in the struct mapped to `timestamp` columns via gocqlx +- [X] T010 Add five namespace wrapper methods (`CreateNamespace`, `GetNamespace`, `GetNamespaceByIdentifier`, `ListNamespaces`, `DeleteNamespace`) to `InstrumentedDatastore` in `gitstore-api/internal/datastore/instrumented.go` — each method records latency and error count via `d.observe(opName, start, err)`, identical in structure to the existing category wrappers + +**Checkpoint**: `go build ./...` passes in `gitstore-api/`; all existing tests still pass; namespace interface is fully implemented in both backends. + +--- + +## Phase 3: User Story 1 — Create a Namespace (Priority: P1) 🎯 MVP + +**Goal**: A permitted caller can create a namespace; duplicate and invalid-identifier requests are rejected deterministically; enterprise creation is gated on `isAdmin`. + +**Independent Test**: Submit a `createNamespace` mutation and verify the response contains `id`, `identifier`, `tier`, `createdAt`, `createdBy`; verify a second call with the same identifier returns a conflict error. + +### Tests for User Story 1 ⚠️ Write FIRST — verify they FAIL before T013 + +- [X] T011 [P] [US1] Extend `gitstore-api/tests/contract/datastore/contract_test.go` with namespace datastore contract tests: `TestCreateNamespace_success`, `TestCreateNamespace_duplicateIdentifier` (returns `ErrAlreadyExists`), `TestCreateNamespace_acrossAllTiers` (same identifier conflicts regardless of tier), `TestGetNamespaceByIdentifier_notFound` +- [X] T012 [P] [US1] Create `gitstore-api/internal/graph/namespace_service_test.go` with GraphQL-level integration tests for `createNamespace`: success (user tier), success (org tier), conflict (duplicate identifier), invalid identifier format (spaces, uppercase, leading hyphen), reserved identifier (`admin`), enterprise tier without `isAdmin` returns permission-denied + +### Implementation for User Story 1 + +- [X] T013 [US1] Add `CreateNamespace(ctx, input, callerUsername, isAdmin)` to `gitstore-api/internal/graph/service.go`: lowercase + validate identifier against regex `^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$`, check reserved names list (from `research.md`), enforce enterprise-tier-requires-admin gate, resolve `parentEnterpriseIdentifier` → `ParentEnterpriseID` via `GetNamespaceByIdentifier`, set `CreatedAt`/`CreatedBy`/`UpdatedAt`/`UpdatedBy`, call `store.CreateNamespace`; map `ErrAlreadyExists` → GraphQL conflict error, `ErrInvalidArgument` → validation error +- [X] T014 [US1] Implement the `createNamespace` mutation resolver body in `gitstore-api/internal/graph/namespace.resolvers.go`: extract `claims` from context via `middleware.GetUserFromContext`, require authentication (`claims == nil` → unauthenticated error), call `r.service.CreateNamespace`, return `CreateNamespacePayload{Namespace: model}` +- [X] T015 [P] [US1] Add `datastoreNamespaceToModel(ns *datastore.Namespace) *model.Namespace` converter to `gitstore-api/internal/graph/converters.go` mapping all fields including `Tier` (`NamespaceTier` string → `model.NamespaceTier` enum) and `ParentEnterpriseID` (`*string` → `*string`) + +**Checkpoint**: `createNamespace` mutation works end-to-end; all T011/T012 tests pass; User Story 1 is independently testable via quickstart.md. + +--- + +## Phase 4: User Story 2 — List and Retrieve Namespaces (Priority: P2) + +**Goal**: A caller can list all namespaces and retrieve one by identifier; not-found is returned deterministically. + +**Independent Test**: Create two namespaces, call `namespaces` query, verify both appear; call `namespace(identifier: "...")` query, verify full metadata is returned; call `namespace(identifier: "unknown-ns")`, verify not-found error. + +### Tests for User Story 2 ⚠️ Write FIRST — verify they FAIL before T018 + +- [X] T016 [P] [US2] Extend `gitstore-api/tests/contract/datastore/contract_test.go` with `TestListNamespaces_empty`, `TestListNamespaces_multiple`, `TestGetNamespace_byID_success`, `TestGetNamespaceByIdentifier_success`, `TestGetNamespaceByIdentifier_notFound` +- [X] T017 [P] [US2] Add `namespaces` query and `namespace(identifier)` query integration tests to `gitstore-api/internal/graph/namespace_service_test.go`: list returns all created namespaces, get by identifier returns correct metadata, get unknown identifier returns not-found error + +### Implementation for User Story 2 + +- [X] T018 [US2] Add `GetNamespaceByIdentifier(ctx, identifier)`, `GetNamespaceByID(ctx, id)`, and `ListNamespaces(ctx)` service methods to `gitstore-api/internal/graph/service.go` — map `ErrNotFound` to GraphQL not-found error; log `zap.String("identifier", ...)` on not-found +- [X] T019 [US2] Implement `namespace`, `namespaceById`, and `namespaces` query resolver bodies in `gitstore-api/internal/graph/namespace.resolvers.go` — all three are unauthenticated reads (no auth gate needed per spec); call respective service methods; return `nil, gqlerror` on not-found + +**Checkpoint**: All three query resolvers work; T016/T017 tests pass; User Stories 1 and 2 are independently functional. + +--- + +## Phase 5: User Story 3 — Delete a Namespace (Priority: P3) + +**Goal**: An authorised caller can delete an empty namespace; deletion is blocked when repositories exist; unauthorised callers are rejected; not-found is returned for non-existent namespaces. + +**Independent Test**: Create a namespace, delete it (authorised caller), verify it no longer appears in list; attempt delete as non-owner/non-admin, verify permission-denied; attempt delete of non-existent namespace, verify not-found. + +### Tests for User Story 3 ⚠️ Write FIRST — verify they FAIL before T022 + +- [X] T020 [P] [US3] Extend `gitstore-api/tests/contract/datastore/contract_test.go` with `TestDeleteNamespace_success`, `TestDeleteNamespace_notFound` (returns `ErrNotFound`), `TestDeleteNamespace_thenGetReturnsNotFound` +- [X] T021 [P] [US3] Add `deleteNamespace` mutation integration tests to `gitstore-api/internal/graph/namespace_service_test.go`: owner can delete own namespace, admin can delete any namespace, non-owner non-admin gets permission-denied, unknown identifier gets not-found, unauthenticated caller gets unauthenticated error + +### Implementation for User Story 3 + +- [X] T022 [US3] Add `DeleteNamespace(ctx, identifier, callerUsername, isAdmin)` service method to `gitstore-api/internal/graph/service.go`: look up namespace by identifier (not-found → error), check ownership (`ns.CreatedBy == callerUsername || isAdmin` — else permission-denied), call `hasRepositories` stub (always returns `false`; comment `// TODO: enforce when repositories table exists`), call `store.DeleteNamespace`; map errors appropriately +- [X] T023 [US3] Implement the `deleteNamespace` mutation resolver body in `gitstore-api/internal/graph/namespace.resolvers.go`: require authentication, call `r.service.DeleteNamespace`, return `DeleteNamespacePayload{DeletedIdentifier: input.Identifier}` + +**Checkpoint**: All three user stories are functional; T020/T021 tests pass; `deleteNamespace` works end-to-end. + +--- + +## Phase 6: Polish & Cross-Cutting Concerns + +- [X] T024 [P] Update `docs/architecture.md` with a namespace lifecycle management section: three tiers, global identifier uniqueness, auth model (`IsAdmin` as elevated role), `gitstore-git-service` boundary (FR-011), and `curl` / GraphQL Playground examples referencing `quickstart.md` +- [X] T025 [P] Verify SPDX license headers on all new files (`shared/schemas/namespace.graphqls`, new Go files): run `./scripts/check-go-license-headers.sh --diff-base origin/main` and `./scripts/check-js-license-headers.sh --diff-base origin/main`; add missing `// SPDX-License-Identifier: AGPL-3.0-or-later` headers +- [X] T026 Run full pre-PR validation in `gitstore-api/`: `go vet ./...`, `staticcheck ./...`, `go build -v ./...`, `go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...`; fix any failures before opening the PR + +--- + +## Dependencies & Execution Order + +### Phase Dependencies + +- **Phase 1 (Setup)**: No prerequisites — start immediately; T003 is fully independent of T001/T002 +- **Phase 2 (Foundational)**: Requires T001 and T002 complete; T004 and T006 can run in parallel; T005 requires T004; T007–T010 require T005 +- **User Story Phases (3–5)**: All require Phase 2 complete; stories can then proceed in sequence (P1 → P2 → P3) or in parallel by different developers +- **Phase 6 (Polish)**: Requires all desired stories complete + +### User Story Dependencies + +- **US1 (P1)**: Requires Phase 2 — no other story dependency +- **US2 (P2)**: Requires Phase 2 — no dependency on US1 (reads are independent of create at the datastore level; but testing US2 in isolation requires a created namespace, so implement US1 first for practical reasons) +- **US3 (P3)**: Requires Phase 2 — deletion test requires a namespace to exist, so US1 must be complete first + +### Within Each User Story + +1. Test tasks (T01x, T01x) MUST be written and verified to FAIL +2. Converter (T015) can be written in parallel with service (T013) +3. Service (T013) must complete before resolver (T014) +4. All tasks within a story complete before moving to next priority + +--- + +## Parallel Opportunities + +``` +Phase 1: + T001 (schema) → T002 (generate) [sequential — generate reads schema] + T003 (auth polish) [fully independent, any time] + +Phase 2: + T004 (entities.go) ─────────────────────────────────────────────────────┐ + T006 (migration) [parallel with T004] │ + → T005 (interface) → T007 (memdb schema) │ + → T008 (memdb backend) │ + → T009 (scylla backend) │ + → T010 (instrumented) ────────────┘ + +Phase 3 (US1): + T011 (datastore tests) [parallel] + T012 (GraphQL tests) [parallel] + T015 (converter) [parallel with T013] + T013 (service) → T014 (resolver) +``` + +--- + +## Implementation Strategy + +### MVP First (User Story 1 Only) + +1. Complete Phase 1 (T001–T003) +2. Complete Phase 2 (T004–T010) — BLOCKS all stories +3. Complete Phase 3 (T011–T015) +4. **STOP and VALIDATE**: run `go test ./...`; exercise `createNamespace` via playground +5. Ship if ready; continue to US2/US3 on next iteration + +### Incremental Delivery + +1. Phase 1 + Phase 2 → persistence foundation ready +2. Phase 3 (US1: create) → **MVP** — namespaces can be created +3. Phase 4 (US2: list/get) → operational visibility — admins can inspect namespaces +4. Phase 5 (US3: delete) → full lifecycle complete +5. Phase 6 → polish and documentation + +Each story adds measurable value and does not break previous stories. + +--- + +## Notes + +- `[P]` tasks operate on different files with no incomplete-task dependencies — safe to run in parallel +- `[Story]` label maps task to its user story for traceability and independent testing +- The `gqlgen`-generated `namespace.resolvers.go` will contain panic stubs after T002; do not edit it manually before implementing — gqlgen will overwrite it on the next `go generate` +- After T002, the file `gitstore-api/internal/graph/namespace.resolvers.go` will contain auto-generated stubs; implement the resolver bodies in that file without regenerating (or use `preserve_resolver: true` if re-running gqlgen mid-implementation) +- ScyllaDB contract tests (in `scylla_test.go`) require Docker via testcontainers; they run automatically if `SCYLLA_TEST=1` is set; memdb tests run without Docker +- The deletion guard for repositories (`hasRepositories` stub) must remain as a no-op in this spec; do NOT implement it — it will be filled when the repository spec lands