Baton.Flow.Definition (Baton v0.27.4)

Copy Markdown View Source

The portable, versioned source representation of a Baton flow.

Definitions contain only JSON-compatible data and are independent of any database or host application. A host may store them in Ecto, Git, files, or another service, then pass the decoded definition to Baton for validation, compilation, execution, and projection.

Summary

Functions

The newest definition wire-format version understood by this Baton release.

Decode a JSON definition.

Dump a definition to a JSON-compatible, string-keyed map.

Encode a definition as JSON.

Load and validate the shape of a definition map.

Types

t()

@type t() :: %Baton.Flow.Definition{
  format: pos_integer(),
  key: String.t(),
  metadata: map(),
  name: String.t(),
  nodes: [Baton.Flow.NodeSpec.t()]
}

Functions

current_format()

The newest definition wire-format version understood by this Baton release.

decode(json)

@spec decode(String.t()) :: {:ok, t()} | {:error, term()}

Decode a JSON definition.

dump(definition)

@spec dump(t()) :: map()

Dump a definition to a JSON-compatible, string-keyed map.

encode(definition)

@spec encode(t()) :: {:ok, String.t()} | {:error, Jason.EncodeError.t()}

Encode a definition as JSON.

load(attrs)

@spec load(map()) :: {:ok, t()} | {:error, term()}

Load and validate the shape of a definition map.