Jido. Flow. Codec
(Jido Action v3.0.0-beta.12)
View Source
Encodes and decodes the stored Flow document.
The document contains JSON-compatible data. A trusted Jido.Flow.Registry
resolves all Action, Flow, schema, and user-data atom identifiers.
See the storage guide for document versions, operation tags, and validation limits.
registry =
Jido.Flow.Registry.new!(%{
"actions/send" => {:action, MyApp.SendNotice},
"schemas/none" => {:schema, []}
})
{:ok, document} = Jido.Flow.Codec.encode(flow, registry)
{:ok, decoded_flow} = Jido.Flow.Codec.decode(document, registry)
{:ok, temporary_document, temporary_registry} =
Jido.Flow.Codec.encode(flow)
case Jido.Flow.Codec.diagnose(editor_document, registry) do
{:ok, flow} -> {:ok, flow}
{:error, errors} -> {:error, Jido.Flow.Error.to_map(errors)}
end
Summary
Functions
Decodes one stored Flow document through a trusted Registry.
Diagnoses one stored Flow document without producing a partial Flow.
Encodes one executable Flow with a generated convenience Registry.
Encodes one canonical Flow as a JSON-compatible document within the reader's limits.
Types
Functions
@spec decode(document(), Jido.Flow.Registry.t()) :: {:ok, Jido.Flow.t()} | {:error, Exception.t()}
Decodes one stored Flow document through a trusted Registry.
@spec diagnose(document(), Jido.Flow.Registry.t()) :: {:ok, Jido.Flow.t()} | {:error, Jido.Flow.Error.Invalid.t()}
Diagnoses one stored Flow document without producing a partial Flow.
The function returns the same canonical value as decode/2 when the complete
document is valid. Otherwise, it returns one ordered
Jido.Flow.Error.Invalid group. Each independent leaf error has a JSON path
when a path is applicable.
Document size, collection size, nesting, root type, and document version errors are terminal. The function does not traverse an unsafe document or a document for another format version.
@spec encode(Jido.Flow.t()) :: {:ok, document(), Jido.Flow.Registry.t()} | {:error, Exception.t()}
Encodes one executable Flow with a generated convenience Registry.
The generated identifiers are for temporary storage, tests, or transport
within one application version. They can change when the Flow changes. Use
encode/2 with an application-owned Registry for durable storage.
@spec encode(Jido.Flow.t(), Jido.Flow.Registry.t()) :: {:ok, document()} | {:error, Exception.t()}
Encodes one canonical Flow as a JSON-compatible document within the reader's limits.