An approval, ask or park can be resolved by an operator, a rule, a classifier or automatically, so the vocabulary stops naming a person: - step type human.approve -> workflow.approve - park class needs_human -> needs_decision (ParkNeedsDecision) - event kinds human_* -> operator_* - alert kind task.needs_human -> task.needs_decision - status grouping "needs you" -> "needs attention" 0061 rewrites the stored values, including the approval step type in the workflow-definitions resource and each task's pinned definition, with the digest recomputed so resumed tasks still match.
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package tools
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/samcharles93/archie-core/internal/domain/messaging"
|
|
)
|
|
|
|
// ApprovalRequester asks an operator to approve or deny a named action.
|
|
type ApprovalRequester = messaging.ApprovalRequester
|
|
|
|
// ApprovalDecision is the outcome of an operator consent request.
|
|
type ApprovalDecision = messaging.ApprovalDecision
|
|
|
|
const (
|
|
ApprovalApproved = messaging.ApprovalApproved
|
|
ApprovalPermanentlyApproved = messaging.ApprovalPermanentlyApproved
|
|
ApprovalDenied = messaging.ApprovalDenied
|
|
)
|
|
|
|
var (
|
|
ErrApprovalDenied = messaging.ErrApprovalDenied
|
|
ErrApprovalNotConfigured = messaging.ErrApprovalNotConfigured
|
|
)
|
|
|
|
const ToolApprovalTimeout = messaging.ToolApprovalTimeout
|
|
|
|
// WithApprovalRequester stores an ApprovalRequester on ctx.
|
|
func WithApprovalRequester(ctx context.Context, a ApprovalRequester) context.Context {
|
|
return messaging.WithApprovalRequester(ctx, a)
|
|
}
|
|
|
|
// ApprovalFromContext returns the ApprovalRequester stored by
|
|
// WithApprovalRequester, or nil when none was stored.
|
|
func ApprovalFromContext(ctx context.Context) ApprovalRequester {
|
|
return messaging.ApprovalFromContext(ctx)
|
|
}
|