-module(aion@workflow@define). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/aion/workflow/define.gleam"). -export([define/5, name/1, input_codec/1, output_codec/1, error_codec/1, entry_fn/1]). -export_type([workflow_definition/3]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC(" workflow.define: typed entry contract (entry fn + input/output/error codecs)\n"). -opaque workflow_definition(EYQ, EYR, EYS) :: {workflow_definition, binary(), aion@codec:codec(EYQ), aion@codec:codec(EYR), aion@codec:codec(EYS), fun((EYQ) -> {ok, EYR} | {error, EYS})}. -file("src/aion/workflow/define.gleam", 29). ?DOC(" Define a typed workflow entry contract consumed by AE at spawn.\n"). -spec define( binary(), aion@codec:codec(EYT), aion@codec:codec(EYV), aion@codec:codec(EYX), fun((EYT) -> {ok, EYV} | {error, EYX}) ) -> workflow_definition(EYT, EYV, EYX). define(Name, Input_codec, Output_codec, Error_codec, Entry_fn) -> {workflow_definition, Name, Input_codec, Output_codec, Error_codec, Entry_fn}. -file("src/aion/workflow/define.gleam", 46). ?DOC(" Return the workflow name carried by the definition.\n"). -spec name(workflow_definition(any(), any(), any())) -> binary(). name(Definition) -> erlang:element(2, Definition). -file("src/aion/workflow/define.gleam", 51). ?DOC(" Return the input codec used by AE to decode the spawn Payload.\n"). -spec input_codec(workflow_definition(EZK, any(), any())) -> aion@codec:codec(EZK). input_codec(Definition) -> erlang:element(3, Definition). -file("src/aion/workflow/define.gleam", 58). ?DOC(" Return the output codec used by AE to encode successful completion Payloads.\n"). -spec output_codec(workflow_definition(any(), EZS, any())) -> aion@codec:codec(EZS). output_codec(Definition) -> erlang:element(4, Definition). -file("src/aion/workflow/define.gleam", 65). ?DOC(" Return the error codec used by AE to encode failed completion Payloads.\n"). -spec error_codec(workflow_definition(any(), any(), FAA)) -> aion@codec:codec(FAA). error_codec(Definition) -> erlang:element(5, Definition). -file("src/aion/workflow/define.gleam", 72). ?DOC(" Return the typed entry function carried for AE to invoke/drive.\n"). -spec entry_fn(workflow_definition(FAF, FAG, FAH)) -> fun((FAF) -> {ok, FAG} | {error, FAH}). entry_fn(Definition) -> erlang:element(6, Definition).