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 ¶
- func Decompile(flow wire.Flow) ([]byte, error)
- func DecompileJSON(raw []byte) ([]byte, error)
- func FillIntegrations(req *wire.CreateFlowRequest, resolve func(IntegrationNode) (Target, error)) error
- func ModulePath(root, file string) (string, error)
- type Diagnostic
- type Flow
- type IntegrationNode
- type Outcome
- type Severity
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decompile ¶
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 ¶
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 ¶
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 ¶
CompileDir compiles every flow file under root. Files with an error are omitted from Flows; their diagnostics are still returned.
func CompileFile ¶
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 ¶
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.