From e5471f37d65f25304d8a1d201c14146adad27cde Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Mon, 29 Apr 2024 10:07:12 +0530 Subject: [PATCH 1/5] :sparkles: Initial Implementation of Notifications and Alers --- apps/comms/Taskfile.yml | 27 + apps/comms/internal/app/app.go | 103 +- apps/comms/internal/app/gqlgen.yml | 114 + .../app/graph/common-types.resolvers.go | 29 + .../app/graph/generated/federation.go | 35 + .../internal/app/graph/generated/generated.go | 9867 +++++++++++++++++ .../internal/app/graph/model/models_gen.go | 155 + .../app/graph/notification.resolvers.go | 75 + .../app/graph/notificationconf.resolvers.go | 121 + apps/comms/internal/app/graph/resolver.go | 15 + apps/comms/internal/app/graph/schema.graphqls | 15 + .../internal/app/graph/schema.resolvers.go | 90 + .../struct-to-graphql/common-types.graphqls | 60 + .../cursorpagination.graphqls | 23 + .../struct-to-graphql/directives.graphqls | 6 + .../struct-to-graphql/matchfilter.graphqls | 20 + .../struct-to-graphql/notification.graphqls | 25 + .../notificationconf.graphqls | 20 + .../struct-to-graphql/pagination.graphqls | 10 + .../graph/struct-to-graphql/scalars.graphqls | 4 + .../struct-to-graphql/subscription.graphqls | 18 + .../app/graph/subscription.resolvers.go | 69 + apps/comms/internal/app/graph/util.go | 50 + .../internal/app/process-notification.go | 13 + apps/comms/internal/domain/api.go | 32 + apps/comms/internal/domain/context.go | 29 + .../domain/entities/field-constants/gen.go | 5 + .../field-constants/generated_constants.go | 65 + .../generated_constants_notification.go | 33 + .../entities/notification-configuration.go | 47 + .../internal/domain/entities/subscription.go | 40 + apps/comms/internal/domain/main.go | 52 + .../internal/domain/notification-config.go | 82 + apps/comms/internal/domain/notification.go | 77 + apps/comms/internal/domain/subscription.go | 49 + apps/comms/internal/env/env.go | 6 + apps/comms/types/types.go | 66 + apps/iam/internal/domain/domain_test.go | 360 +- common/kafka-topic-name.go | 1 + go.mod | 16 +- go.sum | 38 +- pkg/egob/main.go | 24 + 42 files changed, 11779 insertions(+), 207 deletions(-) create mode 100644 apps/comms/internal/app/gqlgen.yml create mode 100644 apps/comms/internal/app/graph/common-types.resolvers.go create mode 100644 apps/comms/internal/app/graph/generated/federation.go create mode 100644 apps/comms/internal/app/graph/generated/generated.go create mode 100644 apps/comms/internal/app/graph/model/models_gen.go create mode 100644 apps/comms/internal/app/graph/notification.resolvers.go create mode 100644 apps/comms/internal/app/graph/notificationconf.resolvers.go create mode 100644 apps/comms/internal/app/graph/resolver.go create mode 100644 apps/comms/internal/app/graph/schema.graphqls create mode 100644 apps/comms/internal/app/graph/schema.resolvers.go create mode 100644 apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls create mode 100644 apps/comms/internal/app/graph/struct-to-graphql/cursorpagination.graphqls create mode 100644 apps/comms/internal/app/graph/struct-to-graphql/directives.graphqls create mode 100644 apps/comms/internal/app/graph/struct-to-graphql/matchfilter.graphqls create mode 100644 apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls create mode 100644 apps/comms/internal/app/graph/struct-to-graphql/notificationconf.graphqls create mode 100644 apps/comms/internal/app/graph/struct-to-graphql/pagination.graphqls create mode 100644 apps/comms/internal/app/graph/struct-to-graphql/scalars.graphqls create mode 100644 apps/comms/internal/app/graph/struct-to-graphql/subscription.graphqls create mode 100644 apps/comms/internal/app/graph/subscription.resolvers.go create mode 100644 apps/comms/internal/app/graph/util.go create mode 100644 apps/comms/internal/app/process-notification.go create mode 100644 apps/comms/internal/domain/api.go create mode 100644 apps/comms/internal/domain/context.go create mode 100644 apps/comms/internal/domain/entities/field-constants/gen.go create mode 100644 apps/comms/internal/domain/entities/field-constants/generated_constants.go create mode 100644 apps/comms/internal/domain/entities/field-constants/generated_constants_notification.go create mode 100644 apps/comms/internal/domain/entities/notification-configuration.go create mode 100644 apps/comms/internal/domain/entities/subscription.go create mode 100644 apps/comms/internal/domain/main.go create mode 100644 apps/comms/internal/domain/notification-config.go create mode 100644 apps/comms/internal/domain/notification.go create mode 100644 apps/comms/internal/domain/subscription.go create mode 100644 apps/comms/types/types.go create mode 100644 pkg/egob/main.go diff --git a/apps/comms/Taskfile.yml b/apps/comms/Taskfile.yml index 3c9b15f4b..fafa3e2a6 100644 --- a/apps/comms/Taskfile.yml +++ b/apps/comms/Taskfile.yml @@ -7,6 +7,33 @@ vars: app: comms tasks: + gql: + dir: ./internal/app + cmds: + - go run github.com/99designs/gqlgen generate + - gofmt -w -d -r '"errors" -> "github.com/kloudlite/api/pkg/errors"' graph/*.resolvers.go + + k8s-schema: + cmds: + - mkdir -p "./internal/app/_struct-to-graphql" + - go run ../../cmd/struct-to-graphql + --struct github.com/kloudlite/api/apps/comms/internal/domain/entities.NotificationConf + --struct github.com/kloudlite/api/apps/comms/internal/domain/entities.Subscription + --struct github.com/kloudlite/api/apps/comms/types.Notification + --struct github.com/kloudlite/api/pkg/types.Pagination + --struct github.com/kloudlite/api/pkg/repos.MatchFilter + --struct github.com/kloudlite/api/pkg/repos.CursorPagination + > ./internal/app/_struct-to-graphql/main.go + - |+ + pushd ./internal/app/_struct-to-graphql + go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Notification + popd + - rm -rf ./internal/app/_struct-to-graphql + + + gen:constants: + cmds: + - go generate ./internal/domain/entities/field-constants/gen.go run: dotenv: [".secrets/env"] env: diff --git a/apps/comms/internal/app/app.go b/apps/comms/internal/app/app.go index 71b1e6838..821f9f82d 100644 --- a/apps/comms/internal/app/app.go +++ b/apps/comms/internal/app/app.go @@ -1,17 +1,40 @@ package app import ( + "context" "embed" "fmt" - "github.com/kloudlite/api/pkg/errors" "text/template" + "github.com/99designs/gqlgen/graphql" + "github.com/gofiber/fiber/v2" + "github.com/kloudlite/api/constants" + httpServer "github.com/kloudlite/api/pkg/http-server" + "github.com/kloudlite/api/pkg/kv" + + "github.com/kloudlite/api/apps/comms/internal/app/graph" + "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" + "github.com/kloudlite/api/apps/comms/internal/domain" + + "github.com/kloudlite/api/apps/comms/internal/domain/entities" + "github.com/kloudlite/api/apps/comms/internal/env" + "github.com/kloudlite/api/apps/comms/types" + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/pkg/errors" + "github.com/kloudlite/api/pkg/logging" + "github.com/kloudlite/api/pkg/messaging" + msg_nats "github.com/kloudlite/api/pkg/messaging/nats" + "github.com/kloudlite/api/pkg/nats" + "github.com/kloudlite/api/pkg/repos" + "github.com/kloudlite/api/pkg/grpc" "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/comms" "go.uber.org/fx" ) +type NotificationConsumer messaging.Consumer + type CommsGrpcServer grpc.Server type EmailTemplatesDir struct { @@ -57,6 +80,26 @@ func parseTemplate(et EmailTemplatesDir, templateName string, subject string) (* } var Module = fx.Module("app", + repos.NewFxMongoRepo[*entities.NotificationConf]("nconfs", "prj", entities.NotificationConfIndexes), + repos.NewFxMongoRepo[*entities.Subscription]("subscriptions", "prj", entities.SubscriptionIndexes), + repos.NewFxMongoRepo[*types.Notification]("notifications", "prj", entities.SubscriptionIndexes), + + fx.Provide(func(jc *nats.JetstreamClient, ev *env.Env, logger logging.Logger) (NotificationConsumer, error) { + topic := string(common.NotificationTopicName) + consumerName := "ntfy:message" + return msg_nats.NewJetstreamConsumer(context.TODO(), jc, msg_nats.JetstreamConsumerArgs{ + Stream: ev.NotificationNatsStream, + ConsumerConfig: msg_nats.ConsumerConfig{ + Name: consumerName, + Durable: consumerName, + Description: "this consumer reads message from a subject dedicated to errors, that occurred when the resource was applied at the agent", + FilterSubjects: []string{ + topic, + }, + }, + }) + }), + fx.Provide(func(et EmailTemplatesDir) (AccountInviteEmail, error) { return parseTemplate(et, "account-invite", "[Kloudlite] Account Invite") }), @@ -78,4 +121,62 @@ var Module = fx.Module("app", fx.Invoke(func(server CommsGrpcServer, commsServer comms.CommsServer) { comms.RegisterCommsServer(server, commsServer) }), + + fx.Invoke( + func(server httpServer.Server, d domain.Domain, sessionRepo kv.Repo[*common.AuthSession], ev *env.Env) { + gqlConfig := generated.Config{Resolvers: &graph.Resolver{Domain: d, Env: ev}} + + gqlConfig.Directives.IsLoggedInAndVerified = func(ctx context.Context, _ interface{}, next graphql.Resolver) (res interface{}, err error) { + sess := httpServer.GetSession[*common.AuthSession](ctx) + if sess == nil { + return nil, fiber.ErrUnauthorized + } + + if !sess.UserVerified { + return nil, &fiber.Error{ + Code: fiber.StatusForbidden, + Message: "user's email is not verified", + } + } + + return next(context.WithValue(ctx, "user-session", sess)) + } + + gqlConfig.Directives.HasAccount = func(ctx context.Context, _ interface{}, next graphql.Resolver) (res interface{}, err error) { + sess := httpServer.GetSession[*common.AuthSession](ctx) + if sess == nil { + return nil, fiber.ErrUnauthorized + } + m := httpServer.GetHttpCookies(ctx) + klAccount := m[ev.AccountCookieName] + if klAccount == "" { + return nil, errors.Newf("no cookie named %q present in request", ev.AccountCookieName) + } + + nctx := context.WithValue(ctx, "user-session", sess) + nctx = context.WithValue(nctx, "account-name", klAccount) + return next(nctx) + } + + schema := generated.NewExecutableSchema(gqlConfig) + server.SetupGraphqlServer(schema, httpServer.NewReadSessionMiddleware(sessionRepo, constants.CookieName, constants.CacheSessionPrefix)) + }, + ), + + fx.Invoke(func(lf fx.Lifecycle, consumer NotificationConsumer, d domain.Domain, logr logging.Logger) { + lf.Append(fx.Hook{ + OnStart: func(ctx context.Context) error { + go func() { + err := processNotification(ctx, d, consumer, logr) + if err != nil { + logr.Errorf(err, "could not process notifications") + } + }() + return nil + }, + OnStop: func(ctx context.Context) error { + return nil + }, + }) + }), ) diff --git a/apps/comms/internal/app/gqlgen.yml b/apps/comms/internal/app/gqlgen.yml new file mode 100644 index 000000000..b7800e568 --- /dev/null +++ b/apps/comms/internal/app/gqlgen.yml @@ -0,0 +1,114 @@ +# Where are all the schema files located? globs are supported eg src/**/*.graphqls +schema: + - graph/*.graphqls + - graph/struct-to-graphql/*.graphqls + +# Where should the generated server code go? +exec: + filename: graph/generated/generated.go + package: generated + +# Uncomment to enable federation +federation: + filename: graph/generated/federation.go + package: generated + version: 2 + +# Where should any generated models go? +model: + filename: graph/model/models_gen.go + package: model + +# Where should the resolver implementations go? +resolver: + layout: follow-schema + dir: graph + package: graph + +# Optional: turn on use ` + "`" + `gqlgen:"fieldName"` + "`" + ` tags in your models +# struct_tag: json + +# Optional: turn on to use []Thing instead of []*Thing +# omit_slice_element_pointers: false + +# Optional: set to speed up generation time by not performing a final validation pass. +# skip_validation: true + +# gqlgen will search for any type names in the schema in these go packages +# if they match it will use them, otherwise it will generate them. +autobind: + - "github.com/kloudlite/api/pkg/errors" + # - "github.com/kloudlite/api/apps/wireguard/internal/domain/entities" + +# This section declares type mapping between the GraphQL and go type systems +# +# The first line in each type will be used as defaults for resolver arguments and +# modelgen, the others will be allowed when binding to fields. Configure them to +# your liking +skip_mod_tidy: true +skip_validation: true + +models: + Metadata: &metadata-model + model: k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta + MetadataIn: *metadata-model + + ID: + model: + - github.com/kloudlite/api/pkg/repos.ID + + Int: + model: + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + + Json: + model: + - github.com/99designs/gqlgen/graphql.Map + + Subscription: &subscription-model + model: + - github.com/kloudlite/api/apps/comms/internal/domain/entities.Subscription + SubscriptionIn: *subscription-model + + NotificationConf: ¬ification-conf-model + model: + - github.com/kloudlite/api/apps/comms/internal/domain/entities.NotificationConf + NotificationConfIn: *notification-conf-model + + Notification: ¬ification-model + model: + - github.com/kloudlite/api/apps/comms/types.Notification + NotificationIn: *notification-model + + Pagination: &pagination + model: + - github.com/kloudlite/api/pkg/types.Pagination + PaginationIn: *pagination + + + MatchFilter: &match-filter-model + model: github.com/kloudlite/api/pkg/repos.MatchFilter + MatchFilterIn: *match-filter-model + + MatchFilterMatchType: + model: github.com/kloudlite/api/pkg/repos.MatchType + + CursorPagination: &cursor-pagination-model + model: github.com/kloudlite/api/pkg/repos.CursorPagination + CursorPaginationIn: *cursor-pagination-model + + CursorPaginationSortDirection: &cursor-pagination-sort-direction + model: github.com/kloudlite/api/pkg/repos.SortDirection + + Overrides: + model: + - github.com/kloudlite/operator/apis/crds/v1.JsonPatch + OverridesIn: + model: + - github.com/kloudlite/operator/apis/crds/v1.JsonPatch + + Github__com___kloudlite___api___common__CreatedOrUpdatedBy: + model: github.com/kloudlite/api/common.CreatedOrUpdatedBy + diff --git a/apps/comms/internal/app/graph/common-types.resolvers.go b/apps/comms/internal/app/graph/common-types.resolvers.go new file mode 100644 index 000000000..78d98baf0 --- /dev/null +++ b/apps/comms/internal/app/graph/common-types.resolvers.go @@ -0,0 +1,29 @@ +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.45 + +import ( + "context" + "fmt" + + "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" + "github.com/kloudlite/api/common" +) + +// UserID is the resolver for the userId field. +func (r *github__com___kloudlite___api___common__CreatedOrUpdatedByResolver) UserID(ctx context.Context, obj *common.CreatedOrUpdatedBy) (string, error) { + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return string(obj.UserId), nil +} + +// Github__com___kloudlite___api___common__CreatedOrUpdatedBy returns generated.Github__com___kloudlite___api___common__CreatedOrUpdatedByResolver implementation. +func (r *Resolver) Github__com___kloudlite___api___common__CreatedOrUpdatedBy() generated.Github__com___kloudlite___api___common__CreatedOrUpdatedByResolver { + return &github__com___kloudlite___api___common__CreatedOrUpdatedByResolver{r} +} + +type github__com___kloudlite___api___common__CreatedOrUpdatedByResolver struct{ *Resolver } diff --git a/apps/comms/internal/app/graph/generated/federation.go b/apps/comms/internal/app/graph/generated/federation.go new file mode 100644 index 000000000..1116a0266 --- /dev/null +++ b/apps/comms/internal/app/graph/generated/federation.go @@ -0,0 +1,35 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package generated + +import ( + "context" + "errors" + "strings" + + "github.com/99designs/gqlgen/plugin/federation/fedruntime" +) + +var ( + ErrUnknownType = errors.New("unknown type") + ErrTypeNotFound = errors.New("type not found") +) + +func (ec *executionContext) __resolve__service(ctx context.Context) (fedruntime.Service, error) { + if ec.DisableIntrospection { + return fedruntime.Service{}, errors.New("federated introspection disabled") + } + + var sdl []string + + for _, src := range sources { + if src.BuiltIn { + continue + } + sdl = append(sdl, src.Input) + } + + return fedruntime.Service{ + SDL: strings.Join(sdl, "\n"), + }, nil +} diff --git a/apps/comms/internal/app/graph/generated/generated.go b/apps/comms/internal/app/graph/generated/generated.go new file mode 100644 index 000000000..03962e33b --- /dev/null +++ b/apps/comms/internal/app/graph/generated/generated.go @@ -0,0 +1,9867 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package generated + +import ( + "bytes" + "context" + "errors" + "fmt" + "io" + "strconv" + "sync" + "sync/atomic" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + "github.com/99designs/gqlgen/plugin/federation/fedruntime" + "github.com/kloudlite/api/apps/comms/internal/app/graph/model" + "github.com/kloudlite/api/apps/comms/internal/domain/entities" + "github.com/kloudlite/api/apps/comms/types" + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/pkg/repos" + types1 "github.com/kloudlite/api/pkg/types" + gqlparser "github.com/vektah/gqlparser/v2" + "github.com/vektah/gqlparser/v2/ast" +) + +// region ************************** generated!.gotpl ************************** + +// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. +func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { + return &executableSchema{ + schema: cfg.Schema, + resolvers: cfg.Resolvers, + directives: cfg.Directives, + complexity: cfg.Complexity, + } +} + +type Config struct { + Schema *ast.Schema + Resolvers ResolverRoot + Directives DirectiveRoot + Complexity ComplexityRoot +} + +type ResolverRoot interface { + Github__com___kloudlite___api___common__CreatedOrUpdatedBy() Github__com___kloudlite___api___common__CreatedOrUpdatedByResolver + Mutation() MutationResolver + Notification() NotificationResolver + NotificationConf() NotificationConfResolver + Query() QueryResolver + Subscription() SubscriptionResolver + NotificationConfIn() NotificationConfInResolver +} + +type DirectiveRoot struct { + HasAccount func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) + IsLoggedInAndVerified func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) +} + +type ComplexityRoot struct { + CursorPagination struct { + After func(childComplexity int) int + Before func(childComplexity int) int + First func(childComplexity int) int + Last func(childComplexity int) int + OrderBy func(childComplexity int) int + SortDirection func(childComplexity int) int + } + + Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig struct { + Enabled func(childComplexity int) int + MailAddress func(childComplexity int) int + } + + Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig struct { + Enabled func(childComplexity int) int + Webhook func(childComplexity int) int + } + + Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig struct { + Enabled func(childComplexity int) int + } + + Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams struct { + ClusterName func(childComplexity int) int + } + + Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams struct { + EnvName func(childComplexity int) int + } + + Github__com___kloudlite___api___common__CreatedOrUpdatedBy struct { + UserEmail func(childComplexity int) int + UserID func(childComplexity int) int + UserName func(childComplexity int) int + } + + MatchFilter struct { + Array func(childComplexity int) int + Exact func(childComplexity int) int + MatchType func(childComplexity int) int + Regex func(childComplexity int) int + } + + Mutation struct { + CommsMarkNotificationAsRead func(childComplexity int, id repos.ID) int + CommsUpdateNotificationConfig func(childComplexity int, config entities.NotificationConf) int + CommsUpdateSubscriptionConfig func(childComplexity int, config entities.Subscription, id repos.ID) int + } + + Notification struct { + AccountName func(childComplexity int) int + CreationTime func(childComplexity int) int + Id func(childComplexity int) int + MarkedForDeletion func(childComplexity int) int + NotificationClusterParams func(childComplexity int) int + NotificationEnvParams func(childComplexity int) int + NotificationType func(childComplexity int) int + Read func(childComplexity int) int + RecordVersion func(childComplexity int) int + ResourceType func(childComplexity int) int + UpdateTime func(childComplexity int) int + } + + NotificationConf struct { + AccountName func(childComplexity int) int + CreatedBy func(childComplexity int) int + CreationTime func(childComplexity int) int + EmailConfigurations func(childComplexity int) int + Id func(childComplexity int) int + LastUpdatedBy func(childComplexity int) int + MarkedForDeletion func(childComplexity int) int + RecordVersion func(childComplexity int) int + SlackConfigurations func(childComplexity int) int + TelegramConfigurations func(childComplexity int) int + UpdateTime func(childComplexity int) int + } + + NotificationEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + NotificationPaginatedRecords struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int + } + + PageInfo struct { + EndCursor func(childComplexity int) int + HasNextPage func(childComplexity int) int + HasPreviousPage func(childComplexity int) int + StartCursor func(childComplexity int) int + } + + Pagination struct { + Page func(childComplexity int) int + PerPage func(childComplexity int) int + } + + Query struct { + CommsGetNotificationConfig func(childComplexity int) int + CommsGetSubscriptionConfig func(childComplexity int, id repos.ID) int + CommsListNotifications func(childComplexity int, pagination *repos.CursorPagination) int + __resolve__service func(childComplexity int) int + } + + Subscription struct { + AccountName func(childComplexity int) int + CreatedBy func(childComplexity int) int + CreationTime func(childComplexity int) int + Enabled func(childComplexity int) int + ID func(childComplexity int) int + LastUpdatedBy func(childComplexity int) int + MailAddress func(childComplexity int) int + MarkedForDeletion func(childComplexity int) int + RecordVersion func(childComplexity int) int + UpdateTime func(childComplexity int) int + } + + _Service struct { + SDL func(childComplexity int) int + } +} + +type Github__com___kloudlite___api___common__CreatedOrUpdatedByResolver interface { + UserID(ctx context.Context, obj *common.CreatedOrUpdatedBy) (string, error) +} +type MutationResolver interface { + CommsUpdateNotificationConfig(ctx context.Context, config entities.NotificationConf) (*entities.NotificationConf, error) + CommsUpdateSubscriptionConfig(ctx context.Context, config entities.Subscription, id repos.ID) (*entities.Subscription, error) + CommsMarkNotificationAsRead(ctx context.Context, id repos.ID) (*types.Notification, error) +} +type NotificationResolver interface { + CreationTime(ctx context.Context, obj *types.Notification) (string, error) + + NotificationClusterParams(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams, error) + NotificationEnvParams(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams, error) + NotificationType(ctx context.Context, obj *types.Notification) (model.GithubComKloudliteAPIAppsCommsTypesNotificationType, error) + + ResourceType(ctx context.Context, obj *types.Notification) (model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType, error) + UpdateTime(ctx context.Context, obj *types.Notification) (string, error) +} +type NotificationConfResolver interface { + CreationTime(ctx context.Context, obj *entities.NotificationConf) (string, error) + EmailConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig, error) + + SlackConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig, error) + TelegramConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig, error) + UpdateTime(ctx context.Context, obj *entities.NotificationConf) (string, error) +} +type QueryResolver interface { + CommsListNotifications(ctx context.Context, pagination *repos.CursorPagination) (*model.NotificationPaginatedRecords, error) + CommsGetNotificationConfig(ctx context.Context) (*entities.NotificationConf, error) + CommsGetSubscriptionConfig(ctx context.Context, id repos.ID) (*entities.Subscription, error) +} +type SubscriptionResolver interface { + AccountName(ctx context.Context) (<-chan string, error) + CreatedBy(ctx context.Context) (<-chan *common.CreatedOrUpdatedBy, error) + CreationTime(ctx context.Context) (<-chan string, error) + Enabled(ctx context.Context) (<-chan bool, error) + ID(ctx context.Context) (<-chan repos.ID, error) + LastUpdatedBy(ctx context.Context) (<-chan *common.CreatedOrUpdatedBy, error) + MailAddress(ctx context.Context) (<-chan string, error) + MarkedForDeletion(ctx context.Context) (<-chan *bool, error) + RecordVersion(ctx context.Context) (<-chan int, error) + UpdateTime(ctx context.Context) (<-chan string, error) +} + +type NotificationConfInResolver interface { + EmailConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn) error + SlackConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn) error + TelegramConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn) error +} + +type executableSchema struct { + schema *ast.Schema + resolvers ResolverRoot + directives DirectiveRoot + complexity ComplexityRoot +} + +func (e *executableSchema) Schema() *ast.Schema { + if e.schema != nil { + return e.schema + } + return parsedSchema +} + +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + ec := executionContext{nil, e, 0, 0, nil} + _ = ec + switch typeName + "." + field { + + case "CursorPagination.after": + if e.complexity.CursorPagination.After == nil { + break + } + + return e.complexity.CursorPagination.After(childComplexity), true + + case "CursorPagination.before": + if e.complexity.CursorPagination.Before == nil { + break + } + + return e.complexity.CursorPagination.Before(childComplexity), true + + case "CursorPagination.first": + if e.complexity.CursorPagination.First == nil { + break + } + + return e.complexity.CursorPagination.First(childComplexity), true + + case "CursorPagination.last": + if e.complexity.CursorPagination.Last == nil { + break + } + + return e.complexity.CursorPagination.Last(childComplexity), true + + case "CursorPagination.orderBy": + if e.complexity.CursorPagination.OrderBy == nil { + break + } + + return e.complexity.CursorPagination.OrderBy(childComplexity), true + + case "CursorPagination.sortDirection": + if e.complexity.CursorPagination.SortDirection == nil { + break + } + + return e.complexity.CursorPagination.SortDirection(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.enabled": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.Enabled == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.Enabled(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.mailAddress": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.MailAddress == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.MailAddress(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.enabled": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.Enabled == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.Enabled(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.webhook": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.Webhook == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.Webhook(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig.enabled": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig.Enabled == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig.Enabled(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams.clusterName": + if e.complexity.Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams.ClusterName == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams.ClusterName(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams.envName": + if e.complexity.Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams.EnvName == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams.EnvName(childComplexity), true + + case "Github__com___kloudlite___api___common__CreatedOrUpdatedBy.userEmail": + if e.complexity.Github__com___kloudlite___api___common__CreatedOrUpdatedBy.UserEmail == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___common__CreatedOrUpdatedBy.UserEmail(childComplexity), true + + case "Github__com___kloudlite___api___common__CreatedOrUpdatedBy.userId": + if e.complexity.Github__com___kloudlite___api___common__CreatedOrUpdatedBy.UserID == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___common__CreatedOrUpdatedBy.UserID(childComplexity), true + + case "Github__com___kloudlite___api___common__CreatedOrUpdatedBy.userName": + if e.complexity.Github__com___kloudlite___api___common__CreatedOrUpdatedBy.UserName == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___common__CreatedOrUpdatedBy.UserName(childComplexity), true + + case "MatchFilter.array": + if e.complexity.MatchFilter.Array == nil { + break + } + + return e.complexity.MatchFilter.Array(childComplexity), true + + case "MatchFilter.exact": + if e.complexity.MatchFilter.Exact == nil { + break + } + + return e.complexity.MatchFilter.Exact(childComplexity), true + + case "MatchFilter.matchType": + if e.complexity.MatchFilter.MatchType == nil { + break + } + + return e.complexity.MatchFilter.MatchType(childComplexity), true + + case "MatchFilter.regex": + if e.complexity.MatchFilter.Regex == nil { + break + } + + return e.complexity.MatchFilter.Regex(childComplexity), true + + case "Mutation.comms_markNotificationAsRead": + if e.complexity.Mutation.CommsMarkNotificationAsRead == nil { + break + } + + args, err := ec.field_Mutation_comms_markNotificationAsRead_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CommsMarkNotificationAsRead(childComplexity, args["id"].(repos.ID)), true + + case "Mutation.comms_updateNotificationConfig": + if e.complexity.Mutation.CommsUpdateNotificationConfig == nil { + break + } + + args, err := ec.field_Mutation_comms_updateNotificationConfig_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CommsUpdateNotificationConfig(childComplexity, args["config"].(entities.NotificationConf)), true + + case "Mutation.comms_updateSubscriptionConfig": + if e.complexity.Mutation.CommsUpdateSubscriptionConfig == nil { + break + } + + args, err := ec.field_Mutation_comms_updateSubscriptionConfig_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CommsUpdateSubscriptionConfig(childComplexity, args["config"].(entities.Subscription), args["id"].(repos.ID)), true + + case "Notification.accountName": + if e.complexity.Notification.AccountName == nil { + break + } + + return e.complexity.Notification.AccountName(childComplexity), true + + case "Notification.creationTime": + if e.complexity.Notification.CreationTime == nil { + break + } + + return e.complexity.Notification.CreationTime(childComplexity), true + + case "Notification.id": + if e.complexity.Notification.Id == nil { + break + } + + return e.complexity.Notification.Id(childComplexity), true + + case "Notification.markedForDeletion": + if e.complexity.Notification.MarkedForDeletion == nil { + break + } + + return e.complexity.Notification.MarkedForDeletion(childComplexity), true + + case "Notification.notificationClusterParams": + if e.complexity.Notification.NotificationClusterParams == nil { + break + } + + return e.complexity.Notification.NotificationClusterParams(childComplexity), true + + case "Notification.notificationEnvParams": + if e.complexity.Notification.NotificationEnvParams == nil { + break + } + + return e.complexity.Notification.NotificationEnvParams(childComplexity), true + + case "Notification.notificationType": + if e.complexity.Notification.NotificationType == nil { + break + } + + return e.complexity.Notification.NotificationType(childComplexity), true + + case "Notification.read": + if e.complexity.Notification.Read == nil { + break + } + + return e.complexity.Notification.Read(childComplexity), true + + case "Notification.recordVersion": + if e.complexity.Notification.RecordVersion == nil { + break + } + + return e.complexity.Notification.RecordVersion(childComplexity), true + + case "Notification.resourceType": + if e.complexity.Notification.ResourceType == nil { + break + } + + return e.complexity.Notification.ResourceType(childComplexity), true + + case "Notification.updateTime": + if e.complexity.Notification.UpdateTime == nil { + break + } + + return e.complexity.Notification.UpdateTime(childComplexity), true + + case "NotificationConf.accountName": + if e.complexity.NotificationConf.AccountName == nil { + break + } + + return e.complexity.NotificationConf.AccountName(childComplexity), true + + case "NotificationConf.createdBy": + if e.complexity.NotificationConf.CreatedBy == nil { + break + } + + return e.complexity.NotificationConf.CreatedBy(childComplexity), true + + case "NotificationConf.creationTime": + if e.complexity.NotificationConf.CreationTime == nil { + break + } + + return e.complexity.NotificationConf.CreationTime(childComplexity), true + + case "NotificationConf.emailConfigurations": + if e.complexity.NotificationConf.EmailConfigurations == nil { + break + } + + return e.complexity.NotificationConf.EmailConfigurations(childComplexity), true + + case "NotificationConf.id": + if e.complexity.NotificationConf.Id == nil { + break + } + + return e.complexity.NotificationConf.Id(childComplexity), true + + case "NotificationConf.lastUpdatedBy": + if e.complexity.NotificationConf.LastUpdatedBy == nil { + break + } + + return e.complexity.NotificationConf.LastUpdatedBy(childComplexity), true + + case "NotificationConf.markedForDeletion": + if e.complexity.NotificationConf.MarkedForDeletion == nil { + break + } + + return e.complexity.NotificationConf.MarkedForDeletion(childComplexity), true + + case "NotificationConf.recordVersion": + if e.complexity.NotificationConf.RecordVersion == nil { + break + } + + return e.complexity.NotificationConf.RecordVersion(childComplexity), true + + case "NotificationConf.slackConfigurations": + if e.complexity.NotificationConf.SlackConfigurations == nil { + break + } + + return e.complexity.NotificationConf.SlackConfigurations(childComplexity), true + + case "NotificationConf.telegramConfigurations": + if e.complexity.NotificationConf.TelegramConfigurations == nil { + break + } + + return e.complexity.NotificationConf.TelegramConfigurations(childComplexity), true + + case "NotificationConf.updateTime": + if e.complexity.NotificationConf.UpdateTime == nil { + break + } + + return e.complexity.NotificationConf.UpdateTime(childComplexity), true + + case "NotificationEdge.cursor": + if e.complexity.NotificationEdge.Cursor == nil { + break + } + + return e.complexity.NotificationEdge.Cursor(childComplexity), true + + case "NotificationEdge.node": + if e.complexity.NotificationEdge.Node == nil { + break + } + + return e.complexity.NotificationEdge.Node(childComplexity), true + + case "NotificationPaginatedRecords.edges": + if e.complexity.NotificationPaginatedRecords.Edges == nil { + break + } + + return e.complexity.NotificationPaginatedRecords.Edges(childComplexity), true + + case "NotificationPaginatedRecords.pageInfo": + if e.complexity.NotificationPaginatedRecords.PageInfo == nil { + break + } + + return e.complexity.NotificationPaginatedRecords.PageInfo(childComplexity), true + + case "NotificationPaginatedRecords.totalCount": + if e.complexity.NotificationPaginatedRecords.TotalCount == nil { + break + } + + return e.complexity.NotificationPaginatedRecords.TotalCount(childComplexity), true + + case "PageInfo.endCursor": + if e.complexity.PageInfo.EndCursor == nil { + break + } + + return e.complexity.PageInfo.EndCursor(childComplexity), true + + case "PageInfo.hasNextPage": + if e.complexity.PageInfo.HasNextPage == nil { + break + } + + return e.complexity.PageInfo.HasNextPage(childComplexity), true + + case "PageInfo.hasPreviousPage": + if e.complexity.PageInfo.HasPreviousPage == nil { + break + } + + return e.complexity.PageInfo.HasPreviousPage(childComplexity), true + + case "PageInfo.startCursor": + if e.complexity.PageInfo.StartCursor == nil { + break + } + + return e.complexity.PageInfo.StartCursor(childComplexity), true + + case "Pagination.page": + if e.complexity.Pagination.Page == nil { + break + } + + return e.complexity.Pagination.Page(childComplexity), true + + case "Pagination.per_page": + if e.complexity.Pagination.PerPage == nil { + break + } + + return e.complexity.Pagination.PerPage(childComplexity), true + + case "Query.comms_getNotificationConfig": + if e.complexity.Query.CommsGetNotificationConfig == nil { + break + } + + return e.complexity.Query.CommsGetNotificationConfig(childComplexity), true + + case "Query.comms_getSubscriptionConfig": + if e.complexity.Query.CommsGetSubscriptionConfig == nil { + break + } + + args, err := ec.field_Query_comms_getSubscriptionConfig_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.CommsGetSubscriptionConfig(childComplexity, args["id"].(repos.ID)), true + + case "Query.comms_listNotifications": + if e.complexity.Query.CommsListNotifications == nil { + break + } + + args, err := ec.field_Query_comms_listNotifications_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.CommsListNotifications(childComplexity, args["pagination"].(*repos.CursorPagination)), true + + case "Query._service": + if e.complexity.Query.__resolve__service == nil { + break + } + + return e.complexity.Query.__resolve__service(childComplexity), true + + case "Subscription.accountName": + if e.complexity.Subscription.AccountName == nil { + break + } + + return e.complexity.Subscription.AccountName(childComplexity), true + + case "Subscription.createdBy": + if e.complexity.Subscription.CreatedBy == nil { + break + } + + return e.complexity.Subscription.CreatedBy(childComplexity), true + + case "Subscription.creationTime": + if e.complexity.Subscription.CreationTime == nil { + break + } + + return e.complexity.Subscription.CreationTime(childComplexity), true + + case "Subscription.enabled": + if e.complexity.Subscription.Enabled == nil { + break + } + + return e.complexity.Subscription.Enabled(childComplexity), true + + case "Subscription.id": + if e.complexity.Subscription.ID == nil { + break + } + + return e.complexity.Subscription.ID(childComplexity), true + + case "Subscription.lastUpdatedBy": + if e.complexity.Subscription.LastUpdatedBy == nil { + break + } + + return e.complexity.Subscription.LastUpdatedBy(childComplexity), true + + case "Subscription.mailAddress": + if e.complexity.Subscription.MailAddress == nil { + break + } + + return e.complexity.Subscription.MailAddress(childComplexity), true + + case "Subscription.markedForDeletion": + if e.complexity.Subscription.MarkedForDeletion == nil { + break + } + + return e.complexity.Subscription.MarkedForDeletion(childComplexity), true + + case "Subscription.recordVersion": + if e.complexity.Subscription.RecordVersion == nil { + break + } + + return e.complexity.Subscription.RecordVersion(childComplexity), true + + case "Subscription.updateTime": + if e.complexity.Subscription.UpdateTime == nil { + break + } + + return e.complexity.Subscription.UpdateTime(childComplexity), true + + case "_Service.sdl": + if e.complexity._Service.SDL == nil { + break + } + + return e.complexity._Service.SDL(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetOperationContext(ctx) + ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputCursorPaginationIn, + ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn, + ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn, + ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn, + ec.unmarshalInputMatchFilterIn, + ec.unmarshalInputNotificationConfIn, + ec.unmarshalInputPaginationIn, + ec.unmarshalInputSubscriptionIn, + ) + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = ec._Query(ctx, rc.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.pendingDeferred) > 0 { + result := <-ec.deferredResults + atomic.AddInt32(&ec.pendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data := ec._Mutation(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Subscription: + next := ec._Subscription(ctx, rc.Operation.SelectionSet) + + var buf bytes.Buffer + return func(ctx context.Context) *graphql.Response { + buf.Reset() + data := next(ctx) + + if data == nil { + return nil + } + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.OperationContext + *executableSchema + deferred int32 + pendingDeferred int32 + deferredResults chan graphql.DeferredResult +} + +func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { + atomic.AddInt32(&ec.pendingDeferred, 1) + go func() { + ctx := graphql.WithFreshResponseContext(dg.Context) + dg.FieldSet.Dispatch(ctx) + ds := graphql.DeferredResult{ + Path: dg.Path, + Label: dg.Label, + Result: dg.FieldSet, + Errors: graphql.GetErrors(ctx), + } + // null fields should bubble up + if dg.FieldSet.Invalids > 0 { + ds.Result = graphql.Null + } + ec.deferredResults <- ds + }() +} + +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(ec.Schema()), nil +} + +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil +} + +var sources = []*ast.Source{ + {Name: "../schema.graphqls", Input: `directive @isLoggedInAndVerified on FIELD_DEFINITION +directive @hasAccount on FIELD_DEFINITION + +type Query { + comms_listNotifications(pagination: CursorPaginationIn): NotificationPaginatedRecords @isLoggedInAndVerified @hasAccount + comms_getNotificationConfig: NotificationConf @isLoggedInAndVerified @hasAccount + comms_getSubscriptionConfig(id: ID!): Subscription +} + +type Mutation { + comms_updateNotificationConfig(config: NotificationConfIn!): NotificationConf @isLoggedInAndVerified @hasAccount + comms_updateSubscriptionConfig(config: SubscriptionIn!, id: ID!): Subscription + + comms_markNotificationAsRead(id: ID!): Notification @isLoggedInAndVerified @hasAccount +} +`, BuiltIn: false}, + {Name: "../struct-to-graphql/common-types.graphqls", Input: `type Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig @shareable { + enabled: Boolean! + mailAddress: String! +} + +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig @shareable { + enabled: Boolean! + webhook: String! +} + +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig @shareable { + enabled: Boolean! +} + +type Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams @shareable { + clusterName: String! +} + +type Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams @shareable { + envName: String! +} + +type Github__com___kloudlite___api___common__CreatedOrUpdatedBy @shareable { + userEmail: String! + userId: String! + userName: String! +} + +type PageInfo @shareable { + endCursor: String + hasNextPage: Boolean + hasPreviousPage: Boolean + startCursor: String +} + +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn { + enabled: Boolean! + mailAddress: String! +} + +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn { + enabled: Boolean! + webhook: String! +} + +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn { + enabled: Boolean! +} + +enum Github__com___kloudlite___api___apps___comms___types__NotificationResourceType { + account + cluster + environment +} + +enum Github__com___kloudlite___api___apps___comms___types__NotificationType { + alert + notification +} + +`, BuiltIn: false}, + {Name: "../struct-to-graphql/cursorpagination.graphqls", Input: `type CursorPagination @shareable { + after: String + before: String + first: Int + last: Int + orderBy: String + sortDirection: CursorPaginationSortDirection +} + +input CursorPaginationIn { + after: String + before: String + first: Int + last: Int + orderBy: String = "_id" + sortDirection: CursorPaginationSortDirection = "ASC" +} + +enum CursorPaginationSortDirection { + ASC + DESC +} + +`, BuiltIn: false}, + {Name: "../struct-to-graphql/directives.graphqls", Input: `extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@shareable", "@external"]) + +directive @goField( + forceResolver: Boolean + name: String +) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION +`, BuiltIn: false}, + {Name: "../struct-to-graphql/matchfilter.graphqls", Input: `type MatchFilter @shareable { + array: [Any!] + exact: Any + matchType: MatchFilterMatchType! + regex: String +} + +input MatchFilterIn { + array: [Any!] + exact: Any + matchType: MatchFilterMatchType! + regex: String +} + +enum MatchFilterMatchType { + array + exact + regex +} + +`, BuiltIn: false}, + {Name: "../struct-to-graphql/notification.graphqls", Input: `type Notification @shareable { + accountName: String! + creationTime: Date! + id: ID! + markedForDeletion: Boolean + notificationClusterParams: Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams + notificationEnvParams: Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams + notificationType: Github__com___kloudlite___api___apps___comms___types__NotificationType! + read: Boolean! + recordVersion: Int! + resourceType: Github__com___kloudlite___api___apps___comms___types__NotificationResourceType! + updateTime: Date! +} + +type NotificationEdge @shareable { + cursor: String! + node: Notification! +} + +type NotificationPaginatedRecords @shareable { + edges: [NotificationEdge!]! + pageInfo: PageInfo! + totalCount: Int! +} + +`, BuiltIn: false}, + {Name: "../struct-to-graphql/notificationconf.graphqls", Input: `type NotificationConf @shareable { + accountName: String! + createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + creationTime: Date! + emailConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig + id: ID! + lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + markedForDeletion: Boolean + recordVersion: Int! + slackConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig + telegramConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig + updateTime: Date! +} + +input NotificationConfIn { + emailConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn + slackConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn + telegramConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn +} + +`, BuiltIn: false}, + {Name: "../struct-to-graphql/pagination.graphqls", Input: `type Pagination @shareable { + page: Int + per_page: Int +} + +input PaginationIn { + page: Int + per_page: Int +} + +`, BuiltIn: false}, + {Name: "../struct-to-graphql/scalars.graphqls", Input: `scalar Any +scalar Json +scalar Map +scalar Date +`, BuiltIn: false}, + {Name: "../struct-to-graphql/subscription.graphqls", Input: `type Subscription @shareable { + accountName: String! + createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + creationTime: Date! + enabled: Boolean! + id: ID! + lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + mailAddress: String! + markedForDeletion: Boolean + recordVersion: Int! + updateTime: Date! +} + +input SubscriptionIn { + enabled: Boolean! + mailAddress: String! +} + +`, BuiltIn: false}, + {Name: "../../federation/directives.graphql", Input: ` + directive @authenticated on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM + directive @composeDirective(name: String!) repeatable on SCHEMA + directive @extends on OBJECT | INTERFACE + directive @external on OBJECT | FIELD_DEFINITION + directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + directive @inaccessible on + | ARGUMENT_DEFINITION + | ENUM + | ENUM_VALUE + | FIELD_DEFINITION + | INPUT_FIELD_DEFINITION + | INPUT_OBJECT + | INTERFACE + | OBJECT + | SCALAR + | UNION + directive @interfaceObject on OBJECT + directive @link(import: [String!], url: String!) repeatable on SCHEMA + directive @override(from: String!, label: String) on FIELD_DEFINITION + directive @policy(policies: [[federation__Policy!]!]!) on + | FIELD_DEFINITION + | OBJECT + | INTERFACE + | SCALAR + | ENUM + directive @provides(fields: FieldSet!) on FIELD_DEFINITION + directive @requires(fields: FieldSet!) on FIELD_DEFINITION + directive @requiresScopes(scopes: [[federation__Scope!]!]!) on + | FIELD_DEFINITION + | OBJECT + | INTERFACE + | SCALAR + | ENUM + directive @shareable repeatable on FIELD_DEFINITION | OBJECT + directive @tag(name: String!) repeatable on + | ARGUMENT_DEFINITION + | ENUM + | ENUM_VALUE + | FIELD_DEFINITION + | INPUT_FIELD_DEFINITION + | INPUT_OBJECT + | INTERFACE + | OBJECT + | SCALAR + | UNION + scalar _Any + scalar FieldSet + scalar federation__Policy + scalar federation__Scope +`, BuiltIn: true}, + {Name: "../../federation/entity.graphql", Input: ` +type _Service { + sdl: String +} + +extend type Query { + _service: _Service! +} +`, BuiltIn: true}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) field_Mutation_comms_markNotificationAsRead_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 repos.ID + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_comms_updateNotificationConfig_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 entities.NotificationConf + if tmp, ok := rawArgs["config"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config")) + arg0, err = ec.unmarshalNNotificationConfIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐNotificationConf(ctx, tmp) + if err != nil { + return nil, err + } + } + args["config"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_comms_updateSubscriptionConfig_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 entities.Subscription + if tmp, ok := rawArgs["config"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config")) + arg0, err = ec.unmarshalNSubscriptionIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐSubscription(ctx, tmp) + if err != nil { + return nil, err + } + } + args["config"] = arg0 + var arg1 repos.ID + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg1, err = ec.unmarshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_comms_getSubscriptionConfig_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 repos.ID + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_comms_listNotifications_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *repos.CursorPagination + if tmp, ok := rawArgs["pagination"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pagination")) + arg0, err = ec.unmarshalOCursorPaginationIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐCursorPagination(ctx, tmp) + if err != nil { + return nil, err + } + } + args["pagination"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["includeDeprecated"] = arg0 + return args, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _CursorPagination_after(ctx context.Context, field graphql.CollectedField, obj *repos.CursorPagination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CursorPagination_after(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.After, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CursorPagination_after(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CursorPagination", + 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) _CursorPagination_before(ctx context.Context, field graphql.CollectedField, obj *repos.CursorPagination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CursorPagination_before(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Before, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CursorPagination_before(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CursorPagination", + 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) _CursorPagination_first(ctx context.Context, field graphql.CollectedField, obj *repos.CursorPagination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CursorPagination_first(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.First, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int64) + fc.Result = res + return ec.marshalOInt2ᚖint64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CursorPagination_first(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CursorPagination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CursorPagination_last(ctx context.Context, field graphql.CollectedField, obj *repos.CursorPagination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CursorPagination_last(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Last, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int64) + fc.Result = res + return ec.marshalOInt2ᚖint64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CursorPagination_last(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CursorPagination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CursorPagination_orderBy(ctx context.Context, field graphql.CollectedField, obj *repos.CursorPagination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CursorPagination_orderBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OrderBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CursorPagination_orderBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CursorPagination", + 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) _CursorPagination_sortDirection(ctx context.Context, field graphql.CollectedField, obj *repos.CursorPagination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CursorPagination_sortDirection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SortDirection, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(repos.SortDirection) + fc.Result = res + return ec.marshalOCursorPaginationSortDirection2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐSortDirection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CursorPagination_sortDirection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CursorPagination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type CursorPaginationSortDirection does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Enabled, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MailAddress, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Enabled, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Webhook, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Enabled, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig", + 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) _Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ClusterName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams", + 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) _Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnvName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams", + 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) _Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx context.Context, field graphql.CollectedField, obj *common.CreatedOrUpdatedBy) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserEmail, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___common__CreatedOrUpdatedBy", + 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) _Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx context.Context, field graphql.CollectedField, obj *common.CreatedOrUpdatedBy) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Github__com___kloudlite___api___common__CreatedOrUpdatedBy().UserID(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___common__CreatedOrUpdatedBy", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx context.Context, field graphql.CollectedField, obj *common.CreatedOrUpdatedBy) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___common__CreatedOrUpdatedBy", + 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) _MatchFilter_array(ctx context.Context, field graphql.CollectedField, obj *repos.MatchFilter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MatchFilter_array(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Array, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]any) + fc.Result = res + return ec.marshalOAny2ᚕinterfaceᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_MatchFilter_array(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MatchFilter", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Any does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _MatchFilter_exact(ctx context.Context, field graphql.CollectedField, obj *repos.MatchFilter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MatchFilter_exact(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Exact, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(any) + fc.Result = res + return ec.marshalOAny2interface(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_MatchFilter_exact(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MatchFilter", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Any does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _MatchFilter_matchType(ctx context.Context, field graphql.CollectedField, obj *repos.MatchFilter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MatchFilter_matchType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MatchType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(repos.MatchType) + fc.Result = res + return ec.marshalNMatchFilterMatchType2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_MatchFilter_matchType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MatchFilter", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type MatchFilterMatchType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _MatchFilter_regex(ctx context.Context, field graphql.CollectedField, obj *repos.MatchFilter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MatchFilter_regex(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Regex, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_MatchFilter_regex(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MatchFilter", + 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) _Mutation_comms_updateNotificationConfig(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_comms_updateNotificationConfig(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CommsUpdateNotificationConfig(rctx, fc.Args["config"].(entities.NotificationConf)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLoggedInAndVerified == nil { + return nil, errors.New("directive isLoggedInAndVerified is not implemented") + } + return ec.directives.IsLoggedInAndVerified(ctx, nil, directive0) + } + directive2 := func(ctx context.Context) (interface{}, error) { + if ec.directives.HasAccount == nil { + return nil, errors.New("directive hasAccount is not implemented") + } + return ec.directives.HasAccount(ctx, nil, directive1) + } + + tmp, err := directive2(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*entities.NotificationConf); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/comms/internal/domain/entities.NotificationConf`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*entities.NotificationConf) + fc.Result = res + return ec.marshalONotificationConf2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐNotificationConf(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_comms_updateNotificationConfig(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "accountName": + return ec.fieldContext_NotificationConf_accountName(ctx, field) + case "createdBy": + return ec.fieldContext_NotificationConf_createdBy(ctx, field) + case "creationTime": + return ec.fieldContext_NotificationConf_creationTime(ctx, field) + case "emailConfigurations": + return ec.fieldContext_NotificationConf_emailConfigurations(ctx, field) + case "id": + return ec.fieldContext_NotificationConf_id(ctx, field) + case "lastUpdatedBy": + return ec.fieldContext_NotificationConf_lastUpdatedBy(ctx, field) + case "markedForDeletion": + return ec.fieldContext_NotificationConf_markedForDeletion(ctx, field) + case "recordVersion": + return ec.fieldContext_NotificationConf_recordVersion(ctx, field) + case "slackConfigurations": + return ec.fieldContext_NotificationConf_slackConfigurations(ctx, field) + case "telegramConfigurations": + return ec.fieldContext_NotificationConf_telegramConfigurations(ctx, field) + case "updateTime": + return ec.fieldContext_NotificationConf_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type NotificationConf", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_comms_updateNotificationConfig_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_comms_updateSubscriptionConfig(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_comms_updateSubscriptionConfig(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + res := &entities.Subscription{} + fc.Result = res + return ec.marshalOSubscription2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐSubscription(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_comms_updateSubscriptionConfig(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "accountName": + return ec.fieldContext_Subscription_accountName(ctx, field) + case "createdBy": + return ec.fieldContext_Subscription_createdBy(ctx, field) + case "creationTime": + return ec.fieldContext_Subscription_creationTime(ctx, field) + case "enabled": + return ec.fieldContext_Subscription_enabled(ctx, field) + case "id": + return ec.fieldContext_Subscription_id(ctx, field) + case "lastUpdatedBy": + return ec.fieldContext_Subscription_lastUpdatedBy(ctx, field) + case "mailAddress": + return ec.fieldContext_Subscription_mailAddress(ctx, field) + case "markedForDeletion": + return ec.fieldContext_Subscription_markedForDeletion(ctx, field) + case "recordVersion": + return ec.fieldContext_Subscription_recordVersion(ctx, field) + case "updateTime": + return ec.fieldContext_Subscription_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Subscription", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_comms_updateSubscriptionConfig_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_comms_markNotificationAsRead(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_comms_markNotificationAsRead(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CommsMarkNotificationAsRead(rctx, fc.Args["id"].(repos.ID)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLoggedInAndVerified == nil { + return nil, errors.New("directive isLoggedInAndVerified is not implemented") + } + return ec.directives.IsLoggedInAndVerified(ctx, nil, directive0) + } + directive2 := func(ctx context.Context) (interface{}, error) { + if ec.directives.HasAccount == nil { + return nil, errors.New("directive hasAccount is not implemented") + } + return ec.directives.HasAccount(ctx, nil, directive1) + } + + tmp, err := directive2(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*types.Notification); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/comms/types.Notification`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*types.Notification) + fc.Result = res + return ec.marshalONotification2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋtypesᚐNotification(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_comms_markNotificationAsRead(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "accountName": + return ec.fieldContext_Notification_accountName(ctx, field) + case "creationTime": + return ec.fieldContext_Notification_creationTime(ctx, field) + case "id": + return ec.fieldContext_Notification_id(ctx, field) + case "markedForDeletion": + return ec.fieldContext_Notification_markedForDeletion(ctx, field) + case "notificationClusterParams": + return ec.fieldContext_Notification_notificationClusterParams(ctx, field) + case "notificationEnvParams": + return ec.fieldContext_Notification_notificationEnvParams(ctx, field) + case "notificationType": + return ec.fieldContext_Notification_notificationType(ctx, field) + case "read": + return ec.fieldContext_Notification_read(ctx, field) + case "recordVersion": + return ec.fieldContext_Notification_recordVersion(ctx, field) + case "resourceType": + return ec.fieldContext_Notification_resourceType(ctx, field) + case "updateTime": + return ec.fieldContext_Notification_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Notification", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_comms_markNotificationAsRead_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Notification_accountName(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_accountName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AccountName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_accountName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + 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) _Notification_creationTime(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_creationTime(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Notification().CreationTime(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNDate2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_creationTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Notification_id(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Id, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(repos.ID) + fc.Result = res + return ec.marshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Notification_markedForDeletion(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_markedForDeletion(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MarkedForDeletion, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_markedForDeletion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + 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) _Notification_notificationClusterParams(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_notificationClusterParams(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Notification().NotificationClusterParams(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams) + fc.Result = res + return ec.marshalOGithub__com___kloudlite___api___apps___comms___types__NotificationClusterParams2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationClusterParams(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_notificationClusterParams(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "clusterName": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Notification_notificationEnvParams(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_notificationEnvParams(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Notification().NotificationEnvParams(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams) + fc.Result = res + return ec.marshalOGithub__com___kloudlite___api___apps___comms___types__NotificationEnvParams2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationEnvParams(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_notificationEnvParams(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "envName": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Notification_notificationType(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_notificationType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Notification().NotificationType(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.GithubComKloudliteAPIAppsCommsTypesNotificationType) + fc.Result = res + return ec.marshalNGithub__com___kloudlite___api___apps___comms___types__NotificationType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_notificationType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Github__com___kloudlite___api___apps___comms___types__NotificationType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Notification_read(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_read(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Read, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_read(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + 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) _Notification_recordVersion(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_recordVersion(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RecordVersion, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_recordVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Notification_resourceType(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_resourceType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Notification().ResourceType(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) + fc.Result = res + return ec.marshalNGithub__com___kloudlite___api___apps___comms___types__NotificationResourceType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationResourceType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_resourceType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Github__com___kloudlite___api___apps___comms___types__NotificationResourceType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Notification_updateTime(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_updateTime(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Notification().UpdateTime(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNDate2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_updateTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationConf_accountName(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_accountName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AccountName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_accountName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + 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) _NotificationConf_createdBy(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_createdBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(common.CreatedOrUpdatedBy) + fc.Result = res + return ec.marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2githubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_createdBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "userEmail": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx, field) + case "userId": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx, field) + case "userName": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___common__CreatedOrUpdatedBy", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationConf_creationTime(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_creationTime(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.NotificationConf().CreationTime(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNDate2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_creationTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationConf_emailConfigurations(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_emailConfigurations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.NotificationConf().EmailConfigurations(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) + fc.Result = res + return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_emailConfigurations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "enabled": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx, field) + case "mailAddress": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationConf_id(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Id, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(repos.ID) + fc.Result = res + return ec.marshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationConf_lastUpdatedBy(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_lastUpdatedBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LastUpdatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(common.CreatedOrUpdatedBy) + fc.Result = res + return ec.marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2githubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_lastUpdatedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "userEmail": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx, field) + case "userId": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx, field) + case "userName": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___common__CreatedOrUpdatedBy", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationConf_markedForDeletion(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_markedForDeletion(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MarkedForDeletion, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_markedForDeletion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + 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) _NotificationConf_recordVersion(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_recordVersion(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RecordVersion, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_recordVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationConf_slackConfigurations(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_slackConfigurations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.NotificationConf().SlackConfigurations(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) + fc.Result = res + return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_slackConfigurations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "enabled": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx, field) + case "webhook": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationConf_telegramConfigurations(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_telegramConfigurations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.NotificationConf().TelegramConfigurations(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig) + fc.Result = res + return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_telegramConfigurations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "enabled": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationConf_updateTime(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_updateTime(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.NotificationConf().UpdateTime(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNDate2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_updateTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.NotificationEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationEdge_cursor(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationEdge_cursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationEdge", + 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) _NotificationEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.NotificationEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationEdge_node(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*types.Notification) + fc.Result = res + return ec.marshalNNotification2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋtypesᚐNotification(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "accountName": + return ec.fieldContext_Notification_accountName(ctx, field) + case "creationTime": + return ec.fieldContext_Notification_creationTime(ctx, field) + case "id": + return ec.fieldContext_Notification_id(ctx, field) + case "markedForDeletion": + return ec.fieldContext_Notification_markedForDeletion(ctx, field) + case "notificationClusterParams": + return ec.fieldContext_Notification_notificationClusterParams(ctx, field) + case "notificationEnvParams": + return ec.fieldContext_Notification_notificationEnvParams(ctx, field) + case "notificationType": + return ec.fieldContext_Notification_notificationType(ctx, field) + case "read": + return ec.fieldContext_Notification_read(ctx, field) + case "recordVersion": + return ec.fieldContext_Notification_recordVersion(ctx, field) + case "resourceType": + return ec.fieldContext_Notification_resourceType(ctx, field) + case "updateTime": + return ec.fieldContext_Notification_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Notification", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationPaginatedRecords_edges(ctx context.Context, field graphql.CollectedField, obj *model.NotificationPaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationPaginatedRecords_edges(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.NotificationEdge) + fc.Result = res + return ec.marshalNNotificationEdge2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐNotificationEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationPaginatedRecords_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationPaginatedRecords", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "cursor": + return ec.fieldContext_NotificationEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_NotificationEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type NotificationEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationPaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.NotificationPaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationPaginatedRecords_pageInfo(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.PageInfo) + fc.Result = res + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationPaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationPaginatedRecords", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationPaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField, obj *model.NotificationPaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationPaginatedRecords_totalCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationPaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationPaginatedRecords", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_endCursor(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EndCursor, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_endCursor(ctx 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 +} + +func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_hasNextPage(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.HasNextPage, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_hasNextPage(ctx 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) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.HasPreviousPage, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(ctx 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) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *model.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_startCursor(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.StartCursor, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_startCursor(ctx 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 +} + +func (ec *executionContext) _Pagination_page(ctx context.Context, field graphql.CollectedField, obj *types1.Pagination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Pagination_page(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Page, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalOInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Pagination_page(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Pagination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Pagination_per_page(ctx context.Context, field graphql.CollectedField, obj *types1.Pagination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Pagination_per_page(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PerPage, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalOInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Pagination_per_page(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Pagination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_comms_listNotifications(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_comms_listNotifications(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().CommsListNotifications(rctx, fc.Args["pagination"].(*repos.CursorPagination)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLoggedInAndVerified == nil { + return nil, errors.New("directive isLoggedInAndVerified is not implemented") + } + return ec.directives.IsLoggedInAndVerified(ctx, nil, directive0) + } + directive2 := func(ctx context.Context) (interface{}, error) { + if ec.directives.HasAccount == nil { + return nil, errors.New("directive hasAccount is not implemented") + } + return ec.directives.HasAccount(ctx, nil, directive1) + } + + tmp, err := directive2(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*model.NotificationPaginatedRecords); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/comms/internal/app/graph/model.NotificationPaginatedRecords`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.NotificationPaginatedRecords) + fc.Result = res + return ec.marshalONotificationPaginatedRecords2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐNotificationPaginatedRecords(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_comms_listNotifications(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) { + switch field.Name { + case "edges": + return ec.fieldContext_NotificationPaginatedRecords_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_NotificationPaginatedRecords_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_NotificationPaginatedRecords_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type NotificationPaginatedRecords", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_comms_listNotifications_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_comms_getNotificationConfig(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_comms_getNotificationConfig(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().CommsGetNotificationConfig(rctx) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLoggedInAndVerified == nil { + return nil, errors.New("directive isLoggedInAndVerified is not implemented") + } + return ec.directives.IsLoggedInAndVerified(ctx, nil, directive0) + } + directive2 := func(ctx context.Context) (interface{}, error) { + if ec.directives.HasAccount == nil { + return nil, errors.New("directive hasAccount is not implemented") + } + return ec.directives.HasAccount(ctx, nil, directive1) + } + + tmp, err := directive2(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*entities.NotificationConf); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/comms/internal/domain/entities.NotificationConf`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*entities.NotificationConf) + fc.Result = res + return ec.marshalONotificationConf2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐNotificationConf(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_comms_getNotificationConfig(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) { + switch field.Name { + case "accountName": + return ec.fieldContext_NotificationConf_accountName(ctx, field) + case "createdBy": + return ec.fieldContext_NotificationConf_createdBy(ctx, field) + case "creationTime": + return ec.fieldContext_NotificationConf_creationTime(ctx, field) + case "emailConfigurations": + return ec.fieldContext_NotificationConf_emailConfigurations(ctx, field) + case "id": + return ec.fieldContext_NotificationConf_id(ctx, field) + case "lastUpdatedBy": + return ec.fieldContext_NotificationConf_lastUpdatedBy(ctx, field) + case "markedForDeletion": + return ec.fieldContext_NotificationConf_markedForDeletion(ctx, field) + case "recordVersion": + return ec.fieldContext_NotificationConf_recordVersion(ctx, field) + case "slackConfigurations": + return ec.fieldContext_NotificationConf_slackConfigurations(ctx, field) + case "telegramConfigurations": + return ec.fieldContext_NotificationConf_telegramConfigurations(ctx, field) + case "updateTime": + return ec.fieldContext_NotificationConf_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type NotificationConf", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_comms_getSubscriptionConfig(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_comms_getSubscriptionConfig(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + res := &entities.Subscription{} + fc.Result = res + return ec.marshalOSubscription2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐSubscription(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_comms_getSubscriptionConfig(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) { + switch field.Name { + case "accountName": + return ec.fieldContext_Subscription_accountName(ctx, field) + case "createdBy": + return ec.fieldContext_Subscription_createdBy(ctx, field) + case "creationTime": + return ec.fieldContext_Subscription_creationTime(ctx, field) + case "enabled": + return ec.fieldContext_Subscription_enabled(ctx, field) + case "id": + return ec.fieldContext_Subscription_id(ctx, field) + case "lastUpdatedBy": + return ec.fieldContext_Subscription_lastUpdatedBy(ctx, field) + case "mailAddress": + return ec.fieldContext_Subscription_mailAddress(ctx, field) + case "markedForDeletion": + return ec.fieldContext_Subscription_markedForDeletion(ctx, field) + case "recordVersion": + return ec.fieldContext_Subscription_recordVersion(ctx, field) + case "updateTime": + return ec.fieldContext_Subscription_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Subscription", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_comms_getSubscriptionConfig_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query__service(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query__service(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.__resolve__service(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(fedruntime.Service) + fc.Result = res + return ec.marshalN_Service2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐService(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query__service(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) { + switch field.Name { + case "sdl": + return ec.fieldContext__Service_sdl(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _Service", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectType(fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +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) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectSchema() + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + fc.Result = res + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___schema(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) { + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_accountName(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_accountName(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().AccountName(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan string): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNString2string(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_accountName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_createdBy(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_createdBy(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().CreatedBy(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *common.CreatedOrUpdatedBy): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2ᚖgithubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_createdBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "userEmail": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx, field) + case "userId": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx, field) + case "userName": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___common__CreatedOrUpdatedBy", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_creationTime(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_creationTime(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().CreationTime(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan string): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNDate2string(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_creationTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_enabled(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_enabled(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().Enabled(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan bool): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNBoolean2bool(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + 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) _Subscription_id(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_id(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().ID(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan repos.ID): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_lastUpdatedBy(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_lastUpdatedBy(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().LastUpdatedBy(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *common.CreatedOrUpdatedBy): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2ᚖgithubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_lastUpdatedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "userEmail": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx, field) + case "userId": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx, field) + case "userName": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___common__CreatedOrUpdatedBy", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_mailAddress(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_mailAddress(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().MailAddress(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan string): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNString2string(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_mailAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_markedForDeletion(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_markedForDeletion(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().MarkedForDeletion(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *bool): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_markedForDeletion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + 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) _Subscription_recordVersion(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_recordVersion(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().RecordVersion(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan int): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNInt2int(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_recordVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_updateTime(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_updateTime(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UpdateTime(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan string): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNDate2string(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_updateTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) __Service_sdl(ctx context.Context, field graphql.CollectedField, obj *fedruntime.Service) (ret graphql.Marshaler) { + fc, err := ec.fieldContext__Service_sdl(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SDL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext__Service_sdl(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_Service", + 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) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_description(ctx 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 +} + +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Locations, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_locations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __DirectiveLocation does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + 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) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_name(ctx 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 +} + +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_description(ctx 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 +} + +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(ctx 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 +} + +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(ctx 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 +} + +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_description(ctx 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 +} + +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + 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) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_isDeprecated(ctx 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") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_deprecationReason(ctx 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 +} + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_name(ctx 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 +} + +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_description(ctx 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 +} + +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_type(ctx 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) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_defaultValue(ctx 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 +} + +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_description(ctx 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 +} + +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_types(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Types(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_types(ctx 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) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_queryType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.QueryType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_queryType(ctx 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) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_mutationType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_mutationType(ctx 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) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_subscriptionType(ctx 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) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_directives(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Directives(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Directive) + fc.Result = res + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_directives(ctx 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) { + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_kind(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalN__TypeKind2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __TypeKind does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + 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) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_interfaces(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_interfaces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_possibleTypes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_enumValues(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + 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) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_inputFields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_inputFields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + 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) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_ofType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_ofType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + 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 "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 "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputCursorPaginationIn(ctx context.Context, obj interface{}) (repos.CursorPagination, error) { + var it repos.CursorPagination + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + if _, present := asMap["orderBy"]; !present { + asMap["orderBy"] = "_id" + } + if _, present := asMap["sortDirection"]; !present { + asMap["sortDirection"] = "ASC" + } + + fieldsInOrder := [...]string{"after", "before", "first", "last", "orderBy", "sortDirection"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "after": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("after")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.After = data + case "before": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("before")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Before = data + case "first": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) + data, err := ec.unmarshalOInt2ᚖint64(ctx, v) + if err != nil { + return it, err + } + it.First = data + case "last": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("last")) + data, err := ec.unmarshalOInt2ᚖint64(ctx, v) + if err != nil { + return it, err + } + it.Last = data + case "orderBy": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy")) + data, err := ec.unmarshalOString2string(ctx, v) + if err != nil { + return it, err + } + it.OrderBy = data + case "sortDirection": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sortDirection")) + data, err := ec.unmarshalOCursorPaginationSortDirection2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐSortDirection(ctx, v) + if err != nil { + return it, err + } + it.SortDirection = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn, error) { + var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"enabled", "mailAddress"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "enabled": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.Enabled = data + case "mailAddress": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mailAddress")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.MailAddress = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn, error) { + var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"enabled", "webhook"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "enabled": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.Enabled = data + case "webhook": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("webhook")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Webhook = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn, error) { + var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"enabled"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "enabled": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.Enabled = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputMatchFilterIn(ctx context.Context, obj interface{}) (repos.MatchFilter, error) { + var it repos.MatchFilter + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"array", "exact", "matchType", "regex"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "array": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("array")) + data, err := ec.unmarshalOAny2ᚕinterfaceᚄ(ctx, v) + if err != nil { + return it, err + } + it.Array = data + case "exact": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exact")) + data, err := ec.unmarshalOAny2interface(ctx, v) + if err != nil { + return it, err + } + it.Exact = data + case "matchType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("matchType")) + data, err := ec.unmarshalNMatchFilterMatchType2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchType(ctx, v) + if err != nil { + return it, err + } + it.MatchType = data + case "regex": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("regex")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Regex = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputNotificationConfIn(ctx context.Context, obj interface{}) (entities.NotificationConf, error) { + var it entities.NotificationConf + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"emailConfigurations", "slackConfigurations", "telegramConfigurations"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "emailConfigurations": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailConfigurations")) + data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.NotificationConfIn().EmailConfigurations(ctx, &it, data); err != nil { + return it, err + } + case "slackConfigurations": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("slackConfigurations")) + data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.NotificationConfIn().SlackConfigurations(ctx, &it, data); err != nil { + return it, err + } + case "telegramConfigurations": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("telegramConfigurations")) + data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.NotificationConfIn().TelegramConfigurations(ctx, &it, data); err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputPaginationIn(ctx context.Context, obj interface{}) (types1.Pagination, error) { + var it types1.Pagination + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"page", "per_page"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "page": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page")) + data, err := ec.unmarshalOInt2int(ctx, v) + if err != nil { + return it, err + } + it.Page = data + case "per_page": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("per_page")) + data, err := ec.unmarshalOInt2int(ctx, v) + if err != nil { + return it, err + } + it.PerPage = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputSubscriptionIn(ctx context.Context, obj interface{}) (entities.Subscription, error) { + var it entities.Subscription + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"enabled", "mailAddress"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "enabled": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.Enabled = data + case "mailAddress": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mailAddress")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.MailAddress = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var cursorPaginationImplementors = []string{"CursorPagination"} + +func (ec *executionContext) _CursorPagination(ctx context.Context, sel ast.SelectionSet, obj *repos.CursorPagination) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, cursorPaginationImplementors) + + 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("CursorPagination") + case "after": + out.Values[i] = ec._CursorPagination_after(ctx, field, obj) + case "before": + out.Values[i] = ec._CursorPagination_before(ctx, field, obj) + case "first": + out.Values[i] = ec._CursorPagination_first(ctx, field, obj) + case "last": + out.Values[i] = ec._CursorPagination_last(ctx, field, obj) + case "orderBy": + out.Values[i] = ec._CursorPagination_orderBy(ctx, field, obj) + case "sortDirection": + out.Values[i] = ec._CursorPagination_sortDirection(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig"} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigImplementors) + + 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("Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig") + case "enabled": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mailAddress": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig"} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigImplementors) + + 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("Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig") + case "enabled": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "webhook": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig"} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigImplementors) + + 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("Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig") + case "enabled": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var github__com___kloudlite___api___apps___comms___types__NotificationClusterParamsImplementors = []string{"Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams"} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___types__NotificationClusterParamsImplementors) + + 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("Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams") + case "clusterName": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var github__com___kloudlite___api___apps___comms___types__NotificationEnvParamsImplementors = []string{"Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams"} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___types__NotificationEnvParamsImplementors) + + 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("Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams") + case "envName": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var github__com___kloudlite___api___common__CreatedOrUpdatedByImplementors = []string{"Github__com___kloudlite___api___common__CreatedOrUpdatedBy"} + +func (ec *executionContext) _Github__com___kloudlite___api___common__CreatedOrUpdatedBy(ctx context.Context, sel ast.SelectionSet, obj *common.CreatedOrUpdatedBy) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___common__CreatedOrUpdatedByImplementors) + + 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("Github__com___kloudlite___api___common__CreatedOrUpdatedBy") + case "userEmail": + out.Values[i] = ec._Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "userId": + 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._Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "userName": + out.Values[i] = ec._Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var matchFilterImplementors = []string{"MatchFilter"} + +func (ec *executionContext) _MatchFilter(ctx context.Context, sel ast.SelectionSet, obj *repos.MatchFilter) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, matchFilterImplementors) + + 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("MatchFilter") + case "array": + out.Values[i] = ec._MatchFilter_array(ctx, field, obj) + case "exact": + out.Values[i] = ec._MatchFilter_exact(ctx, field, obj) + case "matchType": + out.Values[i] = ec._MatchFilter_matchType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "regex": + out.Values[i] = ec._MatchFilter_regex(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var mutationImplementors = []string{"Mutation"} + +func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Mutation", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Mutation") + case "comms_updateNotificationConfig": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_comms_updateNotificationConfig(ctx, field) + }) + case "comms_updateSubscriptionConfig": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_comms_updateSubscriptionConfig(ctx, field) + }) + case "comms_markNotificationAsRead": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_comms_markNotificationAsRead(ctx, field) + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var notificationImplementors = []string{"Notification"} + +func (ec *executionContext) _Notification(ctx context.Context, sel ast.SelectionSet, obj *types.Notification) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, notificationImplementors) + + 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("Notification") + case "accountName": + out.Values[i] = ec._Notification_accountName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "creationTime": + 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._Notification_creationTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "id": + out.Values[i] = ec._Notification_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "markedForDeletion": + out.Values[i] = ec._Notification_markedForDeletion(ctx, field, obj) + case "notificationClusterParams": + 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._Notification_notificationClusterParams(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "notificationEnvParams": + 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._Notification_notificationEnvParams(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "notificationType": + 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._Notification_notificationType(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "read": + out.Values[i] = ec._Notification_read(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "recordVersion": + out.Values[i] = ec._Notification_recordVersion(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "resourceType": + 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._Notification_resourceType(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "updateTime": + 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._Notification_updateTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var notificationConfImplementors = []string{"NotificationConf"} + +func (ec *executionContext) _NotificationConf(ctx context.Context, sel ast.SelectionSet, obj *entities.NotificationConf) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, notificationConfImplementors) + + 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("NotificationConf") + case "accountName": + out.Values[i] = ec._NotificationConf_accountName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "createdBy": + out.Values[i] = ec._NotificationConf_createdBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "creationTime": + 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._NotificationConf_creationTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "emailConfigurations": + 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._NotificationConf_emailConfigurations(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "id": + out.Values[i] = ec._NotificationConf_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "lastUpdatedBy": + out.Values[i] = ec._NotificationConf_lastUpdatedBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "markedForDeletion": + out.Values[i] = ec._NotificationConf_markedForDeletion(ctx, field, obj) + case "recordVersion": + out.Values[i] = ec._NotificationConf_recordVersion(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "slackConfigurations": + 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._NotificationConf_slackConfigurations(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "telegramConfigurations": + 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._NotificationConf_telegramConfigurations(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "updateTime": + 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._NotificationConf_updateTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var notificationEdgeImplementors = []string{"NotificationEdge"} + +func (ec *executionContext) _NotificationEdge(ctx context.Context, sel ast.SelectionSet, obj *model.NotificationEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, notificationEdgeImplementors) + + 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("NotificationEdge") + case "cursor": + out.Values[i] = ec._NotificationEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._NotificationEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var notificationPaginatedRecordsImplementors = []string{"NotificationPaginatedRecords"} + +func (ec *executionContext) _NotificationPaginatedRecords(ctx context.Context, sel ast.SelectionSet, obj *model.NotificationPaginatedRecords) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, notificationPaginatedRecordsImplementors) + + 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("NotificationPaginatedRecords") + case "edges": + out.Values[i] = ec._NotificationPaginatedRecords_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._NotificationPaginatedRecords_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "totalCount": + out.Values[i] = ec._NotificationPaginatedRecords_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var pageInfoImplementors = []string{"PageInfo"} + +func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *model.PageInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, pageInfoImplementors) + + 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("PageInfo") + case "endCursor": + out.Values[i] = ec._PageInfo_endCursor(ctx, field, obj) + case "hasNextPage": + out.Values[i] = ec._PageInfo_hasNextPage(ctx, field, obj) + case "hasPreviousPage": + out.Values[i] = ec._PageInfo_hasPreviousPage(ctx, field, obj) + case "startCursor": + out.Values[i] = ec._PageInfo_startCursor(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var paginationImplementors = []string{"Pagination"} + +func (ec *executionContext) _Pagination(ctx context.Context, sel ast.SelectionSet, obj *types1.Pagination) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, paginationImplementors) + + 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("Pagination") + case "page": + out.Values[i] = ec._Pagination_page(ctx, field, obj) + case "per_page": + out.Values[i] = ec._Pagination_per_page(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var queryImplementors = []string{"Query"} + +func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "comms_listNotifications": + 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_comms_listNotifications(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 "comms_getNotificationConfig": + 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_comms_getNotificationConfig(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 "comms_getSubscriptionConfig": + 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_comms_getSubscriptionConfig(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 "_service": + 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__service(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) { + return ec._Query___type(ctx, field) + }) + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___schema(ctx, field) + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var subscriptionImplementors = []string{"Subscription"} + +func (ec *executionContext) _Subscription(ctx context.Context, sel ast.SelectionSet) func(ctx context.Context) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Subscription", + }) + if len(fields) != 1 { + ec.Errorf(ctx, "must subscribe to exactly one stream") + return nil + } + + switch fields[0].Name { + case "accountName": + return ec._Subscription_accountName(ctx, fields[0]) + case "createdBy": + return ec._Subscription_createdBy(ctx, fields[0]) + case "creationTime": + return ec._Subscription_creationTime(ctx, fields[0]) + case "enabled": + return ec._Subscription_enabled(ctx, fields[0]) + case "id": + return ec._Subscription_id(ctx, fields[0]) + case "lastUpdatedBy": + return ec._Subscription_lastUpdatedBy(ctx, fields[0]) + case "mailAddress": + return ec._Subscription_mailAddress(ctx, fields[0]) + case "markedForDeletion": + return ec._Subscription_markedForDeletion(ctx, fields[0]) + case "recordVersion": + return ec._Subscription_recordVersion(ctx, fields[0]) + case "updateTime": + return ec._Subscription_updateTime(ctx, fields[0]) + default: + panic("unknown field " + strconv.Quote(fields[0].Name)) + } +} + +var _ServiceImplementors = []string{"_Service"} + +func (ec *executionContext) __Service(ctx context.Context, sel ast.SelectionSet, obj *fedruntime.Service) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ServiceImplementors) + + 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("_Service") + case "sdl": + out.Values[i] = ec.__Service_sdl(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __DirectiveImplementors = []string{"__Directive"} + +func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Directive") + case "name": + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "locations": + out.Values[i] = ec.___Directive_locations(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + out.Values[i] = ec.___Directive_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __EnumValueImplementors = []string{"__EnumValue"} + +func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__EnumValue") + case "name": + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __FieldImplementors = []string{"__Field"} + +func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Field") + case "name": + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Field_description(ctx, field, obj) + case "args": + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __InputValueImplementors = []string{"__InputValue"} + +func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ec.___InputValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + case "type": + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __SchemaImplementors = []string{"__Schema"} + +func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Schema") + case "description": + out.Values[i] = ec.___Schema_description(ctx, field, obj) + case "types": + out.Values[i] = ec.___Schema_types(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "queryType": + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + case "subscriptionType": + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + case "directives": + out.Values[i] = ec.___Schema_directives(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __TypeImplementors = []string{"__Type"} + +func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ec.___Type_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.___Type_name(ctx, field, obj) + case "description": + out.Values[i] = ec.___Type_description(ctx, field, obj) + case "fields": + out.Values[i] = ec.___Type_fields(ctx, field, obj) + case "interfaces": + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + case "possibleTypes": + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + case "enumValues": + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + case "inputFields": + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + case "ofType": + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + case "specifiedByURL": + out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) unmarshalNAny2interface(ctx context.Context, v interface{}) (any, error) { + res, err := graphql.UnmarshalAny(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNAny2interface(ctx context.Context, sel ast.SelectionSet, v any) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + res := graphql.MarshalAny(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNDate2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDate2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNFieldSet2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNFieldSet2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___apps___comms___types__NotificationResourceType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationResourceType(ctx context.Context, v interface{}) (model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType, error) { + var res model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___comms___types__NotificationResourceType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationResourceType(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___apps___comms___types__NotificationType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationType(ctx context.Context, v interface{}) (model.GithubComKloudliteAPIAppsCommsTypesNotificationType, error) { + var res model.GithubComKloudliteAPIAppsCommsTypesNotificationType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___comms___types__NotificationType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationType(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteAPIAppsCommsTypesNotificationType) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2githubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx context.Context, sel ast.SelectionSet, v common.CreatedOrUpdatedBy) graphql.Marshaler { + return ec._Github__com___kloudlite___api___common__CreatedOrUpdatedBy(ctx, sel, &v) +} + +func (ec *executionContext) marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2ᚖgithubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx context.Context, sel ast.SelectionSet, v *common.CreatedOrUpdatedBy) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Github__com___kloudlite___api___common__CreatedOrUpdatedBy(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx context.Context, v interface{}) (repos.ID, error) { + tmp, err := graphql.UnmarshalString(v) + res := repos.ID(tmp) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx context.Context, sel ast.SelectionSet, v repos.ID) graphql.Marshaler { + res := graphql.MarshalString(string(v)) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { + res, err := graphql.UnmarshalInt(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { + res := graphql.MarshalInt(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNMatchFilterMatchType2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchType(ctx context.Context, v interface{}) (repos.MatchType, error) { + tmp, err := graphql.UnmarshalString(v) + res := repos.MatchType(tmp) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNMatchFilterMatchType2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchType(ctx context.Context, sel ast.SelectionSet, v repos.MatchType) graphql.Marshaler { + res := graphql.MarshalString(string(v)) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNNotification2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋtypesᚐNotification(ctx context.Context, sel ast.SelectionSet, v *types.Notification) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Notification(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNNotificationConfIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐNotificationConf(ctx context.Context, v interface{}) (entities.NotificationConf, error) { + res, err := ec.unmarshalInputNotificationConfIn(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNNotificationEdge2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐNotificationEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.NotificationEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNNotificationEdge2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐNotificationEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNNotificationEdge2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐNotificationEdge(ctx context.Context, sel ast.SelectionSet, v *model.NotificationEdge) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._NotificationEdge(ctx, sel, v) +} + +func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *model.PageInfo) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._PageInfo(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNSubscriptionIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐSubscription(ctx context.Context, v interface{}) (entities.Subscription, error) { + res, err := ec.unmarshalInputSubscriptionIn(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN_Service2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐService(ctx context.Context, sel ast.SelectionSet, v fedruntime.Service) graphql.Marshaler { + return ec.__Service(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ec.___Directive(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ec.___EnumValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ec.___Field(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ec.___InputValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ec.___Type(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNfederation__Policy2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNfederation__Policy2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNfederation__Policy2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNfederation__Policy2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNfederation__Policy2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNfederation__Policy2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalNfederation__Policy2ᚕᚕstringᚄ(ctx context.Context, v interface{}) ([][]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([][]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNfederation__Policy2ᚕstringᚄ(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNfederation__Policy2ᚕᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v [][]string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNfederation__Policy2ᚕstringᚄ(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalNfederation__Scope2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNfederation__Scope2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNfederation__Scope2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNfederation__Scope2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNfederation__Scope2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNfederation__Scope2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalNfederation__Scope2ᚕᚕstringᚄ(ctx context.Context, v interface{}) ([][]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([][]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNfederation__Scope2ᚕstringᚄ(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNfederation__Scope2ᚕᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v [][]string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNfederation__Scope2ᚕstringᚄ(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v interface{}) (any, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalAny(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOAny2interface(ctx context.Context, sel ast.SelectionSet, v any) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalAny(v) + return res +} + +func (ec *executionContext) unmarshalOAny2ᚕinterfaceᚄ(ctx context.Context, v interface{}) ([]any, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]any, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNAny2interface(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOAny2ᚕinterfaceᚄ(ctx context.Context, sel ast.SelectionSet, v []any) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNAny2interface(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + return res +} + +func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalBoolean(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalBoolean(*v) + return res +} + +func (ec *executionContext) unmarshalOCursorPaginationIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐCursorPagination(ctx context.Context, v interface{}) (*repos.CursorPagination, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputCursorPaginationIn(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOCursorPaginationSortDirection2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐSortDirection(ctx context.Context, v interface{}) (repos.SortDirection, error) { + tmp, err := graphql.UnmarshalString(v) + res := repos.SortDirection(tmp) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOCursorPaginationSortDirection2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐSortDirection(ctx context.Context, sel ast.SelectionSet, v repos.SortDirection) graphql.Marshaler { + res := graphql.MarshalString(string(v)) + return res +} + +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___types__NotificationClusterParams2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationClusterParams(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams(ctx, sel, v) +} + +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___types__NotificationEnvParams2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationEnvParams(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOInt2int(ctx context.Context, v interface{}) (int, error) { + res, err := graphql.UnmarshalInt(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { + res := graphql.MarshalInt(v) + return res +} + +func (ec *executionContext) unmarshalOInt2ᚖint64(ctx context.Context, v interface{}) (*int64, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalInt64(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOInt2ᚖint64(ctx context.Context, sel ast.SelectionSet, v *int64) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalInt64(*v) + return res +} + +func (ec *executionContext) marshalONotification2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋtypesᚐNotification(ctx context.Context, sel ast.SelectionSet, v *types.Notification) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Notification(ctx, sel, v) +} + +func (ec *executionContext) marshalONotificationConf2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐNotificationConf(ctx context.Context, sel ast.SelectionSet, v *entities.NotificationConf) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._NotificationConf(ctx, sel, v) +} + +func (ec *executionContext) marshalONotificationPaginatedRecords2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐNotificationPaginatedRecords(ctx context.Context, sel ast.SelectionSet, v *model.NotificationPaginatedRecords) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._NotificationPaginatedRecords(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + return res +} + +func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNString2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalString(*v) + return res +} + +func (ec *executionContext) marshalOSubscription2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋdomainᚋentitiesᚐSubscription(ctx context.Context, sel ast.SelectionSet, v *entities.Subscription) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := ec._Subscription(ctx, sel) + return res(ctx) +} + +func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Schema(ctx, sel, v) +} + +func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/apps/comms/internal/app/graph/model/models_gen.go b/apps/comms/internal/app/graph/model/models_gen.go new file mode 100644 index 000000000..46105658e --- /dev/null +++ b/apps/comms/internal/app/graph/model/models_gen.go @@ -0,0 +1,155 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package model + +import ( + "fmt" + "io" + "strconv" + + "github.com/kloudlite/api/apps/comms/types" +) + +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig struct { + Enabled bool `json:"enabled"` + MailAddress string `json:"mailAddress"` +} + +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn struct { + Enabled bool `json:"enabled"` + MailAddress string `json:"mailAddress"` +} + +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig struct { + Enabled bool `json:"enabled"` + Webhook string `json:"webhook"` +} + +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn struct { + Enabled bool `json:"enabled"` + Webhook string `json:"webhook"` +} + +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig struct { + Enabled bool `json:"enabled"` +} + +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn struct { + Enabled bool `json:"enabled"` +} + +type GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams struct { + ClusterName string `json:"clusterName"` +} + +type GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams struct { + EnvName string `json:"envName"` +} + +type Mutation struct { +} + +type NotificationEdge struct { + Cursor string `json:"cursor"` + Node *types.Notification `json:"node"` +} + +type NotificationPaginatedRecords struct { + Edges []*NotificationEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} + +type PageInfo struct { + EndCursor *string `json:"endCursor,omitempty"` + HasNextPage *bool `json:"hasNextPage,omitempty"` + HasPreviousPage *bool `json:"hasPreviousPage,omitempty"` + StartCursor *string `json:"startCursor,omitempty"` +} + +type Query struct { +} + +type GithubComKloudliteAPIAppsCommsTypesNotificationResourceType string + +const ( + GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeAccount GithubComKloudliteAPIAppsCommsTypesNotificationResourceType = "account" + GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeCluster GithubComKloudliteAPIAppsCommsTypesNotificationResourceType = "cluster" + GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeEnvironment GithubComKloudliteAPIAppsCommsTypesNotificationResourceType = "environment" +) + +var AllGithubComKloudliteAPIAppsCommsTypesNotificationResourceType = []GithubComKloudliteAPIAppsCommsTypesNotificationResourceType{ + GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeAccount, + GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeCluster, + GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeEnvironment, +} + +func (e GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) IsValid() bool { + switch e { + case GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeAccount, GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeCluster, GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeEnvironment: + return true + } + return false +} + +func (e GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) String() string { + return string(e) +} + +func (e *GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = GithubComKloudliteAPIAppsCommsTypesNotificationResourceType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Github__com___kloudlite___api___apps___comms___types__NotificationResourceType", str) + } + return nil +} + +func (e GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type GithubComKloudliteAPIAppsCommsTypesNotificationType string + +const ( + GithubComKloudliteAPIAppsCommsTypesNotificationTypeAlert GithubComKloudliteAPIAppsCommsTypesNotificationType = "alert" + GithubComKloudliteAPIAppsCommsTypesNotificationTypeNotification GithubComKloudliteAPIAppsCommsTypesNotificationType = "notification" +) + +var AllGithubComKloudliteAPIAppsCommsTypesNotificationType = []GithubComKloudliteAPIAppsCommsTypesNotificationType{ + GithubComKloudliteAPIAppsCommsTypesNotificationTypeAlert, + GithubComKloudliteAPIAppsCommsTypesNotificationTypeNotification, +} + +func (e GithubComKloudliteAPIAppsCommsTypesNotificationType) IsValid() bool { + switch e { + case GithubComKloudliteAPIAppsCommsTypesNotificationTypeAlert, GithubComKloudliteAPIAppsCommsTypesNotificationTypeNotification: + return true + } + return false +} + +func (e GithubComKloudliteAPIAppsCommsTypesNotificationType) String() string { + return string(e) +} + +func (e *GithubComKloudliteAPIAppsCommsTypesNotificationType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = GithubComKloudliteAPIAppsCommsTypesNotificationType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Github__com___kloudlite___api___apps___comms___types__NotificationType", str) + } + return nil +} + +func (e GithubComKloudliteAPIAppsCommsTypesNotificationType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} diff --git a/apps/comms/internal/app/graph/notification.resolvers.go b/apps/comms/internal/app/graph/notification.resolvers.go new file mode 100644 index 000000000..8b5ba262a --- /dev/null +++ b/apps/comms/internal/app/graph/notification.resolvers.go @@ -0,0 +1,75 @@ +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.45 + +import ( + "context" + "fmt" + "time" + + "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" + "github.com/kloudlite/api/apps/comms/internal/app/graph/model" + "github.com/kloudlite/api/apps/comms/types" + fn "github.com/kloudlite/api/pkg/functions" +) + +// CreationTime is the resolver for the creationTime field. +func (r *notificationResolver) CreationTime(ctx context.Context, obj *types.Notification) (string, error) { + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return obj.CreationTime.Format(time.RFC3339), nil +} + +// NotificationClusterParams is the resolver for the notificationClusterParams field. +func (r *notificationResolver) NotificationClusterParams(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams, error) { + if obj == nil { + return nil, fmt.Errorf("obj is nil") + } + + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams](obj.NotificationClusterParams) +} + +// NotificationEnvParams is the resolver for the notificationEnvParams field. +func (r *notificationResolver) NotificationEnvParams(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams, error) { + if obj == nil { + return nil, fmt.Errorf("obj is nil") + } + + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams](obj.NotificationEnvParams) +} + +// NotificationType is the resolver for the notificationType field. +func (r *notificationResolver) NotificationType(ctx context.Context, obj *types.Notification) (model.GithubComKloudliteAPIAppsCommsTypesNotificationType, error) { + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return model.GithubComKloudliteAPIAppsCommsTypesNotificationType(obj.NotificationType), nil +} + +// ResourceType is the resolver for the resourceType field. +func (r *notificationResolver) ResourceType(ctx context.Context, obj *types.Notification) (model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType, error) { + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType(obj.ResourceType), nil +} + +// UpdateTime is the resolver for the updateTime field. +func (r *notificationResolver) UpdateTime(ctx context.Context, obj *types.Notification) (string, error) { + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return obj.UpdateTime.Format(time.RFC3339), nil +} + +// Notification returns generated.NotificationResolver implementation. +func (r *Resolver) Notification() generated.NotificationResolver { return ¬ificationResolver{r} } + +type notificationResolver struct{ *Resolver } diff --git a/apps/comms/internal/app/graph/notificationconf.resolvers.go b/apps/comms/internal/app/graph/notificationconf.resolvers.go new file mode 100644 index 000000000..f6f698349 --- /dev/null +++ b/apps/comms/internal/app/graph/notificationconf.resolvers.go @@ -0,0 +1,121 @@ +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.45 + +import ( + "context" + "fmt" + "time" + + "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" + "github.com/kloudlite/api/apps/comms/internal/app/graph/model" + "github.com/kloudlite/api/apps/comms/internal/domain/entities" + fn "github.com/kloudlite/api/pkg/functions" +) + +// CreationTime is the resolver for the creationTime field. +func (r *notificationConfResolver) CreationTime(ctx context.Context, obj *entities.NotificationConf) (string, error) { + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return obj.CreationTime.Format(time.RFC3339), nil +} + +// EmailConfigurations is the resolver for the emailConfigurations field. +func (r *notificationConfResolver) EmailConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig, error) { + if obj == nil { + return nil, fmt.Errorf("obj is nil") + } + + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig](obj.EmailConfiguration) +} + +// SlackConfigurations is the resolver for the slackConfigurations field. +func (r *notificationConfResolver) SlackConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig, error) { + if obj == nil { + return nil, fmt.Errorf("obj is nil") + } + + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig](obj.SlackConfiguration) +} + +// TelegramConfigurations is the resolver for the telegramConfigurations field. +func (r *notificationConfResolver) TelegramConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig, error) { + if obj == nil { + return nil, fmt.Errorf("obj is nil") + } + + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig](obj.TelegramConfiguration) +} + +// UpdateTime is the resolver for the updateTime field. +func (r *notificationConfResolver) UpdateTime(ctx context.Context, obj *entities.NotificationConf) (string, error) { + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return obj.UpdateTime.Format(time.RFC3339), nil +} + +// EmailConfigurations is the resolver for the emailConfigurations field. +func (r *notificationConfInResolver) EmailConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn) error { + if obj == nil { + return fmt.Errorf("obj is nil") + } + + gckacideeci, err := fn.JsonConvertP[entities.EmailConfig](data) + if err != nil { + return err + } + + obj.EmailConfiguration = gckacideeci + + return nil +} + +// SlackConfigurations is the resolver for the slackConfigurations field. +func (r *notificationConfInResolver) SlackConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn) error { + if obj == nil { + return fmt.Errorf("obj is nil") + } + + gckacideesci, err := fn.JsonConvertP[entities.SlackConfig](data) + if err != nil { + return err + } + + obj.SlackConfiguration = gckacideesci + return nil +} + +// TelegramConfigurations is the resolver for the telegramConfigurations field. +func (r *notificationConfInResolver) TelegramConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn) error { + if obj == nil { + return fmt.Errorf("obj is nil") + } + + gckacideetci, err := fn.JsonConvertP[entities.TelegramConfig](data) + if err != nil { + return err + } + + obj.TelegramConfiguration = gckacideetci + + return nil +} + +// NotificationConf returns generated.NotificationConfResolver implementation. +func (r *Resolver) NotificationConf() generated.NotificationConfResolver { + return ¬ificationConfResolver{r} +} + +// NotificationConfIn returns generated.NotificationConfInResolver implementation. +func (r *Resolver) NotificationConfIn() generated.NotificationConfInResolver { + return ¬ificationConfInResolver{r} +} + +type notificationConfResolver struct{ *Resolver } +type notificationConfInResolver struct{ *Resolver } diff --git a/apps/comms/internal/app/graph/resolver.go b/apps/comms/internal/app/graph/resolver.go new file mode 100644 index 000000000..912366da3 --- /dev/null +++ b/apps/comms/internal/app/graph/resolver.go @@ -0,0 +1,15 @@ +package graph + +import ( + "github.com/kloudlite/api/apps/comms/internal/domain" + "github.com/kloudlite/api/apps/comms/internal/env" +) + +// This file will not be regenerated automatically. +// +// It serves as dependency injection for your app, add any dependencies you require here. + +type Resolver struct { + Domain domain.Domain + Env *env.Env +} diff --git a/apps/comms/internal/app/graph/schema.graphqls b/apps/comms/internal/app/graph/schema.graphqls new file mode 100644 index 000000000..f7ded99fb --- /dev/null +++ b/apps/comms/internal/app/graph/schema.graphqls @@ -0,0 +1,15 @@ +directive @isLoggedInAndVerified on FIELD_DEFINITION +directive @hasAccount on FIELD_DEFINITION + +type Query { + comms_listNotifications(pagination: CursorPaginationIn): NotificationPaginatedRecords @isLoggedInAndVerified @hasAccount + comms_getNotificationConfig: NotificationConf @isLoggedInAndVerified @hasAccount + comms_getSubscriptionConfig(id: ID!): Subscription +} + +type Mutation { + comms_updateNotificationConfig(config: NotificationConfIn!): NotificationConf @isLoggedInAndVerified @hasAccount + comms_updateSubscriptionConfig(config: SubscriptionIn!, id: ID!): Subscription + + comms_markNotificationAsRead(id: ID!): Notification @isLoggedInAndVerified @hasAccount +} diff --git a/apps/comms/internal/app/graph/schema.resolvers.go b/apps/comms/internal/app/graph/schema.resolvers.go new file mode 100644 index 000000000..c1d9f286b --- /dev/null +++ b/apps/comms/internal/app/graph/schema.resolvers.go @@ -0,0 +1,90 @@ +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.45 + +import ( + "context" + "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" + "github.com/kloudlite/api/apps/comms/internal/app/graph/model" + "github.com/kloudlite/api/apps/comms/internal/domain/entities" + "github.com/kloudlite/api/apps/comms/types" + "github.com/kloudlite/api/pkg/errors" + fn "github.com/kloudlite/api/pkg/functions" + "github.com/kloudlite/api/pkg/repos" +) + +// CommsUpdateNotificationConfig is the resolver for the comms_updateNotificationConfig field. +func (r *mutationResolver) CommsUpdateNotificationConfig(ctx context.Context, config entities.NotificationConf) (*entities.NotificationConf, error) { + cc, err := toCommsContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + + return r.Domain.UpdateNotificationConfig(cc, config) +} + +// CommsUpdateSubscriptionConfig is the resolver for the comms_updateSubscriptionConfig field. +func (r *mutationResolver) CommsUpdateSubscriptionConfig(ctx context.Context, config entities.Subscription, id repos.ID) (*entities.Subscription, error) { + cc, err := toCommsContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + + return r.Domain.UpdateSubscriptionConfig(cc, id, config) +} + +// CommsMarkNotificationAsRead is the resolver for the comms_markNotificationAsRead field. +func (r *mutationResolver) CommsMarkNotificationAsRead(ctx context.Context, id repos.ID) (*types.Notification, error) { + cc, err := toCommsContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + + return r.Domain.MarkNotificationAsRead(cc, id) +} + +// CommsListNotifications is the resolver for the comms_listNotifications field. +func (r *queryResolver) CommsListNotifications(ctx context.Context, pagination *repos.CursorPagination) (*model.NotificationPaginatedRecords, error) { + cc, err := toCommsContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + + pr, err := r.Domain.ListNotifications(cc, fn.DefaultIfNil(pagination, repos.DefaultCursorPagination)) + if err != nil { + return nil, errors.NewE(err) + } + + return fn.JsonConvertP[model.NotificationPaginatedRecords](pr) +} + +// CommsGetNotificationConfig is the resolver for the comms_getNotificationConfig field. +func (r *queryResolver) CommsGetNotificationConfig(ctx context.Context) (*entities.NotificationConf, error) { + cc, err := toCommsContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + + return r.Domain.GetNotificationConfig(cc) +} + +// CommsGetSubscriptionConfig is the resolver for the comms_getSubscriptionConfig field. +func (r *queryResolver) CommsGetSubscriptionConfig(ctx context.Context, id repos.ID) (*entities.Subscription, error) { + cc, err := toCommsContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + + return r.Domain.GetSubscriptionConfig(cc, id) +} + +// Mutation returns generated.MutationResolver implementation. +func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} } + +// Query returns generated.QueryResolver implementation. +func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} } + +type mutationResolver struct{ *Resolver } +type queryResolver struct{ *Resolver } diff --git a/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls new file mode 100644 index 000000000..160c86d71 --- /dev/null +++ b/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls @@ -0,0 +1,60 @@ +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig @shareable { + enabled: Boolean! + mailAddress: String! +} + +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig @shareable { + enabled: Boolean! + webhook: String! +} + +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig @shareable { + enabled: Boolean! +} + +type Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams @shareable { + clusterName: String! +} + +type Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams @shareable { + envName: String! +} + +type Github__com___kloudlite___api___common__CreatedOrUpdatedBy @shareable { + userEmail: String! + userId: String! + userName: String! +} + +type PageInfo @shareable { + endCursor: String + hasNextPage: Boolean + hasPreviousPage: Boolean + startCursor: String +} + +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn { + enabled: Boolean! + mailAddress: String! +} + +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn { + enabled: Boolean! + webhook: String! +} + +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn { + enabled: Boolean! +} + +enum Github__com___kloudlite___api___apps___comms___types__NotificationResourceType { + account + cluster + environment +} + +enum Github__com___kloudlite___api___apps___comms___types__NotificationType { + alert + notification +} + diff --git a/apps/comms/internal/app/graph/struct-to-graphql/cursorpagination.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/cursorpagination.graphqls new file mode 100644 index 000000000..58815e858 --- /dev/null +++ b/apps/comms/internal/app/graph/struct-to-graphql/cursorpagination.graphqls @@ -0,0 +1,23 @@ +type CursorPagination @shareable { + after: String + before: String + first: Int + last: Int + orderBy: String + sortDirection: CursorPaginationSortDirection +} + +input CursorPaginationIn { + after: String + before: String + first: Int + last: Int + orderBy: String = "_id" + sortDirection: CursorPaginationSortDirection = "ASC" +} + +enum CursorPaginationSortDirection { + ASC + DESC +} + diff --git a/apps/comms/internal/app/graph/struct-to-graphql/directives.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/directives.graphqls new file mode 100644 index 000000000..59d6b45c6 --- /dev/null +++ b/apps/comms/internal/app/graph/struct-to-graphql/directives.graphqls @@ -0,0 +1,6 @@ +extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@shareable", "@external"]) + +directive @goField( + forceResolver: Boolean + name: String +) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION diff --git a/apps/comms/internal/app/graph/struct-to-graphql/matchfilter.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/matchfilter.graphqls new file mode 100644 index 000000000..ef1a0cb45 --- /dev/null +++ b/apps/comms/internal/app/graph/struct-to-graphql/matchfilter.graphqls @@ -0,0 +1,20 @@ +type MatchFilter @shareable { + array: [Any!] + exact: Any + matchType: MatchFilterMatchType! + regex: String +} + +input MatchFilterIn { + array: [Any!] + exact: Any + matchType: MatchFilterMatchType! + regex: String +} + +enum MatchFilterMatchType { + array + exact + regex +} + diff --git a/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls new file mode 100644 index 000000000..73c128b14 --- /dev/null +++ b/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls @@ -0,0 +1,25 @@ +type Notification @shareable { + accountName: String! + creationTime: Date! + id: ID! + markedForDeletion: Boolean + notificationClusterParams: Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams + notificationEnvParams: Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams + notificationType: Github__com___kloudlite___api___apps___comms___types__NotificationType! + read: Boolean! + recordVersion: Int! + resourceType: Github__com___kloudlite___api___apps___comms___types__NotificationResourceType! + updateTime: Date! +} + +type NotificationEdge @shareable { + cursor: String! + node: Notification! +} + +type NotificationPaginatedRecords @shareable { + edges: [NotificationEdge!]! + pageInfo: PageInfo! + totalCount: Int! +} + diff --git a/apps/comms/internal/app/graph/struct-to-graphql/notificationconf.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/notificationconf.graphqls new file mode 100644 index 000000000..357ef34c0 --- /dev/null +++ b/apps/comms/internal/app/graph/struct-to-graphql/notificationconf.graphqls @@ -0,0 +1,20 @@ +type NotificationConf @shareable { + accountName: String! + createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + creationTime: Date! + emailConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig + id: ID! + lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + markedForDeletion: Boolean + recordVersion: Int! + slackConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig + telegramConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig + updateTime: Date! +} + +input NotificationConfIn { + emailConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn + slackConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn + telegramConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn +} + diff --git a/apps/comms/internal/app/graph/struct-to-graphql/pagination.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/pagination.graphqls new file mode 100644 index 000000000..c3bd803a3 --- /dev/null +++ b/apps/comms/internal/app/graph/struct-to-graphql/pagination.graphqls @@ -0,0 +1,10 @@ +type Pagination @shareable { + page: Int + per_page: Int +} + +input PaginationIn { + page: Int + per_page: Int +} + diff --git a/apps/comms/internal/app/graph/struct-to-graphql/scalars.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/scalars.graphqls new file mode 100644 index 000000000..1f83443a9 --- /dev/null +++ b/apps/comms/internal/app/graph/struct-to-graphql/scalars.graphqls @@ -0,0 +1,4 @@ +scalar Any +scalar Json +scalar Map +scalar Date diff --git a/apps/comms/internal/app/graph/struct-to-graphql/subscription.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/subscription.graphqls new file mode 100644 index 000000000..930c02954 --- /dev/null +++ b/apps/comms/internal/app/graph/struct-to-graphql/subscription.graphqls @@ -0,0 +1,18 @@ +type Subscription @shareable { + accountName: String! + createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + creationTime: Date! + enabled: Boolean! + id: ID! + lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + mailAddress: String! + markedForDeletion: Boolean + recordVersion: Int! + updateTime: Date! +} + +input SubscriptionIn { + enabled: Boolean! + mailAddress: String! +} + diff --git a/apps/comms/internal/app/graph/subscription.resolvers.go b/apps/comms/internal/app/graph/subscription.resolvers.go new file mode 100644 index 000000000..6b0560f0a --- /dev/null +++ b/apps/comms/internal/app/graph/subscription.resolvers.go @@ -0,0 +1,69 @@ +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.45 + +import ( + "context" + "fmt" + + "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/pkg/repos" +) + +// AccountName is the resolver for the accountName field. +func (r *subscriptionResolver) AccountName(ctx context.Context) (<-chan string, error) { + panic(fmt.Errorf("not implemented: AccountName - accountName")) +} + +// CreatedBy is the resolver for the createdBy field. +func (r *subscriptionResolver) CreatedBy(ctx context.Context) (<-chan *common.CreatedOrUpdatedBy, error) { + panic(fmt.Errorf("not implemented: CreatedBy - createdBy")) +} + +// CreationTime is the resolver for the creationTime field. +func (r *subscriptionResolver) CreationTime(ctx context.Context) (<-chan string, error) { + panic(fmt.Errorf("not implemented: CreationTime - creationTime")) +} + +// Enabled is the resolver for the enabled field. +func (r *subscriptionResolver) Enabled(ctx context.Context) (<-chan bool, error) { + panic(fmt.Errorf("not implemented: Enabled - enabled")) +} + +// ID is the resolver for the id field. +func (r *subscriptionResolver) ID(ctx context.Context) (<-chan repos.ID, error) { + panic(fmt.Errorf("not implemented: ID - id")) +} + +// LastUpdatedBy is the resolver for the lastUpdatedBy field. +func (r *subscriptionResolver) LastUpdatedBy(ctx context.Context) (<-chan *common.CreatedOrUpdatedBy, error) { + panic(fmt.Errorf("not implemented: LastUpdatedBy - lastUpdatedBy")) +} + +// MailAddress is the resolver for the mailAddress field. +func (r *subscriptionResolver) MailAddress(ctx context.Context) (<-chan string, error) { + panic(fmt.Errorf("not implemented: MailAddress - mailAddress")) +} + +// MarkedForDeletion is the resolver for the markedForDeletion field. +func (r *subscriptionResolver) MarkedForDeletion(ctx context.Context) (<-chan *bool, error) { + panic(fmt.Errorf("not implemented: MarkedForDeletion - markedForDeletion")) +} + +// RecordVersion is the resolver for the recordVersion field. +func (r *subscriptionResolver) RecordVersion(ctx context.Context) (<-chan int, error) { + panic(fmt.Errorf("not implemented: RecordVersion - recordVersion")) +} + +// UpdateTime is the resolver for the updateTime field. +func (r *subscriptionResolver) UpdateTime(ctx context.Context) (<-chan string, error) { + panic(fmt.Errorf("not implemented: UpdateTime - updateTime")) +} + +// Subscription returns generated.SubscriptionResolver implementation. +func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} } + +type subscriptionResolver struct{ *Resolver } diff --git a/apps/comms/internal/app/graph/util.go b/apps/comms/internal/app/graph/util.go new file mode 100644 index 000000000..e2bae37ec --- /dev/null +++ b/apps/comms/internal/app/graph/util.go @@ -0,0 +1,50 @@ +package graph + +import ( + "context" + "fmt" + "strings" + + "github.com/kloudlite/api/apps/comms/internal/domain" + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/pkg/errors" + "github.com/kloudlite/api/pkg/repos" +) + +func getUserId(ctx context.Context) (repos.ID, error) { + session, ok := ctx.Value("user-session").(*common.AuthSession) + + if !ok { + return "", errors.NewE(errors.Newf("context values %q is missing", "user-session")) + } + + return session.UserId, nil +} + +func toCommsContext(ctx context.Context) (domain.CommsContext, error) { + errMsgs := []string{} + + session, ok := ctx.Value("user-session").(*common.AuthSession) + if !ok { + errMsgs = append(errMsgs, fmt.Sprintf("context values %q is missing", "user-session")) + } + + accountName, ok := ctx.Value("account-name").(string) + if !ok { + errMsgs = append(errMsgs, fmt.Sprintf("context values %q is missing", "account-name")) + } + + var err error + if len(errMsgs) != 0 { + err = errors.NewE(errors.Newf("%v", strings.Join(errMsgs, ","))) + } + + return domain.CommsContext{ + Context: ctx, + AccountName: accountName, + + UserId: session.UserId, + UserName: session.UserName, + UserEmail: session.UserEmail, + }, errors.NewE(err) +} diff --git a/apps/comms/internal/app/process-notification.go b/apps/comms/internal/app/process-notification.go new file mode 100644 index 000000000..9982b17de --- /dev/null +++ b/apps/comms/internal/app/process-notification.go @@ -0,0 +1,13 @@ +package app + +import ( + "context" + + "github.com/kloudlite/api/apps/comms/internal/domain" + "github.com/kloudlite/api/pkg/logging" +) + +func processNotification(ctx context.Context, d domain.Domain, consumer NotificationConsumer, logr logging.Logger) error { + + panic("not implemented") +} diff --git a/apps/comms/internal/domain/api.go b/apps/comms/internal/domain/api.go new file mode 100644 index 000000000..a44dfd444 --- /dev/null +++ b/apps/comms/internal/domain/api.go @@ -0,0 +1,32 @@ +package domain + +import ( + "github.com/kloudlite/api/apps/comms/internal/domain/entities" + "github.com/kloudlite/api/apps/comms/types" + "github.com/kloudlite/api/pkg/repos" +) + +type Domain interface { + ListNotifications(ctx CommsContext, pagination repos.CursorPagination) (*repos.PaginatedRecord[*types.Notification], error) + MarkNotificationAsRead(ctx CommsContext, id repos.ID) (*types.Notification, error) + + GetNotificationConfig(ctx CommsContext) (*entities.NotificationConf, error) + UpdateNotificationConfig(ctx CommsContext, config entities.NotificationConf) (*entities.NotificationConf, error) + + UpdateSubscriptionConfig(ctx CommsContext, id repos.ID, config entities.Subscription) (*entities.Subscription, error) + GetSubscriptionConfig(ctx CommsContext, id repos.ID) (*entities.Subscription, error) + + CreateNotification(ctx CommsContext, notification *types.Notification) (*types.Notification, error) +} + +type PublishMsg string + +const ( + PublishAdd PublishMsg = "added" + PublishDelete PublishMsg = "deleted" + PublishUpdate PublishMsg = "updated" +) + +type ResourceEventPublisher interface { + PublishBuildNotification(cluster *types.Notification, msg PublishMsg) +} diff --git a/apps/comms/internal/domain/context.go b/apps/comms/internal/domain/context.go new file mode 100644 index 000000000..dbf59ea41 --- /dev/null +++ b/apps/comms/internal/domain/context.go @@ -0,0 +1,29 @@ +package domain + +import ( + "context" + + "github.com/kloudlite/api/pkg/repos" +) + +type CommsContext struct { + context.Context + UserId repos.ID + UserName string + AccountName string + UserEmail string +} + +func (c CommsContext) GetAccountName() string { + return c.AccountName +} + +func (c CommsContext) GetUserId() repos.ID { + return c.UserId +} +func (c CommsContext) GetUserEmail() string { + return c.UserEmail +} +func (c CommsContext) GetUserName() string { + return c.UserName +} diff --git a/apps/comms/internal/domain/entities/field-constants/gen.go b/apps/comms/internal/domain/entities/field-constants/gen.go new file mode 100644 index 000000000..05b8bcf15 --- /dev/null +++ b/apps/comms/internal/domain/entities/field-constants/gen.go @@ -0,0 +1,5 @@ +package field_constants + +//go:generate go run github.com/kloudlite/api/cmd/struct-json-path --pkg github.com/kloudlite/api/apps/comms/internal/domain/entities --common-path "metadata" --common-path "apiVersion" --common-path "kind" --common-path "status" --common-path "syncStatus" --common-path "lastUpdatedBy" --common-path "createdBy" --common-path "displayName" --common-path "creationTime" --common-path "updateTime" --common-path "id" --common-path "recordVersion" --common-path "accountName" --common-path "clusterName" --common-path "markedForDeletion" --out-file ./generated_constants.go --banner "package field_constants" --ignore-nesting "time.Time" --ignore-nesting "k8s.io/apimachinery/pkg/apis/meta/v1.Time" + +//go:generate go run github.com/kloudlite/api/cmd/struct-json-path --pkg github.com/kloudlite/api/apps/comms/types --out-file ./generated_constants_notification.go --banner "package field_constants" --ignore-nesting "time.Time" --ignore-nesting "k8s.io/apimachinery/pkg/apis/meta/v1.Time" diff --git a/apps/comms/internal/domain/entities/field-constants/generated_constants.go b/apps/comms/internal/domain/entities/field-constants/generated_constants.go new file mode 100644 index 000000000..4c1f9326f --- /dev/null +++ b/apps/comms/internal/domain/entities/field-constants/generated_constants.go @@ -0,0 +1,65 @@ +// DO NOT EDIT. generated by "github.com/kloudlite/api/cmd/struct-json-path" + +package field_constants + +// constant vars generated for struct EmailConfig +const ( + EmailConfigEnabled = "enabled" + EmailConfigMailAddress = "mailAddress" +) + +// constant vars generated for struct NotificationConf +const ( + NotificationConfEmailConfigurations = "emailConfigurations" + NotificationConfEmailConfigurationsEnabled = "emailConfigurations.enabled" + NotificationConfEmailConfigurationsMailAddress = "emailConfigurations.mailAddress" + NotificationConfSlackConfigurations = "slackConfigurations" + NotificationConfSlackConfigurationsEnabled = "slackConfigurations.enabled" + NotificationConfSlackConfigurationsWebhook = "slackConfigurations.webhook" + NotificationConfTelegramConfigurations = "telegramConfigurations" + NotificationConfTelegramConfigurationsEnabled = "telegramConfigurations.enabled" +) + +// constant vars generated for struct SlackConfig +const ( + SlackConfigEnabled = "enabled" + SlackConfigWebhook = "webhook" +) + +// constant vars generated for struct Subscription +const ( + SubscriptionConfigurations = "configurations" + SubscriptionConfigurationsAlertsEnabled = "configurations.alertsEnabled" + SubscriptionConfigurationsNotificationsEnabled = "configurations.notificationsEnabled" + SubscriptionEnabled = "enabled" + SubscriptionMailAddress = "mailAddress" +) + +// constant vars generated for struct SubscriptionConf +const ( + SubscriptionConfAlertsEnabled = "alertsEnabled" + SubscriptionConfNotificationsEnabled = "notificationsEnabled" +) + +// constant vars generated for struct TelegramConfig +const ( + TelegramConfigEnabled = "enabled" +) + +// constant vars generated for struct +const ( + AccountName = "accountName" + CreatedBy = "createdBy" + CreatedByUserEmail = "createdBy.userEmail" + CreatedByUserId = "createdBy.userId" + CreatedByUserName = "createdBy.userName" + CreationTime = "creationTime" + Id = "id" + LastUpdatedBy = "lastUpdatedBy" + LastUpdatedByUserEmail = "lastUpdatedBy.userEmail" + LastUpdatedByUserId = "lastUpdatedBy.userId" + LastUpdatedByUserName = "lastUpdatedBy.userName" + MarkedForDeletion = "markedForDeletion" + RecordVersion = "recordVersion" + UpdateTime = "updateTime" +) diff --git a/apps/comms/internal/domain/entities/field-constants/generated_constants_notification.go b/apps/comms/internal/domain/entities/field-constants/generated_constants_notification.go new file mode 100644 index 000000000..76b1b365b --- /dev/null +++ b/apps/comms/internal/domain/entities/field-constants/generated_constants_notification.go @@ -0,0 +1,33 @@ +// DO NOT EDIT. generated by "github.com/kloudlite/api/cmd/struct-json-path" + +package field_constants + +// constant vars generated for struct Notification +const ( + NotificationAccountName = "accountName" + NotificationCreationTime = "creationTime" + NotificationId = "id" + NotificationMarkedForDeletion = "markedForDeletion" + NotificationNotificationClusterParams = "notificationClusterParams" + NotificationNotificationClusterParamsClusterName = "notificationClusterParams.clusterName" + NotificationNotificationEnvParams = "notificationEnvParams" + NotificationNotificationEnvParamsEnvName = "notificationEnvParams.envName" + NotificationNotificationType = "notificationType" + NotificationRead = "read" + NotificationRecordVersion = "recordVersion" + NotificationResourceType = "resourceType" + NotificationUpdateTime = "updateTime" +) + +// constant vars generated for struct NotificationClusterParams +const ( + NotificationClusterParamsClusterName = "clusterName" +) + +// constant vars generated for struct NotificationEnvParams +const ( + NotificationEnvParamsEnvName = "envName" +) + +// constant vars generated for struct +const () diff --git a/apps/comms/internal/domain/entities/notification-configuration.go b/apps/comms/internal/domain/entities/notification-configuration.go new file mode 100644 index 000000000..88568ff55 --- /dev/null +++ b/apps/comms/internal/domain/entities/notification-configuration.go @@ -0,0 +1,47 @@ +package entities + +import ( + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/pkg/repos" +) + +type EmailConfig struct { + Enabled bool `json:"enabled"` + MailAddress string `json:"mailAddress"` +} + +type SlackConfig struct { + Enabled bool `json:"enabled"` + Webhook string `json:"webhook"` +} + +type TelegramConfig struct { + Enabled bool `json:"enabled"` +} + +type NotificationConf struct { + repos.BaseEntity `json:",inline" graphql:"noinput"` + CreatedBy common.CreatedOrUpdatedBy `json:"createdBy" graphql:"noinput"` + LastUpdatedBy common.CreatedOrUpdatedBy `json:"lastUpdatedBy" graphql:"noinput"` + + EmailConfiguration *EmailConfig `json:"emailConfigurations"` + SlackConfiguration *SlackConfig `json:"slackConfigurations"` + TelegramConfiguration *TelegramConfig `json:"telegramConfigurations"` + + AccountName string `json:"accountName" graphql:"noinput"` +} + +var NotificationConfIndexes = []repos.IndexField{ + { + Field: []repos.IndexKey{ + {Key: "id", Value: repos.IndexAsc}, + }, + Unique: true, + }, + { + Field: []repos.IndexKey{ + {Key: "accountName", Value: repos.IndexAsc}, + }, + Unique: true, + }, +} diff --git a/apps/comms/internal/domain/entities/subscription.go b/apps/comms/internal/domain/entities/subscription.go new file mode 100644 index 000000000..166ed8a41 --- /dev/null +++ b/apps/comms/internal/domain/entities/subscription.go @@ -0,0 +1,40 @@ +package entities + +import ( + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/pkg/repos" +) + +type SubscriptionConf struct { + AlertsEnabled bool `json:"alertsEnabled"` + NotificationsEnabled bool `json:"notificationsEnabled"` +} + +type Subscription struct { + repos.BaseEntity `json:",inline" graphql:"noinput"` + + CreatedBy common.CreatedOrUpdatedBy `json:"createdBy" graphql:"noinput"` + LastUpdatedBy common.CreatedOrUpdatedBy `json:"lastUpdatedBy" graphql:"noinput"` + + AccountName string `json:"accountName" graphql:"noinput"` + MailAddress string `json:"mailAddress"` + + // Configurations *SubscriptionConf `json:"configurations"` + Enabled bool `json:"enabled"` +} + +var SubscriptionIndexes = []repos.IndexField{ + { + Field: []repos.IndexKey{ + {Key: "id", Value: repos.IndexAsc}, + }, + Unique: true, + }, + { + Field: []repos.IndexKey{ + {Key: "name", Value: repos.IndexAsc}, + {Key: "accountName", Value: repos.IndexAsc}, + }, + Unique: true, + }, +} diff --git a/apps/comms/internal/domain/main.go b/apps/comms/internal/domain/main.go new file mode 100644 index 000000000..a3dbf7fee --- /dev/null +++ b/apps/comms/internal/domain/main.go @@ -0,0 +1,52 @@ +package domain + +import ( + "github.com/kloudlite/api/apps/comms/internal/domain/entities" + "github.com/kloudlite/api/apps/comms/internal/env" + "github.com/kloudlite/api/apps/comms/types" + "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/auth" + "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/iam" + "github.com/kloudlite/api/pkg/kv" + "github.com/kloudlite/api/pkg/logging" + "github.com/kloudlite/api/pkg/repos" + "go.uber.org/fx" +) + +type Impl struct { + notificationRepo repos.DbRepo[*types.Notification] + subscriptionRepo repos.DbRepo[*entities.Subscription] + notificationConfigRepo repos.DbRepo[*entities.NotificationConf] + + iamClient iam.IAMClient + envs *env.Env + logger logging.Logger + cacheClient kv.BinaryDataRepo + authClient auth.AuthClient + + resourceEventPublisher ResourceEventPublisher +} + +var Module = fx.Module("domain", fx.Provide(func(e *env.Env, + notificationRepo repos.DbRepo[*types.Notification], + subscriptionRepo repos.DbRepo[*entities.Subscription], + notificationConfigRepo repos.DbRepo[*entities.NotificationConf], + + logger logging.Logger, + iamClient iam.IAMClient, + cacheClient kv.BinaryDataRepo, + authClient auth.AuthClient, + resourceEventPublisher ResourceEventPublisher, +) (Domain, error) { + return &Impl{ + iamClient: iamClient, + envs: e, + logger: logger, + cacheClient: cacheClient, + authClient: authClient, + resourceEventPublisher: resourceEventPublisher, + + notificationRepo: notificationRepo, + subscriptionRepo: subscriptionRepo, + notificationConfigRepo: notificationConfigRepo, + }, nil +})) diff --git a/apps/comms/internal/domain/notification-config.go b/apps/comms/internal/domain/notification-config.go new file mode 100644 index 000000000..e4ed08dfd --- /dev/null +++ b/apps/comms/internal/domain/notification-config.go @@ -0,0 +1,82 @@ +package domain + +import ( + "github.com/kloudlite/api/apps/comms/internal/domain/entities" + iamT "github.com/kloudlite/api/apps/iam/types" + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/common/fields" + "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/iam" + "github.com/kloudlite/api/pkg/errors" + "github.com/kloudlite/api/pkg/repos" +) + +func (d *Impl) GetNotificationConfig(ctx CommsContext) (*entities.NotificationConf, error) { + co, err := d.iamClient.Can(ctx, &iam.CanIn{ + UserId: string(ctx.UserId), + ResourceRefs: []string{iamT.NewResourceRef(ctx.AccountName, iamT.ResourceAccount, ctx.AccountName)}, + Action: string(iamT.GetAccount), + }) + if err != nil { + return nil, err + } + + if !co.Status { + return nil, errors.NewE(errors.Newf("user %s does not have permission to get account %s", ctx.UserId, ctx.AccountName)) + } + + nc, err := d.notificationConfigRepo.FindOne(ctx, repos.Filter{}) + if err != nil { + return nil, err + } + + if nc == nil { + n, err := d.notificationConfigRepo.Create(ctx, &entities.NotificationConf{ + CreatedBy: common.CreatedOrUpdatedBy{ + UserId: ctx.UserId, + UserName: ctx.UserName, + UserEmail: ctx.UserEmail, + }, + AccountName: ctx.AccountName, + }) + if err != nil { + return nil, err + } + + nc = n + } + + return nc, nil +} +func (d *Impl) UpdateNotificationConfig(ctx CommsContext, config entities.NotificationConf) (*entities.NotificationConf, error) { + co, err := d.iamClient.Can(ctx, &iam.CanIn{ + UserId: string(ctx.UserId), + ResourceRefs: []string{ + iamT.NewResourceRef(ctx.AccountName, iamT.ResourceAccount, ctx.AccountName), + }, + Action: string(iamT.UpdateAccount), + }) + if err != nil { + return nil, err + } + + if !co.Status { + return nil, errors.NewE(errors.Newf("user %s does not have permission to update account %s", ctx.UserId, ctx.AccountName)) + } + + xnc, err := d.notificationConfigRepo.FindOne(ctx, repos.Filter{ + fields.AccountName: ctx.AccountName, + }) + if err != nil { + return nil, err + } + + if xnc == nil { + return nil, errors.NewE(errors.Newf("notification config not found")) + } + + xnc.EmailConfiguration = config.EmailConfiguration + xnc.SlackConfiguration = config.SlackConfiguration + xnc.TelegramConfiguration = config.TelegramConfiguration + + return d.notificationConfigRepo.UpdateById(ctx, xnc.Id, xnc) +} diff --git a/apps/comms/internal/domain/notification.go b/apps/comms/internal/domain/notification.go new file mode 100644 index 000000000..dbc469e52 --- /dev/null +++ b/apps/comms/internal/domain/notification.go @@ -0,0 +1,77 @@ +package domain + +import ( + "github.com/kloudlite/api/apps/comms/types" + iamT "github.com/kloudlite/api/apps/iam/types" + "github.com/kloudlite/api/common/fields" + "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/iam" + "github.com/kloudlite/api/pkg/errors" + "github.com/kloudlite/api/pkg/repos" +) + +func (d *Impl) ListNotifications(ctx CommsContext, pagination repos.CursorPagination) (*repos.PaginatedRecord[*types.Notification], error) { + co, err := d.iamClient.Can(ctx, &iam.CanIn{ + UserId: string(ctx.UserId), + ResourceRefs: []string{iamT.NewResourceRef(ctx.AccountName, iamT.ResourceAccount, ctx.AccountName)}, + Action: string(iamT.GetAccount), + }) + + if err != nil { + return nil, err + } + + if !co.Status { + return nil, errors.NewE(errors.Newf("user %s does not have permission to get account %s", ctx.UserId, ctx.AccountName)) + } + + n, err := d.notificationRepo.FindPaginated(ctx, repos.Filter{ + fields.AccountName: ctx.AccountName, + }, pagination) + if err != nil { + return nil, err + } + + return n, nil +} + +func (d *Impl) MarkNotificationAsRead(ctx CommsContext, id repos.ID) (*types.Notification, error) { + co, err := d.iamClient.Can(ctx, &iam.CanIn{ + UserId: string(ctx.UserId), + ResourceRefs: []string{iamT.NewResourceRef(ctx.AccountName, iamT.ResourceAccount, ctx.AccountName)}, + Action: string(iamT.UpdateAccount), + }) + + if err != nil { + return nil, err + } + + if !co.Status { + return nil, errors.NewE(errors.Newf("user %s does not have permission to update account %s", ctx.UserId, ctx.AccountName)) + } + + xnotf, err := d.notificationRepo.FindOne(ctx, repos.Filter{ + fields.AccountName: ctx.AccountName, + fields.Id: id, + }) + if err != nil { + return nil, err + } + + if xnotf == nil { + return nil, errors.NewE(errors.Newf("notification with id %s not found", id)) + } + + xnotf.Read = true + + n, err := d.notificationRepo.UpdateById(ctx, id, xnotf) + if err != nil { + return nil, err + } + + return n, nil +} + +func (d *Impl) CreateNotification(ctx CommsContext, notification *types.Notification) (*types.Notification, error) { + + return nil, nil +} diff --git a/apps/comms/internal/domain/subscription.go b/apps/comms/internal/domain/subscription.go new file mode 100644 index 000000000..5b1951890 --- /dev/null +++ b/apps/comms/internal/domain/subscription.go @@ -0,0 +1,49 @@ +package domain + +import ( + "github.com/kloudlite/api/apps/comms/internal/domain/entities" + fc "github.com/kloudlite/api/apps/comms/internal/domain/entities/field-constants" + "github.com/kloudlite/api/common/fields" + "github.com/kloudlite/api/pkg/errors" + "github.com/kloudlite/api/pkg/repos" +) + +func (d *Impl) isMailAddressValid(ctx CommsContext, id, mailAddress string) bool { + if mailAddress == "" { + return false + } + + if id == "" { + return false + } + + s, err := d.subscriptionRepo.FindOne(ctx, repos.Filter{ + fc.SubscriptionMailAddress: mailAddress, + fields.Id: id, + }) + + if err != nil { + return false + } + + return s != nil +} + +func (d *Impl) UpdateSubscriptionConfig(ctx CommsContext, id repos.ID, config entities.Subscription) (*entities.Subscription, error) { + if config.MailAddress == "" { + return nil, errors.NewE(errors.New("mail address is required")) + } + + b := d.isMailAddressValid(ctx, string(id), config.MailAddress) + if !b { + return nil, errors.NewE(errors.New("mail address is not valid")) + } + + return d.subscriptionRepo.UpdateOne(ctx, repos.Filter{ + fields.Id: id, + }, &config) +} + +func (d *Impl) GetSubscriptionConfig(ctx CommsContext, id repos.ID) (*entities.Subscription, error) { + return d.subscriptionRepo.FindOne(ctx, repos.Filter{fields.Id: id}) +} diff --git a/apps/comms/internal/env/env.go b/apps/comms/internal/env/env.go index 4fddf1497..c9605efd8 100644 --- a/apps/comms/internal/env/env.go +++ b/apps/comms/internal/env/env.go @@ -16,6 +16,12 @@ type Env struct { ResetPasswordWebUrl string `env:"RESET_PASSWORD_WEB_URL" required:"true"` VerifyEmailWebUrl string `env:"VERIFY_EMAIL_WEB_URL" required:"true"` + + AccountCookieName string `env:"ACCOUNT_COOKIE_NAME" required:"true"` + + // NATS:start + NotificationNatsStream string `env:"NOTIFICATION_NATS_STREAM" required:"true"` + // NATS:start } func LoadEnv() (*Env, error) { diff --git a/apps/comms/types/types.go b/apps/comms/types/types.go new file mode 100644 index 000000000..2e9cabb78 --- /dev/null +++ b/apps/comms/types/types.go @@ -0,0 +1,66 @@ +package types + +import ( + "github.com/kloudlite/api/pkg/egob" + "github.com/kloudlite/api/pkg/repos" +) + +type EnvResources string + +const ( + EnvResourcesApps EnvResources = "apps" + EnvResourcesConfigs EnvResources = "configs" + EnvResourcesSecrets EnvResources = "secrets" + EnvResourcesManagedResources EnvResources = "managedResources" +) + +type NotificationEnvParams struct { + EnvName string `json:"envName" graphql:"noinput"` +} + +type NotificationClusterParams struct { + ClusterName string `json:"clusterName" graphql:"noinput"` +} + +type NotificationResourceType string +type NotificationType string + +const ( + NotificationTypeAlert NotificationType = "alert" + NotificationTypeNotification NotificationType = "notification" +) + +const ( + NotificationResourceTypeEnvironment NotificationResourceType = "environment" + NotificationResourceTypeCluster NotificationResourceType = "cluster" + NotificationResourceTypeAccount NotificationResourceType = "account" +) + +type Notification struct { + repos.BaseEntity `json:",inline" graphql:"noinput"` + ResourceType NotificationResourceType `json:"resourceType" graphql:"noinput"` + NotificationType NotificationType `json:"notificationType" graphql:"noinput"` + + NotificationEnvParams *NotificationEnvParams `json:"notificationEnvParams" graphql:"noinput"` + NotificationClusterParams *NotificationClusterParams `json:"notificationClusterParams" graphql:"noinput"` + + AccountName string `json:"accountName" graphql:"noinput"` + Read bool `json:"read" graphql:"noinput"` +} + +func (obj *Notification) ToBytes() ([]byte, error) { + return egob.Marshal(obj) +} + +func (obj *Notification) ParseBytes(data []byte) error { + return egob.Unmarshal(data, obj) +} + +var NotificationIndexes = []repos.IndexField{ + { + Field: []repos.IndexKey{ + {Key: "id", Value: repos.IndexAsc}, + }, + Unique: true, + }, +} diff --git a/apps/iam/internal/domain/domain_test.go b/apps/iam/internal/domain/domain_test.go index b6f41dadc..8c144c80f 100644 --- a/apps/iam/internal/domain/domain_test.go +++ b/apps/iam/internal/domain/domain_test.go @@ -1,182 +1,182 @@ package domain_test -import ( - "context" - "errors" - - "github.com/kloudlite/api/apps/iam/internal/domain" - "github.com/kloudlite/api/apps/iam/internal/entities" - t "github.com/kloudlite/api/apps/iam/types" - "github.com/kloudlite/api/common" - reposMock "github.com/kloudlite/api/mocks/pkg/repos" - "github.com/kloudlite/api/pkg/repos" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -var _ = Describe("domain.AddRoleBinding() says", func() { - var rbRepo *reposMock.DbRepo[*entities.RoleBinding] - // var roleBindingMap map[t.Action][]t.Role - - BeforeEach(func() { - rbRepo = reposMock.NewDbRepo[*entities.RoleBinding]() - }) - - When("role binding already exists", func() { - BeforeEach(func() { - rbRepo.MockFindOne = func(ctx context.Context, filter repos.Filter) (*entities.RoleBinding, error) { - return &entities.RoleBinding{}, nil - } - }) - - It("should return error", func() { - d := domain.NewDomain(rbRepo, nil) - _, err := d.AddRoleBinding(context.Background(), entities.RoleBinding{ - UserId: "sample", - ResourceType: "sample", - ResourceRef: "sample", - Role: "sample", - }) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("already exists")) - }) - }) - - When("role binding does not exist", func() { - BeforeEach(func() { - rbRepo.MockFindOne = func(ctx context.Context, filter repos.Filter) (*entities.RoleBinding, error) { - return nil, nil - } - }) - - It("creating an empty role binding should throw validation error", func() { - d := domain.NewDomain(rbRepo, nil) - _, err := d.AddRoleBinding(context.Background(), entities.RoleBinding{}) - Expect(err).To(HaveOccurred()) - Expect(errors.As(err, &common.ValidationError{})).To(BeTrue()) - }) - - It("should create a new role binding", func() { - rbRepo.MockCreate = func(ctx context.Context, data *entities.RoleBinding) (*entities.RoleBinding, error) { - return data, nil - } - d := domain.NewDomain(rbRepo, nil) - _, err := d.AddRoleBinding(context.Background(), entities.RoleBinding{ - UserId: "sample", - ResourceType: "sample", - ResourceRef: "sample", - Role: "sample", - }) - Expect(err).NotTo(HaveOccurred()) - }) - }) -}) - -var _ = Describe("domain.Can() says", func() { - var rbRepo *reposMock.DbRepo[*entities.RoleBinding] - - BeforeEach(func() { - rbRepo = reposMock.NewDbRepo[*entities.RoleBinding]() - }) - - When("no action-role-binding map exists", func() { - It("should fail with error", func() { - d := domain.NewDomain(rbRepo, nil) - _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample") - Expect(err).To(HaveOccurred()) - Expect(errors.As(err, &domain.UnAuthorizedError{})).To(BeTrue()) - }) - }) - - Context("when action-role-binging map exists", func() { - When("no role bindings exist in db", func() { - It("should fail with error", func() { - rbRepo.MockFind = func(ctx context.Context, query repos.Query) ([]*entities.RoleBinding, error) { - return nil, nil - } - d := domain.NewDomain(rbRepo, map[t.Action][]t.Role{"sample": {"sample"}}) - _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample") - Expect(err).To(HaveOccurred()) - Expect(errors.As(err, &domain.UnAuthorizedError{})).To(BeTrue()) - }) - }) - - When("action is not permitted for the role", func() { - It("1. if allowed roles is empty, should fail with error", func() { - rbRepo.MockFind = func(ctx context.Context, query repos.Query) ([]*entities.RoleBinding, error) { - return []*entities.RoleBinding{ - { - UserId: "sample", - ResourceType: "sample-resource", - ResourceRef: "sample", - Role: "sample", - }, - }, nil - } - - actionRoleBindings := map[t.Action][]t.Role{ - "sample-action": {}, - } - - d := domain.NewDomain(rbRepo, actionRoleBindings) - _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample-action") - Expect(err).To(HaveOccurred()) - Expect(errors.As(err, &domain.UnAuthorizedError{})).To(BeTrue()) - }) - - It("2. if allowed roles does not contain current role, should fail with error", func() { - rbRepo.MockFind = func(ctx context.Context, query repos.Query) ([]*entities.RoleBinding, error) { - return []*entities.RoleBinding{ - { - UserId: "sample-userid", - ResourceType: "sample-resource", - ResourceRef: "sample-resourceRef", - Role: "sample-role", - }, - }, nil - } - - actionRoleBindings := map[t.Action][]t.Role{ - "sample-action": {"example-role"}, - } - - d := domain.NewDomain(rbRepo, actionRoleBindings) - _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample-action") - Expect(err).To(HaveOccurred()) - Expect(errors.As(err, &domain.UnAuthorizedError{})).To(BeTrue()) - }) - }) - - When("action is permitted for the role", func() { - It("should return true", func() { - rbRepo.MockFind = func(ctx context.Context, query repos.Query) ([]*entities.RoleBinding, error) { - return []*entities.RoleBinding{ - { - UserId: "sample-userid", - ResourceType: "sample-resource", - ResourceRef: "sample-resourceRef", - Role: "sample-role", - }, - }, nil - } - - actionRoleBindings := map[t.Action][]t.Role{ - "sample-action": {"sample-role"}, - } - - d := domain.NewDomain(rbRepo, actionRoleBindings) - _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample-action") - Expect(err).NotTo(HaveOccurred()) - }) - }) - }) - - Context("when system is internally accessing resources", func() { - It("should allow", func() { - d := domain.NewDomain(rbRepo, map[t.Action][]t.Role{"sample-action": {"sample"}}) - can, err := d.Can(context.Background(), "sys-user", []string{"sample"}, "sample-action") - Expect(err).NotTo(HaveOccurred()) - Expect(can).To(BeTrue()) - }) - }) -}) +// import ( +// "context" +// "errors" +// +// "github.com/kloudlite/api/apps/iam/internal/domain" +// "github.com/kloudlite/api/apps/iam/internal/entities" +// t "github.com/kloudlite/api/apps/iam/types" +// "github.com/kloudlite/api/common" +// reposMock "github.com/kloudlite/api/mocks/pkg/repos" +// "github.com/kloudlite/api/pkg/repos" +// . "github.com/onsi/ginkgo/v2" +// . "github.com/onsi/gomega" +// ) +// +// var _ = Describe("domain.AddRoleBinding() says", func() { +// var rbRepo *reposMock.DbRepo[*entities.RoleBinding] +// // var roleBindingMap map[t.Action][]t.Role +// +// BeforeEach(func() { +// rbRepo = reposMock.NewDbRepo[*entities.RoleBinding]() +// }) +// +// When("role binding already exists", func() { +// BeforeEach(func() { +// rbRepo.MockFindOne = func(ctx context.Context, filter repos.Filter) (*entities.RoleBinding, error) { +// return &entities.RoleBinding{}, nil +// } +// }) +// +// It("should return error", func() { +// d := domain.NewDomain(rbRepo, nil) +// _, err := d.AddRoleBinding(context.Background(), entities.RoleBinding{ +// UserId: "sample", +// ResourceType: "sample", +// ResourceRef: "sample", +// Role: "sample", +// }) +// Expect(err).To(HaveOccurred()) +// Expect(err.Error()).To(ContainSubstring("already exists")) +// }) +// }) +// +// When("role binding does not exist", func() { +// BeforeEach(func() { +// rbRepo.MockFindOne = func(ctx context.Context, filter repos.Filter) (*entities.RoleBinding, error) { +// return nil, nil +// } +// }) +// +// It("creating an empty role binding should throw validation error", func() { +// d := domain.NewDomain(rbRepo, nil) +// _, err := d.AddRoleBinding(context.Background(), entities.RoleBinding{}) +// Expect(err).To(HaveOccurred()) +// Expect(errors.As(err, &common.ValidationError{})).To(BeTrue()) +// }) +// +// It("should create a new role binding", func() { +// rbRepo.MockCreate = func(ctx context.Context, data *entities.RoleBinding) (*entities.RoleBinding, error) { +// return data, nil +// } +// d := domain.NewDomain(rbRepo, nil) +// _, err := d.AddRoleBinding(context.Background(), entities.RoleBinding{ +// UserId: "sample", +// ResourceType: "sample", +// ResourceRef: "sample", +// Role: "sample", +// }) +// Expect(err).NotTo(HaveOccurred()) +// }) +// }) +// }) +// +// var _ = Describe("domain.Can() says", func() { +// var rbRepo *reposMock.DbRepo[*entities.RoleBinding] +// +// BeforeEach(func() { +// rbRepo = reposMock.NewDbRepo[*entities.RoleBinding]() +// }) +// +// When("no action-role-binding map exists", func() { +// It("should fail with error", func() { +// d := domain.NewDomain(rbRepo, nil) +// _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample") +// Expect(err).To(HaveOccurred()) +// Expect(errors.As(err, &domain.UnAuthorizedError{})).To(BeTrue()) +// }) +// }) +// +// Context("when action-role-binging map exists", func() { +// When("no role bindings exist in db", func() { +// It("should fail with error", func() { +// rbRepo.MockFind = func(ctx context.Context, query repos.Query) ([]*entities.RoleBinding, error) { +// return nil, nil +// } +// d := domain.NewDomain(rbRepo, map[t.Action][]t.Role{"sample": {"sample"}}) +// _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample") +// Expect(err).To(HaveOccurred()) +// Expect(errors.As(err, &domain.UnAuthorizedError{})).To(BeTrue()) +// }) +// }) +// +// When("action is not permitted for the role", func() { +// It("1. if allowed roles is empty, should fail with error", func() { +// rbRepo.MockFind = func(ctx context.Context, query repos.Query) ([]*entities.RoleBinding, error) { +// return []*entities.RoleBinding{ +// { +// UserId: "sample", +// ResourceType: "sample-resource", +// ResourceRef: "sample", +// Role: "sample", +// }, +// }, nil +// } +// +// actionRoleBindings := map[t.Action][]t.Role{ +// "sample-action": {}, +// } +// +// d := domain.NewDomain(rbRepo, actionRoleBindings) +// _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample-action") +// Expect(err).To(HaveOccurred()) +// Expect(errors.As(err, &domain.UnAuthorizedError{})).To(BeTrue()) +// }) +// +// It("2. if allowed roles does not contain current role, should fail with error", func() { +// rbRepo.MockFind = func(ctx context.Context, query repos.Query) ([]*entities.RoleBinding, error) { +// return []*entities.RoleBinding{ +// { +// UserId: "sample-userid", +// ResourceType: "sample-resource", +// ResourceRef: "sample-resourceRef", +// Role: "sample-role", +// }, +// }, nil +// } +// +// actionRoleBindings := map[t.Action][]t.Role{ +// "sample-action": {"example-role"}, +// } +// +// d := domain.NewDomain(rbRepo, actionRoleBindings) +// _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample-action") +// Expect(err).To(HaveOccurred()) +// Expect(errors.As(err, &domain.UnAuthorizedError{})).To(BeTrue()) +// }) +// }) +// +// When("action is permitted for the role", func() { +// It("should return true", func() { +// rbRepo.MockFind = func(ctx context.Context, query repos.Query) ([]*entities.RoleBinding, error) { +// return []*entities.RoleBinding{ +// { +// UserId: "sample-userid", +// ResourceType: "sample-resource", +// ResourceRef: "sample-resourceRef", +// Role: "sample-role", +// }, +// }, nil +// } +// +// actionRoleBindings := map[t.Action][]t.Role{ +// "sample-action": {"sample-role"}, +// } +// +// d := domain.NewDomain(rbRepo, actionRoleBindings) +// _, err := d.Can(context.Background(), "sample", []string{"sample"}, "sample-action") +// Expect(err).NotTo(HaveOccurred()) +// }) +// }) +// }) +// +// Context("when system is internally accessing resources", func() { +// It("should allow", func() { +// d := domain.NewDomain(rbRepo, map[t.Action][]t.Role{"sample-action": {"sample"}}) +// can, err := d.Can(context.Background(), "sys-user", []string{"sample"}, "sample-action") +// Expect(err).NotTo(HaveOccurred()) +// Expect(can).To(BeTrue()) +// }) +// }) +// }) diff --git a/common/kafka-topic-name.go b/common/kafka-topic-name.go index 8645bf5a5..ba46731a2 100644 --- a/common/kafka-topic-name.go +++ b/common/kafka-topic-name.go @@ -7,6 +7,7 @@ type topicName string const ( GitWebhookTopicName topicName = "events.webhooks.git" AuditEventLogTopicName topicName = "events.audit.event-log" + NotificationTopicName topicName = "events.notification" ) func GetKafkaTopicName(accountName string, clusterName string) string { diff --git a/go.mod b/go.mod index 43a3ef4d1..33fdd3b78 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/kloudlite/api go 1.21.1 require ( - github.com/99designs/gqlgen v0.17.39 + github.com/99designs/gqlgen v0.17.45 github.com/Masterminds/sprig/v3 v3.2.3 github.com/aws/aws-sdk-go v1.45.11 github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 @@ -28,7 +28,7 @@ require ( go.uber.org/fx v1.17.1 go.uber.org/zap v1.26.0 golang.org/x/oauth2 v0.13.0 - golang.org/x/sync v0.6.0 + golang.org/x/sync v0.7.0 google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.33.0 gopkg.in/yaml.v2 v2.4.0 // indirect @@ -49,7 +49,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/ztrue/tracerr v0.4.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/net v0.22.0 + golang.org/x/net v0.24.0 ) require ( @@ -144,13 +144,13 @@ require ( github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect go.uber.org/dig v1.14.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.21.0 // indirect - golang.org/x/mod v0.16.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/term v0.18.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.19.0 + golang.org/x/tools v0.20.0 golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 6bd42891a..c0df223cc 100644 --- a/go.sum +++ b/go.sum @@ -2,14 +2,16 @@ cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopT cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -github.com/99designs/gqlgen v0.17.39 h1:wPTAyc2fqVjAWT5DsJ21k/lLudgnXzURwbsjVNegFpU= -github.com/99designs/gqlgen v0.17.39/go.mod h1:b62q1USk82GYIVjC60h02YguAZLqYZtvWml8KkhJps4= +github.com/99designs/gqlgen v0.17.45 h1:bH0AH67vIJo8JKNKPJP+pOPpQhZeuVRQLf53dKIpDik= +github.com/99designs/gqlgen v0.17.45/go.mod h1:Bas0XQ+Jiu/Xm5E33jC8sES3G+iC2esHBMXcq0fUPs0= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= +github.com/PuerkitoBio/goquery v1.9.1 h1:mTL6XjbJTZdpfL+Gwl5U2h1l9yEkJjhmlTeV9VPW7UI= +github.com/PuerkitoBio/goquery v1.9.1/go.mod h1:cW1n6TmIMDoORQU5IU/P1T3tGFunOeXEpGP2WHRwkbY= github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= @@ -17,6 +19,8 @@ github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= +github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= +github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/aws/aws-sdk-go v1.45.11 h1:8qiSrA12+NRr+2MVpMApi3JxtiFFjDVU1NeWe+80bYg= @@ -161,8 +165,6 @@ github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLA github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/kloudlite/container-registry-authorizer v0.0.0-20231021122509-161dc30fde55 h1:YnZh3TL6AG4EfoInx1/L5zcPHd2QxgLKseJB1KtHjdQ= github.com/kloudlite/container-registry-authorizer v0.0.0-20231021122509-161dc30fde55/go.mod h1:GZj3wZmIw/qCciclRhgQTgmGiqe8wxoVzMXQjbOfnbc= -github.com/kloudlite/operator v1.0.4-0.20240409082541-b8ead24a9fad h1:uJWUGbOPS72pxoFpxRpqr3bT9cBptRcNseytCWY/2KE= -github.com/kloudlite/operator v1.0.4-0.20240409082541-b8ead24a9fad/go.mod h1:ozyCDuQNCcMRu2XYZz4OtWr38IwRZ50ZCOcBsobj60c= github.com/kloudlite/operator v1.0.4-0.20240410110352-9d89459d8651 h1:O4iQybfIdEs0Dl0wSUrju6Dtw9X5HrOBDjrpyqnkGhA= github.com/kloudlite/operator v1.0.4-0.20240410110352-9d89459d8651/go.mod h1:ozyCDuQNCcMRu2XYZz4OtWr38IwRZ50ZCOcBsobj60c= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -342,15 +344,15 @@ golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= -golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -363,8 +365,8 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= -golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= @@ -373,8 +375,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -396,14 +398,14 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -421,8 +423,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= -golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/egob/main.go b/pkg/egob/main.go new file mode 100644 index 000000000..e9be6b37e --- /dev/null +++ b/pkg/egob/main.go @@ -0,0 +1,24 @@ +package egob + +import ( + "bytes" + "encoding/gob" +) + +func Marshal(obj any) ([]byte, error) { + var buf bytes.Buffer + enc := gob.NewEncoder(&buf) + if err := enc.Encode(obj); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func Unmarshal(data []byte, obj any) error { + buf := bytes.NewBuffer(data) + dec := gob.NewDecoder(buf) + if err := dec.Decode(obj); err != nil { + return err + } + return nil +} From bfc69dfeb596b2e8f330efac837a8e1027adf141 Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Wed, 5 Jun 2024 17:35:01 +0530 Subject: [PATCH 2/5] :sparkles: Added notification support in comms --- apps/comms/email-templates/alert/email.html | 186 ++ apps/comms/email-templates/alert/email.mjml | 33 + apps/comms/email-templates/alert/email.txt | 7 + apps/comms/internal/app/app.go | 65 +- .../internal/app/graph/generated/generated.go | 1646 +++++++++++------ .../app/graph/matchfilter.resolvers.go | 33 + .../internal/app/graph/model/models_gen.go | 98 +- .../app/graph/notification.resolvers.go | 52 +- .../app/graph/notificationconf.resolvers.go | 74 +- .../struct-to-graphql/common-types.graphqls | 45 +- .../struct-to-graphql/matchfilter.graphqls | 12 +- .../struct-to-graphql/notification.graphqls | 4 +- .../notificationconf.graphqls | 14 +- apps/comms/internal/app/grpc-server.go | 60 +- .../internal/app/process-notification.go | 19 +- apps/comms/internal/domain/api.go | 4 +- .../entities/notification-configuration.go | 24 +- .../internal/domain/entities/subscription.go | 13 +- apps/comms/internal/domain/mail-parser.go | 99 + apps/comms/internal/domain/main.go | 12 + .../internal/domain/notification-config.go | 10 +- apps/comms/internal/domain/notification.go | 24 +- .../internal/domain/process-notification.go | 186 ++ apps/comms/main.go | 6 +- apps/comms/types/types.go | 54 +- 25 files changed, 1941 insertions(+), 839 deletions(-) create mode 100644 apps/comms/email-templates/alert/email.html create mode 100644 apps/comms/email-templates/alert/email.mjml create mode 100644 apps/comms/email-templates/alert/email.txt create mode 100644 apps/comms/internal/app/graph/matchfilter.resolvers.go create mode 100644 apps/comms/internal/domain/mail-parser.go create mode 100644 apps/comms/internal/domain/process-notification.go diff --git a/apps/comms/email-templates/alert/email.html b/apps/comms/email-templates/alert/email.html new file mode 100644 index 000000000..9b46c01a9 --- /dev/null +++ b/apps/comms/email-templates/alert/email.html @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ +
+
+

+

+ +
+
{{.Type}}: {{.Titile}}
+
+
{{.Body}}
+
+ + + + +
+ View Alerts +
+
+
Alternatively, you can copy and paste the following URL into your browser: {{.Link}}
+
+
If you have any questions or need assistance, please don't hesitate to contact us.
+
+
- Team Kloudlite
+
+

+

+ +
+
+ +
+
+ +
+ + + diff --git a/apps/comms/email-templates/alert/email.mjml b/apps/comms/email-templates/alert/email.mjml new file mode 100644 index 000000000..d74a7b5bd --- /dev/null +++ b/apps/comms/email-templates/alert/email.mjml @@ -0,0 +1,33 @@ + + + + + + + + + + + {{.Type}}: {{.Titile}} + + + {{.Body}} + + + View Alerts + + + Alternatively, you can copy and paste the following URL into your browser: + {{.Link}} + + + If you have any questions or need assistance, please don't hesitate to contact us. + + + - Team Kloudlite + + + + + + diff --git a/apps/comms/email-templates/alert/email.txt b/apps/comms/email-templates/alert/email.txt new file mode 100644 index 000000000..0a5ba62ac --- /dev/null +++ b/apps/comms/email-templates/alert/email.txt @@ -0,0 +1,7 @@ +{{.Type}}: {{.Titile}} + +{{.Body}} + +If you have any questions or need assistance, please don't hesitate to contact us. + +- Team Kloudlite diff --git a/apps/comms/internal/app/app.go b/apps/comms/internal/app/app.go index 595ca82fa..6520cb691 100644 --- a/apps/comms/internal/app/app.go +++ b/apps/comms/internal/app/app.go @@ -2,9 +2,6 @@ package app import ( "context" - "embed" - "fmt" - "text/template" "github.com/99designs/gqlgen/graphql" "github.com/gofiber/fiber/v2" @@ -37,49 +34,6 @@ type NotificationConsumer messaging.Consumer type CommsGrpcServer grpc.Server -type EmailTemplatesDir struct { - embed.FS -} - -type EmailTemplate struct { - Subject string - Html *template.Template - PlainText *template.Template -} - -type AccountInviteEmail *EmailTemplate -type ProjectInviteEmail *EmailTemplate -type RestPasswordEmail *EmailTemplate -type UserVerificationEmail *EmailTemplate -type WelcomeEmail *EmailTemplate -type WaitingEmail *EmailTemplate - -func parseTemplate(et EmailTemplatesDir, templateName string, subject string) (*EmailTemplate, error) { - txtFile, err := et.ReadFile(fmt.Sprintf("email-templates/%v/email.txt", templateName)) - if err != nil { - return nil, errors.NewE(err) - } - txt, err := template.New("email-text").Parse(string(txtFile)) - if err != nil { - return nil, errors.NewE(err) - } - - htmlFile, err := et.ReadFile(fmt.Sprintf("email-templates/%v/email.html", templateName)) - if err != nil { - return nil, errors.NewE(err) - } - html, err := template.New(templateName).Parse(string(htmlFile)) - if err != nil { - return nil, errors.NewE(err) - } - - return &EmailTemplate{ - Subject: subject, - Html: html, - PlainText: txt, - }, nil -} - var Module = fx.Module("app", repos.NewFxMongoRepo[*entities.NotificationConf]("nconfs", "prj", entities.NotificationConfIndexes), repos.NewFxMongoRepo[*entities.Subscription]("subscriptions", "prj", entities.SubscriptionIndexes), @@ -101,23 +55,8 @@ var Module = fx.Module("app", }) }), - fx.Provide(func(et EmailTemplatesDir) (AccountInviteEmail, error) { - return parseTemplate(et, "account-invite", "[Kloudlite] Account Invite") - }), - fx.Provide(func(et EmailTemplatesDir) (ProjectInviteEmail, error) { - return parseTemplate(et, "project-invite", "[Kloudlite] Project Invite") - }), - fx.Provide(func(et EmailTemplatesDir) (RestPasswordEmail, error) { - return parseTemplate(et, "reset-password", "[Kloudlite] Reset Password") - }), - fx.Provide(func(et EmailTemplatesDir) (UserVerificationEmail, error) { - return parseTemplate(et, "user-verification", "[Kloudlite] Verify Email") - }), - fx.Provide(func(et EmailTemplatesDir) (WelcomeEmail, error) { - return parseTemplate(et, "welcome", "[Kloudlite] Welcome to Kloudlite") - }), - fx.Provide(func(et EmailTemplatesDir) (WaitingEmail, error) { - return parseTemplate(et, "waiting", "[Kloudlite] Welcome to Kloudlite") + fx.Provide(func(et domain.EmailTemplatesDir) (*domain.EmailTemplates, error) { + return domain.GetEmailTemplates(et) }), fx.Provide(newCommsSvc), diff --git a/apps/comms/internal/app/graph/generated/generated.go b/apps/comms/internal/app/graph/generated/generated.go index 03962e33b..b4b7375a5 100644 --- a/apps/comms/internal/app/graph/generated/generated.go +++ b/apps/comms/internal/app/graph/generated/generated.go @@ -46,11 +46,13 @@ type Config struct { type ResolverRoot interface { Github__com___kloudlite___api___common__CreatedOrUpdatedBy() Github__com___kloudlite___api___common__CreatedOrUpdatedByResolver + MatchFilter() MatchFilterResolver Mutation() MutationResolver Notification() NotificationResolver NotificationConf() NotificationConfResolver Query() QueryResolver Subscription() SubscriptionResolver + MatchFilterIn() MatchFilterInResolver NotificationConfIn() NotificationConfInResolver } @@ -69,26 +71,34 @@ type ComplexityRoot struct { SortDirection func(childComplexity int) int } - Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig struct { + Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email struct { Enabled func(childComplexity int) int MailAddress func(childComplexity int) int } - Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig struct { + Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack struct { + Channel func(childComplexity int) int Enabled func(childComplexity int) int Webhook func(childComplexity int) int } - Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig struct { + Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram struct { + ChatID func(childComplexity int) int Enabled func(childComplexity int) int + Token func(childComplexity int) int } - Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams struct { - ClusterName func(childComplexity int) int + Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook struct { + Enabled func(childComplexity int) int + URL func(childComplexity int) int } - Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams struct { - EnvName func(childComplexity int) int + Github__com___kloudlite___api___apps___comms___types__NotifyContent struct { + Body func(childComplexity int) int + Image func(childComplexity int) int + Link func(childComplexity int) int + Subject func(childComplexity int) int + Title func(childComplexity int) int } Github__com___kloudlite___api___common__CreatedOrUpdatedBy struct { @@ -98,10 +108,11 @@ type ComplexityRoot struct { } MatchFilter struct { - Array func(childComplexity int) int - Exact func(childComplexity int) int - MatchType func(childComplexity int) int - Regex func(childComplexity int) int + Array func(childComplexity int) int + Exact func(childComplexity int) int + MatchType func(childComplexity int) int + NotInArray func(childComplexity int) int + Regex func(childComplexity int) int } Mutation struct { @@ -111,31 +122,30 @@ type ComplexityRoot struct { } Notification struct { - AccountName func(childComplexity int) int - CreationTime func(childComplexity int) int - Id func(childComplexity int) int - MarkedForDeletion func(childComplexity int) int - NotificationClusterParams func(childComplexity int) int - NotificationEnvParams func(childComplexity int) int - NotificationType func(childComplexity int) int - Read func(childComplexity int) int - RecordVersion func(childComplexity int) int - ResourceType func(childComplexity int) int - UpdateTime func(childComplexity int) int + AccountName func(childComplexity int) int + Content func(childComplexity int) int + CreationTime func(childComplexity int) int + Id func(childComplexity int) int + MarkedForDeletion func(childComplexity int) int + NotificationType func(childComplexity int) int + Read func(childComplexity int) int + RecordVersion func(childComplexity int) int + UpdateTime func(childComplexity int) int } NotificationConf struct { - AccountName func(childComplexity int) int - CreatedBy func(childComplexity int) int - CreationTime func(childComplexity int) int - EmailConfigurations func(childComplexity int) int - Id func(childComplexity int) int - LastUpdatedBy func(childComplexity int) int - MarkedForDeletion func(childComplexity int) int - RecordVersion func(childComplexity int) int - SlackConfigurations func(childComplexity int) int - TelegramConfigurations func(childComplexity int) int - UpdateTime func(childComplexity int) int + AccountName func(childComplexity int) int + CreatedBy func(childComplexity int) int + CreationTime func(childComplexity int) int + Email func(childComplexity int) int + Id func(childComplexity int) int + LastUpdatedBy func(childComplexity int) int + MarkedForDeletion func(childComplexity int) int + RecordVersion func(childComplexity int) int + Slack func(childComplexity int) int + Telegram func(childComplexity int) int + UpdateTime func(childComplexity int) int + Webhook func(childComplexity int) int } NotificationEdge struct { @@ -189,28 +199,30 @@ type ComplexityRoot struct { type Github__com___kloudlite___api___common__CreatedOrUpdatedByResolver interface { UserID(ctx context.Context, obj *common.CreatedOrUpdatedBy) (string, error) } +type MatchFilterResolver interface { + MatchType(ctx context.Context, obj *repos.MatchFilter) (model.GithubComKloudliteAPIPkgReposMatchType, error) +} type MutationResolver interface { CommsUpdateNotificationConfig(ctx context.Context, config entities.NotificationConf) (*entities.NotificationConf, error) CommsUpdateSubscriptionConfig(ctx context.Context, config entities.Subscription, id repos.ID) (*entities.Subscription, error) CommsMarkNotificationAsRead(ctx context.Context, id repos.ID) (*types.Notification, error) } type NotificationResolver interface { + Content(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotifyContent, error) CreationTime(ctx context.Context, obj *types.Notification) (string, error) - NotificationClusterParams(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams, error) - NotificationEnvParams(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams, error) NotificationType(ctx context.Context, obj *types.Notification) (model.GithubComKloudliteAPIAppsCommsTypesNotificationType, error) - ResourceType(ctx context.Context, obj *types.Notification) (model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType, error) UpdateTime(ctx context.Context, obj *types.Notification) (string, error) } type NotificationConfResolver interface { CreationTime(ctx context.Context, obj *entities.NotificationConf) (string, error) - EmailConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig, error) + Email(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail, error) - SlackConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig, error) - TelegramConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig, error) + Slack(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack, error) + Telegram(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram, error) UpdateTime(ctx context.Context, obj *entities.NotificationConf) (string, error) + Webhook(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook, error) } type QueryResolver interface { CommsListNotifications(ctx context.Context, pagination *repos.CursorPagination) (*model.NotificationPaginatedRecords, error) @@ -230,10 +242,14 @@ type SubscriptionResolver interface { UpdateTime(ctx context.Context) (<-chan string, error) } +type MatchFilterInResolver interface { + MatchType(ctx context.Context, obj *repos.MatchFilter, data model.GithubComKloudliteAPIPkgReposMatchType) error +} type NotificationConfInResolver interface { - EmailConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn) error - SlackConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn) error - TelegramConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn) error + Email(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn) error + Slack(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn) error + Telegram(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramIn) error + Webhook(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn) error } type executableSchema struct { @@ -297,54 +313,110 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.CursorPagination.SortDirection(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.enabled": - if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.Enabled == nil { + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email.enabled": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email.Enabled == nil { break } - return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.Enabled(childComplexity), true + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email.Enabled(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.mailAddress": - if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.MailAddress == nil { + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email.mailAddress": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email.MailAddress == nil { break } - return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig.MailAddress(childComplexity), true + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email.MailAddress(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.enabled": - if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.Enabled == nil { + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.channel": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Channel == nil { break } - return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.Enabled(childComplexity), true + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Channel(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.webhook": - if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.Webhook == nil { + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.enabled": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Enabled == nil { break } - return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig.Webhook(childComplexity), true + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Enabled(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig.enabled": - if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig.Enabled == nil { + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.webhook": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Webhook == nil { break } - return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig.Enabled(childComplexity), true + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Webhook(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams.clusterName": - if e.complexity.Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams.ClusterName == nil { + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.chatId": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.ChatID == nil { break } - return e.complexity.Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams.ClusterName(childComplexity), true + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.ChatID(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams.envName": - if e.complexity.Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams.EnvName == nil { + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.enabled": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.Enabled == nil { break } - return e.complexity.Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams.EnvName(childComplexity), true + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.Enabled(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.token": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.Token == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.Token(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook.enabled": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook.Enabled == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook.Enabled(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook.url": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook.URL == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook.URL(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___types__NotifyContent.body": + if e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Body == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Body(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___types__NotifyContent.image": + if e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Image == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Image(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___types__NotifyContent.link": + if e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Link == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Link(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___types__NotifyContent.subject": + if e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Subject == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Subject(childComplexity), true + + case "Github__com___kloudlite___api___apps___comms___types__NotifyContent.title": + if e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Title == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___comms___types__NotifyContent.Title(childComplexity), true case "Github__com___kloudlite___api___common__CreatedOrUpdatedBy.userEmail": if e.complexity.Github__com___kloudlite___api___common__CreatedOrUpdatedBy.UserEmail == nil { @@ -388,6 +460,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.MatchFilter.MatchType(childComplexity), true + case "MatchFilter.notInArray": + if e.complexity.MatchFilter.NotInArray == nil { + break + } + + return e.complexity.MatchFilter.NotInArray(childComplexity), true + case "MatchFilter.regex": if e.complexity.MatchFilter.Regex == nil { break @@ -438,6 +517,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Notification.AccountName(childComplexity), true + case "Notification.content": + if e.complexity.Notification.Content == nil { + break + } + + return e.complexity.Notification.Content(childComplexity), true + case "Notification.creationTime": if e.complexity.Notification.CreationTime == nil { break @@ -459,20 +545,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Notification.MarkedForDeletion(childComplexity), true - case "Notification.notificationClusterParams": - if e.complexity.Notification.NotificationClusterParams == nil { - break - } - - return e.complexity.Notification.NotificationClusterParams(childComplexity), true - - case "Notification.notificationEnvParams": - if e.complexity.Notification.NotificationEnvParams == nil { - break - } - - return e.complexity.Notification.NotificationEnvParams(childComplexity), true - case "Notification.notificationType": if e.complexity.Notification.NotificationType == nil { break @@ -494,13 +566,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Notification.RecordVersion(childComplexity), true - case "Notification.resourceType": - if e.complexity.Notification.ResourceType == nil { - break - } - - return e.complexity.Notification.ResourceType(childComplexity), true - case "Notification.updateTime": if e.complexity.Notification.UpdateTime == nil { break @@ -529,12 +594,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.NotificationConf.CreationTime(childComplexity), true - case "NotificationConf.emailConfigurations": - if e.complexity.NotificationConf.EmailConfigurations == nil { + case "NotificationConf.email": + if e.complexity.NotificationConf.Email == nil { break } - return e.complexity.NotificationConf.EmailConfigurations(childComplexity), true + return e.complexity.NotificationConf.Email(childComplexity), true case "NotificationConf.id": if e.complexity.NotificationConf.Id == nil { @@ -564,19 +629,19 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.NotificationConf.RecordVersion(childComplexity), true - case "NotificationConf.slackConfigurations": - if e.complexity.NotificationConf.SlackConfigurations == nil { + case "NotificationConf.slack": + if e.complexity.NotificationConf.Slack == nil { break } - return e.complexity.NotificationConf.SlackConfigurations(childComplexity), true + return e.complexity.NotificationConf.Slack(childComplexity), true - case "NotificationConf.telegramConfigurations": - if e.complexity.NotificationConf.TelegramConfigurations == nil { + case "NotificationConf.telegram": + if e.complexity.NotificationConf.Telegram == nil { break } - return e.complexity.NotificationConf.TelegramConfigurations(childComplexity), true + return e.complexity.NotificationConf.Telegram(childComplexity), true case "NotificationConf.updateTime": if e.complexity.NotificationConf.UpdateTime == nil { @@ -585,6 +650,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.NotificationConf.UpdateTime(childComplexity), true + case "NotificationConf.webhook": + if e.complexity.NotificationConf.Webhook == nil { + break + } + + return e.complexity.NotificationConf.Webhook(childComplexity), true + case "NotificationEdge.cursor": if e.complexity.NotificationEdge.Cursor == nil { break @@ -786,9 +858,10 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputCursorPaginationIn, - ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn, - ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn, - ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn, + ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailIn, + ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn, + ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn, + ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookIn, ec.unmarshalInputMatchFilterIn, ec.unmarshalInputNotificationConfIn, ec.unmarshalInputPaginationIn, @@ -923,26 +996,34 @@ type Mutation { comms_markNotificationAsRead(id: ID!): Notification @isLoggedInAndVerified @hasAccount } `, BuiltIn: false}, - {Name: "../struct-to-graphql/common-types.graphqls", Input: `type Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig @shareable { + {Name: "../struct-to-graphql/common-types.graphqls", Input: `type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email @shareable { enabled: Boolean! mailAddress: String! } -type Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig @shareable { +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack @shareable { + channel: String! enabled: Boolean! webhook: String! } -type Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig @shareable { +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram @shareable { + chatId: String! enabled: Boolean! + token: String! } -type Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams @shareable { - clusterName: String! +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook @shareable { + enabled: Boolean! + url: String! } -type Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams @shareable { - envName: String! +type Github__com___kloudlite___api___apps___comms___types__NotifyContent @shareable { + body: String! + image: String! + link: String! + subject: String! + title: String! } type Github__com___kloudlite___api___common__CreatedOrUpdatedBy @shareable { @@ -958,24 +1039,26 @@ type PageInfo @shareable { startCursor: String } -input Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn { +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailIn { enabled: Boolean! mailAddress: String! } -input Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn { +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn { + channel: String! enabled: Boolean! webhook: String! } -input Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn { +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn { + chatId: String! enabled: Boolean! + token: String! } -enum Github__com___kloudlite___api___apps___comms___types__NotificationResourceType { - account - cluster - environment +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookIn { + enabled: Boolean! + url: String! } enum Github__com___kloudlite___api___apps___comms___types__NotificationType { @@ -983,6 +1066,13 @@ enum Github__com___kloudlite___api___apps___comms___types__NotificationType { notification } +enum Github__com___kloudlite___api___pkg___repos__MatchType { + array + exact + not_in_array + regex +} + `, BuiltIn: false}, {Name: "../struct-to-graphql/cursorpagination.graphqls", Input: `type CursorPagination @shareable { after: String @@ -1018,35 +1108,29 @@ directive @goField( {Name: "../struct-to-graphql/matchfilter.graphqls", Input: `type MatchFilter @shareable { array: [Any!] exact: Any - matchType: MatchFilterMatchType! + matchType: Github__com___kloudlite___api___pkg___repos__MatchType! + notInArray: [Any!] regex: String } input MatchFilterIn { array: [Any!] exact: Any - matchType: MatchFilterMatchType! + matchType: Github__com___kloudlite___api___pkg___repos__MatchType! + notInArray: [Any!] regex: String } -enum MatchFilterMatchType { - array - exact - regex -} - `, BuiltIn: false}, {Name: "../struct-to-graphql/notification.graphqls", Input: `type Notification @shareable { accountName: String! + content: Github__com___kloudlite___api___apps___comms___types__NotifyContent! creationTime: Date! id: ID! markedForDeletion: Boolean - notificationClusterParams: Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams - notificationEnvParams: Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams notificationType: Github__com___kloudlite___api___apps___comms___types__NotificationType! read: Boolean! recordVersion: Int! - resourceType: Github__com___kloudlite___api___apps___comms___types__NotificationResourceType! updateTime: Date! } @@ -1066,20 +1150,22 @@ type NotificationPaginatedRecords @shareable { accountName: String! createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! creationTime: Date! - emailConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig + email: Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email id: ID! lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! markedForDeletion: Boolean recordVersion: Int! - slackConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig - telegramConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig + slack: Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack + telegram: Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram updateTime: Date! + webhook: Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook } input NotificationConfIn { - emailConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn - slackConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn - telegramConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn + email: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailIn + slack: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn + telegram: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn + webhook: Github__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookIn } `, BuiltIn: false}, @@ -1550,26 +1636,378 @@ func (ec *executionContext) _CursorPagination_sortDirection(ctx context.Context, if resTmp == nil { return graphql.Null } - res := resTmp.(repos.SortDirection) + res := resTmp.(repos.SortDirection) + fc.Result = res + return ec.marshalOCursorPaginationSortDirection2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐSortDirection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CursorPagination_sortDirection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CursorPagination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type CursorPaginationSortDirection does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_enabled(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Enabled, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_mailAddress(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_mailAddress(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MailAddress, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_mailAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Channel, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_enabled(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Enabled, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Webhook, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_chatId(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_chatId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ChatID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_chatId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_enabled(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Enabled, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram", + 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_token(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_token(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Token, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) fc.Result = res - return ec.marshalOCursorPaginationSortDirection2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐSortDirection(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_CursorPagination_sortDirection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_token(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "CursorPagination", + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type CursorPaginationSortDirection does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_enabled(ctx, field) if err != nil { return graphql.Null } @@ -1599,9 +2037,9 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig", + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook", Field: field, IsMethod: false, IsResolver: false, @@ -1612,8 +2050,8 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___ return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_url(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_url(ctx, field) if err != nil { return graphql.Null } @@ -1626,7 +2064,7 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.MailAddress, nil + return obj.URL, nil }) if err != nil { ec.Error(ctx, err) @@ -1643,9 +2081,9 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_url(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig", + Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook", Field: field, IsMethod: false, IsResolver: false, @@ -1656,8 +2094,8 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___ return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotifyContent_body(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsTypesNotifyContent) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_body(ctx, field) if err != nil { return graphql.Null } @@ -1670,7 +2108,7 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Enabled, nil + return obj.Body, nil }) if err != nil { ec.Error(ctx, err) @@ -1682,26 +2120,26 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_body(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig", + Object: "Github__com___kloudlite___api___apps___comms___types__NotifyContent", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotifyContent_image(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsTypesNotifyContent) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_image(ctx, field) if err != nil { return graphql.Null } @@ -1714,7 +2152,7 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Webhook, nil + return obj.Image, nil }) if err != nil { ec.Error(ctx, err) @@ -1731,9 +2169,9 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_image(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig", + Object: "Github__com___kloudlite___api___apps___comms___types__NotifyContent", Field: field, IsMethod: false, IsResolver: false, @@ -1744,8 +2182,8 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___ return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotifyContent_link(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsTypesNotifyContent) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_link(ctx, field) if err != nil { return graphql.Null } @@ -1758,7 +2196,7 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Enabled, nil + return obj.Link, nil }) if err != nil { ec.Error(ctx, err) @@ -1770,26 +2208,26 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_link(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig", + Object: "Github__com___kloudlite___api___apps___comms___types__NotifyContent", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotifyContent_subject(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsTypesNotifyContent) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_subject(ctx, field) if err != nil { return graphql.Null } @@ -1802,7 +2240,7 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___type }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ClusterName, nil + return obj.Subject, nil }) if err != nil { ec.Error(ctx, err) @@ -1819,9 +2257,9 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___type return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_subject(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams", + Object: "Github__com___kloudlite___api___apps___comms___types__NotifyContent", Field: field, IsMethod: false, IsResolver: false, @@ -1832,8 +2270,8 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___ return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotifyContent_title(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsTypesNotifyContent) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_title(ctx, field) if err != nil { return graphql.Null } @@ -1846,7 +2284,7 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___type }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EnvName, nil + return obj.Title, nil }) if err != nil { ec.Error(ctx, err) @@ -1863,9 +2301,9 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___type return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams", + Object: "Github__com___kloudlite___api___apps___comms___types__NotifyContent", Field: field, IsMethod: false, IsResolver: false, @@ -2104,7 +2542,7 @@ func (ec *executionContext) _MatchFilter_matchType(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.MatchType, nil + return ec.resolvers.MatchFilter().MatchType(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -2116,19 +2554,60 @@ func (ec *executionContext) _MatchFilter_matchType(ctx context.Context, field gr } return graphql.Null } - res := resTmp.(repos.MatchType) + res := resTmp.(model.GithubComKloudliteAPIPkgReposMatchType) fc.Result = res - return ec.marshalNMatchFilterMatchType2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchType(ctx, field.Selections, res) + return ec.marshalNGithub__com___kloudlite___api___pkg___repos__MatchType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIPkgReposMatchType(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_MatchFilter_matchType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MatchFilter", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Github__com___kloudlite___api___pkg___repos__MatchType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _MatchFilter_notInArray(ctx context.Context, field graphql.CollectedField, obj *repos.MatchFilter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MatchFilter_notInArray(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.NotInArray, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]any) + fc.Result = res + return ec.marshalOAny2ᚕinterfaceᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_MatchFilter_notInArray(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MatchFilter", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type MatchFilterMatchType does not have child fields") + return nil, errors.New("field of type Any does not have child fields") }, } return fc, nil @@ -2243,8 +2722,8 @@ func (ec *executionContext) fieldContext_Mutation_comms_updateNotificationConfig return ec.fieldContext_NotificationConf_createdBy(ctx, field) case "creationTime": return ec.fieldContext_NotificationConf_creationTime(ctx, field) - case "emailConfigurations": - return ec.fieldContext_NotificationConf_emailConfigurations(ctx, field) + case "email": + return ec.fieldContext_NotificationConf_email(ctx, field) case "id": return ec.fieldContext_NotificationConf_id(ctx, field) case "lastUpdatedBy": @@ -2253,12 +2732,14 @@ func (ec *executionContext) fieldContext_Mutation_comms_updateNotificationConfig return ec.fieldContext_NotificationConf_markedForDeletion(ctx, field) case "recordVersion": return ec.fieldContext_NotificationConf_recordVersion(ctx, field) - case "slackConfigurations": - return ec.fieldContext_NotificationConf_slackConfigurations(ctx, field) - case "telegramConfigurations": - return ec.fieldContext_NotificationConf_telegramConfigurations(ctx, field) + case "slack": + return ec.fieldContext_NotificationConf_slack(ctx, field) + case "telegram": + return ec.fieldContext_NotificationConf_telegram(ctx, field) case "updateTime": return ec.fieldContext_NotificationConf_updateTime(ctx, field) + case "webhook": + return ec.fieldContext_NotificationConf_webhook(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type NotificationConf", field.Name) }, @@ -2404,24 +2885,20 @@ func (ec *executionContext) fieldContext_Mutation_comms_markNotificationAsRead(c switch field.Name { case "accountName": return ec.fieldContext_Notification_accountName(ctx, field) + case "content": + return ec.fieldContext_Notification_content(ctx, field) case "creationTime": return ec.fieldContext_Notification_creationTime(ctx, field) case "id": return ec.fieldContext_Notification_id(ctx, field) case "markedForDeletion": return ec.fieldContext_Notification_markedForDeletion(ctx, field) - case "notificationClusterParams": - return ec.fieldContext_Notification_notificationClusterParams(ctx, field) - case "notificationEnvParams": - return ec.fieldContext_Notification_notificationEnvParams(ctx, field) case "notificationType": return ec.fieldContext_Notification_notificationType(ctx, field) case "read": return ec.fieldContext_Notification_read(ctx, field) case "recordVersion": return ec.fieldContext_Notification_recordVersion(ctx, field) - case "resourceType": - return ec.fieldContext_Notification_resourceType(ctx, field) case "updateTime": return ec.fieldContext_Notification_updateTime(ctx, field) } @@ -2486,8 +2963,8 @@ func (ec *executionContext) fieldContext_Notification_accountName(ctx context.Co return fc, nil } -func (ec *executionContext) _Notification_creationTime(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Notification_creationTime(ctx, field) +func (ec *executionContext) _Notification_content(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_content(ctx, field) if err != nil { return graphql.Null } @@ -2500,7 +2977,7 @@ func (ec *executionContext) _Notification_creationTime(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Notification().CreationTime(rctx, obj) + return ec.resolvers.Notification().Content(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -2512,26 +2989,38 @@ func (ec *executionContext) _Notification_creationTime(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsTypesNotifyContent) fc.Result = res - return ec.marshalNDate2string(ctx, field.Selections, res) + return ec.marshalNGithub__com___kloudlite___api___apps___comms___types__NotifyContent2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotifyContent(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_creationTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_content(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Date does not have child fields") + switch field.Name { + case "body": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_body(ctx, field) + case "image": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_image(ctx, field) + case "link": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_link(ctx, field) + case "subject": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_subject(ctx, field) + case "title": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotifyContent_title(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___types__NotifyContent", field.Name) }, } return fc, nil } -func (ec *executionContext) _Notification_id(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Notification_id(ctx, field) +func (ec *executionContext) _Notification_creationTime(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_creationTime(ctx, field) if err != nil { return graphql.Null } @@ -2544,7 +3033,7 @@ func (ec *executionContext) _Notification_id(ctx context.Context, field graphql. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Id, nil + return ec.resolvers.Notification().CreationTime(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -2556,26 +3045,26 @@ func (ec *executionContext) _Notification_id(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(repos.ID) + res := resTmp.(string) fc.Result = res - return ec.marshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx, field.Selections, res) + return ec.marshalNDate2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_creationTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type Date does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Notification_markedForDeletion(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Notification_markedForDeletion(ctx, field) +func (ec *executionContext) _Notification_id(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_id(ctx, field) if err != nil { return graphql.Null } @@ -2588,80 +3077,38 @@ func (ec *executionContext) _Notification_markedForDeletion(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.MarkedForDeletion, nil + return obj.Id, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*bool) + res := resTmp.(repos.ID) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_markedForDeletion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", 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) _Notification_notificationClusterParams(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Notification_notificationClusterParams(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Notification().NotificationClusterParams(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams) - fc.Result = res - return ec.marshalOGithub__com___kloudlite___api___apps___comms___types__NotificationClusterParams2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationClusterParams(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Notification_notificationClusterParams(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Notification", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "clusterName": - return ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams", field.Name) + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Notification_notificationEnvParams(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Notification_notificationEnvParams(ctx, field) +func (ec *executionContext) _Notification_markedForDeletion(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_markedForDeletion(ctx, field) if err != nil { return graphql.Null } @@ -2674,7 +3121,7 @@ func (ec *executionContext) _Notification_notificationEnvParams(ctx context.Cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Notification().NotificationEnvParams(rctx, obj) + return obj.MarkedForDeletion, nil }) if err != nil { ec.Error(ctx, err) @@ -2683,23 +3130,19 @@ func (ec *executionContext) _Notification_notificationEnvParams(ctx context.Cont if resTmp == nil { return graphql.Null } - res := resTmp.(*model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams) + res := resTmp.(*bool) fc.Result = res - return ec.marshalOGithub__com___kloudlite___api___apps___comms___types__NotificationEnvParams2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationEnvParams(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_notificationEnvParams(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_markedForDeletion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "envName": - return ec.fieldContext_Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil @@ -2837,50 +3280,6 @@ func (ec *executionContext) fieldContext_Notification_recordVersion(ctx context. return fc, nil } -func (ec *executionContext) _Notification_resourceType(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Notification_resourceType(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Notification().ResourceType(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) - fc.Result = res - return ec.marshalNGithub__com___kloudlite___api___apps___comms___types__NotificationResourceType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationResourceType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Notification_resourceType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Notification", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Github__com___kloudlite___api___apps___comms___types__NotificationResourceType does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _Notification_updateTime(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Notification_updateTime(ctx, field) if err != nil { @@ -3065,8 +3464,8 @@ func (ec *executionContext) fieldContext_NotificationConf_creationTime(ctx conte return fc, nil } -func (ec *executionContext) _NotificationConf_emailConfigurations(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_NotificationConf_emailConfigurations(ctx, field) +func (ec *executionContext) _NotificationConf_email(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_email(ctx, field) if err != nil { return graphql.Null } @@ -3079,7 +3478,7 @@ func (ec *executionContext) _NotificationConf_emailConfigurations(ctx context.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.NotificationConf().EmailConfigurations(rctx, obj) + return ec.resolvers.NotificationConf().Email(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -3088,12 +3487,12 @@ func (ec *executionContext) _NotificationConf_emailConfigurations(ctx context.Co if resTmp == nil { return graphql.Null } - res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail) fc.Result = res - return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig(ctx, field.Selections, res) + return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__Email2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_NotificationConf_emailConfigurations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_NotificationConf_email(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "NotificationConf", Field: field, @@ -3102,11 +3501,11 @@ func (ec *executionContext) fieldContext_NotificationConf_emailConfigurations(ct Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "enabled": - return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx, field) + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_enabled(ctx, field) case "mailAddress": - return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx, field) + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_mailAddress(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email", field.Name) }, } return fc, nil @@ -3293,8 +3692,8 @@ func (ec *executionContext) fieldContext_NotificationConf_recordVersion(ctx cont return fc, nil } -func (ec *executionContext) _NotificationConf_slackConfigurations(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_NotificationConf_slackConfigurations(ctx, field) +func (ec *executionContext) _NotificationConf_slack(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_slack(ctx, field) if err != nil { return graphql.Null } @@ -3307,7 +3706,7 @@ func (ec *executionContext) _NotificationConf_slackConfigurations(ctx context.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.NotificationConf().SlackConfigurations(rctx, obj) + return ec.resolvers.NotificationConf().Slack(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -3316,12 +3715,12 @@ func (ec *executionContext) _NotificationConf_slackConfigurations(ctx context.Co if resTmp == nil { return graphql.Null } - res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) fc.Result = res - return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig(ctx, field.Selections, res) + return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__Slack2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_NotificationConf_slackConfigurations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_NotificationConf_slack(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "NotificationConf", Field: field, @@ -3329,19 +3728,21 @@ func (ec *executionContext) fieldContext_NotificationConf_slackConfigurations(ct IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { + case "channel": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx, field) case "enabled": - return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx, field) + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_enabled(ctx, field) case "webhook": - return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx, field) + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack", field.Name) }, } return fc, nil } -func (ec *executionContext) _NotificationConf_telegramConfigurations(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_NotificationConf_telegramConfigurations(ctx, field) +func (ec *executionContext) _NotificationConf_telegram(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_telegram(ctx, field) if err != nil { return graphql.Null } @@ -3354,7 +3755,7 @@ func (ec *executionContext) _NotificationConf_telegramConfigurations(ctx context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.NotificationConf().TelegramConfigurations(rctx, obj) + return ec.resolvers.NotificationConf().Telegram(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -3363,12 +3764,12 @@ func (ec *executionContext) _NotificationConf_telegramConfigurations(ctx context if resTmp == nil { return graphql.Null } - res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig) + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram) fc.Result = res - return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig(ctx, field.Selections, res) + return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_NotificationConf_telegramConfigurations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_NotificationConf_telegram(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "NotificationConf", Field: field, @@ -3376,10 +3777,14 @@ func (ec *executionContext) fieldContext_NotificationConf_telegramConfigurations IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { + case "chatId": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_chatId(ctx, field) case "enabled": - return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx, field) + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_enabled(ctx, field) + case "token": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_token(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram", field.Name) }, } return fc, nil @@ -3429,6 +3834,53 @@ func (ec *executionContext) fieldContext_NotificationConf_updateTime(ctx context return fc, nil } +func (ec *executionContext) _NotificationConf_webhook(ctx context.Context, field graphql.CollectedField, obj *entities.NotificationConf) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationConf_webhook(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.NotificationConf().Webhook(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook) + fc.Result = res + return ec.marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationConf_webhook(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationConf", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "enabled": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_enabled(ctx, field) + case "url": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_url(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _NotificationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.NotificationEdge) (ret graphql.Marshaler) { fc, err := ec.fieldContext_NotificationEdge_cursor(ctx, field) if err != nil { @@ -3514,24 +3966,20 @@ func (ec *executionContext) fieldContext_NotificationEdge_node(ctx context.Conte switch field.Name { case "accountName": return ec.fieldContext_Notification_accountName(ctx, field) + case "content": + return ec.fieldContext_Notification_content(ctx, field) case "creationTime": return ec.fieldContext_Notification_creationTime(ctx, field) case "id": return ec.fieldContext_Notification_id(ctx, field) case "markedForDeletion": return ec.fieldContext_Notification_markedForDeletion(ctx, field) - case "notificationClusterParams": - return ec.fieldContext_Notification_notificationClusterParams(ctx, field) - case "notificationEnvParams": - return ec.fieldContext_Notification_notificationEnvParams(ctx, field) case "notificationType": return ec.fieldContext_Notification_notificationType(ctx, field) case "read": return ec.fieldContext_Notification_read(ctx, field) case "recordVersion": return ec.fieldContext_Notification_recordVersion(ctx, field) - case "resourceType": - return ec.fieldContext_Notification_resourceType(ctx, field) case "updateTime": return ec.fieldContext_Notification_updateTime(ctx, field) } @@ -4089,8 +4537,8 @@ func (ec *executionContext) fieldContext_Query_comms_getNotificationConfig(ctx c return ec.fieldContext_NotificationConf_createdBy(ctx, field) case "creationTime": return ec.fieldContext_NotificationConf_creationTime(ctx, field) - case "emailConfigurations": - return ec.fieldContext_NotificationConf_emailConfigurations(ctx, field) + case "email": + return ec.fieldContext_NotificationConf_email(ctx, field) case "id": return ec.fieldContext_NotificationConf_id(ctx, field) case "lastUpdatedBy": @@ -4099,12 +4547,14 @@ func (ec *executionContext) fieldContext_Query_comms_getNotificationConfig(ctx c return ec.fieldContext_NotificationConf_markedForDeletion(ctx, field) case "recordVersion": return ec.fieldContext_NotificationConf_recordVersion(ctx, field) - case "slackConfigurations": - return ec.fieldContext_NotificationConf_slackConfigurations(ctx, field) - case "telegramConfigurations": - return ec.fieldContext_NotificationConf_telegramConfigurations(ctx, field) + case "slack": + return ec.fieldContext_NotificationConf_slack(ctx, field) + case "telegram": + return ec.fieldContext_NotificationConf_telegram(ctx, field) case "updateTime": return ec.fieldContext_NotificationConf_updateTime(ctx, field) + case "webhook": + return ec.fieldContext_NotificationConf_webhook(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type NotificationConf", field.Name) }, @@ -6821,27 +7271,68 @@ func (ec *executionContext) unmarshalInputCursorPaginationIn(ctx context.Context if err != nil { return it, err } - it.SortDirection = data + it.SortDirection = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn, error) { + var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"enabled", "mailAddress"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "enabled": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.Enabled = data + case "mailAddress": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mailAddress")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.MailAddress = data } } return it, nil } -func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn, error) { - var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn, error) { + var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"enabled", "mailAddress"} + fieldsInOrder := [...]string{"channel", "enabled", "webhook"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "channel": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("channel")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Channel = data case "enabled": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled")) data, err := ec.unmarshalNBoolean2bool(ctx, v) @@ -6849,33 +7340,40 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps__ return it, err } it.Enabled = data - case "mailAddress": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mailAddress")) + case "webhook": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("webhook")) data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.MailAddress = data + it.Webhook = data } } return it, nil } -func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn, error) { - var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramIn, error) { + var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramIn asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"enabled", "webhook"} + fieldsInOrder := [...]string{"chatId", "enabled", "token"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "chatId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("chatId")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.ChatID = data case "enabled": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled")) data, err := ec.unmarshalNBoolean2bool(ctx, v) @@ -6883,27 +7381,27 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps__ return it, err } it.Enabled = data - case "webhook": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("webhook")) + case "token": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("token")) data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.Webhook = data + it.Token = data } } return it, nil } -func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn, error) { - var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn, error) { + var it model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"enabled"} + fieldsInOrder := [...]string{"enabled", "url"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -6917,6 +7415,13 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps__ return it, err } it.Enabled = data + case "url": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("url")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.URL = data } } @@ -6930,7 +7435,7 @@ func (ec *executionContext) unmarshalInputMatchFilterIn(ctx context.Context, obj asMap[k] = v } - fieldsInOrder := [...]string{"array", "exact", "matchType", "regex"} + fieldsInOrder := [...]string{"array", "exact", "matchType", "notInArray", "regex"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -6953,11 +7458,20 @@ func (ec *executionContext) unmarshalInputMatchFilterIn(ctx context.Context, obj it.Exact = data case "matchType": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("matchType")) - data, err := ec.unmarshalNMatchFilterMatchType2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchType(ctx, v) + data, err := ec.unmarshalNGithub__com___kloudlite___api___pkg___repos__MatchType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIPkgReposMatchType(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.MatchFilterIn().MatchType(ctx, &it, data); err != nil { + return it, err + } + case "notInArray": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("notInArray")) + data, err := ec.unmarshalOAny2ᚕinterfaceᚄ(ctx, v) if err != nil { return it, err } - it.MatchType = data + it.NotInArray = data case "regex": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("regex")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -6978,38 +7492,47 @@ func (ec *executionContext) unmarshalInputNotificationConfIn(ctx context.Context asMap[k] = v } - fieldsInOrder := [...]string{"emailConfigurations", "slackConfigurations", "telegramConfigurations"} + fieldsInOrder := [...]string{"email", "slack", "telegram", "webhook"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "emailConfigurations": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailConfigurations")) - data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn(ctx, v) + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) + data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.NotificationConfIn().Email(ctx, &it, data); err != nil { + return it, err + } + case "slack": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("slack")) + data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn(ctx, v) if err != nil { return it, err } - if err = ec.resolvers.NotificationConfIn().EmailConfigurations(ctx, &it, data); err != nil { + if err = ec.resolvers.NotificationConfIn().Slack(ctx, &it, data); err != nil { return it, err } - case "slackConfigurations": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("slackConfigurations")) - data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn(ctx, v) + case "telegram": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("telegram")) + data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramIn(ctx, v) if err != nil { return it, err } - if err = ec.resolvers.NotificationConfIn().SlackConfigurations(ctx, &it, data); err != nil { + if err = ec.resolvers.NotificationConfIn().Telegram(ctx, &it, data); err != nil { return it, err } - case "telegramConfigurations": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("telegramConfigurations")) - data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn(ctx, v) + case "webhook": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("webhook")) + data, err := ec.unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn(ctx, v) if err != nil { return it, err } - if err = ec.resolvers.NotificationConfIn().TelegramConfigurations(ctx, &it, data); err != nil { + if err = ec.resolvers.NotificationConfIn().Webhook(ctx, &it, data); err != nil { return it, err } } @@ -7140,24 +7663,24 @@ func (ec *executionContext) _CursorPagination(ctx context.Context, sel ast.Selec return out } -var github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig"} +var github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email"} -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigImplementors) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailImplementors) 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("Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig") + out.Values[i] = graphql.MarshalString("Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email") case "enabled": - out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_enabled(ctx, field, obj) + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_enabled(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "mailAddress": - out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig_mailAddress(ctx, field, obj) + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email_mailAddress(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -7184,24 +7707,29 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte return out } -var github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig"} +var github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack"} -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigImplementors) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackImplementors) 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("Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig") + out.Values[i] = graphql.MarshalString("Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack") + case "channel": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "enabled": - out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_enabled(ctx, field, obj) + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_enabled(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "webhook": - out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig_webhook(ctx, field, obj) + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -7228,19 +7756,29 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte return out } -var github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig"} +var github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram"} -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigImplementors) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramImplementors) 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("Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig") + out.Values[i] = graphql.MarshalString("Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram") + case "chatId": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_chatId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "enabled": - out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig_enabled(ctx, field, obj) + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_enabled(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "token": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram_token(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -7267,19 +7805,24 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte return out } -var github__com___kloudlite___api___apps___comms___types__NotificationClusterParamsImplementors = []string{"Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams"} +var github__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookImplementors = []string{"Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook"} -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___types__NotificationClusterParamsImplementors) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookImplementors) 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("Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams") - case "clusterName": - out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams_clusterName(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook") + case "enabled": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_enabled(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "url": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook_url(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -7306,19 +7849,39 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___type return out } -var github__com___kloudlite___api___apps___comms___types__NotificationEnvParamsImplementors = []string{"Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams"} +var github__com___kloudlite___api___apps___comms___types__NotifyContentImplementors = []string{"Github__com___kloudlite___api___apps___comms___types__NotifyContent"} -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___types__NotificationEnvParamsImplementors) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___types__NotifyContent(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsCommsTypesNotifyContent) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___comms___types__NotifyContentImplementors) 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("Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams") - case "envName": - out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams_envName(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Github__com___kloudlite___api___apps___comms___types__NotifyContent") + case "body": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___types__NotifyContent_body(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "image": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___types__NotifyContent_image(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "link": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___types__NotifyContent_link(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "subject": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___types__NotifyContent_subject(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "title": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___types__NotifyContent_title(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -7441,10 +8004,43 @@ func (ec *executionContext) _MatchFilter(ctx context.Context, sel ast.SelectionS case "exact": out.Values[i] = ec._MatchFilter_exact(ctx, field, obj) case "matchType": - out.Values[i] = ec._MatchFilter_matchType(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + 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._MatchFilter_matchType(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "notInArray": + out.Values[i] = ec._MatchFilter_notInArray(ctx, field, obj) case "regex": out.Values[i] = ec._MatchFilter_regex(ctx, field, obj) default: @@ -7540,7 +8136,7 @@ func (ec *executionContext) _Notification(ctx context.Context, sel ast.Selection if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "creationTime": + case "content": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -7549,7 +8145,7 @@ func (ec *executionContext) _Notification(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Notification_creationTime(ctx, field, obj) + res = ec._Notification_content(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -7576,14 +8172,7 @@ func (ec *executionContext) _Notification(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "id": - out.Values[i] = ec._Notification_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "markedForDeletion": - out.Values[i] = ec._Notification_markedForDeletion(ctx, field, obj) - case "notificationClusterParams": + case "creationTime": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -7592,40 +8181,10 @@ func (ec *executionContext) _Notification(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Notification_notificationClusterParams(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs + res = ec._Notification_creationTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "notificationEnvParams": - 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._Notification_notificationEnvParams(ctx, field, obj) return res } @@ -7649,6 +8208,13 @@ func (ec *executionContext) _Notification(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "id": + out.Values[i] = ec._Notification_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "markedForDeletion": + out.Values[i] = ec._Notification_markedForDeletion(ctx, field, obj) case "notificationType": field := field @@ -7695,42 +8261,6 @@ func (ec *executionContext) _Notification(ctx context.Context, sel ast.Selection if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "resourceType": - 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._Notification_resourceType(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "updateTime": field := field @@ -7847,7 +8377,7 @@ func (ec *executionContext) _NotificationConf(ctx context.Context, sel ast.Selec } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "emailConfigurations": + case "email": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -7856,7 +8386,7 @@ func (ec *executionContext) _NotificationConf(ctx context.Context, sel ast.Selec ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._NotificationConf_emailConfigurations(ctx, field, obj) + res = ec._NotificationConf_email(ctx, field, obj) return res } @@ -7897,7 +8427,7 @@ func (ec *executionContext) _NotificationConf(ctx context.Context, sel ast.Selec if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "slackConfigurations": + case "slack": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -7906,7 +8436,7 @@ func (ec *executionContext) _NotificationConf(ctx context.Context, sel ast.Selec ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._NotificationConf_slackConfigurations(ctx, field, obj) + res = ec._NotificationConf_slack(ctx, field, obj) return res } @@ -7930,7 +8460,7 @@ func (ec *executionContext) _NotificationConf(ctx context.Context, sel ast.Selec } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "telegramConfigurations": + case "telegram": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -7939,7 +8469,7 @@ func (ec *executionContext) _NotificationConf(ctx context.Context, sel ast.Selec ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._NotificationConf_telegramConfigurations(ctx, field, obj) + res = ec._NotificationConf_telegram(ctx, field, obj) return res } @@ -7998,6 +8528,39 @@ func (ec *executionContext) _NotificationConf(ctx context.Context, sel ast.Selec continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "webhook": + 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._NotificationConf_webhook(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) @@ -8790,24 +9353,28 @@ func (ec *executionContext) marshalNFieldSet2string(ctx context.Context, sel ast return res } -func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___apps___comms___types__NotificationResourceType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationResourceType(ctx context.Context, v interface{}) (model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType, error) { - var res model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType +func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___apps___comms___types__NotificationType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationType(ctx context.Context, v interface{}) (model.GithubComKloudliteAPIAppsCommsTypesNotificationType, error) { + var res model.GithubComKloudliteAPIAppsCommsTypesNotificationType err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___comms___types__NotificationResourceType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationResourceType(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) graphql.Marshaler { +func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___comms___types__NotificationType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationType(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteAPIAppsCommsTypesNotificationType) graphql.Marshaler { return v } -func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___apps___comms___types__NotificationType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationType(ctx context.Context, v interface{}) (model.GithubComKloudliteAPIAppsCommsTypesNotificationType, error) { - var res model.GithubComKloudliteAPIAppsCommsTypesNotificationType - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___comms___types__NotifyContent2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotifyContent(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteAPIAppsCommsTypesNotifyContent) graphql.Marshaler { + return ec._Github__com___kloudlite___api___apps___comms___types__NotifyContent(ctx, sel, &v) } -func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___comms___types__NotificationType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationType(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteAPIAppsCommsTypesNotificationType) graphql.Marshaler { - return v +func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___comms___types__NotifyContent2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotifyContent(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsTypesNotifyContent) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Github__com___kloudlite___api___apps___comms___types__NotifyContent(ctx, sel, v) } func (ec *executionContext) marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2githubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx context.Context, sel ast.SelectionSet, v common.CreatedOrUpdatedBy) graphql.Marshaler { @@ -8824,6 +9391,16 @@ func (ec *executionContext) marshalNGithub__com___kloudlite___api___common__Crea return ec._Github__com___kloudlite___api___common__CreatedOrUpdatedBy(ctx, sel, v) } +func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___pkg___repos__MatchType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIPkgReposMatchType(ctx context.Context, v interface{}) (model.GithubComKloudliteAPIPkgReposMatchType, error) { + var res model.GithubComKloudliteAPIPkgReposMatchType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNGithub__com___kloudlite___api___pkg___repos__MatchType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIPkgReposMatchType(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteAPIPkgReposMatchType) graphql.Marshaler { + return v +} + func (ec *executionContext) unmarshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx context.Context, v interface{}) (repos.ID, error) { tmp, err := graphql.UnmarshalString(v) res := repos.ID(tmp) @@ -8855,22 +9432,6 @@ func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.Selecti return res } -func (ec *executionContext) unmarshalNMatchFilterMatchType2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchType(ctx context.Context, v interface{}) (repos.MatchType, error) { - tmp, err := graphql.UnmarshalString(v) - res := repos.MatchType(tmp) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNMatchFilterMatchType2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchType(ctx context.Context, sel ast.SelectionSet, v repos.MatchType) graphql.Marshaler { - res := graphql.MarshalString(string(v)) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - func (ec *executionContext) marshalNNotification2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋtypesᚐNotification(ctx context.Context, sel ast.SelectionSet, v *types.Notification) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -9484,63 +10045,64 @@ func (ec *executionContext) marshalOCursorPaginationSortDirection2githubᚗcom return res } -func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig) graphql.Marshaler { +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__Email2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig(ctx, sel, v) + return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email(ctx, sel, v) } -func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn, error) { +func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn(ctx, v) + res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__EmailIn(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig) graphql.Marshaler { +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__Slack2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig(ctx, sel, v) + return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack(ctx, sel, v) } -func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn, error) { +func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn(ctx, v) + res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig) graphql.Marshaler { +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig(ctx, sel, v) + return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram(ctx, sel, v) } -func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn, error) { +func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramIn, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn(ctx, v) + res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___types__NotificationClusterParams2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationClusterParams(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams) graphql.Marshaler { +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams(ctx, sel, v) + return ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook(ctx, sel, v) } -func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___comms___types__NotificationEnvParams2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsTypesNotificationEnvParams(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams) graphql.Marshaler { +func (ec *executionContext) unmarshalOGithub__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋcommsᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn, error) { if v == nil { - return graphql.Null + return nil, nil } - return ec._Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams(ctx, sel, v) + res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookIn(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalOInt2int(ctx context.Context, v interface{}) (int, error) { diff --git a/apps/comms/internal/app/graph/matchfilter.resolvers.go b/apps/comms/internal/app/graph/matchfilter.resolvers.go new file mode 100644 index 000000000..dc1ce5012 --- /dev/null +++ b/apps/comms/internal/app/graph/matchfilter.resolvers.go @@ -0,0 +1,33 @@ +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.45 + +import ( + "context" + "fmt" + + "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" + "github.com/kloudlite/api/apps/comms/internal/app/graph/model" + "github.com/kloudlite/api/pkg/repos" +) + +// MatchType is the resolver for the matchType field. +func (r *matchFilterResolver) MatchType(ctx context.Context, obj *repos.MatchFilter) (model.GithubComKloudliteAPIPkgReposMatchType, error) { + panic(fmt.Errorf("not implemented: MatchType - matchType")) +} + +// MatchType is the resolver for the matchType field. +func (r *matchFilterInResolver) MatchType(ctx context.Context, obj *repos.MatchFilter, data model.GithubComKloudliteAPIPkgReposMatchType) error { + panic(fmt.Errorf("not implemented: MatchType - matchType")) +} + +// MatchFilter returns generated.MatchFilterResolver implementation. +func (r *Resolver) MatchFilter() generated.MatchFilterResolver { return &matchFilterResolver{r} } + +// MatchFilterIn returns generated.MatchFilterInResolver implementation. +func (r *Resolver) MatchFilterIn() generated.MatchFilterInResolver { return &matchFilterInResolver{r} } + +type matchFilterResolver struct{ *Resolver } +type matchFilterInResolver struct{ *Resolver } diff --git a/apps/comms/internal/app/graph/model/models_gen.go b/apps/comms/internal/app/graph/model/models_gen.go index 46105658e..d02bbe2b1 100644 --- a/apps/comms/internal/app/graph/model/models_gen.go +++ b/apps/comms/internal/app/graph/model/models_gen.go @@ -10,40 +10,56 @@ import ( "github.com/kloudlite/api/apps/comms/types" ) -type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig struct { +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail struct { Enabled bool `json:"enabled"` MailAddress string `json:"mailAddress"` } -type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn struct { +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn struct { Enabled bool `json:"enabled"` MailAddress string `json:"mailAddress"` } -type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig struct { +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack struct { + Channel string `json:"channel"` Enabled bool `json:"enabled"` Webhook string `json:"webhook"` } -type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn struct { +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn struct { + Channel string `json:"channel"` Enabled bool `json:"enabled"` Webhook string `json:"webhook"` } -type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig struct { - Enabled bool `json:"enabled"` +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram struct { + ChatID string `json:"chatId"` + Enabled bool `json:"enabled"` + Token string `json:"token"` +} + +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramIn struct { + ChatID string `json:"chatId"` + Enabled bool `json:"enabled"` + Token string `json:"token"` } -type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn struct { - Enabled bool `json:"enabled"` +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook struct { + Enabled bool `json:"enabled"` + URL string `json:"url"` } -type GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams struct { - ClusterName string `json:"clusterName"` +type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn struct { + Enabled bool `json:"enabled"` + URL string `json:"url"` } -type GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams struct { - EnvName string `json:"envName"` +type GithubComKloudliteAPIAppsCommsTypesNotifyContent struct { + Body string `json:"body"` + Image string `json:"image"` + Link string `json:"link"` + Subject string `json:"subject"` + Title string `json:"title"` } type Mutation struct { @@ -70,86 +86,88 @@ type PageInfo struct { type Query struct { } -type GithubComKloudliteAPIAppsCommsTypesNotificationResourceType string +type GithubComKloudliteAPIAppsCommsTypesNotificationType string const ( - GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeAccount GithubComKloudliteAPIAppsCommsTypesNotificationResourceType = "account" - GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeCluster GithubComKloudliteAPIAppsCommsTypesNotificationResourceType = "cluster" - GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeEnvironment GithubComKloudliteAPIAppsCommsTypesNotificationResourceType = "environment" + GithubComKloudliteAPIAppsCommsTypesNotificationTypeAlert GithubComKloudliteAPIAppsCommsTypesNotificationType = "alert" + GithubComKloudliteAPIAppsCommsTypesNotificationTypeNotification GithubComKloudliteAPIAppsCommsTypesNotificationType = "notification" ) -var AllGithubComKloudliteAPIAppsCommsTypesNotificationResourceType = []GithubComKloudliteAPIAppsCommsTypesNotificationResourceType{ - GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeAccount, - GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeCluster, - GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeEnvironment, +var AllGithubComKloudliteAPIAppsCommsTypesNotificationType = []GithubComKloudliteAPIAppsCommsTypesNotificationType{ + GithubComKloudliteAPIAppsCommsTypesNotificationTypeAlert, + GithubComKloudliteAPIAppsCommsTypesNotificationTypeNotification, } -func (e GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) IsValid() bool { +func (e GithubComKloudliteAPIAppsCommsTypesNotificationType) IsValid() bool { switch e { - case GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeAccount, GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeCluster, GithubComKloudliteAPIAppsCommsTypesNotificationResourceTypeEnvironment: + case GithubComKloudliteAPIAppsCommsTypesNotificationTypeAlert, GithubComKloudliteAPIAppsCommsTypesNotificationTypeNotification: return true } return false } -func (e GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) String() string { +func (e GithubComKloudliteAPIAppsCommsTypesNotificationType) String() string { return string(e) } -func (e *GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) UnmarshalGQL(v interface{}) error { +func (e *GithubComKloudliteAPIAppsCommsTypesNotificationType) UnmarshalGQL(v interface{}) error { str, ok := v.(string) if !ok { return fmt.Errorf("enums must be strings") } - *e = GithubComKloudliteAPIAppsCommsTypesNotificationResourceType(str) + *e = GithubComKloudliteAPIAppsCommsTypesNotificationType(str) if !e.IsValid() { - return fmt.Errorf("%s is not a valid Github__com___kloudlite___api___apps___comms___types__NotificationResourceType", str) + return fmt.Errorf("%s is not a valid Github__com___kloudlite___api___apps___comms___types__NotificationType", str) } return nil } -func (e GithubComKloudliteAPIAppsCommsTypesNotificationResourceType) MarshalGQL(w io.Writer) { +func (e GithubComKloudliteAPIAppsCommsTypesNotificationType) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) } -type GithubComKloudliteAPIAppsCommsTypesNotificationType string +type GithubComKloudliteAPIPkgReposMatchType string const ( - GithubComKloudliteAPIAppsCommsTypesNotificationTypeAlert GithubComKloudliteAPIAppsCommsTypesNotificationType = "alert" - GithubComKloudliteAPIAppsCommsTypesNotificationTypeNotification GithubComKloudliteAPIAppsCommsTypesNotificationType = "notification" + GithubComKloudliteAPIPkgReposMatchTypeArray GithubComKloudliteAPIPkgReposMatchType = "array" + GithubComKloudliteAPIPkgReposMatchTypeExact GithubComKloudliteAPIPkgReposMatchType = "exact" + GithubComKloudliteAPIPkgReposMatchTypeNotInArray GithubComKloudliteAPIPkgReposMatchType = "not_in_array" + GithubComKloudliteAPIPkgReposMatchTypeRegex GithubComKloudliteAPIPkgReposMatchType = "regex" ) -var AllGithubComKloudliteAPIAppsCommsTypesNotificationType = []GithubComKloudliteAPIAppsCommsTypesNotificationType{ - GithubComKloudliteAPIAppsCommsTypesNotificationTypeAlert, - GithubComKloudliteAPIAppsCommsTypesNotificationTypeNotification, +var AllGithubComKloudliteAPIPkgReposMatchType = []GithubComKloudliteAPIPkgReposMatchType{ + GithubComKloudliteAPIPkgReposMatchTypeArray, + GithubComKloudliteAPIPkgReposMatchTypeExact, + GithubComKloudliteAPIPkgReposMatchTypeNotInArray, + GithubComKloudliteAPIPkgReposMatchTypeRegex, } -func (e GithubComKloudliteAPIAppsCommsTypesNotificationType) IsValid() bool { +func (e GithubComKloudliteAPIPkgReposMatchType) IsValid() bool { switch e { - case GithubComKloudliteAPIAppsCommsTypesNotificationTypeAlert, GithubComKloudliteAPIAppsCommsTypesNotificationTypeNotification: + case GithubComKloudliteAPIPkgReposMatchTypeArray, GithubComKloudliteAPIPkgReposMatchTypeExact, GithubComKloudliteAPIPkgReposMatchTypeNotInArray, GithubComKloudliteAPIPkgReposMatchTypeRegex: return true } return false } -func (e GithubComKloudliteAPIAppsCommsTypesNotificationType) String() string { +func (e GithubComKloudliteAPIPkgReposMatchType) String() string { return string(e) } -func (e *GithubComKloudliteAPIAppsCommsTypesNotificationType) UnmarshalGQL(v interface{}) error { +func (e *GithubComKloudliteAPIPkgReposMatchType) UnmarshalGQL(v interface{}) error { str, ok := v.(string) if !ok { return fmt.Errorf("enums must be strings") } - *e = GithubComKloudliteAPIAppsCommsTypesNotificationType(str) + *e = GithubComKloudliteAPIPkgReposMatchType(str) if !e.IsValid() { - return fmt.Errorf("%s is not a valid Github__com___kloudlite___api___apps___comms___types__NotificationType", str) + return fmt.Errorf("%s is not a valid Github__com___kloudlite___api___pkg___repos__MatchType", str) } return nil } -func (e GithubComKloudliteAPIAppsCommsTypesNotificationType) MarshalGQL(w io.Writer) { +func (e GithubComKloudliteAPIPkgReposMatchType) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) } diff --git a/apps/comms/internal/app/graph/notification.resolvers.go b/apps/comms/internal/app/graph/notification.resolvers.go index 8b5ba262a..eeb9863da 100644 --- a/apps/comms/internal/app/graph/notification.resolvers.go +++ b/apps/comms/internal/app/graph/notification.resolvers.go @@ -7,66 +7,30 @@ package graph import ( "context" "fmt" - "time" "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" "github.com/kloudlite/api/apps/comms/internal/app/graph/model" "github.com/kloudlite/api/apps/comms/types" - fn "github.com/kloudlite/api/pkg/functions" ) -// CreationTime is the resolver for the creationTime field. -func (r *notificationResolver) CreationTime(ctx context.Context, obj *types.Notification) (string, error) { - if obj == nil { - return "", fmt.Errorf("obj is nil") - } - - return obj.CreationTime.Format(time.RFC3339), nil +// Content is the resolver for the content field. +func (r *notificationResolver) Content(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotifyContent, error) { + panic(fmt.Errorf("not implemented: Content - content")) } -// NotificationClusterParams is the resolver for the notificationClusterParams field. -func (r *notificationResolver) NotificationClusterParams(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams, error) { - if obj == nil { - return nil, fmt.Errorf("obj is nil") - } - - return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsTypesNotificationClusterParams](obj.NotificationClusterParams) -} - -// NotificationEnvParams is the resolver for the notificationEnvParams field. -func (r *notificationResolver) NotificationEnvParams(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams, error) { - if obj == nil { - return nil, fmt.Errorf("obj is nil") - } - - return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsTypesNotificationEnvParams](obj.NotificationEnvParams) +// CreationTime is the resolver for the creationTime field. +func (r *notificationResolver) CreationTime(ctx context.Context, obj *types.Notification) (string, error) { + panic(fmt.Errorf("not implemented: CreationTime - creationTime")) } // NotificationType is the resolver for the notificationType field. func (r *notificationResolver) NotificationType(ctx context.Context, obj *types.Notification) (model.GithubComKloudliteAPIAppsCommsTypesNotificationType, error) { - if obj == nil { - return "", fmt.Errorf("obj is nil") - } - - return model.GithubComKloudliteAPIAppsCommsTypesNotificationType(obj.NotificationType), nil -} - -// ResourceType is the resolver for the resourceType field. -func (r *notificationResolver) ResourceType(ctx context.Context, obj *types.Notification) (model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType, error) { - if obj == nil { - return "", fmt.Errorf("obj is nil") - } - - return model.GithubComKloudliteAPIAppsCommsTypesNotificationResourceType(obj.ResourceType), nil + panic(fmt.Errorf("not implemented: NotificationType - notificationType")) } // UpdateTime is the resolver for the updateTime field. func (r *notificationResolver) UpdateTime(ctx context.Context, obj *types.Notification) (string, error) { - if obj == nil { - return "", fmt.Errorf("obj is nil") - } - - return obj.UpdateTime.Format(time.RFC3339), nil + panic(fmt.Errorf("not implemented: UpdateTime - updateTime")) } // Notification returns generated.NotificationResolver implementation. diff --git a/apps/comms/internal/app/graph/notificationconf.resolvers.go b/apps/comms/internal/app/graph/notificationconf.resolvers.go index f6f698349..2b6ad66f5 100644 --- a/apps/comms/internal/app/graph/notificationconf.resolvers.go +++ b/apps/comms/internal/app/graph/notificationconf.resolvers.go @@ -24,85 +24,99 @@ func (r *notificationConfResolver) CreationTime(ctx context.Context, obj *entiti return obj.CreationTime.Format(time.RFC3339), nil } -// EmailConfigurations is the resolver for the emailConfigurations field. -func (r *notificationConfResolver) EmailConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig, error) { +// UpdateTime is the resolver for the updateTime field. +func (r *notificationConfResolver) UpdateTime(ctx context.Context, obj *entities.NotificationConf) (string, error) { if obj == nil { - return nil, fmt.Errorf("obj is nil") + return "", fmt.Errorf("obj is nil") } - return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfig](obj.EmailConfiguration) + return obj.UpdateTime.Format(time.RFC3339), nil } -// SlackConfigurations is the resolver for the slackConfigurations field. -func (r *notificationConfResolver) SlackConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig, error) { +// Webhook is the resolver for the webhook field. +func (r *notificationConfResolver) Webhook(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook, error) { + + if obj.Webhook == nil { + return nil, nil + } + + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook](obj.Webhook) +} + +// Webhook is the resolver for the webhook field. +func (r *notificationConfInResolver) Webhook(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn) error { if obj == nil { - return nil, fmt.Errorf("obj is nil") + return fmt.Errorf("obj is nil") } - return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfig](obj.SlackConfiguration) + gckacideesci, err := fn.JsonConvertP[entities.Webhook](data) + if err != nil { + return err + } + + obj.Webhook = gckacideesci + return nil } -// TelegramConfigurations is the resolver for the telegramConfigurations field. -func (r *notificationConfResolver) TelegramConfigurations(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig, error) { +func (r *notificationConfResolver) Email(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail, error) { if obj == nil { return nil, fmt.Errorf("obj is nil") } - return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfig](obj.TelegramConfiguration) + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail](obj.Email) } - -// UpdateTime is the resolver for the updateTime field. -func (r *notificationConfResolver) UpdateTime(ctx context.Context, obj *entities.NotificationConf) (string, error) { +func (r *notificationConfResolver) Slack(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack, error) { if obj == nil { - return "", fmt.Errorf("obj is nil") + return nil, fmt.Errorf("obj is nil") } - return obj.UpdateTime.Format(time.RFC3339), nil + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack](obj.Slack) } +func (r *notificationConfResolver) Telegram(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram, error) { + if obj == nil { + return nil, fmt.Errorf("obj is nil") + } -// EmailConfigurations is the resolver for the emailConfigurations field. -func (r *notificationConfInResolver) EmailConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailConfigIn) error { + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram](obj.Telegram) +} +func (r *notificationConfInResolver) Email(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn) error { if obj == nil { return fmt.Errorf("obj is nil") } - gckacideeci, err := fn.JsonConvertP[entities.EmailConfig](data) + gckacideeci, err := fn.JsonConvertP[entities.Email](data) if err != nil { return err } - obj.EmailConfiguration = gckacideeci + obj.Email = gckacideeci return nil } - -// SlackConfigurations is the resolver for the slackConfigurations field. -func (r *notificationConfInResolver) SlackConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackConfigIn) error { +func (r *notificationConfInResolver) Slack(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn) error { if obj == nil { return fmt.Errorf("obj is nil") } - gckacideesci, err := fn.JsonConvertP[entities.SlackConfig](data) + gckacideesci, err := fn.JsonConvertP[entities.Slack](data) if err != nil { return err } - obj.SlackConfiguration = gckacideesci + obj.Slack = gckacideesci return nil } - -// TelegramConfigurations is the resolver for the telegramConfigurations field. -func (r *notificationConfInResolver) TelegramConfigurations(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramConfigIn) error { +func (r *notificationConfInResolver) Telegram(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramIn) error { if obj == nil { return fmt.Errorf("obj is nil") } - gckacideetci, err := fn.JsonConvertP[entities.TelegramConfig](data) + gckacideetci, err := fn.JsonConvertP[entities.Telegram](data) if err != nil { return err } - obj.TelegramConfiguration = gckacideetci + obj.Telegram = gckacideetci return nil } diff --git a/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls index 160c86d71..650bb03e5 100644 --- a/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls +++ b/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls @@ -1,23 +1,31 @@ -type Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig @shareable { +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email @shareable { enabled: Boolean! mailAddress: String! } -type Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig @shareable { +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack @shareable { + channel: String! enabled: Boolean! webhook: String! } -type Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig @shareable { +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram @shareable { + chatId: String! enabled: Boolean! + token: String! } -type Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams @shareable { - clusterName: String! +type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook @shareable { + enabled: Boolean! + url: String! } -type Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams @shareable { - envName: String! +type Github__com___kloudlite___api___apps___comms___types__NotifyContent @shareable { + body: String! + image: String! + link: String! + subject: String! + title: String! } type Github__com___kloudlite___api___common__CreatedOrUpdatedBy @shareable { @@ -33,24 +41,26 @@ type PageInfo @shareable { startCursor: String } -input Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn { +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailIn { enabled: Boolean! mailAddress: String! } -input Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn { +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn { + channel: String! enabled: Boolean! webhook: String! } -input Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn { +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn { + chatId: String! enabled: Boolean! + token: String! } -enum Github__com___kloudlite___api___apps___comms___types__NotificationResourceType { - account - cluster - environment +input Github__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookIn { + enabled: Boolean! + url: String! } enum Github__com___kloudlite___api___apps___comms___types__NotificationType { @@ -58,3 +68,10 @@ enum Github__com___kloudlite___api___apps___comms___types__NotificationType { notification } +enum Github__com___kloudlite___api___pkg___repos__MatchType { + array + exact + not_in_array + regex +} + diff --git a/apps/comms/internal/app/graph/struct-to-graphql/matchfilter.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/matchfilter.graphqls index ef1a0cb45..e1e59fb4d 100644 --- a/apps/comms/internal/app/graph/struct-to-graphql/matchfilter.graphqls +++ b/apps/comms/internal/app/graph/struct-to-graphql/matchfilter.graphqls @@ -1,20 +1,16 @@ type MatchFilter @shareable { array: [Any!] exact: Any - matchType: MatchFilterMatchType! + matchType: Github__com___kloudlite___api___pkg___repos__MatchType! + notInArray: [Any!] regex: String } input MatchFilterIn { array: [Any!] exact: Any - matchType: MatchFilterMatchType! + matchType: Github__com___kloudlite___api___pkg___repos__MatchType! + notInArray: [Any!] regex: String } -enum MatchFilterMatchType { - array - exact - regex -} - diff --git a/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls index 73c128b14..6b1fe479e 100644 --- a/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls +++ b/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls @@ -1,14 +1,12 @@ type Notification @shareable { accountName: String! + content: Github__com___kloudlite___api___apps___comms___types__NotifyContent! creationTime: Date! id: ID! markedForDeletion: Boolean - notificationClusterParams: Github__com___kloudlite___api___apps___comms___types__NotificationClusterParams - notificationEnvParams: Github__com___kloudlite___api___apps___comms___types__NotificationEnvParams notificationType: Github__com___kloudlite___api___apps___comms___types__NotificationType! read: Boolean! recordVersion: Int! - resourceType: Github__com___kloudlite___api___apps___comms___types__NotificationResourceType! updateTime: Date! } diff --git a/apps/comms/internal/app/graph/struct-to-graphql/notificationconf.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/notificationconf.graphqls index 357ef34c0..eca8489dd 100644 --- a/apps/comms/internal/app/graph/struct-to-graphql/notificationconf.graphqls +++ b/apps/comms/internal/app/graph/struct-to-graphql/notificationconf.graphqls @@ -2,19 +2,21 @@ type NotificationConf @shareable { accountName: String! createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! creationTime: Date! - emailConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfig + email: Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email id: ID! lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! markedForDeletion: Boolean recordVersion: Int! - slackConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfig - telegramConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfig + slack: Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack + telegram: Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram updateTime: Date! + webhook: Github__com___kloudlite___api___apps___comms___internal___domain___entities__Webhook } input NotificationConfIn { - emailConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailConfigIn - slackConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackConfigIn - telegramConfigurations: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramConfigIn + email: Github__com___kloudlite___api___apps___comms___internal___domain___entities__EmailIn + slack: Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn + telegram: Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn + webhook: Github__com___kloudlite___api___apps___comms___internal___domain___entities__WebhookIn } diff --git a/apps/comms/internal/app/grpc-server.go b/apps/comms/internal/app/grpc-server.go index 08f48fe00..9e9a88e64 100644 --- a/apps/comms/internal/app/grpc-server.go +++ b/apps/comms/internal/app/grpc-server.go @@ -4,6 +4,8 @@ import ( "bytes" "context" "fmt" + + "github.com/kloudlite/api/apps/comms/internal/domain" "github.com/kloudlite/api/apps/comms/internal/env" "github.com/kloudlite/api/pkg/errors" @@ -19,12 +21,7 @@ type commsSvc struct { ev *env.Env - accountInviteEmail AccountInviteEmail - projectInviteEmail ProjectInviteEmail - resetPasswordEmail RestPasswordEmail - userVerificationEmail UserVerificationEmail - welcomeEmail WelcomeEmail - waitingEmail WaitingEmail + eTemplattes *domain.EmailTemplates } func (r *commsSvc) sendSupportEmail(ctx context.Context, subject string, toEmail string, toName string, plainText string, htmlContent string) error { @@ -57,16 +54,16 @@ func (r *commsSvc) SendAccountMemberInviteEmail(ctx context.Context, input *comm "Link": fmt.Sprintf("%v?token=%v", r.ev.AccountsWebInviteUrl, input.InvitationToken), } - if err := r.accountInviteEmail.PlainText.Execute(plainText, args); err != nil { + if err := r.eTemplattes.AccountInviteEmail.PlainText.Execute(plainText, args); err != nil { return nil, errors.NewEf(err, "failed to execute plain-text template") } html := new(bytes.Buffer) - if err := r.accountInviteEmail.Html.Execute(html, args); err != nil { + if err := r.eTemplattes.AccountInviteEmail.Html.Execute(html, args); err != nil { return nil, errors.NewEf(err, "failed to execute html template") } - if err := r.sendSupportEmail(ctx, r.accountInviteEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { + if err := r.sendSupportEmail(ctx, r.eTemplattes.AccountInviteEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { return nil, errors.NewE(err) } return &comms.Void{}, nil @@ -86,16 +83,16 @@ func (r *commsSvc) SendProjectMemberInviteEmail(ctx context.Context, input *comm "Link": fmt.Sprintf("%v?token=%v", r.ev.ProjectsWebInviteUrl, input.InvitationToken), } - if err := r.projectInviteEmail.PlainText.Execute(plainText, args); err != nil { + if err := r.eTemplattes.ProjectInviteEmail.PlainText.Execute(plainText, args); err != nil { return nil, errors.NewEf(err, "failed to execute plain-text template") } html := new(bytes.Buffer) - if err := r.projectInviteEmail.Html.Execute(html, args); err != nil { + if err := r.eTemplattes.ProjectInviteEmail.Html.Execute(html, args); err != nil { return nil, errors.NewEf(err, "failed to execute html template") } - if err := r.sendSupportEmail(ctx, r.projectInviteEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { + if err := r.sendSupportEmail(ctx, r.eTemplattes.ProjectInviteEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { return nil, errors.NewE(err) } @@ -114,16 +111,16 @@ func (r *commsSvc) SendPasswordResetEmail(ctx context.Context, input *comms.Pass "Link": fmt.Sprintf("%v?token=%v", r.ev.ResetPasswordWebUrl, input.ResetToken), } - if err := r.resetPasswordEmail.PlainText.Execute(plainText, args); err != nil { + if err := r.eTemplattes.ResetPasswordEmail.PlainText.Execute(plainText, args); err != nil { return nil, errors.NewEf(err, "failed to execute plain text template") } html := new(bytes.Buffer) - if err := r.resetPasswordEmail.Html.Execute(html, args); err != nil { + if err := r.eTemplattes.ResetPasswordEmail.Html.Execute(html, args); err != nil { return nil, errors.NewEf(err, "failed to execute html template") } - if err := r.sendSupportEmail(ctx, r.resetPasswordEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { + if err := r.sendSupportEmail(ctx, r.eTemplattes.ResetPasswordEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { return nil, errors.NewE(err) } @@ -141,16 +138,16 @@ func (r *commsSvc) SendWelcomeEmail(ctx context.Context, input *comms.WelcomeEma }(), } - if err := r.welcomeEmail.PlainText.Execute(plainText, args); err != nil { + if err := r.eTemplattes.WelcomeEmail.PlainText.Execute(plainText, args); err != nil { return nil, errors.NewEf(err, "failed to execute plain text template") } html := new(bytes.Buffer) - if err := r.welcomeEmail.Html.Execute(html, args); err != nil { + if err := r.eTemplattes.WelcomeEmail.Html.Execute(html, args); err != nil { return nil, errors.NewEf(err, "failed to execute html template") } - if err := r.sendSupportEmail(ctx, r.welcomeEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { + if err := r.sendSupportEmail(ctx, r.eTemplattes.WelcomeEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { return nil, errors.NewE(err) } @@ -168,16 +165,16 @@ func (r *commsSvc) SendWaitingEmail(ctx context.Context, input *comms.WelcomeEma }(), } - if err := r.waitingEmail.PlainText.Execute(plainText, args); err != nil { + if err := r.eTemplattes.WaitingEmail.PlainText.Execute(plainText, args); err != nil { return nil, errors.NewEf(err, "failed to execute plain text template") } html := new(bytes.Buffer) - if err := r.waitingEmail.Html.Execute(html, args); err != nil { + if err := r.eTemplattes.WaitingEmail.Html.Execute(html, args); err != nil { return nil, errors.NewEf(err, "failed to execute html template") } - if err := r.sendSupportEmail(ctx, r.waitingEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { + if err := r.sendSupportEmail(ctx, r.eTemplattes.WaitingEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { return nil, errors.NewE(err) } return &comms.Void{}, nil @@ -195,30 +192,25 @@ func (r *commsSvc) SendVerificationEmail(ctx context.Context, input *comms.Verif "Link": fmt.Sprintf("%v?token=%v", r.ev.VerifyEmailWebUrl, input.VerificationToken), } - if err := r.userVerificationEmail.PlainText.Execute(plainText, args); err != nil { + if err := r.eTemplattes.UserVerificationEmail.PlainText.Execute(plainText, args); err != nil { return nil, errors.NewEf(err, "failed to execute plain text template") } html := new(bytes.Buffer) - if err := r.userVerificationEmail.Html.Execute(html, args); err != nil { + if err := r.eTemplattes.UserVerificationEmail.Html.Execute(html, args); err != nil { return nil, errors.NewEf(err, "failed to execute html template") } - if err := r.sendSupportEmail(ctx, r.userVerificationEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { + if err := r.sendSupportEmail(ctx, r.eTemplattes.UserVerificationEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil { return nil, errors.NewE(err) } return &comms.Void{}, nil } -func newCommsSvc(mailer mail.Mailer, ev *env.Env, ai AccountInviteEmail, pi ProjectInviteEmail, rp RestPasswordEmail, uv UserVerificationEmail, nwl WaitingEmail, wl WelcomeEmail) comms.CommsServer { +func newCommsSvc(mailer mail.Mailer, ev *env.Env, et *domain.EmailTemplates) comms.CommsServer { return &commsSvc{ - mailer: mailer, - supportEmail: ev.SupportEmail, - ev: ev, - accountInviteEmail: ai, - projectInviteEmail: pi, - resetPasswordEmail: rp, - userVerificationEmail: uv, - welcomeEmail: wl, - waitingEmail: nwl, + mailer: mailer, + supportEmail: ev.SupportEmail, + ev: ev, + eTemplattes: et, } } diff --git a/apps/comms/internal/app/process-notification.go b/apps/comms/internal/app/process-notification.go index 9982b17de..aa86b3654 100644 --- a/apps/comms/internal/app/process-notification.go +++ b/apps/comms/internal/app/process-notification.go @@ -5,9 +5,26 @@ import ( "github.com/kloudlite/api/apps/comms/internal/domain" "github.com/kloudlite/api/pkg/logging" + "github.com/kloudlite/api/pkg/messaging/types" + + ntypes "github.com/kloudlite/api/apps/comms/types" ) func processNotification(ctx context.Context, d domain.Domain, consumer NotificationConsumer, logr logging.Logger) error { + return consumer.Consume(func(msg *types.ConsumeMsg) error { + logr.Infof("received notification %s (%s)", msg.Subject) + + notif := ntypes.Notification{} + if err := notif.ParseBytes(msg.Payload); err != nil { + return err + } - panic("not implemented") + return d.Notify(context.Background(), ¬if) + }, + types.ConsumeOpts{ + OnError: func(err error) error { + logr.Errorf(err, "could not consume notification") + return nil + }, + }) } diff --git a/apps/comms/internal/domain/api.go b/apps/comms/internal/domain/api.go index a44dfd444..51e882827 100644 --- a/apps/comms/internal/domain/api.go +++ b/apps/comms/internal/domain/api.go @@ -1,6 +1,8 @@ package domain import ( + "context" + "github.com/kloudlite/api/apps/comms/internal/domain/entities" "github.com/kloudlite/api/apps/comms/types" "github.com/kloudlite/api/pkg/repos" @@ -16,7 +18,7 @@ type Domain interface { UpdateSubscriptionConfig(ctx CommsContext, id repos.ID, config entities.Subscription) (*entities.Subscription, error) GetSubscriptionConfig(ctx CommsContext, id repos.ID) (*entities.Subscription, error) - CreateNotification(ctx CommsContext, notification *types.Notification) (*types.Notification, error) + Notify(ctx context.Context, notification *types.Notification) error } type PublishMsg string diff --git a/apps/comms/internal/domain/entities/notification-configuration.go b/apps/comms/internal/domain/entities/notification-configuration.go index 88568ff55..c1d3eb8be 100644 --- a/apps/comms/internal/domain/entities/notification-configuration.go +++ b/apps/comms/internal/domain/entities/notification-configuration.go @@ -5,18 +5,25 @@ import ( "github.com/kloudlite/api/pkg/repos" ) -type EmailConfig struct { +type Email struct { Enabled bool `json:"enabled"` MailAddress string `json:"mailAddress"` } -type SlackConfig struct { +type Slack struct { Enabled bool `json:"enabled"` - Webhook string `json:"webhook"` + Url string `json:"url"` } -type TelegramConfig struct { - Enabled bool `json:"enabled"` +type Telegram struct { + Enabled bool `json:"enabled"` + Token string `json:"token"` + ChatID string `json:"chatId"` +} + +type Webhook struct { + Enabled bool `json:"enabled"` + URL string `json:"url"` } type NotificationConf struct { @@ -24,9 +31,10 @@ type NotificationConf struct { CreatedBy common.CreatedOrUpdatedBy `json:"createdBy" graphql:"noinput"` LastUpdatedBy common.CreatedOrUpdatedBy `json:"lastUpdatedBy" graphql:"noinput"` - EmailConfiguration *EmailConfig `json:"emailConfigurations"` - SlackConfiguration *SlackConfig `json:"slackConfigurations"` - TelegramConfiguration *TelegramConfig `json:"telegramConfigurations"` + Email *Email `json:"email"` + Slack *Slack `json:"slack"` + Telegram *Telegram `json:"telegram"` + Webhook *Webhook `json:"webhook"` AccountName string `json:"accountName" graphql:"noinput"` } diff --git a/apps/comms/internal/domain/entities/subscription.go b/apps/comms/internal/domain/entities/subscription.go index 166ed8a41..4212d2f61 100644 --- a/apps/comms/internal/domain/entities/subscription.go +++ b/apps/comms/internal/domain/entities/subscription.go @@ -5,16 +5,16 @@ import ( "github.com/kloudlite/api/pkg/repos" ) -type SubscriptionConf struct { - AlertsEnabled bool `json:"alertsEnabled"` - NotificationsEnabled bool `json:"notificationsEnabled"` -} +// type SubscriptionConf struct { +// AlertsEnabled bool `json:"alertsEnabled"` +// NotificationsEnabled bool `json:"notificationsEnabled"` +// } type Subscription struct { repos.BaseEntity `json:",inline" graphql:"noinput"` - CreatedBy common.CreatedOrUpdatedBy `json:"createdBy" graphql:"noinput"` - LastUpdatedBy common.CreatedOrUpdatedBy `json:"lastUpdatedBy" graphql:"noinput"` + CreatedBy common.CreatedOrUpdatedBy `json:"createdBy" graphql:"noinput"` + LastUpdatedBy common.CreatedOrUpdatedBy `json:"lastUpdatedBy" graphql:"noinput"` AccountName string `json:"accountName" graphql:"noinput"` MailAddress string `json:"mailAddress"` @@ -32,7 +32,6 @@ var SubscriptionIndexes = []repos.IndexField{ }, { Field: []repos.IndexKey{ - {Key: "name", Value: repos.IndexAsc}, {Key: "accountName", Value: repos.IndexAsc}, }, Unique: true, diff --git a/apps/comms/internal/domain/mail-parser.go b/apps/comms/internal/domain/mail-parser.go new file mode 100644 index 000000000..5f4ad5a18 --- /dev/null +++ b/apps/comms/internal/domain/mail-parser.go @@ -0,0 +1,99 @@ +package domain + +import ( + "embed" + "fmt" + "text/template" + + "github.com/kloudlite/api/pkg/errors" +) + +type EmailTemplatesDir struct { + embed.FS +} + +type EmailTemplate struct { + Subject string + Html *template.Template + PlainText *template.Template +} + +type EmailTemplates struct { + AccountInviteEmail *EmailTemplate + ProjectInviteEmail *EmailTemplate + ResetPasswordEmail *EmailTemplate + UserVerificationEmail *EmailTemplate + WelcomeEmail *EmailTemplate + WaitingEmail *EmailTemplate + AlertEmail *EmailTemplate +} + +func parseMailTemplate(et EmailTemplatesDir, templateName string, subject string) (*EmailTemplate, error) { + txtFile, err := et.ReadFile(fmt.Sprintf("email-templates/%v/email.txt", templateName)) + if err != nil { + return nil, errors.NewE(err) + } + txt, err := template.New("email-text").Parse(string(txtFile)) + if err != nil { + return nil, errors.NewE(err) + } + + htmlFile, err := et.ReadFile(fmt.Sprintf("email-templates/%v/email.html", templateName)) + if err != nil { + return nil, errors.NewE(err) + } + html, err := template.New(templateName).Parse(string(htmlFile)) + if err != nil { + return nil, errors.NewE(err) + } + + return &EmailTemplate{ + Subject: subject, + Html: html, + PlainText: txt, + }, nil +} + +func GetEmailTemplates(et EmailTemplatesDir) (*EmailTemplates, error) { + accountInvite, err := parseMailTemplate(et, "account-invite", "[Kloudlite] Account Invite") + if err != nil { + return nil, err + } + + projectInvite, err := parseMailTemplate(et, "project-invite", "[Kloudlite] Project Invite") + if err != nil { + return nil, err + } + + restPassword, err := parseMailTemplate(et, "reset-password", "[Kloudlite] Reset Password") + if err != nil { + return nil, err + } + + userVerification, err := parseMailTemplate(et, "user-verification", "[Kloudlite] Verify Email") + if err != nil { + return nil, err + } + + welcome, err := parseMailTemplate(et, "welcome", "[Kloudlite] Welcome to Kloudlite") + if err != nil { + return nil, err + } + + waiting, err := parseMailTemplate(et, "waiting", "[Kloudlite] Welcome to Kloudlite") + if err != nil { + return nil, err + } + + alert, err := parseMailTemplate(et, "alert", "[Kloudlite] Console Notification") + + return &EmailTemplates{ + AccountInviteEmail: accountInvite, + ProjectInviteEmail: projectInvite, + ResetPasswordEmail: restPassword, + UserVerificationEmail: userVerification, + WelcomeEmail: welcome, + WaitingEmail: waiting, + AlertEmail: alert, + }, nil +} diff --git a/apps/comms/internal/domain/main.go b/apps/comms/internal/domain/main.go index a3dbf7fee..7be09add9 100644 --- a/apps/comms/internal/domain/main.go +++ b/apps/comms/internal/domain/main.go @@ -8,6 +8,7 @@ import ( "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/iam" "github.com/kloudlite/api/pkg/kv" "github.com/kloudlite/api/pkg/logging" + "github.com/kloudlite/api/pkg/mail" "github.com/kloudlite/api/pkg/repos" "go.uber.org/fx" ) @@ -23,7 +24,13 @@ type Impl struct { cacheClient kv.BinaryDataRepo authClient auth.AuthClient + eTemplates *EmailTemplates + resourceEventPublisher ResourceEventPublisher + + mailer mail.Mailer + + // CommsServer CommsServer } var Module = fx.Module("domain", fx.Provide(func(e *env.Env, @@ -36,6 +43,9 @@ var Module = fx.Module("domain", fx.Provide(func(e *env.Env, cacheClient kv.BinaryDataRepo, authClient auth.AuthClient, resourceEventPublisher ResourceEventPublisher, + + eTemplates *EmailTemplates, + mailer mail.Mailer, ) (Domain, error) { return &Impl{ iamClient: iamClient, @@ -48,5 +58,7 @@ var Module = fx.Module("domain", fx.Provide(func(e *env.Env, notificationRepo: notificationRepo, subscriptionRepo: subscriptionRepo, notificationConfigRepo: notificationConfigRepo, + mailer: mailer, + eTemplates: eTemplates, }, nil })) diff --git a/apps/comms/internal/domain/notification-config.go b/apps/comms/internal/domain/notification-config.go index e4ed08dfd..0a2ab6a29 100644 --- a/apps/comms/internal/domain/notification-config.go +++ b/apps/comms/internal/domain/notification-config.go @@ -47,6 +47,7 @@ func (d *Impl) GetNotificationConfig(ctx CommsContext) (*entities.NotificationCo return nc, nil } + func (d *Impl) UpdateNotificationConfig(ctx CommsContext, config entities.NotificationConf) (*entities.NotificationConf, error) { co, err := d.iamClient.Can(ctx, &iam.CanIn{ UserId: string(ctx.UserId), @@ -74,9 +75,12 @@ func (d *Impl) UpdateNotificationConfig(ctx CommsContext, config entities.Notifi return nil, errors.NewE(errors.Newf("notification config not found")) } - xnc.EmailConfiguration = config.EmailConfiguration - xnc.SlackConfiguration = config.SlackConfiguration - xnc.TelegramConfiguration = config.TelegramConfiguration + // TODO:(@abdheshnayak) - check for subscription + + xnc.Email = config.Email + xnc.Slack = config.Slack + xnc.Telegram = config.Telegram + xnc.Webhook = config.Webhook return d.notificationConfigRepo.UpdateById(ctx, xnc.Id, xnc) } diff --git a/apps/comms/internal/domain/notification.go b/apps/comms/internal/domain/notification.go index dbc469e52..3442d497c 100644 --- a/apps/comms/internal/domain/notification.go +++ b/apps/comms/internal/domain/notification.go @@ -1,6 +1,8 @@ package domain import ( + "context" + "github.com/kloudlite/api/apps/comms/types" iamT "github.com/kloudlite/api/apps/iam/types" "github.com/kloudlite/api/common/fields" @@ -71,7 +73,25 @@ func (d *Impl) MarkNotificationAsRead(ctx CommsContext, id repos.ID) (*types.Not return n, nil } -func (d *Impl) CreateNotification(ctx CommsContext, notification *types.Notification) (*types.Notification, error) { +func (d *Impl) Notify(ctx context.Context, notification *types.Notification) error { + _, err := d.notificationRepo.Create(ctx, notification) + if err != nil { + return err + } + + nc, err := d.notificationConfigRepo.FindOne(ctx, repos.Filter{}) + if err != nil { + return err + } + + if nc == nil { + return errors.NewE(errors.Newf("notification config not found")) + } + + np := newNotificationProcessor(context.Background(), d, notification, nc) + if err := np.Send(); err != nil { + return err + } - return nil, nil + return nil } diff --git a/apps/comms/internal/domain/process-notification.go b/apps/comms/internal/domain/process-notification.go new file mode 100644 index 000000000..b693c44a6 --- /dev/null +++ b/apps/comms/internal/domain/process-notification.go @@ -0,0 +1,186 @@ +package domain + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "net/http" + "time" + + "github.com/kloudlite/api/apps/comms/internal/domain/entities" + "github.com/kloudlite/api/apps/comms/types" + "github.com/kloudlite/api/pkg/mail" +) + +type notificationProcessor interface { + Send() error +} + +type npClient struct { + domain *Impl + ctx context.Context + n *types.Notification + nc *entities.NotificationConf +} + +func newNotificationProcessor(ctx context.Context, domain *Impl, n *types.Notification, nc *entities.NotificationConf) notificationProcessor { + return &npClient{ + domain: domain, + ctx: ctx, + n: n, + nc: nc, + } +} + +func (c *npClient) Send() error { + logger := c.domain.logger + + if err := c.handleTelegram(); err != nil { + logger.Errorf(err, "failed to send telegram notification") + } + + if err := c.handleSlack(); err != nil { + logger.Errorf(err, "failed to send slack notification") + } + + if err := c.handleEmail(); err != nil { + logger.Errorf(err, "failed to send email notification") + } + + if err := c.handleWebhook(); err != nil { + logger.Errorf(err, "failed to send webhook notification") + } + + if err := c.handleConsoleUpdate(); err != nil { + logger.Errorf(err, "failed to send console update notification") + } + + return nil +} + +func (c *npClient) handleConsoleUpdate() error { + // TODO: (@abdheshnayak) - needs to be implemented + c.domain.logger.Warnf("console update notification is not implemented") + + return nil +} + +func (c *npClient) handleEmail() error { + if c.nc.Email == nil || !c.nc.Email.Enabled { + return nil + } + + // TODO: (@abdheshnayak) - check for subscription + + // subs, err := c.domain.subscriptionRepo.FindOne(c.ctx, repos.Filter{ + // fields.AccountName: c.n.AccountName, + // fc.SubscriptionMailAddress: c.nc.Email.MailAddress, + // }) + + // if err != nil { + // return err + // } + // if subs == nil { + // return fmt.Errorf("subscription not found") + // } + // + // if !subs.Enabled { + // return fmt.Errorf("subscription is not enabled") + // } + + args := map[string]any{ + "Type": c.n.Type, + "Title": c.n.Content.Title, + "Body": c.n.Content.Body, + "Link": c.n.Content.Link, + } + + plainText := new(bytes.Buffer) + html := new(bytes.Buffer) + if err := c.domain.eTemplates.AlertEmail.PlainText.Execute(plainText, args); err != nil { + return err + } + if err := c.domain.eTemplates.AlertEmail.Html.Execute(html, args); err != nil { + return err + } + + if err := c.domain.mailer.SendEmail(c.ctx, mail.Email{ + FromEmailAddress: c.domain.envs.SupportEmail, + FromName: "Kloudlite Support", + Subject: c.n.Content.Subject, + ToEmailAddress: c.nc.Email.MailAddress, + ToName: c.n.AccountName, + PlainText: plainText.String(), + HtmlText: html.String(), + }); err != nil { + return err + } + + return nil +} + +func (c *npClient) handleSlack() error { + if c.nc.Slack == nil || !c.nc.Slack.Enabled { + return nil + } + + m := &struct { + Text string `json:"text"` + }{c.n.ToPlain()} + + b, err := json.Marshal(m) + if err != nil { + return err + } + + return c.HttpsPost(c.nc.Slack.Url, b) +} + +func (c *npClient) handleTelegram() error { + if c.nc.Telegram == nil || !c.nc.Telegram.Enabled { + return nil + } + + url := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage", c.nc.Telegram.Token) + + m := &struct { + ChatID string `json:"chat_id"` + Text string `json:"text"` + }{c.nc.Telegram.ChatID, c.n.ToPlain()} + + b, err := json.Marshal(m) + if err != nil { + return err + } + + return c.HttpsPost(url, []byte(b)) +} + +func (c *npClient) handleWebhook() error { + if c.nc.Webhook == nil || !c.nc.Webhook.Enabled { + return nil + } + + return c.HttpsPost(c.nc.Webhook.URL, []byte(c.n.ToPlain())) +} + +func (c *npClient) HttpsPost(url string, body []byte) error { + client := &http.Client{ + Timeout: time.Second * 10, + } + req, err := http.NewRequest("POST", url, bytes.NewBuffer(body)) + if err != nil { + return err + } + + req.Header.Set("Content-Type", "application/json") + + resp, err := client.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + return nil +} diff --git a/apps/comms/main.go b/apps/comms/main.go index c808af88a..b1d880522 100644 --- a/apps/comms/main.go +++ b/apps/comms/main.go @@ -7,7 +7,7 @@ import ( "os" "time" - "github.com/kloudlite/api/apps/comms/internal/app" + "github.com/kloudlite/api/apps/comms/internal/domain" "github.com/kloudlite/api/apps/comms/internal/env" "github.com/kloudlite/api/apps/comms/internal/framework" "github.com/kloudlite/api/common" @@ -38,8 +38,8 @@ func main() { fx.Provide(func() (*env.Env, error) { return env.LoadEnv() }), - fx.Provide(func() app.EmailTemplatesDir { - return app.EmailTemplatesDir{ + fx.Provide(func() domain.EmailTemplatesDir { + return domain.EmailTemplatesDir{ FS: EmailTemplatesDir, } }), diff --git a/apps/comms/types/types.go b/apps/comms/types/types.go index 2e9cabb78..0d0d53f5e 100644 --- a/apps/comms/types/types.go +++ b/apps/comms/types/types.go @@ -1,51 +1,45 @@ package types import ( + "fmt" + "github.com/kloudlite/api/pkg/egob" "github.com/kloudlite/api/pkg/repos" ) -type EnvResources string +type NotificationType string const ( - EnvResourcesApps EnvResources = "apps" - EnvResourcesConfigs EnvResources = "configs" - EnvResourcesSecrets EnvResources = "secrets" - EnvResourcesManagedResources EnvResources = "managedResources" + NotifyTypeAlert NotificationType = "alert" + NotifyTypeNotify NotificationType = "notification" ) -type NotificationEnvParams struct { - EnvName string `json:"envName" graphql:"noinput"` -} - -type NotificationClusterParams struct { - ClusterName string `json:"clusterName" graphql:"noinput"` +type NotifyContent struct { + Title string `json:"title" graphql:"noinput"` + Subject string `json:"subject" graphql:"noinput"` + Body string `json:"body" graphql:"noinput"` + Link string `json:"link" graphql:"noinput"` + Image string `json:"image" graphql:"noinput"` } -type NotificationResourceType string -type NotificationType string +type Notification struct { + repos.BaseEntity `json:",inline" graphql:"noinput"` + Type NotificationType `json:"notificationType" graphql:"noinput"` -const ( - NotificationTypeAlert NotificationType = "alert" - NotificationTypeNotification NotificationType = "notification" -) + Content NotifyContent `json:"content" graphql:"noinput"` + AccountName string `json:"accountName" graphql:"noinput"` + Read bool `json:"read" graphql:"noinput"` +} -const ( - NotificationResourceTypeEnvironment NotificationResourceType = "environment" - NotificationResourceTypeCluster NotificationResourceType = "cluster" - NotificationResourceTypeAccount NotificationResourceType = "account" -) +func (obj *Notification) ToPlain() string { + return fmt.Sprintf(`%s -type Notification struct { - repos.BaseEntity `json:",inline" graphql:"noinput"` - ResourceType NotificationResourceType `json:"resourceType" graphql:"noinput"` - NotificationType NotificationType `json:"notificationType" graphql:"noinput"` +%s - NotificationEnvParams *NotificationEnvParams `json:"notificationEnvParams" graphql:"noinput"` - NotificationClusterParams *NotificationClusterParams `json:"notificationClusterParams" graphql:"noinput"` +%s - AccountName string `json:"accountName" graphql:"noinput"` - Read bool `json:"read" graphql:"noinput"` +Account: %s +`, obj.Type, obj.Content.Title, obj.Content.Body, obj.AccountName) } func (obj *Notification) ToBytes() ([]byte, error) { From b6ba5b874bb4858c8f944cea67352bd6ad274091 Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Wed, 5 Jun 2024 17:44:26 +0530 Subject: [PATCH 3/5] :art: Implemented resolvers --- .../app/graph/matchfilter.resolvers.go | 20 ++++++++++++-- .../app/graph/notification.resolvers.go | 27 ++++++++++++++++--- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/apps/comms/internal/app/graph/matchfilter.resolvers.go b/apps/comms/internal/app/graph/matchfilter.resolvers.go index dc1ce5012..e96685cb0 100644 --- a/apps/comms/internal/app/graph/matchfilter.resolvers.go +++ b/apps/comms/internal/app/graph/matchfilter.resolvers.go @@ -10,17 +10,33 @@ import ( "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" "github.com/kloudlite/api/apps/comms/internal/app/graph/model" + fn "github.com/kloudlite/api/pkg/functions" "github.com/kloudlite/api/pkg/repos" ) // MatchType is the resolver for the matchType field. func (r *matchFilterResolver) MatchType(ctx context.Context, obj *repos.MatchFilter) (model.GithubComKloudliteAPIPkgReposMatchType, error) { - panic(fmt.Errorf("not implemented: MatchType - matchType")) + + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return fn.JsonConvert[model.GithubComKloudliteAPIPkgReposMatchType](obj.MatchType) } // MatchType is the resolver for the matchType field. func (r *matchFilterInResolver) MatchType(ctx context.Context, obj *repos.MatchFilter, data model.GithubComKloudliteAPIPkgReposMatchType) error { - panic(fmt.Errorf("not implemented: MatchType - matchType")) + if obj == nil { + return fmt.Errorf("obj is nil") + } + + mt, err := fn.JsonConvert[repos.MatchType](data) + if err != nil { + return err + } + + obj.MatchType = mt + return nil } // MatchFilter returns generated.MatchFilterResolver implementation. diff --git a/apps/comms/internal/app/graph/notification.resolvers.go b/apps/comms/internal/app/graph/notification.resolvers.go index eeb9863da..16d145057 100644 --- a/apps/comms/internal/app/graph/notification.resolvers.go +++ b/apps/comms/internal/app/graph/notification.resolvers.go @@ -7,30 +7,49 @@ package graph import ( "context" "fmt" + "time" "github.com/kloudlite/api/apps/comms/internal/app/graph/generated" "github.com/kloudlite/api/apps/comms/internal/app/graph/model" "github.com/kloudlite/api/apps/comms/types" + "github.com/kloudlite/api/pkg/functions" ) // Content is the resolver for the content field. func (r *notificationResolver) Content(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotifyContent, error) { - panic(fmt.Errorf("not implemented: Content - content")) + + if obj == nil { + return nil, fmt.Errorf("nil object") + } + + return functions.JsonConvertP[model.GithubComKloudliteAPIAppsCommsTypesNotifyContent](obj.Content) } // CreationTime is the resolver for the creationTime field. func (r *notificationResolver) CreationTime(ctx context.Context, obj *types.Notification) (string, error) { - panic(fmt.Errorf("not implemented: CreationTime - creationTime")) + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return obj.CreationTime.Format(time.RFC3339), nil } // NotificationType is the resolver for the notificationType field. func (r *notificationResolver) NotificationType(ctx context.Context, obj *types.Notification) (model.GithubComKloudliteAPIAppsCommsTypesNotificationType, error) { - panic(fmt.Errorf("not implemented: NotificationType - notificationType")) + if obj == nil { + return "", fmt.Errorf("nil object") + } + + return functions.JsonConvert[model.GithubComKloudliteAPIAppsCommsTypesNotificationType](obj.Type) } // UpdateTime is the resolver for the updateTime field. func (r *notificationResolver) UpdateTime(ctx context.Context, obj *types.Notification) (string, error) { - panic(fmt.Errorf("not implemented: UpdateTime - updateTime")) + if obj == nil { + return "", fmt.Errorf("obj is nil") + } + + return obj.UpdateTime.Format(time.RFC3339), nil } // Notification returns generated.NotificationResolver implementation. From 28eb8130bef41bba036cb8f347d5a17fb8d6f52b Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Wed, 5 Jun 2024 17:45:46 +0530 Subject: [PATCH 4/5] :art: Consts updated --- .../field-constants/generated_constants.go | 52 ++++++++++--------- .../generated_constants_notification.go | 40 +++++++------- 2 files changed, 48 insertions(+), 44 deletions(-) diff --git a/apps/comms/internal/domain/entities/field-constants/generated_constants.go b/apps/comms/internal/domain/entities/field-constants/generated_constants.go index 4c1f9326f..9167e08f1 100644 --- a/apps/comms/internal/domain/entities/field-constants/generated_constants.go +++ b/apps/comms/internal/domain/entities/field-constants/generated_constants.go @@ -2,48 +2,52 @@ package field_constants -// constant vars generated for struct EmailConfig +// constant vars generated for struct Email const ( - EmailConfigEnabled = "enabled" - EmailConfigMailAddress = "mailAddress" + EmailEnabled = "enabled" + EmailMailAddress = "mailAddress" ) // constant vars generated for struct NotificationConf const ( - NotificationConfEmailConfigurations = "emailConfigurations" - NotificationConfEmailConfigurationsEnabled = "emailConfigurations.enabled" - NotificationConfEmailConfigurationsMailAddress = "emailConfigurations.mailAddress" - NotificationConfSlackConfigurations = "slackConfigurations" - NotificationConfSlackConfigurationsEnabled = "slackConfigurations.enabled" - NotificationConfSlackConfigurationsWebhook = "slackConfigurations.webhook" - NotificationConfTelegramConfigurations = "telegramConfigurations" - NotificationConfTelegramConfigurationsEnabled = "telegramConfigurations.enabled" + NotificationConfEmail = "email" + NotificationConfEmailEnabled = "email.enabled" + NotificationConfEmailMailAddress = "email.mailAddress" + NotificationConfSlack = "slack" + NotificationConfSlackEnabled = "slack.enabled" + NotificationConfSlackUrl = "slack.url" + NotificationConfTelegram = "telegram" + NotificationConfTelegramChatId = "telegram.chatId" + NotificationConfTelegramEnabled = "telegram.enabled" + NotificationConfTelegramToken = "telegram.token" + NotificationConfWebhook = "webhook" + NotificationConfWebhookEnabled = "webhook.enabled" + NotificationConfWebhookUrl = "webhook.url" ) -// constant vars generated for struct SlackConfig +// constant vars generated for struct Slack const ( - SlackConfigEnabled = "enabled" - SlackConfigWebhook = "webhook" + SlackEnabled = "enabled" + SlackUrl = "url" ) // constant vars generated for struct Subscription const ( - SubscriptionConfigurations = "configurations" - SubscriptionConfigurationsAlertsEnabled = "configurations.alertsEnabled" - SubscriptionConfigurationsNotificationsEnabled = "configurations.notificationsEnabled" - SubscriptionEnabled = "enabled" - SubscriptionMailAddress = "mailAddress" + SubscriptionEnabled = "enabled" + SubscriptionMailAddress = "mailAddress" ) -// constant vars generated for struct SubscriptionConf +// constant vars generated for struct Telegram const ( - SubscriptionConfAlertsEnabled = "alertsEnabled" - SubscriptionConfNotificationsEnabled = "notificationsEnabled" + TelegramChatId = "chatId" + TelegramEnabled = "enabled" + TelegramToken = "token" ) -// constant vars generated for struct TelegramConfig +// constant vars generated for struct Webhook const ( - TelegramConfigEnabled = "enabled" + WebhookEnabled = "enabled" + WebhookUrl = "url" ) // constant vars generated for struct diff --git a/apps/comms/internal/domain/entities/field-constants/generated_constants_notification.go b/apps/comms/internal/domain/entities/field-constants/generated_constants_notification.go index 76b1b365b..a0aebf9a6 100644 --- a/apps/comms/internal/domain/entities/field-constants/generated_constants_notification.go +++ b/apps/comms/internal/domain/entities/field-constants/generated_constants_notification.go @@ -4,29 +4,29 @@ package field_constants // constant vars generated for struct Notification const ( - NotificationAccountName = "accountName" - NotificationCreationTime = "creationTime" - NotificationId = "id" - NotificationMarkedForDeletion = "markedForDeletion" - NotificationNotificationClusterParams = "notificationClusterParams" - NotificationNotificationClusterParamsClusterName = "notificationClusterParams.clusterName" - NotificationNotificationEnvParams = "notificationEnvParams" - NotificationNotificationEnvParamsEnvName = "notificationEnvParams.envName" - NotificationNotificationType = "notificationType" - NotificationRead = "read" - NotificationRecordVersion = "recordVersion" - NotificationResourceType = "resourceType" - NotificationUpdateTime = "updateTime" + NotificationAccountName = "accountName" + NotificationContent = "content" + NotificationContentBody = "content.body" + NotificationContentImage = "content.image" + NotificationContentLink = "content.link" + NotificationContentSubject = "content.subject" + NotificationContentTitle = "content.title" + NotificationCreationTime = "creationTime" + NotificationId = "id" + NotificationMarkedForDeletion = "markedForDeletion" + NotificationNotificationType = "notificationType" + NotificationRead = "read" + NotificationRecordVersion = "recordVersion" + NotificationUpdateTime = "updateTime" ) -// constant vars generated for struct NotificationClusterParams +// constant vars generated for struct NotifyContent const ( - NotificationClusterParamsClusterName = "clusterName" -) - -// constant vars generated for struct NotificationEnvParams -const ( - NotificationEnvParamsEnvName = "envName" + NotifyContentBody = "body" + NotifyContentImage = "image" + NotifyContentLink = "link" + NotifyContentSubject = "subject" + NotifyContentTitle = "title" ) // constant vars generated for struct From a9ec61b4731424c5d512ff492f6b2db5a0ef949c Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Thu, 6 Jun 2024 13:07:00 +0530 Subject: [PATCH 5/5] :sparkles: Added gql to comms --- apps/comms/internal/app/app.go | 17 ++ .../internal/app/graph/generated/generated.go | 166 +++++++++--------- .../app/graph/matchfilter.resolvers.go | 1 - .../internal/app/graph/model/models_gen.go | 6 +- .../app/graph/notification.resolvers.go | 1 - .../app/graph/notificationconf.resolvers.go | 76 ++++---- .../struct-to-graphql/common-types.graphqls | 6 +- .../struct-to-graphql/notification.graphqls | 1 + apps/comms/internal/app/notify-publish.go | 22 +++ apps/comms/internal/domain/api.go | 2 +- apps/comms/internal/domain/main.go | 27 ++- apps/comms/internal/env/env.go | 10 ++ apps/comms/internal/framework/framework.go | 50 +++++- apps/comms/types/types.go | 1 + apps/console/internal/app/app.go | 1 + apps/gateway/generate-schema.sh | 4 + apps/gateway/supergraph.yml | 4 + pkg/http-server/http-server.go | 1 + 18 files changed, 251 insertions(+), 145 deletions(-) create mode 100644 apps/comms/internal/app/notify-publish.go diff --git a/apps/comms/internal/app/app.go b/apps/comms/internal/app/app.go index 6520cb691..fe40df32b 100644 --- a/apps/comms/internal/app/app.go +++ b/apps/comms/internal/app/app.go @@ -27,9 +27,14 @@ import ( "github.com/kloudlite/api/pkg/grpc" "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/comms" + "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/iam" "go.uber.org/fx" ) +type ( + IAMGrpcClient grpc.Client +) + type NotificationConsumer messaging.Consumer type CommsGrpcServer grpc.Server @@ -39,6 +44,8 @@ var Module = fx.Module("app", repos.NewFxMongoRepo[*entities.Subscription]("subscriptions", "prj", entities.SubscriptionIndexes), repos.NewFxMongoRepo[*types.Notification]("notifications", "prj", entities.SubscriptionIndexes), + domain.Module, + fx.Provide(func(jc *nats.JetstreamClient, ev *env.Env, logger logging.Logger) (NotificationConsumer, error) { topic := string(common.NotificationTopicName) consumerName := "ntfy:message" @@ -55,6 +62,12 @@ var Module = fx.Module("app", }) }), + fx.Provide( + func(conn IAMGrpcClient) iam.IAMClient { + return iam.NewIAMClient(conn) + }, + ), + fx.Provide(func(et domain.EmailTemplatesDir) (*domain.EmailTemplates, error) { return domain.GetEmailTemplates(et) }), @@ -65,6 +78,10 @@ var Module = fx.Module("app", comms.RegisterCommsServer(server, commsServer) }), + fx.Provide(func(cli *nats.Client, logger logging.Logger) domain.ResourceEventPublisher { + return NewResourceEventPublisher(cli, logger) + }), + fx.Invoke( func(server httpServer.Server, d domain.Domain, sessionRepo kv.Repo[*common.AuthSession], ev *env.Env) { gqlConfig := generated.Config{Resolvers: &graph.Resolver{Domain: d, Env: ev}} diff --git a/apps/comms/internal/app/graph/generated/generated.go b/apps/comms/internal/app/graph/generated/generated.go index b4b7375a5..420a45ef0 100644 --- a/apps/comms/internal/app/graph/generated/generated.go +++ b/apps/comms/internal/app/graph/generated/generated.go @@ -77,9 +77,8 @@ type ComplexityRoot struct { } Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack struct { - Channel func(childComplexity int) int Enabled func(childComplexity int) int - Webhook func(childComplexity int) int + URL func(childComplexity int) int } Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram struct { @@ -128,6 +127,7 @@ type ComplexityRoot struct { Id func(childComplexity int) int MarkedForDeletion func(childComplexity int) int NotificationType func(childComplexity int) int + Priority func(childComplexity int) int Read func(childComplexity int) int RecordVersion func(childComplexity int) int UpdateTime func(childComplexity int) int @@ -327,13 +327,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Email.MailAddress(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.channel": - if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Channel == nil { - break - } - - return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Channel(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.enabled": if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Enabled == nil { break @@ -341,12 +334,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Enabled(childComplexity), true - case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.webhook": - if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Webhook == nil { + case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.url": + if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.URL == nil { break } - return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.Webhook(childComplexity), true + return e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack.URL(childComplexity), true case "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.chatId": if e.complexity.Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram.ChatID == nil { @@ -552,6 +545,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Notification.NotificationType(childComplexity), true + case "Notification.priority": + if e.complexity.Notification.Priority == nil { + break + } + + return e.complexity.Notification.Priority(childComplexity), true + case "Notification.read": if e.complexity.Notification.Read == nil { break @@ -1002,9 +1002,8 @@ type Mutation { } type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack @shareable { - channel: String! enabled: Boolean! - webhook: String! + url: String! } type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram @shareable { @@ -1045,9 +1044,8 @@ input Github__com___kloudlite___api___apps___comms___internal___domain___entitie } input Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn { - channel: String! enabled: Boolean! - webhook: String! + url: String! } input Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn { @@ -1129,6 +1127,7 @@ input MatchFilterIn { id: ID! markedForDeletion: Boolean notificationType: Github__com___kloudlite___api___apps___comms___types__NotificationType! + priority: Int! read: Boolean! recordVersion: Int! updateTime: Date! @@ -1742,50 +1741,6 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___ return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Channel, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack", - 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) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_enabled(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_enabled(ctx, field) if err != nil { @@ -1830,8 +1785,8 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___ return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_url(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_url(ctx, field) if err != nil { return graphql.Null } @@ -1844,7 +1799,7 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Webhook, nil + return obj.URL, nil }) if err != nil { ec.Error(ctx, err) @@ -1861,7 +1816,7 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_url(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack", Field: field, @@ -2895,6 +2850,8 @@ func (ec *executionContext) fieldContext_Mutation_comms_markNotificationAsRead(c return ec.fieldContext_Notification_markedForDeletion(ctx, field) case "notificationType": return ec.fieldContext_Notification_notificationType(ctx, field) + case "priority": + return ec.fieldContext_Notification_priority(ctx, field) case "read": return ec.fieldContext_Notification_read(ctx, field) case "recordVersion": @@ -3192,6 +3149,50 @@ func (ec *executionContext) fieldContext_Notification_notificationType(ctx conte return fc, nil } +func (ec *executionContext) _Notification_priority(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Notification_priority(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Priority, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Notification_priority(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Notification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Notification_read(ctx context.Context, field graphql.CollectedField, obj *types.Notification) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Notification_read(ctx, field) if err != nil { @@ -3728,12 +3729,10 @@ func (ec *executionContext) fieldContext_NotificationConf_slack(ctx context.Cont IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "channel": - return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx, field) case "enabled": return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_enabled(ctx, field) - case "webhook": - return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx, field) + case "url": + return ec.fieldContext_Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_url(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack", field.Name) }, @@ -3976,6 +3975,8 @@ func (ec *executionContext) fieldContext_NotificationEdge_node(ctx context.Conte return ec.fieldContext_Notification_markedForDeletion(ctx, field) case "notificationType": return ec.fieldContext_Notification_notificationType(ctx, field) + case "priority": + return ec.fieldContext_Notification_priority(ctx, field) case "read": return ec.fieldContext_Notification_read(ctx, field) case "recordVersion": @@ -7319,20 +7320,13 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps__ asMap[k] = v } - fieldsInOrder := [...]string{"channel", "enabled", "webhook"} + fieldsInOrder := [...]string{"enabled", "url"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "channel": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("channel")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Channel = data case "enabled": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled")) data, err := ec.unmarshalNBoolean2bool(ctx, v) @@ -7340,13 +7334,13 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps__ return it, err } it.Enabled = data - case "webhook": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("webhook")) + case "url": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("url")) data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.Webhook = data + it.URL = data } } @@ -7718,18 +7712,13 @@ func (ec *executionContext) _Github__com___kloudlite___api___apps___comms___inte switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack") - case "channel": - out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_channel(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } case "enabled": out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_enabled(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "webhook": - out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_webhook(ctx, field, obj) + case "url": + out.Values[i] = ec._Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack_url(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -8251,6 +8240,11 @@ func (ec *executionContext) _Notification(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "priority": + out.Values[i] = ec._Notification_priority(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } case "read": out.Values[i] = ec._Notification_read(ctx, field, obj) if out.Values[i] == graphql.Null { diff --git a/apps/comms/internal/app/graph/matchfilter.resolvers.go b/apps/comms/internal/app/graph/matchfilter.resolvers.go index e96685cb0..01998de80 100644 --- a/apps/comms/internal/app/graph/matchfilter.resolvers.go +++ b/apps/comms/internal/app/graph/matchfilter.resolvers.go @@ -16,7 +16,6 @@ import ( // MatchType is the resolver for the matchType field. func (r *matchFilterResolver) MatchType(ctx context.Context, obj *repos.MatchFilter) (model.GithubComKloudliteAPIPkgReposMatchType, error) { - if obj == nil { return "", fmt.Errorf("obj is nil") } diff --git a/apps/comms/internal/app/graph/model/models_gen.go b/apps/comms/internal/app/graph/model/models_gen.go index d02bbe2b1..eafa39616 100644 --- a/apps/comms/internal/app/graph/model/models_gen.go +++ b/apps/comms/internal/app/graph/model/models_gen.go @@ -21,15 +21,13 @@ type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn struct { } type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack struct { - Channel string `json:"channel"` Enabled bool `json:"enabled"` - Webhook string `json:"webhook"` + URL string `json:"url"` } type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn struct { - Channel string `json:"channel"` Enabled bool `json:"enabled"` - Webhook string `json:"webhook"` + URL string `json:"url"` } type GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram struct { diff --git a/apps/comms/internal/app/graph/notification.resolvers.go b/apps/comms/internal/app/graph/notification.resolvers.go index 16d145057..5999dfa74 100644 --- a/apps/comms/internal/app/graph/notification.resolvers.go +++ b/apps/comms/internal/app/graph/notification.resolvers.go @@ -17,7 +17,6 @@ import ( // Content is the resolver for the content field. func (r *notificationResolver) Content(ctx context.Context, obj *types.Notification) (*model.GithubComKloudliteAPIAppsCommsTypesNotifyContent, error) { - if obj == nil { return nil, fmt.Errorf("nil object") } diff --git a/apps/comms/internal/app/graph/notificationconf.resolvers.go b/apps/comms/internal/app/graph/notificationconf.resolvers.go index 2b6ad66f5..cd353bfed 100644 --- a/apps/comms/internal/app/graph/notificationconf.resolvers.go +++ b/apps/comms/internal/app/graph/notificationconf.resolvers.go @@ -24,61 +24,52 @@ func (r *notificationConfResolver) CreationTime(ctx context.Context, obj *entiti return obj.CreationTime.Format(time.RFC3339), nil } -// UpdateTime is the resolver for the updateTime field. -func (r *notificationConfResolver) UpdateTime(ctx context.Context, obj *entities.NotificationConf) (string, error) { +// Email is the resolver for the email field. +func (r *notificationConfResolver) Email(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail, error) { if obj == nil { - return "", fmt.Errorf("obj is nil") - } - - return obj.UpdateTime.Format(time.RFC3339), nil -} - -// Webhook is the resolver for the webhook field. -func (r *notificationConfResolver) Webhook(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook, error) { - - if obj.Webhook == nil { - return nil, nil + return nil, fmt.Errorf("obj is nil") } - return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook](obj.Webhook) + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail](obj.Email) } -// Webhook is the resolver for the webhook field. -func (r *notificationConfInResolver) Webhook(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn) error { +// Slack is the resolver for the slack field. +func (r *notificationConfResolver) Slack(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack, error) { if obj == nil { - return fmt.Errorf("obj is nil") - } - - gckacideesci, err := fn.JsonConvertP[entities.Webhook](data) - if err != nil { - return err + return nil, fmt.Errorf("obj is nil") } - obj.Webhook = gckacideesci - return nil + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack](obj.Slack) } -func (r *notificationConfResolver) Email(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail, error) { +// Telegram is the resolver for the telegram field. +func (r *notificationConfResolver) Telegram(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram, error) { if obj == nil { return nil, fmt.Errorf("obj is nil") } - return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmail](obj.Email) + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram](obj.Telegram) } -func (r *notificationConfResolver) Slack(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack, error) { + +// UpdateTime is the resolver for the updateTime field. +func (r *notificationConfResolver) UpdateTime(ctx context.Context, obj *entities.NotificationConf) (string, error) { if obj == nil { - return nil, fmt.Errorf("obj is nil") + return "", fmt.Errorf("obj is nil") } - return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlack](obj.Slack) + return obj.UpdateTime.Format(time.RFC3339), nil } -func (r *notificationConfResolver) Telegram(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram, error) { - if obj == nil { - return nil, fmt.Errorf("obj is nil") + +// Webhook is the resolver for the webhook field. +func (r *notificationConfResolver) Webhook(ctx context.Context, obj *entities.NotificationConf) (*model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook, error) { + if obj.Webhook == nil { + return nil, nil } - return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegram](obj.Telegram) + return fn.JsonConvertP[model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhook](obj.Webhook) } + +// Email is the resolver for the email field. func (r *notificationConfInResolver) Email(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesEmailIn) error { if obj == nil { return fmt.Errorf("obj is nil") @@ -93,6 +84,8 @@ func (r *notificationConfInResolver) Email(ctx context.Context, obj *entities.No return nil } + +// Slack is the resolver for the slack field. func (r *notificationConfInResolver) Slack(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesSlackIn) error { if obj == nil { return fmt.Errorf("obj is nil") @@ -106,6 +99,8 @@ func (r *notificationConfInResolver) Slack(ctx context.Context, obj *entities.No obj.Slack = gckacideesci return nil } + +// Telegram is the resolver for the telegram field. func (r *notificationConfInResolver) Telegram(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesTelegramIn) error { if obj == nil { return fmt.Errorf("obj is nil") @@ -121,6 +116,21 @@ func (r *notificationConfInResolver) Telegram(ctx context.Context, obj *entities return nil } +// Webhook is the resolver for the webhook field. +func (r *notificationConfInResolver) Webhook(ctx context.Context, obj *entities.NotificationConf, data *model.GithubComKloudliteAPIAppsCommsInternalDomainEntitiesWebhookIn) error { + if obj == nil { + return fmt.Errorf("obj is nil") + } + + gckacideesci, err := fn.JsonConvertP[entities.Webhook](data) + if err != nil { + return err + } + + obj.Webhook = gckacideesci + return nil +} + // NotificationConf returns generated.NotificationConfResolver implementation. func (r *Resolver) NotificationConf() generated.NotificationConfResolver { return ¬ificationConfResolver{r} diff --git a/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls index 650bb03e5..94ce581b3 100644 --- a/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls +++ b/apps/comms/internal/app/graph/struct-to-graphql/common-types.graphqls @@ -4,9 +4,8 @@ type Github__com___kloudlite___api___apps___comms___internal___domain___entities } type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Slack @shareable { - channel: String! enabled: Boolean! - webhook: String! + url: String! } type Github__com___kloudlite___api___apps___comms___internal___domain___entities__Telegram @shareable { @@ -47,9 +46,8 @@ input Github__com___kloudlite___api___apps___comms___internal___domain___entitie } input Github__com___kloudlite___api___apps___comms___internal___domain___entities__SlackIn { - channel: String! enabled: Boolean! - webhook: String! + url: String! } input Github__com___kloudlite___api___apps___comms___internal___domain___entities__TelegramIn { diff --git a/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls b/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls index 6b1fe479e..0065207ca 100644 --- a/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls +++ b/apps/comms/internal/app/graph/struct-to-graphql/notification.graphqls @@ -5,6 +5,7 @@ type Notification @shareable { id: ID! markedForDeletion: Boolean notificationType: Github__com___kloudlite___api___apps___comms___types__NotificationType! + priority: Int! read: Boolean! recordVersion: Int! updateTime: Date! diff --git a/apps/comms/internal/app/notify-publish.go b/apps/comms/internal/app/notify-publish.go new file mode 100644 index 000000000..ee863ccb9 --- /dev/null +++ b/apps/comms/internal/app/notify-publish.go @@ -0,0 +1,22 @@ +package app + +import ( + "github.com/kloudlite/api/apps/comms/internal/domain" + "github.com/kloudlite/api/pkg/logging" + "github.com/kloudlite/api/pkg/nats" +) + +type ResourceEventPublisherImpl struct { + cli *nats.Client + logger logging.Logger +} + +func (r *ResourceEventPublisherImpl) publish(subject string, msg domain.PublishMsg) { + if err := r.cli.Conn.Publish(subject, []byte(msg)); err != nil { + r.logger.Errorf(err, "failed to publish message to subject %q", subject) + } +} + +func NewResourceEventPublisher(cli *nats.Client, logger logging.Logger) domain.ResourceEventPublisher { + return &ResourceEventPublisherImpl{cli, logger} +} diff --git a/apps/comms/internal/domain/api.go b/apps/comms/internal/domain/api.go index 51e882827..78a7f8f6a 100644 --- a/apps/comms/internal/domain/api.go +++ b/apps/comms/internal/domain/api.go @@ -30,5 +30,5 @@ const ( ) type ResourceEventPublisher interface { - PublishBuildNotification(cluster *types.Notification, msg PublishMsg) + // PublishBuildNotification(cluster *types.Notification, msg PublishMsg) } diff --git a/apps/comms/internal/domain/main.go b/apps/comms/internal/domain/main.go index 7be09add9..3e893fc8e 100644 --- a/apps/comms/internal/domain/main.go +++ b/apps/comms/internal/domain/main.go @@ -4,9 +4,8 @@ import ( "github.com/kloudlite/api/apps/comms/internal/domain/entities" "github.com/kloudlite/api/apps/comms/internal/env" "github.com/kloudlite/api/apps/comms/types" - "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/auth" "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/iam" - "github.com/kloudlite/api/pkg/kv" + // "github.com/kloudlite/api/pkg/kv" "github.com/kloudlite/api/pkg/logging" "github.com/kloudlite/api/pkg/mail" "github.com/kloudlite/api/pkg/repos" @@ -18,11 +17,11 @@ type Impl struct { subscriptionRepo repos.DbRepo[*entities.Subscription] notificationConfigRepo repos.DbRepo[*entities.NotificationConf] - iamClient iam.IAMClient - envs *env.Env - logger logging.Logger - cacheClient kv.BinaryDataRepo - authClient auth.AuthClient + iamClient iam.IAMClient + envs *env.Env + logger logging.Logger + // cacheClient kv.BinaryDataRepo + // authClient auth.AuthClient eTemplates *EmailTemplates @@ -40,19 +39,19 @@ var Module = fx.Module("domain", fx.Provide(func(e *env.Env, logger logging.Logger, iamClient iam.IAMClient, - cacheClient kv.BinaryDataRepo, - authClient auth.AuthClient, + // cacheClient kv.BinaryDataRepo, + // authClient auth.AuthClient, resourceEventPublisher ResourceEventPublisher, eTemplates *EmailTemplates, mailer mail.Mailer, ) (Domain, error) { return &Impl{ - iamClient: iamClient, - envs: e, - logger: logger, - cacheClient: cacheClient, - authClient: authClient, + iamClient: iamClient, + envs: e, + logger: logger, + // cacheClient: cacheClient, + // authClient: authClient, resourceEventPublisher: resourceEventPublisher, notificationRepo: notificationRepo, diff --git a/apps/comms/internal/env/env.go b/apps/comms/internal/env/env.go index c9605efd8..4ccada7d2 100644 --- a/apps/comms/internal/env/env.go +++ b/apps/comms/internal/env/env.go @@ -19,9 +19,19 @@ type Env struct { AccountCookieName string `env:"ACCOUNT_COOKIE_NAME" required:"true"` + NatsURL string `env:"NATS_URL" required:"true"` + // NATS:start NotificationNatsStream string `env:"NOTIFICATION_NATS_STREAM" required:"true"` // NATS:start + + IsDev bool + + SessionKVBucket string `env:"SESSION_KV_BUCKET" required:"true"` + IAMGrpcAddr string `env:"IAM_GRPC_ADDR" required:"true"` + + CommsDBUri string `env:"MONGO_URI" required:"true"` + CommsDBName string `env:"MONGO_DB_NAME" required:"true"` } func LoadEnv() (*Env, error) { diff --git a/apps/comms/internal/framework/framework.go b/apps/comms/internal/framework/framework.go index 23c466da2..e2fa8194f 100644 --- a/apps/comms/internal/framework/framework.go +++ b/apps/comms/internal/framework/framework.go @@ -3,19 +3,49 @@ package framework import ( "context" "fmt" + "time" + "github.com/kloudlite/api/apps/comms/internal/app" "github.com/kloudlite/api/apps/comms/internal/env" + "github.com/kloudlite/api/common" "github.com/kloudlite/api/pkg/errors" "github.com/kloudlite/api/pkg/grpc" + rpc "github.com/kloudlite/api/pkg/grpc" + httpServer "github.com/kloudlite/api/pkg/http-server" + "github.com/kloudlite/api/pkg/kv" "github.com/kloudlite/api/pkg/logging" "github.com/kloudlite/api/pkg/mail" + "github.com/kloudlite/api/pkg/nats" + mongoDb "github.com/kloudlite/api/pkg/repos" "go.uber.org/fx" - "time" ) +type fm struct { + ev *env.Env +} + +func (fm *fm) GetMongoConfig() (url string, dbName string) { + return fm.ev.CommsDBUri, fm.ev.CommsDBName +} + var Module = fx.Module( "framework", + fx.Provide(func(ev *env.Env) *fm { + return &fm{ev} + }), + + fx.Provide(func(ev *env.Env, logger logging.Logger) (*nats.Client, error) { + return nats.NewClient(ev.NatsURL, nats.ClientOpts{ + Name: "comms", + Logger: logger, + }) + }), + + fx.Provide(func(c *nats.Client) (*nats.JetstreamClient, error) { + return nats.NewJetstreamClient(c) + }), + fx.Provide(func(ev *env.Env) mail.Mailer { return mail.NewSendgridMailer(ev.SendgridApiKey) }), @@ -26,6 +56,24 @@ var Module = fx.Module( app.Module, + fx.Provide(func(logger logging.Logger, e *env.Env) httpServer.Server { + corsOrigins := "https://studio.apollographql.com" + return httpServer.NewServer(httpServer.ServerArgs{Logger: logger, CorsAllowOrigins: &corsOrigins, IsDev: e.IsDev}) + }), + + fx.Provide( + func(ev *env.Env, jc *nats.JetstreamClient) (kv.Repo[*common.AuthSession], error) { + cxt := context.TODO() + return kv.NewNatsKVRepo[*common.AuthSession](cxt, ev.SessionKVBucket, jc) + }, + ), + + fx.Provide(func(ev *env.Env) (app.IAMGrpcClient, error) { + return rpc.NewGrpcClient(ev.IAMGrpcAddr) + }), + + mongoDb.NewMongoClientFx[*fm](), + fx.Invoke(func(lf fx.Lifecycle, server app.CommsGrpcServer, ev *env.Env, logger logging.Logger) { lf.Append(fx.Hook{ OnStart: func(ctx context.Context) error { diff --git a/apps/comms/types/types.go b/apps/comms/types/types.go index 0d0d53f5e..4c608e487 100644 --- a/apps/comms/types/types.go +++ b/apps/comms/types/types.go @@ -27,6 +27,7 @@ type Notification struct { Type NotificationType `json:"notificationType" graphql:"noinput"` Content NotifyContent `json:"content" graphql:"noinput"` + Priority int `json:"priority" graphql:"noinput"` AccountName string `json:"accountName" graphql:"noinput"` Read bool `json:"read" graphql:"noinput"` } diff --git a/apps/console/internal/app/app.go b/apps/console/internal/app/app.go index faf59d2d3..88a94b0bb 100644 --- a/apps/console/internal/app/app.go +++ b/apps/console/internal/app/app.go @@ -182,6 +182,7 @@ var Module = fx.Module("app", }, }) }), + fx.Invoke(func(lf fx.Lifecycle, consumer ResourceUpdateConsumer, d domain.Domain, logger logging.Logger) { lf.Append(fx.Hook{ OnStart: func(context.Context) error { diff --git a/apps/gateway/generate-schema.sh b/apps/gateway/generate-schema.sh index f125eb675..230c1c402 100644 --- a/apps/gateway/generate-schema.sh +++ b/apps/gateway/generate-schema.sh @@ -10,6 +10,10 @@ cat ../accounts/internal/app/graph/struct-to-graphql/*.graphqls >>./schemas/acco cat ../console/internal/app/graph/*.graphqls >./schemas/console-api.schema cat ../console/internal/app/graph/struct-to-graphql/*.graphqls >>./schemas/console-api.schema +cat ../comms/internal/app/graph/*.graphqls >./schemas/comms-api.schema +cat ../comms/internal/app/graph/struct-to-graphql/*.graphqls >>./schemas/comms-api.schema + + cat ../container-registry/internal/app/graph/*.graphqls >./schemas/container-registry-api.schema cat ../container-registry/internal/app/graph/struct-to-graphql/*.graphqls >>./schemas/container-registry-api.schema diff --git a/apps/gateway/supergraph.yml b/apps/gateway/supergraph.yml index dc0469425..a3180ab5f 100644 --- a/apps/gateway/supergraph.yml +++ b/apps/gateway/supergraph.yml @@ -16,6 +16,10 @@ subgraphs: routing_url: http://console-api:3000/query schema: file: ./schemas/console-api.schema + comms-api: + routing_url: http://comms-api:3000/query + schema: + file: ./schemas/comms-api.schema infra-api: routing_url: http://infra-api:3000/query schema: diff --git a/pkg/http-server/http-server.go b/pkg/http-server/http-server.go index 0c3d9d112..a6b0399ad 100644 --- a/pkg/http-server/http-server.go +++ b/pkg/http-server/http-server.go @@ -66,6 +66,7 @@ type ServerArgs struct { IsDev bool Logger logging.Logger CorsAllowOrigins *string + IAMGrpcAddr string `env:"IAM_GRPC_ADDR" required:"true"` } func NewServer(args ServerArgs) Server {