Documentation
¶
Overview ¶
Package workflows provides minimal registry types for workflow ent templates
Index ¶
- Constants
- Variables
- func AllowBypassContext(ctx context.Context) context.Context
- func AllowBypassContextWithEvents(ctx context.Context) context.Context
- func AllowBypassContextWithOrg(ctx context.Context) (context.Context, string, error)
- func AllowContext(ctx context.Context) context.Context
- func AllowContextForOrg(ctx context.Context, orgID string) context.Context
- func AllowContextWithOrg(ctx context.Context) (context.Context, string, error)
- func AllowWorkflowEventEmission(ctx context.Context) bool
- func ApplyObjectFieldUpdates(ctx context.Context, client *generated.Client, ...) error
- func ApprovalDomains(doc models.WorkflowDefinitionDocument) ([][]string, error)
- func ApprovalTimingOrDefault(doc models.WorkflowDefinitionDocument) enums.WorkflowApprovalTiming
- func BuildAssignmentContext(ctx context.Context, client *generated.Client, instanceID string) (map[string]any, error)
- func BuildCELVars(obj *Object, changedFields []string, changedEdges []string, ...) map[string]any
- func BuildObjectReplacements(obj *Object) map[string]string
- func BuildWorkflowActionContext(instance *generated.WorkflowInstance, obj *Object, actionKey string) (map[string]string, map[string]any)
- func CleanupOrphanWorkflowInstances(ctx context.Context, client *generated.Client, ownerID string) ([]string, error)
- func ComputeProposalHash(changes map[string]any) (string, error)
- func ConvertApprovalActionsToReview(doc models.WorkflowDefinitionDocument) models.WorkflowDefinitionDocument
- func CreateWorkflowInstanceWithObjectRef(ctx context.Context, tx *generated.Tx, params WorkflowInstanceBuilderParams) (*generated.WorkflowInstance, *generated.WorkflowObjectRef, error)
- func DefinitionHasApprovalAction(doc models.WorkflowDefinitionDocument) bool
- func DefinitionHasReviewAction(doc models.WorkflowDefinitionDocument) bool
- func DefinitionUsesPostCommitApprovals(doc models.WorkflowDefinitionDocument) bool
- func DefinitionUsesPreCommitApprovals(doc models.WorkflowDefinitionDocument) bool
- func DeleteWorkflowInstanceChildren(ctx context.Context, client *generated.Client, instanceIDs []string) error
- func DeleteWorkflowInstancesCascade(ctx context.Context, client *generated.Client, instanceIDs []string) error
- func DeriveDomainKey(objectType enums.WorkflowObjectType, fields []string) string
- func DeriveTriggerPrefilter(doc models.WorkflowDefinitionDocument) ([]string, []string)
- func EligibleWorkflowFields(objectType enums.WorkflowObjectType) map[string]struct{}
- func EnrichWorkflowPayload(ctx context.Context, client *generated.Client, ...) error
- func FieldsFromChanges(changes map[string]any) []string
- func FilterChangesForDomain(changes map[string]any, approvalFields []string) map[string]any
- func FilterWorkflowInstances(query *generated.WorkflowInstanceQuery, objectType enums.WorkflowObjectType, ...) (*generated.WorkflowInstanceQuery, error)
- func FilterWorkflowObjectRefs(query *generated.WorkflowObjectRefQuery, objectType enums.WorkflowObjectType, ...) (*generated.WorkflowObjectRefQuery, error)
- func FindOrphanWorkflowInstanceIDs(ctx context.Context, client *generated.Client, ownerID string) ([]string, error)
- func FindProposalForObjectRefs(ctx context.Context, client *generated.Client, objRefIDs []string, ...) (*generated.WorkflowProposal, error)
- func FromContext(ctx context.Context) bool
- func GetObjectUpdatedBy(obj *Object) string
- func IsWorkflowBypass(ctx context.Context) bool
- func LoadWorkflowObject(ctx context.Context, client *generated.Client, schemaType string, ...) (generated.Noder, error)
- func NewCELEnv(cfg *Config, scope CELExpressionScope) (*cel.Env, error)
- func ObjectOwnerID(ctx context.Context, client *generated.Client, ...) (string, error)
- func ObjectRefIDs(ctx context.Context, client *generated.Client, obj *Object) ([]string, error)
- func OrganizationOwnerIDs(ctx context.Context, client *generated.Client, orgID string) ([]string, error)
- func RegisterAssignmentContextBuilder(builder AssignmentContextBuilder)
- func RegisterCELContextBuilder(builder CELContextBuilder)
- func RegisterObservabilityFieldsBuilder(builder ObservabilityFieldsBuilder)
- func ResolveOwnerID(ctx context.Context, ownerID string) (string, error)
- func ResolveUserDisplayName(ctx context.Context, client *generated.Client, userID string) string
- func SetTriggerChangeSet(ctx *models.WorkflowInstanceContext, changeSet entityops.ChangeSet)
- func StringField(node any, field string) (string, error)
- func StringSliceField(node any, field string) ([]string, error)
- func TriggerChangeSet(ctx models.WorkflowInstanceContext) entityops.ChangeSet
- func ValidateCELExpression(cfg *Config, scope CELExpressionScope, expression string) error
- func ValidatedDomainKey(objectType enums.WorkflowObjectType, fields []string) (string, error)
- func WithAllowWorkflowEventEmission(ctx context.Context) context.Context
- func WithContext(ctx context.Context) context.Context
- func WithTx[T any](ctx context.Context, client *generated.Client, scope *observability.Scope, ...) (T, error)
- func WorkflowSchema(objectType enums.WorkflowObjectType) (*entityops.Schema, error)
- type ApprovalActionParams
- type AssignmentContextBuilder
- type CELConfig
- type CELContextBuilder
- type CELExpressionScope
- type Config
- type ConfigOpts
- func WithCELComprehensionNestingLimit(limit int) ConfigOpts
- func WithCELCostLimit(limit uint64) ConfigOpts
- func WithCELCrossTypeNumericComparisons(enabled bool) ConfigOpts
- func WithCELEvalOptimize(enabled bool) ConfigOpts
- func WithCELExtendedValidations(enabled bool) ConfigOpts
- func WithCELIdentifierEscapeSyntax(enabled bool) ConfigOpts
- func WithCELInterruptCheckFrequency(freq uint) ConfigOpts
- func WithCELMacroCallTracking(enabled bool) ConfigOpts
- func WithCELOptionalTypes(enabled bool) ConfigOpts
- func WithCELParserExpressionSizeLimit(limit int) ConfigOpts
- func WithCELParserRecursionLimit(limit int) ConfigOpts
- func WithCELTimeout(timeout time.Duration) ConfigOpts
- func WithCELTrackState(enabled bool) ConfigOpts
- func WithConfig(cfg Config) ConfigOpts
- func WithEnabled(enabled bool) ConfigOpts
- func WithRuntimeDefinitions(defs *RuntimeDefinitionRegistry) ConfigOpts
- type CreateObjectActionParams
- type DefinitionSeedManifest
- type DefinitionSeeder
- func (s *DefinitionSeeder) SeedDefinitionsFromManifest(ctx context.Context, manifest DefinitionSeedManifest) error
- func (s *DefinitionSeeder) SeedDefinitionsFromManifestFile(ctx context.Context, filePath string) error
- func (s *DefinitionSeeder) SeedDefinitionsFromManifestURL(ctx context.Context, manifestURL string) error
- type DomainChanges
- type EmitFailureDetails
- type EmitFailureMeta
- type EmitReceipt
- type FieldUpdateActionParams
- type GalaConfig
- type IntegrationActionParams
- type NotificationActionParams
- type Object
- type ObservabilityFieldsBuilder
- type ReviewActionParams
- type RuntimeDefinitionRegistry
- type RuntimeWorkflowDefinition
- type SeedWorkflowDefinition
- type SendEmailActionParams
- type TargetConfig
- type TargetedActionParams
- type TxError
- type WebhookActionParams
- type WorkflowCreationError
- type WorkflowCreationStage
- type WorkflowFieldInfo
- type WorkflowInstanceBuilderParams
- type WorkflowObjectTypeInfo
- type WorkflowSchemaTypeDefinition
Constants ¶
const ( // WorkflowDefinitionJSONSchemaVersion is the JSON Schema draft used for workflow definition schemas WorkflowDefinitionJSONSchemaVersion = "https://json-schema.org/draft/2020-12/schema" // WorkflowDefinitionJSONSchemaID is the canonical schema identifier for workflow definitions WorkflowDefinitionJSONSchemaID = "https://theopenlane.io/schemas/workflow-definition.json" // WorkflowDefinitionJSONSchemaTitle is the display title for workflow definition schemas WorkflowDefinitionJSONSchemaTitle = "Workflow Definition" // WorkflowDefinitionJSONSchemaDescription is the top-level description for workflow definition schemas WorkflowDefinitionJSONSchemaDescription = "Schema for Openlane workflow definitions" )
Variables ¶
var ( // ErrWorkflowNotFound is returned when a workflow instance cannot be found ErrWorkflowNotFound = errors.New("workflow instance not found") // ErrNoProposedChanges is returned when attempting to apply changes but none exist ErrNoProposedChanges = errors.New("no proposed changes to apply") // ErrWorkflowAlreadyActive is returned when trying to start a workflow on an object that already has one ErrWorkflowAlreadyActive = errors.New("workflow already active for this object") // ErrFieldNotWorkflowEligible is returned when proposed changes include non-eligible fields ErrFieldNotWorkflowEligible = errors.New("field is not eligible for workflow modification") // ErrUnsupportedObjectType is returned when a workflow is triggered for an unsupported object type ErrUnsupportedObjectType = errors.New("object type does not support workflows") // ErrMissingObjectID is returned when a workflow object is missing an ID ErrMissingObjectID = errors.New("workflow object is missing an ID") // ErrFailedToBuildCELEnv is returned when the CEL environment cannot be built ErrFailedToBuildCELEnv = errors.New("failed to build CEL environment") // ErrEmitFailureDetailsMissing is returned when emit failure details are empty ErrEmitFailureDetailsMissing = errors.New("emit failure details are missing") // ErrEmitNoEmitter is returned when an emitter is required but missing ErrEmitNoEmitter = errors.New("workflow emit requires an emitter") // ErrNilClient is returned when a workflow helper requires a client ErrNilClient = errors.New("workflow client is required") // ErrMissingOrganizationID is returned when an organization id is required ErrMissingOrganizationID = errors.New("organization id is required") // ErrApprovalActionParamsInvalid is returned when approval action params are invalid ErrApprovalActionParamsInvalid = errors.New("approval action params are invalid") // ErrWorkflowDomainFieldsRequired is returned when an approval domain has no fields ErrWorkflowDomainFieldsRequired = errors.New("workflow domain requires at least one field") // ErrStringFieldMarshal is returned when string field extraction cannot marshal the node ErrStringFieldMarshal = errors.New("failed to marshal node for string field extraction") // ErrStringFieldUnmarshal is returned when string field extraction cannot unmarshal the node ErrStringFieldUnmarshal = errors.New("failed to unmarshal node for string field extraction") // ErrStringFieldNil is returned when string field extraction receives a nil node ErrStringFieldNil = errors.New("string field node is nil") // ErrStringSliceFieldInvalid is returned when a string slice field contains non-string values ErrStringSliceFieldInvalid = errors.New("string slice field contains non-string values") // ErrRuntimeDefinitionKeyRequired is returned when a runtime definition is registered without a key ErrRuntimeDefinitionKeyRequired = errors.New("runtime definition key is required") // ErrRuntimeDefinitionDuplicateKey is returned when a runtime definition key is already registered ErrRuntimeDefinitionDuplicateKey = errors.New("runtime definition key already registered") )
var ( // ErrWorkflowSeedFailed is returned when workflow definition upsert fails. ErrWorkflowSeedFailed = errors.New("workflow definition seed failed") // ErrWorkflowSeedSourceFetchFailed is returned when a remote seed source cannot be fetched. ErrWorkflowSeedSourceFetchFailed = errors.New("workflow definition seed source fetch failed") // ErrWorkflowSeedSourceTooLarge is returned when a remote seed payload exceeds the max size. ErrWorkflowSeedSourceTooLarge = errors.New("workflow definition seed source too large") // ErrWorkflowSeedManifestInvalid is returned when seed payload is malformed. ErrWorkflowSeedManifestInvalid = errors.New("workflow definition seed manifest invalid") // ErrWorkflowSeedDefinitionKeyRequired is returned when definition key is missing. ErrWorkflowSeedDefinitionKeyRequired = errors.New("workflow definition seed key is required") // ErrWorkflowSeedSchemaTypeRequired is returned when schema type cannot be resolved. ErrWorkflowSeedSchemaTypeRequired = errors.New("workflow definition seed schema type is required") // ErrWorkflowSeedWorkflowKindRequired is returned when workflow kind cannot be resolved. ErrWorkflowSeedWorkflowKindRequired = errors.New("workflow definition seed workflow kind is required") // ErrWorkflowSeedURLInvalid is returned when the seed URL is invalid. ErrWorkflowSeedURLInvalid = errors.New("workflow definition seed URL is invalid") )
var ( // ErrTxBegin indicates the transaction failed to start. ErrTxBegin = errors.New("failed to begin transaction") // ErrTxCommit indicates the transaction failed to commit. ErrTxCommit = errors.New("failed to commit transaction") )
var WorkflowDefinitionSchemaExtensionTypes = []WorkflowSchemaTypeDefinition{ {Name: "TargetConfig", Type: reflect.TypeFor[TargetConfig]()}, {Name: "ApprovalActionParams", Type: reflect.TypeFor[ApprovalActionParams]()}, {Name: "ReviewActionParams", Type: reflect.TypeFor[ReviewActionParams]()}, {Name: "NotificationActionParams", Type: reflect.TypeFor[NotificationActionParams]()}, {Name: "WebhookActionParams", Type: reflect.TypeFor[WebhookActionParams]()}, {Name: "FieldUpdateActionParams", Type: reflect.TypeFor[FieldUpdateActionParams]()}, {Name: "IntegrationActionParams", Type: reflect.TypeFor[IntegrationActionParams]()}, {Name: "CreateObjectActionParams", Type: reflect.TypeFor[CreateObjectActionParams]()}, {Name: "SendEmailActionParams", Type: reflect.TypeFor[SendEmailActionParams]()}, }
WorkflowDefinitionSchemaExtensionTypes are additional workflow schema definitions beyond the root model graph
var WorkflowDefinitionSchemaModelTypes = []WorkflowSchemaTypeDefinition{ {Name: "WorkflowTrigger", Type: reflect.TypeFor[models.WorkflowTrigger]()}, {Name: "WorkflowCondition", Type: reflect.TypeFor[models.WorkflowCondition]()}, {Name: "WorkflowAction", Type: reflect.TypeFor[models.WorkflowAction]()}, {Name: "WorkflowSelector", Type: reflect.TypeFor[models.WorkflowSelector]()}, }
WorkflowDefinitionSchemaModelTypes are model definition types expected in workflow schema $defs
var WorkflowDefinitionSchemaRootType = WorkflowSchemaTypeDefinition{ Name: "WorkflowDefinitionDocument", Type: reflect.TypeFor[models.WorkflowDefinitionDocument](), }
WorkflowDefinitionSchemaRootType is the root Go type for workflow definition schema generation
Functions ¶
func AllowBypassContext ¶
AllowBypassContext sets workflow bypass and allow decision for internal workflow operations.
func AllowBypassContextWithEvents ¶
AllowBypassContextWithEvents sets workflow bypass, allow decision, and preserves workflow event emission.
func AllowBypassContextWithOrg ¶
AllowBypassContextWithOrg returns an allow/bypass context plus the organization ID.
func AllowContext ¶
AllowContext sets the ent privacy decision to allow for internal workflow operations. It also sets the internal request marker so FGA checks are bypassed.
func AllowContextForOrg ¶
AllowContextForOrg returns an allow context scoped to the supplied organization.
func AllowContextWithOrg ¶
AllowContextWithOrg returns an allow context plus the organization ID.
func AllowWorkflowEventEmission ¶
AllowWorkflowEventEmission reports whether workflow events should be emitted even when bypass is set.
func ApplyObjectFieldUpdates ¶
func ApplyObjectFieldUpdates(ctx context.Context, client *generated.Client, objectType enums.WorkflowObjectType, objectID string, updates map[string]any) error
ApplyObjectFieldUpdates validates and applies updates through the canonical schema.
func ApprovalDomains ¶
func ApprovalDomains(doc models.WorkflowDefinitionDocument) ([][]string, error)
ApprovalDomains returns the distinct field sets used by approval actions in a definition It returns an error when approval action params cannot be parsed
func ApprovalTimingOrDefault ¶
func ApprovalTimingOrDefault(doc models.WorkflowDefinitionDocument) enums.WorkflowApprovalTiming
ApprovalTimingOrDefault resolves the approval timing, defaulting to PRE_COMMIT.
func BuildAssignmentContext ¶
func BuildAssignmentContext(ctx context.Context, client *generated.Client, instanceID string) (map[string]any, error)
BuildAssignmentContext calls the registered assignment context builder to get workflow runtime state. Returns nil if no builder is registered or instanceID is empty.
func BuildCELVars ¶
func BuildCELVars(obj *Object, changedFields []string, changedEdges []string, addedIDs, removedIDs map[string][]string, eventType, userID string, proposedChanges map[string]any) map[string]any
BuildCELVars constructs the activation map for CEL evaluation, allowing generated builders to provide typed contexts instead of ad-hoc maps
func BuildObjectReplacements ¶
BuildObjectReplacements builds string replacements from object fields for template substitution Keys include both top-level field names and "object.<field>" paths
func BuildWorkflowActionContext ¶
func BuildWorkflowActionContext(instance *generated.WorkflowInstance, obj *Object, actionKey string) (map[string]string, map[string]any)
BuildWorkflowActionContext returns the replacement map and base data for notifications/webhooks.
func CleanupOrphanWorkflowInstances ¶
func CleanupOrphanWorkflowInstances(ctx context.Context, client *generated.Client, ownerID string) ([]string, error)
CleanupOrphanWorkflowInstances deletes orphaned workflow instances and returns deleted IDs. If ownerID is provided, deletions are scoped to that organization.
func ComputeProposalHash ¶
ComputeProposalHash computes a SHA256 hash of a changes map with sorted keys
func ConvertApprovalActionsToReview ¶
func ConvertApprovalActionsToReview(doc models.WorkflowDefinitionDocument) models.WorkflowDefinitionDocument
ConvertApprovalActionsToReview returns a copy of the definition with approval actions converted to review actions. This is used to reuse review handling for POST_COMMIT flows.
func CreateWorkflowInstanceWithObjectRef ¶
func CreateWorkflowInstanceWithObjectRef(ctx context.Context, tx *generated.Tx, params WorkflowInstanceBuilderParams) (*generated.WorkflowInstance, *generated.WorkflowObjectRef, error)
CreateWorkflowInstanceWithObjectRef builds a workflow instance and its object ref in a single helper.
func DefinitionHasApprovalAction ¶
func DefinitionHasApprovalAction(doc models.WorkflowDefinitionDocument) bool
DefinitionHasApprovalAction returns true if the workflow definition contains at least one approval action
func DefinitionHasReviewAction ¶
func DefinitionHasReviewAction(doc models.WorkflowDefinitionDocument) bool
DefinitionHasReviewAction returns true if the workflow definition contains at least one review action.
func DefinitionUsesPostCommitApprovals ¶
func DefinitionUsesPostCommitApprovals(doc models.WorkflowDefinitionDocument) bool
DefinitionUsesPostCommitApprovals returns true if approvals should run after commit.
func DefinitionUsesPreCommitApprovals ¶
func DefinitionUsesPreCommitApprovals(doc models.WorkflowDefinitionDocument) bool
DefinitionUsesPreCommitApprovals returns true if approvals should block changes.
func DeleteWorkflowInstanceChildren ¶
func DeleteWorkflowInstanceChildren(ctx context.Context, client *generated.Client, instanceIDs []string) error
DeleteWorkflowInstanceChildren removes workflow instance children such as assignments, targets, proposals, object refs, and events.
func DeleteWorkflowInstancesCascade ¶
func DeleteWorkflowInstancesCascade(ctx context.Context, client *generated.Client, instanceIDs []string) error
DeleteWorkflowInstancesCascade removes workflow instances and associated children via hooks.
func DeriveDomainKey ¶
func DeriveDomainKey(objectType enums.WorkflowObjectType, fields []string) string
DeriveDomainKey generates a stable domain key from a sorted list of field names. A "domain key" is a canonicalized list of approval fields scoped to the object type. Format: "ObjectType:field1,field2" (fields are sorted); if fields are empty, returns the object type string.
func DeriveTriggerPrefilter ¶
func DeriveTriggerPrefilter(doc models.WorkflowDefinitionDocument) ([]string, []string)
DeriveTriggerPrefilter extracts normalized trigger operations and fields/edges for query prefiltering. If any trigger omits fields/edges, field prefiltering is disabled
func EligibleWorkflowFields ¶
func EligibleWorkflowFields(objectType enums.WorkflowObjectType) map[string]struct{}
EligibleWorkflowFields returns the canonical set of workflow-eligible fields for an object type.
func EnrichWorkflowPayload ¶
func EnrichWorkflowPayload(ctx context.Context, client *generated.Client, objectType enums.WorkflowObjectType, objectID string, payload map[string]any) error
EnrichWorkflowPayload adds schema-designated fields to a workflow webhook payload.
func FieldsFromChanges ¶
FieldsFromChanges returns the sorted field names present in a changes map
func FilterChangesForDomain ¶
FilterChangesForDomain filters a mutation's changes to only include fields that belong to the specified approval domain
func FilterWorkflowInstances ¶
func FilterWorkflowInstances(query *generated.WorkflowInstanceQuery, objectType enums.WorkflowObjectType, objectID string) (*generated.WorkflowInstanceQuery, error)
FilterWorkflowInstances restricts a workflow-instance query to one canonical object.
func FilterWorkflowObjectRefs ¶
func FilterWorkflowObjectRefs(query *generated.WorkflowObjectRefQuery, objectType enums.WorkflowObjectType, objectID string) (*generated.WorkflowObjectRefQuery, error)
FilterWorkflowObjectRefs restricts a workflow-object-ref query to one canonical object.
func FindOrphanWorkflowInstanceIDs ¶
func FindOrphanWorkflowInstanceIDs(ctx context.Context, client *generated.Client, ownerID string) ([]string, error)
FindOrphanWorkflowInstanceIDs returns workflow instance IDs whose definitions are missing or soft-deleted. If ownerID is provided, results are scoped to that organization.
func FindProposalForObjectRefs ¶
func FindProposalForObjectRefs(ctx context.Context, client *generated.Client, objRefIDs []string, domainKey string, priorityStates []enums.WorkflowProposalState, states []enums.WorkflowProposalState) (*generated.WorkflowProposal, error)
FindProposalForObjectRefs locates a workflow proposal for the given object refs and domain key. The lookup first honors priorityStates (each queried individually) before falling back to states (queried together).
func FromContext ¶
FromContext reports whether the workflow bypass flag is set in the context.
func GetObjectUpdatedBy ¶
GetObjectUpdatedBy extracts the UpdatedBy field from an Object's Node if available. Returns empty string if the object or node is nil, or if UpdatedBy is not accessible.
func IsWorkflowBypass ¶
IsWorkflowBypass checks if the context has workflow bypass enabled. Used by workflow interceptors to skip approval routing for system operations.
func LoadWorkflowObject ¶
func LoadWorkflowObject(ctx context.Context, client *generated.Client, schemaType string, objectID string) (generated.Noder, error)
LoadWorkflowObject loads an ent object that participates in workflows.
func NewCELEnv ¶
func NewCELEnv(cfg *Config, scope CELExpressionScope) (*cel.Env, error)
NewCELEnv builds the workflow CEL environment using the provided config and scope
func ObjectOwnerID ¶
func ObjectOwnerID(ctx context.Context, client *generated.Client, objectType enums.WorkflowObjectType, objectID string) (string, error)
ObjectOwnerID resolves the owner ID for a workflow object via the canonical schema.
func ObjectRefIDs ¶
ObjectRefIDs returns workflow object ref IDs matching the workflow object.
func OrganizationOwnerIDs ¶
func OrganizationOwnerIDs(ctx context.Context, client *generated.Client, orgID string) ([]string, error)
OrganizationOwnerIDs returns user IDs for owners of an organization.
func RegisterAssignmentContextBuilder ¶
func RegisterAssignmentContextBuilder(builder AssignmentContextBuilder)
RegisterAssignmentContextBuilder sets the assignment context builder for CEL evaluation. Only one builder is needed since the generated code provides a comprehensive implementation.
func RegisterCELContextBuilder ¶
func RegisterCELContextBuilder(builder CELContextBuilder)
RegisterCELContextBuilder adds a CEL context builder. Last registered wins.
func RegisterObservabilityFieldsBuilder ¶
func RegisterObservabilityFieldsBuilder(builder ObservabilityFieldsBuilder)
RegisterObservabilityFieldsBuilder sets the observability fields builder.
func ResolveOwnerID ¶
ResolveOwnerID returns the provided owner ID or derives it from the context when empty.
func ResolveUserDisplayName ¶
ResolveUserDisplayName fetches a user by ID and returns their display name (FirstName LastName). If the user cannot be found or has no name, returns the original userID as fallback.
func SetTriggerChangeSet ¶
func SetTriggerChangeSet(ctx *models.WorkflowInstanceContext, changeSet entityops.ChangeSet)
SetTriggerChangeSet applies a mutation change-set to workflow instance trigger context fields.
func StringField ¶
StringField extracts a string field by name from a struct or pointer to struct It returns an error when decoding fails
func StringSliceField ¶
StringSliceField extracts a string slice field by name from a struct or pointer to struct It returns an error when decoding fails
func TriggerChangeSet ¶
func TriggerChangeSet(ctx models.WorkflowInstanceContext) entityops.ChangeSet
TriggerChangeSet returns the trigger mutation change-set carried by workflow instance context.
func ValidateCELExpression ¶
func ValidateCELExpression(cfg *Config, scope CELExpressionScope, expression string) error
ValidateCELExpression ensures the expression compiles against a CEL environment configured with the provided workflow config and scope.
func ValidatedDomainKey ¶
func ValidatedDomainKey(objectType enums.WorkflowObjectType, fields []string) (string, error)
ValidatedDomainKey validates an approval domain against canonical workflow field descriptors.
func WithAllowWorkflowEventEmission ¶
WithAllowWorkflowEventEmission marks the context to allow workflow event emission even when bypass is set.
func WithContext ¶
WithContext sets the workflow bypass flag in the context. Operations with this context will skip workflow approval interceptors.
func WithTx ¶
func WithTx[T any](ctx context.Context, client *generated.Client, scope *observability.Scope, fn func(tx *generated.Tx) (T, error)) (T, error)
WithTx runs fn inside a transaction and ensures rollback on error.
func WorkflowSchema ¶
func WorkflowSchema(objectType enums.WorkflowObjectType) (*entityops.Schema, error)
WorkflowSchema resolves a workflow object type through the canonical entity catalog.
Types ¶
type ApprovalActionParams ¶
type ApprovalActionParams struct {
// TargetedActionParams identifies the approval recipients
TargetedActionParams
// Required defaults to true when omitted
Required *bool `json:"required"`
// Label is an optional display label for the approval action
Label string `json:"label"`
// RequiredCount sets a quorum threshold (number of approvals needed) for this action
RequiredCount int `json:"required_count"`
// Fields lists the approval-gated fields for domain derivation
Fields []string `json:"fields,omitempty"`
}
ApprovalActionParams defines params for APPROVAL actions
type AssignmentContextBuilder ¶
type AssignmentContextBuilder func(ctx context.Context, client *generated.Client, instanceID string) (map[string]any, error)
AssignmentContextBuilder builds workflow runtime context (assignments, instance, initiator) for CEL evaluation. Generated code registers this to provide assignment state when evaluating NOTIFY action When expressions.
type CELConfig ¶
type CELConfig struct {
// Timeout is the maximum duration allowed for evaluating a CEL expression
Timeout time.Duration `json:"timeout" koanf:"timeout" default:"100ms"`
// CostLimit caps the runtime cost of CEL evaluation, 0 disables the limit
CostLimit uint64 `json:"costlimit" koanf:"costlimit" default:"0"`
// InterruptCheckFrequency controls how often CEL checks for interrupts during comprehensions
InterruptCheckFrequency uint `json:"interruptcheckfrequency" koanf:"interruptcheckfrequency" default:"100"`
// ParserRecursionLimit caps the parser recursion depth, 0 uses CEL defaults
ParserRecursionLimit int `json:"parserrecursionlimit" koanf:"parserrecursionlimit" default:"250"`
// ParserExpressionSizeLimit caps expression size (code points), 0 uses CEL defaults
ParserExpressionSizeLimit int `json:"parserexpressionsizelimit" koanf:"parserexpressionsizelimit" default:"100000"`
// ComprehensionNestingLimit caps nested comprehensions, 0 disables the check
ComprehensionNestingLimit int `json:"comprehensionnestinglimit" koanf:"comprehensionnestinglimit" default:"0"`
// ExtendedValidations enables extra AST validations (regex, duration, timestamps, homogeneous aggregates)
ExtendedValidations bool `json:"extendedvalidations" koanf:"extendedvalidations" default:"true"`
// OptionalTypes enables CEL optional types and optional field syntax
OptionalTypes bool `json:"optionaltypes" koanf:"optionaltypes" default:"false"`
// IdentifierEscapeSyntax enables backtick escaped identifiers
IdentifierEscapeSyntax bool `json:"identifierescapesyntax" koanf:"identifierescapesyntax" default:"true"`
// CrossTypeNumericComparisons enables comparisons across numeric types
CrossTypeNumericComparisons bool `json:"crosstypenumericcomparisons" koanf:"crosstypenumericcomparisons" default:"false"`
// MacroCallTracking records macro calls in AST source info for debugging
MacroCallTracking bool `json:"macrocalltracking" koanf:"macrocalltracking" default:"false"`
// EvalOptimize enables evaluation-time optimizations for repeated program runs
EvalOptimize bool `json:"evaloptimize" koanf:"evaloptimize" default:"true"`
// TrackState enables evaluation state tracking for debugging
TrackState bool `json:"trackstate" koanf:"trackstate" default:"false"`
}
CELConfig contains CEL evaluation and validation settings for workflows
type CELContextBuilder ¶
type CELContextBuilder func(obj *Object, changedFields []string, changedEdges []string, addedIDs, removedIDs map[string][]string, eventType, userID string, proposedChanges map[string]any) map[string]any
CELContextBuilder can override how CEL activation variables are built per object type. Codegen can register specialized builders (e.g., to expose typed fields) by calling RegisterCELContextBuilder in an init() function.
type CELExpressionScope ¶
type CELExpressionScope int
CELExpressionScope determines which variables are available when compiling CEL expressions
const ( // CELScopeBase includes the base workflow variables only CELScopeBase CELExpressionScope = iota // CELScopeAction includes action-specific variables (assignments, instance, initiator) CELScopeAction )
type Config ¶
type Config struct {
// Enabled determines if the workflows engine is enabled
Enabled bool `json:"enabled" koanf:"enabled" default:"false"`
// CEL contains configuration for CEL evaluation and validation
CEL CELConfig `json:"cel" koanf:"cel"`
// Gala controls gala runtime wiring for workflow and mutation eventing.
Gala GalaConfig `json:"gala" koanf:"gala"`
// RuntimeDefinitions holds in-memory workflow definitions that participate in
// trigger matching without DB persistence
RuntimeDefinitions *RuntimeDefinitionRegistry `json:"-" koanf:"-"`
}
Config contains the configuration for the workflows engine
func NewDefaultConfig ¶
func NewDefaultConfig(opts ...ConfigOpts) *Config
NewDefaultConfig creates a new workflows config with default values applied.
type ConfigOpts ¶
type ConfigOpts func(*Config)
ConfigOpts configures the Config
func WithCELComprehensionNestingLimit ¶
func WithCELComprehensionNestingLimit(limit int) ConfigOpts
WithCELComprehensionNestingLimit sets the CEL comprehension nesting limit
func WithCELCostLimit ¶
func WithCELCostLimit(limit uint64) ConfigOpts
WithCELCostLimit sets the CEL cost limit
func WithCELCrossTypeNumericComparisons ¶
func WithCELCrossTypeNumericComparisons(enabled bool) ConfigOpts
WithCELCrossTypeNumericComparisons toggles CEL cross-type numeric comparisons
func WithCELEvalOptimize ¶
func WithCELEvalOptimize(enabled bool) ConfigOpts
WithCELEvalOptimize toggles CEL evaluation optimizations
func WithCELExtendedValidations ¶
func WithCELExtendedValidations(enabled bool) ConfigOpts
WithCELExtendedValidations toggles CEL extended validations
func WithCELIdentifierEscapeSyntax ¶
func WithCELIdentifierEscapeSyntax(enabled bool) ConfigOpts
WithCELIdentifierEscapeSyntax toggles CEL identifier escape syntax
func WithCELInterruptCheckFrequency ¶
func WithCELInterruptCheckFrequency(freq uint) ConfigOpts
WithCELInterruptCheckFrequency sets the CEL interrupt check frequency
func WithCELMacroCallTracking ¶
func WithCELMacroCallTracking(enabled bool) ConfigOpts
WithCELMacroCallTracking toggles CEL macro call tracking
func WithCELOptionalTypes ¶
func WithCELOptionalTypes(enabled bool) ConfigOpts
WithCELOptionalTypes toggles CEL optional types
func WithCELParserExpressionSizeLimit ¶
func WithCELParserExpressionSizeLimit(limit int) ConfigOpts
WithCELParserExpressionSizeLimit sets the CEL parser expression size limit
func WithCELParserRecursionLimit ¶
func WithCELParserRecursionLimit(limit int) ConfigOpts
WithCELParserRecursionLimit sets the CEL parser recursion limit
func WithCELTimeout ¶
func WithCELTimeout(timeout time.Duration) ConfigOpts
WithCELTimeout sets the CEL evaluation timeout
func WithCELTrackState ¶
func WithCELTrackState(enabled bool) ConfigOpts
WithCELTrackState toggles CEL evaluation state tracking
func WithConfig ¶
func WithConfig(cfg Config) ConfigOpts
WithConfig applies all settings from a Config struct
func WithRuntimeDefinitions ¶
func WithRuntimeDefinitions(defs *RuntimeDefinitionRegistry) ConfigOpts
WithRuntimeDefinitions configures the engine with in-memory runtime definitions
type CreateObjectActionParams ¶
type CreateObjectActionParams struct {
// ObjectType identifies the schema type to create (e.g., Task, Review, Finding)
ObjectType string `json:"object_type"`
// Fields are applied to the new object after creation
Fields map[string]any `json:"fields,omitempty"`
// LinkToTrigger attaches the created object to the triggering object when supported
LinkToTrigger *bool `json:"link_to_trigger,omitempty"`
}
CreateObjectActionParams defines params for CREATE_OBJECT actions
type DefinitionSeedManifest ¶
type DefinitionSeedManifest struct {
Definitions []SeedWorkflowDefinition `json:"definitions"`
}
DefinitionSeedManifest defines a payload for seeding workflow definitions.
type DefinitionSeeder ¶
type DefinitionSeeder struct {
// contains filtered or unexported fields
}
DefinitionSeeder upserts system-owned workflow definitions from manifest inputs.
func NewDefinitionSeeder ¶
func NewDefinitionSeeder(client *generated.Client) *DefinitionSeeder
NewDefinitionSeeder creates a workflow definition seeder.
func (*DefinitionSeeder) SeedDefinitionsFromManifest ¶
func (s *DefinitionSeeder) SeedDefinitionsFromManifest(ctx context.Context, manifest DefinitionSeedManifest) error
SeedDefinitionsFromManifest upserts system-owned definitions from an in-memory manifest payload.
func (*DefinitionSeeder) SeedDefinitionsFromManifestFile ¶
func (s *DefinitionSeeder) SeedDefinitionsFromManifestFile(ctx context.Context, filePath string) error
SeedDefinitionsFromManifestFile loads and upserts definitions from a local manifest file.
func (*DefinitionSeeder) SeedDefinitionsFromManifestURL ¶
func (s *DefinitionSeeder) SeedDefinitionsFromManifestURL(ctx context.Context, manifestURL string) error
SeedDefinitionsFromManifestURL loads and upserts definitions from a remote manifest URL.
type DomainChanges ¶
type DomainChanges struct {
// DomainKey is the derived key for the approval field set
DomainKey string
// Fields lists the approval fields included in the domain
Fields []string
// Changes is the subset of proposed changes for the domain
Changes map[string]any
}
DomainChanges represents changes grouped by approval domain
func DomainChangesForDefinition ¶
func DomainChangesForDefinition(doc models.WorkflowDefinitionDocument, objectType enums.WorkflowObjectType, proposedChanges map[string]any) ([]DomainChanges, error)
DomainChangesForDefinition splits proposed changes by approval domains for a workflow definition
func SplitChangesByDomains ¶
func SplitChangesByDomains(changes map[string]any, objectType enums.WorkflowObjectType, domains [][]string) []DomainChanges
SplitChangesByDomains filters changes into per-domain buckets based on approval field sets
type EmitFailureDetails ¶
type EmitFailureDetails struct {
// Topic is the event topic name
Topic string `json:"topic"`
// EventID is the idempotency key when available
EventID string `json:"event_id,omitempty"`
// Payload is the original event payload JSON
Payload json.RawMessage `json:"payload,omitempty"`
// Attempts is the number of emit attempts recorded
Attempts int `json:"attempts"`
// LastError is the most recent enqueue error
LastError string `json:"last_error,omitempty"`
// OriginalEventType is the workflow event type that failed
OriginalEventType enums.WorkflowEventType `json:"original_event_type"`
// ActionKey is the workflow action key when available
ActionKey string `json:"action_key,omitempty"`
// ActionIndex is the workflow action index when available
ActionIndex int `json:"action_index"`
// ObjectID is the workflow object id
ObjectID string `json:"object_id,omitempty"`
// ObjectType is the workflow object type
ObjectType enums.WorkflowObjectType `json:"object_type,omitempty"`
}
EmitFailureDetails stores failure context for deterministic re-emission
func NewEmitFailureDetails ¶
func NewEmitFailureDetails(topic, eventID string, payload any, meta EmitFailureMeta, err error) (EmitFailureDetails, error)
NewEmitFailureDetails builds a failure payload, including a JSON-encoded event payload
func ParseEmitFailureDetails ¶
func ParseEmitFailureDetails(raw json.RawMessage) (EmitFailureDetails, error)
ParseEmitFailureDetails decodes failure details from raw JSON
type EmitFailureMeta ¶
type EmitFailureMeta struct {
// EventType is the workflow event type associated with the emit
EventType enums.WorkflowEventType
// ActionKey is the workflow action key when available
ActionKey string
// ActionIndex is the workflow action index when available
ActionIndex int
// ObjectID is the target object id
ObjectID string
// ObjectType is the target object type
ObjectType enums.WorkflowObjectType
}
EmitFailureMeta holds structured emit metadata for recovery
type EmitReceipt ¶
type EmitReceipt struct {
// EventID is the event identifier when assigned
EventID string
// Err is the enqueue/dispatch error when present
Err error
}
EmitReceipt captures enqueue status for workflow events
func EmitWorkflowEvent ¶
func EmitWorkflowEvent(ctx context.Context, runtime *gala.Gala, topic gala.TopicName, payload any) EmitReceipt
EmitWorkflowEvent emits a typed workflow payload via Gala
type FieldUpdateActionParams ¶
type FieldUpdateActionParams struct {
// Updates maps field names to new values
Updates map[string]any `json:"updates"`
}
FieldUpdateActionParams defines params for FIELD_UPDATE actions
type GalaConfig ¶
type GalaConfig struct {
// Enabled toggles gala worker and runtime initialization.
Enabled bool `json:"enabled" koanf:"enabled" default:"false"`
// WorkerCount configures queue worker concurrency when gala workers are enabled.
WorkerCount int `json:"workercount" koanf:"workercount" default:"10"`
// MaxRetries sets River job max attempts for gala dispatch jobs.
MaxRetries int `json:"maxretries" koanf:"maxretries" default:"5"`
// FailOnEnqueueError is kept for backward config compatibility and currently has no runtime effect.
FailOnEnqueueError bool `json:"failonenqueueerror" koanf:"failonenqueueerror" default:"false"`
// QueueName optionally overrides queue selection for durable gala dispatch jobs.
QueueName string `json:"queuename" koanf:"queuename" default:"events"`
}
GalaConfig controls optional gala runtime wiring.
type IntegrationActionParams ¶
type IntegrationActionParams struct {
// InstallationID is the explicit installation identifier for the operation
InstallationID string `json:"installation_id,omitempty"`
// DefinitionID identifies the integration definition when no installation ID is set
DefinitionID string `json:"definition_id,omitempty"`
// OperationName identifies the integration operation to execute
OperationName string `json:"operation_name,omitempty"`
// Config holds the integration-specific configuration payload as a JSON object document
Config json.RawMessage `json:"config,omitempty"`
// ScopeExpression is an optional CEL expression gate for this integration action
ScopeExpression string `json:"scope_expression,omitempty"`
// ScopePayload is optional payload data exposed to scope expression evaluation as a JSON object document
ScopePayload json.RawMessage `json:"scope_payload,omitempty"`
// ScopeResource is optional resource identity data exposed to scope expression evaluation
ScopeResource string `json:"scope_resource,omitempty"`
// ForceClientRebuild requests a client cache bypass for the installation
ForceClientRebuild bool `json:"force_client_rebuild"`
}
IntegrationActionParams defines params for INTEGRATION actions
type NotificationActionParams ¶
type NotificationActionParams struct {
// TargetedActionParams identifies notification message targets
TargetedActionParams
// Topic sets an optional notification topic
Topic string `json:"topic"`
// Title is the notification title
Title string `json:"title"`
// Body is the notification body
Body string `json:"body"`
// Data is an optional payload merged into the notification data
Data map[string]any `json:"data"`
}
NotificationActionParams defines params for in-app NOTIFICATION actions
type Object ¶
type Object struct {
// ID is the workflow object identifier.
ID string
// Type is the workflow object type.
Type enums.WorkflowObjectType
// Node is the concrete ent entity when available.
Node generated.Noder
}
Object captures the workflow target along with its concrete ent entity when available.
func ObjectFromRef ¶
func ObjectFromRef(ref *generated.WorkflowObjectRef) (*Object, error)
ObjectFromRef builds an Object from a WorkflowObjectRef record.
func (*Object) CELValue ¶
CELValue exposes the value used inside CEL expressions. Prefer the concrete ent entity so expressions can access real fields.
func (*Object) ObservabilityFields ¶
ObservabilityFields returns standard log fields for the object. Uses the registered builder if available, otherwise falls back to basic fields.
type ObservabilityFieldsBuilder ¶
ObservabilityFieldsBuilder builds observability log fields for a workflow object. Generated code registers this to provide complete field coverage for all workflow-eligible types.
type ReviewActionParams ¶
type ReviewActionParams struct {
// TargetedActionParams identifies the review recipients
TargetedActionParams
// Required defaults to true when omitted
Required *bool `json:"required"`
// Label is an optional display label for the review action
Label string `json:"label"`
// RequiredCount sets a quorum threshold (number of reviews needed) for this action
RequiredCount int `json:"required_count"`
}
ReviewActionParams defines params for REVIEW actions
type RuntimeDefinitionRegistry ¶
type RuntimeDefinitionRegistry struct {
// contains filtered or unexported fields
}
RuntimeDefinitionRegistry holds runtime workflow definitions registered at startup
func NewRuntimeDefinitionRegistry ¶
func NewRuntimeDefinitionRegistry() *RuntimeDefinitionRegistry
NewRuntimeDefinitionRegistry creates an empty registry
func (*RuntimeDefinitionRegistry) Match ¶
func (r *RuntimeDefinitionRegistry) Match(schemaType string, eventType string, changedFields []string, changedEdges []string) []*RuntimeWorkflowDefinition
Match returns runtime definitions matching the given trigger criteria. It applies the same coarse prefiltering as the DB query: schema type match, operation match (if trigger operations are set), and field overlap (if trigger fields are set)
func (*RuntimeDefinitionRegistry) Register ¶
func (r *RuntimeDefinitionRegistry) Register(def RuntimeWorkflowDefinition) error
Register adds a runtime definition to the registry. It derives trigger prefilter fields from the definition document using DeriveTriggerPrefilter and returns an error if the key is empty or already registered
type RuntimeWorkflowDefinition ¶
type RuntimeWorkflowDefinition struct {
// Key is the stable identifier for this definition
Key string
// Name is the display name
Name string
// Description is optional description text
Description string
// WorkflowKind is the workflow classification
WorkflowKind enums.WorkflowKind
// SchemaType is the object type this workflow applies to
SchemaType string
// ApprovalSubmissionMode controls how proposals are submitted
ApprovalSubmissionMode enums.WorkflowApprovalSubmissionMode
// Definition is the workflow definition document
Definition models.WorkflowDefinitionDocument
// TriggerOperations is derived from the definition at registration time
TriggerOperations []string
// TriggerFields is derived from the definition at registration time
TriggerFields []string
}
RuntimeWorkflowDefinition holds a system workflow definition that lives in memory and participates in trigger matching without DB persistence
func (*RuntimeWorkflowDefinition) ToEntDefinition ¶
func (d *RuntimeWorkflowDefinition) ToEntDefinition() *generated.WorkflowDefinition
ToEntDefinition converts a runtime definition to a synthetic *generated.WorkflowDefinition for compatibility with the existing engine execution path
type SeedWorkflowDefinition ¶
type SeedWorkflowDefinition struct {
// Key is a stable identifier persisted to system_internal_id.
Key string `json:"key"`
// Name is the workflow definition display name.
Name string `json:"name"`
// Description is optional definition description text.
Description string `json:"description,omitempty"`
// WorkflowKind optionally overrides the workflow kind derived from Definition.
WorkflowKind enums.WorkflowKind `json:"workflow_kind,omitempty"`
// SchemaType optionally overrides the schema type derived from Definition.
SchemaType string `json:"schema_type,omitempty"`
// Revision overrides workflow revision. Defaults to 1.
Revision int `json:"revision,omitempty"`
// Draft controls whether the definition is a draft. Defaults to false.
Draft *bool `json:"draft,omitempty"`
// Active controls whether the definition is active. Defaults to true.
Active *bool `json:"active,omitempty"`
// IsDefault controls whether this definition is default for schema type. Defaults to false.
IsDefault *bool `json:"is_default,omitempty"`
// CooldownSeconds configures duplicate trigger suppression.
CooldownSeconds int `json:"cooldown_seconds,omitempty"`
// ApprovalSubmissionMode optionally overrides the definition-level submission mode.
ApprovalSubmissionMode enums.WorkflowApprovalSubmissionMode `json:"approval_submission_mode,omitempty"`
// Definition is the workflow definition document to persist.
Definition models.WorkflowDefinitionDocument `json:"definition"`
}
SeedWorkflowDefinition defines a single workflow definition seed record.
type SendEmailActionParams ¶
type SendEmailActionParams struct {
// TargetedActionParams identifies users, groups, roles, or resolvers to email
TargetedActionParams
// EmailTemplateID references an email template by database ID
EmailTemplateID string `json:"emailTemplateId,omitempty"`
// EmailTemplateKey references an email template by catalog key
EmailTemplateKey string `json:"emailTemplateKey,omitempty"`
// To contains explicit recipient email addresses
To []string `json:"to,omitempty"`
// From overrides the default sender email address
From string `json:"from,omitempty"`
// ReplyTo sets an optional reply-to email address
ReplyTo string `json:"replyTo,omitempty"`
}
SendEmailActionParams defines params for SEND_EMAIL actions
type TargetConfig ¶
type TargetConfig struct {
// Type selects how targets are resolved
Type enums.WorkflowTargetType `json:"type"`
// ID identifies the target resource for static targets
ID string `json:"id,omitempty"`
// ResolverKey names the resolver used for dynamic targets
ResolverKey string `json:"resolver_key,omitempty"`
// Destination identifies the external channel destination
Destination string `json:"destination,omitempty"`
}
TargetConfig defines who should receive workflow actions
type TargetedActionParams ¶
type TargetedActionParams struct {
// Targets identifies users, groups, roles, or resolvers to receive the action
Targets []TargetConfig `json:"targets"`
}
TargetedActionParams captures workflow action params that target recipients
type TxError ¶
TxError wraps a transaction error with a stage marker.
type WebhookActionParams ¶
type WebhookActionParams struct {
// URL is the webhook endpoint
URL string `json:"url"`
// Method is the HTTP method for the webhook request
Method string `json:"method"`
// Headers are additional HTTP headers for the webhook request
Headers map[string]string `json:"headers"`
// PayloadExpr is a CEL expression that evaluates to a JSON object merged into the base payload.
// When empty, only the base payload is sent.
PayloadExpr string `json:"payload_expr"`
// TimeoutMS overrides the webhook timeout in milliseconds
TimeoutMS int `json:"timeout_ms"`
// Secret signs the webhook payload if provided
Secret string `json:"secret"`
// Retries overrides the retry count when non-zero
Retries int `json:"retries"`
// Optional override for the idempotency key header
IdempotencyKey string `json:"idempotency_key"`
}
WebhookActionParams defines params for WEBHOOK actions
type WorkflowCreationError ¶
type WorkflowCreationError struct {
// Stage is the creation stage that failed
Stage WorkflowCreationStage
// Err is the underlying error
Err error
}
WorkflowCreationError wraps the underlying error and indicates what stage failed.
func (*WorkflowCreationError) Error ¶
func (e *WorkflowCreationError) Error() string
Error formats the workflow creation error
func (*WorkflowCreationError) Unwrap ¶
func (e *WorkflowCreationError) Unwrap() error
Unwrap returns the underlying error
type WorkflowCreationStage ¶
type WorkflowCreationStage string
WorkflowCreationStage identifies which step failed when building instances/object refs.
const ( WorkflowCreationStageInstance WorkflowCreationStage = "instance" WorkflowCreationStageObjectRef WorkflowCreationStage = "object_ref" )
type WorkflowFieldInfo ¶
WorkflowFieldInfo is the workflow-facing view of a canonical entity field.
type WorkflowInstanceBuilderParams ¶
type WorkflowInstanceBuilderParams struct {
// WorkflowDefinitionID is the definition id for the instance
WorkflowDefinitionID string
// DefinitionSnapshot is the snapshot of the workflow definition
DefinitionSnapshot models.WorkflowDefinitionDocument
// State is the initial workflow instance state
State enums.WorkflowInstanceState
// Context is the workflow instance context payload
Context models.WorkflowInstanceContext
// OwnerID is the organization owner id
OwnerID string
// ObjectType is the workflow object type
ObjectType enums.WorkflowObjectType
// ObjectID is the workflow object id
ObjectID string
}
WorkflowInstanceBuilderParams defines the inputs for creating a workflow instance + object ref.
type WorkflowObjectTypeInfo ¶
type WorkflowObjectTypeInfo struct {
Type enums.WorkflowObjectType
Label string
Description string
EligibleFields []WorkflowFieldInfo
EligibleEdges []string
}
WorkflowObjectTypeInfo is the workflow-facing view of a canonical entity schema.
func WorkflowMetadata ¶
func WorkflowMetadata() []WorkflowObjectTypeInfo
WorkflowMetadata derives workflow object metadata from canonical schema descriptors.
type WorkflowSchemaTypeDefinition ¶
type WorkflowSchemaTypeDefinition struct {
// Name is the schema definition name under $defs
Name string
// Type is the reflected Go type represented by this schema definition
Type reflect.Type
}
WorkflowSchemaTypeDefinition identifies a named Go type used in workflow schema generation
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package engine is the workflow engine for orchestrating workflow execution
|
Package engine is the workflow engine for orchestrating workflow execution |
|
Package observability provides logging and metrics wrappers and consistency for workflows there are several functions in this package that are geared towards reducing boilerplate overhead with the main callers by pre-setting common fields such as operation origin and trigger event so that inline within the workflow package we don't have crazy verbose log and metric statements making the code harder to read
|
Package observability provides logging and metrics wrappers and consistency for workflows there are several functions in this package that are geared towards reducing boilerplate overhead with the main callers by pre-setting common fields such as operation origin and trigger event so that inline within the workflow package we don't have crazy verbose log and metric statements making the code harder to read |
|
Package reconciler provides workflow reconciliation helpers.
|
Package reconciler provides workflow reconciliation helpers. |
|
Package resolvers provides a registry for workflow target resolution functions
|
Package resolvers provides a registry for workflow target resolution functions |