flowdsl

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package flowdsl compiles a flow file into the CreateFlowRequest JSON the Echopoint API already accepts, and renders a stored flow back into that file. The file is YAML: nodes are named, and next and on_failure replace the edges array. Nothing here calls the API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decompile

func Decompile(flow wire.Flow) ([]byte, error)

Decompile renders a stored flow as a flow file. Compiling that file produces the same create request the API would accept for this flow. Edge ids and pinned borders are left out: compile lays the graph out itself.

func DecompileJSON

func DecompileJSON(raw []byte) ([]byte, error)

DecompileJSON renders a stored flow JSON document as a flow file.

func FillIntegrations added in v0.2.0

func FillIntegrations(req *wire.CreateFlowRequest, resolve func(IntegrationNode) (Target, error)) error

FillIntegrations calls resolve for every integration node of req, poll and loop bodies included. The compiler works offline, so an operation node leaves it without a method and url; the API requires both. For an operation, resolve returns the target to store on the node; for an event, the target is ignored. An error from resolve refuses that node; FillIntegrations returns every refusal joined.

func ModulePath

func ModulePath(root, file string) (string, error)

ModulePath is the library path of a flow file, such as anchor/login.

Types

type Diagnostic

type Diagnostic struct {
	File     string   `json:"file,omitempty"`
	Line     int      `json:"line,omitempty"`
	Severity Severity `json:"-"`
	Message  string   `json:"message"`
}

Diagnostic is one problem found while reading or checking a flow file.

func (Diagnostic) String

func (d Diagnostic) String() string

type Flow

type Flow struct {
	// Path is the file's module path, such as anchor/login.
	Path    string                 `json:"path"`
	Request wire.CreateFlowRequest `json:"request"`
}

Flow is one compiled create-flow document.

type IntegrationNode added in v0.2.0

type IntegrationNode struct {
	// NodeID is the node's id. A node inside a poll or loop body is named
	// parent/child.
	NodeID string
	Ref    wire.IntegrationNodeRef
}

IntegrationNode is one integration node of a compiled flow.

func (IntegrationNode) IsEvent added in v0.2.0

func (n IntegrationNode) IsEvent() bool

IsEvent reports whether the node waits for an event rather than calling an operation.

type Outcome

type Outcome struct {
	Flows       []Flow
	Diagnostics []Diagnostic
}

Outcome is everything a compile found. Flows with an error are omitted.

func CompileDir

func CompileDir(root string) (Outcome, error)

CompileDir compiles every flow file under root. Files with an error are omitted from Flows; their diagnostics are still returned.

func CompileFile

func CompileFile(file, root string) (Outcome, error)

CompileFile compiles one flow file. root is the library used to resolve module files; an empty root means the file's directory. Diagnostics of flow files the file does not reach are left out.

func CompileSource

func CompileSource(path string, src []byte) Outcome

CompileSource compiles one flow file held in memory. path is the module path recorded on diagnostics. A module reference that names another file cannot be resolved from a single source; a module UUID can.

func (Outcome) Errors

func (o Outcome) Errors() []Diagnostic

Errors returns the diagnostics that failed the compile.

func (Outcome) Warnings

func (o Outcome) Warnings() []Diagnostic

Warnings returns the diagnostics that did not fail the compile.

type Severity

type Severity int

Severity is how serious a diagnostic is. A warning still compiles.

const (
	// Error means the file does not compile.
	Error Severity = iota
	// Warning means the file compiles, with something the author should see.
	Warning
)

type Target added in v0.2.0

type Target struct {
	Method string
	URL    string
}

Target is the HTTP call an integration operation makes.

Directories

Path Synopsis
Package wire is the JSON shape of a flow the API stores.
Package wire is the JSON shape of a flow the API stores.

Jump to

Keyboard shortcuts

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