-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(EYU, EYV, EYW) :: {workflow_definition, binary(), aion@codec:codec(EYU), aion@codec:codec(EYV), aion@codec:codec(EYW), fun((EYU) -> {ok, EYV} | {error, EYW})}. -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(EYX), aion@codec:codec(EYZ), aion@codec:codec(EZB), fun((EYX) -> {ok, EYZ} | {error, EZB}) ) -> workflow_definition(EYX, EYZ, EZB). 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(EZO, any(), any())) -> aion@codec:codec(EZO). 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(), EZW, any())) -> aion@codec:codec(EZW). 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(), FAE)) -> aion@codec:codec(FAE). 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(FAJ, FAK, FAL)) -> fun((FAJ) -> {ok, FAK} | {error, FAL}). entry_fn(Definition) -> erlang:element(6, Definition).