Compare commits

...

8 Commits

20 changed files with 332 additions and 180 deletions

165
Cargo.lock generated
View File

@ -71,9 +71,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
version = "0.10.3" version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [ dependencies = [
"generic-array", "generic-array",
] ]
@ -121,9 +121,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.1.6" version = "4.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"clap_lex", "clap_lex",
@ -134,9 +134,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.3.1" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09"
dependencies = [ dependencies = [
"os_str_bytes", "os_str_bytes",
] ]
@ -262,11 +262,9 @@ dependencies = [
name = "dagger-core" name = "dagger-core"
version = "0.2.8" version = "0.2.8"
dependencies = [ dependencies = [
"clap",
"dirs", "dirs",
"eyre", "eyre",
"flate2", "flate2",
"genco",
"graphql-introspection-query", "graphql-introspection-query",
"graphql_client", "graphql_client",
"hex", "hex",
@ -292,7 +290,6 @@ dependencies = [
"dirs", "dirs",
"eyre", "eyre",
"flate2", "flate2",
"genco",
"graphql-introspection-query", "graphql-introspection-query",
"graphql_client", "graphql_client",
"hex", "hex",
@ -309,7 +306,7 @@ dependencies = [
[[package]] [[package]]
name = "dagger-sdk" name = "dagger-sdk"
version = "0.2.17" version = "0.2.19"
dependencies = [ dependencies = [
"base64", "base64",
"dagger-core", "dagger-core",
@ -327,9 +324,9 @@ dependencies = [
[[package]] [[package]]
name = "darling" name = "darling"
version = "0.14.3" version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"darling_macro", "darling_macro",
@ -337,9 +334,9 @@ dependencies = [
[[package]] [[package]]
name = "darling_core" name = "darling_core"
version = "0.14.3" version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
dependencies = [ dependencies = [
"fnv", "fnv",
"ident_case", "ident_case",
@ -351,9 +348,9 @@ dependencies = [
[[package]] [[package]]
name = "darling_macro" name = "darling_macro"
version = "0.14.3" version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"quote", "quote",
@ -746,9 +743,9 @@ dependencies = [
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.3.15" version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -838,9 +835,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.24" version = "0.14.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
@ -916,9 +913,9 @@ dependencies = [
[[package]] [[package]]
name = "io-lifetimes" name = "io-lifetimes"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.45.0", "windows-sys 0.45.0",
@ -932,9 +929,9 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
[[package]] [[package]]
name = "is-terminal" name = "is-terminal"
version = "0.4.3" version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857"
dependencies = [ dependencies = [
"hermit-abi 0.3.1", "hermit-abi 0.3.1",
"io-lifetimes", "io-lifetimes",
@ -953,9 +950,9 @@ dependencies = [
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
@ -974,9 +971,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.139" version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]] [[package]]
name = "libz-sys" name = "libz-sys"
@ -1233,18 +1230,18 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.51" version = "1.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.23" version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -1301,18 +1298,9 @@ dependencies = [
[[package]] [[package]]
name = "relative-path" name = "relative-path"
version = "1.7.3" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3bf6b372449361333ac1f498b7edae4dd5e70dccd7c0c2a7c7bce8f05ede648" checksum = "4bf2521270932c3c7bed1a59151222bd7643c79310f2916f01925e1e16255698"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "reqwest" name = "reqwest"
@ -1362,9 +1350,9 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.36.8" version = "0.36.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"errno", "errno",
@ -1376,9 +1364,9 @@ dependencies = [
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.12" version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
[[package]] [[package]]
name = "schannel" name = "schannel"
@ -1420,18 +1408,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.152" version = "1.0.156"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.152" version = "1.0.156"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1440,9 +1428,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.93" version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -1507,9 +1495,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.4.7" version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
dependencies = [ dependencies = [
"libc", "libc",
"winapi", "winapi",
@ -1523,9 +1511,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.107" version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1545,16 +1533,15 @@ dependencies = [
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.3.0" version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand", "fastrand",
"libc",
"redox_syscall", "redox_syscall",
"remove_dir_all", "rustix",
"winapi", "windows-sys 0.42.0",
] ]
[[package]] [[package]]
@ -1568,18 +1555,18 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.38" version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.38" version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1613,9 +1600,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.25.0" version = "1.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes", "bytes",
@ -1628,7 +1615,7 @@ dependencies = [
"signal-hook-registry", "signal-hook-registry",
"socket2", "socket2",
"tokio-macros", "tokio-macros",
"windows-sys 0.42.0", "windows-sys 0.45.0",
] ]
[[package]] [[package]]
@ -1728,15 +1715,15 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]] [[package]]
name = "unicode-bidi" name = "unicode-bidi"
version = "0.3.10" version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.6" version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]] [[package]]
name = "unicode-normalization" name = "unicode-normalization"
@ -1959,9 +1946,9 @@ dependencies = [
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.42.1" version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm", "windows_aarch64_gnullvm",
"windows_aarch64_msvc", "windows_aarch64_msvc",
@ -1974,45 +1961,45 @@ dependencies = [
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.42.1" version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.42.1" version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.42.1" version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.42.1" version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.42.1" version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.42.1" version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.42.1" version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]] [[package]]
name = "winreg" name = "winreg"

View File

@ -1,42 +1,20 @@
[package]
name = "dagger-rs"
version = "0.2.10"
edition = "2021"
readme = "README.md"
license-file = "LICENSE.MIT"
description = "A dagger sdk for rust, written in rust"
repository = "https://github.com/kjuulh/dagger-rs"
publish = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[workspace] [workspace]
members = [ members = [
"crates/dagger-codegen", "crates/dagger-codegen",
"crates/dagger-sdk", "crates/dagger-sdk",
"crates/dagger-core", "crates/dagger-core",
"crates/dagger-rs",
"ci", "ci",
] ]
[dependencies] [workspace.dependencies]
dagger-codegen = { path = "crates/dagger-codegen", version = "^0.2.5" } dagger-codegen = { path = "crates/dagger-codegen", version = "^0.2.5" }
dagger-core = { path = "crates/dagger-core", version = "^0.2.8" } dagger-core = { path = "crates/dagger-core", version = "^0.2.8" }
dagger-rs = { path = "crates/dagger-rs", version = "^0.2.10" }
dagger-sdk = { path = "crates/dagger-sdk", version = "^0.2.19" }
clap = "4.1.6"
dirs = "4.0.0"
eyre = "0.6.8" eyre = "0.6.8"
flate2 = { version = "1.0.25", features = ["zlib"] } color-eyre = "0.6.2"
genco = "0.17.3"
graphql-introspection-query = "0.2.0"
graphql_client = { version = "0.12.0", features = ["reqwest"] }
hex = "0.4.3"
hex-literal = "0.3.4"
platform-info = "1.0.2"
reqwest = { version = "0.11.14", features = ["stream", "deflate"] }
serde = { version = "1.0.152", features = ["derive"] } serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93" serde_json = "1.0.93"
sha2 = "0.10.6"
tar = "0.4.38"
tempfile = "3.3.0"
color-eyre = "0.6.2"
tokio = { version = "1.25.0", features = ["full"] } tokio = { version = "1.25.0", features = ["full"] }

View File

@ -3,6 +3,19 @@ command = "cargo"
args = ["run", "-p", "ci", "--", "codegen"] args = ["run", "-p", "ci", "--", "codegen"]
workspace = false workspace = false
[tasks.local_codegen]
command = "cargo"
args = [
"run",
"-p",
"dagger-rs",
"--",
"generate",
"--output",
"crates/dagger-sdk/src/gen.rs",
]
workspace = false
[tasks.build] [tasks.build]
command = "cargo" command = "cargo"
args = ["run", "-p", "ci", "--", "ci"] args = ["run", "-p", "ci", "--", "ci"]
@ -20,6 +33,10 @@ args = ["fix", "--workspace", "--allow-dirty"]
dependencies = ["fmt"] dependencies = ["fmt"]
workspace = false workspace = false
[tasks.gen]
dependencies = ["local_codegen", "fmt", "fix"]
workspace = false
[tasks.release_crate] [tasks.release_crate]
command = "cargo" command = "cargo"
args = [ args = [

View File

@ -8,6 +8,6 @@ edition = "2021"
[dependencies] [dependencies]
clap = "4.1.6" clap = "4.1.6"
color-eyre = "0.6.2" color-eyre = "0.6.2"
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.17" } dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.19" }
eyre = "0.6.8" eyre = "0.6.8"
tokio = { version = "1.25.0", features = ["full"] } tokio = { version = "1.25.0", features = ["full"] }

View File

@ -10,12 +10,15 @@ publish = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
convert_case = "0.6.0" dagger-core = { workspace = true }
dagger-core = { path = "../dagger-core", version = "^0.2.8" }
eyre = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
eyre = "0.6.8"
genco = "0.17.3" genco = "0.17.3"
convert_case = "0.6.0"
itertools = "0.10.5" itertools = "0.10.5"
[dev-dependencies]
pretty_assertions = "1.3.0" pretty_assertions = "1.3.0"
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"

View File

@ -196,6 +196,22 @@ pub fn type_ref_is_scalar(type_ref: &TypeRef) -> bool {
.unwrap_or(false) .unwrap_or(false)
} }
pub fn type_ref_is_enum(type_ref: &TypeRef) -> bool {
let mut type_ref = type_ref.clone();
if type_ref
.kind
.pipe(|k| *k == __TypeKind::NON_NULL)
.unwrap_or(false)
{
type_ref = *type_ref.of_type.unwrap().clone();
}
type_ref
.kind
.pipe(|k| *k == __TypeKind::ENUM)
.unwrap_or(false)
}
pub fn type_ref_is_object(type_ref: &TypeRef) -> bool { pub fn type_ref_is_object(type_ref: &TypeRef) -> bool {
let mut type_ref = type_ref.clone(); let mut type_ref = type_ref.clone();
if type_ref if type_ref

View File

@ -3,10 +3,11 @@ use dagger_core::introspection::{FullTypeFields, TypeRef};
use genco::prelude::rust; use genco::prelude::rust;
use genco::quote; use genco::quote;
use genco::tokens::quoted; use genco::tokens::quoted;
use itertools::Itertools;
use crate::functions::{ use crate::functions::{
type_field_has_optional, type_ref_is_list, type_ref_is_list_of_objects, type_ref_is_object, type_field_has_optional, type_ref_is_enum, type_ref_is_list, type_ref_is_list_of_objects,
type_ref_is_optional, type_ref_is_scalar, CommonFunctions, Scalar, type_ref_is_object, type_ref_is_optional, type_ref_is_scalar, CommonFunctions, Scalar,
}; };
use crate::utility::OptionExt; use crate::utility::OptionExt;
@ -133,6 +134,12 @@ fn render_required_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt
} }
} }
if type_ref_is_enum(&s.input_value.type_) {
return Some(quote! {
query = query.arg_enum($(quoted(name)), $(n));
})
}
if type_ref_is_list(&s.input_value.type_) { if type_ref_is_list(&s.input_value.type_) {
let inner = *s let inner = *s
.input_value .input_value
@ -187,6 +194,14 @@ fn render_optional_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt
let n = format_struct_name(&s.input_value.name); let n = format_struct_name(&s.input_value.name);
let name = &s.input_value.name; let name = &s.input_value.name;
if type_ref_is_enum(&s.input_value.type_) {
return Some(quote! {
if let Some($(&n)) = opts.$(&n) {
query = query.arg_enum($(quoted(name)), $(n));
}
});
}
Some(quote! { Some(quote! {
if let Some($(&n)) = opts.$(&n) { if let Some($(&n)) = opts.$(&n) {
query = query.arg($(quoted(name)), $(&n)); query = query.arg($(quoted(name)), $(&n));
@ -391,6 +406,7 @@ pub fn format_optional_args(
.map(|t| { .map(|t| {
t.into_iter() t.into_iter()
.filter(|t| type_ref_is_optional(&t.input_value.type_)) .filter(|t| type_ref_is_optional(&t.input_value.type_))
.sorted_by_key(|val| &val.input_value.name)
.collect::<Vec<_>>() .collect::<Vec<_>>()
}) })
.pipe(|t| render_optional_field_args(funcs, t)) .pipe(|t| render_optional_field_args(funcs, t))

View File

@ -1,6 +1,7 @@
use dagger_core::introspection::FullType; use dagger_core::introspection::FullType;
use genco::prelude::rust; use genco::prelude::rust;
use genco::quote; use genco::quote;
use itertools::Itertools;
fn render_enum_values(values: &FullType) -> Option<rust::Tokens> { fn render_enum_values(values: &FullType) -> Option<rust::Tokens> {
let values = values let values = values
@ -10,6 +11,7 @@ fn render_enum_values(values: &FullType) -> Option<rust::Tokens> {
.map(|values| { .map(|values| {
values values
.into_iter() .into_iter()
.sorted_by_key(|a| &a.name)
.map(|val| quote! { $(val.name.as_ref()), }) .map(|val| quote! { $(val.name.as_ref()), })
}) })
.flatten() .flatten()

View File

@ -1,6 +1,7 @@
use dagger_core::introspection::{FullType, FullTypeInputFields}; use dagger_core::introspection::{FullType, FullTypeInputFields};
use genco::prelude::rust; use genco::prelude::rust;
use genco::quote; use genco::quote;
use itertools::Itertools;
use crate::functions::CommonFunctions; use crate::functions::CommonFunctions;
use crate::rust::functions::{format_name, format_struct_name}; use crate::rust::functions::{format_name, format_struct_name};
@ -20,7 +21,10 @@ pub fn render_input_fields(
funcs: &CommonFunctions, funcs: &CommonFunctions,
fields: &[FullTypeInputFields], fields: &[FullTypeInputFields],
) -> Option<rust::Tokens> { ) -> Option<rust::Tokens> {
let rendered_fields = fields.iter().map(|f| render_input_field(funcs, f)); let rendered_fields = fields
.iter()
.sorted_by_key(|val| &val.input_value.name)
.map(|f| render_input_field(funcs, f));
if rendered_fields.len() == 0 { if rendered_fields.len() == 0 {
None None

View File

@ -10,20 +10,19 @@ publish = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
clap = "4.1.6" eyre = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
dirs = "4.0.0" dirs = "4.0.0"
eyre = "0.6.8"
flate2 = { version = "1.0.25", features = ["zlib"] } flate2 = { version = "1.0.25", features = ["zlib"] }
genco = "0.17.3"
graphql-introspection-query = "0.2.0" graphql-introspection-query = "0.2.0"
graphql_client = { version = "0.12.0", features = ["reqwest"] } graphql_client = { version = "0.12.0", features = ["reqwest"] }
hex = "0.4.3" hex = "0.4.3"
hex-literal = "0.3.4" hex-literal = "0.3.4"
platform-info = "1.0.2" platform-info = "1.0.2"
reqwest = { version = "0.11.14", features = ["stream", "deflate"] } reqwest = { version = "0.11.14", features = ["stream", "deflate"] }
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
sha2 = "0.10.6" sha2 = "0.10.6"
tar = "0.4.38" tar = "0.4.38"
tempfile = "3.3.0" tempfile = "3.3.0"
tokio = { version = "1.25.0", features = ["full"] }

View File

@ -0,0 +1,34 @@
[package]
name = "dagger-rs"
version = "0.2.10"
edition = "2021"
readme = "README.md"
license-file = "LICENSE.MIT"
description = "A dagger sdk for rust, written in rust"
repository = "https://github.com/kjuulh/dagger-rs"
publish = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dagger-core = { workspace = true }
dagger-codegen = { workspace = true }
eyre = { workspace = true }
color-eyre = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
clap = "4.1.6"
dirs = "4.0.0"
flate2 = { version = "1.0.25", features = ["zlib"] }
graphql-introspection-query = "0.2.0"
graphql_client = { version = "0.12.0", features = ["reqwest"] }
hex = "0.4.3"
hex-literal = "0.3.4"
platform-info = "1.0.2"
reqwest = { version = "0.11.14", features = ["stream", "deflate"] }
sha2 = "0.10.6"
tar = "0.4.38"
tempfile = "3.3.0"

View File

@ -6,8 +6,43 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.19 (2023-03-14)
### Chore
- <csr-id-6629d2db4fbc7cdba9b2e4a241e4b0a2592cf384/> fix release version
### Bug Fixes
- <csr-id-8fd6bb983ef00b1aa2cf1ba3088028329033c38f/> serialization of enum args for graphql
### Commit Statistics
<csr-read-only-do-not-edit/>
- 2 commits contributed to the release.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 1 unique issue was worked on: [#34](https://github.com/kjuulh/dagger-rs/issues/34)
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **[#34](https://github.com/kjuulh/dagger-rs/issues/34)**
- serialization of enum args for graphql ([`8fd6bb9`](https://github.com/kjuulh/dagger-rs/commit/8fd6bb983ef00b1aa2cf1ba3088028329033c38f))
* **Uncategorized**
- fix release version ([`6629d2d`](https://github.com/kjuulh/dagger-rs/commit/6629d2db4fbc7cdba9b2e4a241e4b0a2592cf384))
</details>
## v0.2.17 (2023-03-13) ## v0.2.17 (2023-03-13)
<csr-id-f67928155f02076cbb41abd4010523879ff3caf1/>
<csr-id-2cc0231c5f29993081f0f7e15e44cac95a7d6086/>
<csr-id-9ba01396cb44ee02cf7a16008e3f0bdae9f78754/>
<csr-id-e9e35edb1cb67eee8cc033212aba3b1888def78f/>
### Bug Fixes ### Bug Fixes
- <csr-id-1bfd084cd28e2b984c61de7f3f9a065cc41be007/> make sure tests have a command to execute - <csr-id-1bfd084cd28e2b984c61de7f3f9a065cc41be007/> make sure tests have a command to execute
@ -30,7 +65,7 @@ and this project adheres to
<csr-read-only-do-not-edit/> <csr-read-only-do-not-edit/>
- 9 commits contributed to the release over the course of 2 calendar days. - 10 commits contributed to the release over the course of 2 calendar days.
- 2 days passed between releases. - 2 days passed between releases.
- 9 commits were understood as [conventional](https://www.conventionalcommits.org). - 9 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages - 0 issues like '(#ID)' were seen in commit messages
@ -42,6 +77,7 @@ and this project adheres to
<details><summary>view details</summary> <details><summary>view details</summary>
* **Uncategorized** * **Uncategorized**
- Release dagger-sdk v0.2.17 ([`a8e6dde`](https://github.com/kjuulh/dagger-rs/commit/a8e6dde615029d9a94d159ed84b5373121cd201f))
- make sure tests have a command to execute ([`1bfd084`](https://github.com/kjuulh/dagger-rs/commit/1bfd084cd28e2b984c61de7f3f9a065cc41be007)) - make sure tests have a command to execute ([`1bfd084`](https://github.com/kjuulh/dagger-rs/commit/1bfd084cd28e2b984c61de7f3f9a065cc41be007))
- remove unused imports ([`5593fce`](https://github.com/kjuulh/dagger-rs/commit/5593fce2e16e0aa97a2e6843f15d3bb1121048f5)) - remove unused imports ([`5593fce`](https://github.com/kjuulh/dagger-rs/commit/5593fce2e16e0aa97a2e6843f15d3bb1121048f5))
- remove export and instead use exitcode ([`2cc0231`](https://github.com/kjuulh/dagger-rs/commit/2cc0231c5f29993081f0f7e15e44cac95a7d6086)) - remove export and instead use exitcode ([`2cc0231`](https://github.com/kjuulh/dagger-rs/commit/2cc0231c5f29993081f0f7e15e44cac95a7d6086))

View File

@ -1,6 +1,6 @@
[package] [package]
name = "dagger-sdk" name = "dagger-sdk"
version = "0.2.17" version = "0.2.19"
edition = "2021" edition = "2021"
readme = "README.md" readme = "README.md"
license-file = "LICENSE.MIT" license-file = "LICENSE.MIT"
@ -11,15 +11,16 @@ publish = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
dagger-core = { path = "../dagger-core", version = "^0.2.8" } dagger-core = { workspace = true }
eyre = { workspace = true }
tokio = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
base64 = "0.21.0" base64 = "0.21.0"
eyre = "0.6.8"
futures = "0.3.27" futures = "0.3.27"
gql_client = "1.0.7" gql_client = "1.0.7"
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
tokio = { version = "1.25.0", features = ["full"] }
derive_builder = "0.12.0" derive_builder = "0.12.0"
[dev-dependencies] [dev-dependencies]

View File

@ -111,8 +111,8 @@ pub struct BuildArg {
} }
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct PipelineLabel { pub struct PipelineLabel {
pub value: String,
pub name: String, pub name: String,
pub value: String,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct CacheVolume { pub struct CacheVolume {
@ -137,13 +137,13 @@ pub struct Container {
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerBuildOpts<'a> { pub struct ContainerBuildOpts<'a> {
/// Additional build arguments.
#[builder(setter(into, strip_option), default)]
pub build_args: Option<Vec<BuildArg>>,
/// Path to the Dockerfile to use. /// Path to the Dockerfile to use.
/// Default: './Dockerfile'. /// Default: './Dockerfile'.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub dockerfile: Option<&'a str>, pub dockerfile: Option<&'a str>,
/// Additional build arguments.
#[builder(setter(into, strip_option), default)]
pub build_args: Option<Vec<BuildArg>>,
/// Target build stage to build. /// Target build stage to build.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub target: Option<&'a str>, pub target: Option<&'a str>,
@ -162,20 +162,20 @@ pub struct ContainerExecOpts<'a> {
/// Command to run instead of the container's default command (e.g., ["run", "main.go"]). /// Command to run instead of the container's default command (e.g., ["run", "main.go"]).
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub args: Option<Vec<&'a str>>, pub args: Option<Vec<&'a str>>,
/// Content to write to the command's standard input before closing (e.g., "Hello world").
#[builder(setter(into, strip_option), default)]
pub stdin: Option<&'a str>,
/// Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
#[builder(setter(into, strip_option), default)]
pub redirect_stdout: Option<&'a str>,
/// Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
#[builder(setter(into, strip_option), default)]
pub redirect_stderr: Option<&'a str>,
/// Provide dagger access to the executed command. /// Provide dagger access to the executed command.
/// Do not use this option unless you trust the command being executed. /// Do not use this option unless you trust the command being executed.
/// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM. /// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub experimental_privileged_nesting: Option<bool>, pub experimental_privileged_nesting: Option<bool>,
/// Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
#[builder(setter(into, strip_option), default)]
pub redirect_stderr: Option<&'a str>,
/// Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
#[builder(setter(into, strip_option), default)]
pub redirect_stdout: Option<&'a str>,
/// Content to write to the command's standard input before closing (e.g., "Hello world").
#[builder(setter(into, strip_option), default)]
pub stdin: Option<&'a str>,
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerExportOpts { pub struct ContainerExportOpts {
@ -217,15 +217,6 @@ pub struct ContainerWithDirectoryOpts<'a> {
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerWithExecOpts<'a> { pub struct ContainerWithExecOpts<'a> {
/// Content to write to the command's standard input before closing (e.g., "Hello world").
#[builder(setter(into, strip_option), default)]
pub stdin: Option<&'a str>,
/// Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
#[builder(setter(into, strip_option), default)]
pub redirect_stdout: Option<&'a str>,
/// Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
#[builder(setter(into, strip_option), default)]
pub redirect_stderr: Option<&'a str>,
/// Provides dagger access to the executed command. /// Provides dagger access to the executed command.
/// Do not use this option unless you trust the command being executed. /// Do not use this option unless you trust the command being executed.
/// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM. /// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
@ -237,15 +228,24 @@ pub struct ContainerWithExecOpts<'a> {
/// when absolutely necessary and only with trusted commands. /// when absolutely necessary and only with trusted commands.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub insecure_root_capabilities: Option<bool>, pub insecure_root_capabilities: Option<bool>,
/// Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
#[builder(setter(into, strip_option), default)]
pub redirect_stderr: Option<&'a str>,
/// Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
#[builder(setter(into, strip_option), default)]
pub redirect_stdout: Option<&'a str>,
/// Content to write to the command's standard input before closing (e.g., "Hello world").
#[builder(setter(into, strip_option), default)]
pub stdin: Option<&'a str>,
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerWithExposedPortOpts<'a> { pub struct ContainerWithExposedPortOpts<'a> {
/// Transport layer network protocol
#[builder(setter(into, strip_option), default)]
pub protocol: Option<NetworkProtocol>,
/// Optional port description /// Optional port description
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub description: Option<&'a str>, pub description: Option<&'a str>,
/// Transport layer network protocol
#[builder(setter(into, strip_option), default)]
pub protocol: Option<NetworkProtocol>,
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerWithFileOpts { pub struct ContainerWithFileOpts {
@ -256,12 +256,12 @@ pub struct ContainerWithFileOpts {
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerWithMountedCacheOpts { pub struct ContainerWithMountedCacheOpts {
/// Identifier of the directory to use as the cache volume's root.
#[builder(setter(into, strip_option), default)]
pub source: Option<DirectoryId>,
/// Sharing mode of the cache volume. /// Sharing mode of the cache volume.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub sharing: Option<CacheSharingMode>, pub sharing: Option<CacheSharingMode>,
/// Identifier of the directory to use as the cache volume's root.
#[builder(setter(into, strip_option), default)]
pub source: Option<DirectoryId>,
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerWithNewFileOpts<'a> { pub struct ContainerWithNewFileOpts<'a> {
@ -955,7 +955,7 @@ impl Container {
query = query.arg("port", port); query = query.arg("port", port);
if let Some(protocol) = opts.protocol { if let Some(protocol) = opts.protocol {
query = query.arg("protocol", protocol); query = query.arg_enum("protocol", protocol);
} }
if let Some(description) = opts.description { if let Some(description) = opts.description {
query = query.arg("description", description); query = query.arg("description", description);
@ -1085,7 +1085,7 @@ impl Container {
query = query.arg("source", source); query = query.arg("source", source);
} }
if let Some(sharing) = opts.sharing { if let Some(sharing) = opts.sharing {
query = query.arg("sharing", sharing); query = query.arg_enum("sharing", sharing);
} }
return Container { return Container {
@ -1395,7 +1395,7 @@ impl Container {
query = query.arg("port", port); query = query.arg("port", port);
if let Some(protocol) = opts.protocol { if let Some(protocol) = opts.protocol {
query = query.arg("protocol", protocol); query = query.arg_enum("protocol", protocol);
} }
return Container { return Container {
@ -1485,6 +1485,9 @@ pub struct Directory {
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct DirectoryDockerBuildOpts<'a> { pub struct DirectoryDockerBuildOpts<'a> {
/// Build arguments to use in the build.
#[builder(setter(into, strip_option), default)]
pub build_args: Option<Vec<BuildArg>>,
/// Path to the Dockerfile to use (e.g., "frontend.Dockerfile"). /// Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
/// Defaults: './Dockerfile'. /// Defaults: './Dockerfile'.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
@ -1492,9 +1495,6 @@ pub struct DirectoryDockerBuildOpts<'a> {
/// The platform to build. /// The platform to build.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub platform: Option<Platform>, pub platform: Option<Platform>,
/// Build arguments to use in the build.
#[builder(setter(into, strip_option), default)]
pub build_args: Option<Vec<BuildArg>>,
/// Target build stage to build. /// Target build stage to build.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub target: Option<&'a str>, pub target: Option<&'a str>,
@ -2073,10 +2073,10 @@ pub struct GitRef {
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct GitRefTreeOpts<'a> { pub struct GitRefTreeOpts<'a> {
#[builder(setter(into, strip_option), default)]
pub ssh_known_hosts: Option<&'a str>,
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub ssh_auth_socket: Option<SocketId>, pub ssh_auth_socket: Option<SocketId>,
#[builder(setter(into, strip_option), default)]
pub ssh_known_hosts: Option<&'a str>,
} }
impl GitRef { impl GitRef {
@ -2480,12 +2480,12 @@ pub struct QueryDirectoryOpts {
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct QueryGitOpts { pub struct QueryGitOpts {
/// Set to true to keep .git directory.
#[builder(setter(into, strip_option), default)]
pub keep_git_dir: Option<bool>,
/// A service which must be started before the repo is fetched. /// A service which must be started before the repo is fetched.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub experimental_service_host: Option<ContainerId>, pub experimental_service_host: Option<ContainerId>,
/// Set to true to keep .git directory.
#[builder(setter(into, strip_option), default)]
pub keep_git_dir: Option<bool>,
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct QueryHttpOpts { pub struct QueryHttpOpts {
@ -2848,9 +2848,9 @@ impl Socket {
} }
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] #[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
pub enum CacheSharingMode { pub enum CacheSharingMode {
SHARED,
PRIVATE,
LOCKED, LOCKED,
PRIVATE,
SHARED,
} }
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] #[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
pub enum NetworkProtocol { pub enum NetworkProtocol {

View File

@ -68,6 +68,32 @@ impl Selection {
s s
} }
pub fn arg_enum<S>(&self, name: &str, value: S) -> Selection
where
S: Serialize,
{
let mut s = self.clone();
let val = serde_json::to_string(&value).unwrap();
let val = val[1..val.len() - 1].to_string();
println!("test");
println!("{}", val);
match s.args.as_mut() {
Some(args) => {
let _ = args.insert(name.to_string(), val);
}
None => {
let mut hm = HashMap::new();
let _ = hm.insert(name.to_string(), val);
s.args = Some(hm);
}
}
s
}
pub fn build(&self) -> eyre::Result<String> { pub fn build(&self) -> eyre::Result<String> {
let mut fields = vec!["query".to_string()]; let mut fields = vec!["query".to_string()];
@ -76,7 +102,7 @@ impl Selection {
if let Some(args) = sel.args { if let Some(args) = sel.args {
let actualargs = args let actualargs = args
.iter() .iter()
.map(|(name, arg)| format!("{name}:{arg}")) .map(|(name, arg)| format!("{name}:{}", arg.as_str()))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
query = query.add(&format!("({})", actualargs.join(", "))); query = query.add(&format!("({})", actualargs.join(", ")));
@ -99,6 +125,9 @@ impl Selection {
{ {
let query = self.build()?; let query = self.build()?;
let qbs = query.as_str();
println!("{}", qbs);
let resp: Option<serde_json::Value> = match gql_client.query(&query).await { let resp: Option<serde_json::Value> = match gql_client.query(&query).await {
Ok(r) => r, Ok(r) => r,
Err(e) => eyre::bail!(e), Err(e) => eyre::bail!(e),

View File

@ -0,0 +1,29 @@
use dagger_sdk::{ContainerWithExposedPortOpts, NetworkProtocol};
#[tokio::test]
async fn test_issue_30_alt() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?;
client
.container()
.from("denoland/deno:debian-1.30.3")
.with_exposed_port_opts(
53,
ContainerWithExposedPortOpts {
protocol: Some(NetworkProtocol::TCP),
description: None,
},
)
.with_exposed_port_opts(
53,
ContainerWithExposedPortOpts {
protocol: Some(NetworkProtocol::UDP),
description: None,
},
)
.with_exec(vec!["echo", "hello"])
.exit_code()
.await?;
Ok(())
}

View File

@ -1 +1,2 @@
mod iss_30; mod iss_30;
mod iss_33;