Compare commits

..

6 Commits

Author SHA1 Message Date
Jeff McCune
bac7aec0ba (#167) Restructure the bare platform
This patch restructures the bare platform in preparation for a
`Platform` kind of output from CUE in addition to the existing
`BuildPlan` kind.

This patch establishes a pattern where our own CUE defined code goes
into the two CUE module paths:

1. `internal/platforms/cue.mod/gen/github.com/holos-run/holos/api/v1alpha1`
2. `internal/platforms/cue.mod/pkg/github.com/holos-run/holos/api/v1alpha1`
3. `internal/platforms/cue.mod/usr/github.com/holos-run/holos/api/v1alpha1`

The first path is automatically generated from Go structs.  The second
path is where we override and provide additional cue level integration.

The third path is reserved for the end user to further refine and
constrain our definitions.
2024-05-07 16:53:00 -07:00
Jeff McCune
42f916af41 (#164) Use quay.io/holos/oauth2-proxy:v7.6.0-1-g77a03ae2
Custom build to set samesite=none on the csrf cookie.
2024-05-06 16:18:32 -07:00
Jeff McCune
47a5e237e0 (#162) Lint go, typescript, and proto3 files
This patch adds lint coverage for proto3 and typescript to keep our code
reasonably clean.  The go linter was already enabled.
2024-05-06 14:17:08 -07:00
Jeff McCune
1279e2351a (#162) Move Platform back to holos.v1alpha1
No need to have a separate package for the PlatformService and related
protobuf messages.
2024-05-06 13:47:37 -07:00
Jeff McCune
adb8177026 Merge pull request #166 from holos-run/jeff/165-deploy-holos
(#165) Deploy Holos to Dev
2024-05-06 11:23:48 -07:00
Jeff McCune
4e8fa5abda (#165) Bump dev deployment to 0.73.1 2024-05-06 11:22:24 -07:00
81 changed files with 3522 additions and 2154 deletions

View File

@@ -87,6 +87,8 @@ test: ## Run tests.
.PHONY: lint
lint: ## Run linters.
buf lint
cd internal/frontend/holos && ng lint
golangci-lint run
.PHONY: coverage

View File

@@ -39,3 +39,14 @@ func (bp *BuildPlan) Validate() error {
}
return nil
}
func (bp *BuildPlan) ResultCapacity() (count int) {
if bp == nil {
return 0
}
count = len(bp.Spec.Components.HelmChartList) +
len(bp.Spec.Components.KubernetesObjectsList) +
len(bp.Spec.Components.KustomizeBuildList) +
len(bp.Spec.Components.Resources)
return count
}

9
api/v1alpha1/platform.go Normal file
View File

@@ -0,0 +1,9 @@
package v1alpha1
// Platform represents a platform to manage. A Platform resource tells holos
// which components to build. The primary use case is to specify the cluster
// names, cluster types, and holos components to build.
type Platform struct {
TypeMeta `json:",inline" yaml:",inline"`
Metadata ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}

View File

@@ -19,6 +19,14 @@ type Result struct {
accumulatedOutput string
}
// Continue returns true if Skip is true indicating the result is to be skipped over.
func (r *Result) Continue() bool {
if r == nil {
return false
}
return r.Skip
}
func (r *Result) Name() string {
return r.Metadata.Name
}
@@ -32,6 +40,11 @@ func (r *Result) KustomizationFilename(writeTo string, cluster string) string {
return filepath.Join(writeTo, "clusters", cluster, "holos", "components", r.Metadata.Name+"-kustomization.gen.yaml")
}
// KustomizationContent returns the kustomization file contents to write.
func (r *Result) KustomizationContent() string {
return r.KsContent
}
// AccumulatedOutput returns the accumulated rendered output.
func (r *Result) AccumulatedOutput() string {
return r.accumulatedOutput

View File

@@ -8,3 +8,13 @@ type TypeMeta struct {
func (tm *TypeMeta) GetKind() string {
return tm.Kind
}
func (tm *TypeMeta) GetAPIVersion() string {
return tm.Kind
}
// Discriminator is an interface to discriminate the kind api object.
type Discriminator interface {
GetKind() string
GetAPIVersion() string
}

View File

@@ -18,7 +18,3 @@ plugins:
out: internal/frontend/holos/src/app/gen
opt:
- target=ts
- plugin: connect-query
out: internal/frontend/holos/src/app/gen
opt:
- target=ts

View File

@@ -89,7 +89,8 @@ _IngressAuthProxy: {
spec: {
securityContext: seccompProfile: type: "RuntimeDefault"
containers: [{
image: "quay.io/oauth2-proxy/oauth2-proxy:v7.6.0"
// image: "quay.io/oauth3-proxy/oauth2-proxy:v7.6.0"
image: "quay.io/holos/oauth2-proxy:v7.6.0-1-g77a03ae2"
imagePullPolicy: "IfNotPresent"
name: "oauth2-proxy"
volumeMounts: [{

View File

@@ -34,7 +34,7 @@ let OBJECTS = #APIObjects & {
containers: [
{
name: Holos
image: "271053619184.dkr.ecr.us-east-2.amazonaws.com/holos-run/holos-server/holos:0.73.0"
image: "271053619184.dkr.ecr.us-east-2.amazonaws.com/holos-run/holos-server/holos:0.73.1"
imagePullPolicy: "Always"
env: [
{

273
internal/builder/builder.go Normal file
View File

@@ -0,0 +1,273 @@
// Package builder is responsible for building fully rendered kubernetes api
// objects from various input directories. A directory may contain a platform
// spec or a component spec.
package builder
import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"cuelang.org/go/cue/build"
"cuelang.org/go/cue/cuecontext"
"cuelang.org/go/cue/load"
"github.com/holos-run/holos/api/v1alpha1"
"github.com/holos-run/holos"
"github.com/holos-run/holos/internal/errors"
"github.com/holos-run/holos/internal/logger"
)
const (
KubernetesObjects = v1alpha1.KubernetesObjectsKind
// Helm is the value of the kind field of holos build output indicating helm
// values and helm command information.
Helm = v1alpha1.HelmChartKind
// Skip is the value when the instance should be skipped
Skip = "Skip"
// KustomizeBuild is the value of the kind field of cue output indicating holos should process the component using kustomize build to render output.
KustomizeBuild = v1alpha1.KustomizeBuildKind
)
// An Option configures a Builder
type Option func(*config)
type config struct {
args []string
cluster string
}
type Builder struct {
cfg config
}
// New returns a new *Builder configured by opts Option.
func New(opts ...Option) *Builder {
var cfg config
for _, f := range opts {
f(&cfg)
}
b := &Builder{cfg: cfg}
return b
}
// Entrypoints configures the leaf directories Builder builds.
func Entrypoints(args []string) Option {
return func(cfg *config) { cfg.args = args }
}
// Cluster configures the cluster name for the holos component instance.
func Cluster(name string) Option {
return func(cfg *config) { cfg.cluster = name }
}
// Cluster returns the cluster name of the component instance being built.
func (b *Builder) Cluster() string {
return b.cfg.cluster
}
// Instances returns the cue build instances being built.
func (b *Builder) Instances(ctx context.Context) ([]*build.Instance, error) {
log := logger.FromContext(ctx)
mod, err := b.findCueMod()
if err != nil {
return nil, errors.Wrap(err)
}
dir := string(mod)
cfg := load.Config{Dir: dir}
// Make args relative to the module directory
args := make([]string, len(b.cfg.args))
for idx, path := range b.cfg.args {
target, err := filepath.Abs(path)
if err != nil {
return nil, errors.Wrap(fmt.Errorf("could not find absolute path: %w", err))
}
relPath, err := filepath.Rel(dir, target)
if err != nil {
return nil, errors.Wrap(fmt.Errorf("invalid argument, must be relative to cue.mod: %w", err))
}
relPath = "./" + relPath
args[idx] = relPath
equiv := fmt.Sprintf("cue export --out yaml -t cluster=%v %v", b.Cluster(), relPath)
log.Debug("cue: equivalent command: " + equiv)
}
// Refer to https://github.com/cue-lang/cue/blob/v0.7.0/cmd/cue/cmd/common.go#L429
cfg.Tags = append(cfg.Tags, "cluster="+b.Cluster())
log.DebugContext(ctx, fmt.Sprintf("cue: tags %v", cfg.Tags))
return load.Instances(args, &cfg), nil
}
func (b *Builder) Run(ctx context.Context) (results []*v1alpha1.Result, err error) {
log := logger.FromContext(ctx)
log.DebugContext(ctx, "cue: building instances")
instances, err := b.Instances(ctx)
if err != nil {
return nil, err
}
results = make([]*v1alpha1.Result, 0, len(instances)*8)
// Each CUE instance provides a BuildPlan
for idx, instance := range instances {
log.DebugContext(ctx, "cue: building instance", "idx", idx, "dir", instance.Dir)
r, err := b.runInstance(ctx, instance)
if err != nil {
return nil, errors.Wrap(fmt.Errorf("could not run: %w", err))
}
results = append(results, r...)
}
return results, nil
}
func (b Builder) runInstance(ctx context.Context, instance *build.Instance) (results []*v1alpha1.Result, err error) {
path := holos.InstancePath(instance.Dir)
log := logger.FromContext(ctx).With("dir", path)
if err := instance.Err; err != nil {
return nil, errors.Wrap(fmt.Errorf("could not load: %w", err))
}
cueCtx := cuecontext.New()
value := cueCtx.BuildInstance(instance)
if err := value.Err(); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not build %s: %w", instance.Dir, err))
}
log.DebugContext(ctx, "cue: validating instance")
if err := value.Validate(); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not validate: %w", err))
}
log.DebugContext(ctx, "cue: decoding holos build plan")
jsonBytes, err := value.MarshalJSON()
if err != nil {
return nil, errors.Wrap(fmt.Errorf("could not marshal cue instance %s: %w", instance.Dir, err))
}
decoder := json.NewDecoder(bytes.NewReader(jsonBytes))
// Discriminate the type of build plan.
tm := &v1alpha1.TypeMeta{}
err = decoder.Decode(tm)
if err != nil {
return nil, errors.Wrap(fmt.Errorf("invalid BuildPlan: %s: %w", instance.Dir, err))
}
log.DebugContext(ctx, "cue: discriminated build kind: "+tm.Kind, "kind", tm.Kind, "apiVersion", tm.APIVersion)
// New decoder for the full object
decoder = json.NewDecoder(bytes.NewReader(jsonBytes))
decoder.DisallowUnknownFields()
switch tm.Kind {
case "BuildPlan":
var bp v1alpha1.BuildPlan
if err = decoder.Decode(&bp); err != nil {
err = errors.Wrap(fmt.Errorf("could not decode BuildPlan %s: %w", instance.Dir, err))
return
}
results, err = b.buildPlan(ctx, &bp, path)
case "Platform":
var pf v1alpha1.Platform
if err = decoder.Decode(&pf); err != nil {
err = errors.Wrap(fmt.Errorf("could not decode Platform %s: %w", instance.Dir, err))
return
}
results, err = b.buildPlatform(ctx, &pf)
default:
err = errors.Wrap(fmt.Errorf("unknown kind: %v", tm.Kind))
}
return
}
func (b *Builder) buildPlatform(ctx context.Context, pf *v1alpha1.Platform) (results []*v1alpha1.Result, err error) {
log := logger.FromContext(ctx)
log.ErrorContext(ctx, "not implemented", "platform", pf)
return nil, errors.Wrap(fmt.Errorf("not implemeneted"))
}
func (b *Builder) buildPlan(ctx context.Context, buildPlan *v1alpha1.BuildPlan, path holos.InstancePath) (results []*v1alpha1.Result, err error) {
log := logger.FromContext(ctx)
if err := buildPlan.Validate(); err != nil {
log.WarnContext(ctx, "could not validate", "skipped", true, "err", err)
return nil, errors.Wrap(fmt.Errorf("could not validate %w", err))
}
if buildPlan.Spec.Disabled {
log.DebugContext(ctx, "skipped: spec.disabled is true", "skipped", true)
return
}
// TODO: concurrent renders
results = make([]*v1alpha1.Result, 0, buildPlan.ResultCapacity())
log.DebugContext(ctx, "allocated results slice", "cap", buildPlan.ResultCapacity())
for _, component := range buildPlan.Spec.Components.Resources {
if result, err := component.Render(ctx, path); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not render: %w", err))
} else {
results = append(results, result)
}
}
for _, component := range buildPlan.Spec.Components.KubernetesObjectsList {
if result, err := component.Render(ctx, path); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not render: %w", err))
} else {
results = append(results, result)
}
}
for _, component := range buildPlan.Spec.Components.HelmChartList {
if result, err := component.Render(ctx, path); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not render: %w", err))
} else {
results = append(results, result)
}
}
for _, component := range buildPlan.Spec.Components.KustomizeBuildList {
if result, err := component.Render(ctx, path); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not render: %w", err))
} else {
results = append(results, result)
}
}
log.DebugContext(ctx, "returning results", "len", len(results))
return results, nil
}
// findCueMod returns the root module location containing the cue.mod file or
// directory or an error if the builder arguments do not share a common root
// module.
func (b *Builder) findCueMod() (dir holos.PathCueMod, err error) {
for _, origPath := range b.cfg.args {
absPath, err := filepath.Abs(origPath)
if err != nil {
return "", err
}
path := holos.PathCueMod(absPath)
for {
if _, err := os.Stat(filepath.Join(string(path), "cue.mod")); err == nil {
if dir != "" && dir != path {
return "", fmt.Errorf("multiple modules not supported: %v is not %v", dir, path)
}
dir = path
break
} else if !os.IsNotExist(err) {
return "", err
}
parentPath := holos.PathCueMod(filepath.Dir(string(path)))
if parentPath == path {
return "", fmt.Errorf("no cue.mod from root to leaf: %v", origPath)
}
path = parentPath
}
}
return dir, nil
}

View File

@@ -2,12 +2,13 @@ package build
import (
"fmt"
"log/slog"
"strings"
"github.com/holos-run/holos/internal/builder"
"github.com/holos-run/holos/internal/cli/command"
"github.com/holos-run/holos/internal/errors"
"github.com/holos-run/holos/internal/holos"
"github.com/holos-run/holos/internal/internal/builder"
"github.com/spf13/cobra"
)
@@ -20,10 +21,12 @@ func makeBuildRunFunc(cfg *holos.Config) command.RunFunc {
return err
}
outs := make([]string, 0, len(results))
for _, result := range results {
if result.Skip {
for idx, result := range results {
if result == nil || result.Skip {
slog.Debug("skip result", "idx", idx, "result", result)
continue
}
slog.Debug("append result", "idx", idx, "result.kind", result.Kind)
outs = append(outs, result.AccumulatedOutput())
}
out := strings.Join(outs, "---\n")

View File

@@ -1,13 +1,14 @@
package render
import (
"context"
"flag"
"fmt"
"github.com/holos-run/holos/internal/builder"
"github.com/holos-run/holos/internal/cli/command"
"github.com/holos-run/holos/internal/errors"
"github.com/holos-run/holos/internal/holos"
"github.com/holos-run/holos/internal/internal/builder"
"github.com/holos-run/holos/internal/logger"
"github.com/spf13/cobra"
)
@@ -53,8 +54,9 @@ func New(cfg *holos.Config) *cobra.Command {
// TODO: Avoid accidental over-writes if to holos component instances result in
// the same file path. Write files into a blank temporary directory, error if a
// file exists, then move the directory into place.
for _, result := range results {
if result.Skip {
var result Result
for _, result = range results {
if result.Continue() {
continue
}
// API Objects
@@ -64,7 +66,7 @@ func New(cfg *holos.Config) *cobra.Command {
}
// Kustomization
path = result.KustomizationFilename(cfg.WriteTo(), cfg.ClusterName())
if err := result.Save(ctx, path, result.KsContent); err != nil {
if err := result.Save(ctx, path, result.KustomizationContent()); err != nil {
return errors.Wrap(err)
}
log.InfoContext(ctx, "rendered "+result.Name(), "status", "ok", "action", "rendered", "name", result.Name())
@@ -73,3 +75,13 @@ func New(cfg *holos.Config) *cobra.Command {
}
return cmd
}
type Result interface {
Continue() bool
Name() string
Filename(writeTo string, cluster string) string
KustomizationFilename(writeTo string, cluster string) string
Save(ctx context.Context, path string, content string) error
AccumulatedOutput() string
KustomizationContent() string
}

View File

@@ -17,7 +17,7 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/user"
)
@@ -365,7 +365,7 @@ func (c *OrganizationClient) QueryPlatforms(o *Organization) *PlatformQuery {
id := o.ID
step := sqlgraph.NewStep(
sqlgraph.From(organization.Table, organization.FieldID, id),
sqlgraph.To(entplatform.Table, entplatform.FieldID),
sqlgraph.To(platform.Table, platform.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, organization.PlatformsTable, organization.PlatformsColumn),
)
fromV = sqlgraph.Neighbors(o.driver.Dialect(), step)
@@ -410,13 +410,13 @@ func NewPlatformClient(c config) *PlatformClient {
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `entplatform.Hooks(f(g(h())))`.
// A call to `Use(f, g, h)` equals to `platform.Hooks(f(g(h())))`.
func (c *PlatformClient) Use(hooks ...Hook) {
c.hooks.Platform = append(c.hooks.Platform, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `entplatform.Intercept(f(g(h())))`.
// A call to `Intercept(f, g, h)` equals to `platform.Intercept(f(g(h())))`.
func (c *PlatformClient) Intercept(interceptors ...Interceptor) {
c.inters.Platform = append(c.inters.Platform, interceptors...)
}
@@ -478,7 +478,7 @@ func (c *PlatformClient) DeleteOne(pl *Platform) *PlatformDeleteOne {
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *PlatformClient) DeleteOneID(id uuid.UUID) *PlatformDeleteOne {
builder := c.Delete().Where(entplatform.ID(id))
builder := c.Delete().Where(platform.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &PlatformDeleteOne{builder}
@@ -495,7 +495,7 @@ func (c *PlatformClient) Query() *PlatformQuery {
// Get returns a Platform entity by its id.
func (c *PlatformClient) Get(ctx context.Context, id uuid.UUID) (*Platform, error) {
return c.Query().Where(entplatform.ID(id)).Only(ctx)
return c.Query().Where(platform.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
@@ -513,9 +513,9 @@ func (c *PlatformClient) QueryCreator(pl *Platform) *UserQuery {
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
id := pl.ID
step := sqlgraph.NewStep(
sqlgraph.From(entplatform.Table, entplatform.FieldID, id),
sqlgraph.From(platform.Table, platform.FieldID, id),
sqlgraph.To(user.Table, user.FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, entplatform.CreatorTable, entplatform.CreatorColumn),
sqlgraph.Edge(sqlgraph.M2O, false, platform.CreatorTable, platform.CreatorColumn),
)
fromV = sqlgraph.Neighbors(pl.driver.Dialect(), step)
return fromV, nil
@@ -529,9 +529,9 @@ func (c *PlatformClient) QueryOrganization(pl *Platform) *OrganizationQuery {
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
id := pl.ID
step := sqlgraph.NewStep(
sqlgraph.From(entplatform.Table, entplatform.FieldID, id),
sqlgraph.From(platform.Table, platform.FieldID, id),
sqlgraph.To(organization.Table, organization.FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, entplatform.OrganizationTable, entplatform.OrganizationColumn),
sqlgraph.Edge(sqlgraph.M2O, false, platform.OrganizationTable, platform.OrganizationColumn),
)
fromV = sqlgraph.Neighbors(pl.driver.Dialect(), step)
return fromV, nil

View File

@@ -13,8 +13,7 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/user"
)
@@ -77,7 +76,7 @@ func checkColumn(table, column string) error {
initCheck.Do(func() {
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
organization.Table: organization.ValidColumn,
entplatform.Table: entplatform.ValidColumn,
platform.Table: platform.ValidColumn,
user.Table: user.ValidColumn,
})
})

View File

@@ -13,10 +13,10 @@ import (
"entgo.io/ent/dialect/sql"
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/predicate"
"github.com/holos-run/holos/internal/ent/user"
platform "github.com/holos-run/holos/service/gen/holos/platform/v1alpha1"
holos "github.com/holos-run/holos/service/gen/holos/v1alpha1"
)
const (
@@ -813,8 +813,8 @@ type PlatformMutation struct {
updated_at *time.Time
name *string
display_name *string
form **platform.Form
model **platform.Model
form **holos.Form
model **holos.Model
cue *[]byte
cue_definition *string
clearedFields map[string]struct{}
@@ -1148,12 +1148,12 @@ func (m *PlatformMutation) ResetCreatorID() {
}
// SetForm sets the "form" field.
func (m *PlatformMutation) SetForm(pl *platform.Form) {
m.form = &pl
func (m *PlatformMutation) SetForm(h *holos.Form) {
m.form = &h
}
// Form returns the value of the "form" field in the mutation.
func (m *PlatformMutation) Form() (r *platform.Form, exists bool) {
func (m *PlatformMutation) Form() (r *holos.Form, exists bool) {
v := m.form
if v == nil {
return
@@ -1164,7 +1164,7 @@ func (m *PlatformMutation) Form() (r *platform.Form, exists bool) {
// OldForm returns the old "form" field's value of the Platform entity.
// If the Platform object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *PlatformMutation) OldForm(ctx context.Context) (v *platform.Form, err error) {
func (m *PlatformMutation) OldForm(ctx context.Context) (v *holos.Form, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldForm is only allowed on UpdateOne operations")
}
@@ -1181,28 +1181,28 @@ func (m *PlatformMutation) OldForm(ctx context.Context) (v *platform.Form, err e
// ClearForm clears the value of the "form" field.
func (m *PlatformMutation) ClearForm() {
m.form = nil
m.clearedFields[entplatform.FieldForm] = struct{}{}
m.clearedFields[platform.FieldForm] = struct{}{}
}
// FormCleared returns if the "form" field was cleared in this mutation.
func (m *PlatformMutation) FormCleared() bool {
_, ok := m.clearedFields[entplatform.FieldForm]
_, ok := m.clearedFields[platform.FieldForm]
return ok
}
// ResetForm resets all changes to the "form" field.
func (m *PlatformMutation) ResetForm() {
m.form = nil
delete(m.clearedFields, entplatform.FieldForm)
delete(m.clearedFields, platform.FieldForm)
}
// SetModel sets the "model" field.
func (m *PlatformMutation) SetModel(pl *platform.Model) {
m.model = &pl
func (m *PlatformMutation) SetModel(h *holos.Model) {
m.model = &h
}
// Model returns the value of the "model" field in the mutation.
func (m *PlatformMutation) Model() (r *platform.Model, exists bool) {
func (m *PlatformMutation) Model() (r *holos.Model, exists bool) {
v := m.model
if v == nil {
return
@@ -1213,7 +1213,7 @@ func (m *PlatformMutation) Model() (r *platform.Model, exists bool) {
// OldModel returns the old "model" field's value of the Platform entity.
// If the Platform object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *PlatformMutation) OldModel(ctx context.Context) (v *platform.Model, err error) {
func (m *PlatformMutation) OldModel(ctx context.Context) (v *holos.Model, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldModel is only allowed on UpdateOne operations")
}
@@ -1230,19 +1230,19 @@ func (m *PlatformMutation) OldModel(ctx context.Context) (v *platform.Model, err
// ClearModel clears the value of the "model" field.
func (m *PlatformMutation) ClearModel() {
m.model = nil
m.clearedFields[entplatform.FieldModel] = struct{}{}
m.clearedFields[platform.FieldModel] = struct{}{}
}
// ModelCleared returns if the "model" field was cleared in this mutation.
func (m *PlatformMutation) ModelCleared() bool {
_, ok := m.clearedFields[entplatform.FieldModel]
_, ok := m.clearedFields[platform.FieldModel]
return ok
}
// ResetModel resets all changes to the "model" field.
func (m *PlatformMutation) ResetModel() {
m.model = nil
delete(m.clearedFields, entplatform.FieldModel)
delete(m.clearedFields, platform.FieldModel)
}
// SetCue sets the "cue" field.
@@ -1279,19 +1279,19 @@ func (m *PlatformMutation) OldCue(ctx context.Context) (v []byte, err error) {
// ClearCue clears the value of the "cue" field.
func (m *PlatformMutation) ClearCue() {
m.cue = nil
m.clearedFields[entplatform.FieldCue] = struct{}{}
m.clearedFields[platform.FieldCue] = struct{}{}
}
// CueCleared returns if the "cue" field was cleared in this mutation.
func (m *PlatformMutation) CueCleared() bool {
_, ok := m.clearedFields[entplatform.FieldCue]
_, ok := m.clearedFields[platform.FieldCue]
return ok
}
// ResetCue resets all changes to the "cue" field.
func (m *PlatformMutation) ResetCue() {
m.cue = nil
delete(m.clearedFields, entplatform.FieldCue)
delete(m.clearedFields, platform.FieldCue)
}
// SetCueDefinition sets the "cue_definition" field.
@@ -1328,25 +1328,25 @@ func (m *PlatformMutation) OldCueDefinition(ctx context.Context) (v string, err
// ClearCueDefinition clears the value of the "cue_definition" field.
func (m *PlatformMutation) ClearCueDefinition() {
m.cue_definition = nil
m.clearedFields[entplatform.FieldCueDefinition] = struct{}{}
m.clearedFields[platform.FieldCueDefinition] = struct{}{}
}
// CueDefinitionCleared returns if the "cue_definition" field was cleared in this mutation.
func (m *PlatformMutation) CueDefinitionCleared() bool {
_, ok := m.clearedFields[entplatform.FieldCueDefinition]
_, ok := m.clearedFields[platform.FieldCueDefinition]
return ok
}
// ResetCueDefinition resets all changes to the "cue_definition" field.
func (m *PlatformMutation) ResetCueDefinition() {
m.cue_definition = nil
delete(m.clearedFields, entplatform.FieldCueDefinition)
delete(m.clearedFields, platform.FieldCueDefinition)
}
// ClearCreator clears the "creator" edge to the User entity.
func (m *PlatformMutation) ClearCreator() {
m.clearedcreator = true
m.clearedFields[entplatform.FieldCreatorID] = struct{}{}
m.clearedFields[platform.FieldCreatorID] = struct{}{}
}
// CreatorCleared reports if the "creator" edge to the User entity was cleared.
@@ -1378,7 +1378,7 @@ func (m *PlatformMutation) SetOrganizationID(id uuid.UUID) {
// ClearOrganization clears the "organization" edge to the Organization entity.
func (m *PlatformMutation) ClearOrganization() {
m.clearedorganization = true
m.clearedFields[entplatform.FieldOrgID] = struct{}{}
m.clearedFields[platform.FieldOrgID] = struct{}{}
}
// OrganizationCleared reports if the "organization" edge to the Organization entity was cleared.
@@ -1446,34 +1446,34 @@ func (m *PlatformMutation) Type() string {
func (m *PlatformMutation) Fields() []string {
fields := make([]string, 0, 10)
if m.created_at != nil {
fields = append(fields, entplatform.FieldCreatedAt)
fields = append(fields, platform.FieldCreatedAt)
}
if m.updated_at != nil {
fields = append(fields, entplatform.FieldUpdatedAt)
fields = append(fields, platform.FieldUpdatedAt)
}
if m.organization != nil {
fields = append(fields, entplatform.FieldOrgID)
fields = append(fields, platform.FieldOrgID)
}
if m.name != nil {
fields = append(fields, entplatform.FieldName)
fields = append(fields, platform.FieldName)
}
if m.display_name != nil {
fields = append(fields, entplatform.FieldDisplayName)
fields = append(fields, platform.FieldDisplayName)
}
if m.creator != nil {
fields = append(fields, entplatform.FieldCreatorID)
fields = append(fields, platform.FieldCreatorID)
}
if m.form != nil {
fields = append(fields, entplatform.FieldForm)
fields = append(fields, platform.FieldForm)
}
if m.model != nil {
fields = append(fields, entplatform.FieldModel)
fields = append(fields, platform.FieldModel)
}
if m.cue != nil {
fields = append(fields, entplatform.FieldCue)
fields = append(fields, platform.FieldCue)
}
if m.cue_definition != nil {
fields = append(fields, entplatform.FieldCueDefinition)
fields = append(fields, platform.FieldCueDefinition)
}
return fields
}
@@ -1483,25 +1483,25 @@ func (m *PlatformMutation) Fields() []string {
// schema.
func (m *PlatformMutation) Field(name string) (ent.Value, bool) {
switch name {
case entplatform.FieldCreatedAt:
case platform.FieldCreatedAt:
return m.CreatedAt()
case entplatform.FieldUpdatedAt:
case platform.FieldUpdatedAt:
return m.UpdatedAt()
case entplatform.FieldOrgID:
case platform.FieldOrgID:
return m.OrgID()
case entplatform.FieldName:
case platform.FieldName:
return m.Name()
case entplatform.FieldDisplayName:
case platform.FieldDisplayName:
return m.DisplayName()
case entplatform.FieldCreatorID:
case platform.FieldCreatorID:
return m.CreatorID()
case entplatform.FieldForm:
case platform.FieldForm:
return m.Form()
case entplatform.FieldModel:
case platform.FieldModel:
return m.Model()
case entplatform.FieldCue:
case platform.FieldCue:
return m.Cue()
case entplatform.FieldCueDefinition:
case platform.FieldCueDefinition:
return m.CueDefinition()
}
return nil, false
@@ -1512,25 +1512,25 @@ func (m *PlatformMutation) Field(name string) (ent.Value, bool) {
// database failed.
func (m *PlatformMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case entplatform.FieldCreatedAt:
case platform.FieldCreatedAt:
return m.OldCreatedAt(ctx)
case entplatform.FieldUpdatedAt:
case platform.FieldUpdatedAt:
return m.OldUpdatedAt(ctx)
case entplatform.FieldOrgID:
case platform.FieldOrgID:
return m.OldOrgID(ctx)
case entplatform.FieldName:
case platform.FieldName:
return m.OldName(ctx)
case entplatform.FieldDisplayName:
case platform.FieldDisplayName:
return m.OldDisplayName(ctx)
case entplatform.FieldCreatorID:
case platform.FieldCreatorID:
return m.OldCreatorID(ctx)
case entplatform.FieldForm:
case platform.FieldForm:
return m.OldForm(ctx)
case entplatform.FieldModel:
case platform.FieldModel:
return m.OldModel(ctx)
case entplatform.FieldCue:
case platform.FieldCue:
return m.OldCue(ctx)
case entplatform.FieldCueDefinition:
case platform.FieldCueDefinition:
return m.OldCueDefinition(ctx)
}
return nil, fmt.Errorf("unknown Platform field %s", name)
@@ -1541,70 +1541,70 @@ func (m *PlatformMutation) OldField(ctx context.Context, name string) (ent.Value
// type.
func (m *PlatformMutation) SetField(name string, value ent.Value) error {
switch name {
case entplatform.FieldCreatedAt:
case platform.FieldCreatedAt:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreatedAt(v)
return nil
case entplatform.FieldUpdatedAt:
case platform.FieldUpdatedAt:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdatedAt(v)
return nil
case entplatform.FieldOrgID:
case platform.FieldOrgID:
v, ok := value.(uuid.UUID)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetOrgID(v)
return nil
case entplatform.FieldName:
case platform.FieldName:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetName(v)
return nil
case entplatform.FieldDisplayName:
case platform.FieldDisplayName:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDisplayName(v)
return nil
case entplatform.FieldCreatorID:
case platform.FieldCreatorID:
v, ok := value.(uuid.UUID)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreatorID(v)
return nil
case entplatform.FieldForm:
v, ok := value.(*platform.Form)
case platform.FieldForm:
v, ok := value.(*holos.Form)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetForm(v)
return nil
case entplatform.FieldModel:
v, ok := value.(*platform.Model)
case platform.FieldModel:
v, ok := value.(*holos.Model)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetModel(v)
return nil
case entplatform.FieldCue:
case platform.FieldCue:
v, ok := value.([]byte)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCue(v)
return nil
case entplatform.FieldCueDefinition:
case platform.FieldCueDefinition:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
@@ -1641,17 +1641,17 @@ func (m *PlatformMutation) AddField(name string, value ent.Value) error {
// mutation.
func (m *PlatformMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(entplatform.FieldForm) {
fields = append(fields, entplatform.FieldForm)
if m.FieldCleared(platform.FieldForm) {
fields = append(fields, platform.FieldForm)
}
if m.FieldCleared(entplatform.FieldModel) {
fields = append(fields, entplatform.FieldModel)
if m.FieldCleared(platform.FieldModel) {
fields = append(fields, platform.FieldModel)
}
if m.FieldCleared(entplatform.FieldCue) {
fields = append(fields, entplatform.FieldCue)
if m.FieldCleared(platform.FieldCue) {
fields = append(fields, platform.FieldCue)
}
if m.FieldCleared(entplatform.FieldCueDefinition) {
fields = append(fields, entplatform.FieldCueDefinition)
if m.FieldCleared(platform.FieldCueDefinition) {
fields = append(fields, platform.FieldCueDefinition)
}
return fields
}
@@ -1667,16 +1667,16 @@ func (m *PlatformMutation) FieldCleared(name string) bool {
// error if the field is not defined in the schema.
func (m *PlatformMutation) ClearField(name string) error {
switch name {
case entplatform.FieldForm:
case platform.FieldForm:
m.ClearForm()
return nil
case entplatform.FieldModel:
case platform.FieldModel:
m.ClearModel()
return nil
case entplatform.FieldCue:
case platform.FieldCue:
m.ClearCue()
return nil
case entplatform.FieldCueDefinition:
case platform.FieldCueDefinition:
m.ClearCueDefinition()
return nil
}
@@ -1687,34 +1687,34 @@ func (m *PlatformMutation) ClearField(name string) error {
// It returns an error if the field is not defined in the schema.
func (m *PlatformMutation) ResetField(name string) error {
switch name {
case entplatform.FieldCreatedAt:
case platform.FieldCreatedAt:
m.ResetCreatedAt()
return nil
case entplatform.FieldUpdatedAt:
case platform.FieldUpdatedAt:
m.ResetUpdatedAt()
return nil
case entplatform.FieldOrgID:
case platform.FieldOrgID:
m.ResetOrgID()
return nil
case entplatform.FieldName:
case platform.FieldName:
m.ResetName()
return nil
case entplatform.FieldDisplayName:
case platform.FieldDisplayName:
m.ResetDisplayName()
return nil
case entplatform.FieldCreatorID:
case platform.FieldCreatorID:
m.ResetCreatorID()
return nil
case entplatform.FieldForm:
case platform.FieldForm:
m.ResetForm()
return nil
case entplatform.FieldModel:
case platform.FieldModel:
m.ResetModel()
return nil
case entplatform.FieldCue:
case platform.FieldCue:
m.ResetCue()
return nil
case entplatform.FieldCueDefinition:
case platform.FieldCueDefinition:
m.ResetCueDefinition()
return nil
}
@@ -1725,10 +1725,10 @@ func (m *PlatformMutation) ResetField(name string) error {
func (m *PlatformMutation) AddedEdges() []string {
edges := make([]string, 0, 2)
if m.creator != nil {
edges = append(edges, entplatform.EdgeCreator)
edges = append(edges, platform.EdgeCreator)
}
if m.organization != nil {
edges = append(edges, entplatform.EdgeOrganization)
edges = append(edges, platform.EdgeOrganization)
}
return edges
}
@@ -1737,11 +1737,11 @@ func (m *PlatformMutation) AddedEdges() []string {
// name in this mutation.
func (m *PlatformMutation) AddedIDs(name string) []ent.Value {
switch name {
case entplatform.EdgeCreator:
case platform.EdgeCreator:
if id := m.creator; id != nil {
return []ent.Value{*id}
}
case entplatform.EdgeOrganization:
case platform.EdgeOrganization:
if id := m.organization; id != nil {
return []ent.Value{*id}
}
@@ -1765,10 +1765,10 @@ func (m *PlatformMutation) RemovedIDs(name string) []ent.Value {
func (m *PlatformMutation) ClearedEdges() []string {
edges := make([]string, 0, 2)
if m.clearedcreator {
edges = append(edges, entplatform.EdgeCreator)
edges = append(edges, platform.EdgeCreator)
}
if m.clearedorganization {
edges = append(edges, entplatform.EdgeOrganization)
edges = append(edges, platform.EdgeOrganization)
}
return edges
}
@@ -1777,9 +1777,9 @@ func (m *PlatformMutation) ClearedEdges() []string {
// was cleared in this mutation.
func (m *PlatformMutation) EdgeCleared(name string) bool {
switch name {
case entplatform.EdgeCreator:
case platform.EdgeCreator:
return m.clearedcreator
case entplatform.EdgeOrganization:
case platform.EdgeOrganization:
return m.clearedorganization
}
return false
@@ -1789,10 +1789,10 @@ func (m *PlatformMutation) EdgeCleared(name string) bool {
// if that edge is not defined in the schema.
func (m *PlatformMutation) ClearEdge(name string) error {
switch name {
case entplatform.EdgeCreator:
case platform.EdgeCreator:
m.ClearCreator()
return nil
case entplatform.EdgeOrganization:
case platform.EdgeOrganization:
m.ClearOrganization()
return nil
}
@@ -1803,10 +1803,10 @@ func (m *PlatformMutation) ClearEdge(name string) error {
// It returns an error if the edge is not defined in the schema.
func (m *PlatformMutation) ResetEdge(name string) error {
switch name {
case entplatform.EdgeCreator:
case platform.EdgeCreator:
m.ResetCreator()
return nil
case entplatform.EdgeOrganization:
case platform.EdgeOrganization:
m.ResetOrganization()
return nil
}

View File

@@ -48,7 +48,7 @@ const (
// PlatformsTable is the table that holds the platforms relation/edge.
PlatformsTable = "platforms"
// PlatformsInverseTable is the table name for the Platform entity.
// It exists in this package in order to avoid circular dependency with the "entplatform" package.
// It exists in this package in order to avoid circular dependency with the "platform" package.
PlatformsInverseTable = "platforms"
// PlatformsColumn is the table column denoting the platforms relation/edge.
PlatformsColumn = "org_id"

View File

@@ -14,7 +14,7 @@ import (
"entgo.io/ent/schema/field"
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/user"
)
@@ -288,7 +288,7 @@ func (oc *OrganizationCreate) createSpec() (*Organization, *sqlgraph.CreateSpec)
Columns: []string{organization.PlatformsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID),
IDSpec: sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID),
},
}
for _, k := range nodes {

View File

@@ -13,7 +13,7 @@ import (
"entgo.io/ent/schema/field"
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/predicate"
"github.com/holos-run/holos/internal/ent/user"
)
@@ -121,7 +121,7 @@ func (oq *OrganizationQuery) QueryPlatforms() *PlatformQuery {
}
step := sqlgraph.NewStep(
sqlgraph.From(organization.Table, organization.FieldID, selector),
sqlgraph.To(entplatform.Table, entplatform.FieldID),
sqlgraph.To(platform.Table, platform.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, organization.PlatformsTable, organization.PlatformsColumn),
)
fromU = sqlgraph.SetNeighbors(oq.driver.Dialect(), step)
@@ -590,7 +590,7 @@ func (oq *OrganizationQuery) loadPlatforms(ctx context.Context, query *PlatformQ
}
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(entplatform.FieldOrgID)
query.ctx.AppendFieldOnce(platform.FieldOrgID)
}
query.Where(predicate.Platform(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(organization.PlatformsColumn), fks...))

View File

@@ -13,7 +13,7 @@ import (
"entgo.io/ent/schema/field"
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/predicate"
"github.com/holos-run/holos/internal/ent/user"
)
@@ -319,7 +319,7 @@ func (ou *OrganizationUpdate) sqlSave(ctx context.Context) (n int, err error) {
Columns: []string{organization.PlatformsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID),
IDSpec: sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
@@ -332,7 +332,7 @@ func (ou *OrganizationUpdate) sqlSave(ctx context.Context) (n int, err error) {
Columns: []string{organization.PlatformsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID),
IDSpec: sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID),
},
}
for _, k := range nodes {
@@ -348,7 +348,7 @@ func (ou *OrganizationUpdate) sqlSave(ctx context.Context) (n int, err error) {
Columns: []string{organization.PlatformsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID),
IDSpec: sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID),
},
}
for _, k := range nodes {
@@ -694,7 +694,7 @@ func (ouo *OrganizationUpdateOne) sqlSave(ctx context.Context) (_node *Organizat
Columns: []string{organization.PlatformsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID),
IDSpec: sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
@@ -707,7 +707,7 @@ func (ouo *OrganizationUpdateOne) sqlSave(ctx context.Context) (_node *Organizat
Columns: []string{organization.PlatformsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID),
IDSpec: sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID),
},
}
for _, k := range nodes {
@@ -723,7 +723,7 @@ func (ouo *OrganizationUpdateOne) sqlSave(ctx context.Context) (_node *Organizat
Columns: []string{organization.PlatformsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID),
IDSpec: sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID),
},
}
for _, k := range nodes {

View File

@@ -12,9 +12,9 @@ import (
"entgo.io/ent/dialect/sql"
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/user"
platform "github.com/holos-run/holos/service/gen/holos/platform/v1alpha1"
holos "github.com/holos-run/holos/service/gen/holos/v1alpha1"
)
// Platform is the model entity for the Platform schema.
@@ -35,9 +35,9 @@ type Platform struct {
// CreatorID holds the value of the "creator_id" field.
CreatorID uuid.UUID `json:"creator_id,omitempty"`
// JSON representation of FormlyFormConfig[] refer to https://github.com/holos-run/holos/issues/161
Form *platform.Form `json:"form,omitempty"`
Form *holos.Form `json:"form,omitempty"`
// JSON representation of the form model which holds user input values refer to https://github.com/holos-run/holos/issues/161
Model *platform.Model `json:"model,omitempty"`
Model *holos.Model `json:"model,omitempty"`
// CUE definition to vet the model against e.g. #PlatformConfig
Cue []byte `json:"cue,omitempty"`
// The definition name to vet config_values against config_cue e.g. '#PlatformSpec'
@@ -86,13 +86,13 @@ func (*Platform) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case entplatform.FieldForm, entplatform.FieldModel, entplatform.FieldCue:
case platform.FieldForm, platform.FieldModel, platform.FieldCue:
values[i] = new([]byte)
case entplatform.FieldName, entplatform.FieldDisplayName, entplatform.FieldCueDefinition:
case platform.FieldName, platform.FieldDisplayName, platform.FieldCueDefinition:
values[i] = new(sql.NullString)
case entplatform.FieldCreatedAt, entplatform.FieldUpdatedAt:
case platform.FieldCreatedAt, platform.FieldUpdatedAt:
values[i] = new(sql.NullTime)
case entplatform.FieldID, entplatform.FieldOrgID, entplatform.FieldCreatorID:
case platform.FieldID, platform.FieldOrgID, platform.FieldCreatorID:
values[i] = new(uuid.UUID)
default:
values[i] = new(sql.UnknownType)
@@ -109,49 +109,49 @@ func (pl *Platform) assignValues(columns []string, values []any) error {
}
for i := range columns {
switch columns[i] {
case entplatform.FieldID:
case platform.FieldID:
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
pl.ID = *value
}
case entplatform.FieldCreatedAt:
case platform.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
pl.CreatedAt = value.Time
}
case entplatform.FieldUpdatedAt:
case platform.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
pl.UpdatedAt = value.Time
}
case entplatform.FieldOrgID:
case platform.FieldOrgID:
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field org_id", values[i])
} else if value != nil {
pl.OrgID = *value
}
case entplatform.FieldName:
case platform.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
pl.Name = value.String
}
case entplatform.FieldDisplayName:
case platform.FieldDisplayName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field display_name", values[i])
} else if value.Valid {
pl.DisplayName = value.String
}
case entplatform.FieldCreatorID:
case platform.FieldCreatorID:
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field creator_id", values[i])
} else if value != nil {
pl.CreatorID = *value
}
case entplatform.FieldForm:
case platform.FieldForm:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field form", values[i])
} else if value != nil && len(*value) > 0 {
@@ -159,7 +159,7 @@ func (pl *Platform) assignValues(columns []string, values []any) error {
return fmt.Errorf("unmarshal field form: %w", err)
}
}
case entplatform.FieldModel:
case platform.FieldModel:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field model", values[i])
} else if value != nil && len(*value) > 0 {
@@ -167,13 +167,13 @@ func (pl *Platform) assignValues(columns []string, values []any) error {
return fmt.Errorf("unmarshal field model: %w", err)
}
}
case entplatform.FieldCue:
case platform.FieldCue:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field cue", values[i])
} else if value != nil {
pl.Cue = *value
}
case entplatform.FieldCueDefinition:
case platform.FieldCueDefinition:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field cue_definition", values[i])
} else if value.Valid {

View File

@@ -1,6 +1,6 @@
// Code generated by ent, DO NOT EDIT.
package entplatform
package platform
import (
"time"

View File

@@ -1,6 +1,6 @@
// Code generated by ent, DO NOT EDIT.
package entplatform
package platform
import (
"time"

View File

@@ -14,9 +14,9 @@ import (
"entgo.io/ent/schema/field"
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/user"
platform "github.com/holos-run/holos/service/gen/holos/platform/v1alpha1"
holos "github.com/holos-run/holos/service/gen/holos/v1alpha1"
)
// PlatformCreate is the builder for creating a Platform entity.
@@ -80,14 +80,14 @@ func (pc *PlatformCreate) SetCreatorID(u uuid.UUID) *PlatformCreate {
}
// SetForm sets the "form" field.
func (pc *PlatformCreate) SetForm(pl *platform.Form) *PlatformCreate {
pc.mutation.SetForm(pl)
func (pc *PlatformCreate) SetForm(h *holos.Form) *PlatformCreate {
pc.mutation.SetForm(h)
return pc
}
// SetModel sets the "model" field.
func (pc *PlatformCreate) SetModel(pl *platform.Model) *PlatformCreate {
pc.mutation.SetModel(pl)
func (pc *PlatformCreate) SetModel(h *holos.Model) *PlatformCreate {
pc.mutation.SetModel(h)
return pc
}
@@ -177,15 +177,15 @@ func (pc *PlatformCreate) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save.
func (pc *PlatformCreate) defaults() {
if _, ok := pc.mutation.CreatedAt(); !ok {
v := entplatform.DefaultCreatedAt()
v := platform.DefaultCreatedAt()
pc.mutation.SetCreatedAt(v)
}
if _, ok := pc.mutation.UpdatedAt(); !ok {
v := entplatform.DefaultUpdatedAt()
v := platform.DefaultUpdatedAt()
pc.mutation.SetUpdatedAt(v)
}
if _, ok := pc.mutation.ID(); !ok {
v := entplatform.DefaultID()
v := platform.DefaultID()
pc.mutation.SetID(v)
}
}
@@ -205,7 +205,7 @@ func (pc *PlatformCreate) check() error {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Platform.name"`)}
}
if v, ok := pc.mutation.Name(); ok {
if err := entplatform.NameValidator(v); err != nil {
if err := platform.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Platform.name": %w`, err)}
}
}
@@ -250,7 +250,7 @@ func (pc *PlatformCreate) sqlSave(ctx context.Context) (*Platform, error) {
func (pc *PlatformCreate) createSpec() (*Platform, *sqlgraph.CreateSpec) {
var (
_node = &Platform{config: pc.config}
_spec = sqlgraph.NewCreateSpec(entplatform.Table, sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID))
_spec = sqlgraph.NewCreateSpec(platform.Table, sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID))
)
_spec.OnConflict = pc.conflict
if id, ok := pc.mutation.ID(); ok {
@@ -258,43 +258,43 @@ func (pc *PlatformCreate) createSpec() (*Platform, *sqlgraph.CreateSpec) {
_spec.ID.Value = &id
}
if value, ok := pc.mutation.CreatedAt(); ok {
_spec.SetField(entplatform.FieldCreatedAt, field.TypeTime, value)
_spec.SetField(platform.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := pc.mutation.UpdatedAt(); ok {
_spec.SetField(entplatform.FieldUpdatedAt, field.TypeTime, value)
_spec.SetField(platform.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := pc.mutation.Name(); ok {
_spec.SetField(entplatform.FieldName, field.TypeString, value)
_spec.SetField(platform.FieldName, field.TypeString, value)
_node.Name = value
}
if value, ok := pc.mutation.DisplayName(); ok {
_spec.SetField(entplatform.FieldDisplayName, field.TypeString, value)
_spec.SetField(platform.FieldDisplayName, field.TypeString, value)
_node.DisplayName = value
}
if value, ok := pc.mutation.Form(); ok {
_spec.SetField(entplatform.FieldForm, field.TypeJSON, value)
_spec.SetField(platform.FieldForm, field.TypeJSON, value)
_node.Form = value
}
if value, ok := pc.mutation.Model(); ok {
_spec.SetField(entplatform.FieldModel, field.TypeJSON, value)
_spec.SetField(platform.FieldModel, field.TypeJSON, value)
_node.Model = value
}
if value, ok := pc.mutation.Cue(); ok {
_spec.SetField(entplatform.FieldCue, field.TypeBytes, value)
_spec.SetField(platform.FieldCue, field.TypeBytes, value)
_node.Cue = value
}
if value, ok := pc.mutation.CueDefinition(); ok {
_spec.SetField(entplatform.FieldCueDefinition, field.TypeString, value)
_spec.SetField(platform.FieldCueDefinition, field.TypeString, value)
_node.CueDefinition = value
}
if nodes := pc.mutation.CreatorIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.CreatorTable,
Columns: []string{entplatform.CreatorColumn},
Table: platform.CreatorTable,
Columns: []string{platform.CreatorColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
@@ -310,8 +310,8 @@ func (pc *PlatformCreate) createSpec() (*Platform, *sqlgraph.CreateSpec) {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.OrganizationTable,
Columns: []string{entplatform.OrganizationColumn},
Table: platform.OrganizationTable,
Columns: []string{platform.OrganizationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(organization.FieldID, field.TypeUUID),
@@ -377,133 +377,133 @@ type (
// SetUpdatedAt sets the "updated_at" field.
func (u *PlatformUpsert) SetUpdatedAt(v time.Time) *PlatformUpsert {
u.Set(entplatform.FieldUpdatedAt, v)
u.Set(platform.FieldUpdatedAt, v)
return u
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *PlatformUpsert) UpdateUpdatedAt() *PlatformUpsert {
u.SetExcluded(entplatform.FieldUpdatedAt)
u.SetExcluded(platform.FieldUpdatedAt)
return u
}
// SetOrgID sets the "org_id" field.
func (u *PlatformUpsert) SetOrgID(v uuid.UUID) *PlatformUpsert {
u.Set(entplatform.FieldOrgID, v)
u.Set(platform.FieldOrgID, v)
return u
}
// UpdateOrgID sets the "org_id" field to the value that was provided on create.
func (u *PlatformUpsert) UpdateOrgID() *PlatformUpsert {
u.SetExcluded(entplatform.FieldOrgID)
u.SetExcluded(platform.FieldOrgID)
return u
}
// SetName sets the "name" field.
func (u *PlatformUpsert) SetName(v string) *PlatformUpsert {
u.Set(entplatform.FieldName, v)
u.Set(platform.FieldName, v)
return u
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *PlatformUpsert) UpdateName() *PlatformUpsert {
u.SetExcluded(entplatform.FieldName)
u.SetExcluded(platform.FieldName)
return u
}
// SetDisplayName sets the "display_name" field.
func (u *PlatformUpsert) SetDisplayName(v string) *PlatformUpsert {
u.Set(entplatform.FieldDisplayName, v)
u.Set(platform.FieldDisplayName, v)
return u
}
// UpdateDisplayName sets the "display_name" field to the value that was provided on create.
func (u *PlatformUpsert) UpdateDisplayName() *PlatformUpsert {
u.SetExcluded(entplatform.FieldDisplayName)
u.SetExcluded(platform.FieldDisplayName)
return u
}
// SetCreatorID sets the "creator_id" field.
func (u *PlatformUpsert) SetCreatorID(v uuid.UUID) *PlatformUpsert {
u.Set(entplatform.FieldCreatorID, v)
u.Set(platform.FieldCreatorID, v)
return u
}
// UpdateCreatorID sets the "creator_id" field to the value that was provided on create.
func (u *PlatformUpsert) UpdateCreatorID() *PlatformUpsert {
u.SetExcluded(entplatform.FieldCreatorID)
u.SetExcluded(platform.FieldCreatorID)
return u
}
// SetForm sets the "form" field.
func (u *PlatformUpsert) SetForm(v *platform.Form) *PlatformUpsert {
u.Set(entplatform.FieldForm, v)
func (u *PlatformUpsert) SetForm(v *holos.Form) *PlatformUpsert {
u.Set(platform.FieldForm, v)
return u
}
// UpdateForm sets the "form" field to the value that was provided on create.
func (u *PlatformUpsert) UpdateForm() *PlatformUpsert {
u.SetExcluded(entplatform.FieldForm)
u.SetExcluded(platform.FieldForm)
return u
}
// ClearForm clears the value of the "form" field.
func (u *PlatformUpsert) ClearForm() *PlatformUpsert {
u.SetNull(entplatform.FieldForm)
u.SetNull(platform.FieldForm)
return u
}
// SetModel sets the "model" field.
func (u *PlatformUpsert) SetModel(v *platform.Model) *PlatformUpsert {
u.Set(entplatform.FieldModel, v)
func (u *PlatformUpsert) SetModel(v *holos.Model) *PlatformUpsert {
u.Set(platform.FieldModel, v)
return u
}
// UpdateModel sets the "model" field to the value that was provided on create.
func (u *PlatformUpsert) UpdateModel() *PlatformUpsert {
u.SetExcluded(entplatform.FieldModel)
u.SetExcluded(platform.FieldModel)
return u
}
// ClearModel clears the value of the "model" field.
func (u *PlatformUpsert) ClearModel() *PlatformUpsert {
u.SetNull(entplatform.FieldModel)
u.SetNull(platform.FieldModel)
return u
}
// SetCue sets the "cue" field.
func (u *PlatformUpsert) SetCue(v []byte) *PlatformUpsert {
u.Set(entplatform.FieldCue, v)
u.Set(platform.FieldCue, v)
return u
}
// UpdateCue sets the "cue" field to the value that was provided on create.
func (u *PlatformUpsert) UpdateCue() *PlatformUpsert {
u.SetExcluded(entplatform.FieldCue)
u.SetExcluded(platform.FieldCue)
return u
}
// ClearCue clears the value of the "cue" field.
func (u *PlatformUpsert) ClearCue() *PlatformUpsert {
u.SetNull(entplatform.FieldCue)
u.SetNull(platform.FieldCue)
return u
}
// SetCueDefinition sets the "cue_definition" field.
func (u *PlatformUpsert) SetCueDefinition(v string) *PlatformUpsert {
u.Set(entplatform.FieldCueDefinition, v)
u.Set(platform.FieldCueDefinition, v)
return u
}
// UpdateCueDefinition sets the "cue_definition" field to the value that was provided on create.
func (u *PlatformUpsert) UpdateCueDefinition() *PlatformUpsert {
u.SetExcluded(entplatform.FieldCueDefinition)
u.SetExcluded(platform.FieldCueDefinition)
return u
}
// ClearCueDefinition clears the value of the "cue_definition" field.
func (u *PlatformUpsert) ClearCueDefinition() *PlatformUpsert {
u.SetNull(entplatform.FieldCueDefinition)
u.SetNull(platform.FieldCueDefinition)
return u
}
@@ -514,7 +514,7 @@ func (u *PlatformUpsert) ClearCueDefinition() *PlatformUpsert {
// OnConflict(
// sql.ResolveWithNewValues(),
// sql.ResolveWith(func(u *sql.UpdateSet) {
// u.SetIgnore(entplatform.FieldID)
// u.SetIgnore(platform.FieldID)
// }),
// ).
// Exec(ctx)
@@ -522,10 +522,10 @@ func (u *PlatformUpsertOne) UpdateNewValues() *PlatformUpsertOne {
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
if _, exists := u.create.mutation.ID(); exists {
s.SetIgnore(entplatform.FieldID)
s.SetIgnore(platform.FieldID)
}
if _, exists := u.create.mutation.CreatedAt(); exists {
s.SetIgnore(entplatform.FieldCreatedAt)
s.SetIgnore(platform.FieldCreatedAt)
}
}))
return u
@@ -629,7 +629,7 @@ func (u *PlatformUpsertOne) UpdateCreatorID() *PlatformUpsertOne {
}
// SetForm sets the "form" field.
func (u *PlatformUpsertOne) SetForm(v *platform.Form) *PlatformUpsertOne {
func (u *PlatformUpsertOne) SetForm(v *holos.Form) *PlatformUpsertOne {
return u.Update(func(s *PlatformUpsert) {
s.SetForm(v)
})
@@ -650,7 +650,7 @@ func (u *PlatformUpsertOne) ClearForm() *PlatformUpsertOne {
}
// SetModel sets the "model" field.
func (u *PlatformUpsertOne) SetModel(v *platform.Model) *PlatformUpsertOne {
func (u *PlatformUpsertOne) SetModel(v *holos.Model) *PlatformUpsertOne {
return u.Update(func(s *PlatformUpsert) {
s.SetModel(v)
})
@@ -884,7 +884,7 @@ type PlatformUpsertBulk struct {
// OnConflict(
// sql.ResolveWithNewValues(),
// sql.ResolveWith(func(u *sql.UpdateSet) {
// u.SetIgnore(entplatform.FieldID)
// u.SetIgnore(platform.FieldID)
// }),
// ).
// Exec(ctx)
@@ -893,10 +893,10 @@ func (u *PlatformUpsertBulk) UpdateNewValues() *PlatformUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
for _, b := range u.create.builders {
if _, exists := b.mutation.ID(); exists {
s.SetIgnore(entplatform.FieldID)
s.SetIgnore(platform.FieldID)
}
if _, exists := b.mutation.CreatedAt(); exists {
s.SetIgnore(entplatform.FieldCreatedAt)
s.SetIgnore(platform.FieldCreatedAt)
}
}
}))
@@ -1001,7 +1001,7 @@ func (u *PlatformUpsertBulk) UpdateCreatorID() *PlatformUpsertBulk {
}
// SetForm sets the "form" field.
func (u *PlatformUpsertBulk) SetForm(v *platform.Form) *PlatformUpsertBulk {
func (u *PlatformUpsertBulk) SetForm(v *holos.Form) *PlatformUpsertBulk {
return u.Update(func(s *PlatformUpsert) {
s.SetForm(v)
})
@@ -1022,7 +1022,7 @@ func (u *PlatformUpsertBulk) ClearForm() *PlatformUpsertBulk {
}
// SetModel sets the "model" field.
func (u *PlatformUpsertBulk) SetModel(v *platform.Model) *PlatformUpsertBulk {
func (u *PlatformUpsertBulk) SetModel(v *holos.Model) *PlatformUpsertBulk {
return u.Update(func(s *PlatformUpsert) {
s.SetModel(v)
})

View File

@@ -8,9 +8,8 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/predicate"
entplatform "github.com/holos-run/holos/internal/ent/platform"
)
// PlatformDelete is the builder for deleting a Platform entity.
@@ -41,7 +40,7 @@ func (pd *PlatformDelete) ExecX(ctx context.Context) int {
}
func (pd *PlatformDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(entplatform.Table, sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID))
_spec := sqlgraph.NewDeleteSpec(platform.Table, sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID))
if ps := pd.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
@@ -75,7 +74,7 @@ func (pdo *PlatformDeleteOne) Exec(ctx context.Context) error {
case err != nil:
return err
case n == 0:
return &NotFoundError{entplatform.Label}
return &NotFoundError{platform.Label}
default:
return nil
}

View File

@@ -12,7 +12,7 @@ import (
"entgo.io/ent/schema/field"
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/predicate"
"github.com/holos-run/holos/internal/ent/user"
)
@@ -21,7 +21,7 @@ import (
type PlatformQuery struct {
config
ctx *QueryContext
order []entplatform.OrderOption
order []platform.OrderOption
inters []Interceptor
predicates []predicate.Platform
withCreator *UserQuery
@@ -57,7 +57,7 @@ func (pq *PlatformQuery) Unique(unique bool) *PlatformQuery {
}
// Order specifies how the records should be ordered.
func (pq *PlatformQuery) Order(o ...entplatform.OrderOption) *PlatformQuery {
func (pq *PlatformQuery) Order(o ...platform.OrderOption) *PlatformQuery {
pq.order = append(pq.order, o...)
return pq
}
@@ -74,9 +74,9 @@ func (pq *PlatformQuery) QueryCreator() *UserQuery {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(entplatform.Table, entplatform.FieldID, selector),
sqlgraph.From(platform.Table, platform.FieldID, selector),
sqlgraph.To(user.Table, user.FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, entplatform.CreatorTable, entplatform.CreatorColumn),
sqlgraph.Edge(sqlgraph.M2O, false, platform.CreatorTable, platform.CreatorColumn),
)
fromU = sqlgraph.SetNeighbors(pq.driver.Dialect(), step)
return fromU, nil
@@ -96,9 +96,9 @@ func (pq *PlatformQuery) QueryOrganization() *OrganizationQuery {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(entplatform.Table, entplatform.FieldID, selector),
sqlgraph.From(platform.Table, platform.FieldID, selector),
sqlgraph.To(organization.Table, organization.FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, entplatform.OrganizationTable, entplatform.OrganizationColumn),
sqlgraph.Edge(sqlgraph.M2O, false, platform.OrganizationTable, platform.OrganizationColumn),
)
fromU = sqlgraph.SetNeighbors(pq.driver.Dialect(), step)
return fromU, nil
@@ -114,7 +114,7 @@ func (pq *PlatformQuery) First(ctx context.Context) (*Platform, error) {
return nil, err
}
if len(nodes) == 0 {
return nil, &NotFoundError{entplatform.Label}
return nil, &NotFoundError{platform.Label}
}
return nodes[0], nil
}
@@ -136,7 +136,7 @@ func (pq *PlatformQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
return
}
if len(ids) == 0 {
err = &NotFoundError{entplatform.Label}
err = &NotFoundError{platform.Label}
return
}
return ids[0], nil
@@ -163,9 +163,9 @@ func (pq *PlatformQuery) Only(ctx context.Context) (*Platform, error) {
case 1:
return nodes[0], nil
case 0:
return nil, &NotFoundError{entplatform.Label}
return nil, &NotFoundError{platform.Label}
default:
return nil, &NotSingularError{entplatform.Label}
return nil, &NotSingularError{platform.Label}
}
}
@@ -190,9 +190,9 @@ func (pq *PlatformQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
case 1:
id = ids[0]
case 0:
err = &NotFoundError{entplatform.Label}
err = &NotFoundError{platform.Label}
default:
err = &NotSingularError{entplatform.Label}
err = &NotSingularError{platform.Label}
}
return
}
@@ -231,7 +231,7 @@ func (pq *PlatformQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
pq.Unique(true)
}
ctx = setContextOp(ctx, pq.ctx, "IDs")
if err = pq.Select(entplatform.FieldID).Scan(ctx, &ids); err != nil {
if err = pq.Select(platform.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
@@ -295,7 +295,7 @@ func (pq *PlatformQuery) Clone() *PlatformQuery {
return &PlatformQuery{
config: pq.config,
ctx: pq.ctx.Clone(),
order: append([]entplatform.OrderOption{}, pq.order...),
order: append([]platform.OrderOption{}, pq.order...),
inters: append([]Interceptor{}, pq.inters...),
predicates: append([]predicate.Platform{}, pq.predicates...),
withCreator: pq.withCreator.Clone(),
@@ -339,14 +339,14 @@ func (pq *PlatformQuery) WithOrganization(opts ...func(*OrganizationQuery)) *Pla
// }
//
// client.Platform.Query().
// GroupBy(entplatform.FieldCreatedAt).
// GroupBy(platform.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
func (pq *PlatformQuery) GroupBy(field string, fields ...string) *PlatformGroupBy {
pq.ctx.Fields = append([]string{field}, fields...)
grbuild := &PlatformGroupBy{build: pq}
grbuild.flds = &pq.ctx.Fields
grbuild.label = entplatform.Label
grbuild.label = platform.Label
grbuild.scan = grbuild.Scan
return grbuild
}
@@ -361,12 +361,12 @@ func (pq *PlatformQuery) GroupBy(field string, fields ...string) *PlatformGroupB
// }
//
// client.Platform.Query().
// Select(entplatform.FieldCreatedAt).
// Select(platform.FieldCreatedAt).
// Scan(ctx, &v)
func (pq *PlatformQuery) Select(fields ...string) *PlatformSelect {
pq.ctx.Fields = append(pq.ctx.Fields, fields...)
sbuild := &PlatformSelect{PlatformQuery: pq}
sbuild.label = entplatform.Label
sbuild.label = platform.Label
sbuild.flds, sbuild.scan = &pq.ctx.Fields, sbuild.Scan
return sbuild
}
@@ -388,7 +388,7 @@ func (pq *PlatformQuery) prepareQuery(ctx context.Context) error {
}
}
for _, f := range pq.ctx.Fields {
if !entplatform.ValidColumn(f) {
if !platform.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
@@ -513,7 +513,7 @@ func (pq *PlatformQuery) sqlCount(ctx context.Context) (int, error) {
}
func (pq *PlatformQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(entplatform.Table, entplatform.Columns, sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID))
_spec := sqlgraph.NewQuerySpec(platform.Table, platform.Columns, sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID))
_spec.From = pq.sql
if unique := pq.ctx.Unique; unique != nil {
_spec.Unique = *unique
@@ -522,17 +522,17 @@ func (pq *PlatformQuery) querySpec() *sqlgraph.QuerySpec {
}
if fields := pq.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, entplatform.FieldID)
_spec.Node.Columns = append(_spec.Node.Columns, platform.FieldID)
for i := range fields {
if fields[i] != entplatform.FieldID {
if fields[i] != platform.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
}
}
if pq.withCreator != nil {
_spec.Node.AddColumnOnce(entplatform.FieldCreatorID)
_spec.Node.AddColumnOnce(platform.FieldCreatorID)
}
if pq.withOrganization != nil {
_spec.Node.AddColumnOnce(entplatform.FieldOrgID)
_spec.Node.AddColumnOnce(platform.FieldOrgID)
}
}
if ps := pq.predicates; len(ps) > 0 {
@@ -560,10 +560,10 @@ func (pq *PlatformQuery) querySpec() *sqlgraph.QuerySpec {
func (pq *PlatformQuery) sqlQuery(ctx context.Context) *sql.Selector {
builder := sql.Dialect(pq.driver.Dialect())
t1 := builder.Table(entplatform.Table)
t1 := builder.Table(platform.Table)
columns := pq.ctx.Fields
if len(columns) == 0 {
columns = entplatform.Columns
columns = platform.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
if pq.sql != nil {

View File

@@ -13,10 +13,10 @@ import (
"entgo.io/ent/schema/field"
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/predicate"
"github.com/holos-run/holos/internal/ent/user"
platform "github.com/holos-run/holos/service/gen/holos/platform/v1alpha1"
holos "github.com/holos-run/holos/service/gen/holos/v1alpha1"
)
// PlatformUpdate is the builder for updating Platform entities.
@@ -95,8 +95,8 @@ func (pu *PlatformUpdate) SetNillableCreatorID(u *uuid.UUID) *PlatformUpdate {
}
// SetForm sets the "form" field.
func (pu *PlatformUpdate) SetForm(pl *platform.Form) *PlatformUpdate {
pu.mutation.SetForm(pl)
func (pu *PlatformUpdate) SetForm(h *holos.Form) *PlatformUpdate {
pu.mutation.SetForm(h)
return pu
}
@@ -107,8 +107,8 @@ func (pu *PlatformUpdate) ClearForm() *PlatformUpdate {
}
// SetModel sets the "model" field.
func (pu *PlatformUpdate) SetModel(pl *platform.Model) *PlatformUpdate {
pu.mutation.SetModel(pl)
func (pu *PlatformUpdate) SetModel(h *holos.Model) *PlatformUpdate {
pu.mutation.SetModel(h)
return pu
}
@@ -214,7 +214,7 @@ func (pu *PlatformUpdate) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save.
func (pu *PlatformUpdate) defaults() {
if _, ok := pu.mutation.UpdatedAt(); !ok {
v := entplatform.UpdateDefaultUpdatedAt()
v := platform.UpdateDefaultUpdatedAt()
pu.mutation.SetUpdatedAt(v)
}
}
@@ -222,7 +222,7 @@ func (pu *PlatformUpdate) defaults() {
// check runs all checks and user-defined validators on the builder.
func (pu *PlatformUpdate) check() error {
if v, ok := pu.mutation.Name(); ok {
if err := entplatform.NameValidator(v); err != nil {
if err := platform.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Platform.name": %w`, err)}
}
}
@@ -239,7 +239,7 @@ func (pu *PlatformUpdate) sqlSave(ctx context.Context) (n int, err error) {
if err := pu.check(); err != nil {
return n, err
}
_spec := sqlgraph.NewUpdateSpec(entplatform.Table, entplatform.Columns, sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID))
_spec := sqlgraph.NewUpdateSpec(platform.Table, platform.Columns, sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID))
if ps := pu.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
@@ -248,44 +248,44 @@ func (pu *PlatformUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
}
if value, ok := pu.mutation.UpdatedAt(); ok {
_spec.SetField(entplatform.FieldUpdatedAt, field.TypeTime, value)
_spec.SetField(platform.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := pu.mutation.Name(); ok {
_spec.SetField(entplatform.FieldName, field.TypeString, value)
_spec.SetField(platform.FieldName, field.TypeString, value)
}
if value, ok := pu.mutation.DisplayName(); ok {
_spec.SetField(entplatform.FieldDisplayName, field.TypeString, value)
_spec.SetField(platform.FieldDisplayName, field.TypeString, value)
}
if value, ok := pu.mutation.Form(); ok {
_spec.SetField(entplatform.FieldForm, field.TypeJSON, value)
_spec.SetField(platform.FieldForm, field.TypeJSON, value)
}
if pu.mutation.FormCleared() {
_spec.ClearField(entplatform.FieldForm, field.TypeJSON)
_spec.ClearField(platform.FieldForm, field.TypeJSON)
}
if value, ok := pu.mutation.Model(); ok {
_spec.SetField(entplatform.FieldModel, field.TypeJSON, value)
_spec.SetField(platform.FieldModel, field.TypeJSON, value)
}
if pu.mutation.ModelCleared() {
_spec.ClearField(entplatform.FieldModel, field.TypeJSON)
_spec.ClearField(platform.FieldModel, field.TypeJSON)
}
if value, ok := pu.mutation.Cue(); ok {
_spec.SetField(entplatform.FieldCue, field.TypeBytes, value)
_spec.SetField(platform.FieldCue, field.TypeBytes, value)
}
if pu.mutation.CueCleared() {
_spec.ClearField(entplatform.FieldCue, field.TypeBytes)
_spec.ClearField(platform.FieldCue, field.TypeBytes)
}
if value, ok := pu.mutation.CueDefinition(); ok {
_spec.SetField(entplatform.FieldCueDefinition, field.TypeString, value)
_spec.SetField(platform.FieldCueDefinition, field.TypeString, value)
}
if pu.mutation.CueDefinitionCleared() {
_spec.ClearField(entplatform.FieldCueDefinition, field.TypeString)
_spec.ClearField(platform.FieldCueDefinition, field.TypeString)
}
if pu.mutation.CreatorCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.CreatorTable,
Columns: []string{entplatform.CreatorColumn},
Table: platform.CreatorTable,
Columns: []string{platform.CreatorColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
@@ -297,8 +297,8 @@ func (pu *PlatformUpdate) sqlSave(ctx context.Context) (n int, err error) {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.CreatorTable,
Columns: []string{entplatform.CreatorColumn},
Table: platform.CreatorTable,
Columns: []string{platform.CreatorColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
@@ -313,8 +313,8 @@ func (pu *PlatformUpdate) sqlSave(ctx context.Context) (n int, err error) {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.OrganizationTable,
Columns: []string{entplatform.OrganizationColumn},
Table: platform.OrganizationTable,
Columns: []string{platform.OrganizationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(organization.FieldID, field.TypeUUID),
@@ -326,8 +326,8 @@ func (pu *PlatformUpdate) sqlSave(ctx context.Context) (n int, err error) {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.OrganizationTable,
Columns: []string{entplatform.OrganizationColumn},
Table: platform.OrganizationTable,
Columns: []string{platform.OrganizationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(organization.FieldID, field.TypeUUID),
@@ -340,7 +340,7 @@ func (pu *PlatformUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
if n, err = sqlgraph.UpdateNodes(ctx, pu.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{entplatform.Label}
err = &NotFoundError{platform.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -421,8 +421,8 @@ func (puo *PlatformUpdateOne) SetNillableCreatorID(u *uuid.UUID) *PlatformUpdate
}
// SetForm sets the "form" field.
func (puo *PlatformUpdateOne) SetForm(pl *platform.Form) *PlatformUpdateOne {
puo.mutation.SetForm(pl)
func (puo *PlatformUpdateOne) SetForm(h *holos.Form) *PlatformUpdateOne {
puo.mutation.SetForm(h)
return puo
}
@@ -433,8 +433,8 @@ func (puo *PlatformUpdateOne) ClearForm() *PlatformUpdateOne {
}
// SetModel sets the "model" field.
func (puo *PlatformUpdateOne) SetModel(pl *platform.Model) *PlatformUpdateOne {
puo.mutation.SetModel(pl)
func (puo *PlatformUpdateOne) SetModel(h *holos.Model) *PlatformUpdateOne {
puo.mutation.SetModel(h)
return puo
}
@@ -553,7 +553,7 @@ func (puo *PlatformUpdateOne) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save.
func (puo *PlatformUpdateOne) defaults() {
if _, ok := puo.mutation.UpdatedAt(); !ok {
v := entplatform.UpdateDefaultUpdatedAt()
v := platform.UpdateDefaultUpdatedAt()
puo.mutation.SetUpdatedAt(v)
}
}
@@ -561,7 +561,7 @@ func (puo *PlatformUpdateOne) defaults() {
// check runs all checks and user-defined validators on the builder.
func (puo *PlatformUpdateOne) check() error {
if v, ok := puo.mutation.Name(); ok {
if err := entplatform.NameValidator(v); err != nil {
if err := platform.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Platform.name": %w`, err)}
}
}
@@ -578,7 +578,7 @@ func (puo *PlatformUpdateOne) sqlSave(ctx context.Context) (_node *Platform, err
if err := puo.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(entplatform.Table, entplatform.Columns, sqlgraph.NewFieldSpec(entplatform.FieldID, field.TypeUUID))
_spec := sqlgraph.NewUpdateSpec(platform.Table, platform.Columns, sqlgraph.NewFieldSpec(platform.FieldID, field.TypeUUID))
id, ok := puo.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Platform.id" for update`)}
@@ -586,12 +586,12 @@ func (puo *PlatformUpdateOne) sqlSave(ctx context.Context) (_node *Platform, err
_spec.Node.ID.Value = id
if fields := puo.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, entplatform.FieldID)
_spec.Node.Columns = append(_spec.Node.Columns, platform.FieldID)
for _, f := range fields {
if !entplatform.ValidColumn(f) {
if !platform.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != entplatform.FieldID {
if f != platform.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
@@ -604,44 +604,44 @@ func (puo *PlatformUpdateOne) sqlSave(ctx context.Context) (_node *Platform, err
}
}
if value, ok := puo.mutation.UpdatedAt(); ok {
_spec.SetField(entplatform.FieldUpdatedAt, field.TypeTime, value)
_spec.SetField(platform.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := puo.mutation.Name(); ok {
_spec.SetField(entplatform.FieldName, field.TypeString, value)
_spec.SetField(platform.FieldName, field.TypeString, value)
}
if value, ok := puo.mutation.DisplayName(); ok {
_spec.SetField(entplatform.FieldDisplayName, field.TypeString, value)
_spec.SetField(platform.FieldDisplayName, field.TypeString, value)
}
if value, ok := puo.mutation.Form(); ok {
_spec.SetField(entplatform.FieldForm, field.TypeJSON, value)
_spec.SetField(platform.FieldForm, field.TypeJSON, value)
}
if puo.mutation.FormCleared() {
_spec.ClearField(entplatform.FieldForm, field.TypeJSON)
_spec.ClearField(platform.FieldForm, field.TypeJSON)
}
if value, ok := puo.mutation.Model(); ok {
_spec.SetField(entplatform.FieldModel, field.TypeJSON, value)
_spec.SetField(platform.FieldModel, field.TypeJSON, value)
}
if puo.mutation.ModelCleared() {
_spec.ClearField(entplatform.FieldModel, field.TypeJSON)
_spec.ClearField(platform.FieldModel, field.TypeJSON)
}
if value, ok := puo.mutation.Cue(); ok {
_spec.SetField(entplatform.FieldCue, field.TypeBytes, value)
_spec.SetField(platform.FieldCue, field.TypeBytes, value)
}
if puo.mutation.CueCleared() {
_spec.ClearField(entplatform.FieldCue, field.TypeBytes)
_spec.ClearField(platform.FieldCue, field.TypeBytes)
}
if value, ok := puo.mutation.CueDefinition(); ok {
_spec.SetField(entplatform.FieldCueDefinition, field.TypeString, value)
_spec.SetField(platform.FieldCueDefinition, field.TypeString, value)
}
if puo.mutation.CueDefinitionCleared() {
_spec.ClearField(entplatform.FieldCueDefinition, field.TypeString)
_spec.ClearField(platform.FieldCueDefinition, field.TypeString)
}
if puo.mutation.CreatorCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.CreatorTable,
Columns: []string{entplatform.CreatorColumn},
Table: platform.CreatorTable,
Columns: []string{platform.CreatorColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
@@ -653,8 +653,8 @@ func (puo *PlatformUpdateOne) sqlSave(ctx context.Context) (_node *Platform, err
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.CreatorTable,
Columns: []string{entplatform.CreatorColumn},
Table: platform.CreatorTable,
Columns: []string{platform.CreatorColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
@@ -669,8 +669,8 @@ func (puo *PlatformUpdateOne) sqlSave(ctx context.Context) (_node *Platform, err
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.OrganizationTable,
Columns: []string{entplatform.OrganizationColumn},
Table: platform.OrganizationTable,
Columns: []string{platform.OrganizationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(organization.FieldID, field.TypeUUID),
@@ -682,8 +682,8 @@ func (puo *PlatformUpdateOne) sqlSave(ctx context.Context) (_node *Platform, err
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: entplatform.OrganizationTable,
Columns: []string{entplatform.OrganizationColumn},
Table: platform.OrganizationTable,
Columns: []string{platform.OrganizationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(organization.FieldID, field.TypeUUID),
@@ -699,7 +699,7 @@ func (puo *PlatformUpdateOne) sqlSave(ctx context.Context) (_node *Platform, err
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{entplatform.Label}
err = &NotFoundError{platform.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}

View File

@@ -9,7 +9,7 @@ import (
// Organization is the predicate function for organization builders.
type Organization func(*sql.Selector)
// Platform is the predicate function for entplatform builders.
// Platform is the predicate function for platform builders.
type Platform func(*sql.Selector)
// User is the predicate function for user builders.

View File

@@ -7,7 +7,7 @@ import (
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
entplatform "github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/schema"
"github.com/holos-run/holos/internal/ent/user"
)
@@ -41,31 +41,31 @@ func init() {
organizationDescID := organizationMixinFields0[0].Descriptor()
// organization.DefaultID holds the default value on creation for the id field.
organization.DefaultID = organizationDescID.Default.(func() uuid.UUID)
entplatformMixin := schema.Platform{}.Mixin()
entplatformMixinFields0 := entplatformMixin[0].Fields()
_ = entplatformMixinFields0
entplatformMixinFields1 := entplatformMixin[1].Fields()
_ = entplatformMixinFields1
entplatformFields := schema.Platform{}.Fields()
_ = entplatformFields
// entplatformDescCreatedAt is the schema descriptor for created_at field.
entplatformDescCreatedAt := entplatformMixinFields1[0].Descriptor()
// entplatform.DefaultCreatedAt holds the default value on creation for the created_at field.
entplatform.DefaultCreatedAt = entplatformDescCreatedAt.Default.(func() time.Time)
// entplatformDescUpdatedAt is the schema descriptor for updated_at field.
entplatformDescUpdatedAt := entplatformMixinFields1[1].Descriptor()
// entplatform.DefaultUpdatedAt holds the default value on creation for the updated_at field.
entplatform.DefaultUpdatedAt = entplatformDescUpdatedAt.Default.(func() time.Time)
// entplatform.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
entplatform.UpdateDefaultUpdatedAt = entplatformDescUpdatedAt.UpdateDefault.(func() time.Time)
// entplatformDescName is the schema descriptor for name field.
entplatformDescName := entplatformFields[1].Descriptor()
// entplatform.NameValidator is a validator for the "name" field. It is called by the builders before save.
entplatform.NameValidator = entplatformDescName.Validators[0].(func(string) error)
// entplatformDescID is the schema descriptor for id field.
entplatformDescID := entplatformMixinFields0[0].Descriptor()
// entplatform.DefaultID holds the default value on creation for the id field.
entplatform.DefaultID = entplatformDescID.Default.(func() uuid.UUID)
platformMixin := schema.Platform{}.Mixin()
platformMixinFields0 := platformMixin[0].Fields()
_ = platformMixinFields0
platformMixinFields1 := platformMixin[1].Fields()
_ = platformMixinFields1
platformFields := schema.Platform{}.Fields()
_ = platformFields
// platformDescCreatedAt is the schema descriptor for created_at field.
platformDescCreatedAt := platformMixinFields1[0].Descriptor()
// platform.DefaultCreatedAt holds the default value on creation for the created_at field.
platform.DefaultCreatedAt = platformDescCreatedAt.Default.(func() time.Time)
// platformDescUpdatedAt is the schema descriptor for updated_at field.
platformDescUpdatedAt := platformMixinFields1[1].Descriptor()
// platform.DefaultUpdatedAt holds the default value on creation for the updated_at field.
platform.DefaultUpdatedAt = platformDescUpdatedAt.Default.(func() time.Time)
// platform.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
platform.UpdateDefaultUpdatedAt = platformDescUpdatedAt.UpdateDefault.(func() time.Time)
// platformDescName is the schema descriptor for name field.
platformDescName := platformFields[1].Descriptor()
// platform.NameValidator is a validator for the "name" field. It is called by the builders before save.
platform.NameValidator = platformDescName.Validators[0].(func(string) error)
// platformDescID is the schema descriptor for id field.
platformDescID := platformMixinFields0[0].Descriptor()
// platform.DefaultID holds the default value on creation for the id field.
platform.DefaultID = platformDescID.Default.(func() uuid.UUID)
userMixin := schema.User{}.Mixin()
userMixinFields0 := userMixin[0].Fields()
_ = userMixinFields0

View File

@@ -6,7 +6,7 @@ import (
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
"github.com/gofrs/uuid"
platform "github.com/holos-run/holos/service/gen/holos/platform/v1alpha1"
holos "github.com/holos-run/holos/service/gen/holos/v1alpha1"
)
type Platform struct {
@@ -26,10 +26,10 @@ func (Platform) Fields() []ent.Field {
field.String("name").NotEmpty(),
field.String("display_name"),
field.UUID("creator_id", uuid.UUID{}),
field.JSON("form", &platform.Form{}).
field.JSON("form", &holos.Form{}).
Optional().
Comment("JSON representation of FormlyFormConfig[] refer to https://github.com/holos-run/holos/issues/161"),
field.JSON("model", &platform.Model{}).
field.JSON("model", &holos.Model{}).
Optional().
Comment("JSON representation of the form model which holds user input values refer to https://github.com/holos-run/holos/issues/161"),
field.Bytes("cue").

View File

@@ -0,0 +1,47 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended",
"plugin:@angular-eslint/template/accessibility"
],
"rules": {}
}
]
}

View File

@@ -40,3 +40,6 @@ testem.log
# System files
.DS_Store
Thumbs.db
# NX?
/.nx/

View File

@@ -100,8 +100,22 @@
],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
},
"cli": {
"schematicCollections": [
"@angular-eslint/schematics"
]
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,8 @@
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
"test": "ng test",
"lint": "ng lint"
},
"private": true,
"dependencies": {
@@ -32,6 +33,11 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.3.4",
"@angular-eslint/builder": "17.3.0",
"@angular-eslint/eslint-plugin": "17.3.0",
"@angular-eslint/eslint-plugin-template": "17.3.0",
"@angular-eslint/schematics": "17.3.0",
"@angular-eslint/template-parser": "17.3.0",
"@angular/cli": "^17.3.4",
"@angular/compiler-cli": "^17.3.0",
"@bufbuild/buf": "^1.31.0",
@@ -40,6 +46,9 @@
"@connectrpc/protoc-gen-connect-query": "^1.3.1",
"@ngx-formly/schematics": "^6.3.0",
"@types/jasmine": "~5.1.0",
"@typescript-eslint/eslint-plugin": "7.2.0",
"@typescript-eslint/parser": "7.2.0",
"eslint": "^8.57.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
@@ -48,4 +57,4 @@
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.4.2"
}
}
}

View File

@@ -1,105 +0,0 @@
// @generated by protoc-gen-connect-query v1.3.1 with parameter "target=ts"
// @generated from file holos/platform/v1alpha1/platform.proto (package holos.platform.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { MethodKind } from "@bufbuild/protobuf";
import { AddPlatformRequest, AddPlatformResponse, GetFormRequest, GetFormResponse, GetModelRequest, GetModelResponse, GetPlatformRequest, GetPlatformResponse, ListPlatformsRequest, ListPlatformsResponse, PutFormRequest, PutFormResponse, PutModelRequest, PutModelResponse } from "./platform_pb.js";
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.AddPlatform
*/
export const addPlatform = {
localName: "addPlatform",
name: "AddPlatform",
kind: MethodKind.Unary,
I: AddPlatformRequest,
O: AddPlatformResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetPlatform
*/
export const getPlatform = {
localName: "getPlatform",
name: "GetPlatform",
kind: MethodKind.Unary,
I: GetPlatformRequest,
O: GetPlatformResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.ListPlatforms
*/
export const listPlatforms = {
localName: "listPlatforms",
name: "ListPlatforms",
kind: MethodKind.Unary,
I: ListPlatformsRequest,
O: ListPlatformsResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetForm
*/
export const getForm = {
localName: "getForm",
name: "GetForm",
kind: MethodKind.Unary,
I: GetFormRequest,
O: GetFormResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.PutForm
*/
export const putForm = {
localName: "putForm",
name: "PutForm",
kind: MethodKind.Unary,
I: PutFormRequest,
O: PutFormResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetModel
*/
export const getModel = {
localName: "getModel",
name: "GetModel",
kind: MethodKind.Unary,
I: GetModelRequest,
O: GetModelResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.PutModel
*/
export const putModel = {
localName: "putModel",
name: "PutModel",
kind: MethodKind.Unary,
I: PutModelRequest,
O: PutModelResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;

View File

@@ -1,80 +0,0 @@
// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"
// @generated from file holos/platform/v1alpha1/platform.proto (package holos.platform.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { AddPlatformRequest, AddPlatformResponse, GetFormRequest, GetFormResponse, GetModelRequest, GetModelResponse, GetPlatformRequest, GetPlatformResponse, ListPlatformsRequest, ListPlatformsResponse, PutFormRequest, PutFormResponse, PutModelRequest, PutModelResponse } from "./platform_pb.js";
import { MethodKind } from "@bufbuild/protobuf";
/**
* @generated from service holos.platform.v1alpha1.PlatformService
*/
export const PlatformService = {
typeName: "holos.platform.v1alpha1.PlatformService",
methods: {
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.AddPlatform
*/
addPlatform: {
name: "AddPlatform",
I: AddPlatformRequest,
O: AddPlatformResponse,
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetPlatform
*/
getPlatform: {
name: "GetPlatform",
I: GetPlatformRequest,
O: GetPlatformResponse,
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.ListPlatforms
*/
listPlatforms: {
name: "ListPlatforms",
I: ListPlatformsRequest,
O: ListPlatformsResponse,
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetForm
*/
getForm: {
name: "GetForm",
I: GetFormRequest,
O: GetFormResponse,
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.PutForm
*/
putForm: {
name: "PutForm",
I: PutFormRequest,
O: PutFormResponse,
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetModel
*/
getModel: {
name: "GetModel",
I: GetModelRequest,
O: GetModelResponse,
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.PutModel
*/
putModel: {
name: "PutModel",
I: PutModelRequest,
O: PutModelResponse,
kind: MethodKind.Unary,
},
}
} as const;

View File

@@ -1,732 +0,0 @@
// @generated by protoc-gen-es v1.9.0 with parameter "target=ts"
// @generated from file holos/platform/v1alpha1/platform.proto (package holos.platform.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3, Struct } from "@bufbuild/protobuf";
/**
* @generated from message holos.platform.v1alpha1.Platform
*/
export class Platform extends Message<Platform> {
/**
* Unique id assigned by the server.
*
* @generated from field: string id = 1;
*/
id = "";
/**
* Organization ID resource owner.
*
* @generated from field: string org_id = 2;
*/
orgId = "";
/**
* name is the platform short name as a dns label.
*
* @generated from field: string name = 3;
*/
name = "";
/**
* @generated from field: string display_name = 4;
*/
displayName = "";
/**
* @generated from field: holos.platform.v1alpha1.PlatformSpec spec = 5;
*/
spec?: PlatformSpec;
constructor(data?: PartialMessage<Platform>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.Platform";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "org_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 4, name: "display_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 5, name: "spec", kind: "message", T: PlatformSpec },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Platform {
return new Platform().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Platform {
return new Platform().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Platform {
return new Platform().fromJsonString(jsonString, options);
}
static equals(a: Platform | PlainMessage<Platform> | undefined, b: Platform | PlainMessage<Platform> | undefined): boolean {
return proto3.util.equals(Platform, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.PlatformSpec
*/
export class PlatformSpec extends Message<PlatformSpec> {
/**
* model represents the user-defined and user-supplied form field values.
*
* @generated from field: google.protobuf.Struct model = 1;
*/
model?: Struct;
constructor(data?: PartialMessage<PlatformSpec>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.PlatformSpec";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "model", kind: "message", T: Struct },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PlatformSpec {
return new PlatformSpec().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PlatformSpec {
return new PlatformSpec().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PlatformSpec {
return new PlatformSpec().fromJsonString(jsonString, options);
}
static equals(a: PlatformSpec | PlainMessage<PlatformSpec> | undefined, b: PlatformSpec | PlainMessage<PlatformSpec> | undefined): boolean {
return proto3.util.equals(PlatformSpec, a, b);
}
}
/**
* Form represents the Formly input form.
*
* @generated from message holos.platform.v1alpha1.Form
*/
export class Form extends Message<Form> {
/**
* fields represents FormlyFieldConfig[] encoded as a JSON array.
*
* @generated from field: repeated google.protobuf.Struct fields = 1;
*/
fields: Struct[] = [];
constructor(data?: PartialMessage<Form>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.Form";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "fields", kind: "message", T: Struct, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Form {
return new Form().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Form {
return new Form().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Form {
return new Form().fromJsonString(jsonString, options);
}
static equals(a: Form | PlainMessage<Form> | undefined, b: Form | PlainMessage<Form> | undefined): boolean {
return proto3.util.equals(Form, a, b);
}
}
/**
* Model represents the values entered into the form, stored in the form's model
* in the web app, and persisted into the backend database. The model is
* ultimately intended as the input to platform rendering.
*
* @generated from message holos.platform.v1alpha1.Model
*/
export class Model extends Message<Model> {
/**
* @generated from field: google.protobuf.Struct model = 1;
*/
model?: Struct;
constructor(data?: PartialMessage<Model>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.Model";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "model", kind: "message", T: Struct },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Model {
return new Model().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Model {
return new Model().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Model {
return new Model().fromJsonString(jsonString, options);
}
static equals(a: Model | PlainMessage<Model> | undefined, b: Model | PlainMessage<Model> | undefined): boolean {
return proto3.util.equals(Model, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.ListPlatformsRequest
*/
export class ListPlatformsRequest extends Message<ListPlatformsRequest> {
/**
* @generated from field: string org_id = 1;
*/
orgId = "";
constructor(data?: PartialMessage<ListPlatformsRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.ListPlatformsRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "org_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListPlatformsRequest {
return new ListPlatformsRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListPlatformsRequest {
return new ListPlatformsRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListPlatformsRequest {
return new ListPlatformsRequest().fromJsonString(jsonString, options);
}
static equals(a: ListPlatformsRequest | PlainMessage<ListPlatformsRequest> | undefined, b: ListPlatformsRequest | PlainMessage<ListPlatformsRequest> | undefined): boolean {
return proto3.util.equals(ListPlatformsRequest, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.ListPlatformsResponse
*/
export class ListPlatformsResponse extends Message<ListPlatformsResponse> {
/**
* @generated from field: repeated holos.platform.v1alpha1.Platform platforms = 1;
*/
platforms: Platform[] = [];
constructor(data?: PartialMessage<ListPlatformsResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.ListPlatformsResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platforms", kind: "message", T: Platform, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListPlatformsResponse {
return new ListPlatformsResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListPlatformsResponse {
return new ListPlatformsResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListPlatformsResponse {
return new ListPlatformsResponse().fromJsonString(jsonString, options);
}
static equals(a: ListPlatformsResponse | PlainMessage<ListPlatformsResponse> | undefined, b: ListPlatformsResponse | PlainMessage<ListPlatformsResponse> | undefined): boolean {
return proto3.util.equals(ListPlatformsResponse, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.AddPlatformRequest
*/
export class AddPlatformRequest extends Message<AddPlatformRequest> {
/**
* @generated from field: holos.platform.v1alpha1.Platform platform = 1;
*/
platform?: Platform;
constructor(data?: PartialMessage<AddPlatformRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.AddPlatformRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform", kind: "message", T: Platform },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AddPlatformRequest {
return new AddPlatformRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AddPlatformRequest {
return new AddPlatformRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AddPlatformRequest {
return new AddPlatformRequest().fromJsonString(jsonString, options);
}
static equals(a: AddPlatformRequest | PlainMessage<AddPlatformRequest> | undefined, b: AddPlatformRequest | PlainMessage<AddPlatformRequest> | undefined): boolean {
return proto3.util.equals(AddPlatformRequest, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.AddPlatformResponse
*/
export class AddPlatformResponse extends Message<AddPlatformResponse> {
/**
* @generated from field: repeated holos.platform.v1alpha1.Platform platforms = 1;
*/
platforms: Platform[] = [];
constructor(data?: PartialMessage<AddPlatformResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.AddPlatformResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platforms", kind: "message", T: Platform, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AddPlatformResponse {
return new AddPlatformResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AddPlatformResponse {
return new AddPlatformResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AddPlatformResponse {
return new AddPlatformResponse().fromJsonString(jsonString, options);
}
static equals(a: AddPlatformResponse | PlainMessage<AddPlatformResponse> | undefined, b: AddPlatformResponse | PlainMessage<AddPlatformResponse> | undefined): boolean {
return proto3.util.equals(AddPlatformResponse, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.GetPlatformRequest
*/
export class GetPlatformRequest extends Message<GetPlatformRequest> {
/**
* @generated from field: string platform_id = 1;
*/
platformId = "";
constructor(data?: PartialMessage<GetPlatformRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetPlatformRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetPlatformRequest {
return new GetPlatformRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetPlatformRequest {
return new GetPlatformRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetPlatformRequest {
return new GetPlatformRequest().fromJsonString(jsonString, options);
}
static equals(a: GetPlatformRequest | PlainMessage<GetPlatformRequest> | undefined, b: GetPlatformRequest | PlainMessage<GetPlatformRequest> | undefined): boolean {
return proto3.util.equals(GetPlatformRequest, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.GetPlatformResponse
*/
export class GetPlatformResponse extends Message<GetPlatformResponse> {
/**
* @generated from field: holos.platform.v1alpha1.Platform platform = 1;
*/
platform?: Platform;
constructor(data?: PartialMessage<GetPlatformResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetPlatformResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform", kind: "message", T: Platform },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetPlatformResponse {
return new GetPlatformResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetPlatformResponse {
return new GetPlatformResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetPlatformResponse {
return new GetPlatformResponse().fromJsonString(jsonString, options);
}
static equals(a: GetPlatformResponse | PlainMessage<GetPlatformResponse> | undefined, b: GetPlatformResponse | PlainMessage<GetPlatformResponse> | undefined): boolean {
return proto3.util.equals(GetPlatformResponse, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.GetFormRequest
*/
export class GetFormRequest extends Message<GetFormRequest> {
/**
* @generated from field: string platform_id = 1;
*/
platformId = "";
constructor(data?: PartialMessage<GetFormRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetFormRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetFormRequest {
return new GetFormRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetFormRequest {
return new GetFormRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetFormRequest {
return new GetFormRequest().fromJsonString(jsonString, options);
}
static equals(a: GetFormRequest | PlainMessage<GetFormRequest> | undefined, b: GetFormRequest | PlainMessage<GetFormRequest> | undefined): boolean {
return proto3.util.equals(GetFormRequest, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.GetFormResponse
*/
export class GetFormResponse extends Message<GetFormResponse> {
/**
* @generated from field: repeated google.protobuf.Struct fields = 1;
*/
fields: Struct[] = [];
/**
* @generated from field: google.protobuf.Struct model = 2;
*/
model?: Struct;
constructor(data?: PartialMessage<GetFormResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetFormResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "fields", kind: "message", T: Struct, repeated: true },
{ no: 2, name: "model", kind: "message", T: Struct },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetFormResponse {
return new GetFormResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetFormResponse {
return new GetFormResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetFormResponse {
return new GetFormResponse().fromJsonString(jsonString, options);
}
static equals(a: GetFormResponse | PlainMessage<GetFormResponse> | undefined, b: GetFormResponse | PlainMessage<GetFormResponse> | undefined): boolean {
return proto3.util.equals(GetFormResponse, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.GetModelRequest
*/
export class GetModelRequest extends Message<GetModelRequest> {
/**
* @generated from field: string platform_id = 1;
*/
platformId = "";
constructor(data?: PartialMessage<GetModelRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetModelRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetModelRequest {
return new GetModelRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetModelRequest {
return new GetModelRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetModelRequest {
return new GetModelRequest().fromJsonString(jsonString, options);
}
static equals(a: GetModelRequest | PlainMessage<GetModelRequest> | undefined, b: GetModelRequest | PlainMessage<GetModelRequest> | undefined): boolean {
return proto3.util.equals(GetModelRequest, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.GetModelResponse
*/
export class GetModelResponse extends Message<GetModelResponse> {
/**
* @generated from field: google.protobuf.Struct model = 1;
*/
model?: Struct;
constructor(data?: PartialMessage<GetModelResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetModelResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "model", kind: "message", T: Struct },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetModelResponse {
return new GetModelResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetModelResponse {
return new GetModelResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetModelResponse {
return new GetModelResponse().fromJsonString(jsonString, options);
}
static equals(a: GetModelResponse | PlainMessage<GetModelResponse> | undefined, b: GetModelResponse | PlainMessage<GetModelResponse> | undefined): boolean {
return proto3.util.equals(GetModelResponse, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.PutModelRequest
*/
export class PutModelRequest extends Message<PutModelRequest> {
/**
* @generated from field: string platform_id = 1;
*/
platformId = "";
/**
* @generated from field: google.protobuf.Struct model = 2;
*/
model?: Struct;
constructor(data?: PartialMessage<PutModelRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.PutModelRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "model", kind: "message", T: Struct },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PutModelRequest {
return new PutModelRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PutModelRequest {
return new PutModelRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PutModelRequest {
return new PutModelRequest().fromJsonString(jsonString, options);
}
static equals(a: PutModelRequest | PlainMessage<PutModelRequest> | undefined, b: PutModelRequest | PlainMessage<PutModelRequest> | undefined): boolean {
return proto3.util.equals(PutModelRequest, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.PutModelResponse
*/
export class PutModelResponse extends Message<PutModelResponse> {
/**
* @generated from field: google.protobuf.Struct model = 1;
*/
model?: Struct;
constructor(data?: PartialMessage<PutModelResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.PutModelResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "model", kind: "message", T: Struct },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PutModelResponse {
return new PutModelResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PutModelResponse {
return new PutModelResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PutModelResponse {
return new PutModelResponse().fromJsonString(jsonString, options);
}
static equals(a: PutModelResponse | PlainMessage<PutModelResponse> | undefined, b: PutModelResponse | PlainMessage<PutModelResponse> | undefined): boolean {
return proto3.util.equals(PutModelResponse, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.PutFormRequest
*/
export class PutFormRequest extends Message<PutFormRequest> {
/**
* @generated from field: string platform_id = 1;
*/
platformId = "";
/**
* @generated from field: repeated google.protobuf.Struct fields = 2;
*/
fields: Struct[] = [];
constructor(data?: PartialMessage<PutFormRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.PutFormRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "fields", kind: "message", T: Struct, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PutFormRequest {
return new PutFormRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PutFormRequest {
return new PutFormRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PutFormRequest {
return new PutFormRequest().fromJsonString(jsonString, options);
}
static equals(a: PutFormRequest | PlainMessage<PutFormRequest> | undefined, b: PutFormRequest | PlainMessage<PutFormRequest> | undefined): boolean {
return proto3.util.equals(PutFormRequest, a, b);
}
}
/**
* @generated from message holos.platform.v1alpha1.PutFormResponse
*/
export class PutFormResponse extends Message<PutFormResponse> {
/**
* @generated from field: repeated google.protobuf.Struct fields = 1;
*/
fields: Struct[] = [];
constructor(data?: PartialMessage<PutFormResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.PutFormResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "fields", kind: "message", T: Struct, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PutFormResponse {
return new PutFormResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PutFormResponse {
return new PutFormResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PutFormResponse {
return new PutFormResponse().fromJsonString(jsonString, options);
}
static equals(a: PutFormResponse | PlainMessage<PutFormResponse> | undefined, b: PutFormResponse | PlainMessage<PutFormResponse> | undefined): boolean {
return proto3.util.equals(PutFormResponse, a, b);
}
}

View File

@@ -1,35 +0,0 @@
// @generated by protoc-gen-connect-query v1.3.1 with parameter "target=ts"
// @generated from file holos/v1alpha1/organization.proto (package holos.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { MethodKind } from "@bufbuild/protobuf";
import { CreateCallerOrganizationRequest, GetCallerOrganizationsRequest, GetCallerOrganizationsResponse } from "./organization_pb.js";
/**
* @generated from rpc holos.v1alpha1.OrganizationService.GetCallerOrganizations
*/
export const getCallerOrganizations = {
localName: "getCallerOrganizations",
name: "GetCallerOrganizations",
kind: MethodKind.Unary,
I: GetCallerOrganizationsRequest,
O: GetCallerOrganizationsResponse,
service: {
typeName: "holos.v1alpha1.OrganizationService"
}
} as const;
/**
* @generated from rpc holos.v1alpha1.OrganizationService.CreateCallerOrganization
*/
export const createCallerOrganization = {
localName: "createCallerOrganization",
name: "CreateCallerOrganization",
kind: MethodKind.Unary,
I: CreateCallerOrganizationRequest,
O: GetCallerOrganizationsResponse,
service: {
typeName: "holos.v1alpha1.OrganizationService"
}
} as const;

View File

@@ -3,7 +3,7 @@
/* eslint-disable */
// @ts-nocheck
import { CreateCallerOrganizationRequest, GetCallerOrganizationsRequest, GetCallerOrganizationsResponse } from "./organization_pb.js";
import { CreateCallerOrganizationRequest, CreateCallerOrganizationResponse, ListCallerOrganizationsRequest, ListCallerOrganizationsResponse } from "./organization_pb.js";
import { MethodKind } from "@bufbuild/protobuf";
/**
@@ -13,12 +13,12 @@ export const OrganizationService = {
typeName: "holos.v1alpha1.OrganizationService",
methods: {
/**
* @generated from rpc holos.v1alpha1.OrganizationService.GetCallerOrganizations
* @generated from rpc holos.v1alpha1.OrganizationService.ListCallerOrganizations
*/
getCallerOrganizations: {
name: "GetCallerOrganizations",
I: GetCallerOrganizationsRequest,
O: GetCallerOrganizationsResponse,
listCallerOrganizations: {
name: "ListCallerOrganizations",
I: ListCallerOrganizationsRequest,
O: ListCallerOrganizationsResponse,
kind: MethodKind.Unary,
},
/**
@@ -27,7 +27,7 @@ export const OrganizationService = {
createCallerOrganization: {
name: "CreateCallerOrganization",
I: CreateCallerOrganizationRequest,
O: GetCallerOrganizationsResponse,
O: CreateCallerOrganizationResponse,
kind: MethodKind.Unary,
},
}

View File

@@ -72,40 +72,40 @@ export class Organization extends Message<Organization> {
}
/**
* @generated from message holos.v1alpha1.GetCallerOrganizationsRequest
* @generated from message holos.v1alpha1.ListCallerOrganizationsRequest
*/
export class GetCallerOrganizationsRequest extends Message<GetCallerOrganizationsRequest> {
constructor(data?: PartialMessage<GetCallerOrganizationsRequest>) {
export class ListCallerOrganizationsRequest extends Message<ListCallerOrganizationsRequest> {
constructor(data?: PartialMessage<ListCallerOrganizationsRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.GetCallerOrganizationsRequest";
static readonly typeName = "holos.v1alpha1.ListCallerOrganizationsRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetCallerOrganizationsRequest {
return new GetCallerOrganizationsRequest().fromBinary(bytes, options);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListCallerOrganizationsRequest {
return new ListCallerOrganizationsRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetCallerOrganizationsRequest {
return new GetCallerOrganizationsRequest().fromJson(jsonValue, options);
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListCallerOrganizationsRequest {
return new ListCallerOrganizationsRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetCallerOrganizationsRequest {
return new GetCallerOrganizationsRequest().fromJsonString(jsonString, options);
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListCallerOrganizationsRequest {
return new ListCallerOrganizationsRequest().fromJsonString(jsonString, options);
}
static equals(a: GetCallerOrganizationsRequest | PlainMessage<GetCallerOrganizationsRequest> | undefined, b: GetCallerOrganizationsRequest | PlainMessage<GetCallerOrganizationsRequest> | undefined): boolean {
return proto3.util.equals(GetCallerOrganizationsRequest, a, b);
static equals(a: ListCallerOrganizationsRequest | PlainMessage<ListCallerOrganizationsRequest> | undefined, b: ListCallerOrganizationsRequest | PlainMessage<ListCallerOrganizationsRequest> | undefined): boolean {
return proto3.util.equals(ListCallerOrganizationsRequest, a, b);
}
}
/**
* @generated from message holos.v1alpha1.GetCallerOrganizationsResponse
* @generated from message holos.v1alpha1.ListCallerOrganizationsResponse
*/
export class GetCallerOrganizationsResponse extends Message<GetCallerOrganizationsResponse> {
export class ListCallerOrganizationsResponse extends Message<ListCallerOrganizationsResponse> {
/**
* @generated from field: holos.v1alpha1.User user = 1;
*/
@@ -116,32 +116,32 @@ export class GetCallerOrganizationsResponse extends Message<GetCallerOrganizatio
*/
organizations: Organization[] = [];
constructor(data?: PartialMessage<GetCallerOrganizationsResponse>) {
constructor(data?: PartialMessage<ListCallerOrganizationsResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.GetCallerOrganizationsResponse";
static readonly typeName = "holos.v1alpha1.ListCallerOrganizationsResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "user", kind: "message", T: User },
{ no: 2, name: "organizations", kind: "message", T: Organization, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetCallerOrganizationsResponse {
return new GetCallerOrganizationsResponse().fromBinary(bytes, options);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListCallerOrganizationsResponse {
return new ListCallerOrganizationsResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetCallerOrganizationsResponse {
return new GetCallerOrganizationsResponse().fromJson(jsonValue, options);
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListCallerOrganizationsResponse {
return new ListCallerOrganizationsResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetCallerOrganizationsResponse {
return new GetCallerOrganizationsResponse().fromJsonString(jsonString, options);
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListCallerOrganizationsResponse {
return new ListCallerOrganizationsResponse().fromJsonString(jsonString, options);
}
static equals(a: GetCallerOrganizationsResponse | PlainMessage<GetCallerOrganizationsResponse> | undefined, b: GetCallerOrganizationsResponse | PlainMessage<GetCallerOrganizationsResponse> | undefined): boolean {
return proto3.util.equals(GetCallerOrganizationsResponse, a, b);
static equals(a: ListCallerOrganizationsResponse | PlainMessage<ListCallerOrganizationsResponse> | undefined, b: ListCallerOrganizationsResponse | PlainMessage<ListCallerOrganizationsResponse> | undefined): boolean {
return proto3.util.equals(ListCallerOrganizationsResponse, a, b);
}
}
@@ -176,3 +176,46 @@ export class CreateCallerOrganizationRequest extends Message<CreateCallerOrganiz
}
}
/**
* @generated from message holos.v1alpha1.CreateCallerOrganizationResponse
*/
export class CreateCallerOrganizationResponse extends Message<CreateCallerOrganizationResponse> {
/**
* @generated from field: holos.v1alpha1.User user = 1;
*/
user?: User;
/**
* @generated from field: repeated holos.v1alpha1.Organization organizations = 2;
*/
organizations: Organization[] = [];
constructor(data?: PartialMessage<CreateCallerOrganizationResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.CreateCallerOrganizationResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "user", kind: "message", T: User },
{ no: 2, name: "organizations", kind: "message", T: Organization, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateCallerOrganizationResponse {
return new CreateCallerOrganizationResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateCallerOrganizationResponse {
return new CreateCallerOrganizationResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateCallerOrganizationResponse {
return new CreateCallerOrganizationResponse().fromJsonString(jsonString, options);
}
static equals(a: CreateCallerOrganizationResponse | PlainMessage<CreateCallerOrganizationResponse> | undefined, b: CreateCallerOrganizationResponse | PlainMessage<CreateCallerOrganizationResponse> | undefined): boolean {
return proto3.util.equals(CreateCallerOrganizationResponse, a, b);
}
}

View File

@@ -1,91 +0,0 @@
// @generated by protoc-gen-connect-query v1.3.1 with parameter "target=ts"
// @generated from file holos/v1alpha1/platform.proto (package holos.platform.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { MethodKind } from "@bufbuild/protobuf";
import { AddPlatformRequest, AddPlatformResponse, GetFormRequest, GetFormResponse, GetModelRequest, GetModelResponse, GetPlatformRequest, GetPlatformResponse, ListPlatformsRequest, ListPlatformsResponse, PutModelRequest, PutModelResponse } from "./platform_pb.js";
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.AddPlatform
*/
export const addPlatform = {
localName: "addPlatform",
name: "AddPlatform",
kind: MethodKind.Unary,
I: AddPlatformRequest,
O: AddPlatformResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetPlatform
*/
export const getPlatform = {
localName: "getPlatform",
name: "GetPlatform",
kind: MethodKind.Unary,
I: GetPlatformRequest,
O: GetPlatformResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.ListPlatforms
*/
export const listPlatforms = {
localName: "listPlatforms",
name: "ListPlatforms",
kind: MethodKind.Unary,
I: ListPlatformsRequest,
O: ListPlatformsResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetForm
*/
export const getForm = {
localName: "getForm",
name: "GetForm",
kind: MethodKind.Unary,
I: GetFormRequest,
O: GetFormResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetModel
*/
export const getModel = {
localName: "getModel",
name: "GetModel",
kind: MethodKind.Unary,
I: GetModelRequest,
O: GetModelResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.PutModel
*/
export const putModel = {
localName: "putModel",
name: "PutModel",
kind: MethodKind.Unary,
I: PutModelRequest,
O: PutModelResponse,
service: {
typeName: "holos.platform.v1alpha1.PlatformService"
}
} as const;

View File

@@ -1,19 +1,19 @@
// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"
// @generated from file holos/v1alpha1/platform.proto (package holos.platform.v1alpha1, syntax proto3)
// @generated from file holos/v1alpha1/platform.proto (package holos.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { AddPlatformRequest, AddPlatformResponse, GetFormRequest, GetFormResponse, GetModelRequest, GetModelResponse, GetPlatformRequest, GetPlatformResponse, ListPlatformsRequest, ListPlatformsResponse, PutModelRequest, PutModelResponse } from "./platform_pb.js";
import { AddPlatformRequest, AddPlatformResponse, GetFormRequest, GetFormResponse, GetModelRequest, GetModelResponse, GetPlatformRequest, GetPlatformResponse, ListPlatformsRequest, ListPlatformsResponse, PutFormRequest, PutFormResponse, PutModelRequest, PutModelResponse } from "./platform_pb.js";
import { MethodKind } from "@bufbuild/protobuf";
/**
* @generated from service holos.platform.v1alpha1.PlatformService
* @generated from service holos.v1alpha1.PlatformService
*/
export const PlatformService = {
typeName: "holos.platform.v1alpha1.PlatformService",
typeName: "holos.v1alpha1.PlatformService",
methods: {
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.AddPlatform
* @generated from rpc holos.v1alpha1.PlatformService.AddPlatform
*/
addPlatform: {
name: "AddPlatform",
@@ -22,7 +22,7 @@ export const PlatformService = {
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetPlatform
* @generated from rpc holos.v1alpha1.PlatformService.GetPlatform
*/
getPlatform: {
name: "GetPlatform",
@@ -31,7 +31,7 @@ export const PlatformService = {
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.ListPlatforms
* @generated from rpc holos.v1alpha1.PlatformService.ListPlatforms
*/
listPlatforms: {
name: "ListPlatforms",
@@ -40,7 +40,7 @@ export const PlatformService = {
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetForm
* @generated from rpc holos.v1alpha1.PlatformService.GetForm
*/
getForm: {
name: "GetForm",
@@ -49,7 +49,16 @@ export const PlatformService = {
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.GetModel
* @generated from rpc holos.v1alpha1.PlatformService.PutForm
*/
putForm: {
name: "PutForm",
I: PutFormRequest,
O: PutFormResponse,
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.v1alpha1.PlatformService.GetModel
*/
getModel: {
name: "GetModel",
@@ -58,7 +67,7 @@ export const PlatformService = {
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.platform.v1alpha1.PlatformService.PutModel
* @generated from rpc holos.v1alpha1.PlatformService.PutModel
*/
putModel: {
name: "PutModel",

View File

@@ -1,5 +1,5 @@
// @generated by protoc-gen-es v1.9.0 with parameter "target=ts"
// @generated from file holos/v1alpha1/platform.proto (package holos.platform.v1alpha1, syntax proto3)
// @generated from file holos/v1alpha1/platform.proto (package holos.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
@@ -7,7 +7,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM
import { Message, proto3, Struct } from "@bufbuild/protobuf";
/**
* @generated from message holos.platform.v1alpha1.Platform
* @generated from message holos.v1alpha1.Platform
*/
export class Platform extends Message<Platform> {
/**
@@ -37,7 +37,7 @@ export class Platform extends Message<Platform> {
displayName = "";
/**
* @generated from field: holos.platform.v1alpha1.PlatformSpec spec = 5;
* @generated from field: holos.v1alpha1.PlatformSpec spec = 5;
*/
spec?: PlatformSpec;
@@ -47,7 +47,7 @@ export class Platform extends Message<Platform> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.Platform";
static readonly typeName = "holos.v1alpha1.Platform";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "org_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
@@ -74,7 +74,7 @@ export class Platform extends Message<Platform> {
}
/**
* @generated from message holos.platform.v1alpha1.PlatformSpec
* @generated from message holos.v1alpha1.PlatformSpec
*/
export class PlatformSpec extends Message<PlatformSpec> {
/**
@@ -90,7 +90,7 @@ export class PlatformSpec extends Message<PlatformSpec> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.PlatformSpec";
static readonly typeName = "holos.v1alpha1.PlatformSpec";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "model", kind: "message", T: Struct },
]);
@@ -113,7 +113,89 @@ export class PlatformSpec extends Message<PlatformSpec> {
}
/**
* @generated from message holos.platform.v1alpha1.ListPlatformsRequest
* Form represents the Formly input form.
*
* @generated from message holos.v1alpha1.Form
*/
export class Form extends Message<Form> {
/**
* fields represents FormlyFieldConfig[] encoded as a JSON array.
*
* @generated from field: repeated google.protobuf.Struct fields = 1;
*/
fields: Struct[] = [];
constructor(data?: PartialMessage<Form>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.Form";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "fields", kind: "message", T: Struct, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Form {
return new Form().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Form {
return new Form().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Form {
return new Form().fromJsonString(jsonString, options);
}
static equals(a: Form | PlainMessage<Form> | undefined, b: Form | PlainMessage<Form> | undefined): boolean {
return proto3.util.equals(Form, a, b);
}
}
/**
* Model represents the values entered into the form, stored in the form's model
* in the web app, and persisted into the backend database. The model is
* ultimately intended as the input to platform rendering.
*
* @generated from message holos.v1alpha1.Model
*/
export class Model extends Message<Model> {
/**
* @generated from field: google.protobuf.Struct model = 1;
*/
model?: Struct;
constructor(data?: PartialMessage<Model>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.Model";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "model", kind: "message", T: Struct },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Model {
return new Model().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Model {
return new Model().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Model {
return new Model().fromJsonString(jsonString, options);
}
static equals(a: Model | PlainMessage<Model> | undefined, b: Model | PlainMessage<Model> | undefined): boolean {
return proto3.util.equals(Model, a, b);
}
}
/**
* @generated from message holos.v1alpha1.ListPlatformsRequest
*/
export class ListPlatformsRequest extends Message<ListPlatformsRequest> {
/**
@@ -127,7 +209,7 @@ export class ListPlatformsRequest extends Message<ListPlatformsRequest> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.ListPlatformsRequest";
static readonly typeName = "holos.v1alpha1.ListPlatformsRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "org_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
@@ -150,11 +232,11 @@ export class ListPlatformsRequest extends Message<ListPlatformsRequest> {
}
/**
* @generated from message holos.platform.v1alpha1.ListPlatformsResponse
* @generated from message holos.v1alpha1.ListPlatformsResponse
*/
export class ListPlatformsResponse extends Message<ListPlatformsResponse> {
/**
* @generated from field: repeated holos.platform.v1alpha1.Platform platforms = 1;
* @generated from field: repeated holos.v1alpha1.Platform platforms = 1;
*/
platforms: Platform[] = [];
@@ -164,7 +246,7 @@ export class ListPlatformsResponse extends Message<ListPlatformsResponse> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.ListPlatformsResponse";
static readonly typeName = "holos.v1alpha1.ListPlatformsResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platforms", kind: "message", T: Platform, repeated: true },
]);
@@ -187,11 +269,11 @@ export class ListPlatformsResponse extends Message<ListPlatformsResponse> {
}
/**
* @generated from message holos.platform.v1alpha1.AddPlatformRequest
* @generated from message holos.v1alpha1.AddPlatformRequest
*/
export class AddPlatformRequest extends Message<AddPlatformRequest> {
/**
* @generated from field: holos.platform.v1alpha1.Platform platform = 1;
* @generated from field: holos.v1alpha1.Platform platform = 1;
*/
platform?: Platform;
@@ -201,7 +283,7 @@ export class AddPlatformRequest extends Message<AddPlatformRequest> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.AddPlatformRequest";
static readonly typeName = "holos.v1alpha1.AddPlatformRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform", kind: "message", T: Platform },
]);
@@ -224,13 +306,13 @@ export class AddPlatformRequest extends Message<AddPlatformRequest> {
}
/**
* @generated from message holos.platform.v1alpha1.AddPlatformResponse
* @generated from message holos.v1alpha1.AddPlatformResponse
*/
export class AddPlatformResponse extends Message<AddPlatformResponse> {
/**
* @generated from field: repeated holos.platform.v1alpha1.Platform platform = 1;
* @generated from field: repeated holos.v1alpha1.Platform platforms = 1;
*/
platform: Platform[] = [];
platforms: Platform[] = [];
constructor(data?: PartialMessage<AddPlatformResponse>) {
super();
@@ -238,9 +320,9 @@ export class AddPlatformResponse extends Message<AddPlatformResponse> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.AddPlatformResponse";
static readonly typeName = "holos.v1alpha1.AddPlatformResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform", kind: "message", T: Platform, repeated: true },
{ no: 1, name: "platforms", kind: "message", T: Platform, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AddPlatformResponse {
@@ -261,7 +343,7 @@ export class AddPlatformResponse extends Message<AddPlatformResponse> {
}
/**
* @generated from message holos.platform.v1alpha1.GetPlatformRequest
* @generated from message holos.v1alpha1.GetPlatformRequest
*/
export class GetPlatformRequest extends Message<GetPlatformRequest> {
/**
@@ -275,7 +357,7 @@ export class GetPlatformRequest extends Message<GetPlatformRequest> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetPlatformRequest";
static readonly typeName = "holos.v1alpha1.GetPlatformRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
@@ -298,11 +380,11 @@ export class GetPlatformRequest extends Message<GetPlatformRequest> {
}
/**
* @generated from message holos.platform.v1alpha1.GetPlatformResponse
* @generated from message holos.v1alpha1.GetPlatformResponse
*/
export class GetPlatformResponse extends Message<GetPlatformResponse> {
/**
* @generated from field: holos.platform.v1alpha1.Platform platform = 1;
* @generated from field: holos.v1alpha1.Platform platform = 1;
*/
platform?: Platform;
@@ -312,7 +394,7 @@ export class GetPlatformResponse extends Message<GetPlatformResponse> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetPlatformResponse";
static readonly typeName = "holos.v1alpha1.GetPlatformResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform", kind: "message", T: Platform },
]);
@@ -335,7 +417,7 @@ export class GetPlatformResponse extends Message<GetPlatformResponse> {
}
/**
* @generated from message holos.platform.v1alpha1.GetFormRequest
* @generated from message holos.v1alpha1.GetFormRequest
*/
export class GetFormRequest extends Message<GetFormRequest> {
/**
@@ -349,7 +431,7 @@ export class GetFormRequest extends Message<GetFormRequest> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetFormRequest";
static readonly typeName = "holos.v1alpha1.GetFormRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
@@ -372,33 +454,29 @@ export class GetFormRequest extends Message<GetFormRequest> {
}
/**
* @generated from message holos.platform.v1alpha1.GetFormResponse
* @generated from message holos.v1alpha1.GetFormResponse
*/
export class GetFormResponse extends Message<GetFormResponse> {
/**
* model represents the persisted state of the form model.
*
* @generated from field: google.protobuf.Struct model = 1;
*/
model?: Struct;
/**
* fields represents FormlyFieldConfig[] encoded as a JSON array.
*
* @generated from field: repeated google.protobuf.Struct fields = 2;
* @generated from field: repeated google.protobuf.Struct fields = 1;
*/
fields: Struct[] = [];
/**
* @generated from field: google.protobuf.Struct model = 2;
*/
model?: Struct;
constructor(data?: PartialMessage<GetFormResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetFormResponse";
static readonly typeName = "holos.v1alpha1.GetFormResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "model", kind: "message", T: Struct },
{ no: 2, name: "fields", kind: "message", T: Struct, repeated: true },
{ no: 1, name: "fields", kind: "message", T: Struct, repeated: true },
{ no: 2, name: "model", kind: "message", T: Struct },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetFormResponse {
@@ -419,7 +497,7 @@ export class GetFormResponse extends Message<GetFormResponse> {
}
/**
* @generated from message holos.platform.v1alpha1.GetModelRequest
* @generated from message holos.v1alpha1.GetModelRequest
*/
export class GetModelRequest extends Message<GetModelRequest> {
/**
@@ -433,7 +511,7 @@ export class GetModelRequest extends Message<GetModelRequest> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetModelRequest";
static readonly typeName = "holos.v1alpha1.GetModelRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
@@ -456,12 +534,10 @@ export class GetModelRequest extends Message<GetModelRequest> {
}
/**
* @generated from message holos.platform.v1alpha1.GetModelResponse
* @generated from message holos.v1alpha1.GetModelResponse
*/
export class GetModelResponse extends Message<GetModelResponse> {
/**
* model represents the persisted state of the form model.
*
* @generated from field: google.protobuf.Struct model = 1;
*/
model?: Struct;
@@ -472,7 +548,7 @@ export class GetModelResponse extends Message<GetModelResponse> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.GetModelResponse";
static readonly typeName = "holos.v1alpha1.GetModelResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "model", kind: "message", T: Struct },
]);
@@ -495,7 +571,7 @@ export class GetModelResponse extends Message<GetModelResponse> {
}
/**
* @generated from message holos.platform.v1alpha1.PutModelRequest
* @generated from message holos.v1alpha1.PutModelRequest
*/
export class PutModelRequest extends Message<PutModelRequest> {
/**
@@ -514,7 +590,7 @@ export class PutModelRequest extends Message<PutModelRequest> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.PutModelRequest";
static readonly typeName = "holos.v1alpha1.PutModelRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "model", kind: "message", T: Struct },
@@ -538,7 +614,7 @@ export class PutModelRequest extends Message<PutModelRequest> {
}
/**
* @generated from message holos.platform.v1alpha1.PutModelResponse
* @generated from message holos.v1alpha1.PutModelResponse
*/
export class PutModelResponse extends Message<PutModelResponse> {
/**
@@ -552,7 +628,7 @@ export class PutModelResponse extends Message<PutModelResponse> {
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.platform.v1alpha1.PutModelResponse";
static readonly typeName = "holos.v1alpha1.PutModelResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "model", kind: "message", T: Struct },
]);
@@ -574,3 +650,83 @@ export class PutModelResponse extends Message<PutModelResponse> {
}
}
/**
* @generated from message holos.v1alpha1.PutFormRequest
*/
export class PutFormRequest extends Message<PutFormRequest> {
/**
* @generated from field: string platform_id = 1;
*/
platformId = "";
/**
* @generated from field: repeated google.protobuf.Struct fields = 2;
*/
fields: Struct[] = [];
constructor(data?: PartialMessage<PutFormRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.PutFormRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "platform_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "fields", kind: "message", T: Struct, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PutFormRequest {
return new PutFormRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PutFormRequest {
return new PutFormRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PutFormRequest {
return new PutFormRequest().fromJsonString(jsonString, options);
}
static equals(a: PutFormRequest | PlainMessage<PutFormRequest> | undefined, b: PutFormRequest | PlainMessage<PutFormRequest> | undefined): boolean {
return proto3.util.equals(PutFormRequest, a, b);
}
}
/**
* @generated from message holos.v1alpha1.PutFormResponse
*/
export class PutFormResponse extends Message<PutFormResponse> {
/**
* @generated from field: repeated google.protobuf.Struct fields = 1;
*/
fields: Struct[] = [];
constructor(data?: PartialMessage<PutFormResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.PutFormResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "fields", kind: "message", T: Struct, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PutFormResponse {
return new PutFormResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PutFormResponse {
return new PutFormResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PutFormResponse {
return new PutFormResponse().fromJsonString(jsonString, options);
}
static equals(a: PutFormResponse | PlainMessage<PutFormResponse> | undefined, b: PutFormResponse | PlainMessage<PutFormResponse> | undefined): boolean {
return proto3.util.equals(PutFormResponse, a, b);
}
}

View File

@@ -1,35 +0,0 @@
// @generated by protoc-gen-connect-query v1.3.1 with parameter "target=ts"
// @generated from file holos/v1alpha1/system.proto (package holos.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { MethodKind } from "@bufbuild/protobuf";
import { EmptyRequest, EmptyResponse } from "./system_pb.js";
/**
* @generated from rpc holos.v1alpha1.SystemService.SeedDatabase
*/
export const seedDatabase = {
localName: "seedDatabase",
name: "SeedDatabase",
kind: MethodKind.Unary,
I: EmptyRequest,
O: EmptyResponse,
service: {
typeName: "holos.v1alpha1.SystemService"
}
} as const;
/**
* @generated from rpc holos.v1alpha1.SystemService.DropTables
*/
export const dropTables = {
localName: "dropTables",
name: "DropTables",
kind: MethodKind.Unary,
I: EmptyRequest,
O: EmptyResponse,
service: {
typeName: "holos.v1alpha1.SystemService"
}
} as const;

View File

@@ -3,7 +3,7 @@
/* eslint-disable */
// @ts-nocheck
import { EmptyRequest, EmptyResponse } from "./system_pb.js";
import { DropTablesRequest, DropTablesResponse, SeedDatabaseRequest, SeedDatabaseResponse } from "./system_pb.js";
import { MethodKind } from "@bufbuild/protobuf";
/**
@@ -17,8 +17,8 @@ export const SystemService = {
*/
seedDatabase: {
name: "SeedDatabase",
I: EmptyRequest,
O: EmptyResponse,
I: SeedDatabaseRequest,
O: SeedDatabaseResponse,
kind: MethodKind.Unary,
},
/**
@@ -26,8 +26,8 @@ export const SystemService = {
*/
dropTables: {
name: "DropTables",
I: EmptyRequest,
O: EmptyResponse,
I: DropTablesRequest,
O: DropTablesResponse,
kind: MethodKind.Unary,
},
}

View File

@@ -7,64 +7,126 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM
import { Message, proto3 } from "@bufbuild/protobuf";
/**
* @generated from message holos.v1alpha1.EmptyRequest
* @generated from message holos.v1alpha1.SeedDatabaseRequest
*/
export class EmptyRequest extends Message<EmptyRequest> {
constructor(data?: PartialMessage<EmptyRequest>) {
export class SeedDatabaseRequest extends Message<SeedDatabaseRequest> {
constructor(data?: PartialMessage<SeedDatabaseRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.EmptyRequest";
static readonly typeName = "holos.v1alpha1.SeedDatabaseRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EmptyRequest {
return new EmptyRequest().fromBinary(bytes, options);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SeedDatabaseRequest {
return new SeedDatabaseRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EmptyRequest {
return new EmptyRequest().fromJson(jsonValue, options);
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SeedDatabaseRequest {
return new SeedDatabaseRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EmptyRequest {
return new EmptyRequest().fromJsonString(jsonString, options);
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SeedDatabaseRequest {
return new SeedDatabaseRequest().fromJsonString(jsonString, options);
}
static equals(a: EmptyRequest | PlainMessage<EmptyRequest> | undefined, b: EmptyRequest | PlainMessage<EmptyRequest> | undefined): boolean {
return proto3.util.equals(EmptyRequest, a, b);
static equals(a: SeedDatabaseRequest | PlainMessage<SeedDatabaseRequest> | undefined, b: SeedDatabaseRequest | PlainMessage<SeedDatabaseRequest> | undefined): boolean {
return proto3.util.equals(SeedDatabaseRequest, a, b);
}
}
/**
* @generated from message holos.v1alpha1.EmptyResponse
* @generated from message holos.v1alpha1.SeedDatabaseResponse
*/
export class EmptyResponse extends Message<EmptyResponse> {
constructor(data?: PartialMessage<EmptyResponse>) {
export class SeedDatabaseResponse extends Message<SeedDatabaseResponse> {
constructor(data?: PartialMessage<SeedDatabaseResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.EmptyResponse";
static readonly typeName = "holos.v1alpha1.SeedDatabaseResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EmptyResponse {
return new EmptyResponse().fromBinary(bytes, options);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SeedDatabaseResponse {
return new SeedDatabaseResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EmptyResponse {
return new EmptyResponse().fromJson(jsonValue, options);
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SeedDatabaseResponse {
return new SeedDatabaseResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EmptyResponse {
return new EmptyResponse().fromJsonString(jsonString, options);
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SeedDatabaseResponse {
return new SeedDatabaseResponse().fromJsonString(jsonString, options);
}
static equals(a: EmptyResponse | PlainMessage<EmptyResponse> | undefined, b: EmptyResponse | PlainMessage<EmptyResponse> | undefined): boolean {
return proto3.util.equals(EmptyResponse, a, b);
static equals(a: SeedDatabaseResponse | PlainMessage<SeedDatabaseResponse> | undefined, b: SeedDatabaseResponse | PlainMessage<SeedDatabaseResponse> | undefined): boolean {
return proto3.util.equals(SeedDatabaseResponse, a, b);
}
}
/**
* @generated from message holos.v1alpha1.DropTablesRequest
*/
export class DropTablesRequest extends Message<DropTablesRequest> {
constructor(data?: PartialMessage<DropTablesRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.DropTablesRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DropTablesRequest {
return new DropTablesRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DropTablesRequest {
return new DropTablesRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DropTablesRequest {
return new DropTablesRequest().fromJsonString(jsonString, options);
}
static equals(a: DropTablesRequest | PlainMessage<DropTablesRequest> | undefined, b: DropTablesRequest | PlainMessage<DropTablesRequest> | undefined): boolean {
return proto3.util.equals(DropTablesRequest, a, b);
}
}
/**
* @generated from message holos.v1alpha1.DropTablesResponse
*/
export class DropTablesResponse extends Message<DropTablesResponse> {
constructor(data?: PartialMessage<DropTablesResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.DropTablesResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DropTablesResponse {
return new DropTablesResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DropTablesResponse {
return new DropTablesResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DropTablesResponse {
return new DropTablesResponse().fromJsonString(jsonString, options);
}
static equals(a: DropTablesResponse | PlainMessage<DropTablesResponse> | undefined, b: DropTablesResponse | PlainMessage<DropTablesResponse> | undefined): boolean {
return proto3.util.equals(DropTablesResponse, a, b);
}
}

View File

@@ -1,49 +0,0 @@
// @generated by protoc-gen-connect-query v1.3.1 with parameter "target=ts"
// @generated from file holos/v1alpha1/user.proto (package holos.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { MethodKind } from "@bufbuild/protobuf";
import { CreateCallerUserRequest, CreateCallerUserResponse, GetCallerClaimsRequest, GetCallerClaimsResponse, GetCallerUserRequest, GetCallerUserResponse } from "./user_pb.js";
/**
* @generated from rpc holos.v1alpha1.UserService.GetCallerClaims
*/
export const getCallerClaims = {
localName: "getCallerClaims",
name: "GetCallerClaims",
kind: MethodKind.Unary,
I: GetCallerClaimsRequest,
O: GetCallerClaimsResponse,
service: {
typeName: "holos.v1alpha1.UserService"
}
} as const;
/**
* @generated from rpc holos.v1alpha1.UserService.GetCallerUser
*/
export const getCallerUser = {
localName: "getCallerUser",
name: "GetCallerUser",
kind: MethodKind.Unary,
I: GetCallerUserRequest,
O: GetCallerUserResponse,
service: {
typeName: "holos.v1alpha1.UserService"
}
} as const;
/**
* @generated from rpc holos.v1alpha1.UserService.CreateCallerUser
*/
export const createCallerUser = {
localName: "createCallerUser",
name: "CreateCallerUser",
kind: MethodKind.Unary,
I: CreateCallerUserRequest,
O: CreateCallerUserResponse,
service: {
typeName: "holos.v1alpha1.UserService"
}
} as const;

View File

@@ -1,20 +1,20 @@
import { Inject, Injectable } from '@angular/core';
import { OrganizationService as ConnectOrganizationService } from '../gen/holos/v1alpha1/organization_connect';
import { ObservableClient } from '../../connect/observable-client';
import { Observable, switchMap, of, shareReplay, catchError, BehaviorSubject } from 'rxjs';
import { GetCallerOrganizationsResponse, Organization } from '../gen/holos/v1alpha1/organization_pb';
import { UserService } from './user.service';
import { Code, ConnectError } from '@connectrpc/connect';
import { BehaviorSubject, Observable, catchError, of, shareReplay, switchMap } from 'rxjs';
import { ObservableClient } from '../../connect/observable-client';
import { OrganizationService as ConnectOrganizationService } from '../gen/holos/v1alpha1/organization_connect';
import { ListCallerOrganizationsResponse, Organization } from '../gen/holos/v1alpha1/organization_pb';
import { UserService } from './user.service';
@Injectable({
providedIn: 'root'
})
export class OrganizationService {
private callerOrganizationsTrigger$ = new BehaviorSubject<void>(undefined);
private callerOrganizations$: Observable<GetCallerOrganizationsResponse>;
private callerOrganizations$: Observable<ListCallerOrganizationsResponse>;
private fetchCallerOrganizations(): Observable<GetCallerOrganizationsResponse> {
return this.client.getCallerOrganizations({ request: {} }).pipe(
private fetchCallerOrganizations(): Observable<ListCallerOrganizationsResponse> {
return this.client.listCallerOrganizations({ request: {} }).pipe(
switchMap(resp => {
if (resp && resp.organizations.length > 0) {
return of(resp)
@@ -25,7 +25,7 @@ export class OrganizationService {
if (err instanceof ConnectError) {
if (err.code == Code.NotFound) {
return this.userService.createUser().pipe(
switchMap(user => this.client.createCallerOrganization({ request: {} }))
switchMap(() => this.client.createCallerOrganization({ request: {} }))
)
}
}

View File

@@ -1,10 +1,10 @@
import { Inject, Injectable } from '@angular/core';
import { PlatformService as ConnectPlatformService } from '../gen/holos/v1alpha1/platform_connect';
import { Observable, filter, of, switchMap } from 'rxjs';
import { ObservableClient } from '../../connect/observable-client';
import { Platform, GetFormResponse, ListPlatformsRequest, PutModelRequest, PutModelResponse } from '../gen/holos/v1alpha1/platform_pb';
import { Organization } from '../gen/holos/v1alpha1/organization_pb';
import { JsonValue, Struct, } from '@bufbuild/protobuf';
import { Observable, of, switchMap } from 'rxjs';
import { ObservableClient } from '../../connect/observable-client';
import { Organization } from '../gen/holos/v1alpha1/organization_pb';
import { PlatformService as ConnectPlatformService } from '../gen/holos/v1alpha1/platform_connect';
import { GetFormResponse, ListPlatformsRequest, Platform, PutModelRequest, PutModelResponse } from '../gen/holos/v1alpha1/platform_pb';
@Injectable({
providedIn: 'root'

View File

@@ -1,15 +1,14 @@
import { Component, Input, OnDestroy, inject } from '@angular/core';
import { Observable, Subject, shareReplay, takeUntil } from 'rxjs';
import { PlatformService } from '../../services/platform.service';
import { GetFormResponse } from '../../gen/holos/v1alpha1/platform_pb';
import { MatTab, MatTabGroup } from '@angular/material/tabs';
import { AsyncPipe, CommonModule } from '@angular/common';
import { Component, Input, OnDestroy, inject } from '@angular/core';
import { FormGroup, ReactiveFormsModule } from '@angular/forms';
import { FormlyMaterialModule } from '@ngx-formly/material';
import { FormlyFieldConfig, FormlyFormOptions, FormlyModule } from '@ngx-formly/core';
import { MatButton } from '@angular/material/button';
import { MatDivider } from '@angular/material/divider';
import { JsonObject, JsonValue } from '@bufbuild/protobuf';
import { MatTab, MatTabGroup } from '@angular/material/tabs';
import { JsonValue } from '@bufbuild/protobuf';
import { FormlyFieldConfig, FormlyFormOptions, FormlyModule } from '@ngx-formly/core';
import { FormlyMaterialModule } from '@ngx-formly/material';
import { Subject, takeUntil } from 'rxjs';
import { PlatformService } from '../../services/platform.service';
@Component({
selector: 'app-platform-detail',
@@ -32,7 +31,7 @@ export class PlatformDetailComponent implements OnDestroy {
private platformService = inject(PlatformService);
private platformId: string = "";
private destroy$: Subject<any> = new Subject<any>();
private destroy$: Subject<boolean> = new Subject<boolean>();
form = new FormGroup({});
fields: FormlyFieldConfig[] = [];
model: JsonValue = {};

View File

@@ -1,5 +1,5 @@
import { Platform } from '../../gen/holos/v1alpha1/platform_pb';
import { Component, inject } from '@angular/core';
import { Component, OnInit, inject } from '@angular/core';
import { MatListItem, MatNavList } from '@angular/material/list';
import { Observable, filter } from 'rxjs';
import { Organization } from '../../gen/holos/v1alpha1/organization_pb';
@@ -21,14 +21,14 @@ import { RouterLink } from '@angular/router';
templateUrl: './platforms.component.html',
styleUrl: './platforms.component.scss'
})
export class PlatformsComponent {
export class PlatformsComponent implements OnInit {
private orgSvc = inject(OrganizationService);
private platformSvc = inject(PlatformService);
org$!: Observable<Organization | undefined>;
platforms$!: Observable<Platform[]>;
ngOnInit(): void {
ngOnInit() {
this.org$ = this.orgSvc.activeOrg();
this.platforms$ = this.platformSvc.listPlatforms(this.org$.pipe(
filter((org): org is Organization => org !== undefined)

View File

@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import { FieldWrapper } from '@ngx-formly/core';
@Component({
selector: 'formly-wrapper-holos-panel',
selector: 'app-holos-panel-wrapper',
standalone: true,
imports: [],
templateUrl: './holos-panel-wrapper.component.html',

View File

@@ -1,219 +0,0 @@
// Package builder is responsible for building fully rendered kubernetes api
// objects from various input directories. A directory may contain a platform
// spec or a component spec.
package builder
import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"cuelang.org/go/cue/build"
"cuelang.org/go/cue/cuecontext"
"cuelang.org/go/cue/load"
"github.com/holos-run/holos/api/v1alpha1"
"github.com/holos-run/holos"
"github.com/holos-run/holos/internal/errors"
"github.com/holos-run/holos/internal/logger"
)
const (
KubernetesObjects = v1alpha1.KubernetesObjectsKind
// Helm is the value of the kind field of holos build output indicating helm
// values and helm command information.
Helm = v1alpha1.HelmChartKind
// Skip is the value when the instance should be skipped
Skip = "Skip"
// KustomizeBuild is the value of the kind field of cue output indicating holos should process the component using kustomize build to render output.
KustomizeBuild = v1alpha1.KustomizeBuildKind
)
// An Option configures a Builder
type Option func(*config)
type config struct {
args []string
cluster string
}
type Builder struct {
cfg config
}
// New returns a new *Builder configured by opts Option.
func New(opts ...Option) *Builder {
var cfg config
for _, f := range opts {
f(&cfg)
}
b := &Builder{cfg: cfg}
return b
}
// Entrypoints configures the leaf directories Builder builds.
func Entrypoints(args []string) Option {
return func(cfg *config) { cfg.args = args }
}
// Cluster configures the cluster name for the holos component instance.
func Cluster(name string) Option {
return func(cfg *config) { cfg.cluster = name }
}
// Cluster returns the cluster name of the component instance being built.
func (b *Builder) Cluster() string {
return b.cfg.cluster
}
// Instances returns the cue build instances being built.
func (b *Builder) Instances(ctx context.Context) ([]*build.Instance, error) {
log := logger.FromContext(ctx)
mod, err := b.findCueMod()
if err != nil {
return nil, errors.Wrap(err)
}
dir := string(mod)
cfg := load.Config{Dir: dir}
// Make args relative to the module directory
args := make([]string, len(b.cfg.args))
for idx, path := range b.cfg.args {
target, err := filepath.Abs(path)
if err != nil {
return nil, errors.Wrap(fmt.Errorf("could not find absolute path: %w", err))
}
relPath, err := filepath.Rel(dir, target)
if err != nil {
return nil, errors.Wrap(fmt.Errorf("invalid argument, must be relative to cue.mod: %w", err))
}
relPath = "./" + relPath
args[idx] = relPath
equiv := fmt.Sprintf("cue export --out yaml -t cluster=%v %v", b.Cluster(), relPath)
log.Debug("cue: equivalent command: " + equiv)
}
// Refer to https://github.com/cue-lang/cue/blob/v0.7.0/cmd/cue/cmd/common.go#L429
cfg.Tags = append(cfg.Tags, "cluster="+b.Cluster())
log.DebugContext(ctx, fmt.Sprintf("cue: tags %v", cfg.Tags))
return load.Instances(args, &cfg), nil
}
func (b *Builder) Run(ctx context.Context) (results []*v1alpha1.Result, err error) {
results = make([]*v1alpha1.Result, 0, len(b.cfg.args))
cueCtx := cuecontext.New()
logger.FromContext(ctx).DebugContext(ctx, "cue: building instances")
instances, err := b.Instances(ctx)
if err != nil {
return results, err
}
// Each CUE instance provides a BuildPlan
for _, instance := range instances {
var buildPlan v1alpha1.BuildPlan
log := logger.FromContext(ctx).With("dir", instance.Dir)
if err := instance.Err; err != nil {
return nil, errors.Wrap(fmt.Errorf("could not load: %w", err))
}
log.DebugContext(ctx, "cue: building instance")
value := cueCtx.BuildInstance(instance)
if err := value.Err(); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not build %s: %w", instance.Dir, err))
}
log.DebugContext(ctx, "cue: validating instance")
if err := value.Validate(); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not validate: %w", err))
}
log.DebugContext(ctx, "cue: decoding holos build plan")
// Hack to catch unknown fields https://github.com/holos-run/holos/issues/72
jsonBytes, err := value.MarshalJSON()
if err != nil {
return nil, errors.Wrap(fmt.Errorf("could not marshal cue instance %s: %w", instance.Dir, err))
}
decoder := json.NewDecoder(bytes.NewReader(jsonBytes))
decoder.DisallowUnknownFields()
err = decoder.Decode(&buildPlan)
if err != nil {
return nil, errors.Wrap(fmt.Errorf("invalid BuildPlan: %s: %w", instance.Dir, err))
}
if err := buildPlan.Validate(); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not validate %s: %w", instance.Dir, err))
}
if buildPlan.Spec.Disabled {
log.DebugContext(ctx, "skipped: spec.disabled is true", "skipped", true)
continue
}
// TODO: concurrent renders
for _, component := range buildPlan.Spec.Components.Resources {
if result, err := component.Render(ctx, holos.InstancePath(instance.Dir)); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not render: %w", err))
} else {
results = append(results, result)
}
}
for _, component := range buildPlan.Spec.Components.KubernetesObjectsList {
if result, err := component.Render(ctx, holos.InstancePath(instance.Dir)); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not render: %w", err))
} else {
results = append(results, result)
}
}
for _, component := range buildPlan.Spec.Components.HelmChartList {
if result, err := component.Render(ctx, holos.InstancePath(instance.Dir)); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not render: %w", err))
} else {
results = append(results, result)
}
}
for _, component := range buildPlan.Spec.Components.KustomizeBuildList {
if result, err := component.Render(ctx, holos.InstancePath(instance.Dir)); err != nil {
return nil, errors.Wrap(fmt.Errorf("could not render: %w", err))
} else {
results = append(results, result)
}
}
}
return results, nil
}
// findCueMod returns the root module location containing the cue.mod file or
// directory or an error if the builder arguments do not share a common root
// module.
func (b *Builder) findCueMod() (dir holos.PathCueMod, err error) {
for _, origPath := range b.cfg.args {
absPath, err := filepath.Abs(origPath)
if err != nil {
return "", err
}
path := holos.PathCueMod(absPath)
for {
if _, err := os.Stat(filepath.Join(string(path), "cue.mod")); err == nil {
if dir != "" && dir != path {
return "", fmt.Errorf("multiple modules not supported: %v is not %v", dir, path)
}
dir = path
break
} else if !os.IsNotExist(err) {
return "", err
}
parentPath := holos.PathCueMod(filepath.Dir(string(path)))
if parentPath == path {
return "", fmt.Errorf("no cue.mod from root to leaf: %v", origPath)
}
path = parentPath
}
}
return dir, nil
}

View File

@@ -0,0 +1,4 @@
package holos
// #ClusterName is the --cluster-name flag value provided by the holos cli.
#ClusterName: string @tag(cluster, type=string)

View File

@@ -1,26 +1,20 @@
package holos
import ( "encoding/yaml"
import "encoding/yaml"
import v1 "github.com/holos-run/holos/api/v1alpha1"
)
let PLATFORM = {message: "TODO: Load the platform from the API."}
// The platform configmap is a simple component that manages a configmap named
// platform in the default namespace. The purpose is to exercise end to end
// validation of platform configuration values provided by the holos web ui to
// each cluster in the platform.
platform: #Platform & {metadata: name: "bare"}
let PLATFORM = platform
// spec represents the output provided to holos
spec: components: KubernetesObjectsList: [
#KubernetesObjects & {
// Provide a BuildPlan to the holos cli to render k8s api objects.
v1.#BuildPlan & {
spec: components: resources: platformConfigmap: {
metadata: name: "platform-configmap"
apiObjectMap: OBJECTS.apiObjectMap
},
]
}
}
// OBJECTS represents the kubernetes api objects to manage.
let OBJECTS = #APIObjects & {
let OBJECTS = v1.#APIObjects & {
apiObjects: ConfigMap: platform: {
metadata: {
name: "platform"

View File

@@ -1,12 +1,12 @@
package forms
import formsv1 "github.com/holos-run/forms/v1alpha1"
import v1 "github.com/holos-run/holos/v1alpha1"
let Platform = formsv1.#Platform & {
name: "bare"
displayName: "Bare Platform"
// Provides a concrete v1.#Form
FormBuilder.Output
sections: org: {
let FormBuilder = v1.#FormBuilder & {
Sections: org: {
displayName: "Organization"
description: "Organization config values are used to derive more specific configuration values throughout the platform."
@@ -64,7 +64,7 @@ let Platform = formsv1.#Platform & {
}
}
sections: cloud: {
Sections: cloud: {
displayName: "Cloud Providers"
description: "Select the services that provide resources for the platform."
@@ -91,7 +91,7 @@ let Platform = formsv1.#Platform & {
}
}
sections: aws: {
Sections: aws: {
displayName: "Amazon Web Services"
description: "Provide the information necessary for Holos to manage AWS resources to provide the platform."
@@ -128,7 +128,7 @@ let Platform = formsv1.#Platform & {
}
}
sections: gcp: {
Sections: gcp: {
displayName: "Google Cloud Platform"
description: "Use this form to configure platform level GCP settings."
@@ -208,7 +208,7 @@ let Platform = formsv1.#Platform & {
}
}
sections: cloudflare: {
Sections: cloudflare: {
displayName: "Cloudflare"
description: "Cloudflare is primarily used for DNS automation."
@@ -228,7 +228,7 @@ let Platform = formsv1.#Platform & {
}
}
sections: github: {
Sections: github: {
displayName: "GitHub"
description: "GitHub is primarily used to host Git repositories and execute Actions workflows."
@@ -253,7 +253,7 @@ let Platform = formsv1.#Platform & {
}
}
sections: backups: {
Sections: backups: {
displayName: "Backups"
description: "Configure platform level data backup settings. Requires AWS."
@@ -278,76 +278,8 @@ let Platform = formsv1.#Platform & {
}
}
}
_sections: privacy: {
displayName: "Data Privacy"
description: "Configure data privacy aspects of the platform."
fieldConfigs: {
country: {
// https://formly.dev/docs/api/ui/material/select/
type: "select"
props: {
label: "Select Planet"
description: "Juridiction of applicable data privacy laws."
options: [
{value: "mercury", label: "Mercury"},
{value: "venus", label: "Venus"},
{value: "earth", label: "Earth"},
{value: "mars", label: "Mars"},
{value: "jupiter", label: "Jupiter"},
{value: "saturn", label: "Saturn"},
{value: "uranus", label: "Uranus"},
{value: "neptune", label: "Neptune"},
]
}
}
regions: {
// https://formly.dev/docs/api/ui/material/select/
type: "select"
props: {
label: "Select Regions"
description: "Select the regions this platform operates in."
multiple: true
selectAllOption: "Select All"
options: [
{value: "us-east-2", label: "Ohio"},
{value: "us-west-2", label: "Oregon"},
{value: "eu-west-1", label: "Ireland"},
{value: "eu-west-2", label: "London", disabled: true},
]
}
}
}
}
_sections: terms: {
displayName: "Terms and Conditions"
description: "Example of a boolean checkbox."
fieldConfigs: {
// platform.spec.config.user.sections.terms.fields.didAgree
didAgree: {
type: "checkbox"
props: {
label: "Accept terms"
description: "In order to proceed, please accept terms"
pattern: "true"
required: true
}
validation: {
messages: {
pattern: "Please accept the terms"
}
}
}
}
}
}
// Provide the output form fields
Platform.Form
let GCPRegions = [
{value: "africa-south1", label: "africa-south1"},
{value: "asia-east1", label: "asia-east1"},

View File

@@ -1,63 +0,0 @@
package holos
import (
h "github.com/holos-run/holos/api/v1alpha1"
"encoding/yaml"
)
// CUE provides a #BuildPlan to the holos cli. Holos requires the output of CUE
// to conform to the #BuildPlan schema.
{} & h.#BuildPlan
// #HolosComponent defines struct fields common to all holos component types.
#HolosComponent: {
h.#HolosComponent
metadata: name: string
_NameLengthConstraint: len(metadata.name) & >=1
...
}
#KubernetesObjects: #HolosComponent & h.#KubernetesObjects
// #HolosTypeMeta is similar to kubernetes api TypeMeta, but for holos api
// objects such as the Platform config resource.
#HolosTypeMeta: {
kind: string @go(Kind)
apiVersion: string @go(APIVersion)
}
// #HolosObjectMeta is similar to kubernetes api ObjectMeta, but for holos api
// objects.
#HolosObjectMeta: {
name: string @go(Name)
labels: {[string]: string} @go(Labels,map[string]string)
annotations: {[string]: string} @go(Annotations,map[string]string)
}
// #APIObjects defines the output format for kubernetes api objects. The holos
// cli expects the yaml representation of each api object in the apiObjectMap
// field.
#APIObjects: {
// apiObjects represents the un-marshalled form of each kubernetes api object
// managed by a holos component.
apiObjects: {
[Kind=_]: {
[string]: {
kind: Kind
...
}
}
ConfigMap?: [Name=_]: #ConfigMap & {metadata: name: Name}
}
// apiObjectMap holds the marshalled representation of apiObjects
apiObjectMap: {
for kind, v in apiObjects {
"\(kind)": {
for name, obj in v {
"\(name)": yaml.Marshal(obj)
}
}
}
}
}

View File

@@ -1,13 +0,0 @@
package holos
import (
corev1 "k8s.io/api/core/v1"
)
_NamespaceObject: {
metadata: name: string
metadata: namespace: string
metadata: labels: "app.holos.run/managed": "true"
}
#ConfigMap: _NamespaceObject & corev1.#ConfigMap

View File

@@ -1,39 +0,0 @@
package holos
// #Platform represents the user supplied platform configuration.
#Platform: {
#HolosTypeMeta
kind: "Platform"
apiVersion: "app.holos.run/v1alpha1"
metadata: #HolosObjectMeta
spec: #PlatformSpec
holos: #Holos
}
// #Holos represents the holos reserved field in the #Platform schema defined by the holos development team.
#Holos: {
// flags represents config values provided by holos command line flags.
flags: {
// cluster represents the holos render --cluster-name flag.
cluster: string @tag(cluster, type=string)
}
}
// #PlatformSpec represents configuration values defined by the platform
// designer. Config values are organized by section, then simple strings for
// each section.
#PlatformSpec: {
config: [string]: _
config: user: #UserDefinedConfig
}
// #PlatformUserConfig represents configuration fields and values defined by the
// user.
#UserDefinedConfig: {
sections: [string]: fields: [string]: _
}
// #PlatformConfig represents the platform config data returned from the Holos API. Useful for cue vet.
#PlatformConfig: {
platform: spec: #PlatformSpec
}

View File

@@ -1,20 +0,0 @@
{
"platform": {
"spec": {
"config": {
"user": {
"sections": {
"org": {
"fields": {
"contactEmail": "jeff@openinfrastructure.co",
"displayName": "Open Infrastructure Services LLC",
"domain": "ois.run",
"name": "ois"
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,20 @@
Bare Platform
| Folder | Description |
| - | - |
| forms | Contains Platform and Project form and model definitions |
| platform | Contains the Platform resource that defines how to render the configuration for all Platform Components |
| components | Contains BuildPlan resources which define how to render individual Platform Components |
## Forms
To populate the form, the platform must already be created in the Web UI:
```bash
platformId="018f36fb-e3ff-7f7f-a5d1-7ca2bf499e94"
cue export ./forms/platform/ --out json \
| jq '{platform_id: "'$platformId'", fields: .spec.fields}' \
| grpcurl -H "x-oidc-id-token: $(holos token)" -d @ \
app.dev.k2.holos.run:443 \
holos.v1alpha1.PlatformService.PutForm
```

View File

@@ -1 +0,0 @@
package holos

View File

@@ -0,0 +1,33 @@
package v1alpha1
import "encoding/yaml"
import core "k8s.io/api/core/v1"
// #APIObjects defines the output format for kubernetes api objects. The holos
// cli expects the yaml representation of each api object in the apiObjectMap
// field.
#APIObjects: {
// apiObjects represents the un-marshalled form of each kubernetes api object
// managed by a holos component.
apiObjects: {
[Kind=string]: {
[string]: {
kind: Kind
...
}
}
ConfigMap: [string]: core.#ConfigMap & {apiVersion: "v1"}
}
// apiObjectMap holds the marshalled representation of apiObjects
apiObjectMap: {
for kind, v in apiObjects {
"\(kind)": {
for name, obj in v {
"\(name)": yaml.Marshal(obj)
}
}
}
}
}

View File

@@ -0,0 +1,6 @@
package v1alpha1
#BuildPlan: {
apiVersion: #APIVersion
kind: #BuildPlanKind
}

View File

@@ -1,35 +1,31 @@
package v1alpha1
#Platform: {
name: string // short dns label name
displayName: string // Display name
description: string // Plaform description
// #Form represents a web app form to provide to the Holos API for display in
// the web app. A form is implemented as an Formly FieldConfig array using
// Angular Material form field components.
#Form: {
#TypeMeta
apiVersion: #APIVersion
kind: "Form"
sections: {[NAME=string]: #ConfigSection & {name: NAME}}
spec: fields: [...#FieldConfig]
}
Form: {
let Name = name
apiVersion: "forms.holos.run/v1alpha1"
kind: "PlatformForm"
metadata: name: Name
spec: #PlatformFormSpec
// #FormBuilder provides a concrete #Form via the Output field.
#FormBuilder: {
Name: string
Sections: {[NAME=string]: #FormSection & {name: NAME}}
Output: #Form & {
spec: fields: [for s in Sections {s.wrapper}]
}
let Sections = sections
// Collapse all sections into one fields list.
// Refer to https://formly.dev/docs/examples/other/nested-formly-forms
Form: spec: fields: [for s in Sections {s.wrapper}]
}
#PlatformFormSpec: {
fields: [...#FieldConfig]
}
// #ConfigSection represents a configuration section of the front end UI. For
// example, Organization config values. The fields of the section map to form
// input fields.
#ConfigSection: {
// #FormSection represents a configuration section of the front end UI. The
// wrapper field provides a concrete #FieldConfig for the form section. The
// fields of the section map to form input fields.
// Refer to: to https://formly.dev/docs/examples/other/nested-formly-forms
#FormSection: {
name: string // e.g. "org"
displayName: string // e.g. "Organization"
description: string
@@ -58,14 +54,7 @@ package v1alpha1
}
}
// REMOVE
#ConfigSectionOutput: {
name: string
displayName: string
description: string
fieldConfigs: [...#FieldConfig]
}
// #FieldConfig represents a Formly Field Config.
// Refer to https://formly.dev/docs/api/core#formlyfieldconfig
// Refer to https://formly.dev/docs/api/ui/material/select
#FieldConfig: {

View File

@@ -0,0 +1,16 @@
package v1alpha1
// #HolosComponent defines struct fields common to all holos platform
// component types.
#HolosComponent: {
metadata: name: string
_NameLengthConstraint: len(metadata.name) & >=1
...
}
// #KubernetesObjects is a Holos Component BuildPlan which has k8s api objects
// embedded into the build plan itself.
#KubernetesObjects: #HolosComponent & {
apiVersion: #APIVersion
kind: #KubernetesObjectsKind
}

View File

@@ -0,0 +1,9 @@
package v1alpha1
import corev1 "k8s.io/api/core/v1"
#ConfigMap: corev1.#ConfigMap & {
apiVersion: "v1"
kind: "ConfigMap"
...
}

View File

@@ -0,0 +1 @@
package v1alpha1

View File

@@ -0,0 +1,20 @@
package v1alpha1
// #Platform represents a platform to manage. Holos manages a platform by
// rendering platform components and applying the configuration to clusters as
// defined by the platform resource.
#Platform: {
#TypeMeta
apiVersion: #APIVersion
kind: "Platform"
metadata: #ObjectMeta
spec: {
// model represents the user defined platform model, which is produced and
// defined by the user supplied form.
model: {...}
// components represents components to manage in the platform, organized by
// the kind of cluster the rendered configuration applies to.
components: {}
}
}

View File

@@ -0,0 +1 @@
package v1alpha1

View File

@@ -0,0 +1,16 @@
package v1alpha1
// #TypeMeta is similar to kubernetes api TypeMeta, but for holos api
// objects such as the Platform config resource.
#TypeMeta: {
kind: string @go(Kind)
apiVersion: string @go(APIVersion)
}
// #ObjectMeta is similar to kubernetes api ObjectMeta, but for holos api
// objects.
#ObjectMeta: {
name: string @go(Name)
labels: {[string]: string} @go(Labels,map[string]string)
annotations: {[string]: string} @go(Annotations,map[string]string)
}

View File

@@ -27,10 +27,10 @@ type OrganizationHandler struct {
db *ent.Client
}
func (h *OrganizationHandler) GetCallerOrganizations(
func (h *OrganizationHandler) ListCallerOrganizations(
ctx context.Context,
req *connect.Request[holos.GetCallerOrganizationsRequest],
) (*connect.Response[holos.GetCallerOrganizationsResponse], error) {
req *connect.Request[holos.ListCallerOrganizationsRequest],
) (*connect.Response[holos.ListCallerOrganizationsResponse], error) {
authnID, err := authn.FromContext(ctx)
if err != nil {
return nil, connect.NewError(connect.CodePermissionDenied, errors.Wrap(err))
@@ -56,7 +56,7 @@ func (h *OrganizationHandler) GetCallerOrganizations(
rpcOrgs = append(rpcOrgs, OrganizationToRPC(dbOrg))
}
res := connect.NewResponse(&holos.GetCallerOrganizationsResponse{
res := connect.NewResponse(&holos.ListCallerOrganizationsResponse{
User: UserToRPC(dbUser),
Organizations: rpcOrgs,
})
@@ -66,7 +66,7 @@ func (h *OrganizationHandler) GetCallerOrganizations(
func (h *OrganizationHandler) CreateCallerOrganization(
ctx context.Context,
req *connect.Request[holos.CreateCallerOrganizationRequest],
) (*connect.Response[holos.GetCallerOrganizationsResponse], error) {
) (*connect.Response[holos.CreateCallerOrganizationResponse], error) {
log := logger.FromContext(ctx)
authnID, err := authn.FromContext(ctx)
if err != nil {
@@ -110,7 +110,7 @@ func (h *OrganizationHandler) CreateCallerOrganization(
rpcOrgs = append(rpcOrgs, OrganizationToRPC(dbOrg))
}
res := connect.NewResponse(&holos.GetCallerOrganizationsResponse{
res := connect.NewResponse(&holos.CreateCallerOrganizationResponse{
User: UserToRPC(dbUser),
Organizations: rpcOrgs,
})

View File

@@ -13,7 +13,7 @@ import (
"github.com/holos-run/holos/internal/ent/user"
"github.com/holos-run/holos/internal/errors"
"github.com/holos-run/holos/internal/server/middleware/authn"
psvc "github.com/holos-run/holos/service/gen/holos/platform/v1alpha1"
holos "github.com/holos-run/holos/service/gen/holos/v1alpha1"
)
// NewPlatformHandler returns a new PlatformService implementation.
@@ -28,21 +28,21 @@ type PlatformHandler struct {
func (h *PlatformHandler) ListPlatforms(
ctx context.Context,
req *connect.Request[psvc.ListPlatformsRequest],
) (*connect.Response[psvc.ListPlatformsResponse], error) {
req *connect.Request[holos.ListPlatformsRequest],
) (*connect.Response[holos.ListPlatformsResponse], error) {
_, reqDBOrg, err := getAuthnUsersOrg(ctx, req.Msg.OrgId, h.db)
if err != nil {
return nil, errors.Wrap(err)
}
resp := &psvc.ListPlatformsResponse{Platforms: rpcPlatforms(reqDBOrg)}
resp := &holos.ListPlatformsResponse{Platforms: rpcPlatforms(reqDBOrg)}
return connect.NewResponse(resp), nil
}
func (h *PlatformHandler) AddPlatform(
ctx context.Context,
req *connect.Request[psvc.AddPlatformRequest],
) (*connect.Response[psvc.AddPlatformResponse], error) {
req *connect.Request[holos.AddPlatformRequest],
) (*connect.Response[holos.AddPlatformResponse], error) {
dbUser, dbOrg, err := getAuthnUsersOrg(ctx, req.Msg.Platform.OrgId, h.db)
if err != nil {
return nil, errors.Wrap(err)
@@ -58,7 +58,7 @@ func (h *PlatformHandler) AddPlatform(
return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Wrap(err))
}
resp := &psvc.AddPlatformResponse{Platforms: rpcPlatforms(dbOrg)}
resp := &holos.AddPlatformResponse{Platforms: rpcPlatforms(dbOrg)}
resp.Platforms = append(resp.Platforms, PlatformToRPC(platform))
return connect.NewResponse(resp), nil
@@ -89,7 +89,7 @@ func (h *PlatformHandler) getPlatform(ctx context.Context, id string, uid authn.
return p, nil
}
func (h *PlatformHandler) GetPlatform(ctx context.Context, req *connect.Request[psvc.GetPlatformRequest]) (*connect.Response[psvc.GetPlatformResponse], error) {
func (h *PlatformHandler) GetPlatform(ctx context.Context, req *connect.Request[holos.GetPlatformRequest]) (*connect.Response[holos.GetPlatformResponse], error) {
authnID, err := authn.FromContext(ctx)
if err != nil {
return nil, connect.NewError(connect.CodePermissionDenied, errors.Wrap(err))
@@ -100,10 +100,10 @@ func (h *PlatformHandler) GetPlatform(ctx context.Context, req *connect.Request[
return nil, errors.Wrap(err)
}
return connect.NewResponse(&psvc.GetPlatformResponse{Platform: PlatformToRPC(p)}), nil
return connect.NewResponse(&holos.GetPlatformResponse{Platform: PlatformToRPC(p)}), nil
}
func (h *PlatformHandler) PutModel(ctx context.Context, req *connect.Request[psvc.PutModelRequest]) (*connect.Response[psvc.PutModelResponse], error) {
func (h *PlatformHandler) PutModel(ctx context.Context, req *connect.Request[holos.PutModelRequest]) (*connect.Response[holos.PutModelResponse], error) {
authnID, err := authn.FromContext(ctx)
if err != nil {
return nil, connect.NewError(connect.CodePermissionDenied, errors.Wrap(err))
@@ -117,16 +117,16 @@ func (h *PlatformHandler) PutModel(ctx context.Context, req *connect.Request[psv
slog.WarnContext(ctx, "todo: validate the platform config against cue definitions", "action", "todo", "cue", len(p.Cue))
_, err = p.Update().
SetModel(&psvc.Model{Model: req.Msg.GetModel()}).
SetModel(&holos.Model{Model: req.Msg.GetModel()}).
Save(ctx)
if err != nil {
return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Wrap(err))
}
return connect.NewResponse(&psvc.PutModelResponse{Model: req.Msg.Model}), nil
return connect.NewResponse(&holos.PutModelResponse{Model: req.Msg.Model}), nil
}
func (h *PlatformHandler) GetModel(ctx context.Context, req *connect.Request[psvc.GetModelRequest]) (*connect.Response[psvc.GetModelResponse], error) {
func (h *PlatformHandler) GetModel(ctx context.Context, req *connect.Request[holos.GetModelRequest]) (*connect.Response[holos.GetModelResponse], error) {
authnID, err := authn.FromContext(ctx)
if err != nil {
return nil, connect.NewError(connect.CodePermissionDenied, errors.Wrap(err))
@@ -137,10 +137,10 @@ func (h *PlatformHandler) GetModel(ctx context.Context, req *connect.Request[psv
return nil, errors.Wrap(err)
}
return connect.NewResponse(&psvc.GetModelResponse{Model: p.Model.Model}), nil
return connect.NewResponse(&holos.GetModelResponse{Model: p.Model.Model}), nil
}
func (h *PlatformHandler) GetForm(ctx context.Context, req *connect.Request[psvc.GetFormRequest]) (*connect.Response[psvc.GetFormResponse], error) {
func (h *PlatformHandler) GetForm(ctx context.Context, req *connect.Request[holos.GetFormRequest]) (*connect.Response[holos.GetFormResponse], error) {
authnID, err := authn.FromContext(ctx)
if err != nil {
return nil, connect.NewError(connect.CodePermissionDenied, errors.Wrap(err))
@@ -151,10 +151,10 @@ func (h *PlatformHandler) GetForm(ctx context.Context, req *connect.Request[psvc
return nil, errors.Wrap(err)
}
return connect.NewResponse(&psvc.GetFormResponse{Fields: p.Form.GetFields(), Model: p.Model.GetModel()}), nil
return connect.NewResponse(&holos.GetFormResponse{Fields: p.Form.GetFields(), Model: p.Model.GetModel()}), nil
}
func (h *PlatformHandler) PutForm(ctx context.Context, req *connect.Request[psvc.PutFormRequest]) (*connect.Response[psvc.PutFormResponse], error) {
func (h *PlatformHandler) PutForm(ctx context.Context, req *connect.Request[holos.PutFormRequest]) (*connect.Response[holos.PutFormResponse], error) {
authnID, err := authn.FromContext(ctx)
if err != nil {
return nil, connect.NewError(connect.CodePermissionDenied, errors.Wrap(err))
@@ -166,23 +166,23 @@ func (h *PlatformHandler) PutForm(ctx context.Context, req *connect.Request[psvc
}
_, err = p.Update().
SetForm(&psvc.Form{Fields: req.Msg.GetFields()}).
SetForm(&holos.Form{Fields: req.Msg.GetFields()}).
Save(ctx)
if err != nil {
return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Wrap(err))
}
resp := &psvc.PutFormResponse{Fields: req.Msg.GetFields()}
resp := &holos.PutFormResponse{Fields: req.Msg.GetFields()}
return connect.NewResponse(resp), nil
}
func PlatformToRPC(platform *ent.Platform) *psvc.Platform {
return &psvc.Platform{
func PlatformToRPC(platform *ent.Platform) *holos.Platform {
return &holos.Platform{
Id: platform.ID.String(),
Name: platform.Name,
DisplayName: platform.DisplayName,
OrgId: platform.OrgID.String(),
Spec: &psvc.PlatformSpec{Model: platform.Model.GetModel()},
Spec: &holos.PlatformSpec{Model: platform.Model.GetModel()},
}
}
@@ -234,12 +234,12 @@ func getAuthnUsersOrg(ctx context.Context, orgID string, db *ent.Client) (*ent.U
return dbUser, reqDBOrg, nil
}
func rpcPlatforms(reqDBOrg *ent.Organization) []*psvc.Platform {
func rpcPlatforms(reqDBOrg *ent.Organization) []*holos.Platform {
if reqDBOrg == nil {
return nil
}
// one extra in case a new platform is appended.
platforms := make([]*psvc.Platform, 0, 1+len(reqDBOrg.Edges.Platforms))
platforms := make([]*holos.Platform, 0, 1+len(reqDBOrg.Edges.Platforms))
for _, platform := range reqDBOrg.Edges.Platforms {
platforms = append(platforms, PlatformToRPC(platform))
}

View File

@@ -12,7 +12,6 @@ import (
"github.com/holos-run/holos/internal/errors"
"github.com/holos-run/holos/internal/server/middleware/authn"
"github.com/holos-run/holos/internal/server/middleware/logger"
psvc "github.com/holos-run/holos/service/gen/holos/platform/v1alpha1"
holos "github.com/holos-run/holos/service/gen/holos/v1alpha1"
)
@@ -40,7 +39,7 @@ func (h *SystemHandler) checkAdmin(ctx context.Context) error {
return nil
}
func (h *SystemHandler) DropTables(ctx context.Context, req *connect.Request[holos.EmptyRequest]) (*connect.Response[holos.EmptyResponse], error) {
func (h *SystemHandler) DropTables(ctx context.Context, req *connect.Request[holos.DropTablesRequest]) (*connect.Response[holos.DropTablesResponse], error) {
if err := h.checkAdmin(ctx); err != nil {
return nil, err
}
@@ -65,10 +64,10 @@ func (h *SystemHandler) DropTables(ctx context.Context, req *connect.Request[hol
return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Wrap(err))
}
return connect.NewResponse(&holos.EmptyResponse{}), nil
return connect.NewResponse(&holos.DropTablesResponse{}), nil
}
func (h *SystemHandler) SeedDatabase(ctx context.Context, req *connect.Request[holos.EmptyRequest]) (*connect.Response[holos.EmptyResponse], error) {
func (h *SystemHandler) SeedDatabase(ctx context.Context, req *connect.Request[holos.SeedDatabaseRequest]) (*connect.Response[holos.SeedDatabaseResponse], error) {
if err := h.checkAdmin(ctx); err != nil {
return nil, err
}
@@ -120,12 +119,12 @@ func (h *SystemHandler) SeedDatabase(ctx context.Context, req *connect.Request[h
return errors.Wrap(err)
}
var form psvc.Form
var form holos.Form
if err := json.Unmarshal([]byte(BareForm), &form); err != nil {
return errors.Wrap(err)
}
var model psvc.Model
var model holos.Model
if err := json.Unmarshal([]byte(Model), &model); err != nil {
return errors.Wrap(err)
}
@@ -164,7 +163,7 @@ func (h *SystemHandler) SeedDatabase(ctx context.Context, req *connect.Request[h
return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Wrap(err))
}
return connect.NewResponse(&holos.EmptyResponse{}), nil
return connect.NewResponse(&holos.SeedDatabaseResponse{}), nil
}
const Model = `{"model":{}}`

View File

@@ -17,7 +17,6 @@ import (
"github.com/holos-run/holos/internal/server/handler"
"github.com/holos-run/holos/internal/server/middleware/authn"
"github.com/holos-run/holos/internal/server/middleware/logger"
"github.com/holos-run/holos/service/gen/holos/platform/v1alpha1/platformconnect"
"github.com/holos-run/holos/service/gen/holos/v1alpha1/holosconnect"
"github.com/prometheus/client_golang/prometheus/promhttp"
"golang.org/x/net/http2"
@@ -115,13 +114,13 @@ func (s *Server) registerConnectRpc() error {
s.handle(holosconnect.NewUserServiceHandler(handler.NewUserHandler(s.db), opts))
s.handle(holosconnect.NewOrganizationServiceHandler(handler.NewOrganizationHandler(s.db), opts))
s.handle(platformconnect.NewPlatformServiceHandler(handler.NewPlatformHandler(s.db), opts))
s.handle(holosconnect.NewPlatformServiceHandler(handler.NewPlatformHandler(s.db), opts))
s.handle(holosconnect.NewSystemServiceHandler(handler.NewSystemHandler(s.db), opts))
reflector := grpcreflect.NewStaticReflector(
holosconnect.UserServiceName,
holosconnect.OrganizationServiceName,
platformconnect.PlatformServiceName,
holosconnect.PlatformServiceName,
holosconnect.SystemServiceName,
)

View File

@@ -20,16 +20,21 @@ message Organization {
Creator creator = 5;
}
message GetCallerOrganizationsRequest {}
message ListCallerOrganizationsRequest {}
message GetCallerOrganizationsResponse {
message ListCallerOrganizationsResponse {
User user = 1;
repeated Organization organizations = 2;
}
message CreateCallerOrganizationRequest {}
service OrganizationService {
rpc GetCallerOrganizations(GetCallerOrganizationsRequest) returns (GetCallerOrganizationsResponse) {}
rpc CreateCallerOrganization(CreateCallerOrganizationRequest) returns (GetCallerOrganizationsResponse) {}
message CreateCallerOrganizationResponse {
User user = 1;
repeated Organization organizations = 2;
}
service OrganizationService {
rpc ListCallerOrganizations(ListCallerOrganizationsRequest) returns (ListCallerOrganizationsResponse) {}
rpc CreateCallerOrganization(CreateCallerOrganizationRequest) returns (CreateCallerOrganizationResponse) {}
}

View File

@@ -1,7 +1,7 @@
syntax = "proto3";
package holos.platform.v1alpha1;
option go_package = "github.com/holos-run/holos/service/gen/holos/platform/v1alpha1;platform";
package holos.v1alpha1;
option go_package = "github.com/holos-run/holos/service/gen/holos/v1alpha1;holos";
// git clone https://github.com/bufbuild/protovalidate then add <parent>/protovalidate/proto/protovalidate to your editor proto search path
import "buf/validate/validate.proto";

View File

@@ -5,16 +5,16 @@ package holos.v1alpha1;
option go_package = "github.com/holos-run/holos/service/gen/holos/v1alpha1;holos";
// git clone https://github.com/bufbuild/protovalidate then add <parent>/protovalidate/proto/protovalidate to your editor proto search path
import "buf/validate/validate.proto";
import "holos/v1alpha1/timestamps.proto";
import "holos/v1alpha1/user.proto";
// For validation, see the [Standard constraints](https://github.com/bufbuild/protovalidate/blob/main/docs/standard-constraints.md)
message EmptyRequest {}
message EmptyResponse {}
message SeedDatabaseRequest {}
message SeedDatabaseResponse {}
message DropTablesRequest {}
message DropTablesResponse {}
service SystemService {
rpc SeedDatabase(EmptyRequest) returns (EmptyResponse) {}
rpc DropTables(EmptyRequest) returns (EmptyResponse) {}
rpc SeedDatabase(SeedDatabaseRequest) returns (SeedDatabaseResponse) {}
rpc DropTables(DropTablesRequest) returns (DropTablesResponse) {}
}

View File

@@ -4,7 +4,6 @@ package holos.v1alpha1;
option go_package = "github.com/holos-run/holos/service/gen/holos/v1alpha1;holos";
import "google/protobuf/timestamp.proto";
// git clone https://github.com/bufbuild/protovalidate then add <parent>/protovalidate/proto/protovalidate to your editor proto search path
import "buf/validate/validate.proto";
import "holos/v1alpha1/timestamps.proto";

View File

@@ -1 +1 @@
73
74

View File

@@ -1 +1 @@
1
0