From 7b423f8b0590710307df095c6f9202d750b8c276 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Wed, 8 Jan 2025 14:42:48 +0100 Subject: [PATCH 1/2] chore: update schema --- go.mod | 2 +- go.sum | 2 + .../mimir/graph/generated/generated.go | 252 ++++++++++++++---- .../graph/m_insert_run_service_config.go | 18 +- .../services/mimir/graph/schema.resolvers.go | 4 +- .../be/services/mimir/model/models_gen.go | 5 + .../nhost/be/services/mimir/nhost/models.go | 12 +- .../nhost/be/services/mimir/schema/schema.cue | 8 +- .../be/services/mimir/schema/schema.graphqls | 8 +- vendor/modules.txt | 2 +- 10 files changed, 247 insertions(+), 66 deletions(-) diff --git a/go.mod b/go.mod index ed930f660..1df34bbdd 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 github.com/hashicorp/go-getter v1.7.6 - github.com/nhost/be v0.0.0-20241204194612-edc17ec72b31 + github.com/nhost/be v0.0.0-20250108133629-afef8c60957d github.com/pelletier/go-toml/v2 v2.2.3 github.com/rs/cors/wrapper/gin v0.0.0-20240830163046-1084d89a1692 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index ae68195f0..a9f5130bb 100644 --- a/go.sum +++ b/go.sum @@ -534,6 +534,8 @@ github.com/nhost/be v0.0.0-20241204190417-8fa53b2d4c01 h1:4/JXNR7XKnMmzCBtDu2dLF github.com/nhost/be v0.0.0-20241204190417-8fa53b2d4c01/go.mod h1:6lkCTKviZ+ZQDaYed7QFz4MoFb5sg10tlaux2AHeBEQ= github.com/nhost/be v0.0.0-20241204194612-edc17ec72b31 h1:zksBHPXvVGSjI7N8ib6b3qatNULgXGB1RTulaemp+aE= github.com/nhost/be v0.0.0-20241204194612-edc17ec72b31/go.mod h1:6lkCTKviZ+ZQDaYed7QFz4MoFb5sg10tlaux2AHeBEQ= +github.com/nhost/be v0.0.0-20250108133629-afef8c60957d h1:Qpm1om9RfHMFILg9LTZchPkvGShOBgSj2kf5cMXFoDU= +github.com/nhost/be v0.0.0-20250108133629-afef8c60957d/go.mod h1:6lkCTKviZ+ZQDaYed7QFz4MoFb5sg10tlaux2AHeBEQ= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= diff --git a/vendor/github.com/nhost/be/services/mimir/graph/generated/generated.go b/vendor/github.com/nhost/be/services/mimir/graph/generated/generated.go index 1a4566885..f9a7db594 100644 --- a/vendor/github.com/nhost/be/services/mimir/graph/generated/generated.go +++ b/vendor/github.com/nhost/be/services/mimir/graph/generated/generated.go @@ -693,13 +693,18 @@ type ComplexityRoot struct { Tput func(childComplexity int) int } + InsertRunServiceConfigResponse struct { + Config func(childComplexity int) int + ServiceID func(childComplexity int) int + } + Mutation struct { ChangeDatabaseVersion func(childComplexity int, appID string, version string, force *bool) int DeleteConfig func(childComplexity int, appID string) int DeleteRunServiceConfig func(childComplexity int, appID string, serviceID string) int DeleteSecret func(childComplexity int, appID string, key string) int InsertConfig func(childComplexity int, appID string, config model.ConfigConfigInsertInput, systemConfig model.ConfigSystemConfigInsertInput, secrets []*model.ConfigEnvironmentVariableInsertInput) int - InsertRunServiceConfig func(childComplexity int, appID string, serviceID string, config model.ConfigRunServiceConfigInsertInput) int + InsertRunServiceConfig func(childComplexity int, appID string, config model.ConfigRunServiceConfigInsertInput) int InsertSecret func(childComplexity int, appID string, secret model.ConfigEnvironmentVariableInsertInput) int ReplaceConfig func(childComplexity int, appID string, config model.ConfigConfigInsertInput) int ReplaceConfigRawJSON func(childComplexity int, appID string, rawJSON string) int @@ -736,7 +741,7 @@ type MutationResolver interface { UpdateSecret(ctx context.Context, appID string, secret model.ConfigEnvironmentVariableInsertInput) (*model.ConfigEnvironmentVariable, error) DeleteSecret(ctx context.Context, appID string, key string) (*model.ConfigEnvironmentVariable, error) UpdateSystemConfig(ctx context.Context, appID string, systemConfig model.ConfigSystemConfigUpdateInput) (*model.ConfigSystemConfig, error) - InsertRunServiceConfig(ctx context.Context, appID string, serviceID string, config model.ConfigRunServiceConfigInsertInput) (*model.ConfigRunServiceConfig, error) + InsertRunServiceConfig(ctx context.Context, appID string, config model.ConfigRunServiceConfigInsertInput) (*model.InsertRunServiceConfigResponse, error) UpdateRunServiceConfig(ctx context.Context, appID string, serviceID string, config model.ConfigRunServiceConfigUpdateInput) (*model.ConfigRunServiceConfig, error) ReplaceRunServiceConfig(ctx context.Context, appID string, serviceID string, config model.ConfigRunServiceConfigInsertInput) (*model.ConfigRunServiceConfig, error) DeleteRunServiceConfig(ctx context.Context, appID string, serviceID string) (*model.ConfigRunServiceConfig, error) @@ -3182,6 +3187,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ConfigSystemConfigPostgresDisk.Tput(childComplexity), true + case "InsertRunServiceConfigResponse.config": + if e.complexity.InsertRunServiceConfigResponse.Config == nil { + break + } + + return e.complexity.InsertRunServiceConfigResponse.Config(childComplexity), true + + case "InsertRunServiceConfigResponse.serviceID": + if e.complexity.InsertRunServiceConfigResponse.ServiceID == nil { + break + } + + return e.complexity.InsertRunServiceConfigResponse.ServiceID(childComplexity), true + case "Mutation.changeDatabaseVersion": if e.complexity.Mutation.ChangeDatabaseVersion == nil { break @@ -3252,7 +3271,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.InsertRunServiceConfig(childComplexity, args["appID"].(string), args["serviceID"].(string), args["config"].(model.ConfigRunServiceConfigInsertInput)), true + return e.complexity.Mutation.InsertRunServiceConfig(childComplexity, args["appID"].(string), args["config"].(model.ConfigRunServiceConfigInsertInput)), true case "Mutation.insertSecret": if e.complexity.Mutation.InsertSecret == nil { @@ -3824,6 +3843,11 @@ type ConfigRunServiceConfigWithID { config: ConfigRunServiceConfig! } +type InsertRunServiceConfigResponse { + serviceID: uuid! + config: ConfigRunServiceConfig! +} + type Query { configRawJSON( appID: uuid! @hasAppVisibility, @@ -3921,9 +3945,8 @@ type Mutation { insertRunServiceConfig( appID: uuid! @hasAppVisibility, - serviceID: uuid!, config: ConfigRunServiceConfigInsertInput!, - ): ConfigRunServiceConfig! + ): InsertRunServiceConfigResponse! updateRunServiceConfig( appID: uuid! @hasAppVisibility, serviceID: uuid!, @@ -8647,16 +8670,11 @@ func (ec *executionContext) field_Mutation_insertRunServiceConfig_args(ctx conte return nil, err } args["appID"] = arg0 - arg1, err := ec.field_Mutation_insertRunServiceConfig_argsServiceID(ctx, rawArgs) + arg1, err := ec.field_Mutation_insertRunServiceConfig_argsConfig(ctx, rawArgs) if err != nil { return nil, err } - args["serviceID"] = arg1 - arg2, err := ec.field_Mutation_insertRunServiceConfig_argsConfig(ctx, rawArgs) - if err != nil { - return nil, err - } - args["config"] = arg2 + args["config"] = arg1 return args, nil } func (ec *executionContext) field_Mutation_insertRunServiceConfig_argsAppID( @@ -8703,28 +8721,6 @@ func (ec *executionContext) field_Mutation_insertRunServiceConfig_argsAppID( } } -func (ec *executionContext) field_Mutation_insertRunServiceConfig_argsServiceID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["serviceID"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("serviceID")) - if tmp, ok := rawArgs["serviceID"]; ok { - return ec.unmarshalNuuid2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - func (ec *executionContext) field_Mutation_insertRunServiceConfig_argsConfig( ctx context.Context, rawArgs map[string]interface{}, @@ -25857,6 +25853,110 @@ func (ec *executionContext) fieldContext_ConfigSystemConfigPostgresDisk_tput(_ c return fc, nil } +func (ec *executionContext) _InsertRunServiceConfigResponse_serviceID(ctx context.Context, field graphql.CollectedField, obj *model.InsertRunServiceConfigResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InsertRunServiceConfigResponse_serviceID(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.ServiceID, 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.marshalNuuid2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InsertRunServiceConfigResponse_serviceID(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InsertRunServiceConfigResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type uuid does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _InsertRunServiceConfigResponse_config(ctx context.Context, field graphql.CollectedField, obj *model.InsertRunServiceConfigResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InsertRunServiceConfigResponse_config(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.Config, 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.ConfigRunServiceConfig) + fc.Result = res + return ec.marshalNConfigRunServiceConfig2ᚖgithubᚗcomᚋnhostᚋbeᚋservicesᚋmimirᚋmodelᚐConfigRunServiceConfig(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InsertRunServiceConfigResponse_config(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InsertRunServiceConfigResponse", + 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_ConfigRunServiceConfig_name(ctx, field) + case "image": + return ec.fieldContext_ConfigRunServiceConfig_image(ctx, field) + case "command": + return ec.fieldContext_ConfigRunServiceConfig_command(ctx, field) + case "environment": + return ec.fieldContext_ConfigRunServiceConfig_environment(ctx, field) + case "ports": + return ec.fieldContext_ConfigRunServiceConfig_ports(ctx, field) + case "resources": + return ec.fieldContext_ConfigRunServiceConfig_resources(ctx, field) + case "healthCheck": + return ec.fieldContext_ConfigRunServiceConfig_healthCheck(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ConfigRunServiceConfig", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Mutation_updateConfig(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Mutation_updateConfig(ctx, field) if err != nil { @@ -26517,7 +26617,7 @@ func (ec *executionContext) _Mutation_insertRunServiceConfig(ctx context.Context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().InsertRunServiceConfig(rctx, fc.Args["appID"].(string), fc.Args["serviceID"].(string), fc.Args["config"].(model.ConfigRunServiceConfigInsertInput)) + return ec.resolvers.Mutation().InsertRunServiceConfig(rctx, fc.Args["appID"].(string), fc.Args["config"].(model.ConfigRunServiceConfigInsertInput)) }) if err != nil { ec.Error(ctx, err) @@ -26529,9 +26629,9 @@ func (ec *executionContext) _Mutation_insertRunServiceConfig(ctx context.Context } return graphql.Null } - res := resTmp.(*model.ConfigRunServiceConfig) + res := resTmp.(*model.InsertRunServiceConfigResponse) fc.Result = res - return ec.marshalNConfigRunServiceConfig2ᚖgithubᚗcomᚋnhostᚋbeᚋservicesᚋmimirᚋmodelᚐConfigRunServiceConfig(ctx, field.Selections, res) + return ec.marshalNInsertRunServiceConfigResponse2ᚖgithubᚗcomᚋnhostᚋbeᚋservicesᚋmimirᚋmodelᚐInsertRunServiceConfigResponse(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Mutation_insertRunServiceConfig(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -26542,22 +26642,12 @@ func (ec *executionContext) fieldContext_Mutation_insertRunServiceConfig(ctx con IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "name": - return ec.fieldContext_ConfigRunServiceConfig_name(ctx, field) - case "image": - return ec.fieldContext_ConfigRunServiceConfig_image(ctx, field) - case "command": - return ec.fieldContext_ConfigRunServiceConfig_command(ctx, field) - case "environment": - return ec.fieldContext_ConfigRunServiceConfig_environment(ctx, field) - case "ports": - return ec.fieldContext_ConfigRunServiceConfig_ports(ctx, field) - case "resources": - return ec.fieldContext_ConfigRunServiceConfig_resources(ctx, field) - case "healthCheck": - return ec.fieldContext_ConfigRunServiceConfig_healthCheck(ctx, field) + case "serviceID": + return ec.fieldContext_InsertRunServiceConfigResponse_serviceID(ctx, field) + case "config": + return ec.fieldContext_InsertRunServiceConfigResponse_config(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type ConfigRunServiceConfig", field.Name) + return nil, fmt.Errorf("no field named %q was found under type InsertRunServiceConfigResponse", field.Name) }, } defer func() { @@ -45156,6 +45246,50 @@ func (ec *executionContext) _ConfigSystemConfigPostgresDisk(ctx context.Context, return out } +var insertRunServiceConfigResponseImplementors = []string{"InsertRunServiceConfigResponse"} + +func (ec *executionContext) _InsertRunServiceConfigResponse(ctx context.Context, sel ast.SelectionSet, obj *model.InsertRunServiceConfigResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, insertRunServiceConfigResponseImplementors) + + 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("InsertRunServiceConfigResponse") + case "serviceID": + out.Values[i] = ec._InsertRunServiceConfigResponse_serviceID(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "config": + out.Values[i] = ec._InsertRunServiceConfigResponse_config(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 mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { @@ -47354,6 +47488,20 @@ func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.S return graphql.WrapContextMarshaler(ctx, res) } +func (ec *executionContext) marshalNInsertRunServiceConfigResponse2githubᚗcomᚋnhostᚋbeᚋservicesᚋmimirᚋmodelᚐInsertRunServiceConfigResponse(ctx context.Context, sel ast.SelectionSet, v model.InsertRunServiceConfigResponse) graphql.Marshaler { + return ec._InsertRunServiceConfigResponse(ctx, sel, &v) +} + +func (ec *executionContext) marshalNInsertRunServiceConfigResponse2ᚖgithubᚗcomᚋnhostᚋbeᚋservicesᚋmimirᚋmodelᚐInsertRunServiceConfigResponse(ctx context.Context, sel ast.SelectionSet, v *model.InsertRunServiceConfigResponse) 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._InsertRunServiceConfigResponse(ctx, sel, v) +} + func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { res, err := graphql.UnmarshalInt(v) return res, graphql.ErrorOnPath(ctx, err) diff --git a/vendor/github.com/nhost/be/services/mimir/graph/m_insert_run_service_config.go b/vendor/github.com/nhost/be/services/mimir/graph/m_insert_run_service_config.go index 7d01fd646..e290cee7e 100644 --- a/vendor/github.com/nhost/be/services/mimir/graph/m_insert_run_service_config.go +++ b/vendor/github.com/nhost/be/services/mimir/graph/m_insert_run_service_config.go @@ -3,7 +3,9 @@ package graph import ( "context" "fmt" + "strings" + "github.com/google/uuid" nhcontext "github.com/nhost/be/lib/graphql/context" "github.com/nhost/be/services/mimir/model" "github.com/nhost/be/services/mimir/schema" @@ -42,9 +44,8 @@ func nameMustBeUnique(svcs Services, serviceID, name string) error { func (r *mutationResolver) insertRunServiceConfig( ctx context.Context, appID string, - serviceID string, configInput model.ConfigRunServiceConfigInsertInput, -) (*model.ConfigRunServiceConfig, error) { +) (*model.InsertRunServiceConfigResponse, error) { r.mu.Lock() defer r.mu.Unlock() @@ -54,6 +55,8 @@ func (r *mutationResolver) insertRunServiceConfig( } app := r.data[i] + serviceID := uuid.NewString() + if _, err := app.IndexService(serviceID); err == nil { return nil, ErrServiceAlreadyExists } @@ -65,6 +68,12 @@ func (r *mutationResolver) insertRunServiceConfig( config := &model.ConfigRunServiceConfig{} //nolint:exhaustruct config.Insert(&configInput) + config.Image.Image = strings.ReplaceAll( + config.Image.Image, + "", + serviceID, + ) + svc := &Service{ ServiceID: serviceID, Config: config, @@ -85,5 +94,8 @@ func (r *mutationResolver) insertRunServiceConfig( app.Services = append(app.Services, svc) - return config, nil + return &model.InsertRunServiceConfigResponse{ + ServiceID: serviceID, + Config: config, + }, nil } diff --git a/vendor/github.com/nhost/be/services/mimir/graph/schema.resolvers.go b/vendor/github.com/nhost/be/services/mimir/graph/schema.resolvers.go index c8346ac1e..bca3f3713 100644 --- a/vendor/github.com/nhost/be/services/mimir/graph/schema.resolvers.go +++ b/vendor/github.com/nhost/be/services/mimir/graph/schema.resolvers.go @@ -62,8 +62,8 @@ func (r *mutationResolver) UpdateSystemConfig(ctx context.Context, appID string, } // InsertRunServiceConfig is the resolver for the insertRunServiceConfig field. -func (r *mutationResolver) InsertRunServiceConfig(ctx context.Context, appID string, serviceID string, config model.ConfigRunServiceConfigInsertInput) (*model.ConfigRunServiceConfig, error) { - return r.insertRunServiceConfig(ctx, appID, serviceID, config) +func (r *mutationResolver) InsertRunServiceConfig(ctx context.Context, appID string, config model.ConfigRunServiceConfigInsertInput) (*model.InsertRunServiceConfigResponse, error) { + return r.insertRunServiceConfig(ctx, appID, config) } // UpdateRunServiceConfig is the resolver for the updateRunServiceConfig field. diff --git a/vendor/github.com/nhost/be/services/mimir/model/models_gen.go b/vendor/github.com/nhost/be/services/mimir/model/models_gen.go index be2e34b25..50403314d 100644 --- a/vendor/github.com/nhost/be/services/mimir/model/models_gen.go +++ b/vendor/github.com/nhost/be/services/mimir/model/models_gen.go @@ -28,6 +28,11 @@ type ConfigRunServiceConfigWithID struct { Config *ConfigRunServiceConfig `json:"config"` } +type InsertRunServiceConfigResponse struct { + ServiceID string `json:"serviceID"` + Config *ConfigRunServiceConfig `json:"config"` +} + type Mutation struct { } diff --git a/vendor/github.com/nhost/be/services/mimir/nhost/models.go b/vendor/github.com/nhost/be/services/mimir/nhost/models.go index 7b5352f84..4fd7b03a7 100644 --- a/vendor/github.com/nhost/be/services/mimir/nhost/models.go +++ b/vendor/github.com/nhost/be/services/mimir/nhost/models.go @@ -618,7 +618,6 @@ type RunService struct { UpdatedAt pgtype.Timestamptz AppID uuid.UUID MimirConfigEnc pgtype.Text - CreatorUserID uuid.UUID Subdomain string } @@ -656,6 +655,7 @@ type StorageFile struct { Etag pgtype.Text IsUploaded pgtype.Bool UploadedByUserID pgtype.UUID + Metadata []byte } type StorageSchemaMigration struct { @@ -663,6 +663,16 @@ type StorageSchemaMigration struct { Dirty bool } +type StorageVirus struct { + ID uuid.UUID + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz + FileID uuid.UUID + Filename string + Virus string + UserSession []byte +} + type Workspace struct { ID uuid.UUID Name string diff --git a/vendor/github.com/nhost/be/services/mimir/schema/schema.cue b/vendor/github.com/nhost/be/services/mimir/schema/schema.cue index 86b6fe86b..e1d1e9dff 100644 --- a/vendor/github.com/nhost/be/services/mimir/schema/schema.cue +++ b/vendor/github.com/nhost/be/services/mimir/schema/schema.cue @@ -147,7 +147,7 @@ import ( #Hasura: { // Version of hasura, you can see available versions in the URL below: // https://hub.docker.com/r/hasura/graphql-engine/tags - version: string | *"v2.38.0-ce" + version: string | *"v2.36.9-ce" // JWT Secrets configuration jwtSecrets: [#JWTSecret] @@ -252,7 +252,7 @@ import ( #Postgres: { // Version of postgres, you can see available versions in the URL below: // https://hub.docker.com/r/nhost/postgres/tags - version: string | *"14.13-20240909-1" + version: string | *"14.13-20250108-1" // Resources for the service resources?: { @@ -303,7 +303,7 @@ import ( // Releases: // // https://github.com/nhost/hasura-auth/releases - version: string | *"0.33.0" + version: string | *"0.36.1" // Resources for the service resources?: #Resources @@ -644,7 +644,7 @@ import ( } #AI: { - version: string | *"0.6.1" + version: string | *"0.7.1" resources: { compute: #ComputeResources } diff --git a/vendor/github.com/nhost/be/services/mimir/schema/schema.graphqls b/vendor/github.com/nhost/be/services/mimir/schema/schema.graphqls index fb32d8124..8d1d1629b 100644 --- a/vendor/github.com/nhost/be/services/mimir/schema/schema.graphqls +++ b/vendor/github.com/nhost/be/services/mimir/schema/schema.graphqls @@ -30,6 +30,11 @@ type ConfigRunServiceConfigWithID { config: ConfigRunServiceConfig! } +type InsertRunServiceConfigResponse { + serviceID: uuid! + config: ConfigRunServiceConfig! +} + type Query { configRawJSON( appID: uuid! @hasAppVisibility, @@ -127,9 +132,8 @@ type Mutation { insertRunServiceConfig( appID: uuid! @hasAppVisibility, - serviceID: uuid!, config: ConfigRunServiceConfigInsertInput!, - ): ConfigRunServiceConfig! + ): InsertRunServiceConfigResponse! updateRunServiceConfig( appID: uuid! @hasAppVisibility, serviceID: uuid!, diff --git a/vendor/modules.txt b/vendor/modules.txt index 7e0b476ac..25db76c5b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -564,7 +564,7 @@ github.com/muesli/termenv # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/nhost/be v0.0.0-20241204194612-edc17ec72b31 +# github.com/nhost/be v0.0.0-20250108133629-afef8c60957d ## explicit; go 1.23.1 github.com/nhost/be/lib/graphql github.com/nhost/be/lib/graphql/context From b29751bfb0c9e9788f8c8e2e0e9ff14a02743171 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Wed, 8 Jan 2025 15:06:48 +0100 Subject: [PATCH 2/2] asd --- go.mod | 2 +- go.sum | 2 + nhostclient/graphql/models_gen.go | 222 +++++++----------------------- vendor/modules.txt | 2 +- 4 files changed, 53 insertions(+), 175 deletions(-) diff --git a/go.mod b/go.mod index 1df34bbdd..a2f3dc6b1 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 github.com/hashicorp/go-getter v1.7.6 - github.com/nhost/be v0.0.0-20250108133629-afef8c60957d + github.com/nhost/be v0.0.0-20250108140619-2d5cbe3d8d53 github.com/pelletier/go-toml/v2 v2.2.3 github.com/rs/cors/wrapper/gin v0.0.0-20240830163046-1084d89a1692 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index a9f5130bb..090f2bfff 100644 --- a/go.sum +++ b/go.sum @@ -536,6 +536,8 @@ github.com/nhost/be v0.0.0-20241204194612-edc17ec72b31 h1:zksBHPXvVGSjI7N8ib6b3q github.com/nhost/be v0.0.0-20241204194612-edc17ec72b31/go.mod h1:6lkCTKviZ+ZQDaYed7QFz4MoFb5sg10tlaux2AHeBEQ= github.com/nhost/be v0.0.0-20250108133629-afef8c60957d h1:Qpm1om9RfHMFILg9LTZchPkvGShOBgSj2kf5cMXFoDU= github.com/nhost/be v0.0.0-20250108133629-afef8c60957d/go.mod h1:6lkCTKviZ+ZQDaYed7QFz4MoFb5sg10tlaux2AHeBEQ= +github.com/nhost/be v0.0.0-20250108140619-2d5cbe3d8d53 h1:a/HtPyxfMQCOUtCuFPfBCDiwXQe0qXHa2TN/zZ8QuSg= +github.com/nhost/be v0.0.0-20250108140619-2d5cbe3d8d53/go.mod h1:6lkCTKviZ+ZQDaYed7QFz4MoFb5sg10tlaux2AHeBEQ= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= diff --git a/nhostclient/graphql/models_gen.go b/nhostclient/graphql/models_gen.go index 570986258..5d1a75354 100644 --- a/nhostclient/graphql/models_gen.go +++ b/nhostclient/graphql/models_gen.go @@ -1300,6 +1300,11 @@ type ContainerError struct { Name string `json:"name"` } +type InsertRunServiceConfigResponse struct { + Config *ConfigRunServiceConfig `json:"config"` + ServiceID string `json:"serviceID"` +} + // Boolean expression to compare columns of type "Int". All fields are combined with logical 'AND'. type IntComparisonExp struct { Eq *int64 `json:"_eq,omitempty"` @@ -1792,7 +1797,6 @@ type AppsInsertInput struct { Name *string `json:"name,omitempty"` OrganizationID *string `json:"organizationID,omitempty"` RegionID *string `json:"regionId,omitempty"` - RunServices *RunServiceArrRelInsertInput `json:"runServices,omitempty"` Slug *string `json:"slug,omitempty"` Workspace *WorkspacesObjRelInsertInput `json:"workspace,omitempty"` } @@ -4278,12 +4282,9 @@ type RunService struct { AppID string `json:"appID"` Config *ConfigRunServiceConfig `json:"config,omitempty"` CreatedAt time.Time `json:"createdAt"` - // An object relationship - Creator *Users `json:"creator"` - CreatorUserID string `json:"creatorUserId"` - ID string `json:"id"` - Subdomain string `json:"subdomain"` - UpdatedAt time.Time `json:"updatedAt"` + ID string `json:"id"` + Subdomain string `json:"subdomain"` + UpdatedAt time.Time `json:"updatedAt"` } // aggregated selection of "run_service" @@ -4317,73 +4318,53 @@ type RunServiceAggregateOrderBy struct { Min *RunServiceMinOrderBy `json:"min,omitempty"` } -// input type for inserting array relation for remote table "run_service" -type RunServiceArrRelInsertInput struct { - Data []*RunServiceInsertInput `json:"data"` - // upsert condition - OnConflict *RunServiceOnConflict `json:"on_conflict,omitempty"` -} - // Boolean expression to filter rows from the table "run_service". All fields are combined with a logical 'AND'. type RunServiceBoolExp struct { - And []*RunServiceBoolExp `json:"_and,omitempty"` - Not *RunServiceBoolExp `json:"_not,omitempty"` - Or []*RunServiceBoolExp `json:"_or,omitempty"` - App *AppsBoolExp `json:"app,omitempty"` - AppID *UUIDComparisonExp `json:"appID,omitempty"` - CreatedAt *TimestamptzComparisonExp `json:"createdAt,omitempty"` - Creator *UsersBoolExp `json:"creator,omitempty"` - CreatorUserID *UUIDComparisonExp `json:"creatorUserId,omitempty"` - ID *UUIDComparisonExp `json:"id,omitempty"` - Subdomain *StringComparisonExp `json:"subdomain,omitempty"` - UpdatedAt *TimestamptzComparisonExp `json:"updatedAt,omitempty"` -} - -// input type for inserting data into table "run_service" -type RunServiceInsertInput struct { - App *AppsObjRelInsertInput `json:"app,omitempty"` - AppID *string `json:"appID,omitempty"` - ID *string `json:"id,omitempty"` + And []*RunServiceBoolExp `json:"_and,omitempty"` + Not *RunServiceBoolExp `json:"_not,omitempty"` + Or []*RunServiceBoolExp `json:"_or,omitempty"` + App *AppsBoolExp `json:"app,omitempty"` + AppID *UUIDComparisonExp `json:"appID,omitempty"` + CreatedAt *TimestamptzComparisonExp `json:"createdAt,omitempty"` + ID *UUIDComparisonExp `json:"id,omitempty"` + Subdomain *StringComparisonExp `json:"subdomain,omitempty"` + UpdatedAt *TimestamptzComparisonExp `json:"updatedAt,omitempty"` } // aggregate max on columns type RunServiceMaxFields struct { - AppID *string `json:"appID,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty"` - CreatorUserID *string `json:"creatorUserId,omitempty"` - ID *string `json:"id,omitempty"` - Subdomain *string `json:"subdomain,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty"` + AppID *string `json:"appID,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty"` + ID *string `json:"id,omitempty"` + Subdomain *string `json:"subdomain,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` } // order by max() on columns of table "run_service" type RunServiceMaxOrderBy struct { - AppID *OrderBy `json:"appID,omitempty"` - CreatedAt *OrderBy `json:"createdAt,omitempty"` - CreatorUserID *OrderBy `json:"creatorUserId,omitempty"` - ID *OrderBy `json:"id,omitempty"` - Subdomain *OrderBy `json:"subdomain,omitempty"` - UpdatedAt *OrderBy `json:"updatedAt,omitempty"` + AppID *OrderBy `json:"appID,omitempty"` + CreatedAt *OrderBy `json:"createdAt,omitempty"` + ID *OrderBy `json:"id,omitempty"` + Subdomain *OrderBy `json:"subdomain,omitempty"` + UpdatedAt *OrderBy `json:"updatedAt,omitempty"` } // aggregate min on columns type RunServiceMinFields struct { - AppID *string `json:"appID,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty"` - CreatorUserID *string `json:"creatorUserId,omitempty"` - ID *string `json:"id,omitempty"` - Subdomain *string `json:"subdomain,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty"` + AppID *string `json:"appID,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty"` + ID *string `json:"id,omitempty"` + Subdomain *string `json:"subdomain,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` } // order by min() on columns of table "run_service" type RunServiceMinOrderBy struct { - AppID *OrderBy `json:"appID,omitempty"` - CreatedAt *OrderBy `json:"createdAt,omitempty"` - CreatorUserID *OrderBy `json:"creatorUserId,omitempty"` - ID *OrderBy `json:"id,omitempty"` - Subdomain *OrderBy `json:"subdomain,omitempty"` - UpdatedAt *OrderBy `json:"updatedAt,omitempty"` + AppID *OrderBy `json:"appID,omitempty"` + CreatedAt *OrderBy `json:"createdAt,omitempty"` + ID *OrderBy `json:"id,omitempty"` + Subdomain *OrderBy `json:"subdomain,omitempty"` + UpdatedAt *OrderBy `json:"updatedAt,omitempty"` } // response of any mutation on the table "run_service" @@ -4394,23 +4375,14 @@ type RunServiceMutationResponse struct { Returning []*RunService `json:"returning"` } -// on_conflict condition type for table "run_service" -type RunServiceOnConflict struct { - Constraint RunServiceConstraint `json:"constraint"` - UpdateColumns []RunServiceUpdateColumn `json:"update_columns"` - Where *RunServiceBoolExp `json:"where,omitempty"` -} - // Ordering options when selecting data from "run_service". type RunServiceOrderBy struct { - App *AppsOrderBy `json:"app,omitempty"` - AppID *OrderBy `json:"appID,omitempty"` - CreatedAt *OrderBy `json:"createdAt,omitempty"` - Creator *UsersOrderBy `json:"creator,omitempty"` - CreatorUserID *OrderBy `json:"creatorUserId,omitempty"` - ID *OrderBy `json:"id,omitempty"` - Subdomain *OrderBy `json:"subdomain,omitempty"` - UpdatedAt *OrderBy `json:"updatedAt,omitempty"` + App *AppsOrderBy `json:"app,omitempty"` + AppID *OrderBy `json:"appID,omitempty"` + CreatedAt *OrderBy `json:"createdAt,omitempty"` + ID *OrderBy `json:"id,omitempty"` + Subdomain *OrderBy `json:"subdomain,omitempty"` + UpdatedAt *OrderBy `json:"updatedAt,omitempty"` } // Streaming cursor of the table "run_service" @@ -4423,12 +4395,11 @@ type RunServiceStreamCursorInput struct { // Initial value of the column from where the streaming should start type RunServiceStreamCursorValueInput struct { - AppID *string `json:"appID,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty"` - CreatorUserID *string `json:"creatorUserId,omitempty"` - ID *string `json:"id,omitempty"` - Subdomain *string `json:"subdomain,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty"` + AppID *string `json:"appID,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty"` + ID *string `json:"id,omitempty"` + Subdomain *string `json:"subdomain,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` } // Boolean expression to compare columns of type "software_type_enum". All fields are combined with logical 'AND'. @@ -4698,10 +4669,6 @@ type Users struct { // An array relationship RefreshTokens []*AuthRefreshTokens `json:"refreshTokens"` // An array relationship - RunServices []*RunService `json:"runServices"` - // An aggregate relationship - RunServicesAggregate *RunServiceAggregate `json:"runServices_aggregate"` - // An array relationship UserProviders []*AuthUserProviders `json:"userProviders"` // An array relationship WorkspaceMemberInvitesByInvitedByUserID []*WorkspaceMemberInvites `json:"workspaceMemberInvitesByInvitedByUserId"` @@ -4727,8 +4694,6 @@ type UsersBoolExp struct { OrganizationMembership *OrganizationMembersBoolExp `json:"organizationMembership,omitempty"` PaymentMethods *PaymentMethodsBoolExp `json:"payment_methods,omitempty"` RefreshTokens *AuthRefreshTokensBoolExp `json:"refreshTokens,omitempty"` - RunServices *RunServiceBoolExp `json:"runServices,omitempty"` - RunServicesAggregate *RunServiceAggregateBoolExp `json:"runServices_aggregate,omitempty"` UserProviders *AuthUserProvidersBoolExp `json:"userProviders,omitempty"` WorkspaceMemberInvitesByInvitedByUserID *WorkspaceMemberInvitesBoolExp `json:"workspaceMemberInvitesByInvitedByUserId,omitempty"` WorkspaceMembers *WorkspaceMembersBoolExp `json:"workspaceMembers,omitempty"` @@ -4756,7 +4721,6 @@ type UsersOrderBy struct { OrganizationMembershipAggregate *OrganizationMembersAggregateOrderBy `json:"organizationMembership_aggregate,omitempty"` PaymentMethodsAggregate *PaymentMethodsAggregateOrderBy `json:"payment_methods_aggregate,omitempty"` RefreshTokensAggregate *AuthRefreshTokensAggregateOrderBy `json:"refreshTokens_aggregate,omitempty"` - RunServicesAggregate *RunServiceAggregateOrderBy `json:"runServices_aggregate,omitempty"` UserProvidersAggregate *AuthUserProvidersAggregateOrderBy `json:"userProviders_aggregate,omitempty"` WorkspaceMemberInvitesByInvitedByUserIDAggregate *WorkspaceMemberInvitesAggregateOrderBy `json:"workspaceMemberInvitesByInvitedByUserId_aggregate,omitempty"` WorkspaceMembersAggregate *WorkspaceMembersAggregateOrderBy `json:"workspaceMembers_aggregate,omitempty"` @@ -7804,50 +7768,6 @@ func (e RegionsSelectColumn) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) } -// unique or primary key constraints on table "run_service" -type RunServiceConstraint string - -const ( - // unique or primary key constraint on columns "id" - RunServiceConstraintRunServicePkey RunServiceConstraint = "run_service_pkey" - // unique or primary key constraint on columns "subdomain" - RunServiceConstraintRunServiceSubdomainKey RunServiceConstraint = "run_service_subdomain_key" -) - -var AllRunServiceConstraint = []RunServiceConstraint{ - RunServiceConstraintRunServicePkey, - RunServiceConstraintRunServiceSubdomainKey, -} - -func (e RunServiceConstraint) IsValid() bool { - switch e { - case RunServiceConstraintRunServicePkey, RunServiceConstraintRunServiceSubdomainKey: - return true - } - return false -} - -func (e RunServiceConstraint) String() string { - return string(e) -} - -func (e *RunServiceConstraint) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = RunServiceConstraint(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid run_service_constraint", str) - } - return nil -} - -func (e RunServiceConstraint) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -} - // select columns of table "run_service" type RunServiceSelectColumn string @@ -7857,8 +7777,6 @@ const ( // column name RunServiceSelectColumnCreatedAt RunServiceSelectColumn = "createdAt" // column name - RunServiceSelectColumnCreatorUserID RunServiceSelectColumn = "creatorUserId" - // column name RunServiceSelectColumnID RunServiceSelectColumn = "id" // column name RunServiceSelectColumnSubdomain RunServiceSelectColumn = "subdomain" @@ -7869,7 +7787,6 @@ const ( var AllRunServiceSelectColumn = []RunServiceSelectColumn{ RunServiceSelectColumnAppID, RunServiceSelectColumnCreatedAt, - RunServiceSelectColumnCreatorUserID, RunServiceSelectColumnID, RunServiceSelectColumnSubdomain, RunServiceSelectColumnUpdatedAt, @@ -7877,7 +7794,7 @@ var AllRunServiceSelectColumn = []RunServiceSelectColumn{ func (e RunServiceSelectColumn) IsValid() bool { switch e { - case RunServiceSelectColumnAppID, RunServiceSelectColumnCreatedAt, RunServiceSelectColumnCreatorUserID, RunServiceSelectColumnID, RunServiceSelectColumnSubdomain, RunServiceSelectColumnUpdatedAt: + case RunServiceSelectColumnAppID, RunServiceSelectColumnCreatedAt, RunServiceSelectColumnID, RunServiceSelectColumnSubdomain, RunServiceSelectColumnUpdatedAt: return true } return false @@ -7904,47 +7821,6 @@ func (e RunServiceSelectColumn) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) } -// placeholder for update columns of table "run_service" (current role has no relevant permissions) -type RunServiceUpdateColumn string - -const ( - // placeholder (do not use) - RunServiceUpdateColumnPlaceholder RunServiceUpdateColumn = "_PLACEHOLDER" -) - -var AllRunServiceUpdateColumn = []RunServiceUpdateColumn{ - RunServiceUpdateColumnPlaceholder, -} - -func (e RunServiceUpdateColumn) IsValid() bool { - switch e { - case RunServiceUpdateColumnPlaceholder: - return true - } - return false -} - -func (e RunServiceUpdateColumn) String() string { - return string(e) -} - -func (e *RunServiceUpdateColumn) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = RunServiceUpdateColumn(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid run_service_update_column", str) - } - return nil -} - -func (e RunServiceUpdateColumn) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -} - type SoftwareTypeEnum string const ( diff --git a/vendor/modules.txt b/vendor/modules.txt index 25db76c5b..5586eb168 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -564,7 +564,7 @@ github.com/muesli/termenv # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/nhost/be v0.0.0-20250108133629-afef8c60957d +# github.com/nhost/be v0.0.0-20250108140619-2d5cbe3d8d53 ## explicit; go 1.23.1 github.com/nhost/be/lib/graphql github.com/nhost/be/lib/graphql/context