Documentation
¶
Overview ¶
Package workflow builds native xyOps workflows: a validated graph (NewXyopsWorkflow) and the plan -> changes? -> approval -> deploy pipeline (NewPipeline). xyOps owns orchestration, Resume authorization and audit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Approval ¶
type Approval struct {
// ReviewInput is an optional top-level input.data key containing a safe,
// human-readable plan. Show it in the native Resume dialog, not in logs
// or notification text. This field is for display, never deploy authority.
ReviewInput string
// WebHook is fired when the run reaches approval (optional).
WebHook string
// Text is shown with the suspension and sent with the notification.
Text string
}
Approval configures an approval step.
type Pipeline ¶
type Pipeline struct {
Workflow *XyopsWorkflow
// Steps maps step ID to the event it runs (owned or referenced).
Steps map[string]xyops.EventRef
// Owned maps step ID to events this pipeline created (tasks, approvals).
Owned map[string]*xyops.Event
}
Pipeline is a native workflow and the events its steps run.
func NewPipeline ¶
NewPipeline creates the workflow and the events its owned steps run. The workflow ID and every owned event ID are claimed app-wide: a collision with another event, workflow or pipeline in the app fails synthesis, and a refusal leaves no partial resources.
type PipelineProps ¶
type PipelineProps struct {
// ID names the workflow; owned steps are ID_<step>. Every title is
// "<stack>-<id>" (xyops.Title).
ID, Category string
// Executor runs every owned step.
Executor string
Enabled bool
Trigger xyops.Trigger
Fields []xyops.Field
// Steps run in order. At least one; a gate may not be first or last.
Steps []Step
MaxRuns int
StepConcurrency int
// Queue holds up to this many further runs (FIFO, native xyOps queue) while
// MaxRuns are in progress, for up to TimeoutSeconds. 0 = refuse them.
// A queued run starts nothing (no step, no credentials) until it starts.
Queue int
TimeoutSeconds int
AlertWebHook string
}
PipelineProps defines native xyOps orchestration, not an independent approval service: xyOps permissions authorize Resume and its audit log records it. Handlers must enforce pinned intent, expiry, replay protection and disruption guards themselves; a graph is not that policy.
Concurrency has separate controls:
- MaxRuns / Queue: concurrent and waiting runs of the workflow. A run holds its slot until it finishes, including while an approval is suspended.
- StepConcurrency: job limit on events this pipeline owns (default MaxRuns). Referenced events keep the limits their owner declared.
- Target locking (two runs mutating the same infrastructure) belongs to the handlers: the graph cannot know which runs touch the same targets.
type Step ¶
type Step struct {
// ID names the node; owned events are "<pipeline ID>_<ID>".
ID string
// Exactly one of Script (Task), Event (Run), Approval or Gate.
Script string
TimeoutSeconds int
Event *xyops.EventRef
Approval *Approval
Gate string
// Label shown on the node; defaults to ID ("<ID>?" for gates).
Label string
}
A pipeline is an ordered list of steps run in series on one native xyOps workflow. Each step is wired to the next on success; a Gate ends the run when its condition is false. Steps:
- Task: an event the pipeline owns, "<pipeline ID>_<step>", running a reviewed script on the pipeline's Executor.
- Run: an existing event or workflow (event.Ref(), XyopsWorkflow.Ref() or xyops.ExternalEvent). A workflow runs as a sub-workflow: the run waits for it and keeps its slot. The pipeline never creates or changes it.
- Approval: an owned no-op event that, at start, notifies a web hook and suspends until an authorized user resumes it (Abort declines). Insert it only where a human must decide.
- Gate: a decision on the previous step's output data (xyOps expression, e.g. "data.changes == true"). False ends the run.
Starting a workflow that must run independently (its own queue and approvals) is not a step: use xyops.EventProps.OnSuccess on the launching event.
func ApprovalStep ¶
ApprovalStep is a human decision point: notify, then suspend until Resume.
type XyopsConnection ¶
type XyopsConnection struct {
ID string `json:"id"`
Source string `json:"source"`
Dest string `json:"dest"`
Condition string `json:"condition,omitempty"`
}
XyopsConnection preserves native routing conditions.
type XyopsNode ¶
type XyopsNode struct {
ID string `json:"id"`
Type string `json:"type"`
X int `json:"x"`
Y int `json:"y"`
Data map[string]any `json:"data,omitempty"`
}
XyopsNode is a native xyOps node. Data is backend-owned JSON, not a CDK deployment vocabulary. Action/limit nodes attach to jobs, not sequential steps.
type XyopsWorkflow ¶
XyopsWorkflow is a provider-backed workflow definition, installed when its containing stack is applied (including bootstrap). Construction never runs it.
func NewXyopsWorkflow ¶
func NewXyopsWorkflow(stack *core.Stack, name string, p XyopsWorkflowProps) (*XyopsWorkflow, error)
NewXyopsWorkflow validates and synthesizes a native workflow resource using attributes available since provider 0.1.2-dev.8. Require xyops.Provider on stack. Native loops are allowed. Use an explicit join controller for all-of fan-in.
func (*XyopsWorkflow) Ref ¶
func (w *XyopsWorkflow) Ref() xyops.EventRef
Ref returns a reference for launching this workflow (for example from an event's OnSuccess). The workflow resource is a dependency of the launcher.
type XyopsWorkflowProps ¶
type XyopsWorkflowProps struct {
ID string
Title string
Category string
Enabled bool
Nodes []XyopsNode
Connections []XyopsConnection
Triggers []map[string]any
Actions []map[string]any
Limits []map[string]any
Tags []string
Import bool
Params map[string]any
Fields []map[string]any
Notes *string
Icon *string
}
XyopsWorkflowProps maps the existing xyops_workflow provider resource. No runtime approval or deployment-safety guarantee is inferred from a graph. Optional metadata and runtime input fields require provider 0.1.2-dev.8 or later.