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 ¶
- Variables
- func CreateObject(ctx context.Context, client *generated.Client, schemaType string, ...) error
- func ExtractChangedEdges(m ent.Mutation) ([]string, map[string][]string, map[string][]string)
- func IsCreatableSchemaType(schemaType string) bool
- func NormalizeSchemaType(value string) string
- type WorkflowDomain
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilClient = errors.New("ent client is required") ErrCreateObjectTypeInvalid = errors.New("create object type is invalid") )
var ErrEmptyDomainFields = fmt.Errorf("domain requires at least one field")
ErrEmptyDomainFields is returned when no fields are provided for a domain
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
var ErrInvalidObjectType = fmt.Errorf("object type is not workflow-eligible")
ErrInvalidObjectType is returned when an object type is not workflow-eligible
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", ), }
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 ¶
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
IsCreatableSchemaType reports whether the schema type maps to a creatable ent client.
func NormalizeSchemaType ¶ added in v1.8.1
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).