diff --git a/go.mod b/go.mod index c942bd6e..667a3937 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 github.com/hashicorp/go-getter v1.7.8 - github.com/nhost/be v0.0.0-20250207083244-0a46c4feae7b + github.com/nhost/be v0.0.0-20250211083240-96c835d9c359 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 35e5d5ca..2cb82d5f 100644 --- a/go.sum +++ b/go.sum @@ -1039,6 +1039,8 @@ github.com/nhost/be v0.0.0-20250206162232-abfad0d0fc9c h1:WhKuYjtjt8nK/lMa+P2m4z github.com/nhost/be v0.0.0-20250206162232-abfad0d0fc9c/go.mod h1:ptZc9rgaLJcew/L9b8w0nN4AfOGxqUINqMvCe4uMV/M= github.com/nhost/be v0.0.0-20250207083244-0a46c4feae7b h1:FvP6PyJZExw/3XFJyOJ7XTzpjrQ6wVpLloX1vw6HrAw= github.com/nhost/be v0.0.0-20250207083244-0a46c4feae7b/go.mod h1:ptZc9rgaLJcew/L9b8w0nN4AfOGxqUINqMvCe4uMV/M= +github.com/nhost/be v0.0.0-20250211083240-96c835d9c359 h1:vFgKEHSPsLQbw1kpW1fuD+ZKmkolP1xINJ/r9G1X3II= +github.com/nhost/be v0.0.0-20250211083240-96c835d9c359/go.mod h1:ptZc9rgaLJcew/L9b8w0nN4AfOGxqUINqMvCe4uMV/M= github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= diff --git a/nhostclient/graphql/models_gen.go b/nhostclient/graphql/models_gen.go index 34713820..89230efa 100644 --- a/nhostclient/graphql/models_gen.go +++ b/nhostclient/graphql/models_gen.go @@ -927,24 +927,28 @@ type ConfigPostgres struct { } type ConfigPostgresResources struct { - Autoscaler *ConfigAutoscaler `json:"autoscaler,omitempty"` - Compute *ConfigResourcesCompute `json:"compute,omitempty"` - EnablePublicAccess *bool `json:"enablePublicAccess,omitempty"` - Networking *ConfigNetworking `json:"networking,omitempty"` - Replicas *uint32 `json:"replicas,omitempty"` - Storage *ConfigPostgresStorage `json:"storage"` + Compute *ConfigResourcesCompute `json:"compute,omitempty"` + EnablePublicAccess *bool `json:"enablePublicAccess,omitempty"` + Storage *ConfigPostgresResourcesStorage `json:"storage"` +} + +type ConfigPostgresResourcesStorage struct { + Capacity uint32 `json:"capacity"` +} + +type ConfigPostgresResourcesStorageUpdateInput struct { + Capacity *uint32 `json:"capacity,omitempty"` } type ConfigPostgresResourcesUpdateInput struct { - Autoscaler *ConfigAutoscalerUpdateInput `json:"autoscaler,omitempty"` - Compute *ConfigResourcesComputeUpdateInput `json:"compute,omitempty"` - EnablePublicAccess *bool `json:"enablePublicAccess,omitempty"` - Networking *ConfigNetworkingUpdateInput `json:"networking,omitempty"` - Replicas *uint32 `json:"replicas,omitempty"` - Storage *ConfigPostgresStorageUpdateInput `json:"storage,omitempty"` + Compute *ConfigResourcesComputeUpdateInput `json:"compute,omitempty"` + EnablePublicAccess *bool `json:"enablePublicAccess,omitempty"` + Storage *ConfigPostgresResourcesStorageUpdateInput `json:"storage,omitempty"` } type ConfigPostgresSettings struct { + ArchiveMode *string `json:"archiveMode,omitempty"` + ArchiveTimeout *string `json:"archiveTimeout,omitempty"` CheckpointCompletionTarget *float64 `json:"checkpointCompletionTarget,omitempty"` DefaultStatisticsTarget *string `json:"defaultStatisticsTarget,omitempty"` EffectiveCacheSize *string `json:"effectiveCacheSize,omitempty"` @@ -969,6 +973,8 @@ type ConfigPostgresSettings struct { } type ConfigPostgresSettingsUpdateInput struct { + ArchiveMode *string `json:"archiveMode,omitempty"` + ArchiveTimeout *string `json:"archiveTimeout,omitempty"` CheckpointCompletionTarget *float64 `json:"checkpointCompletionTarget,omitempty"` DefaultStatisticsTarget *string `json:"defaultStatisticsTarget,omitempty"` EffectiveCacheSize *string `json:"effectiveCacheSize,omitempty"` @@ -992,14 +998,6 @@ type ConfigPostgresSettingsUpdateInput struct { WorkMem *string `json:"workMem,omitempty"` } -type ConfigPostgresStorage struct { - Capacity uint32 `json:"capacity"` -} - -type ConfigPostgresStorageUpdateInput struct { - Capacity *uint32 `json:"capacity,omitempty"` -} - type ConfigPostgresUpdateInput struct { Resources *ConfigPostgresResourcesUpdateInput `json:"resources,omitempty"` Settings *ConfigPostgresSettingsUpdateInput `json:"settings,omitempty"` 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 bbd28162..e593f202 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 @@ -511,6 +511,7 @@ type ComplexityRoot struct { ConfigPostgresResources struct { Compute func(childComplexity int) int EnablePublicAccess func(childComplexity int) int + Replicas func(childComplexity int) int Storage func(childComplexity int) int } @@ -2470,6 +2471,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ConfigPostgresResources.EnablePublicAccess(childComplexity), true + case "ConfigPostgresResources.replicas": + if e.complexity.ConfigPostgresResources.Replicas == nil { + break + } + + return e.complexity.ConfigPostgresResources.Replicas(childComplexity), true + case "ConfigPostgresResources.storage": if e.complexity.ConfigPostgresResources.Storage == nil { break @@ -6971,6 +6979,10 @@ type ConfigPostgresResources { storage: ConfigPostgresResourcesStorage! """ + """ + replicas: Int + """ + """ enablePublicAccess: Boolean } @@ -6978,12 +6990,14 @@ type ConfigPostgresResources { input ConfigPostgresResourcesUpdateInput { compute: ConfigResourcesComputeUpdateInput storage: ConfigPostgresResourcesStorageUpdateInput + replicas: Int enablePublicAccess: Boolean } input ConfigPostgresResourcesInsertInput { compute: ConfigResourcesComputeInsertInput storage: ConfigPostgresResourcesStorageInsertInput! + replicas: Int enablePublicAccess: Boolean } @@ -6993,6 +7007,7 @@ input ConfigPostgresResourcesComparisonExp { _or: [ConfigPostgresResourcesComparisonExp!] compute: ConfigResourcesComputeComparisonExp storage: ConfigPostgresResourcesStorageComparisonExp + replicas: ConfigIntComparisonExp enablePublicAccess: ConfigBooleanComparisonExp } @@ -20919,6 +20934,8 @@ func (ec *executionContext) fieldContext_ConfigPostgres_resources(_ context.Cont return ec.fieldContext_ConfigPostgresResources_compute(ctx, field) case "storage": return ec.fieldContext_ConfigPostgresResources_storage(ctx, field) + case "replicas": + return ec.fieldContext_ConfigPostgresResources_replicas(ctx, field) case "enablePublicAccess": return ec.fieldContext_ConfigPostgresResources_enablePublicAccess(ctx, field) } @@ -21108,6 +21125,47 @@ func (ec *executionContext) fieldContext_ConfigPostgresResources_storage(_ conte return fc, nil } +func (ec *executionContext) _ConfigPostgresResources_replicas(ctx context.Context, field graphql.CollectedField, obj *model.ConfigPostgresResources) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ConfigPostgresResources_replicas(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) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Replicas, 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.marshalOInt2ᚖint(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ConfigPostgresResources_replicas(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ConfigPostgresResources", + 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) _ConfigPostgresResources_enablePublicAccess(ctx context.Context, field graphql.CollectedField, obj *model.ConfigPostgresResources) (ret graphql.Marshaler) { fc, err := ec.fieldContext_ConfigPostgresResources_enablePublicAccess(ctx, field) if err != nil { @@ -37031,7 +37089,7 @@ func (ec *executionContext) unmarshalInputConfigPostgresResourcesComparisonExp(c asMap[k] = v } - fieldsInOrder := [...]string{"_and", "_not", "_or", "compute", "storage", "enablePublicAccess"} + fieldsInOrder := [...]string{"_and", "_not", "_or", "compute", "storage", "replicas", "enablePublicAccess"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -37073,6 +37131,13 @@ func (ec *executionContext) unmarshalInputConfigPostgresResourcesComparisonExp(c return it, err } it.Storage = data + case "replicas": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("replicas")) + data, err := ec.unmarshalOConfigIntComparisonExp2ᚖgithubᚗcomᚋnhostᚋbeᚋservicesᚋmimirᚋmodelᚐGenericComparisonExp(ctx, v) + if err != nil { + return it, err + } + it.Replicas = data case "enablePublicAccess": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enablePublicAccess")) data, err := ec.unmarshalOConfigBooleanComparisonExp2ᚖgithubᚗcomᚋnhostᚋbeᚋservicesᚋmimirᚋmodelᚐGenericComparisonExp(ctx, v) @@ -37093,7 +37158,7 @@ func (ec *executionContext) unmarshalInputConfigPostgresResourcesInsertInput(ctx asMap[k] = v } - fieldsInOrder := [...]string{"compute", "storage", "enablePublicAccess"} + fieldsInOrder := [...]string{"compute", "storage", "replicas", "enablePublicAccess"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -37114,6 +37179,13 @@ func (ec *executionContext) unmarshalInputConfigPostgresResourcesInsertInput(ctx return it, err } it.Storage = data + case "replicas": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("replicas")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Replicas = data case "enablePublicAccess": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enablePublicAccess")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -43608,6 +43680,8 @@ func (ec *executionContext) _ConfigPostgresResources(ctx context.Context, sel as if out.Values[i] == graphql.Null { out.Invalids++ } + case "replicas": + out.Values[i] = ec._ConfigPostgresResources_replicas(ctx, field, obj) case "enablePublicAccess": out.Values[i] = ec._ConfigPostgresResources_enablePublicAccess(ctx, field, obj) default: diff --git a/vendor/github.com/nhost/be/services/mimir/model/cuegraph_gen.go b/vendor/github.com/nhost/be/services/mimir/model/cuegraph_gen.go index 99705c09..3696eaab 100644 --- a/vendor/github.com/nhost/be/services/mimir/model/cuegraph_gen.go +++ b/vendor/github.com/nhost/be/services/mimir/model/cuegraph_gen.go @@ -19437,6 +19437,8 @@ type ConfigPostgresResources struct { Storage *ConfigPostgresResourcesStorage `json:"storage,omitempty" toml:"storage,omitempty"` + Replicas *int `json:"replicas" toml:"replicas"` + EnablePublicAccess *bool `json:"enablePublicAccess" toml:"enablePublicAccess"` } @@ -19448,6 +19450,9 @@ func (o *ConfigPostgresResources) MarshalJSON() ([]byte, error) { if o.Storage != nil { m["storage"] = o.Storage } + if o.Replicas != nil { + m["replicas"] = o.Replicas + } if o.EnablePublicAccess != nil { m["enablePublicAccess"] = o.EnablePublicAccess } @@ -19468,6 +19473,13 @@ func (o *ConfigPostgresResources) GetStorage() *ConfigPostgresResourcesStorage { return o.Storage } +func (o *ConfigPostgresResources) GetReplicas() *int { + if o == nil { + o = &ConfigPostgresResources{} + } + return o.Replicas +} + func (o *ConfigPostgresResources) GetEnablePublicAccess() *bool { if o == nil { o = &ConfigPostgresResources{} @@ -19480,6 +19492,8 @@ type ConfigPostgresResourcesUpdateInput struct { IsSetCompute bool `json:"-"` Storage *ConfigPostgresResourcesStorageUpdateInput `json:"storage,omitempty" toml:"storage,omitempty"` IsSetStorage bool `json:"-"` + Replicas *int `json:"replicas,omitempty" toml:"replicas,omitempty"` + IsSetReplicas bool `json:"-"` EnablePublicAccess *bool `json:"enablePublicAccess,omitempty" toml:"enablePublicAccess,omitempty"` IsSetEnablePublicAccess bool `json:"-"` } @@ -19509,6 +19523,23 @@ func (o *ConfigPostgresResourcesUpdateInput) UnmarshalGQL(v interface{}) error { } o.IsSetStorage = true } + if v, ok := m["replicas"]; ok { + if v == nil { + o.Replicas = nil + } else { + // clearly a not very efficient shortcut + b, err := json.Marshal(v) + if err != nil { + return err + } + var x int + if err := json.Unmarshal(b, &x); err != nil { + return err + } + o.Replicas = &x + } + o.IsSetReplicas = true + } if v, ok := m["enablePublicAccess"]; ok { if v == nil { o.EnablePublicAccess = nil @@ -19551,6 +19582,13 @@ func (o *ConfigPostgresResourcesUpdateInput) GetStorage() *ConfigPostgresResourc return o.Storage } +func (o *ConfigPostgresResourcesUpdateInput) GetReplicas() *int { + if o == nil { + o = &ConfigPostgresResourcesUpdateInput{} + } + return o.Replicas +} + func (o *ConfigPostgresResourcesUpdateInput) GetEnablePublicAccess() *bool { if o == nil { o = &ConfigPostgresResourcesUpdateInput{} @@ -19582,6 +19620,9 @@ func (s *ConfigPostgresResources) Update(v *ConfigPostgresResourcesUpdateInput) s.Storage.Update(v.Storage) } } + if v.IsSetReplicas || v.Replicas != nil { + s.Replicas = v.Replicas + } if v.IsSetEnablePublicAccess || v.EnablePublicAccess != nil { s.EnablePublicAccess = v.EnablePublicAccess } @@ -19590,6 +19631,7 @@ func (s *ConfigPostgresResources) Update(v *ConfigPostgresResourcesUpdateInput) type ConfigPostgresResourcesInsertInput struct { Compute *ConfigResourcesComputeInsertInput `json:"compute,omitempty" toml:"compute,omitempty"` Storage *ConfigPostgresResourcesStorageInsertInput `json:"storage,omitempty" toml:"storage,omitempty"` + Replicas *int `json:"replicas,omitempty" toml:"replicas,omitempty"` EnablePublicAccess *bool `json:"enablePublicAccess,omitempty" toml:"enablePublicAccess,omitempty"` } @@ -19607,6 +19649,13 @@ func (o *ConfigPostgresResourcesInsertInput) GetStorage() *ConfigPostgresResourc return o.Storage } +func (o *ConfigPostgresResourcesInsertInput) GetReplicas() *int { + if o == nil { + o = &ConfigPostgresResourcesInsertInput{} + } + return o.Replicas +} + func (o *ConfigPostgresResourcesInsertInput) GetEnablePublicAccess() *bool { if o == nil { o = &ConfigPostgresResourcesInsertInput{} @@ -19627,6 +19676,7 @@ func (s *ConfigPostgresResources) Insert(v *ConfigPostgresResourcesInsertInput) } s.Storage.Insert(v.Storage) } + s.Replicas = v.Replicas s.EnablePublicAccess = v.EnablePublicAccess } @@ -19638,6 +19688,7 @@ func (s *ConfigPostgresResources) Clone() *ConfigPostgresResources { v := &ConfigPostgresResources{} v.Compute = s.Compute.Clone() v.Storage = s.Storage.Clone() + v.Replicas = s.Replicas v.EnablePublicAccess = s.EnablePublicAccess return v } @@ -19648,6 +19699,7 @@ type ConfigPostgresResourcesComparisonExp struct { Or []*ConfigPostgresResourcesComparisonExp `json:"_or,omitempty"` Compute *ConfigResourcesComputeComparisonExp `json:"compute,omitempty"` Storage *ConfigPostgresResourcesStorageComparisonExp `json:"storage,omitempty"` + Replicas *ConfigIntComparisonExp `json:"replicas,omitempty"` EnablePublicAccess *ConfigBooleanComparisonExp `json:"enablePublicAccess,omitempty"` } @@ -19668,6 +19720,9 @@ func (exp *ConfigPostgresResourcesComparisonExp) Matches(o *ConfigPostgresResour if !exp.Storage.Matches(o.Storage) { return false } + if o.Replicas != nil && !exp.Replicas.Matches(*o.Replicas) { + return false + } if o.EnablePublicAccess != nil && !exp.EnablePublicAccess.Matches(*o.EnablePublicAccess) { return false } 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 8745ae06..e22bbb40 100644 --- a/vendor/github.com/nhost/be/services/mimir/schema/schema.cue +++ b/vendor/github.com/nhost/be/services/mimir/schema/schema.cue @@ -117,13 +117,13 @@ import ( compute?: #ResourcesCompute // Number of replicas for a service - replicas?: uint8 & >=1 & <=10 | *1 + replicas: uint8 & >=1 & <=10 | *1 autoscaler?: #Autoscaler _validateReplicasMustBeSmallerThanMaxReplicas: (replicas <= autoscaler.maxReplicas) & true @cuegraph(skip) _validateMultipleReplicasNeedsCompute: ( - (replicas == _|_ | replicas == 1) && autoscaler == _|_ | + replicas == 1 && autoscaler == _|_ | compute != _|_) & true @cuegraph(skip) _validateMultipleReplicasRatioMustBe1For2: ( replicas == 1 && autoscaler == _|_ | @@ -263,6 +263,8 @@ import ( capacity: uint32 & >=1 & <=1000 // GiB } + replicas?: 1 + enablePublicAccess?: bool | *false } diff --git a/vendor/github.com/nhost/be/services/mimir/schema/schema_gen.graphqls b/vendor/github.com/nhost/be/services/mimir/schema/schema_gen.graphqls index 41cbb109..c3361234 100644 --- a/vendor/github.com/nhost/be/services/mimir/schema/schema_gen.graphqls +++ b/vendor/github.com/nhost/be/services/mimir/schema/schema_gen.graphqls @@ -3030,6 +3030,10 @@ type ConfigPostgresResources { storage: ConfigPostgresResourcesStorage! """ + """ + replicas: Int + """ + """ enablePublicAccess: Boolean } @@ -3037,12 +3041,14 @@ type ConfigPostgresResources { input ConfigPostgresResourcesUpdateInput { compute: ConfigResourcesComputeUpdateInput storage: ConfigPostgresResourcesStorageUpdateInput + replicas: Int enablePublicAccess: Boolean } input ConfigPostgresResourcesInsertInput { compute: ConfigResourcesComputeInsertInput storage: ConfigPostgresResourcesStorageInsertInput! + replicas: Int enablePublicAccess: Boolean } @@ -3052,6 +3058,7 @@ input ConfigPostgresResourcesComparisonExp { _or: [ConfigPostgresResourcesComparisonExp!] compute: ConfigResourcesComputeComparisonExp storage: ConfigPostgresResourcesStorageComparisonExp + replicas: ConfigIntComparisonExp enablePublicAccess: ConfigBooleanComparisonExp } diff --git a/vendor/modules.txt b/vendor/modules.txt index 7110e8d7..6c5f7c66 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -643,7 +643,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-20250207083244-0a46c4feae7b +# github.com/nhost/be v0.0.0-20250211083240-96c835d9c359 ## explicit; go 1.23.4 github.com/nhost/be/lib/graphql github.com/nhost/be/lib/graphql/context