-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(GDY, GDZ, GEA) :: {workflow_definition, binary(), aion@codec:codec(GDY), aion@codec:codec(GDZ), aion@codec:codec(GEA), fun((GDY) -> {ok, GDZ} | {error, GEA})}. -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(GEB), aion@codec:codec(GED), aion@codec:codec(GEF), fun((GEB) -> {ok, GED} | {error, GEF}) ) -> workflow_definition(GEB, GED, GEF). 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(GES, any(), any())) -> aion@codec:codec(GES). 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(), GFA, any())) -> aion@codec:codec(GFA). 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(), GFI)) -> aion@codec:codec(GFI). 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(GFN, GFO, GFP)) -> fun((GFN) -> {ok, GFO} | {error, GFP}). entry_fn(Definition) -> erlang:element(6, Definition).