diff --git a/drip/api.gen.go b/drip/api.gen.go index ef501dd..f67c56a 100644 --- a/drip/api.gen.go +++ b/drip/api.gen.go @@ -517,7 +517,8 @@ type ListNodeVersionsParams struct { // CreateComfyNodesJSONBody defines parameters for CreateComfyNodes. type CreateComfyNodesJSONBody struct { - Nodes *map[string]ComfyNode `json:"nodes,omitempty"` + Nodes *map[string]ComfyNode `json:"nodes,omitempty"` + Success *bool `json:"success,omitempty"` } // ValidatePublisherParams defines parameters for ValidatePublisher. @@ -4971,42 +4972,43 @@ var swaggerSpec = []string{ "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", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/ent/ciworkflowresult_query.go b/ent/ciworkflowresult_query.go index 5b438d3..ce7f3aa 100644 --- a/ent/ciworkflowresult_query.go +++ b/ent/ciworkflowresult_query.go @@ -12,6 +12,7 @@ import ( "registry-backend/ent/predicate" "registry-backend/ent/storagefile" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -113,7 +114,7 @@ func (cwrq *CIWorkflowResultQuery) QueryStorageFile() *StorageFileQuery { // First returns the first CIWorkflowResult entity from the query. // Returns a *NotFoundError when no CIWorkflowResult was found. func (cwrq *CIWorkflowResultQuery) First(ctx context.Context) (*CIWorkflowResult, error) { - nodes, err := cwrq.Limit(1).All(setContextOp(ctx, cwrq.ctx, "First")) + nodes, err := cwrq.Limit(1).All(setContextOp(ctx, cwrq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -136,7 +137,7 @@ func (cwrq *CIWorkflowResultQuery) FirstX(ctx context.Context) *CIWorkflowResult // Returns a *NotFoundError when no CIWorkflowResult ID was found. func (cwrq *CIWorkflowResultQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = cwrq.Limit(1).IDs(setContextOp(ctx, cwrq.ctx, "FirstID")); err != nil { + if ids, err = cwrq.Limit(1).IDs(setContextOp(ctx, cwrq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -159,7 +160,7 @@ func (cwrq *CIWorkflowResultQuery) FirstIDX(ctx context.Context) uuid.UUID { // Returns a *NotSingularError when more than one CIWorkflowResult entity is found. // Returns a *NotFoundError when no CIWorkflowResult entities are found. func (cwrq *CIWorkflowResultQuery) Only(ctx context.Context) (*CIWorkflowResult, error) { - nodes, err := cwrq.Limit(2).All(setContextOp(ctx, cwrq.ctx, "Only")) + nodes, err := cwrq.Limit(2).All(setContextOp(ctx, cwrq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -187,7 +188,7 @@ func (cwrq *CIWorkflowResultQuery) OnlyX(ctx context.Context) *CIWorkflowResult // Returns a *NotFoundError when no entities are found. func (cwrq *CIWorkflowResultQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = cwrq.Limit(2).IDs(setContextOp(ctx, cwrq.ctx, "OnlyID")); err != nil { + if ids, err = cwrq.Limit(2).IDs(setContextOp(ctx, cwrq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -212,7 +213,7 @@ func (cwrq *CIWorkflowResultQuery) OnlyIDX(ctx context.Context) uuid.UUID { // All executes the query and returns a list of CIWorkflowResults. func (cwrq *CIWorkflowResultQuery) All(ctx context.Context) ([]*CIWorkflowResult, error) { - ctx = setContextOp(ctx, cwrq.ctx, "All") + ctx = setContextOp(ctx, cwrq.ctx, ent.OpQueryAll) if err := cwrq.prepareQuery(ctx); err != nil { return nil, err } @@ -234,7 +235,7 @@ func (cwrq *CIWorkflowResultQuery) IDs(ctx context.Context) (ids []uuid.UUID, er if cwrq.ctx.Unique == nil && cwrq.path != nil { cwrq.Unique(true) } - ctx = setContextOp(ctx, cwrq.ctx, "IDs") + ctx = setContextOp(ctx, cwrq.ctx, ent.OpQueryIDs) if err = cwrq.Select(ciworkflowresult.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -252,7 +253,7 @@ func (cwrq *CIWorkflowResultQuery) IDsX(ctx context.Context) []uuid.UUID { // Count returns the count of the given query. func (cwrq *CIWorkflowResultQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, cwrq.ctx, "Count") + ctx = setContextOp(ctx, cwrq.ctx, ent.OpQueryCount) if err := cwrq.prepareQuery(ctx); err != nil { return 0, err } @@ -270,7 +271,7 @@ func (cwrq *CIWorkflowResultQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (cwrq *CIWorkflowResultQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, cwrq.ctx, "Exist") + ctx = setContextOp(ctx, cwrq.ctx, ent.OpQueryExist) switch _, err := cwrq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -305,8 +306,9 @@ func (cwrq *CIWorkflowResultQuery) Clone() *CIWorkflowResultQuery { withGitcommit: cwrq.withGitcommit.Clone(), withStorageFile: cwrq.withStorageFile.Clone(), // clone intermediate query. - sql: cwrq.sql.Clone(), - path: cwrq.path, + sql: cwrq.sql.Clone(), + path: cwrq.path, + modifiers: append([]func(*sql.Selector){}, cwrq.modifiers...), } } @@ -656,7 +658,7 @@ func (cwrgb *CIWorkflowResultGroupBy) Aggregate(fns ...AggregateFunc) *CIWorkflo // Scan applies the selector query and scans the result into the given value. func (cwrgb *CIWorkflowResultGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cwrgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, cwrgb.build.ctx, ent.OpQueryGroupBy) if err := cwrgb.build.prepareQuery(ctx); err != nil { return err } @@ -704,7 +706,7 @@ func (cwrs *CIWorkflowResultSelect) Aggregate(fns ...AggregateFunc) *CIWorkflowR // Scan applies the selector query and scans the result into the given value. func (cwrs *CIWorkflowResultSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cwrs.ctx, "Select") + ctx = setContextOp(ctx, cwrs.ctx, ent.OpQuerySelect) if err := cwrs.prepareQuery(ctx); err != nil { return err } diff --git a/ent/comfynode_create.go b/ent/comfynode_create.go index 9b9fb13..d9cc9a9 100644 --- a/ent/comfynode_create.go +++ b/ent/comfynode_create.go @@ -270,7 +270,7 @@ func (cnc *ComfyNodeCreate) check() error { if _, ok := cnc.mutation.ReturnNames(); !ok { return &ValidationError{Name: "return_names", err: errors.New(`ent: missing required field "ComfyNode.return_names"`)} } - if _, ok := cnc.mutation.VersionsID(); !ok { + if len(cnc.mutation.VersionsIDs()) == 0 { return &ValidationError{Name: "versions", err: errors.New(`ent: missing required edge "ComfyNode.versions"`)} } return nil diff --git a/ent/comfynode_query.go b/ent/comfynode_query.go index 1f0f0d3..4998b2f 100644 --- a/ent/comfynode_query.go +++ b/ent/comfynode_query.go @@ -10,6 +10,7 @@ import ( "registry-backend/ent/nodeversion" "registry-backend/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -87,7 +88,7 @@ func (cnq *ComfyNodeQuery) QueryVersions() *NodeVersionQuery { // First returns the first ComfyNode entity from the query. // Returns a *NotFoundError when no ComfyNode was found. func (cnq *ComfyNodeQuery) First(ctx context.Context) (*ComfyNode, error) { - nodes, err := cnq.Limit(1).All(setContextOp(ctx, cnq.ctx, "First")) + nodes, err := cnq.Limit(1).All(setContextOp(ctx, cnq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -110,7 +111,7 @@ func (cnq *ComfyNodeQuery) FirstX(ctx context.Context) *ComfyNode { // Returns a *NotFoundError when no ComfyNode ID was found. func (cnq *ComfyNodeQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = cnq.Limit(1).IDs(setContextOp(ctx, cnq.ctx, "FirstID")); err != nil { + if ids, err = cnq.Limit(1).IDs(setContextOp(ctx, cnq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -133,7 +134,7 @@ func (cnq *ComfyNodeQuery) FirstIDX(ctx context.Context) string { // Returns a *NotSingularError when more than one ComfyNode entity is found. // Returns a *NotFoundError when no ComfyNode entities are found. func (cnq *ComfyNodeQuery) Only(ctx context.Context) (*ComfyNode, error) { - nodes, err := cnq.Limit(2).All(setContextOp(ctx, cnq.ctx, "Only")) + nodes, err := cnq.Limit(2).All(setContextOp(ctx, cnq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -161,7 +162,7 @@ func (cnq *ComfyNodeQuery) OnlyX(ctx context.Context) *ComfyNode { // Returns a *NotFoundError when no entities are found. func (cnq *ComfyNodeQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = cnq.Limit(2).IDs(setContextOp(ctx, cnq.ctx, "OnlyID")); err != nil { + if ids, err = cnq.Limit(2).IDs(setContextOp(ctx, cnq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -186,7 +187,7 @@ func (cnq *ComfyNodeQuery) OnlyIDX(ctx context.Context) string { // All executes the query and returns a list of ComfyNodes. func (cnq *ComfyNodeQuery) All(ctx context.Context) ([]*ComfyNode, error) { - ctx = setContextOp(ctx, cnq.ctx, "All") + ctx = setContextOp(ctx, cnq.ctx, ent.OpQueryAll) if err := cnq.prepareQuery(ctx); err != nil { return nil, err } @@ -208,7 +209,7 @@ func (cnq *ComfyNodeQuery) IDs(ctx context.Context) (ids []string, err error) { if cnq.ctx.Unique == nil && cnq.path != nil { cnq.Unique(true) } - ctx = setContextOp(ctx, cnq.ctx, "IDs") + ctx = setContextOp(ctx, cnq.ctx, ent.OpQueryIDs) if err = cnq.Select(comfynode.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -226,7 +227,7 @@ func (cnq *ComfyNodeQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (cnq *ComfyNodeQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, cnq.ctx, "Count") + ctx = setContextOp(ctx, cnq.ctx, ent.OpQueryCount) if err := cnq.prepareQuery(ctx); err != nil { return 0, err } @@ -244,7 +245,7 @@ func (cnq *ComfyNodeQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (cnq *ComfyNodeQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, cnq.ctx, "Exist") + ctx = setContextOp(ctx, cnq.ctx, ent.OpQueryExist) switch _, err := cnq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -278,8 +279,9 @@ func (cnq *ComfyNodeQuery) Clone() *ComfyNodeQuery { predicates: append([]predicate.ComfyNode{}, cnq.predicates...), withVersions: cnq.withVersions.Clone(), // clone intermediate query. - sql: cnq.sql.Clone(), - path: cnq.path, + sql: cnq.sql.Clone(), + path: cnq.path, + modifiers: append([]func(*sql.Selector){}, cnq.modifiers...), } } @@ -572,7 +574,7 @@ func (cngb *ComfyNodeGroupBy) Aggregate(fns ...AggregateFunc) *ComfyNodeGroupBy // Scan applies the selector query and scans the result into the given value. func (cngb *ComfyNodeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cngb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, cngb.build.ctx, ent.OpQueryGroupBy) if err := cngb.build.prepareQuery(ctx); err != nil { return err } @@ -620,7 +622,7 @@ func (cns *ComfyNodeSelect) Aggregate(fns ...AggregateFunc) *ComfyNodeSelect { // Scan applies the selector query and scans the result into the given value. func (cns *ComfyNodeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cns.ctx, "Select") + ctx = setContextOp(ctx, cns.ctx, ent.OpQuerySelect) if err := cns.prepareQuery(ctx); err != nil { return err } diff --git a/ent/comfynode_update.go b/ent/comfynode_update.go index 87b09d6..814a74a 100644 --- a/ent/comfynode_update.go +++ b/ent/comfynode_update.go @@ -264,7 +264,7 @@ func (cnu *ComfyNodeUpdate) defaults() { // check runs all checks and user-defined validators on the builder. func (cnu *ComfyNodeUpdate) check() error { - if _, ok := cnu.mutation.VersionsID(); cnu.mutation.VersionsCleared() && !ok { + if cnu.mutation.VersionsCleared() && len(cnu.mutation.VersionsIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "ComfyNode.versions"`) } return nil @@ -639,7 +639,7 @@ func (cnuo *ComfyNodeUpdateOne) defaults() { // check runs all checks and user-defined validators on the builder. func (cnuo *ComfyNodeUpdateOne) check() error { - if _, ok := cnuo.mutation.VersionsID(); cnuo.mutation.VersionsCleared() && !ok { + if cnuo.mutation.VersionsCleared() && len(cnuo.mutation.VersionsIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "ComfyNode.versions"`) } return nil diff --git a/ent/ent.go b/ent/ent.go index 987d9fe..2f31e89 100644 --- a/ent/ent.go +++ b/ent/ent.go @@ -79,7 +79,7 @@ var ( columnCheck sql.ColumnCheck ) -// columnChecker checks if the column exists in the given table. +// checkColumn checks if the column exists in the given table. func checkColumn(table, column string) error { initCheck.Do(func() { columnCheck = sql.NewColumnCheck(map[string]func(string) bool{ diff --git a/ent/enttest/enttest.go b/ent/enttest/enttest.go index 78e3f25..ace3799 100644 --- a/ent/enttest/enttest.go +++ b/ent/enttest/enttest.go @@ -4,6 +4,7 @@ package enttest import ( "context" + "registry-backend/ent" // required by schema hooks. _ "registry-backend/ent/runtime" diff --git a/ent/gitcommit_query.go b/ent/gitcommit_query.go index e6c7f0c..1354be9 100644 --- a/ent/gitcommit_query.go +++ b/ent/gitcommit_query.go @@ -11,6 +11,7 @@ import ( "registry-backend/ent/gitcommit" "registry-backend/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -88,7 +89,7 @@ func (gcq *GitCommitQuery) QueryResults() *CIWorkflowResultQuery { // First returns the first GitCommit entity from the query. // Returns a *NotFoundError when no GitCommit was found. func (gcq *GitCommitQuery) First(ctx context.Context) (*GitCommit, error) { - nodes, err := gcq.Limit(1).All(setContextOp(ctx, gcq.ctx, "First")) + nodes, err := gcq.Limit(1).All(setContextOp(ctx, gcq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -111,7 +112,7 @@ func (gcq *GitCommitQuery) FirstX(ctx context.Context) *GitCommit { // Returns a *NotFoundError when no GitCommit ID was found. func (gcq *GitCommitQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = gcq.Limit(1).IDs(setContextOp(ctx, gcq.ctx, "FirstID")); err != nil { + if ids, err = gcq.Limit(1).IDs(setContextOp(ctx, gcq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -134,7 +135,7 @@ func (gcq *GitCommitQuery) FirstIDX(ctx context.Context) uuid.UUID { // Returns a *NotSingularError when more than one GitCommit entity is found. // Returns a *NotFoundError when no GitCommit entities are found. func (gcq *GitCommitQuery) Only(ctx context.Context) (*GitCommit, error) { - nodes, err := gcq.Limit(2).All(setContextOp(ctx, gcq.ctx, "Only")) + nodes, err := gcq.Limit(2).All(setContextOp(ctx, gcq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -162,7 +163,7 @@ func (gcq *GitCommitQuery) OnlyX(ctx context.Context) *GitCommit { // Returns a *NotFoundError when no entities are found. func (gcq *GitCommitQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = gcq.Limit(2).IDs(setContextOp(ctx, gcq.ctx, "OnlyID")); err != nil { + if ids, err = gcq.Limit(2).IDs(setContextOp(ctx, gcq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -187,7 +188,7 @@ func (gcq *GitCommitQuery) OnlyIDX(ctx context.Context) uuid.UUID { // All executes the query and returns a list of GitCommits. func (gcq *GitCommitQuery) All(ctx context.Context) ([]*GitCommit, error) { - ctx = setContextOp(ctx, gcq.ctx, "All") + ctx = setContextOp(ctx, gcq.ctx, ent.OpQueryAll) if err := gcq.prepareQuery(ctx); err != nil { return nil, err } @@ -209,7 +210,7 @@ func (gcq *GitCommitQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) if gcq.ctx.Unique == nil && gcq.path != nil { gcq.Unique(true) } - ctx = setContextOp(ctx, gcq.ctx, "IDs") + ctx = setContextOp(ctx, gcq.ctx, ent.OpQueryIDs) if err = gcq.Select(gitcommit.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -227,7 +228,7 @@ func (gcq *GitCommitQuery) IDsX(ctx context.Context) []uuid.UUID { // Count returns the count of the given query. func (gcq *GitCommitQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, gcq.ctx, "Count") + ctx = setContextOp(ctx, gcq.ctx, ent.OpQueryCount) if err := gcq.prepareQuery(ctx); err != nil { return 0, err } @@ -245,7 +246,7 @@ func (gcq *GitCommitQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (gcq *GitCommitQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, gcq.ctx, "Exist") + ctx = setContextOp(ctx, gcq.ctx, ent.OpQueryExist) switch _, err := gcq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -279,8 +280,9 @@ func (gcq *GitCommitQuery) Clone() *GitCommitQuery { predicates: append([]predicate.GitCommit{}, gcq.predicates...), withResults: gcq.withResults.Clone(), // clone intermediate query. - sql: gcq.sql.Clone(), - path: gcq.path, + sql: gcq.sql.Clone(), + path: gcq.path, + modifiers: append([]func(*sql.Selector){}, gcq.modifiers...), } } @@ -573,7 +575,7 @@ func (gcgb *GitCommitGroupBy) Aggregate(fns ...AggregateFunc) *GitCommitGroupBy // Scan applies the selector query and scans the result into the given value. func (gcgb *GitCommitGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gcgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, gcgb.build.ctx, ent.OpQueryGroupBy) if err := gcgb.build.prepareQuery(ctx); err != nil { return err } @@ -621,7 +623,7 @@ func (gcs *GitCommitSelect) Aggregate(fns ...AggregateFunc) *GitCommitSelect { // Scan applies the selector query and scans the result into the given value. func (gcs *GitCommitSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gcs.ctx, "Select") + ctx = setContextOp(ctx, gcs.ctx, ent.OpQuerySelect) if err := gcs.prepareQuery(ctx); err != nil { return err } diff --git a/ent/migrate/migrations/20250108174943_migration.sql b/ent/migrate/migrations/20250108174943_migration.sql new file mode 100644 index 0000000..cbc90e7 --- /dev/null +++ b/ent/migrate/migrations/20250108174943_migration.sql @@ -0,0 +1,2 @@ +-- Modify "node_versions" table +ALTER TABLE "node_versions" ADD COLUMN "comfy_node_extract_status" character varying NOT NULL DEFAULT 'pending'; diff --git a/ent/migrate/migrations/atlas.sum b/ent/migrate/migrations/atlas.sum index a51722d..56f5878 100644 --- a/ent/migrate/migrations/atlas.sum +++ b/ent/migrate/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:8SOJUFGRssSFdXBeGuzVrSFCGl1tbQzcRmYLySPuCjw= +h1:z4k6rHKyxqhuNcbt2GYDUqjQji24QgI/bWCTtuF9Sgo= 20240526144817_migration.sql h1:sP6keX+oMyLL2qpIFx0Ns0WYfWM5hJ4zkFPmLWT68fM= 20240528220411_migration.sql h1:SR44sOEaWbDgYCKJZIKcGCI7Ta+LqL71z225Nhs2+HM= 20240528221846_migration.sql h1:EkUonGI9Bu689qWX4pG3PRC+On4f6u7UvwDbaR8mCNk= @@ -19,3 +19,4 @@ h1:8SOJUFGRssSFdXBeGuzVrSFCGl1tbQzcRmYLySPuCjw= 20241226025206_migration.sql h1:y/ZYZYi3KBibAhuFxxBbuNbcnLs7pdVvtmj1pXedmiY= 20241231175239_migration.sql h1:igqzI6zZ87Q80+JLQTqFg0TbxyLWxeZlByO3WLVhjb0= 20241231182546_migration.sql h1:vqeCFbEp44x7DPYxTK+2inBDwAMiEo+uHO9BO/hthl8= +20250108174943_migration.sql h1:+/kcuH84DfLheAwpLyJc2UQHNTxxEjO3wRuYddL4Nkc= diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index c0dc408..56b1b0d 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -187,6 +187,7 @@ var ( {Name: "deprecated", Type: field.TypeBool, Default: false}, {Name: "status", Type: field.TypeEnum, Enums: []string{"active", "banned", "deleted", "pending", "flagged"}, Default: "pending"}, {Name: "status_reason", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}}, + {Name: "comfy_node_extract_status", Type: field.TypeString, Default: "pending"}, {Name: "node_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}}, {Name: "node_version_storage_file", Type: field.TypeUUID, Nullable: true}, } @@ -198,13 +199,13 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "node_versions_nodes_versions", - Columns: []*schema.Column{NodeVersionsColumns[9]}, + Columns: []*schema.Column{NodeVersionsColumns[10]}, RefColumns: []*schema.Column{NodesColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "node_versions_storage_files_storage_file", - Columns: []*schema.Column{NodeVersionsColumns[10]}, + Columns: []*schema.Column{NodeVersionsColumns[11]}, RefColumns: []*schema.Column{StorageFilesColumns[0]}, OnDelete: schema.SetNull, }, @@ -213,7 +214,7 @@ var ( { Name: "nodeversion_node_id_version", Unique: true, - Columns: []*schema.Column{NodeVersionsColumns[9], NodeVersionsColumns[3]}, + Columns: []*schema.Column{NodeVersionsColumns[10], NodeVersionsColumns[3]}, }, }, } diff --git a/ent/mutation.go b/ent/mutation.go index 15c9661..f20a3ab 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -6039,29 +6039,30 @@ func (m *NodeReviewMutation) ResetEdge(name string) error { // NodeVersionMutation represents an operation that mutates the NodeVersion nodes in the graph. type NodeVersionMutation struct { config - op Op - typ string - id *uuid.UUID - create_time *time.Time - update_time *time.Time - version *string - changelog *string - pip_dependencies *[]string - appendpip_dependencies []string - deprecated *bool - status *schema.NodeVersionStatus - status_reason *string - clearedFields map[string]struct{} - node *string - clearednode bool - storage_file *uuid.UUID - clearedstorage_file bool - comfy_nodes map[string]struct{} - removedcomfy_nodes map[string]struct{} - clearedcomfy_nodes bool - done bool - oldValue func(context.Context) (*NodeVersion, error) - predicates []predicate.NodeVersion + op Op + typ string + id *uuid.UUID + create_time *time.Time + update_time *time.Time + version *string + changelog *string + pip_dependencies *[]string + appendpip_dependencies []string + deprecated *bool + status *schema.NodeVersionStatus + status_reason *string + comfy_node_extract_status *schema.ComfyNodeExtractStatus + clearedFields map[string]struct{} + node *string + clearednode bool + storage_file *uuid.UUID + clearedstorage_file bool + comfy_nodes map[string]struct{} + removedcomfy_nodes map[string]struct{} + clearedcomfy_nodes bool + done bool + oldValue func(context.Context) (*NodeVersion, error) + predicates []predicate.NodeVersion } var _ ent.Mutation = (*NodeVersionMutation)(nil) @@ -6520,6 +6521,42 @@ func (m *NodeVersionMutation) ResetStatusReason() { m.status_reason = nil } +// SetComfyNodeExtractStatus sets the "comfy_node_extract_status" field. +func (m *NodeVersionMutation) SetComfyNodeExtractStatus(snes schema.ComfyNodeExtractStatus) { + m.comfy_node_extract_status = &snes +} + +// ComfyNodeExtractStatus returns the value of the "comfy_node_extract_status" field in the mutation. +func (m *NodeVersionMutation) ComfyNodeExtractStatus() (r schema.ComfyNodeExtractStatus, exists bool) { + v := m.comfy_node_extract_status + if v == nil { + return + } + return *v, true +} + +// OldComfyNodeExtractStatus returns the old "comfy_node_extract_status" field's value of the NodeVersion entity. +// If the NodeVersion 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 *NodeVersionMutation) OldComfyNodeExtractStatus(ctx context.Context) (v schema.ComfyNodeExtractStatus, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldComfyNodeExtractStatus is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldComfyNodeExtractStatus requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldComfyNodeExtractStatus: %w", err) + } + return oldValue.ComfyNodeExtractStatus, nil +} + +// ResetComfyNodeExtractStatus resets all changes to the "comfy_node_extract_status" field. +func (m *NodeVersionMutation) ResetComfyNodeExtractStatus() { + m.comfy_node_extract_status = nil +} + // ClearNode clears the "node" edge to the Node entity. func (m *NodeVersionMutation) ClearNode() { m.clearednode = true @@ -6674,7 +6711,7 @@ func (m *NodeVersionMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *NodeVersionMutation) Fields() []string { - fields := make([]string, 0, 9) + fields := make([]string, 0, 10) if m.create_time != nil { fields = append(fields, nodeversion.FieldCreateTime) } @@ -6702,6 +6739,9 @@ func (m *NodeVersionMutation) Fields() []string { if m.status_reason != nil { fields = append(fields, nodeversion.FieldStatusReason) } + if m.comfy_node_extract_status != nil { + fields = append(fields, nodeversion.FieldComfyNodeExtractStatus) + } return fields } @@ -6728,6 +6768,8 @@ func (m *NodeVersionMutation) Field(name string) (ent.Value, bool) { return m.Status() case nodeversion.FieldStatusReason: return m.StatusReason() + case nodeversion.FieldComfyNodeExtractStatus: + return m.ComfyNodeExtractStatus() } return nil, false } @@ -6755,6 +6797,8 @@ func (m *NodeVersionMutation) OldField(ctx context.Context, name string) (ent.Va return m.OldStatus(ctx) case nodeversion.FieldStatusReason: return m.OldStatusReason(ctx) + case nodeversion.FieldComfyNodeExtractStatus: + return m.OldComfyNodeExtractStatus(ctx) } return nil, fmt.Errorf("unknown NodeVersion field %s", name) } @@ -6827,6 +6871,13 @@ func (m *NodeVersionMutation) SetField(name string, value ent.Value) error { } m.SetStatusReason(v) return nil + case nodeversion.FieldComfyNodeExtractStatus: + v, ok := value.(schema.ComfyNodeExtractStatus) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetComfyNodeExtractStatus(v) + return nil } return fmt.Errorf("unknown NodeVersion field %s", name) } @@ -6912,6 +6963,9 @@ func (m *NodeVersionMutation) ResetField(name string) error { case nodeversion.FieldStatusReason: m.ResetStatusReason() return nil + case nodeversion.FieldComfyNodeExtractStatus: + m.ResetComfyNodeExtractStatus() + return nil } return fmt.Errorf("unknown NodeVersion field %s", name) } diff --git a/ent/node_create.go b/ent/node_create.go index 06f8b57..749c76e 100644 --- a/ent/node_create.go +++ b/ent/node_create.go @@ -358,7 +358,7 @@ func (nc *NodeCreate) check() error { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Node.status": %w`, err)} } } - if _, ok := nc.mutation.PublisherID(); !ok { + if len(nc.mutation.PublisherIDs()) == 0 { return &ValidationError{Name: "publisher", err: errors.New(`ent: missing required edge "Node.publisher"`)} } return nil diff --git a/ent/node_query.go b/ent/node_query.go index 87dd563..6075019 100644 --- a/ent/node_query.go +++ b/ent/node_query.go @@ -13,6 +13,7 @@ import ( "registry-backend/ent/predicate" "registry-backend/ent/publisher" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -135,7 +136,7 @@ func (nq *NodeQuery) QueryReviews() *NodeReviewQuery { // First returns the first Node entity from the query. // Returns a *NotFoundError when no Node was found. func (nq *NodeQuery) First(ctx context.Context) (*Node, error) { - nodes, err := nq.Limit(1).All(setContextOp(ctx, nq.ctx, "First")) + nodes, err := nq.Limit(1).All(setContextOp(ctx, nq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -158,7 +159,7 @@ func (nq *NodeQuery) FirstX(ctx context.Context) *Node { // Returns a *NotFoundError when no Node ID was found. func (nq *NodeQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = nq.Limit(1).IDs(setContextOp(ctx, nq.ctx, "FirstID")); err != nil { + if ids, err = nq.Limit(1).IDs(setContextOp(ctx, nq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -181,7 +182,7 @@ func (nq *NodeQuery) FirstIDX(ctx context.Context) string { // Returns a *NotSingularError when more than one Node entity is found. // Returns a *NotFoundError when no Node entities are found. func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) { - nodes, err := nq.Limit(2).All(setContextOp(ctx, nq.ctx, "Only")) + nodes, err := nq.Limit(2).All(setContextOp(ctx, nq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -209,7 +210,7 @@ func (nq *NodeQuery) OnlyX(ctx context.Context) *Node { // Returns a *NotFoundError when no entities are found. func (nq *NodeQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = nq.Limit(2).IDs(setContextOp(ctx, nq.ctx, "OnlyID")); err != nil { + if ids, err = nq.Limit(2).IDs(setContextOp(ctx, nq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -234,7 +235,7 @@ func (nq *NodeQuery) OnlyIDX(ctx context.Context) string { // All executes the query and returns a list of Nodes. func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error) { - ctx = setContextOp(ctx, nq.ctx, "All") + ctx = setContextOp(ctx, nq.ctx, ent.OpQueryAll) if err := nq.prepareQuery(ctx); err != nil { return nil, err } @@ -256,7 +257,7 @@ func (nq *NodeQuery) IDs(ctx context.Context) (ids []string, err error) { if nq.ctx.Unique == nil && nq.path != nil { nq.Unique(true) } - ctx = setContextOp(ctx, nq.ctx, "IDs") + ctx = setContextOp(ctx, nq.ctx, ent.OpQueryIDs) if err = nq.Select(node.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -274,7 +275,7 @@ func (nq *NodeQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (nq *NodeQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, nq.ctx, "Count") + ctx = setContextOp(ctx, nq.ctx, ent.OpQueryCount) if err := nq.prepareQuery(ctx); err != nil { return 0, err } @@ -292,7 +293,7 @@ func (nq *NodeQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (nq *NodeQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, nq.ctx, "Exist") + ctx = setContextOp(ctx, nq.ctx, ent.OpQueryExist) switch _, err := nq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -328,8 +329,9 @@ func (nq *NodeQuery) Clone() *NodeQuery { withVersions: nq.withVersions.Clone(), withReviews: nq.withReviews.Clone(), // clone intermediate query. - sql: nq.sql.Clone(), - path: nq.path, + sql: nq.sql.Clone(), + path: nq.path, + modifiers: append([]func(*sql.Selector){}, nq.modifiers...), } } @@ -721,7 +723,7 @@ func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { // Scan applies the selector query and scans the result into the given value. func (ngb *NodeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ngb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, ngb.build.ctx, ent.OpQueryGroupBy) if err := ngb.build.prepareQuery(ctx); err != nil { return err } @@ -769,7 +771,7 @@ func (ns *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { // Scan applies the selector query and scans the result into the given value. func (ns *NodeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ns.ctx, "Select") + ctx = setContextOp(ctx, ns.ctx, ent.OpQuerySelect) if err := ns.prepareQuery(ctx); err != nil { return err } diff --git a/ent/node_update.go b/ent/node_update.go index afcdc11..d84f7a2 100644 --- a/ent/node_update.go +++ b/ent/node_update.go @@ -417,7 +417,7 @@ func (nu *NodeUpdate) check() error { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Node.status": %w`, err)} } } - if _, ok := nu.mutation.PublisherID(); nu.mutation.PublisherCleared() && !ok { + if nu.mutation.PublisherCleared() && len(nu.mutation.PublisherIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "Node.publisher"`) } return nil @@ -1048,7 +1048,7 @@ func (nuo *NodeUpdateOne) check() error { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Node.status": %w`, err)} } } - if _, ok := nuo.mutation.PublisherID(); nuo.mutation.PublisherCleared() && !ok { + if nuo.mutation.PublisherCleared() && len(nuo.mutation.PublisherIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "Node.publisher"`) } return nil diff --git a/ent/nodereview_create.go b/ent/nodereview_create.go index 4b86b2e..3e3f6d7 100644 --- a/ent/nodereview_create.go +++ b/ent/nodereview_create.go @@ -131,10 +131,10 @@ func (nrc *NodeReviewCreate) check() error { if _, ok := nrc.mutation.Star(); !ok { return &ValidationError{Name: "star", err: errors.New(`ent: missing required field "NodeReview.star"`)} } - if _, ok := nrc.mutation.UserID(); !ok { + if len(nrc.mutation.UserIDs()) == 0 { return &ValidationError{Name: "user", err: errors.New(`ent: missing required edge "NodeReview.user"`)} } - if _, ok := nrc.mutation.NodeID(); !ok { + if len(nrc.mutation.NodeIDs()) == 0 { return &ValidationError{Name: "node", err: errors.New(`ent: missing required edge "NodeReview.node"`)} } return nil diff --git a/ent/nodereview_query.go b/ent/nodereview_query.go index 9515939..a704d39 100644 --- a/ent/nodereview_query.go +++ b/ent/nodereview_query.go @@ -11,6 +11,7 @@ import ( "registry-backend/ent/predicate" "registry-backend/ent/user" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -111,7 +112,7 @@ func (nrq *NodeReviewQuery) QueryNode() *NodeQuery { // First returns the first NodeReview entity from the query. // Returns a *NotFoundError when no NodeReview was found. func (nrq *NodeReviewQuery) First(ctx context.Context) (*NodeReview, error) { - nodes, err := nrq.Limit(1).All(setContextOp(ctx, nrq.ctx, "First")) + nodes, err := nrq.Limit(1).All(setContextOp(ctx, nrq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (nrq *NodeReviewQuery) FirstX(ctx context.Context) *NodeReview { // Returns a *NotFoundError when no NodeReview ID was found. func (nrq *NodeReviewQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = nrq.Limit(1).IDs(setContextOp(ctx, nrq.ctx, "FirstID")); err != nil { + if ids, err = nrq.Limit(1).IDs(setContextOp(ctx, nrq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -157,7 +158,7 @@ func (nrq *NodeReviewQuery) FirstIDX(ctx context.Context) uuid.UUID { // Returns a *NotSingularError when more than one NodeReview entity is found. // Returns a *NotFoundError when no NodeReview entities are found. func (nrq *NodeReviewQuery) Only(ctx context.Context) (*NodeReview, error) { - nodes, err := nrq.Limit(2).All(setContextOp(ctx, nrq.ctx, "Only")) + nodes, err := nrq.Limit(2).All(setContextOp(ctx, nrq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -185,7 +186,7 @@ func (nrq *NodeReviewQuery) OnlyX(ctx context.Context) *NodeReview { // Returns a *NotFoundError when no entities are found. func (nrq *NodeReviewQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = nrq.Limit(2).IDs(setContextOp(ctx, nrq.ctx, "OnlyID")); err != nil { + if ids, err = nrq.Limit(2).IDs(setContextOp(ctx, nrq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -210,7 +211,7 @@ func (nrq *NodeReviewQuery) OnlyIDX(ctx context.Context) uuid.UUID { // All executes the query and returns a list of NodeReviews. func (nrq *NodeReviewQuery) All(ctx context.Context) ([]*NodeReview, error) { - ctx = setContextOp(ctx, nrq.ctx, "All") + ctx = setContextOp(ctx, nrq.ctx, ent.OpQueryAll) if err := nrq.prepareQuery(ctx); err != nil { return nil, err } @@ -232,7 +233,7 @@ func (nrq *NodeReviewQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error if nrq.ctx.Unique == nil && nrq.path != nil { nrq.Unique(true) } - ctx = setContextOp(ctx, nrq.ctx, "IDs") + ctx = setContextOp(ctx, nrq.ctx, ent.OpQueryIDs) if err = nrq.Select(nodereview.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -250,7 +251,7 @@ func (nrq *NodeReviewQuery) IDsX(ctx context.Context) []uuid.UUID { // Count returns the count of the given query. func (nrq *NodeReviewQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, nrq.ctx, "Count") + ctx = setContextOp(ctx, nrq.ctx, ent.OpQueryCount) if err := nrq.prepareQuery(ctx); err != nil { return 0, err } @@ -268,7 +269,7 @@ func (nrq *NodeReviewQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (nrq *NodeReviewQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, nrq.ctx, "Exist") + ctx = setContextOp(ctx, nrq.ctx, ent.OpQueryExist) switch _, err := nrq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -303,8 +304,9 @@ func (nrq *NodeReviewQuery) Clone() *NodeReviewQuery { withUser: nrq.withUser.Clone(), withNode: nrq.withNode.Clone(), // clone intermediate query. - sql: nrq.sql.Clone(), - path: nrq.path, + sql: nrq.sql.Clone(), + path: nrq.path, + modifiers: append([]func(*sql.Selector){}, nrq.modifiers...), } } @@ -647,7 +649,7 @@ func (nrgb *NodeReviewGroupBy) Aggregate(fns ...AggregateFunc) *NodeReviewGroupB // Scan applies the selector query and scans the result into the given value. func (nrgb *NodeReviewGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, nrgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, nrgb.build.ctx, ent.OpQueryGroupBy) if err := nrgb.build.prepareQuery(ctx); err != nil { return err } @@ -695,7 +697,7 @@ func (nrs *NodeReviewSelect) Aggregate(fns ...AggregateFunc) *NodeReviewSelect { // Scan applies the selector query and scans the result into the given value. func (nrs *NodeReviewSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, nrs.ctx, "Select") + ctx = setContextOp(ctx, nrs.ctx, ent.OpQuerySelect) if err := nrs.prepareQuery(ctx); err != nil { return err } diff --git a/ent/nodereview_update.go b/ent/nodereview_update.go index 352461c..ba3d5f0 100644 --- a/ent/nodereview_update.go +++ b/ent/nodereview_update.go @@ -135,10 +135,10 @@ func (nru *NodeReviewUpdate) ExecX(ctx context.Context) { // check runs all checks and user-defined validators on the builder. func (nru *NodeReviewUpdate) check() error { - if _, ok := nru.mutation.UserID(); nru.mutation.UserCleared() && !ok { + if nru.mutation.UserCleared() && len(nru.mutation.UserIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "NodeReview.user"`) } - if _, ok := nru.mutation.NodeID(); nru.mutation.NodeCleared() && !ok { + if nru.mutation.NodeCleared() && len(nru.mutation.NodeIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "NodeReview.node"`) } return nil @@ -366,10 +366,10 @@ func (nruo *NodeReviewUpdateOne) ExecX(ctx context.Context) { // check runs all checks and user-defined validators on the builder. func (nruo *NodeReviewUpdateOne) check() error { - if _, ok := nruo.mutation.UserID(); nruo.mutation.UserCleared() && !ok { + if nruo.mutation.UserCleared() && len(nruo.mutation.UserIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "NodeReview.user"`) } - if _, ok := nruo.mutation.NodeID(); nruo.mutation.NodeCleared() && !ok { + if nruo.mutation.NodeCleared() && len(nruo.mutation.NodeIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "NodeReview.node"`) } return nil diff --git a/ent/nodeversion.go b/ent/nodeversion.go index 2200106..1786045 100644 --- a/ent/nodeversion.go +++ b/ent/nodeversion.go @@ -40,6 +40,8 @@ type NodeVersion struct { Status schema.NodeVersionStatus `json:"status,omitempty"` // Give a reason for the status change. Eg. 'Banned due to security vulnerability' StatusReason string `json:"status_reason,omitempty"` + // ComfyNodeExtractStatus holds the value of the "comfy_node_extract_status" field. + ComfyNodeExtractStatus schema.ComfyNodeExtractStatus `json:"comfy_node_extract_status,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the NodeVersionQuery when eager-loading is set. Edges NodeVersionEdges `json:"edges"` @@ -100,7 +102,7 @@ func (*NodeVersion) scanValues(columns []string) ([]any, error) { values[i] = new([]byte) case nodeversion.FieldDeprecated: values[i] = new(sql.NullBool) - case nodeversion.FieldNodeID, nodeversion.FieldVersion, nodeversion.FieldChangelog, nodeversion.FieldStatus, nodeversion.FieldStatusReason: + case nodeversion.FieldNodeID, nodeversion.FieldVersion, nodeversion.FieldChangelog, nodeversion.FieldStatus, nodeversion.FieldStatusReason, nodeversion.FieldComfyNodeExtractStatus: values[i] = new(sql.NullString) case nodeversion.FieldCreateTime, nodeversion.FieldUpdateTime: values[i] = new(sql.NullTime) @@ -185,6 +187,12 @@ func (nv *NodeVersion) assignValues(columns []string, values []any) error { } else if value.Valid { nv.StatusReason = value.String } + case nodeversion.FieldComfyNodeExtractStatus: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field comfy_node_extract_status", values[i]) + } else if value.Valid { + nv.ComfyNodeExtractStatus = schema.ComfyNodeExtractStatus(value.String) + } case nodeversion.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field node_version_storage_file", values[i]) @@ -269,6 +277,9 @@ func (nv *NodeVersion) String() string { builder.WriteString(", ") builder.WriteString("status_reason=") builder.WriteString(nv.StatusReason) + builder.WriteString(", ") + builder.WriteString("comfy_node_extract_status=") + builder.WriteString(fmt.Sprintf("%v", nv.ComfyNodeExtractStatus)) builder.WriteByte(')') return builder.String() } diff --git a/ent/nodeversion/nodeversion.go b/ent/nodeversion/nodeversion.go index 2b3d68c..7f3e63e 100644 --- a/ent/nodeversion/nodeversion.go +++ b/ent/nodeversion/nodeversion.go @@ -35,6 +35,8 @@ const ( FieldStatus = "status" // FieldStatusReason holds the string denoting the status_reason field in the database. FieldStatusReason = "status_reason" + // FieldComfyNodeExtractStatus holds the string denoting the comfy_node_extract_status field in the database. + FieldComfyNodeExtractStatus = "comfy_node_extract_status" // EdgeNode holds the string denoting the node edge name in mutations. EdgeNode = "node" // EdgeStorageFile holds the string denoting the storage_file edge name in mutations. @@ -78,6 +80,7 @@ var Columns = []string{ FieldDeprecated, FieldStatus, FieldStatusReason, + FieldComfyNodeExtractStatus, } // ForeignKeys holds the SQL foreign-keys that are owned by the "node_versions" @@ -112,6 +115,8 @@ var ( DefaultDeprecated bool // DefaultStatusReason holds the default value on creation for the "status_reason" field. DefaultStatusReason string + // DefaultComfyNodeExtractStatus holds the default value on creation for the "comfy_node_extract_status" field. + DefaultComfyNodeExtractStatus schema.ComfyNodeExtractStatus // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) @@ -176,6 +181,11 @@ func ByStatusReason(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStatusReason, opts...).ToFunc() } +// ByComfyNodeExtractStatus orders the results by the comfy_node_extract_status field. +func ByComfyNodeExtractStatus(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldComfyNodeExtractStatus, opts...).ToFunc() +} + // ByNodeField orders the results by node field. func ByNodeField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { diff --git a/ent/nodeversion/where.go b/ent/nodeversion/where.go index 26dd6f1..2c3457e 100644 --- a/ent/nodeversion/where.go +++ b/ent/nodeversion/where.go @@ -92,6 +92,12 @@ func StatusReason(v string) predicate.NodeVersion { return predicate.NodeVersion(sql.FieldEQ(FieldStatusReason, v)) } +// ComfyNodeExtractStatus applies equality check predicate on the "comfy_node_extract_status" field. It's identical to ComfyNodeExtractStatusEQ. +func ComfyNodeExtractStatus(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldEQ(FieldComfyNodeExtractStatus, vc)) +} + // CreateTimeEQ applies the EQ predicate on the "create_time" field. func CreateTimeEQ(v time.Time) predicate.NodeVersion { return predicate.NodeVersion(sql.FieldEQ(FieldCreateTime, v)) @@ -482,6 +488,90 @@ func StatusReasonContainsFold(v string) predicate.NodeVersion { return predicate.NodeVersion(sql.FieldContainsFold(FieldStatusReason, v)) } +// ComfyNodeExtractStatusEQ applies the EQ predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusEQ(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldEQ(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusNEQ applies the NEQ predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusNEQ(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldNEQ(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusIn applies the In predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusIn(vs ...schema.ComfyNodeExtractStatus) predicate.NodeVersion { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.NodeVersion(sql.FieldIn(FieldComfyNodeExtractStatus, v...)) +} + +// ComfyNodeExtractStatusNotIn applies the NotIn predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusNotIn(vs ...schema.ComfyNodeExtractStatus) predicate.NodeVersion { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.NodeVersion(sql.FieldNotIn(FieldComfyNodeExtractStatus, v...)) +} + +// ComfyNodeExtractStatusGT applies the GT predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusGT(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldGT(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusGTE applies the GTE predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusGTE(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldGTE(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusLT applies the LT predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusLT(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldLT(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusLTE applies the LTE predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusLTE(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldLTE(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusContains applies the Contains predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusContains(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldContains(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusHasPrefix applies the HasPrefix predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusHasPrefix(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldHasPrefix(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusHasSuffix applies the HasSuffix predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusHasSuffix(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldHasSuffix(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusEqualFold applies the EqualFold predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusEqualFold(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldEqualFold(FieldComfyNodeExtractStatus, vc)) +} + +// ComfyNodeExtractStatusContainsFold applies the ContainsFold predicate on the "comfy_node_extract_status" field. +func ComfyNodeExtractStatusContainsFold(v schema.ComfyNodeExtractStatus) predicate.NodeVersion { + vc := string(v) + return predicate.NodeVersion(sql.FieldContainsFold(FieldComfyNodeExtractStatus, vc)) +} + // HasNode applies the HasEdge predicate on the "node" edge. func HasNode() predicate.NodeVersion { return predicate.NodeVersion(func(s *sql.Selector) { diff --git a/ent/nodeversion_create.go b/ent/nodeversion_create.go index 1fac388..1599c31 100644 --- a/ent/nodeversion_create.go +++ b/ent/nodeversion_create.go @@ -130,6 +130,20 @@ func (nvc *NodeVersionCreate) SetNillableStatusReason(s *string) *NodeVersionCre return nvc } +// SetComfyNodeExtractStatus sets the "comfy_node_extract_status" field. +func (nvc *NodeVersionCreate) SetComfyNodeExtractStatus(snes schema.ComfyNodeExtractStatus) *NodeVersionCreate { + nvc.mutation.SetComfyNodeExtractStatus(snes) + return nvc +} + +// SetNillableComfyNodeExtractStatus sets the "comfy_node_extract_status" field if the given value is not nil. +func (nvc *NodeVersionCreate) SetNillableComfyNodeExtractStatus(snes *schema.ComfyNodeExtractStatus) *NodeVersionCreate { + if snes != nil { + nvc.SetComfyNodeExtractStatus(*snes) + } + return nvc +} + // SetID sets the "id" field. func (nvc *NodeVersionCreate) SetID(u uuid.UUID) *NodeVersionCreate { nvc.mutation.SetID(u) @@ -238,6 +252,10 @@ func (nvc *NodeVersionCreate) defaults() { v := nodeversion.DefaultStatusReason nvc.mutation.SetStatusReason(v) } + if _, ok := nvc.mutation.ComfyNodeExtractStatus(); !ok { + v := nodeversion.DefaultComfyNodeExtractStatus + nvc.mutation.SetComfyNodeExtractStatus(v) + } if _, ok := nvc.mutation.ID(); !ok { v := nodeversion.DefaultID() nvc.mutation.SetID(v) @@ -275,7 +293,10 @@ func (nvc *NodeVersionCreate) check() error { if _, ok := nvc.mutation.StatusReason(); !ok { return &ValidationError{Name: "status_reason", err: errors.New(`ent: missing required field "NodeVersion.status_reason"`)} } - if _, ok := nvc.mutation.NodeID(); !ok { + if _, ok := nvc.mutation.ComfyNodeExtractStatus(); !ok { + return &ValidationError{Name: "comfy_node_extract_status", err: errors.New(`ent: missing required field "NodeVersion.comfy_node_extract_status"`)} + } + if len(nvc.mutation.NodeIDs()) == 0 { return &ValidationError{Name: "node", err: errors.New(`ent: missing required edge "NodeVersion.node"`)} } return nil @@ -346,6 +367,10 @@ func (nvc *NodeVersionCreate) createSpec() (*NodeVersion, *sqlgraph.CreateSpec) _spec.SetField(nodeversion.FieldStatusReason, field.TypeString, value) _node.StatusReason = value } + if value, ok := nvc.mutation.ComfyNodeExtractStatus(); ok { + _spec.SetField(nodeversion.FieldComfyNodeExtractStatus, field.TypeString, value) + _node.ComfyNodeExtractStatus = value + } if nodes := nvc.mutation.NodeIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -550,6 +575,18 @@ func (u *NodeVersionUpsert) UpdateStatusReason() *NodeVersionUpsert { return u } +// SetComfyNodeExtractStatus sets the "comfy_node_extract_status" field. +func (u *NodeVersionUpsert) SetComfyNodeExtractStatus(v schema.ComfyNodeExtractStatus) *NodeVersionUpsert { + u.Set(nodeversion.FieldComfyNodeExtractStatus, v) + return u +} + +// UpdateComfyNodeExtractStatus sets the "comfy_node_extract_status" field to the value that was provided on create. +func (u *NodeVersionUpsert) UpdateComfyNodeExtractStatus() *NodeVersionUpsert { + u.SetExcluded(nodeversion.FieldComfyNodeExtractStatus) + return u +} + // UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. // Using this option is equivalent to using: // @@ -720,6 +757,20 @@ func (u *NodeVersionUpsertOne) UpdateStatusReason() *NodeVersionUpsertOne { }) } +// SetComfyNodeExtractStatus sets the "comfy_node_extract_status" field. +func (u *NodeVersionUpsertOne) SetComfyNodeExtractStatus(v schema.ComfyNodeExtractStatus) *NodeVersionUpsertOne { + return u.Update(func(s *NodeVersionUpsert) { + s.SetComfyNodeExtractStatus(v) + }) +} + +// UpdateComfyNodeExtractStatus sets the "comfy_node_extract_status" field to the value that was provided on create. +func (u *NodeVersionUpsertOne) UpdateComfyNodeExtractStatus() *NodeVersionUpsertOne { + return u.Update(func(s *NodeVersionUpsert) { + s.UpdateComfyNodeExtractStatus() + }) +} + // Exec executes the query. func (u *NodeVersionUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -1057,6 +1108,20 @@ func (u *NodeVersionUpsertBulk) UpdateStatusReason() *NodeVersionUpsertBulk { }) } +// SetComfyNodeExtractStatus sets the "comfy_node_extract_status" field. +func (u *NodeVersionUpsertBulk) SetComfyNodeExtractStatus(v schema.ComfyNodeExtractStatus) *NodeVersionUpsertBulk { + return u.Update(func(s *NodeVersionUpsert) { + s.SetComfyNodeExtractStatus(v) + }) +} + +// UpdateComfyNodeExtractStatus sets the "comfy_node_extract_status" field to the value that was provided on create. +func (u *NodeVersionUpsertBulk) UpdateComfyNodeExtractStatus() *NodeVersionUpsertBulk { + return u.Update(func(s *NodeVersionUpsert) { + s.UpdateComfyNodeExtractStatus() + }) +} + // Exec executes the query. func (u *NodeVersionUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/ent/nodeversion_query.go b/ent/nodeversion_query.go index 1f28c25..11493b0 100644 --- a/ent/nodeversion_query.go +++ b/ent/nodeversion_query.go @@ -13,6 +13,7 @@ import ( "registry-backend/ent/predicate" "registry-backend/ent/storagefile" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -137,7 +138,7 @@ func (nvq *NodeVersionQuery) QueryComfyNodes() *ComfyNodeQuery { // First returns the first NodeVersion entity from the query. // Returns a *NotFoundError when no NodeVersion was found. func (nvq *NodeVersionQuery) First(ctx context.Context) (*NodeVersion, error) { - nodes, err := nvq.Limit(1).All(setContextOp(ctx, nvq.ctx, "First")) + nodes, err := nvq.Limit(1).All(setContextOp(ctx, nvq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -160,7 +161,7 @@ func (nvq *NodeVersionQuery) FirstX(ctx context.Context) *NodeVersion { // Returns a *NotFoundError when no NodeVersion ID was found. func (nvq *NodeVersionQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = nvq.Limit(1).IDs(setContextOp(ctx, nvq.ctx, "FirstID")); err != nil { + if ids, err = nvq.Limit(1).IDs(setContextOp(ctx, nvq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -183,7 +184,7 @@ func (nvq *NodeVersionQuery) FirstIDX(ctx context.Context) uuid.UUID { // Returns a *NotSingularError when more than one NodeVersion entity is found. // Returns a *NotFoundError when no NodeVersion entities are found. func (nvq *NodeVersionQuery) Only(ctx context.Context) (*NodeVersion, error) { - nodes, err := nvq.Limit(2).All(setContextOp(ctx, nvq.ctx, "Only")) + nodes, err := nvq.Limit(2).All(setContextOp(ctx, nvq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -211,7 +212,7 @@ func (nvq *NodeVersionQuery) OnlyX(ctx context.Context) *NodeVersion { // Returns a *NotFoundError when no entities are found. func (nvq *NodeVersionQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = nvq.Limit(2).IDs(setContextOp(ctx, nvq.ctx, "OnlyID")); err != nil { + if ids, err = nvq.Limit(2).IDs(setContextOp(ctx, nvq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -236,7 +237,7 @@ func (nvq *NodeVersionQuery) OnlyIDX(ctx context.Context) uuid.UUID { // All executes the query and returns a list of NodeVersions. func (nvq *NodeVersionQuery) All(ctx context.Context) ([]*NodeVersion, error) { - ctx = setContextOp(ctx, nvq.ctx, "All") + ctx = setContextOp(ctx, nvq.ctx, ent.OpQueryAll) if err := nvq.prepareQuery(ctx); err != nil { return nil, err } @@ -258,7 +259,7 @@ func (nvq *NodeVersionQuery) IDs(ctx context.Context) (ids []uuid.UUID, err erro if nvq.ctx.Unique == nil && nvq.path != nil { nvq.Unique(true) } - ctx = setContextOp(ctx, nvq.ctx, "IDs") + ctx = setContextOp(ctx, nvq.ctx, ent.OpQueryIDs) if err = nvq.Select(nodeversion.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -276,7 +277,7 @@ func (nvq *NodeVersionQuery) IDsX(ctx context.Context) []uuid.UUID { // Count returns the count of the given query. func (nvq *NodeVersionQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, nvq.ctx, "Count") + ctx = setContextOp(ctx, nvq.ctx, ent.OpQueryCount) if err := nvq.prepareQuery(ctx); err != nil { return 0, err } @@ -294,7 +295,7 @@ func (nvq *NodeVersionQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (nvq *NodeVersionQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, nvq.ctx, "Exist") + ctx = setContextOp(ctx, nvq.ctx, ent.OpQueryExist) switch _, err := nvq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -330,8 +331,9 @@ func (nvq *NodeVersionQuery) Clone() *NodeVersionQuery { withStorageFile: nvq.withStorageFile.Clone(), withComfyNodes: nvq.withComfyNodes.Clone(), // clone intermediate query. - sql: nvq.sql.Clone(), - path: nvq.path, + sql: nvq.sql.Clone(), + path: nvq.path, + modifiers: append([]func(*sql.Selector){}, nvq.modifiers...), } } @@ -730,7 +732,7 @@ func (nvgb *NodeVersionGroupBy) Aggregate(fns ...AggregateFunc) *NodeVersionGrou // Scan applies the selector query and scans the result into the given value. func (nvgb *NodeVersionGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, nvgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, nvgb.build.ctx, ent.OpQueryGroupBy) if err := nvgb.build.prepareQuery(ctx); err != nil { return err } @@ -778,7 +780,7 @@ func (nvs *NodeVersionSelect) Aggregate(fns ...AggregateFunc) *NodeVersionSelect // Scan applies the selector query and scans the result into the given value. func (nvs *NodeVersionSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, nvs.ctx, "Select") + ctx = setContextOp(ctx, nvs.ctx, ent.OpQuerySelect) if err := nvs.prepareQuery(ctx); err != nil { return err } diff --git a/ent/nodeversion_update.go b/ent/nodeversion_update.go index 0160c1a..ce1517c 100644 --- a/ent/nodeversion_update.go +++ b/ent/nodeversion_update.go @@ -143,6 +143,20 @@ func (nvu *NodeVersionUpdate) SetNillableStatusReason(s *string) *NodeVersionUpd return nvu } +// SetComfyNodeExtractStatus sets the "comfy_node_extract_status" field. +func (nvu *NodeVersionUpdate) SetComfyNodeExtractStatus(snes schema.ComfyNodeExtractStatus) *NodeVersionUpdate { + nvu.mutation.SetComfyNodeExtractStatus(snes) + return nvu +} + +// SetNillableComfyNodeExtractStatus sets the "comfy_node_extract_status" field if the given value is not nil. +func (nvu *NodeVersionUpdate) SetNillableComfyNodeExtractStatus(snes *schema.ComfyNodeExtractStatus) *NodeVersionUpdate { + if snes != nil { + nvu.SetComfyNodeExtractStatus(*snes) + } + return nvu +} + // SetNode sets the "node" edge to the Node entity. func (nvu *NodeVersionUpdate) SetNode(n *Node) *NodeVersionUpdate { return nvu.SetNodeID(n.ID) @@ -263,7 +277,7 @@ func (nvu *NodeVersionUpdate) check() error { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "NodeVersion.status": %w`, err)} } } - if _, ok := nvu.mutation.NodeID(); nvu.mutation.NodeCleared() && !ok { + if nvu.mutation.NodeCleared() && len(nvu.mutation.NodeIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "NodeVersion.node"`) } return nil @@ -316,6 +330,9 @@ func (nvu *NodeVersionUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := nvu.mutation.StatusReason(); ok { _spec.SetField(nodeversion.FieldStatusReason, field.TypeString, value) } + if value, ok := nvu.mutation.ComfyNodeExtractStatus(); ok { + _spec.SetField(nodeversion.FieldComfyNodeExtractStatus, field.TypeString, value) + } if nvu.mutation.NodeCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -549,6 +566,20 @@ func (nvuo *NodeVersionUpdateOne) SetNillableStatusReason(s *string) *NodeVersio return nvuo } +// SetComfyNodeExtractStatus sets the "comfy_node_extract_status" field. +func (nvuo *NodeVersionUpdateOne) SetComfyNodeExtractStatus(snes schema.ComfyNodeExtractStatus) *NodeVersionUpdateOne { + nvuo.mutation.SetComfyNodeExtractStatus(snes) + return nvuo +} + +// SetNillableComfyNodeExtractStatus sets the "comfy_node_extract_status" field if the given value is not nil. +func (nvuo *NodeVersionUpdateOne) SetNillableComfyNodeExtractStatus(snes *schema.ComfyNodeExtractStatus) *NodeVersionUpdateOne { + if snes != nil { + nvuo.SetComfyNodeExtractStatus(*snes) + } + return nvuo +} + // SetNode sets the "node" edge to the Node entity. func (nvuo *NodeVersionUpdateOne) SetNode(n *Node) *NodeVersionUpdateOne { return nvuo.SetNodeID(n.ID) @@ -682,7 +713,7 @@ func (nvuo *NodeVersionUpdateOne) check() error { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "NodeVersion.status": %w`, err)} } } - if _, ok := nvuo.mutation.NodeID(); nvuo.mutation.NodeCleared() && !ok { + if nvuo.mutation.NodeCleared() && len(nvuo.mutation.NodeIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "NodeVersion.node"`) } return nil @@ -752,6 +783,9 @@ func (nvuo *NodeVersionUpdateOne) sqlSave(ctx context.Context) (_node *NodeVersi if value, ok := nvuo.mutation.StatusReason(); ok { _spec.SetField(nodeversion.FieldStatusReason, field.TypeString, value) } + if value, ok := nvuo.mutation.ComfyNodeExtractStatus(); ok { + _spec.SetField(nodeversion.FieldComfyNodeExtractStatus, field.TypeString, value) + } if nvuo.mutation.NodeCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, diff --git a/ent/personalaccesstoken_create.go b/ent/personalaccesstoken_create.go index a6d2bf2..31b8065 100644 --- a/ent/personalaccesstoken_create.go +++ b/ent/personalaccesstoken_create.go @@ -165,7 +165,7 @@ func (patc *PersonalAccessTokenCreate) check() error { if _, ok := patc.mutation.Token(); !ok { return &ValidationError{Name: "token", err: errors.New(`ent: missing required field "PersonalAccessToken.token"`)} } - if _, ok := patc.mutation.PublisherID(); !ok { + if len(patc.mutation.PublisherIDs()) == 0 { return &ValidationError{Name: "publisher", err: errors.New(`ent: missing required edge "PersonalAccessToken.publisher"`)} } return nil diff --git a/ent/personalaccesstoken_query.go b/ent/personalaccesstoken_query.go index d0d6a39..e365140 100644 --- a/ent/personalaccesstoken_query.go +++ b/ent/personalaccesstoken_query.go @@ -10,6 +10,7 @@ import ( "registry-backend/ent/predicate" "registry-backend/ent/publisher" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -87,7 +88,7 @@ func (patq *PersonalAccessTokenQuery) QueryPublisher() *PublisherQuery { // First returns the first PersonalAccessToken entity from the query. // Returns a *NotFoundError when no PersonalAccessToken was found. func (patq *PersonalAccessTokenQuery) First(ctx context.Context) (*PersonalAccessToken, error) { - nodes, err := patq.Limit(1).All(setContextOp(ctx, patq.ctx, "First")) + nodes, err := patq.Limit(1).All(setContextOp(ctx, patq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -110,7 +111,7 @@ func (patq *PersonalAccessTokenQuery) FirstX(ctx context.Context) *PersonalAcces // Returns a *NotFoundError when no PersonalAccessToken ID was found. func (patq *PersonalAccessTokenQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = patq.Limit(1).IDs(setContextOp(ctx, patq.ctx, "FirstID")); err != nil { + if ids, err = patq.Limit(1).IDs(setContextOp(ctx, patq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -133,7 +134,7 @@ func (patq *PersonalAccessTokenQuery) FirstIDX(ctx context.Context) uuid.UUID { // Returns a *NotSingularError when more than one PersonalAccessToken entity is found. // Returns a *NotFoundError when no PersonalAccessToken entities are found. func (patq *PersonalAccessTokenQuery) Only(ctx context.Context) (*PersonalAccessToken, error) { - nodes, err := patq.Limit(2).All(setContextOp(ctx, patq.ctx, "Only")) + nodes, err := patq.Limit(2).All(setContextOp(ctx, patq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -161,7 +162,7 @@ func (patq *PersonalAccessTokenQuery) OnlyX(ctx context.Context) *PersonalAccess // Returns a *NotFoundError when no entities are found. func (patq *PersonalAccessTokenQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = patq.Limit(2).IDs(setContextOp(ctx, patq.ctx, "OnlyID")); err != nil { + if ids, err = patq.Limit(2).IDs(setContextOp(ctx, patq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -186,7 +187,7 @@ func (patq *PersonalAccessTokenQuery) OnlyIDX(ctx context.Context) uuid.UUID { // All executes the query and returns a list of PersonalAccessTokens. func (patq *PersonalAccessTokenQuery) All(ctx context.Context) ([]*PersonalAccessToken, error) { - ctx = setContextOp(ctx, patq.ctx, "All") + ctx = setContextOp(ctx, patq.ctx, ent.OpQueryAll) if err := patq.prepareQuery(ctx); err != nil { return nil, err } @@ -208,7 +209,7 @@ func (patq *PersonalAccessTokenQuery) IDs(ctx context.Context) (ids []uuid.UUID, if patq.ctx.Unique == nil && patq.path != nil { patq.Unique(true) } - ctx = setContextOp(ctx, patq.ctx, "IDs") + ctx = setContextOp(ctx, patq.ctx, ent.OpQueryIDs) if err = patq.Select(personalaccesstoken.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -226,7 +227,7 @@ func (patq *PersonalAccessTokenQuery) IDsX(ctx context.Context) []uuid.UUID { // Count returns the count of the given query. func (patq *PersonalAccessTokenQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, patq.ctx, "Count") + ctx = setContextOp(ctx, patq.ctx, ent.OpQueryCount) if err := patq.prepareQuery(ctx); err != nil { return 0, err } @@ -244,7 +245,7 @@ func (patq *PersonalAccessTokenQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (patq *PersonalAccessTokenQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, patq.ctx, "Exist") + ctx = setContextOp(ctx, patq.ctx, ent.OpQueryExist) switch _, err := patq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -278,8 +279,9 @@ func (patq *PersonalAccessTokenQuery) Clone() *PersonalAccessTokenQuery { predicates: append([]predicate.PersonalAccessToken{}, patq.predicates...), withPublisher: patq.withPublisher.Clone(), // clone intermediate query. - sql: patq.sql.Clone(), - path: patq.path, + sql: patq.sql.Clone(), + path: patq.path, + modifiers: append([]func(*sql.Selector){}, patq.modifiers...), } } @@ -572,7 +574,7 @@ func (patgb *PersonalAccessTokenGroupBy) Aggregate(fns ...AggregateFunc) *Person // Scan applies the selector query and scans the result into the given value. func (patgb *PersonalAccessTokenGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, patgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, patgb.build.ctx, ent.OpQueryGroupBy) if err := patgb.build.prepareQuery(ctx); err != nil { return err } @@ -620,7 +622,7 @@ func (pats *PersonalAccessTokenSelect) Aggregate(fns ...AggregateFunc) *Personal // Scan applies the selector query and scans the result into the given value. func (pats *PersonalAccessTokenSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pats.ctx, "Select") + ctx = setContextOp(ctx, pats.ctx, ent.OpQuerySelect) if err := pats.prepareQuery(ctx); err != nil { return err } diff --git a/ent/personalaccesstoken_update.go b/ent/personalaccesstoken_update.go index e41faf7..8ebe6fd 100644 --- a/ent/personalaccesstoken_update.go +++ b/ent/personalaccesstoken_update.go @@ -146,7 +146,7 @@ func (patu *PersonalAccessTokenUpdate) defaults() { // check runs all checks and user-defined validators on the builder. func (patu *PersonalAccessTokenUpdate) check() error { - if _, ok := patu.mutation.PublisherID(); patu.mutation.PublisherCleared() && !ok { + if patu.mutation.PublisherCleared() && len(patu.mutation.PublisherIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "PersonalAccessToken.publisher"`) } return nil @@ -362,7 +362,7 @@ func (patuo *PersonalAccessTokenUpdateOne) defaults() { // check runs all checks and user-defined validators on the builder. func (patuo *PersonalAccessTokenUpdateOne) check() error { - if _, ok := patuo.mutation.PublisherID(); patuo.mutation.PublisherCleared() && !ok { + if patuo.mutation.PublisherCleared() && len(patuo.mutation.PublisherIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "PersonalAccessToken.publisher"`) } return nil diff --git a/ent/publisher_query.go b/ent/publisher_query.go index fd9f618..45dcead 100644 --- a/ent/publisher_query.go +++ b/ent/publisher_query.go @@ -13,6 +13,7 @@ import ( "registry-backend/ent/publisher" "registry-backend/ent/publisherpermission" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -135,7 +136,7 @@ func (pq *PublisherQuery) QueryPersonalAccessTokens() *PersonalAccessTokenQuery // First returns the first Publisher entity from the query. // Returns a *NotFoundError when no Publisher was found. func (pq *PublisherQuery) First(ctx context.Context) (*Publisher, error) { - nodes, err := pq.Limit(1).All(setContextOp(ctx, pq.ctx, "First")) + nodes, err := pq.Limit(1).All(setContextOp(ctx, pq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -158,7 +159,7 @@ func (pq *PublisherQuery) FirstX(ctx context.Context) *Publisher { // Returns a *NotFoundError when no Publisher ID was found. func (pq *PublisherQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = pq.Limit(1).IDs(setContextOp(ctx, pq.ctx, "FirstID")); err != nil { + if ids, err = pq.Limit(1).IDs(setContextOp(ctx, pq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -181,7 +182,7 @@ func (pq *PublisherQuery) FirstIDX(ctx context.Context) string { // Returns a *NotSingularError when more than one Publisher entity is found. // Returns a *NotFoundError when no Publisher entities are found. func (pq *PublisherQuery) Only(ctx context.Context) (*Publisher, error) { - nodes, err := pq.Limit(2).All(setContextOp(ctx, pq.ctx, "Only")) + nodes, err := pq.Limit(2).All(setContextOp(ctx, pq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -209,7 +210,7 @@ func (pq *PublisherQuery) OnlyX(ctx context.Context) *Publisher { // Returns a *NotFoundError when no entities are found. func (pq *PublisherQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = pq.Limit(2).IDs(setContextOp(ctx, pq.ctx, "OnlyID")); err != nil { + if ids, err = pq.Limit(2).IDs(setContextOp(ctx, pq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -234,7 +235,7 @@ func (pq *PublisherQuery) OnlyIDX(ctx context.Context) string { // All executes the query and returns a list of Publishers. func (pq *PublisherQuery) All(ctx context.Context) ([]*Publisher, error) { - ctx = setContextOp(ctx, pq.ctx, "All") + ctx = setContextOp(ctx, pq.ctx, ent.OpQueryAll) if err := pq.prepareQuery(ctx); err != nil { return nil, err } @@ -256,7 +257,7 @@ func (pq *PublisherQuery) IDs(ctx context.Context) (ids []string, err error) { if pq.ctx.Unique == nil && pq.path != nil { pq.Unique(true) } - ctx = setContextOp(ctx, pq.ctx, "IDs") + ctx = setContextOp(ctx, pq.ctx, ent.OpQueryIDs) if err = pq.Select(publisher.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -274,7 +275,7 @@ func (pq *PublisherQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (pq *PublisherQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, pq.ctx, "Count") + ctx = setContextOp(ctx, pq.ctx, ent.OpQueryCount) if err := pq.prepareQuery(ctx); err != nil { return 0, err } @@ -292,7 +293,7 @@ func (pq *PublisherQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (pq *PublisherQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, pq.ctx, "Exist") + ctx = setContextOp(ctx, pq.ctx, ent.OpQueryExist) switch _, err := pq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -328,8 +329,9 @@ func (pq *PublisherQuery) Clone() *PublisherQuery { withNodes: pq.withNodes.Clone(), withPersonalAccessTokens: pq.withPersonalAccessTokens.Clone(), // clone intermediate query. - sql: pq.sql.Clone(), - path: pq.path, + sql: pq.sql.Clone(), + path: pq.path, + modifiers: append([]func(*sql.Selector){}, pq.modifiers...), } } @@ -723,7 +725,7 @@ func (pgb *PublisherGroupBy) Aggregate(fns ...AggregateFunc) *PublisherGroupBy { // Scan applies the selector query and scans the result into the given value. func (pgb *PublisherGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) if err := pgb.build.prepareQuery(ctx); err != nil { return err } @@ -771,7 +773,7 @@ func (ps *PublisherSelect) Aggregate(fns ...AggregateFunc) *PublisherSelect { // Scan applies the selector query and scans the result into the given value. func (ps *PublisherSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, "Select") + ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) if err := ps.prepareQuery(ctx); err != nil { return err } diff --git a/ent/publisherpermission_create.go b/ent/publisherpermission_create.go index 5e912db..41a0ed0 100644 --- a/ent/publisherpermission_create.go +++ b/ent/publisherpermission_create.go @@ -100,10 +100,10 @@ func (ppc *PublisherPermissionCreate) check() error { if _, ok := ppc.mutation.PublisherID(); !ok { return &ValidationError{Name: "publisher_id", err: errors.New(`ent: missing required field "PublisherPermission.publisher_id"`)} } - if _, ok := ppc.mutation.UserID(); !ok { + if len(ppc.mutation.UserIDs()) == 0 { return &ValidationError{Name: "user", err: errors.New(`ent: missing required edge "PublisherPermission.user"`)} } - if _, ok := ppc.mutation.PublisherID(); !ok { + if len(ppc.mutation.PublisherIDs()) == 0 { return &ValidationError{Name: "publisher", err: errors.New(`ent: missing required edge "PublisherPermission.publisher"`)} } return nil diff --git a/ent/publisherpermission_query.go b/ent/publisherpermission_query.go index 0f767cf..ff4b481 100644 --- a/ent/publisherpermission_query.go +++ b/ent/publisherpermission_query.go @@ -11,6 +11,7 @@ import ( "registry-backend/ent/publisherpermission" "registry-backend/ent/user" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -110,7 +111,7 @@ func (ppq *PublisherPermissionQuery) QueryPublisher() *PublisherQuery { // First returns the first PublisherPermission entity from the query. // Returns a *NotFoundError when no PublisherPermission was found. func (ppq *PublisherPermissionQuery) First(ctx context.Context) (*PublisherPermission, error) { - nodes, err := ppq.Limit(1).All(setContextOp(ctx, ppq.ctx, "First")) + nodes, err := ppq.Limit(1).All(setContextOp(ctx, ppq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -133,7 +134,7 @@ func (ppq *PublisherPermissionQuery) FirstX(ctx context.Context) *PublisherPermi // Returns a *NotFoundError when no PublisherPermission ID was found. func (ppq *PublisherPermissionQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = ppq.Limit(1).IDs(setContextOp(ctx, ppq.ctx, "FirstID")); err != nil { + if ids, err = ppq.Limit(1).IDs(setContextOp(ctx, ppq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -156,7 +157,7 @@ func (ppq *PublisherPermissionQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one PublisherPermission entity is found. // Returns a *NotFoundError when no PublisherPermission entities are found. func (ppq *PublisherPermissionQuery) Only(ctx context.Context) (*PublisherPermission, error) { - nodes, err := ppq.Limit(2).All(setContextOp(ctx, ppq.ctx, "Only")) + nodes, err := ppq.Limit(2).All(setContextOp(ctx, ppq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -184,7 +185,7 @@ func (ppq *PublisherPermissionQuery) OnlyX(ctx context.Context) *PublisherPermis // Returns a *NotFoundError when no entities are found. func (ppq *PublisherPermissionQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = ppq.Limit(2).IDs(setContextOp(ctx, ppq.ctx, "OnlyID")); err != nil { + if ids, err = ppq.Limit(2).IDs(setContextOp(ctx, ppq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -209,7 +210,7 @@ func (ppq *PublisherPermissionQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of PublisherPermissions. func (ppq *PublisherPermissionQuery) All(ctx context.Context) ([]*PublisherPermission, error) { - ctx = setContextOp(ctx, ppq.ctx, "All") + ctx = setContextOp(ctx, ppq.ctx, ent.OpQueryAll) if err := ppq.prepareQuery(ctx); err != nil { return nil, err } @@ -231,7 +232,7 @@ func (ppq *PublisherPermissionQuery) IDs(ctx context.Context) (ids []int, err er if ppq.ctx.Unique == nil && ppq.path != nil { ppq.Unique(true) } - ctx = setContextOp(ctx, ppq.ctx, "IDs") + ctx = setContextOp(ctx, ppq.ctx, ent.OpQueryIDs) if err = ppq.Select(publisherpermission.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -249,7 +250,7 @@ func (ppq *PublisherPermissionQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (ppq *PublisherPermissionQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, ppq.ctx, "Count") + ctx = setContextOp(ctx, ppq.ctx, ent.OpQueryCount) if err := ppq.prepareQuery(ctx); err != nil { return 0, err } @@ -267,7 +268,7 @@ func (ppq *PublisherPermissionQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (ppq *PublisherPermissionQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, ppq.ctx, "Exist") + ctx = setContextOp(ctx, ppq.ctx, ent.OpQueryExist) switch _, err := ppq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -302,8 +303,9 @@ func (ppq *PublisherPermissionQuery) Clone() *PublisherPermissionQuery { withUser: ppq.withUser.Clone(), withPublisher: ppq.withPublisher.Clone(), // clone intermediate query. - sql: ppq.sql.Clone(), - path: ppq.path, + sql: ppq.sql.Clone(), + path: ppq.path, + modifiers: append([]func(*sql.Selector){}, ppq.modifiers...), } } @@ -646,7 +648,7 @@ func (ppgb *PublisherPermissionGroupBy) Aggregate(fns ...AggregateFunc) *Publish // Scan applies the selector query and scans the result into the given value. func (ppgb *PublisherPermissionGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ppgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, ppgb.build.ctx, ent.OpQueryGroupBy) if err := ppgb.build.prepareQuery(ctx); err != nil { return err } @@ -694,7 +696,7 @@ func (pps *PublisherPermissionSelect) Aggregate(fns ...AggregateFunc) *Publisher // Scan applies the selector query and scans the result into the given value. func (pps *PublisherPermissionSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pps.ctx, "Select") + ctx = setContextOp(ctx, pps.ctx, ent.OpQuerySelect) if err := pps.prepareQuery(ctx); err != nil { return err } diff --git a/ent/publisherpermission_update.go b/ent/publisherpermission_update.go index ac1da53..c724014 100644 --- a/ent/publisherpermission_update.go +++ b/ent/publisherpermission_update.go @@ -134,10 +134,10 @@ func (ppu *PublisherPermissionUpdate) check() error { return &ValidationError{Name: "permission", err: fmt.Errorf(`ent: validator failed for field "PublisherPermission.permission": %w`, err)} } } - if _, ok := ppu.mutation.UserID(); ppu.mutation.UserCleared() && !ok { + if ppu.mutation.UserCleared() && len(ppu.mutation.UserIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "PublisherPermission.user"`) } - if _, ok := ppu.mutation.PublisherID(); ppu.mutation.PublisherCleared() && !ok { + if ppu.mutation.PublisherCleared() && len(ppu.mutation.PublisherIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "PublisherPermission.publisher"`) } return nil @@ -360,10 +360,10 @@ func (ppuo *PublisherPermissionUpdateOne) check() error { return &ValidationError{Name: "permission", err: fmt.Errorf(`ent: validator failed for field "PublisherPermission.permission": %w`, err)} } } - if _, ok := ppuo.mutation.UserID(); ppuo.mutation.UserCleared() && !ok { + if ppuo.mutation.UserCleared() && len(ppuo.mutation.UserIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "PublisherPermission.user"`) } - if _, ok := ppuo.mutation.PublisherID(); ppuo.mutation.PublisherCleared() && !ok { + if ppuo.mutation.PublisherCleared() && len(ppuo.mutation.PublisherIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "PublisherPermission.publisher"`) } return nil diff --git a/ent/runtime.go b/ent/runtime.go index 5226394..e867e17 100644 --- a/ent/runtime.go +++ b/ent/runtime.go @@ -160,6 +160,10 @@ func init() { nodeversionDescStatusReason := nodeversionFields[7].Descriptor() // nodeversion.DefaultStatusReason holds the default value on creation for the status_reason field. nodeversion.DefaultStatusReason = nodeversionDescStatusReason.Default.(string) + // nodeversionDescComfyNodeExtractStatus is the schema descriptor for comfy_node_extract_status field. + nodeversionDescComfyNodeExtractStatus := nodeversionFields[8].Descriptor() + // nodeversion.DefaultComfyNodeExtractStatus holds the default value on creation for the comfy_node_extract_status field. + nodeversion.DefaultComfyNodeExtractStatus = schema.ComfyNodeExtractStatus(nodeversionDescComfyNodeExtractStatus.Default.(string)) // nodeversionDescID is the schema descriptor for id field. nodeversionDescID := nodeversionFields[0].Descriptor() // nodeversion.DefaultID holds the default value on creation for the id field. diff --git a/ent/runtime/runtime.go b/ent/runtime/runtime.go index df3812a..77eb9f5 100644 --- a/ent/runtime/runtime.go +++ b/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in registry-backend/ent/runtime.go const ( - Version = "v0.13.1" // Version of ent codegen. - Sum = "h1:uD8QwN1h6SNphdCCzmkMN3feSUzNnVvV/WIkHKMbzOE=" // Sum of ent codegen. + Version = "v0.14.1" // Version of ent codegen. + Sum = "h1:fUERL506Pqr92EPHJqr8EYxbPioflJo6PudkrEA8a/s=" // Sum of ent codegen. ) diff --git a/ent/schema/node_version.go b/ent/schema/node_version.go index cc8cba1..7229373 100644 --- a/ent/schema/node_version.go +++ b/ent/schema/node_version.go @@ -38,6 +38,9 @@ func (NodeVersion) Fields() []ent.Field { field.String("status_reason").SchemaType(map[string]string{ dialect.Postgres: "text", }).Default("").Comment("Give a reason for the status change. Eg. 'Banned due to security vulnerability'"), + field.String("comfy_node_extract_status"). + GoType(ComfyNodeExtractStatus("")). + Default(string(ComfyNodeExtractStatusPending)), } } @@ -80,3 +83,19 @@ func (NodeVersionStatus) Values() (types []string) { string(NodeVersionStatusFlagged), } } + +type ComfyNodeExtractStatus string + +func (ComfyNodeExtractStatus) Values() (types []string) { + return []string{ + string(ComfyNodeExtractStatusPending), + string(ComfyNodeExtractStatusFailed), + string(ComfyNodeExtractStatusSuccess), + } +} + +const ( + ComfyNodeExtractStatusPending = "pending" + ComfyNodeExtractStatusFailed = "failed" + ComfyNodeExtractStatusSuccess = "success" +) diff --git a/ent/storagefile_query.go b/ent/storagefile_query.go index 3d014aa..2d415ee 100644 --- a/ent/storagefile_query.go +++ b/ent/storagefile_query.go @@ -9,6 +9,7 @@ import ( "registry-backend/ent/predicate" "registry-backend/ent/storagefile" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -64,7 +65,7 @@ func (sfq *StorageFileQuery) Order(o ...storagefile.OrderOption) *StorageFileQue // First returns the first StorageFile entity from the query. // Returns a *NotFoundError when no StorageFile was found. func (sfq *StorageFileQuery) First(ctx context.Context) (*StorageFile, error) { - nodes, err := sfq.Limit(1).All(setContextOp(ctx, sfq.ctx, "First")) + nodes, err := sfq.Limit(1).All(setContextOp(ctx, sfq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -87,7 +88,7 @@ func (sfq *StorageFileQuery) FirstX(ctx context.Context) *StorageFile { // Returns a *NotFoundError when no StorageFile ID was found. func (sfq *StorageFileQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = sfq.Limit(1).IDs(setContextOp(ctx, sfq.ctx, "FirstID")); err != nil { + if ids, err = sfq.Limit(1).IDs(setContextOp(ctx, sfq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -110,7 +111,7 @@ func (sfq *StorageFileQuery) FirstIDX(ctx context.Context) uuid.UUID { // Returns a *NotSingularError when more than one StorageFile entity is found. // Returns a *NotFoundError when no StorageFile entities are found. func (sfq *StorageFileQuery) Only(ctx context.Context) (*StorageFile, error) { - nodes, err := sfq.Limit(2).All(setContextOp(ctx, sfq.ctx, "Only")) + nodes, err := sfq.Limit(2).All(setContextOp(ctx, sfq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -138,7 +139,7 @@ func (sfq *StorageFileQuery) OnlyX(ctx context.Context) *StorageFile { // Returns a *NotFoundError when no entities are found. func (sfq *StorageFileQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID - if ids, err = sfq.Limit(2).IDs(setContextOp(ctx, sfq.ctx, "OnlyID")); err != nil { + if ids, err = sfq.Limit(2).IDs(setContextOp(ctx, sfq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -163,7 +164,7 @@ func (sfq *StorageFileQuery) OnlyIDX(ctx context.Context) uuid.UUID { // All executes the query and returns a list of StorageFiles. func (sfq *StorageFileQuery) All(ctx context.Context) ([]*StorageFile, error) { - ctx = setContextOp(ctx, sfq.ctx, "All") + ctx = setContextOp(ctx, sfq.ctx, ent.OpQueryAll) if err := sfq.prepareQuery(ctx); err != nil { return nil, err } @@ -185,7 +186,7 @@ func (sfq *StorageFileQuery) IDs(ctx context.Context) (ids []uuid.UUID, err erro if sfq.ctx.Unique == nil && sfq.path != nil { sfq.Unique(true) } - ctx = setContextOp(ctx, sfq.ctx, "IDs") + ctx = setContextOp(ctx, sfq.ctx, ent.OpQueryIDs) if err = sfq.Select(storagefile.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -203,7 +204,7 @@ func (sfq *StorageFileQuery) IDsX(ctx context.Context) []uuid.UUID { // Count returns the count of the given query. func (sfq *StorageFileQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, sfq.ctx, "Count") + ctx = setContextOp(ctx, sfq.ctx, ent.OpQueryCount) if err := sfq.prepareQuery(ctx); err != nil { return 0, err } @@ -221,7 +222,7 @@ func (sfq *StorageFileQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (sfq *StorageFileQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, sfq.ctx, "Exist") + ctx = setContextOp(ctx, sfq.ctx, ent.OpQueryExist) switch _, err := sfq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -254,8 +255,9 @@ func (sfq *StorageFileQuery) Clone() *StorageFileQuery { inters: append([]Interceptor{}, sfq.inters...), predicates: append([]predicate.StorageFile{}, sfq.predicates...), // clone intermediate query. - sql: sfq.sql.Clone(), - path: sfq.path, + sql: sfq.sql.Clone(), + path: sfq.path, + modifiers: append([]func(*sql.Selector){}, sfq.modifiers...), } } @@ -498,7 +500,7 @@ func (sfgb *StorageFileGroupBy) Aggregate(fns ...AggregateFunc) *StorageFileGrou // Scan applies the selector query and scans the result into the given value. func (sfgb *StorageFileGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sfgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, sfgb.build.ctx, ent.OpQueryGroupBy) if err := sfgb.build.prepareQuery(ctx); err != nil { return err } @@ -546,7 +548,7 @@ func (sfs *StorageFileSelect) Aggregate(fns ...AggregateFunc) *StorageFileSelect // Scan applies the selector query and scans the result into the given value. func (sfs *StorageFileSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sfs.ctx, "Select") + ctx = setContextOp(ctx, sfs.ctx, ent.OpQuerySelect) if err := sfs.prepareQuery(ctx); err != nil { return err } diff --git a/ent/user_query.go b/ent/user_query.go index a1548b7..81639aa 100644 --- a/ent/user_query.go +++ b/ent/user_query.go @@ -12,6 +12,7 @@ import ( "registry-backend/ent/publisherpermission" "registry-backend/ent/user" + "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" @@ -111,7 +112,7 @@ func (uq *UserQuery) QueryReviews() *NodeReviewQuery { // First returns the first User entity from the query. // Returns a *NotFoundError when no User was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - nodes, err := uq.Limit(1).All(setContextOp(ctx, uq.ctx, "First")) + nodes, err := uq.Limit(1).All(setContextOp(ctx, uq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (uq *UserQuery) FirstX(ctx context.Context) *User { // Returns a *NotFoundError when no User ID was found. func (uq *UserQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = uq.Limit(1).IDs(setContextOp(ctx, uq.ctx, "FirstID")); err != nil { + if ids, err = uq.Limit(1).IDs(setContextOp(ctx, uq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -157,7 +158,7 @@ func (uq *UserQuery) FirstIDX(ctx context.Context) string { // Returns a *NotSingularError when more than one User entity is found. // Returns a *NotFoundError when no User entities are found. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - nodes, err := uq.Limit(2).All(setContextOp(ctx, uq.ctx, "Only")) + nodes, err := uq.Limit(2).All(setContextOp(ctx, uq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -185,7 +186,7 @@ func (uq *UserQuery) OnlyX(ctx context.Context) *User { // Returns a *NotFoundError when no entities are found. func (uq *UserQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = uq.Limit(2).IDs(setContextOp(ctx, uq.ctx, "OnlyID")); err != nil { + if ids, err = uq.Limit(2).IDs(setContextOp(ctx, uq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -210,7 +211,7 @@ func (uq *UserQuery) OnlyIDX(ctx context.Context) string { // All executes the query and returns a list of Users. func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { - ctx = setContextOp(ctx, uq.ctx, "All") + ctx = setContextOp(ctx, uq.ctx, ent.OpQueryAll) if err := uq.prepareQuery(ctx); err != nil { return nil, err } @@ -232,7 +233,7 @@ func (uq *UserQuery) IDs(ctx context.Context) (ids []string, err error) { if uq.ctx.Unique == nil && uq.path != nil { uq.Unique(true) } - ctx = setContextOp(ctx, uq.ctx, "IDs") + ctx = setContextOp(ctx, uq.ctx, ent.OpQueryIDs) if err = uq.Select(user.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -250,7 +251,7 @@ func (uq *UserQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (uq *UserQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, uq.ctx, "Count") + ctx = setContextOp(ctx, uq.ctx, ent.OpQueryCount) if err := uq.prepareQuery(ctx); err != nil { return 0, err } @@ -268,7 +269,7 @@ func (uq *UserQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (uq *UserQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, uq.ctx, "Exist") + ctx = setContextOp(ctx, uq.ctx, ent.OpQueryExist) switch _, err := uq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -303,8 +304,9 @@ func (uq *UserQuery) Clone() *UserQuery { withPublisherPermissions: uq.withPublisherPermissions.Clone(), withReviews: uq.withReviews.Clone(), // clone intermediate query. - sql: uq.sql.Clone(), - path: uq.path, + sql: uq.sql.Clone(), + path: uq.path, + modifiers: append([]func(*sql.Selector){}, uq.modifiers...), } } @@ -647,7 +649,7 @@ func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { // Scan applies the selector query and scans the result into the given value. func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) if err := ugb.build.prepareQuery(ctx); err != nil { return err } @@ -695,7 +697,7 @@ func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { // Scan applies the selector query and scans the result into the given value. func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, "Select") + ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) if err := us.prepareQuery(ctx); err != nil { return err } diff --git a/go.mod b/go.mod index cfe9197..8abbc50 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,14 @@ module registry-backend -go 1.21.5 +go 1.23.0 + +toolchain go1.23.4 require ( cloud.google.com/go/monitoring v1.18.0 cloud.google.com/go/pubsub v1.36.1 cloud.google.com/go/storage v1.38.0 - entgo.io/ent v0.13.1 + entgo.io/ent v0.14.1 firebase.google.com/go v3.13.0+incompatible github.com/Masterminds/semver/v3 v3.2.1 github.com/algolia/algoliasearch-client-go/v3 v3.31.1 @@ -30,7 +32,7 @@ require ( require github.com/golang-jwt/jwt v3.2.2+incompatible // indirect require ( - ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 // indirect + ariga.io/atlas v0.30.0 // indirect cloud.google.com/go v0.112.0 // indirect cloud.google.com/go/compute v1.24.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect @@ -44,6 +46,7 @@ require ( github.com/agext/levenshtein v1.2.3 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/bmatcuk/doublestar v1.3.4 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/containerd/containerd v1.7.12 // indirect github.com/containerd/log v0.1.0 // indirect @@ -57,7 +60,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-openapi/inflect v0.19.0 // indirect + github.com/go-openapi/inflect v0.21.0 // indirect github.com/go-openapi/jsonpointer v0.20.2 // indirect github.com/go-openapi/swag v0.22.9 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -67,7 +70,8 @@ require ( github.com/google/s2a-go v0.1.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.1 // indirect - github.com/hashicorp/hcl/v2 v2.19.1 // indirect + github.com/hashicorp/hcl/v2 v2.23.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/invopop/yaml v0.2.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/klauspost/compress v1.16.7 // indirect @@ -77,6 +81,7 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect @@ -84,39 +89,43 @@ require ( github.com/moby/term v0.5.0 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/morikuni/aec v1.0.0 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc5 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/shirou/gopsutil/v3 v3.23.12 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + github.com/spf13/cobra v1.8.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect - github.com/zclconf/go-cty v1.14.2 // indirect + github.com/zclconf/go-cty v1.16.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect go.opentelemetry.io/otel v1.23.1 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect go.opentelemetry.io/otel/trace v1.23.1 // indirect - golang.org/x/crypto v0.22.0 // indirect + golang.org/x/crypto v0.32.0 // indirect golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/net v0.34.0 // indirect golang.org/x/oauth2 v0.17.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.20.0 // indirect + golang.org/x/tools v0.29.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect diff --git a/go.sum b/go.sum index b13e6a2..b8fe3c6 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 h1:GwdJbXydHCYPedeeLt4x/lrlIISQ4JTH1mRWuE5ZZ14= ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43/go.mod h1:uj3pm+hUTVN/X5yfdBexHlZv+1Xu5u5ZbZx7+CDavNU= +ariga.io/atlas v0.30.0 h1:Tyi4A1LXDp9VB+EO51e8Xacsw31uJge9fr5pmd3TL9U= +ariga.io/atlas v0.30.0/go.mod h1:lkLAw/t2/P7g5CFYlYmHvNuShlmGujwm3OGsW00xowI= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= @@ -25,6 +27,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= entgo.io/ent v0.13.1 h1:uD8QwN1h6SNphdCCzmkMN3feSUzNnVvV/WIkHKMbzOE= entgo.io/ent v0.13.1/go.mod h1:qCEmo+biw3ccBn9OyL4ZK5dfpwg++l1Gxwac5B1206A= +entgo.io/ent v0.14.1 h1:fUERL506Pqr92EPHJqr8EYxbPioflJo6PudkrEA8a/s= +entgo.io/ent v0.14.1/go.mod h1:MH6XLG0KXpkcDQhKiHfANZSzR55TJyPL5IGNpI8wpco= firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4= firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= @@ -50,6 +54,8 @@ github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= +github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0= +github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -64,6 +70,7 @@ github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3 github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -98,6 +105,8 @@ github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4= github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= +github.com/go-openapi/inflect v0.21.0 h1:FoBjBTQEcbg2cJUWX6uwL9OyIW8eqc9k4KhN4lfbeYk= +github.com/go-openapi/inflect v0.21.0/go.mod h1:INezMuUu7SJQc2AyR3WO0DqqYUJSj8Kb4hBd7WtjlAw= github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= @@ -155,6 +164,10 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI= github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= +github.com/hashicorp/hcl/v2 v2.23.0 h1:Fphj1/gCylPxHutVSEOf2fBOh1VE4AuLV7+kbJf3qos= +github.com/hashicorp/hcl/v2 v2.23.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= @@ -201,6 +214,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= @@ -236,11 +251,15 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4= @@ -253,6 +272,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= @@ -292,6 +313,8 @@ github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFi github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zclconf/go-cty v1.14.2 h1:kTG7lqmBou0Zkx35r6HJHUQTvaRPr5bIAf3AoHS0izI= github.com/zclconf/go-cty v1.14.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.16.0 h1:xPKEhst+BW5D0wxebMZkxgapvOE/dw7bFTlgSc9nD6w= +github.com/zclconf/go-cty v1.16.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.einride.tech/aip v0.66.0 h1:XfV+NQX6L7EOYK11yoHHFtndeaWh3KbD9/cN/6iWEt8= go.einride.tech/aip v0.66.0/go.mod h1:qAhMsfT7plxBX+Oy7Huol6YUvZ0ZzdUz26yZsQwfl1M= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= @@ -320,6 +343,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= @@ -333,6 +358,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -346,6 +373,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= @@ -357,6 +386,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -377,6 +408,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -385,6 +418,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -398,6 +433,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= +golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/integration-tests/registry_integration_test.go b/integration-tests/registry_integration_test.go index 860c458..59f554a 100644 --- a/integration-tests/registry_integration_test.go +++ b/integration-tests/registry_integration_test.go @@ -838,7 +838,8 @@ func TestRegistryComfyNode(t *testing.T) { require.NoError(t, err, "should not return error") } nodeVersion := nodeVersions[len(nodeVersions)-1] - backfilledNodeVersions := nodeVersions[:len(nodeVersions)-1] + nodeVersionExtractionFailed := nodeVersions[len(nodeVersions)-2] + backfilledNodeVersions := nodeVersions[:len(nodeVersions)-2] t.Run("NoComfyNode", func(t *testing.T) { res, err := withMiddleware(authz, impl.GetNodeVersion)(ctx, drip.GetNodeVersionRequestObject{ @@ -877,14 +878,50 @@ func TestRegistryComfyNode(t *testing.T) { }} // create comfy nodes - body := drip.CreateComfyNodesJSONRequestBody(comfyNodes) - res, err := withMiddleware(authz, impl.CreateComfyNodes)(ctx, drip.CreateComfyNodesRequestObject{ - NodeId: *node.Id, - Version: *nodeVersion.Version, - Body: &body, - }) - require.NoError(t, err) - require.IsType(t, drip.CreateComfyNodes204Response{}, res) + { + body := drip.CreateComfyNodesJSONRequestBody(comfyNodes) + res, err := withMiddleware(authz, impl.CreateComfyNodes)(ctx, drip.CreateComfyNodesRequestObject{ + NodeId: *node.Id, + Version: *nodeVersion.Version, + Body: &body, + }) + require.NoError(t, err) + require.IsType(t, drip.CreateComfyNodes204Response{}, res) + } + + // mark comfy nodes extraction as failed + { + res, err := withMiddleware(authz, impl.CreateComfyNodes)(ctx, drip.CreateComfyNodesRequestObject{ + NodeId: *node.Id, + Version: *nodeVersionExtractionFailed.Version, + Body: &drip.CreateComfyNodesJSONRequestBody{Success: proto.Bool(false)}, + }) + require.NoError(t, err) + require.IsType(t, drip.CreateComfyNodes204Response{}, res) + } + + t.Run("AssertAlgolia", func(t *testing.T) { + indexed := impl.mockAlgolia.LastIndexedNodes + require.Len(t, impl.mockAlgolia.LastIndexedNodes, 1) + + node, err := client.Node.Get(ctx, *node.Id) + require.NoError(t, err) + nodeVersion, err := client.NodeVersion.Query().Where(nodeversion.Version(*nodeVersion.Version)).WithComfyNodes().Only(ctx) + require.NoError(t, err) + node.Edges.Versions = append(node.Edges.Versions, nodeVersion) + + assert.Equal(t, node.ID, indexed[0].ID) + assert.Equal(t, node.Edges.Versions[0].ID, indexed[0].Edges.Versions[0].ID) + indexedComfyNodes := drip.CreateComfyNodesJSONRequestBody{ + Nodes: &map[string]drip.ComfyNode{}, + } + for _, node := range indexed[0].Edges.Versions[0].Edges.ComfyNodes { + cn := *(mapper.DBComfyNodeToApiComfyNode(node)) + cn.ComfyNodeId = nil + (*indexedComfyNodes.Nodes)[node.ID] = cn + } + assert.Equal(t, comfyNodes, indexedComfyNodes) + }) t.Run("AssertAlgolia", func(t *testing.T) { indexed := impl.mockAlgolia.LastIndexedNodes diff --git a/node-pack-extract/cloudbuild.yaml b/node-pack-extract/cloudbuild.yaml index c0137b6..72f4fbe 100644 --- a/node-pack-extract/cloudbuild.yaml +++ b/node-pack-extract/cloudbuild.yaml @@ -28,6 +28,7 @@ steps: args: - -c - gcloud auth print-identity-token --audiences="$_REGISTRY_BACKEND_URL" | tee /workspace/token + waitFor: ["-"] - name: "curlimages/curl" entrypoint: "sh" diff --git a/node-pack-extract/entrypoint.sh b/node-pack-extract/entrypoint.sh index 7f4c6f4..34d9bbd 100644 --- a/node-pack-extract/entrypoint.sh +++ b/node-pack-extract/entrypoint.sh @@ -8,6 +8,7 @@ init.sh & OUTPUTFILE=${1:-"/tmp/output.json"} echo -n > "$OUTPUTFILE" until cat "$OUTPUTFILE" | grep ''; do + sleep 1 curl -sf localhost:8188/object_info | jq -c ' to_entries | @@ -24,11 +25,10 @@ until cat "$OUTPUTFILE" | grep ''; do output_is_list : .output_is_list, } ) | - if length > 0 then {nodes: from_entries} else "" end' | + if length > 0 then + {success: true, nodes: from_entries} + else + {success: false} + end' | tee "$OUTPUTFILE" - - sleep 1 done - -# make sure its json or we fail -grep '{' "$OUTPUTFILE" diff --git a/openapi.yml b/openapi.yml index 02568ac..31752d3 100644 --- a/openapi.yml +++ b/openapi.yml @@ -1788,6 +1788,8 @@ paths: schema: type: object properties: + success: + type: boolean nodes: additionalProperties: $ref: '#/components/schemas/ComfyNode' diff --git a/server/implementation/registry.go b/server/implementation/registry.go index a1bd34e..a3aaa25 100644 --- a/server/implementation/registry.go +++ b/server/implementation/registry.go @@ -1008,20 +1008,25 @@ func (s *DripStrictServerImplementation) ReindexNodes(ctx context.Context, reque return drip.ReindexNodes200Response{}, nil } -// CreateComfyNodes bulk-creates comfy-nodes for a node version +// CreateComfyNodes bulk-stores comfy-nodes extraction result for a node version func (impl *DripStrictServerImplementation) CreateComfyNodes(ctx context.Context, request drip.CreateComfyNodesRequestObject) (res drip.CreateComfyNodesResponseObject, err error) { - err = impl.RegistryService.CreateComfyNodes(ctx, impl.Client, request.NodeId, request.Version, *request.Body.Nodes) + if request.Body.Success != nil && !*request.Body.Success { + err = impl.RegistryService.MarKComfyNodeExtractionFailed(ctx, impl.Client, request.NodeId, request.Version) + } else { + err = impl.RegistryService.CreateComfyNodes(ctx, impl.Client, request.NodeId, request.Version, *request.Body.Nodes) + } + if ent.IsNotFound(err) { log.Ctx(ctx).Error().Msgf("Node or node version not found w/ err: %v", err) return drip.CreateComfyNodes404JSONResponse{Message: "Node or node version not found", Error: err.Error()}, nil } if errors.Is(err, drip_services.ErrComfyNodesAlreadyExist) { - log.Ctx(ctx).Error().Msgf("Comfy nodes for %s %s exist", request.NodeId, request.Version) - return drip.CreateComfyNodes409JSONResponse{Message: "Comfy nodes already exist", Error: err.Error()}, nil + log.Ctx(ctx).Error().Msgf("Comfy nodes extraction result for %s %s already set", request.NodeId, request.Version) + return drip.CreateComfyNodes409JSONResponse{Message: "Comfy nodes extraction result already set", Error: err.Error()}, nil } if err != nil { - log.Ctx(ctx).Error().Msgf("Failed to create comfy nodes w/ err: %v", err) - return drip.CreateComfyNodes500JSONResponse{Message: "Failed to create comfy nodes", Error: err.Error()}, nil + log.Ctx(ctx).Error().Msgf("Failed to store comfy nodes extraction w/ err: %v", err) + return drip.CreateComfyNodes500JSONResponse{Message: "Failed to store comfy nodes extraction", Error: err.Error()}, nil } log.Ctx(ctx).Info().Msgf("CreateComfyNodes successful") diff --git a/services/registry/registry_svc.go b/services/registry/registry_svc.go index 1f01915..1474098 100644 --- a/services/registry/registry_svc.go +++ b/services/registry/registry_svc.go @@ -570,6 +570,17 @@ func (s *RegistryService) GetLatestNodeVersion(ctx context.Context, client *ent. var ErrComfyNodesAlreadyExist = errors.New("comfy nodes already exist") +func (s *RegistryService) MarKComfyNodeExtractionFailed(ctx context.Context, client *ent.Client, nodeID string, nodeVersion string) error { + return client.NodeVersion. + Update(). + Where( + nodeversion.NodeIDEQ(nodeID), + nodeversion.VersionEQ(nodeVersion), + ). + SetComfyNodeExtractStatus(schema.ComfyNodeExtractStatusFailed). + Exec(ctx) +} + func (s *RegistryService) CreateComfyNodes(ctx context.Context, client *ent.Client, nodeID string, nodeVersion string, comfyNodes map[string]drip.ComfyNode) (err error) { return db.WithTx(ctx, client, func(tx *ent.Tx) error { nv, err := tx.NodeVersion.Query(). @@ -629,6 +640,11 @@ func (s *RegistryService) CreateComfyNodes(ctx context.Context, client *ent.Clie return fmt.Errorf("failed to update comfy nodes: %w", err) } + err = nv.Update().SetComfyNodeExtractStatus(schema.ComfyNodeExtractStatusSuccess).Exec(ctx) + if err != nil { + return fmt.Errorf("failed to update comfy nodes extraction status: %w", err) + } + if _, err := s.indexNodeWithLatestVersion(ctx, tx.Client(), nodeID); err != nil { return fmt.Errorf("failed to update node index") } @@ -642,6 +658,7 @@ func (s *RegistryService) GetComfyNode(ctx context.Context, client *ent.Client, nv, err := client.NodeVersion.Query(). Where(nodeversion.VersionEQ(nodeVersion)). Where(nodeversion.NodeIDEQ(nodeID)). + Where(nodeversion.ComfyNodeExtractStatusEQ(schema.ComfyNodeExtractStatusSuccess)). WithComfyNodes(func(cnq *ent.ComfyNodeQuery) { cnq.Where(comfynode.IDEQ(comfyNodeID)) }). @@ -656,7 +673,7 @@ func (s *RegistryService) TriggerComfyNodesBackfill(ctx context.Context, client q := client.NodeVersion. Query(). WithStorageFile(). - Where(nodeversion.Not(nodeversion.HasComfyNodes())) + Where(nodeversion.ComfyNodeExtractStatusEQ(schema.ComfyNodeExtractStatusPending)) if max != nil { q.Limit(*max) }