-module(dagger@dsl@current_module). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/dagger/dsl/current_module.gleam"). -export([none/1, include/2, exclude/2, gitignore/2, current_module/0, dependencies/4, generated_context_directory/1, generators/2, id/1, name/3, source/1, workdir/3, workdir_file/2]). -export_type([opts/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. -type opts() :: {opts, gleam@option:option(list(binary())), gleam@option:option(list(binary())), gleam@option:option(boolean())}. -file("src/dagger/dsl/current_module.gleam", 18). -spec defaults() -> opts(). defaults() -> {opts, none, none, none}. -file("src/dagger/dsl/current_module.gleam", 26). -spec none(opts()) -> opts(). none(Opts) -> Opts. -file("src/dagger/dsl/current_module.gleam", 30). -spec include(opts(), list(binary())) -> opts(). include(Opts, Val) -> {opts, {some, Val}, erlang:element(3, Opts), erlang:element(4, Opts)}. -file("src/dagger/dsl/current_module.gleam", 34). -spec exclude(opts(), list(binary())) -> opts(). exclude(Opts, Val) -> {opts, erlang:element(2, Opts), {some, Val}, erlang:element(4, Opts)}. -file("src/dagger/dsl/current_module.gleam", 38). -spec gitignore(opts(), boolean()) -> opts(). gitignore(Opts, Val) -> {opts, erlang:element(2, Opts), erlang:element(3, Opts), {some, Val}}. -file("src/dagger/dsl/current_module.gleam", 42). -spec current_module() -> dagger@dsl@types:current_module(). current_module() -> Field = {field, <<"currentModule"/utf8>>, [], []}, {current_module, {pure, [Field]}}. -file("src/dagger/dsl/current_module.gleam", 48). ?DOC(" The dependencies of the module.\n"). -spec dependencies( dagger@dsl@types:current_module(), fun((dagger@dsl@types:module_()) -> list(dagger@types:field())), dagger@types:client(), fun(({ok, list(dagger@dsl@types:module_())} | {error, dagger@types:query_error()}) -> KSI) ) -> KSI. dependencies(Parent, Select, Client, Handler) -> Subfields = Select({module, {pure, []}}), Field = {field, <<"dependencies"/utf8>>, [], Subfields}, Op = begin dagger@types:bind( erlang:element(2, Parent), fun(Q) -> Full_query = lists:append(Q, [Field]), {fetch, Full_query, {decoder, fun gleam@dynamic@decode:decode_dynamic/1}, fun(Dyn) -> Path = dagger@types:make_path(Full_query), case gleam@dynamic@decode:run( Dyn, gleam@dynamic@decode:at( Path, gleam@dynamic@decode:list( {decoder, fun gleam@dynamic@decode:decode_dynamic/1} ) ) ) of {ok, Items} -> {pure, {ok, gleam@list:map( Items, fun(_) -> {module, {pure, Full_query}} end )}}; {error, _} -> {pure, {error, {decoding_error, <<"dependencies"/utf8>>}}} end end} end ) end, Handler(dagger@interpreter:run(Op, Client)). -file("src/dagger/dsl/current_module.gleam", 70). ?DOC(" The generated files and directories made on top of the module source's context directory.\n"). -spec generated_context_directory(dagger@dsl@types:current_module()) -> dagger@dsl@types:directory(). generated_context_directory(Parent) -> Field = {field, <<"generatedContextDirectory"/utf8>>, [], []}, New_op = begin dagger@types:bind( erlang:element(2, Parent), fun(Q) -> {pure, lists:append(Q, [Field])} end ) end, {directory, New_op}. -file("src/dagger/dsl/current_module.gleam", 79). -spec encode_generators(opts()) -> list({binary(), dagger@types:value()}). encode_generators(Opts) -> gleam@list:filter_map([case erlang:element(2, Opts) of {some, Val} -> {ok, {<<"include"/utf8>>, {g_list, gleam@list:map(Val, fun(X) -> {g_string, X} end)}}}; none -> {error, nil} end], fun(X@1) -> X@1 end). -file("src/dagger/dsl/current_module.gleam", 89). ?DOC(" Return all generators defined by the module\n"). -spec generators(dagger@dsl@types:current_module(), fun((opts()) -> opts())) -> dagger@dsl@types:generator_group(). generators(Parent, With_fn) -> Opts = With_fn(defaults()), Field = {field, <<"generators"/utf8>>, encode_generators(Opts), []}, New_op = begin dagger@types:bind( erlang:element(2, Parent), fun(Q) -> {pure, lists:append(Q, [Field])} end ) end, {generator_group, New_op}. -file("src/dagger/dsl/current_module.gleam", 100). ?DOC(" A unique identifier for this CurrentModule.\n"). -spec id(dagger@dsl@types:current_module()) -> dagger@dsl@types:current_module(). id(Parent) -> Field = {field, <<"id"/utf8>>, [], []}, New_op = begin dagger@types:bind( erlang:element(2, Parent), fun(Q) -> {pure, lists:append(Q, [Field])} end ) end, {current_module, New_op}. -file("src/dagger/dsl/current_module.gleam", 110). ?DOC(" The name of the module being executed in\n"). -spec name( dagger@dsl@types:current_module(), dagger@types:client(), fun(({ok, binary()} | {error, dagger@types:query_error()}) -> KSL) ) -> KSL. name(Parent, Client, Handler) -> Field = {field, <<"name"/utf8>>, [], []}, Op = begin dagger@types:bind( erlang:element(2, Parent), fun(Q) -> Full_query = lists:append(Q, [Field]), {fetch, Full_query, {decoder, fun gleam@dynamic@decode:decode_dynamic/1}, fun(Dyn) -> Path = dagger@types:make_path(Full_query), case gleam@dynamic@decode:run( Dyn, gleam@dynamic@decode:at( Path, {decoder, fun gleam@dynamic@decode:decode_string/1} ) ) of {ok, Val} -> {pure, {ok, Val}}; {error, _} -> {pure, {error, {decoding_error, <<"name"/utf8>>}}} end end} end ) end, Handler(dagger@interpreter:run(Op, Client)). -file("src/dagger/dsl/current_module.gleam", 131). ?DOC(" The directory containing the module's source code loaded into the engine (plus any generated code that may have been created).\n"). -spec source(dagger@dsl@types:current_module()) -> dagger@dsl@types:directory(). source(Parent) -> Field = {field, <<"source"/utf8>>, [], []}, New_op = begin dagger@types:bind( erlang:element(2, Parent), fun(Q) -> {pure, lists:append(Q, [Field])} end ) end, {directory, New_op}. -file("src/dagger/dsl/current_module.gleam", 140). -spec encode_workdir(opts()) -> list({binary(), dagger@types:value()}). encode_workdir(Opts) -> gleam@list:filter_map([case erlang:element(2, Opts) of {some, Val} -> {ok, {<<"include"/utf8>>, {g_list, gleam@list:map(Val, fun(X) -> {g_string, X} end)}}}; none -> {error, nil} end, case erlang:element(3, Opts) of {some, Val@1} -> {ok, {<<"exclude"/utf8>>, {g_list, gleam@list:map( Val@1, fun(X@1) -> {g_string, X@1} end )}}}; none -> {error, nil} end, case erlang:element(4, Opts) of {some, Val@2} -> {ok, {<<"gitignore"/utf8>>, {g_bool, Val@2}}}; none -> {error, nil} end], fun(X@2) -> X@2 end). -file("src/dagger/dsl/current_module.gleam", 158). ?DOC(" Load a directory from the module's scratch working directory, including any changes that may have been made to it during module function execution.\n"). -spec workdir( dagger@dsl@types:current_module(), binary(), fun((opts()) -> opts()) ) -> dagger@dsl@types:directory(). workdir(Parent, Path, With_fn) -> Opts = With_fn(defaults()), Field = {field, <<"workdir"/utf8>>, lists:append( [{<<"path"/utf8>>, {g_string, Path}}], encode_workdir(Opts) ), []}, New_op = begin dagger@types:bind( erlang:element(2, Parent), fun(Q) -> {pure, lists:append(Q, [Field])} end ) end, {directory, New_op}. -file("src/dagger/dsl/current_module.gleam", 169). ?DOC(" Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.\n"). -spec workdir_file(dagger@dsl@types:current_module(), binary()) -> dagger@dsl@types:file(). workdir_file(Parent, Path) -> Field = {field, <<"workdirFile"/utf8>>, [{<<"path"/utf8>>, {g_string, Path}}], []}, New_op = begin dagger@types:bind( erlang:element(2, Parent), fun(Q) -> {pure, lists:append(Q, [Field])} end ) end, {file, New_op}.