workflowgenerated

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Code generated by ent. DO NOT EDIT. This file is generated to keep workflow create helpers in sync with ent schemas.

Code generated by ent. DO NOT EDIT. This file is generated to provide type-safe workflow domains for approval scopes.

Code generated by ent. DO NOT EDIT. This should be above the package name declaration for go tooling to treat this as generated. This file is generated to detect edge mutations for workflow triggers.

Code generated by ent. DO NOT EDIT. This file is generated to keep workflow registries in sync with ent schemas.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilClient               = errors.New("ent client is required")
	ErrCreateObjectTypeInvalid = errors.New("create object type is invalid")
)
View Source
var ErrEmptyDomainFields = fmt.Errorf("domain requires at least one field")

ErrEmptyDomainFields is returned when no fields are provided for a domain

View Source
var ErrInvalidDomainField = fmt.Errorf("field is not workflow-eligible for object type")

ErrInvalidDomainField is returned when a field is not workflow-eligible for the object type

View Source
var ErrInvalidObjectType = fmt.Errorf("object type is not workflow-eligible")

ErrInvalidObjectType is returned when an object type is not workflow-eligible

View Source
var WorkflowEligibleEdges = map[string][]string{
	generated.TypeActionPlan: edgeList(
		"approver",
		"delegate",
		"workflow_object_refs",
	),
	generated.TypeControl: edgeList(
		"evidence",
		"control_objectives",
		"tasks",
		"narratives",
		"risks",
		"action_plans",
		"procedures",
		"internal_policies",
		"comments",
		"discussions",
		"control_owner",
		"delegate",
		"responsible_party",
		"workflow_object_refs",
	),
	generated.TypeEvidence: edgeList(
		"workflow_object_refs",
	),
	generated.TypeInternalPolicy: edgeList(
		"approver",
		"delegate",
		"file",
		"comments",
		"discussions",
		"workflow_object_refs",
	),
	generated.TypeProcedure: edgeList(
		"approver",
		"delegate",
		"controls",
		"subcontrols",
		"internal_policies",
		"programs",
		"narratives",
		"risks",
		"tasks",
		"comments",
		"discussions",
		"file",
		"workflow_object_refs",
	),
	generated.TypeSubcontrol: edgeList(
		"evidence",
		"control_objectives",
		"tasks",
		"narratives",
		"risks",
		"action_plans",
		"procedures",
		"internal_policies",
		"comments",
		"discussions",
		"control_owner",
		"delegate",
		"responsible_party",
		"control",
		"control_implementations",
		"mapped_to_subcontrols",
		"mapped_from_subcontrols",
		"workflow_object_refs",
	),
}
View Source
var WorkflowEligibleFields = map[enums.WorkflowObjectType]map[string]struct{}{
	enums.WorkflowObjectTypeActionPlan: {
		"status":                   {},
		"details":                  {},
		"details_json":             {},
		"workflow_eligible_marker": {},
	},
	enums.WorkflowObjectTypeCampaign: {
		"workflow_eligible_marker": {},
		"status":                   {},
		"is_active":                {},
		"scheduled_at":             {},
		"due_date":                 {},
		"is_recurring":             {},
		"recurrence_frequency":     {},
		"recipient_count":          {},
		"resend_count":             {},
	},
	enums.WorkflowObjectTypeCampaignTarget: {
		"workflow_eligible_marker": {},
		"status":                   {},
		"sent_at":                  {},
		"completed_at":             {},
	},
	enums.WorkflowObjectTypeControl: {
		"title":                        {},
		"reference_id":                 {},
		"auditor_reference_id":         {},
		"responsible_party_id":         {},
		"status":                       {},
		"reference_framework":          {},
		"reference_framework_revision": {},
		"category":                     {},
		"category_id":                  {},
		"subcategory":                  {},
		"control_owner_id":             {},
		"workflow_eligible_marker":     {},
	},
	enums.WorkflowObjectTypeEvidence: {
		"workflow_eligible_marker": {},
	},
	enums.WorkflowObjectTypeIdentityHolder: {
		"workflow_eligible_marker": {},
		"status":                   {},
		"is_active":                {},
		"start_date":               {},
		"end_date":                 {},
	},
	enums.WorkflowObjectTypeInternalPolicy: {
		"status":                   {},
		"details":                  {},
		"details_json":             {},
		"workflow_eligible_marker": {},
	},
	enums.WorkflowObjectTypePlatform: {
		"workflow_eligible_marker": {},
		"business_purpose":         {},
		"scope_statement":          {},
		"status":                   {},
		"contains_pii":             {},
	},
	enums.WorkflowObjectTypeProcedure: {
		"status":                   {},
		"details":                  {},
		"details_json":             {},
		"workflow_eligible_marker": {},
	},
	enums.WorkflowObjectTypeSubcontrol: {
		"title":                        {},
		"reference_id":                 {},
		"auditor_reference_id":         {},
		"responsible_party_id":         {},
		"status":                       {},
		"reference_framework":          {},
		"reference_framework_revision": {},
		"category":                     {},
		"category_id":                  {},
		"subcategory":                  {},
		"control_owner_id":             {},
		"workflow_eligible_marker":     {},
	},
}

WorkflowEligibleFields maps object types to their workflow-eligible field names. Use this to validate that fields in a domain are valid for the object type.

Functions

func CreateObject added in v1.8.1

func CreateObject(ctx context.Context, client *generated.Client, schemaType string, fields map[string]any) error

CreateObject builds and executes a create mutation for the provided schema type.

func ExtractChangedEdges

func ExtractChangedEdges(m ent.Mutation) ([]string, map[string][]string, map[string][]string)

ExtractChangedEdges inspects the mutation to determine which edge relationships were modified. It returns: edge names, added IDs per edge, removed IDs per edge.

func IsCreatableSchemaType added in v1.8.1

func IsCreatableSchemaType(schemaType string) bool

IsCreatableSchemaType reports whether the schema type maps to a creatable ent client.

func NormalizeSchemaType added in v1.8.1

func NormalizeSchemaType(value string) string

NormalizeSchemaType returns a normalized schema identifier for matching.

Types

type WorkflowDomain added in v1.5.10

type WorkflowDomain struct {
	// ObjectType is the workflow object type this domain applies to
	ObjectType enums.WorkflowObjectType
	// Fields is the sorted list of field names in this domain
	Fields []string
}

WorkflowDomain represents a canonical approval domain for workflow proposals. A domain is the combination of an object type and the fields requiring approval.

func NewWorkflowDomain added in v1.5.10

func NewWorkflowDomain(objectType enums.WorkflowObjectType, fields []string) (WorkflowDomain, error)

NewWorkflowDomain creates a validated domain for an object type and fields. Fields are automatically sorted to ensure canonical ordering. Returns an error if the object type or any field is not workflow-eligible.

func (WorkflowDomain) Key added in v1.5.10

func (d WorkflowDomain) Key() string

Key returns the canonical domain key including object type prefix. Format: "ObjectType:field1,field2,field3" (fields are sorted).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL