flow

package
v0.50.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder constructs a Flow fluently in Go, as an alternative to parsing JSON. Use the node constructors in pkg/node (node.NewRequest, node.NewDelay, ...).

f := flow.NewBuilder("provision").Version("1.0").
    Input("baseURL", "https://api.example.com").
    Add(node.NewRequest("create").POST("{{baseURL}}/customers")).
    Add(node.NewRequest("provision").POST("{{baseURL}}/workspaces")).
    Edge("create", "provision").
    Build()

func NewBuilder

func NewBuilder(name string) *Builder

NewBuilder starts a flow with the given name (version defaults to "1.0").

func (*Builder) Add

func (b *Builder) Add(n node.AnyNode) *Builder

Add appends a node (any of the pkg/node constructors).

func (*Builder) Build

func (b *Builder) Build() Flow

Build returns the assembled flow.

func (*Builder) Edge

func (b *Builder) Edge(source, target string) *Builder

Edge connects source -> target on the success path.

func (*Builder) Input

func (b *Builder) Input(key string, value any) *Builder

Input declares an initial input (a default; launch inputs override it).

func (*Builder) Version

func (b *Builder) Version(version string) *Builder

Version sets the flow version.

type Flow

type Flow struct {
	Name          string         `json:"name"`
	Description   string         `json:"description"`
	Version       string         `json:"version"`
	Nodes         []node.AnyNode `json:"-"`
	Edges         []edge.Edge    `json:"edges"`
	InitialInputs map[string]any `json:"initialInputs"`
}

func ParseFromJSON

func ParseFromJSON(data []byte) (*Flow, error)

func ParseFromJSONWithOptions

func ParseFromJSONWithOptions(data []byte, options ParseOptions) (*Flow, error)

type ParseOptions

type ParseOptions struct {
	AllowedInitialInputKeys   []string
	AllowUnknownInitialInputs bool
}

type ReferencedFlow

type ReferencedFlow struct {
	FlowDefinition json.RawMessage `json:"flow_definition"`
	InputOverrides map[string]any  `json:"input_overrides,omitempty"`
}

ReferencedFlow contains the extra flow definitions the runner can execute from module nodes without calling back into the control plane at runtime.

func (*ReferencedFlow) UnmarshalJSON

func (r *ReferencedFlow) UnmarshalJSON(data []byte) error

type ReferencedFlowRegistry

type ReferencedFlowRegistry map[string]ReferencedFlow

ReferencedFlowRegistry stores module targets by flow ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL