workflows

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 21 Imported by: 12

Documentation

Index

Constants

View Source
const (
	KeywordTrigger = "trigger"
)

Variables

View Source
var (
	InterpolationTokenRe = regexp.MustCompile(`^\$\((\S+)\)$`)
)

Functions

func DeepMap

func DeepMap(input any, transform func(el any) (any, error)) (any, error)

DeepMap recursively applies a transformation function over each string within:

  • a map[string]any
  • a []any
  • a string

func EncodeExecutionID deprecated added in v0.2.2

func EncodeExecutionID(workflowID, eventID string) (string, error)

Deprecated: Use GenerateExecutionIDWithTriggerIndex instead.

func GenerateExecutionIDWithTriggerIndex added in v1.3.0

func GenerateExecutionIDWithTriggerIndex(workflowID, triggerEventID string, triggerIndex int) (string, error)

func GenerateJSONSchema

func GenerateJSONSchema() ([]byte, error)

func GenerateWorkflowID added in v0.4.0

func GenerateWorkflowID(owner []byte, name string, workflow []byte, config []byte, secretsURL string) ([32]byte, error)

func GenerateWorkflowIDFromStrings added in v0.4.0

func GenerateWorkflowIDFromStrings(owner string, name string, workflow []byte, config []byte, secretsURL string) (string, error)

func GenerateWorkflowOwnerAddress added in v0.9.7

func GenerateWorkflowOwnerAddress(prefix string, ownerKey string) ([]byte, error)

CREATE2-style address derivation with domain separation and collision resistance: ownerAddress = keccak256(0xff ++ bytes.repeat(0x0, 84) ++ "Chainlink Runtime Environment GenerateWorkflowOwnerAddress\x00" ++ len(prefix).to_bytes(8, byteorder='big') ++ prefix ++ len(ownerKey).to_bytes(8, byteorder='big') ++ ownerKey)[:20]

func GetTriggerIndexFromReferenceID added in v1.3.0

func GetTriggerIndexFromReferenceID(referenceID string) (int, error)

func GetTriggerReferenceID added in v1.3.0

func GetTriggerReferenceID(triggerIndex int) string

func HashTruncateName added in v0.4.1

func HashTruncateName(name string) string

HashTruncateName returns the SHA-256 hash of the workflow name truncated to the first 10 bytes.

func ParseWorkflowSpecYaml

func ParseWorkflowSpecYaml(data string) (sdk.WorkflowSpec, error)

func WFYamlSpec

func WFYamlSpec(t *testing.T, name, owner string) string

WFYamlSpec generates a validate yaml spec for a workflow for the given name and owner

Types

type DependencyGraph

type DependencyGraph struct {
	ID string
	graph.Graph[string, *Vertex]

	Triggers []*sdk.StepDefinition

	Spec *sdk.WorkflowSpec
}

DependencyGraph is an intermediate representation of a workflow wherein all the graph vertices are represented and validated. It is a static representation of the workflow dependencies.

func BuildDependencyGraph added in v0.2.2

func BuildDependencyGraph(spec sdk.WorkflowSpec) (*DependencyGraph, error)

type Mapping added in v0.2.2

type Mapping map[string]any

func (Mapping) MarshalJSON added in v0.2.2

func (m Mapping) MarshalJSON() ([]byte, error)

func (*Mapping) UnmarshalJSON added in v0.2.2

func (m *Mapping) UnmarshalJSON(b []byte) error

type Vertex

type Vertex struct {
	sdk.StepDefinition
	Dependencies []string
}

func (*Vertex) VID

func (v *Vertex) VID() string

VID is an identifier for a Vertex that can be used to uniquely identify it in a graph. it represents the notion `hash` in the graph package AddVertex method. we refrain from naming it `hash` to avoid confusion with the hash function.

type WorkflowSpecYaml added in v0.2.2

type WorkflowSpecYaml struct {
	Name string `json:"name,omitempty" jsonschema:"pattern=^[0-9A-Za-z_\\-]+$,maxLength=10"` // plain text string exactly 10 characters long, or  empty name allowed for anonymous workflows
	//Name nameYaml `json:"name"`
	Owner string `json:"owner,omitempty" jsonschema:"pattern=^0x[0-9a-fA-F]{40}$"` // 20 bytes represented as hex string with 0x prefix, or empty owner allowed for anonymous workflows
	// Triggers define a starting condition for the workflow, based on specific events or conditions.
	Triggers []triggerDefinitionYaml `json:"triggers" jsonschema:"required"`
	// Actions represent a discrete operation within the workflow, potentially transforming input data.
	Actions []stepDefinitionYaml `json:"actions,omitempty"`
	// Consensus encapsulates the logic for aggregating and validating the results from various nodes.
	Consensus []stepDefinitionYaml `json:"consensus,omitempty"`
	// Targets represents the final step of the workflow, delivering the processed data to a specified location.
	Targets []stepDefinitionYaml `json:"targets" jsonschema:"required"`
	// contains filtered or unexported fields
}

WorkflowSpecYaml is the YAML representation of a workflow spec.

It allows for multiple ways of defining a workflow spec, which we later convert to a single representation, `WorkflowSpec`.

func (WorkflowSpecYaml) ToWorkflowSpec added in v0.2.2

func (w WorkflowSpecYaml) ToWorkflowSpec() sdk.WorkflowSpec

ToWorkflowSpec converts a WorkflowSpecYaml to a WorkflowSpec.

We support multiple ways of defining a workflow spec yaml, but internally we want to work with a single representation.

Directories

Path Synopsis
cmd command
cmd
gen_owners command
gen_owners derives workflow owner addresses from org IDs.
gen_owners derives workflow owner addresses from org IDs.
pb
pb
sdk
gen command
v2/pb module
host
NOTE: loosely based on: https://github.com/tetratelabs/wazero/blob/1353ca24fef0a57a3a342d75f20357a6e9d3be35/internal/wasip1/errno.go#L14
NOTE: loosely based on: https://github.com/tetratelabs/wazero/blob/1353ca24fef0a57a3a342d75f20357a6e9d3be35/internal/wasip1/errno.go#L14
pb
pb/generate command

Jump to

Keyboard shortcuts

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