Versions in this module Expand all Collapse all v2 v2.3.0 Aug 28, 2026 Changes in this version + const WorkflowDefinitionJSONSchemaDescription + const WorkflowDefinitionJSONSchemaID + const WorkflowDefinitionJSONSchemaTitle + const WorkflowDefinitionJSONSchemaVersion + var ErrApprovalActionParamsInvalid = errors.New("approval action params are invalid") + var ErrEmitFailureDetailsMissing = errors.New("emit failure details are missing") + var ErrEmitNoEmitter = errors.New("workflow emit requires an emitter") + var ErrFailedToBuildCELEnv = errors.New("failed to build CEL environment") + var ErrFieldNotWorkflowEligible = errors.New("field is not eligible for workflow modification") + var ErrMissingObjectID = errors.New("workflow object is missing an ID") + var ErrMissingOrganizationID = errors.New("organization id is required") + var ErrNilClient = errors.New("workflow client is required") + var ErrNoProposedChanges = errors.New("no proposed changes to apply") + var ErrRuntimeDefinitionDuplicateKey = errors.New("runtime definition key already registered") + var ErrRuntimeDefinitionKeyRequired = errors.New("runtime definition key is required") + var ErrStringFieldMarshal = errors.New("failed to marshal node for string field extraction") + var ErrStringFieldNil = errors.New("string field node is nil") + var ErrStringFieldUnmarshal = errors.New("failed to unmarshal node for string field extraction") + var ErrStringSliceFieldInvalid = errors.New("string slice field contains non-string values") + var ErrTxBegin = errors.New("failed to begin transaction") + var ErrTxCommit = errors.New("failed to commit transaction") + var ErrUnsupportedObjectType = errors.New("object type does not support workflows") + var ErrWorkflowAlreadyActive = errors.New("workflow already active for this object") + var ErrWorkflowDomainFieldsRequired = errors.New("workflow domain requires at least one field") + var ErrWorkflowNotFound = errors.New("workflow instance not found") + var ErrWorkflowSeedDefinitionKeyRequired = errors.New("workflow definition seed key is required") + var ErrWorkflowSeedFailed = errors.New("workflow definition seed failed") + var ErrWorkflowSeedManifestInvalid = errors.New("workflow definition seed manifest invalid") + var ErrWorkflowSeedSchemaTypeRequired = errors.New("workflow definition seed schema type is required") + var ErrWorkflowSeedSourceFetchFailed = errors.New("workflow definition seed source fetch failed") + var ErrWorkflowSeedSourceTooLarge = errors.New("workflow definition seed source too large") + var ErrWorkflowSeedURLInvalid = errors.New("workflow definition seed URL is invalid") + var ErrWorkflowSeedWorkflowKindRequired = errors.New("workflow definition seed workflow kind is required") + var WorkflowDefinitionSchemaExtensionTypes = []WorkflowSchemaTypeDefinition + var WorkflowDefinitionSchemaModelTypes = []WorkflowSchemaTypeDefinition + var WorkflowDefinitionSchemaRootType = WorkflowSchemaTypeDefinition + 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 struct + Fields []string + Label string + Required *bool + RequiredCount int + type AssignmentContextBuilder func(ctx context.Context, client *generated.Client, instanceID string) (map[string]any, error) + type CELConfig struct + ComprehensionNestingLimit int + CostLimit uint64 + CrossTypeNumericComparisons bool + EvalOptimize bool + ExtendedValidations bool + IdentifierEscapeSyntax bool + InterruptCheckFrequency uint + MacroCallTracking bool + OptionalTypes bool + ParserExpressionSizeLimit int + ParserRecursionLimit int + Timeout time.Duration + TrackState bool + type CELContextBuilder func(obj *Object, changedFields []string, changedEdges []string, ...) map[string]any + type CELExpressionScope int + const CELScopeAction + const CELScopeBase + type Config struct + CEL CELConfig + Enabled bool + Gala GalaConfig + RuntimeDefinitions *RuntimeDefinitionRegistry + func NewDefaultConfig(opts ...ConfigOpts) *Config + func (c *Config) IsEnabled() bool + type ConfigOpts func(*Config) + 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 struct + Fields map[string]any + LinkToTrigger *bool + ObjectType string + type DefinitionSeedManifest struct + Definitions []SeedWorkflowDefinition + type DefinitionSeeder struct + func NewDefinitionSeeder(client *generated.Client) *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 struct + Changes map[string]any + DomainKey string + Fields []string + func DomainChangesForDefinition(doc models.WorkflowDefinitionDocument, objectType enums.WorkflowObjectType, ...) ([]DomainChanges, error) + func SplitChangesByDomains(changes map[string]any, objectType enums.WorkflowObjectType, ...) []DomainChanges + type EmitFailureDetails struct + ActionIndex int + ActionKey string + Attempts int + EventID string + LastError string + ObjectID string + ObjectType enums.WorkflowObjectType + OriginalEventType enums.WorkflowEventType + Payload json.RawMessage + Topic string + func NewEmitFailureDetails(topic, eventID string, payload any, meta EmitFailureMeta, err error) (EmitFailureDetails, error) + func ParseEmitFailureDetails(raw json.RawMessage) (EmitFailureDetails, error) + type EmitFailureMeta struct + ActionIndex int + ActionKey string + EventType enums.WorkflowEventType + ObjectID string + ObjectType enums.WorkflowObjectType + type EmitReceipt struct + Err error + EventID string + func EmitWorkflowEvent(ctx context.Context, runtime *gala.Gala, topic gala.TopicName, payload any) EmitReceipt + func EmitWorkflowEventWithHeaders(ctx context.Context, runtime *gala.Gala, topic gala.TopicName, payload any, ...) EmitReceipt + type FieldUpdateActionParams struct + Updates map[string]any + type GalaConfig struct + Enabled bool + FailOnEnqueueError bool + MaxRetries int + QueueName string + WorkerCount int + type IntegrationActionParams struct + Config json.RawMessage + DefinitionID string + ForceClientRebuild bool + InstallationID string + OperationName string + ScopeExpression string + ScopePayload json.RawMessage + ScopeResource string + type NotificationActionParams struct + Body string + Data map[string]any + Title string + Topic string + type Object struct + ID string + Node generated.Noder + Type enums.WorkflowObjectType + func ObjectFromRef(ref *generated.WorkflowObjectRef) (*Object, error) + func (o *Object) CELValue() any + func (o *Object) ObservabilityFields() map[string]any + type ObservabilityFieldsBuilder func(obj *Object) map[string]any + type ReviewActionParams struct + Label string + Required *bool + RequiredCount int + type RuntimeDefinitionRegistry struct + func NewRuntimeDefinitionRegistry() *RuntimeDefinitionRegistry + func (r *RuntimeDefinitionRegistry) Match(schemaType string, eventType string, changedFields []string, ...) []*RuntimeWorkflowDefinition + func (r *RuntimeDefinitionRegistry) Register(def RuntimeWorkflowDefinition) error + type RuntimeWorkflowDefinition struct + ApprovalSubmissionMode enums.WorkflowApprovalSubmissionMode + Definition models.WorkflowDefinitionDocument + Description string + Key string + Name string + SchemaType string + TriggerFields []string + TriggerOperations []string + WorkflowKind enums.WorkflowKind + func (d *RuntimeWorkflowDefinition) ToEntDefinition() *generated.WorkflowDefinition + type SeedWorkflowDefinition struct + Active *bool + ApprovalSubmissionMode enums.WorkflowApprovalSubmissionMode + CooldownSeconds int + Definition models.WorkflowDefinitionDocument + Description string + Draft *bool + IsDefault *bool + Key string + Name string + Revision int + SchemaType string + WorkflowKind enums.WorkflowKind + type SendEmailActionParams struct + EmailTemplateID string + EmailTemplateKey string + From string + ReplyTo string + To []string + type TargetConfig struct + Destination string + ID string + ResolverKey string + Type enums.WorkflowTargetType + type TargetedActionParams struct + Targets []TargetConfig + type TxError struct + Err error + Stage error + func (e *TxError) Error() string + func (e *TxError) Is(target error) bool + func (e *TxError) Unwrap() error + type WebhookActionParams struct + Headers map[string]string + IdempotencyKey string + Method string + PayloadExpr string + Retries int + Secret string + TimeoutMS int + URL string + type WorkflowCreationError struct + Err error + Stage WorkflowCreationStage + func (e *WorkflowCreationError) Error() string + func (e *WorkflowCreationError) Unwrap() error + type WorkflowCreationStage string + const WorkflowCreationStageInstance + const WorkflowCreationStageObjectRef + type WorkflowFieldInfo struct + Label string + Name string + Type string + type WorkflowInstanceBuilderParams struct + Context models.WorkflowInstanceContext + DefinitionSnapshot models.WorkflowDefinitionDocument + ObjectID string + ObjectType enums.WorkflowObjectType + OwnerID string + State enums.WorkflowInstanceState + WorkflowDefinitionID string + type WorkflowObjectTypeInfo struct + Description string + EligibleEdges []string + EligibleFields []WorkflowFieldInfo + Label string + Type enums.WorkflowObjectType + func WorkflowMetadata() []WorkflowObjectTypeInfo + type WorkflowSchemaTypeDefinition struct + Name string + Type reflect.Type Other modules containing this package github.com/theopenlane/core