Packages

Gleam SDK for Dagger — type-safe pipelines via GraphQL codegen

Current section

Files

Jump to
dagger_gleam src dagger@dsl@module_source.erl
Raw

src/dagger@dsl@module_source.erl

-module(dagger@dsl@module_source).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/dagger/dsl/module_source.gleam").
-export([module_source/1, as_module/1, as_string/3, blueprint/1, clone_ref/3, commit/3, config_clients/4, config_exists/3, context_directory/1, dependencies/4, digest/3, directory/2, engine_version/3, generated_context_directory/1, html_repo_u_r_l/3, html_u_r_l/3, id/1, introspection_schema_j_s_o_n/1, kind/3, local_context_directory_path/3, module_name/3, module_original_name/3, original_subpath/3, pin/3, repo_root_path/3, sdk/1, source_root_subpath/3, source_subpath/3, sync/1, toolchains/4, user_defaults/1, version/3, with_blueprint/2, with_client/3, with_dependencies/2, with_engine_version/2, with_experimental_features/2, with_includes/2, with_name/2, with_s_d_k/2, with_source_subpath/2, with_toolchains/2, with_update_blueprint/1, with_update_dependencies/2, with_update_toolchains/2, with_updated_clients/2, without_blueprint/1, without_client/2, without_dependencies/2, without_experimental_features/2, without_toolchains/2]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-file("src/dagger/dsl/module_source.gleam", 9).
-spec module_source(dagger@dsl@types:module_source()) -> dagger@dsl@types:module_source().
module_source(Id) ->
Field = {field,
<<"loadModuleSourceFromID"/utf8>>,
[{<<"id"/utf8>>, {g_deferred, erlang:element(2, Id)}}],
[]},
{module_source, {pure, [Field]}}.
-file("src/dagger/dsl/module_source.gleam", 15).
?DOC(" Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation\n").
-spec as_module(dagger@dsl@types:module_source()) -> dagger@dsl@types:module_().
as_module(Parent) ->
Field = {field, <<"asModule"/utf8>>, [], []},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module, New_op}.
-file("src/dagger/dsl/module_source.gleam", 25).
?DOC(" A human readable ref string representation of this module source.\n").
-spec as_string(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VMY)
) -> VMY.
as_string(Parent, Client, Handler) ->
Field = {field, <<"asString"/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, <<"asString"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 46).
?DOC(" The blueprint referenced by the module source.\n").
-spec blueprint(dagger@dsl@types:module_source()) -> dagger@dsl@types:module_source().
blueprint(Parent) ->
Field = {field, <<"blueprint"/utf8>>, [], []},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 56).
?DOC(" The ref to clone the root of the git repo from. Only valid for git sources.\n").
-spec clone_ref(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VNA)
) -> VNA.
clone_ref(Parent, Client, Handler) ->
Field = {field, <<"cloneRef"/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, <<"cloneRef"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 77).
?DOC(" The resolved commit of the git repo this source points to.\n").
-spec commit(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VNC)
) -> VNC.
commit(Parent, Client, Handler) ->
Field = {field, <<"commit"/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, <<"commit"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 98).
?DOC(" The clients generated for the module.\n").
-spec config_clients(
dagger@dsl@types:module_source(),
fun((dagger@dsl@types:module_config_client()) -> list(dagger@types:field())),
dagger@types:client(),
fun(({ok, list(dagger@dsl@types:module_config_client())} |
{error, dagger@types:query_error()}) -> VNG)
) -> VNG.
config_clients(Parent, Select, Client, Handler) ->
Subfields = Select({module_config_client, {pure, []}}),
Field = {field, <<"configClients"/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_config_client,
{pure, Full_query}}
end
)}};
{error, _} ->
{pure,
{error,
{decoding_error,
<<"configClients"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 120).
?DOC(" Whether an existing dagger.json for the module was found.\n").
-spec config_exists(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, boolean()} | {error, dagger@types:query_error()}) -> VNI)
) -> VNI.
config_exists(Parent, Client, Handler) ->
Field = {field, <<"configExists"/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_bool/1}
)
) of
{ok, Val} ->
{pure, {ok, Val}};
{error, _} ->
{pure,
{error,
{decoding_error,
<<"configExists"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 141).
?DOC(" The full directory loaded for the module source, including the source code as a subdirectory.\n").
-spec context_directory(dagger@dsl@types:module_source()) -> dagger@dsl@types:directory().
context_directory(Parent) ->
Field = {field, <<"contextDirectory"/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/module_source.gleam", 151).
?DOC(" The dependencies of the module source.\n").
-spec dependencies(
dagger@dsl@types:module_source(),
fun((dagger@dsl@types:module_source()) -> list(dagger@types:field())),
dagger@types:client(),
fun(({ok, list(dagger@dsl@types:module_source())} |
{error, dagger@types:query_error()}) -> VNM)
) -> VNM.
dependencies(Parent, Select, Client, Handler) ->
Subfields = Select({module_source, {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_source,
{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/module_source.gleam", 173).
?DOC(" A content-hash of the module source. Module sources with the same digest will output the same generated context and convert into the same module instance.\n").
-spec digest(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VNO)
) -> VNO.
digest(Parent, Client, Handler) ->
Field = {field, <<"digest"/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, <<"digest"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 194).
?DOC(" The directory containing the module configuration and source code (source code may be in a subdir).\n").
-spec directory(dagger@dsl@types:module_source(), binary()) -> dagger@dsl@types:directory().
directory(Parent, Path) ->
Field = {field,
<<"directory"/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,
{directory, New_op}.
-file("src/dagger/dsl/module_source.gleam", 204).
?DOC(" The engine version of the module.\n").
-spec engine_version(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VNQ)
) -> VNQ.
engine_version(Parent, Client, Handler) ->
Field = {field, <<"engineVersion"/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,
<<"engineVersion"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 225).
?DOC(" The generated files and directories made on top of the module source's context directory.\n").
-spec generated_context_directory(dagger@dsl@types:module_source()) -> 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/module_source.gleam", 235).
?DOC(" The URL to access the web view of the repository (e.g., GitHub, GitLab, Bitbucket).\n").
-spec html_repo_u_r_l(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VNS)
) -> VNS.
html_repo_u_r_l(Parent, Client, Handler) ->
Field = {field, <<"htmlRepoURL"/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, <<"htmlRepoURL"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 256).
?DOC(" The URL to the source's git repo in a web browser. Only valid for git sources.\n").
-spec html_u_r_l(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VNU)
) -> VNU.
html_u_r_l(Parent, Client, Handler) ->
Field = {field, <<"htmlURL"/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, <<"htmlURL"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 277).
?DOC(" A unique identifier for this ModuleSource.\n").
-spec id(dagger@dsl@types:module_source()) -> dagger@dsl@types:module_source().
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,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 289).
?DOC(
" The introspection schema JSON file for this module source.\n"
" This file represents the schema visible to the module's source code, including all core types and those from the dependencies.\n"
" Note: this is in the context of a module, so some core types may be hidden.\n"
).
-spec introspection_schema_j_s_o_n(dagger@dsl@types:module_source()) -> dagger@dsl@types:file().
introspection_schema_j_s_o_n(Parent) ->
Field = {field, <<"introspectionSchemaJSON"/utf8>>, [], []},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{file, New_op}.
-file("src/dagger/dsl/module_source.gleam", 299).
?DOC(" The kind of module source (currently local, git or dir).\n").
-spec kind(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, dagger@dsl@types:module_source_kind()} |
{error, dagger@types:query_error()}) -> VNW)
) -> VNW.
kind(Parent, Client, Handler) ->
Field = {field, <<"kind"/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,
gleam@dynamic@decode:map(
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(S) ->
dagger@dsl@types:module_source_kind_from_string(
S
)
end
)
)
) of
{ok, Val} ->
{pure, {ok, Val}};
{error, _} ->
{pure,
{error, {decoding_error, <<"kind"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 320).
?DOC(" The full absolute path to the context directory on the caller's host filesystem that this module source is loaded from. Only valid for local module sources.\n").
-spec local_context_directory_path(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VNY)
) -> VNY.
local_context_directory_path(Parent, Client, Handler) ->
Field = {field, <<"localContextDirectoryPath"/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,
<<"localContextDirectoryPath"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 341).
?DOC(" The name of the module, including any setting via the withName API.\n").
-spec module_name(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VOA)
) -> VOA.
module_name(Parent, Client, Handler) ->
Field = {field, <<"moduleName"/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, <<"moduleName"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 362).
?DOC(" The original name of the module as read from the module's dagger.json (or set for the first time with the withName API).\n").
-spec module_original_name(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VOC)
) -> VOC.
module_original_name(Parent, Client, Handler) ->
Field = {field, <<"moduleOriginalName"/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,
<<"moduleOriginalName"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 383).
?DOC(" The original subpath used when instantiating this module source, relative to the context directory.\n").
-spec original_subpath(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VOE)
) -> VOE.
original_subpath(Parent, Client, Handler) ->
Field = {field, <<"originalSubpath"/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,
<<"originalSubpath"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 404).
?DOC(" The pinned version of this module source.\n").
-spec pin(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VOG)
) -> VOG.
pin(Parent, Client, Handler) ->
Field = {field, <<"pin"/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, <<"pin"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 425).
?DOC(" The import path corresponding to the root of the git repo this source points to. Only valid for git sources.\n").
-spec repo_root_path(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VOI)
) -> VOI.
repo_root_path(Parent, Client, Handler) ->
Field = {field, <<"repoRootPath"/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,
<<"repoRootPath"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 446).
?DOC(" The SDK configuration of the module.\n").
-spec sdk(dagger@dsl@types:module_source()) -> dagger@dsl@types:s_d_k_config().
sdk(Parent) ->
Field = {field, <<"sdk"/utf8>>, [], []},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{s_d_k_config, New_op}.
-file("src/dagger/dsl/module_source.gleam", 456).
?DOC(" The path, relative to the context directory, that contains the module's dagger.json.\n").
-spec source_root_subpath(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VOK)
) -> VOK.
source_root_subpath(Parent, Client, Handler) ->
Field = {field, <<"sourceRootSubpath"/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,
<<"sourceRootSubpath"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 477).
?DOC(" The path to the directory containing the module's source code, relative to the context directory.\n").
-spec source_subpath(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VOM)
) -> VOM.
source_subpath(Parent, Client, Handler) ->
Field = {field, <<"sourceSubpath"/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,
<<"sourceSubpath"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 498).
?DOC(" Forces evaluation of the module source, including any loading into the engine and associated validation.\n").
-spec sync(dagger@dsl@types:module_source()) -> dagger@dsl@types:module_source().
sync(Parent) ->
Field = {field, <<"sync"/utf8>>, [], []},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 508).
?DOC(" The toolchains referenced by the module source.\n").
-spec toolchains(
dagger@dsl@types:module_source(),
fun((dagger@dsl@types:module_source()) -> list(dagger@types:field())),
dagger@types:client(),
fun(({ok, list(dagger@dsl@types:module_source())} |
{error, dagger@types:query_error()}) -> VOQ)
) -> VOQ.
toolchains(Parent, Select, Client, Handler) ->
Subfields = Select({module_source, {pure, []}}),
Field = {field, <<"toolchains"/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_source,
{pure, Full_query}}
end
)}};
{error, _} ->
{pure,
{error,
{decoding_error, <<"toolchains"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 530).
?DOC(" User-defined defaults read from local .env files\n").
-spec user_defaults(dagger@dsl@types:module_source()) -> dagger@dsl@types:env_file().
user_defaults(Parent) ->
Field = {field, <<"userDefaults"/utf8>>, [], []},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{env_file, New_op}.
-file("src/dagger/dsl/module_source.gleam", 540).
?DOC(" The specified version of the git repo this source points to.\n").
-spec version(
dagger@dsl@types:module_source(),
dagger@types:client(),
fun(({ok, binary()} | {error, dagger@types:query_error()}) -> VOS)
) -> VOS.
version(Parent, Client, Handler) ->
Field = {field, <<"version"/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, <<"version"/utf8>>}}}
end
end}
end
)
end,
Handler(dagger@interpreter:run(Op, Client)).
-file("src/dagger/dsl/module_source.gleam", 561).
?DOC(" Set a blueprint for the module source.\n").
-spec with_blueprint(
dagger@dsl@types:module_source(),
dagger@dsl@types:module_source()
) -> dagger@dsl@types:module_source().
with_blueprint(Parent, Blueprint) ->
Field = {field,
<<"withBlueprint"/utf8>>,
[{<<"blueprint"/utf8>>, {g_deferred, erlang:element(2, Blueprint)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 571).
?DOC(" Update the module source with a new client to generate.\n").
-spec with_client(dagger@dsl@types:module_source(), binary(), binary()) -> dagger@dsl@types:module_source().
with_client(Parent, Generator, Output_dir) ->
Field = {field,
<<"withClient"/utf8>>,
[{<<"generator"/utf8>>, {g_string, Generator}},
{<<"outputDir"/utf8>>, {g_string, Output_dir}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 581).
?DOC(" Append the provided dependencies to the module source's dependency list.\n").
-spec with_dependencies(
dagger@dsl@types:module_source(),
list(dagger@dsl@types:module_source())
) -> dagger@dsl@types:module_source().
with_dependencies(Parent, Dependencies) ->
Field = {field,
<<"withDependencies"/utf8>>,
[{<<"dependencies"/utf8>>,
{g_list,
gleam@list:map(
Dependencies,
fun(X) -> {g_deferred, erlang:element(2, X)} end
)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 591).
?DOC(" Upgrade the engine version of the module to the given value.\n").
-spec with_engine_version(dagger@dsl@types:module_source(), binary()) -> dagger@dsl@types:module_source().
with_engine_version(Parent, Version) ->
Field = {field,
<<"withEngineVersion"/utf8>>,
[{<<"version"/utf8>>, {g_string, Version}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 601).
?DOC(" Enable the experimental features for the module source.\n").
-spec with_experimental_features(
dagger@dsl@types:module_source(),
list(dagger@dsl@types:module_source_experimental_feature())
) -> dagger@dsl@types:module_source().
with_experimental_features(Parent, Features) ->
Field = {field,
<<"withExperimentalFeatures"/utf8>>,
[{<<"features"/utf8>>,
{g_list,
gleam@list:map(
Features,
fun(X) ->
{g_string,
dagger@dsl@types:module_source_experimental_feature_to_json(
X
)}
end
)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 611).
?DOC(" Update the module source with additional include patterns for files+directories from its context that are required for building it\n").
-spec with_includes(dagger@dsl@types:module_source(), list(binary())) -> dagger@dsl@types:module_source().
with_includes(Parent, Patterns) ->
Field = {field,
<<"withIncludes"/utf8>>,
[{<<"patterns"/utf8>>,
{g_list, gleam@list:map(Patterns, fun(X) -> {g_string, X} end)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 621).
?DOC(" Update the module source with a new name.\n").
-spec with_name(dagger@dsl@types:module_source(), binary()) -> dagger@dsl@types:module_source().
with_name(Parent, Name) ->
Field = {field,
<<"withName"/utf8>>,
[{<<"name"/utf8>>, {g_string, Name}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 631).
?DOC(" Update the module source with a new SDK.\n").
-spec with_s_d_k(dagger@dsl@types:module_source(), binary()) -> dagger@dsl@types:module_source().
with_s_d_k(Parent, Source) ->
Field = {field,
<<"withSDK"/utf8>>,
[{<<"source"/utf8>>, {g_string, Source}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 641).
?DOC(" Update the module source with a new source subpath.\n").
-spec with_source_subpath(dagger@dsl@types:module_source(), binary()) -> dagger@dsl@types:module_source().
with_source_subpath(Parent, Path) ->
Field = {field,
<<"withSourceSubpath"/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,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 651).
?DOC(" Add toolchains to the module source.\n").
-spec with_toolchains(
dagger@dsl@types:module_source(),
list(dagger@dsl@types:module_source())
) -> dagger@dsl@types:module_source().
with_toolchains(Parent, Toolchains) ->
Field = {field,
<<"withToolchains"/utf8>>,
[{<<"toolchains"/utf8>>,
{g_list,
gleam@list:map(
Toolchains,
fun(X) -> {g_deferred, erlang:element(2, X)} end
)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 661).
?DOC(" Update the blueprint module to the latest version.\n").
-spec with_update_blueprint(dagger@dsl@types:module_source()) -> dagger@dsl@types:module_source().
with_update_blueprint(Parent) ->
Field = {field, <<"withUpdateBlueprint"/utf8>>, [], []},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 671).
?DOC(" Update one or more module dependencies.\n").
-spec with_update_dependencies(dagger@dsl@types:module_source(), list(binary())) -> dagger@dsl@types:module_source().
with_update_dependencies(Parent, Dependencies) ->
Field = {field,
<<"withUpdateDependencies"/utf8>>,
[{<<"dependencies"/utf8>>,
{g_list,
gleam@list:map(Dependencies, fun(X) -> {g_string, X} end)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 681).
?DOC(" Update one or more toolchains.\n").
-spec with_update_toolchains(dagger@dsl@types:module_source(), list(binary())) -> dagger@dsl@types:module_source().
with_update_toolchains(Parent, Toolchains) ->
Field = {field,
<<"withUpdateToolchains"/utf8>>,
[{<<"toolchains"/utf8>>,
{g_list,
gleam@list:map(Toolchains, fun(X) -> {g_string, X} end)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 691).
?DOC(" Update one or more clients.\n").
-spec with_updated_clients(dagger@dsl@types:module_source(), list(binary())) -> dagger@dsl@types:module_source().
with_updated_clients(Parent, Clients) ->
Field = {field,
<<"withUpdatedClients"/utf8>>,
[{<<"clients"/utf8>>,
{g_list, gleam@list:map(Clients, fun(X) -> {g_string, X} end)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 701).
?DOC(" Remove the current blueprint from the module source.\n").
-spec without_blueprint(dagger@dsl@types:module_source()) -> dagger@dsl@types:module_source().
without_blueprint(Parent) ->
Field = {field, <<"withoutBlueprint"/utf8>>, [], []},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 711).
?DOC(" Remove a client from the module source.\n").
-spec without_client(dagger@dsl@types:module_source(), binary()) -> dagger@dsl@types:module_source().
without_client(Parent, Path) ->
Field = {field,
<<"withoutClient"/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,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 721).
?DOC(" Remove the provided dependencies from the module source's dependency list.\n").
-spec without_dependencies(dagger@dsl@types:module_source(), list(binary())) -> dagger@dsl@types:module_source().
without_dependencies(Parent, Dependencies) ->
Field = {field,
<<"withoutDependencies"/utf8>>,
[{<<"dependencies"/utf8>>,
{g_list,
gleam@list:map(Dependencies, fun(X) -> {g_string, X} end)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 731).
?DOC(" Disable experimental features for the module source.\n").
-spec without_experimental_features(
dagger@dsl@types:module_source(),
list(dagger@dsl@types:module_source_experimental_feature())
) -> dagger@dsl@types:module_source().
without_experimental_features(Parent, Features) ->
Field = {field,
<<"withoutExperimentalFeatures"/utf8>>,
[{<<"features"/utf8>>,
{g_list,
gleam@list:map(
Features,
fun(X) ->
{g_string,
dagger@dsl@types:module_source_experimental_feature_to_json(
X
)}
end
)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.
-file("src/dagger/dsl/module_source.gleam", 741).
?DOC(" Remove the provided toolchains from the module source.\n").
-spec without_toolchains(dagger@dsl@types:module_source(), list(binary())) -> dagger@dsl@types:module_source().
without_toolchains(Parent, Toolchains) ->
Field = {field,
<<"withoutToolchains"/utf8>>,
[{<<"toolchains"/utf8>>,
{g_list,
gleam@list:map(Toolchains, fun(X) -> {g_string, X} end)}}],
[]},
New_op = begin
dagger@types:bind(
erlang:element(2, Parent),
fun(Q) -> {pure, lists:append(Q, [Field])} end
)
end,
{module_source, New_op}.