diff --git a/.gitignore b/.gitignore index 9a1e634..6875baa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target -config/local.* +api/config/local.* +web/dist diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1df931a..882b4f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,23 @@ repos: - - repo: https://github.com/doublify/pre-commit-rust - rev: v1.0 + - repo: local hooks: - - id: fmt - - id: cargo-check - args: ['--tests'] - - id: clippy - args: ['--tests', '--', '-D', 'warnings'] + - id: format + name: format + language: system + pass_filenames: false + entry: cargo make format-flow + - id: format-toml + name: format-toml + language: system + pass_filenames: false + entry: cargo make format-toml-flow + - id: check + name: check + language: system + pass_filenames: false + entry: cargo make check-tests + - id: clippy + name: clippy + language: system + pass_filenames: false + entry: cargo make clippy-flow diff --git a/Cargo.lock b/Cargo.lock index 9cfb223..96d420c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "actix-codec" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a36c014a3e811624313b51a227b775ecba55d36ef9462bbaac7d4f13e54c9271" +checksum = "57a7559404a7f3573127aab53c08ce37a6c6a315c374a31070f3c91cd1b4a7fe" dependencies = [ "bitflags", "bytes", @@ -16,14 +16,14 @@ dependencies = [ "memchr", "pin-project-lite", "tokio", - "tokio-util", + "tokio-util 0.7.0", ] [[package]] name = "actix-http" -version = "3.0.0-beta.18" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b95871724d27ac9a23d6db3246b23e4e42cd44a23145e1c6b04b78fb5271da" +checksum = "a5885cb81a0d4d0d322864bea1bb6c2a8144626b4fdc625d4c51eba197e7797a" dependencies = [ "actix-codec", "actix-rt", @@ -32,7 +32,7 @@ dependencies = [ "ahash 0.7.6", "base64", "bitflags", - "brotli2", + "brotli", "bytes", "bytestring", "derive_more", @@ -43,7 +43,7 @@ dependencies = [ "http", "httparse", "httpdate", - "itoa 1.0.1", + "itoa", "language-tags", "local-channel", "log", @@ -68,9 +68,9 @@ dependencies = [ [[package]] name = "actix-router" -version = "0.5.0-beta.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b53c1deabdbf3a8a8b9a949123edd3cafb873abd75da96b5933a8b590f9d6dc2" +checksum = "eb60846b52c118f2f04a56cc90880a274271c489b2498623d58176f8ca21fa80" dependencies = [ "bytestring", "firestorm", @@ -82,31 +82,30 @@ dependencies = [ [[package]] name = "actix-rt" -version = "2.5.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cf33e04d9911b39bfb7be3c01309568b4315895d3358372dce64ed2c2bf32d" +checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000" dependencies = [ - "actix-macros", "futures-core", "tokio", ] [[package]] name = "actix-server" -version = "2.0.0-rc.3" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9259b4f3cc9ca96d7d91a7da66b7b01c47653a0da5b0ba3f7f45a344480443b" +checksum = "0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824" dependencies = [ "actix-rt", "actix-service", "actix-utils", "futures-core", "futures-util", - "log", - "mio 0.8.0", + "mio", "num_cpus", "socket2", "tokio", + "tracing", ] [[package]] @@ -132,9 +131,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.0.0-beta.19" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229d0d2c11d6c734327cf1fbc15dd644b351b440bcb4608349258f5e00605bdc" +checksum = "f4e5ebffd51d50df56a3ae0de0e59487340ca456f05dd0b90c0a7a6dd6a74d31" dependencies = [ "actix-codec", "actix-http", @@ -147,13 +146,14 @@ dependencies = [ "actix-web-codegen", "ahash 0.7.6", "bytes", + "bytestring", "cfg-if", "cookie", "derive_more", "encoding_rs", "futures-core", "futures-util", - "itoa 1.0.1", + "itoa", "language-tags", "log", "mime", @@ -165,15 +165,15 @@ dependencies = [ "serde_urlencoded", "smallvec", "socket2", - "time 0.3.5", + "time 0.3.7", "url", ] [[package]] name = "actix-web-codegen" -version = "0.5.0-rc.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a793e4a7bd059e06e1bc1bd9943b57a47f806de3599d2437441682292c333e" +checksum = "7525bedf54704abb1d469e88d7e7e9226df73778798a69cea5022d53b2ae91bc" dependencies = [ "actix-router", "proc-macro2", @@ -213,6 +213,21 @@ dependencies = [ "memchr", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ef4730490ad1c4eae5c4325b2a95f521d023e5c885853ff7aca0a6a1631db3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "697ed7edc0f1711de49ce108c541623a0af97c6c60b2f6e2b65229847ac843c2" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "ansi_term" version = "0.12.1" @@ -224,9 +239,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.53" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0" +checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" [[package]] name = "async-trait" @@ -241,9 +256,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" @@ -286,9 +301,9 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ "generic-array 0.14.5", ] @@ -303,23 +318,30 @@ dependencies = [ ] [[package]] -name = "brotli-sys" -version = "0.3.2" +name = "boolinator" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" + +[[package]] +name = "brotli" +version = "3.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f838e47a451d5a8fa552371f80024dd6ace9b7acdf25c4c3d0f9bc6816fb1c39" dependencies = [ - "cc", - "libc", + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", ] [[package]] -name = "brotli2" -version = "0.3.2" +name = "brotli-decompressor" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" dependencies = [ - "brotli-sys", - "libc", + "alloc-no-stdlib", + "alloc-stdlib", ] [[package]] @@ -357,9 +379,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] @@ -409,6 +431,27 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06821ea598337a8412cf47c5b71c3bc694a7f0aed188ac28b836fab164a2c202" +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "contextswitch" +version = "0.1.0" +dependencies = [ + "chrono", + "http", + "serde", + "serde_json", + "uuid", +] + [[package]] name = "contextswitch-api" version = "0.1.0" @@ -419,10 +462,9 @@ dependencies = [ "chrono", "config", "configparser", - "contextswitch-types", + "contextswitch", "http", "lazy_static", - "listenfd", "mktemp", "proptest", "regex", @@ -441,15 +483,10 @@ dependencies = [ ] [[package]] -name = "contextswitch-types" +name = "contextswitch-web" version = "0.1.0" -source = "git+https://github.com/dax/contextswitch-types.git#974890d5f59efd257dd77faa44ec5106efcb1330" dependencies = [ - "chrono", - "http", - "serde", - "serde_json", - "uuid", + "yew", ] [[package]] @@ -465,15 +502,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05" dependencies = [ "percent-encoding", - "time 0.3.5", + "time 0.3.7", "version_check", ] [[package]] name = "core-foundation" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", @@ -496,20 +533,21 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if", ] [[package]] name = "crypto-common" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d6b536309245c849479fba3da410962a43ed8e51c26b729208ec0ac2798d0" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" dependencies = [ "generic-array 0.14.5", + "typenum", ] [[package]] @@ -536,13 +574,12 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" dependencies = [ - "block-buffer 0.10.0", + "block-buffer 0.10.2", "crypto-common", - "generic-array 0.14.5", ] [[package]] @@ -571,9 +608,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fastrand" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ "instant", ] @@ -629,36 +666,36 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" [[package]] name = "futures-sink" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" [[package]] name = "futures-task" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" [[package]] name = "futures-util" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" dependencies = [ "futures-core", "futures-task", @@ -687,9 +724,9 @@ dependencies = [ [[package]] name = "gethostname" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4addc164932852d066774c405dbbdb7914742d2b39e39e1a7ca949c856d054d1" +checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" dependencies = [ "libc", "winapi", @@ -697,20 +734,126 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", +] + +[[package]] +name = "gloo" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23947965eee55e3e97a5cd142dd4c10631cc349b48cecca0ed230fd296f568cd" +dependencies = [ + "gloo-console", + "gloo-dialogs", + "gloo-events", + "gloo-file", + "gloo-render", + "gloo-storage", + "gloo-timers", + "gloo-utils", +] + +[[package]] +name = "gloo-console" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3907f786f65bbb4f419e918b0c5674175ef1c231ecda93b2dbd65fd1e8882637" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-dialogs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ffb557a2ea2ed283f1334423d303a336fad55fb8572d51ae488f828b1464b40" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-events" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "088514ec8ef284891c762c88a66b639b3a730134714692ee31829765c5bc814f" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa5d6084efa4a2b182ef3a8649cb6506cb4843f22cf907c6e0a799944248ae90" +dependencies = [ + "gloo-events", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-render" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b4cda6e149df3bb4a3c6a343873903e5bcc2448a9877d61bb8274806ad67f6e" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5057761927af1b1929d02b1f49cf83553dd347a473ee7c8bb08420f2673ffc" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-timers" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d12a7f4e95cfe710f1d624fb1210b7d961a5fb05c4fd942f4feab06e61f590e" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-utils" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c77af6f96a4f9e27c8ac23a88407381a31f4a74c3fb985c85aa79b8d898136" +dependencies = [ + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] name = "h2" -version = "0.3.10" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9de88456263e249e241fcd211d3954e2c9b0ef7ccfc235a444eb367cae3689" +checksum = "62eeb471aa3e3c9197aa4bfeabfe02982f6dc96f750486c0bb0009ac58b26d2b" dependencies = [ "bytes", "fnv", @@ -721,7 +864,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util", + "tokio-util 0.6.9", "tracing", ] @@ -757,7 +900,7 @@ checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" dependencies = [ "bytes", "fnv", - "itoa 1.0.1", + "itoa", ] [[package]] @@ -773,9 +916,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" [[package]] name = "httpdate" @@ -785,9 +928,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.16" +version = "0.14.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" +checksum = "043f0e083e9901b6cc658a77d1eb86f4fc650bbb977a4337dd63192826aa85dd" dependencies = [ "bytes", "futures-channel", @@ -798,7 +941,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 0.4.8", + "itoa", "pin-project-lite", "socket2", "tokio", @@ -852,15 +995,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" - -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c" [[package]] name = "itoa" @@ -879,9 +1016,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" dependencies = [ "wasm-bindgen", ] @@ -911,9 +1048,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.112" +version = "0.2.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" [[package]] name = "linked-hash-map" @@ -921,17 +1058,6 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" -[[package]] -name = "listenfd" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e514e2cb8a9624701346ea3e694c1766d76778e343e537d873c1c366e79a7" -dependencies = [ - "libc", - "uuid", - "winapi", -] - [[package]] name = "local-channel" version = "0.1.2" @@ -952,9 +1078,9 @@ checksum = "902eb695eb0591864543cbfbf6d742510642a605a61fc5e97fe6ceb5a30ac4fb" [[package]] name = "lock_api" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" dependencies = [ "scopeguard", ] @@ -1019,27 +1145,15 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.14" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - -[[package]] -name = "mio" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2" +checksum = "7ba42135c6a5917b9db9cd7b293e5409e1c6b041e6f9825e92e55a894c63b6f8" dependencies = [ "libc", "log", "miow", "ntapi", + "wasi 0.11.0+wasi-snapshot-preview1", "winapi", ] @@ -1092,9 +1206,9 @@ dependencies = [ [[package]] name = "ntapi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" dependencies = [ "winapi", ] @@ -1129,10 +1243,19 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.9.0" +name = "num_threads" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" +checksum = "c539a50b93a303167eded6e8dff5220cd39447409fb659f4cd24b1f72fe4f133" +dependencies = [ + "libc", +] + +[[package]] +name = "once_cell" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" [[package]] name = "opaque-debug" @@ -1156,9 +1279,9 @@ dependencies = [ [[package]] name = "openssl-probe" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" @@ -1185,27 +1308,25 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ - "instant", "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" dependencies = [ "cfg-if", - "instant", "libc", "redox_syscall", "smallvec", - "winapi", + "windows-sys", ] [[package]] @@ -1313,6 +1434,30 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.36" @@ -1356,23 +1501,22 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quote" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" +checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" dependencies = [ "proc-macro2", ] [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", "rand_core", - "rand_hc", ] [[package]] @@ -1394,15 +1538,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core", -] - [[package]] name = "rand_xorshift" version = "0.3.0" @@ -1414,18 +1549,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ "aho-corasick", "memchr", @@ -1458,15 +1593,16 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c4e0a76dc12a116108933f6301b95e83634e0c47b0afbed6abbaa0601e99258" +checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525" dependencies = [ "base64", "bytes", "encoding_rs", "futures-core", "futures-util", + "h2", "http", "http-body", "hyper", @@ -1562,6 +1698,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "scoped-tls-hkt" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63" + [[package]] name = "scopeguard" version = "1.1.0" @@ -1570,9 +1712,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "security-framework" -version = "2.4.2" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" dependencies = [ "bitflags", "core-foundation", @@ -1583,9 +1725,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.4.2" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" dependencies = [ "core-foundation-sys", "libc", @@ -1593,24 +1735,24 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" +checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d" [[package]] name = "serde" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -1619,23 +1761,23 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.74" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142" +checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" dependencies = [ - "itoa 1.0.1", + "itoa", "ryu", "serde", ] [[package]] name = "serde_urlencoded" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 0.4.8", + "itoa", "ryu", "serde", ] @@ -1660,7 +1802,7 @@ checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.1", + "digest 0.10.3", ] [[package]] @@ -1689,15 +1831,15 @@ checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" [[package]] name = "smallvec" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "socket2" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ "libc", "winapi", @@ -1705,9 +1847,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7" +checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" dependencies = [ "proc-macro2", "quote", @@ -1750,9 +1892,9 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" dependencies = [ "once_cell", ] @@ -1769,12 +1911,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad" +checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" dependencies = [ - "itoa 0.4.8", + "itoa", "libc", + "num_threads", "time-macros", ] @@ -1801,19 +1944,20 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.15.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" +checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" dependencies = [ "bytes", "libc", "memchr", - "mio 0.7.14", + "mio", "num_cpus", "once_cell", "parking_lot", "pin-project-lite", "signal-hook-registry", + "socket2", "tokio-macros", "winapi", ] @@ -1853,6 +1997,20 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-util" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64910e1b9c1901aaf5375561e35b9c057d95ff41a44ede043a03e09279eabaf1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.5.8" @@ -1870,9 +2028,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.29" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" +checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" dependencies = [ "cfg-if", "log", @@ -1883,9 +2041,9 @@ dependencies = [ [[package]] name = "tracing-actix-web" -version = "0.5.0-beta.9" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6025a1b13fe88f5a520e0b9caeb962f969093e3f05f567ca3cd02f9391733c01" +checksum = "99bcebac55fba44eadf75a424ee403e756f9165596a613d125876388e5fb4c34" dependencies = [ "actix-web", "pin-project", @@ -1896,9 +2054,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" +checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" dependencies = [ "proc-macro2", "quote", @@ -1915,7 +2073,7 @@ dependencies = [ "log", "serde", "serde_json", - "time 0.3.5", + "time 0.3.7", "tracing", "tracing-core", "tracing-log", @@ -1924,11 +2082,12 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" +checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c" dependencies = [ "lazy_static", + "valuable", ] [[package]] @@ -1954,9 +2113,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" dependencies = [ "serde", "tracing-core", @@ -1964,9 +2123,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.5" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d81bfa81424cc98cb034b837c985b7a290f592e5b4322f353f94a0ab0f9f594" +checksum = "9e0ab7bdc962035a87fba73f3acca9b8a8d0034c2e6f60b84aeaaddddc155dce" dependencies = [ "ansi_term", "lazy_static", @@ -2044,6 +2203,12 @@ dependencies = [ "serde", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" @@ -2082,20 +2247,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] -name = "wasm-bindgen" -version = "0.2.78" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ "cfg-if", + "serde", + "serde_json", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" dependencies = [ "bumpalo", "lazy_static", @@ -2108,9 +2281,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" +checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" dependencies = [ "cfg-if", "js-sys", @@ -2120,9 +2293,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2130,9 +2303,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" dependencies = [ "proc-macro2", "quote", @@ -2143,15 +2316,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" [[package]] name = "web-sys" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" dependencies = [ "js-sys", "wasm-bindgen", @@ -2179,6 +2352,49 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" + +[[package]] +name = "windows_i686_gnu" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" + +[[package]] +name = "windows_i686_msvc" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" + [[package]] name = "winreg" version = "0.7.0" @@ -2198,19 +2414,52 @@ dependencies = [ ] [[package]] -name = "zstd" -version = "0.9.2+zstd.1.5.1" +name = "yew" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2390ea1bf6c038c39674f22d95f0564725fc06034a47129179810b2fc58caa54" +checksum = "2a1ccb53e57d3f7d847338cf5758befa811cabe207df07f543c06f502f9998cd" +dependencies = [ + "console_error_panic_hook", + "gloo", + "gloo-utils", + "indexmap", + "js-sys", + "scoped-tls-hkt", + "slab", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "yew-macro", +] + +[[package]] +name = "yew-macro" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fab79082b556d768d6e21811869c761893f0450e1d550a67892b9bce303b7bb" +dependencies = [ + "boolinator", + "lazy_static", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zstd" +version = "0.10.0+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1365becbe415f3f0fcd024e2f7b45bacfb5bdd055f0dc113571394114e7bdd" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "4.1.3+zstd.1.5.1" +version = "4.1.4+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e99d81b99fb3c2c2c794e3fe56c305c63d5173a16a46b5850b07c935ffc7db79" +checksum = "2f7cd17c9af1a4d6c24beb1cc54b17e2ef7b593dc92f19e9d9acad8b182bbaee" dependencies = [ "libc", "zstd-sys", @@ -2218,9 +2467,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "1.6.2+zstd.1.5.1" +version = "1.6.3+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2daf2f248d9ea44454bfcb2516534e8b8ad2fc91bf818a1885495fc42bc8ac9f" +checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8" dependencies = [ "cc", "libc", diff --git a/Cargo.toml b/Cargo.toml index 6d56fa2..4fd8473 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,41 +1,18 @@ [package] -name = "contextswitch-api" +name = "contextswitch" version = "0.1.0" edition = "2021" authors = ["David Rousselie "] +[workspace] +members = ["api", "web"] + [lib] path = "src/lib.rs" -[[bin]] -path = "src/main.rs" -name = "contextswitch-api" - [dependencies] -contextswitch-types = { git = "https://github.com/dax/contextswitch-types.git" } -actix-web = "=4.0.0-beta.19" -actix-http = "=3.0.0-beta.18" -tokio = { version = "1", features = ["macros", "rt-multi-thread"] } -serde = { version = "1.0.0", features = ["derive"] } +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" uuid = { version = "0.8.0", features = ["serde"] } chrono = { version = "0.4.0", features = ["serde"] } -mktemp = "0.4.0" -configparser = "3.0.0" -listenfd = "0.3.0" -tracing = { version = "0.1.0", features = ["log"] } -tracing-subscriber = { version = "0.3.0", features = ["std", "env-filter", "fmt", "json"] } -tracing-log = "0.1.0" -tracing-actix-web = "=0.5.0-beta.9" -regex = "1.5.0" -lazy_static = "1.4.0" -tracing-bunyan-formatter = "0.3.0" -thiserror = "1.0" -anyhow = "1.0" -http = "0.2.0" -config = "0.12.0" - -[dev-dependencies] -proptest = "1.0.0" -reqwest = { version = "0.11.0", features = ["json"] } -rstest = "0.12.0" +http = "0.2.0" \ No newline at end of file diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 0000000..2a0c19c --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,60 @@ +[env] +CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "true" +CARGO_MAKE_COVERAGE_PROVIDER = "tarpaulin" +CARGO_MAKE_CLIPPY_ARGS = "--tests -- -D warnings" + +[tasks.default] +clear = true +alias = "run" + +[tasks.test] +install_crate = "cargo-nextest" +args = [ + "nextest", + "run", + "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", + "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )", +] + +[tasks.audit] +condition = {} +workspace = false + +[tasks.run-api] +install_crate = "bunyan" +env = { "CONFIG_PATH" = "api/config", "TASKRC" = "$PWD/api/taskrc" } +command = "bash" +args = ["-c", "cargo run -p contextswitch-api | bunyan"] +workspace = false +watch = { watch = ["./api/"], no_git_ignore = true } + +[tasks.run-web] +install_crate = "trunk" +command = "bash" +args = ["-c", "cd web; trunk serve"] +workspace = false + +[tasks.run] +run_task = { name = ["run-api", "run-web"], parallel = true, fork = true } +workspace = false + +[tasks.watch-api] +watch = { watch = ["./api/"], no_git_ignore = true } +command = "bash" +args = ["-c", "cd api; cargo make watch-flow"] +workspace = false + +[tasks.watch-web] +watch = { watch = ["./web/"], no_git_ignore = true } +command = "bash" +args = ["-c", "cd web; cargo make watch-flow"] +workspace = false + +[tasks.watch-root] +watch = { watch = ["./src/"], no_git_ignore = true } +run_task = "dev-test-flow" +workspace = false + +[tasks.watch] +run_task = { name = ["watch-api", "watch-web", "watch-root"], parallel = true, fork = true } +workspace = false diff --git a/api/Cargo.toml b/api/Cargo.toml new file mode 100644 index 0000000..94d0eb6 --- /dev/null +++ b/api/Cargo.toml @@ -0,0 +1,45 @@ +[package] +name = "contextswitch-api" +version = "0.1.0" +edition = "2021" +authors = ["David Rousselie "] + +[lib] +path = "src/lib.rs" + +[[bin]] +path = "src/main.rs" +name = "contextswitch-api" + +[dependencies] +contextswitch = { path = ".." } +actix-web = "4.0.0" +actix-http = "3.0.0" +tokio = { version = "1", features = ["macros", "rt-multi-thread"] } +serde = { version = "1.0.0", features = ["derive"] } +serde_json = "1.0" +uuid = { version = "0.8.0", features = ["serde"] } +chrono = { version = "0.4.0", features = ["serde"] } +mktemp = "0.4.0" +configparser = "3.0.0" +tracing = { version = "0.1.0", features = ["log"] } +tracing-subscriber = { version = "0.3.0", features = [ + "std", + "env-filter", + "fmt", + "json", +] } +tracing-log = "0.1.0" +tracing-actix-web = "0.5.0" +regex = "1.5.0" +lazy_static = "1.4.0" +tracing-bunyan-formatter = "0.3.0" +thiserror = "1.0" +anyhow = "1.0" +http = "0.2.0" +config = "0.12.0" + +[dev-dependencies] +proptest = "1.0.0" +reqwest = { version = "0.11.0", features = ["json"] } +rstest = "0.12.0" diff --git a/api/Makefile.toml b/api/Makefile.toml new file mode 100644 index 0000000..8ee118d --- /dev/null +++ b/api/Makefile.toml @@ -0,0 +1 @@ +extend = "../Makefile.toml" diff --git a/config/default.toml b/api/config/default.toml similarity index 86% rename from config/default.toml rename to api/config/default.toml index 37dc21b..e84e4f7 100644 --- a/config/default.toml +++ b/api/config/default.toml @@ -4,4 +4,4 @@ port = 8000 log_directive = "info" [taskwarrior] -data_location = "/tmp" \ No newline at end of file +data_location = "/tmp" diff --git a/api/config/dev.toml b/api/config/dev.toml new file mode 100644 index 0000000..30b7ad6 --- /dev/null +++ b/api/config/dev.toml @@ -0,0 +1,2 @@ +[application] +log_directive = "debug" diff --git a/api/config/test.toml b/api/config/test.toml new file mode 100644 index 0000000..30b7ad6 --- /dev/null +++ b/api/config/test.toml @@ -0,0 +1,2 @@ +[application] +log_directive = "debug" diff --git a/src/configuration.rs b/api/src/configuration.rs similarity index 80% rename from src/configuration.rs rename to api/src/configuration.rs index cbc7073..ec10929 100644 --- a/src/configuration.rs +++ b/api/src/configuration.rs @@ -25,10 +25,11 @@ impl Settings { let config_file_required = file.is_some(); let config_file = file.unwrap_or_else(|| env::var("CONFIG").unwrap_or_else(|_| "dev".into())); + let config_path = env::var("CONFIG_PATH").unwrap_or_else(|_| "config".into()); let config = Config::builder() - .add_source(File::with_name("config/default")) - .add_source(File::with_name("config/local").required(false)) + .add_source(File::with_name(&format!("{}/default", config_path))) + .add_source(File::with_name(&format!("{}/local", config_path)).required(false)) .add_source(File::with_name(&config_file).required(config_file_required)) .add_source(Environment::with_prefix("cs")) .build()?; diff --git a/src/contextswitch/api.rs b/api/src/contextswitch/api.rs similarity index 98% rename from src/contextswitch/api.rs rename to api/src/contextswitch/api.rs index cbaf621..bce8d45 100644 --- a/src/contextswitch/api.rs +++ b/api/src/contextswitch/api.rs @@ -1,5 +1,5 @@ use crate::contextswitch::taskwarrior; -use contextswitch_types::Task; +use contextswitch::Task; use serde_json; fn error_chain_fmt( diff --git a/src/contextswitch/mod.rs b/api/src/contextswitch/mod.rs similarity index 100% rename from src/contextswitch/mod.rs rename to api/src/contextswitch/mod.rs diff --git a/src/contextswitch/taskwarrior.rs b/api/src/contextswitch/taskwarrior.rs similarity index 95% rename from src/contextswitch/taskwarrior.rs rename to api/src/contextswitch/taskwarrior.rs index b8d9dcc..a98ba48 100644 --- a/src/contextswitch/taskwarrior.rs +++ b/api/src/contextswitch/taskwarrior.rs @@ -2,7 +2,7 @@ use crate::configuration::TaskwarriorSettings; use anyhow::{anyhow, Context}; use chrono::{DateTime, Utc}; use configparser::ini::Ini; -use contextswitch_types::{ContextswitchData, Task, TaskId}; +use contextswitch::{ContextswitchData, Task, TaskId}; use regex::Regex; use serde::{Deserialize, Serialize}; use serde_json; @@ -168,35 +168,35 @@ impl From for TaskwarriorTaskId { pub struct TaskwarriorTask { pub uuid: TaskwarriorTaskId, pub id: TaskwarriorTaskLocalId, - #[serde(with = "contextswitch_types::tw_date_format")] + #[serde(with = "contextswitch::tw_date_format")] pub entry: DateTime, - #[serde(with = "contextswitch_types::tw_date_format")] + #[serde(with = "contextswitch::tw_date_format")] pub modified: DateTime, - pub status: contextswitch_types::Status, + pub status: contextswitch::Status, pub description: String, pub urgency: f64, #[serde( default, skip_serializing_if = "Option::is_none", - with = "contextswitch_types::opt_tw_date_format" + with = "contextswitch::opt_tw_date_format" )] pub due: Option>, #[serde( default, skip_serializing_if = "Option::is_none", - with = "contextswitch_types::opt_tw_date_format" + with = "contextswitch::opt_tw_date_format" )] pub start: Option>, #[serde( default, skip_serializing_if = "Option::is_none", - with = "contextswitch_types::opt_tw_date_format" + with = "contextswitch::opt_tw_date_format" )] pub end: Option>, #[serde( default, skip_serializing_if = "Option::is_none", - with = "contextswitch_types::opt_tw_date_format" + with = "contextswitch::opt_tw_date_format" )] pub wait: Option>, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -204,9 +204,9 @@ pub struct TaskwarriorTask { #[serde(default, skip_serializing_if = "Option::is_none")] pub project: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, + pub priority: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub recur: Option, + pub recur: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub tags: Option>, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -432,7 +432,7 @@ mod tests { mod from_taskwarrior_task_to_contextswitch_task { use super::super::*; use chrono::TimeZone; - use contextswitch_types::Bookmark; + use contextswitch::Bookmark; use http::uri::Uri; use proptest::prelude::*; @@ -443,7 +443,7 @@ mod tests { id: TaskwarriorTaskLocalId(42), entry: Utc.ymd(2022, 1, 1).and_hms(1, 0, 0), modified: Utc.ymd(2022, 1, 1).and_hms(1, 0, 1), - status: contextswitch_types::Status::Pending, + status: contextswitch::Status::Pending, description: "simple task".to_string(), urgency: 0.5, due: Some(Utc.ymd(2022, 1, 1).and_hms(1, 0, 2)), @@ -452,8 +452,8 @@ mod tests { wait: Some(Utc.ymd(2022, 1, 1).and_hms(1, 0, 5)), parent: Some(TaskwarriorTaskId(Uuid::new_v4())), project: Some("simple project".to_string()), - priority: Some(contextswitch_types::Priority::H), - recur: Some(contextswitch_types::Recurrence::Daily), + priority: Some(contextswitch::Priority::H), + recur: Some(contextswitch::Recurrence::Daily), tags: Some(vec!["tag1".to_string(), "tag2".to_string()]), contextswitch: Some(String::from( r#"{"bookmarks": [{"uri": "https://www.example.com/path"}]}"#, @@ -498,7 +498,7 @@ mod tests { id: TaskwarriorTaskLocalId(42), entry: Utc.ymd(2022, 1, 1).and_hms(1, 0, 0), modified: Utc.ymd(2022, 1, 1).and_hms(1, 0, 1), - status: contextswitch_types::Status::Pending, + status: contextswitch::Status::Pending, description: "simple task".to_string(), urgency: 0.5, due: None, @@ -528,7 +528,7 @@ mod tests { mod from_contextswitch_task_to_taskwarrior_action { use super::super::*; use chrono::TimeZone; - use contextswitch_types::{Bookmark, Priority, Recurrence}; + use contextswitch::{Bookmark, Priority, Recurrence}; use http::Uri; #[test] @@ -537,7 +537,7 @@ mod tests { id: TaskId(Uuid::new_v4()), entry: Utc.ymd(2022, 1, 1).and_hms(1, 0, 0), modified: Utc.ymd(2022, 1, 1).and_hms(1, 0, 1), - status: contextswitch_types::Status::Pending, + status: contextswitch::Status::Pending, description: "simple task".to_string(), urgency: 0.5, due: None, @@ -579,7 +579,7 @@ mod tests { id: TaskId(Uuid::new_v4()), entry: Utc.ymd(2022, 1, 1).and_hms(1, 0, 0), modified: Utc.ymd(2022, 1, 1).and_hms(1, 0, 1), - status: contextswitch_types::Status::Pending, + status: contextswitch::Status::Pending, description: "simple task".to_string(), urgency: 0.5, due: Some(Utc.ymd(2022, 1, 1).and_hms(1, 0, 2)), diff --git a/api/src/lib.rs b/api/src/lib.rs new file mode 100644 index 0000000..1677630 --- /dev/null +++ b/api/src/lib.rs @@ -0,0 +1,45 @@ +use actix_web::{dev::Server, http, middleware, web, App, HttpServer}; +use core::time::Duration; +use std::env; +use std::net::TcpListener; +use tracing_actix_web::TracingLogger; + +#[macro_use] +extern crate lazy_static; + +pub mod configuration; +pub mod contextswitch; +pub mod observability; +pub mod routes; + +pub fn run(listener: TcpListener) -> Result { + let cs_front_base_url = + env::var("CS_FRONT_BASE_URL").unwrap_or_else(|_| "http://localhost:8080".to_string()); + let server = HttpServer::new(move || { + App::new() + .wrap(TracingLogger::default()) + .wrap(middleware::Compress::default()) + .wrap( + middleware::DefaultHeaders::new() + .add(("Access-Control-Allow-Origin", cs_front_base_url.as_bytes())) + .add(( + "Access-Control-Allow-Methods", + "POST, GET, OPTIONS".as_bytes(), + )) + .add(("Access-Control-Allow-Headers", "content-type".as_bytes())), + ) + .route("/ping", web::get().to(routes::ping)) + .route("/tasks", web::get().to(routes::list_tasks)) + .route("/tasks", web::post().to(routes::add_task)) + .route("/tasks/{task_id}", web::put().to(routes::update_task)) + .route( + "/tasks", + web::method(http::Method::OPTIONS).to(routes::option_task), + ) + }) + .keep_alive(http::KeepAlive::Timeout(Duration::from_secs(60))) + .shutdown_timeout(60) + .listen(listener)?; + + Ok(server.run()) +} diff --git a/src/main.rs b/api/src/main.rs similarity index 96% rename from src/main.rs rename to api/src/main.rs index 2f9c3da..6313308 100644 --- a/src/main.rs +++ b/api/src/main.rs @@ -1,5 +1,3 @@ -extern crate listenfd; - use contextswitch_api::configuration::Settings; use contextswitch_api::observability::{get_subscriber, init_subscriber}; use contextswitch_api::{contextswitch::taskwarrior, run}; diff --git a/src/observability.rs b/api/src/observability.rs similarity index 100% rename from src/observability.rs rename to api/src/observability.rs diff --git a/src/routes/health_check.rs b/api/src/routes/health_check.rs similarity index 100% rename from src/routes/health_check.rs rename to api/src/routes/health_check.rs diff --git a/src/routes/mod.rs b/api/src/routes/mod.rs similarity index 100% rename from src/routes/mod.rs rename to api/src/routes/mod.rs diff --git a/src/routes/tasks.rs b/api/src/routes/tasks.rs similarity index 64% rename from src/routes/tasks.rs rename to api/src/routes/tasks.rs index fdf4fb7..9fb61dc 100644 --- a/src/routes/tasks.rs +++ b/api/src/routes/tasks.rs @@ -1,7 +1,7 @@ -use crate::contextswitch; +use crate::contextswitch as cs; use actix_web::{http::StatusCode, web, HttpResponse, ResponseError}; use anyhow::Context; -use contextswitch_types::{NewTask, Task, TaskId}; +use contextswitch::{NewTask, Task, TaskId}; use serde::Deserialize; #[derive(Deserialize)] @@ -9,15 +9,11 @@ pub struct TaskQuery { filter: Option, } -impl ResponseError for contextswitch::ContextswitchError { +impl ResponseError for cs::ContextswitchError { fn status_code(&self) -> StatusCode { match self { - contextswitch::ContextswitchError::InvalidDataError { .. } => { - StatusCode::INTERNAL_SERVER_ERROR - } - contextswitch::ContextswitchError::UnexpectedError(_) => { - StatusCode::INTERNAL_SERVER_ERROR - } + cs::ContextswitchError::InvalidDataError { .. } => StatusCode::INTERNAL_SERVER_ERROR, + cs::ContextswitchError::UnexpectedError(_) => StatusCode::INTERNAL_SERVER_ERROR, } } } @@ -25,12 +21,12 @@ impl ResponseError for contextswitch::ContextswitchError { #[tracing::instrument(level = "debug", skip_all, fields(filter = %task_query.filter.as_ref().unwrap_or(&"".to_string())))] pub async fn list_tasks( task_query: web::Query, -) -> Result { +) -> Result { let filter = task_query .filter .as_ref() .map_or(vec![], |filter| filter.split(' ').collect()); - let tasks: Vec = contextswitch::list_tasks(filter)?; + let tasks: Vec = cs::list_tasks(filter)?; Ok(HttpResponse::Ok() .content_type("application/json") @@ -40,8 +36,8 @@ pub async fn list_tasks( #[tracing::instrument(level = "debug", skip_all, fields(definition = %new_task.definition))] pub async fn add_task( new_task: web::Json, -) -> Result { - let task: Task = contextswitch::add_task(new_task.definition.split(' ').collect()).await?; +) -> Result { + let task: Task = cs::add_task(new_task.definition.split(' ').collect()).await?; Ok(HttpResponse::Ok() .content_type("application/json") @@ -52,12 +48,12 @@ pub async fn add_task( pub async fn update_task( path: web::Path, task: web::Json, -) -> Result { +) -> Result { let task_to_update = task.into_inner(); if path.into_inner() != task_to_update.id { return Ok(HttpResponse::BadRequest().finish()); } - let task_updated: Task = contextswitch::update_task(task_to_update).await?; + let task_updated: Task = cs::update_task(task_to_update).await?; Ok(HttpResponse::Ok() .content_type("application/json") @@ -65,6 +61,6 @@ pub async fn update_task( } #[tracing::instrument(level = "debug")] -pub fn option_task() -> HttpResponse { +pub async fn option_task() -> HttpResponse { HttpResponse::Ok().finish() } diff --git a/tests/api/health_check.rs b/api/tests/api/health_check.rs similarity index 100% rename from tests/api/health_check.rs rename to api/tests/api/health_check.rs diff --git a/tests/api/helpers.rs b/api/tests/api/helpers.rs similarity index 100% rename from tests/api/helpers.rs rename to api/tests/api/helpers.rs diff --git a/tests/api/main.rs b/api/tests/api/main.rs similarity index 100% rename from tests/api/main.rs rename to api/tests/api/main.rs diff --git a/tests/api/tasks.rs b/api/tests/api/tasks.rs similarity index 88% rename from tests/api/tasks.rs rename to api/tests/api/tasks.rs index d4143d8..5f8fbbb 100644 --- a/tests/api/tasks.rs +++ b/api/tests/api/tasks.rs @@ -1,6 +1,6 @@ use crate::helpers::app_address; -use contextswitch_api::contextswitch; -use contextswitch_types::{Bookmark, ContextswitchData, NewTask, Task}; +use contextswitch::{Bookmark, ContextswitchData, NewTask, Task}; +use contextswitch_api::contextswitch as cs; use http::uri::Uri; use rstest::*; @@ -10,7 +10,7 @@ mod list_tasks { #[rstest] #[tokio::test] async fn list_tasks(app_address: &str) { - let task = contextswitch::add_task(vec![ + let task = cs::add_task(vec![ "test", "list_tasks", "contextswitch:'{\"bookmarks\":[{\"uri\":\"https://example.com/path?filter=1\"}]}'", @@ -40,10 +40,10 @@ mod list_tasks { #[rstest] #[tokio::test] - async fn list_tasks_with_unknown_contextswitch_data(app_address: &str) { - let task = contextswitch::add_task(vec![ + async fn list_tasks_with_unknown_cs_data(app_address: &str) { + let task = cs::add_task(vec![ "test", - "list_tasks_with_unknown_contextswitch_data", + "list_tasks_with_unknown_cs_data", "contextswitch:'{\"unknown\": 1}'", ]) .await @@ -59,17 +59,14 @@ mod list_tasks { .expect("Cannot parse JSON result"); assert_eq!(tasks.len(), 1); - assert_eq!( - tasks[0].description, - "test list_tasks_with_unknown_contextswitch_data" - ); + assert_eq!(tasks[0].description, "test list_tasks_with_unknown_cs_data"); assert!(tasks[0].contextswitch.is_none()); } #[rstest] #[tokio::test] - async fn list_tasks_with_invalid_contextswitch_data(app_address: &str) { - let task = contextswitch::add_task(vec![ + async fn list_tasks_with_invalid_cs_data(app_address: &str) { + let task = cs::add_task(vec![ "test", "list_tasks_with_invalid_contextswitch_data", "contextswitch:'}'", @@ -134,7 +131,7 @@ mod update_task { #[rstest] #[tokio::test] async fn update_task(app_address: &str) { - let mut task = contextswitch::add_task(vec![ + let mut task = cs::add_task(vec![ "test", "update_task", "contextswitch:'{\"bookmarks\":[{\"uri\":\"https://example.com/path?filter=1\"}]}'", diff --git a/config/test.toml b/config/test.toml deleted file mode 100644 index 0112d1f..0000000 --- a/config/test.toml +++ /dev/null @@ -1,2 +0,0 @@ -[application] -log_directive = "debug" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index b18e044..515b875 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,52 +1,202 @@ -use actix_web::{dev::Server, http, middleware, web, App, HttpServer}; -use listenfd::ListenFd; -use std::env; -use std::net::TcpListener; -use tracing_actix_web::TracingLogger; +use chrono::{DateTime, Utc}; +use http::uri::Uri; +use serde::{Deserialize, Serialize}; +use std::fmt; +use uuid::Uuid; -#[macro_use] -extern crate lazy_static; - -pub mod configuration; -pub mod contextswitch; -pub mod observability; -pub mod routes; - -pub fn run(listener: TcpListener) -> Result { - let cs_front_base_url = - env::var("CS_FRONT_BASE_URL").unwrap_or_else(|_| "http://localhost:8080".to_string()); - let mut server = HttpServer::new(move || { - App::new() - .wrap(TracingLogger::default()) - .wrap(middleware::Compress::default()) - .wrap( - middleware::DefaultHeaders::new() - .add(("Access-Control-Allow-Origin", cs_front_base_url.as_bytes())) - .add(( - "Access-Control-Allow-Methods", - "POST, GET, OPTIONS".as_bytes(), - )) - .add(("Access-Control-Allow-Headers", "content-type".as_bytes())), - ) - .route("/ping", web::get().to(routes::ping)) - .route("/tasks", web::get().to(routes::list_tasks)) - .route("/tasks", web::post().to(routes::add_task)) - .route("/tasks/{task_id}", web::put().to(routes::update_task)) - .route( - "/tasks", - web::method(http::Method::OPTIONS).to(routes::option_task), - ) - }) - .keep_alive(60) - .shutdown_timeout(60); - - let mut listenfd = ListenFd::from_env(); - - server = if let Some(fdlistener) = listenfd.take_tcp_listener(0)? { - server.listen(fdlistener)? - } else { - server.listen(listener)? - }; - - Ok(server.run()) +#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Copy, Eq)] +#[serde(rename_all = "lowercase")] +pub enum Recurrence { + Daily, + Weekly, + Monthly, + Yearly, +} + +impl fmt::Display for Recurrence { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", format!("{:?}", self).to_lowercase()) + } +} + +#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Copy, Eq)] +#[serde(rename_all = "lowercase")] +pub enum Status { + Pending, + Completed, + Recurring, + Deleted, +} + +impl fmt::Display for Status { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", format!("{:?}", self).to_lowercase()) + } +} + +#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Copy, Eq)] +pub enum Priority { + H, + M, + L, +} + +impl fmt::Display for Priority { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}", self) + } +} + +#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Eq)] +pub struct Bookmark { + #[serde(with = "uri")] + pub uri: Uri, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, +} + +#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Eq)] +pub struct BookmarkContent { + pub title: String, + pub content_preview: Option, +} + +pub mod uri { + use http::uri::Uri; + use serde::{self, Deserialize, Deserializer, Serializer}; + + pub fn serialize(uri: &Uri, serializer: S) -> Result + where + S: Serializer, + { + let uri_str = uri.to_string(); + serializer.serialize_str(&uri_str) + } + + pub fn deserialize<'de, D>(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse::().map_err(serde::de::Error::custom) + } +} + +#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Eq)] +pub struct ContextswitchData { + pub bookmarks: Vec, +} + +#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Eq)] +pub struct TaskId(pub Uuid); + +impl fmt::Display for TaskId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.0) + } +} + +#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] +pub struct Task { + pub id: TaskId, + #[serde(with = "tw_date_format")] + pub entry: DateTime, + #[serde(with = "tw_date_format")] + pub modified: DateTime, + pub status: Status, + pub description: String, + pub urgency: f64, + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "opt_tw_date_format" + )] + pub due: Option>, + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "opt_tw_date_format" + )] + pub start: Option>, + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "opt_tw_date_format" + )] + pub end: Option>, + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "opt_tw_date_format" + )] + pub wait: Option>, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parent: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub project: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recur: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contextswitch: Option, +} + +#[derive(Deserialize, Serialize)] +pub struct NewTask { + pub definition: String, +} + +pub mod tw_date_format { + use chrono::{DateTime, TimeZone, Utc}; + use serde::{self, Deserialize, Deserializer, Serializer}; + + const FORMAT: &str = "%Y%m%dT%H%M%SZ"; + + pub fn serialize(date: &DateTime, serializer: S) -> Result + where + S: Serializer, + { + let s = format!("{}", date.format(FORMAT)); + serializer.serialize_str(&s) + } + + pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + Utc.datetime_from_str(&s, FORMAT) + .map_err(serde::de::Error::custom) + } +} + +pub mod opt_tw_date_format { + use chrono::{DateTime, TimeZone, Utc}; + use serde::{self, Deserialize, Deserializer, Serializer}; + + const FORMAT: &str = "%Y%m%dT%H%M%SZ"; + + pub fn serialize(date: &Option>, serializer: S) -> Result + where + S: Serializer, + { + if let Some(ref d) = *date { + return serializer.serialize_str(&d.format(FORMAT).to_string()); + } + + serializer.serialize_none() + } + + pub fn deserialize<'de, D>(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + Utc.datetime_from_str(&s, FORMAT) + .map(Some) + .map_err(serde::de::Error::custom) + } } diff --git a/web/Cargo.toml b/web/Cargo.toml new file mode 100644 index 0000000..9a0effb --- /dev/null +++ b/web/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "contextswitch-web" +version = "0.1.0" +edition = "2021" +authors = ["David Rousselie "] + +[[bin]] +path = "src/main.rs" +name = "contextswitch-web" + +[dependencies] +yew = "0.19" diff --git a/web/Makefile.toml b/web/Makefile.toml new file mode 100644 index 0000000..8ee118d --- /dev/null +++ b/web/Makefile.toml @@ -0,0 +1 @@ +extend = "../Makefile.toml" diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..b9d6414 --- /dev/null +++ b/web/index.html @@ -0,0 +1,7 @@ + + + + + Contextswitch + + diff --git a/web/src/main.rs b/web/src/main.rs new file mode 100644 index 0000000..22b1599 --- /dev/null +++ b/web/src/main.rs @@ -0,0 +1,12 @@ +use yew::prelude::*; + +#[function_component(App)] +fn app() -> Html { + html! { +

{ "Hello World" }

+ } +} + +fn main() { + yew::start_app::(); +}