From ca364453a75531f3a4541f0928cd0982149115a8 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Wed, 24 Jul 2024 16:38:56 +0200 Subject: [PATCH] refactor --- Cargo.lock | 497 +++++++++++++++++++++----------------- Cargo.toml | 1 + src/cache.rs | 59 ----- src/db.rs | 47 +--- src/item.rs | 53 +--- src/main.rs | 2 +- src/routes/item/mod.rs | 4 + src/routes/item/supply.rs | 6 +- src/transaction.rs | 156 ++---------- src/variant.rs | 120 ++------- 10 files changed, 341 insertions(+), 604 deletions(-) delete mode 100644 src/cache.rs diff --git a/Cargo.lock b/Cargo.lock index 040b1bf..5898160 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -56,47 +56,48 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -121,18 +122,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -152,15 +153,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -197,9 +198,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -224,9 +225,9 @@ dependencies = [ [[package]] name = "bson" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d43b38e074cc0de2957f10947e376a1d88b9c4dbab340b590800cc1b2e066b2" +checksum = "d8a88e82b9106923b5c4d6edfca9e7db958d4e98a478ec115022e81b9b38e2c8" dependencies = [ "ahash", "base64 0.13.1", @@ -257,15 +258,21 @@ checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" [[package]] name = "bytes" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" + +[[package]] +name = "case" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6c0e7b807d60291f42f33f58480c0bfafe28ed08286446f45e463728cf9c1c" [[package]] name = "cc" -version = "1.0.95" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" +checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" [[package]] name = "cdb" @@ -275,6 +282,7 @@ dependencies = [ "futures", "log", "mdq", + "mongod", "mongodb", "rocket", "rocket_cors", @@ -303,23 +311,23 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] name = "clap" -version = "4.5.4" +version = "4.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "8f6b81fb3c84f5563d509c59b5a48d935f689e993afa90fe39047f05adef9142" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "5ca6706fd5224857d9ac5eb9355f6683563cc0541c7cd9d014043b57cbec78ac" dependencies = [ "anstream", "anstyle", @@ -329,15 +337,15 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "comfy-table" @@ -389,7 +397,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "crossterm_winapi", "libc", "parking_lot", @@ -499,15 +507,15 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.17" +version = "0.99.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 1.0.109", + "syn 2.0.72", ] [[package]] @@ -536,11 +544,11 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35b50dba0afdca80b187392b24f2499a88c336d5a8493e4b4ccfb608708be56a" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -556,9 +564,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "encoding_rs" @@ -575,23 +583,33 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 1.0.109", ] [[package]] -name = "env_logger" -version = "0.10.2" +name = "env_filter" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +checksum = "c6dc8c8ff84895b051f07a0e65f975cf225131742531338752abfb324e4449ff" dependencies = [ - "humantime", - "is-terminal", "log", "regex", - "termcolor", +] + +[[package]] +name = "env_logger" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06676b12debf7bba6903559720abca942d3a66b8acb88815fd2c7c6537e9ade1" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", ] [[package]] @@ -602,9 +620,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -630,12 +648,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "finl_unicode" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" - [[package]] name = "fnv" version = "1.0.7" @@ -713,7 +725,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -771,9 +783,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -782,9 +794,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "glob" @@ -823,6 +835,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.3.9" @@ -890,9 +908,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -908,9 +926,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", @@ -1026,6 +1044,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itoa" version = "1.0.11" @@ -1043,9 +1067,9 @@ dependencies = [ [[package]] name = "jsonfilter" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e41e2b969fe3568e7c235357ffdca59388bb77b54367ca7110d5df39a506b9" +checksum = "f1e46f0c1b9ad5f49d868ccd9210aa5739361d110902169c441cacc1ec2f090b" dependencies = [ "regex", "serde", @@ -1054,15 +1078,15 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "linked-hash-map" @@ -1072,9 +1096,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -1088,9 +1112,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "loom" @@ -1149,8 +1173,8 @@ dependencies = [ [[package]] name = "mdq" -version = "0.3.0" -source = "git+https://git.hydrar.de/mdtools/mdq#b35c8aff9a11e5b6e7358c4c90d84311b5e4443e" +version = "0.3.1" +source = "git+https://git.hydrar.de/mdtools/mdq#823319dd0295db8423526993cd93006be80a7392" dependencies = [ "chrono", "clap", @@ -1168,9 +1192,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -1180,22 +1204,50 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.11" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" dependencies = [ + "hermit-abi", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "mongod" +version = "0.2.0" +source = "git+https://git.hydrar.de/jmarya/mongod#280f3cf3a0e63b8587e95adc78dfaf756d58550e" +dependencies = [ + "chrono", + "futures", + "mongod_derive", + "mongodb", + "regex", + "serde", + "serde_json", + "tokio", + "uuid", +] + +[[package]] +name = "mongod_derive" +version = "0.1.0" +source = "git+https://git.hydrar.de/jmarya/mongod#280f3cf3a0e63b8587e95adc78dfaf756d58550e" +dependencies = [ + "case", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -1282,9 +1334,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -1301,9 +1353,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" dependencies = [ "memchr", ] @@ -1322,9 +1374,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1340,7 +1392,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -1372,7 +1424,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -1407,9 +1459,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -1422,7 +1474,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", "version_check", "yansi", ] @@ -1480,11 +1532,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] @@ -1504,19 +1556,19 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -1530,13 +1582,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] [[package]] @@ -1547,9 +1599,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "resolv-conf" @@ -1626,7 +1678,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.60", + "syn 2.0.72", "unicode-xid", "version_check", ] @@ -1677,9 +1729,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc_version" @@ -1696,7 +1748,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.22", + "semver 1.0.23", ] [[package]] @@ -1715,7 +1767,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -1755,15 +1807,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -1807,9 +1859,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "semver-parser" @@ -1819,38 +1871,38 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.199" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.14" +version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.199" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "indexmap", "itoa", @@ -1860,9 +1912,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] @@ -2003,13 +2055,13 @@ dependencies = [ [[package]] name = "stringprep" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" dependencies = [ - "finl_unicode", "unicode-bidi", "unicode-normalization", + "unicode-properties", ] [[package]] @@ -2026,28 +2078,28 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.26.2" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" [[package]] name = "strum_macros" -version = "0.26.2" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "rustversion", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -2062,9 +2114,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -2095,33 +2147,24 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" -version = "1.0.59" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.59" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -2167,9 +2210,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -2182,32 +2225,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "d040ac2b29ab03b09d4129c2f5bbd012a3ac2f79d38ff506a4bf8dd34b0eac8a" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2 0.5.7", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -2233,9 +2275,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", @@ -2243,14 +2285,13 @@ dependencies = [ "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] name = "toml" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +checksum = "ac2caab0bf757388c6c0ae23b3293fdb463fee59434529014f85e3263b995c28" dependencies = [ "serde", "serde_spanned", @@ -2260,18 +2301,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.12" +version = "0.22.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" +checksum = "278f3d518e152219c994ce877758516bca5e118eaed6996192a774fb9fbf0788" dependencies = [ "indexmap", "serde", @@ -2305,7 +2346,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -2475,10 +2516,16 @@ dependencies = [ ] [[package]] -name = "unicode-width" -version = "0.1.12" +name = "unicode-properties" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291" + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" @@ -2500,9 +2547,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna 0.5.0", @@ -2511,15 +2558,15 @@ dependencies = [ [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom", "serde", @@ -2583,7 +2630,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", "wasm-bindgen-shared", ] @@ -2605,7 +2652,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2674,7 +2721,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2692,7 +2739,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2712,18 +2759,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2734,9 +2781,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -2746,9 +2793,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -2758,15 +2805,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -2776,9 +2823,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -2788,9 +2835,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -2800,9 +2847,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -2812,15 +2859,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.7" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578" +checksum = "557404e450152cd6795bb558bca69e43c585055f4606e3bcae5894fc6dac9ba0" dependencies = [ "memchr", ] @@ -2855,20 +2902,20 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] diff --git a/Cargo.toml b/Cargo.toml index ed7e4c4..1d01c73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,3 +17,4 @@ serde_yaml = "0.9.34" tokio = { version = "1.35.1", features = ["full"] } toml = "0.8.8" uuid = { version = "1.8.0", features = ["v4"] } +mongod = { git = "https://git.hydrar.de/jmarya/mongod" } diff --git a/src/cache.rs b/src/cache.rs deleted file mode 100644 index 7a3a6a4..0000000 --- a/src/cache.rs +++ /dev/null @@ -1,59 +0,0 @@ -use mongodb::bson::doc; - -use crate::{get_mongo, id_of}; - -pub struct InventoryCache {} - -impl InventoryCache { - pub async fn push(uuid: &str) { - let db = get_mongo!(); - - // todo : if not exists? - let update = doc! { "$push": { "transactions": uuid } }; - - let options = mongodb::options::FindOneAndUpdateOptions::builder() - .upsert(true) - .return_document(mongodb::options::ReturnDocument::After) - .build(); - - db.database("cdb") - .collection::("cache") - .find_one_and_update(id_of!("inventory"), update, options) - .await - .unwrap(); - } - - pub async fn get() -> Vec { - let db = get_mongo!(); - let inventorycache = db - .database("cdb") - .collection::("cache") - .find_one(id_of!("inventory"), None) - .await - .unwrap() - .unwrap(); - inventorycache - .get_array("transactions") - .unwrap() - .iter() - .map(|x| x.as_str().unwrap().to_string()) - .collect() - } - - pub async fn remove(uuid: &str) { - let db = get_mongo!(); - - let update = doc! { "$pull": { "transactions": uuid}}; - - let options = mongodb::options::FindOneAndUpdateOptions::builder() - .upsert(true) - .return_document(mongodb::options::ReturnDocument::After) - .build(); - - db.database("cdb") - .collection::("cache") - .find_one_and_update(id_of!("inventory"), update, options) - .await - .unwrap(); - } -} diff --git a/src/db.rs b/src/db.rs index 5c08c99..92afd0e 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1,47 +1,5 @@ use crate::item::Item; -/// Collect database results into a `Vec<_>` -#[macro_export] -macro_rules! collect_results { - ($res:expr) => {{ - use futures::stream::TryStreamExt; - let mut ret = vec![]; - - while let Some(doc) = $res.try_next().await.unwrap() { - ret.push(doc); - } - - ret - }}; -} - -/// Get a database collection -#[macro_export] -macro_rules! cdb_col { - ($db:expr, $col:expr) => { - $db.database("cdb") - .collection::($col) - }; -} - -/// Get a MongoDB Client from the environment -#[macro_export] -macro_rules! get_mongo { - () => { - mongodb::Client::with_uri_str(std::env::var("DB_URI").unwrap()) - .await - .unwrap() - }; -} - -/// MongoDB filter for the `_id` field. -#[macro_export] -macro_rules! id_of { - ($id:expr) => { - doc! { "_id": $id} - }; -} - /// Item database pub struct ItemDB { index: mdq::Index, @@ -54,11 +12,12 @@ impl ItemDB { pub async fn new(dir: &str) -> Self { // scan for markdown item entries let index = mdq::Index::new(dir, true); - let mongodb = get_mongo!(); for item in &index.documents { let item = Item::new(item); - item.init_db(&mongodb).await; + log::info!("Adding item {} to DB", item.name); + + } Self { index } diff --git a/src/item.rs b/src/item.rs index bdd81bc..32fc8f7 100644 --- a/src/item.rs +++ b/src/item.rs @@ -1,7 +1,8 @@ use std::collections::HashMap; -use crate::id_of; -use mongodb::{bson::doc, Collection}; +use mongod::{derive::{Model, Referencable}, Validate}; +use mongodb::bson::doc; +use serde::{Deserialize, Serialize}; use serde_json::json; use crate::variant::Variant; @@ -16,22 +17,15 @@ use crate::variant::Variant; // DEMAND STATS // SEASONAL REVIEWS -fn hashmap_to_bson_document( - hashmap: HashMap, -) -> mongodb::bson::Document { - let mut document = mongodb::bson::Document::new(); - for (key, value) in hashmap { - document.insert(key, value); - } - document -} - /// Represents a single item in a collection of physical goods. /// /// This struct serves as a blueprint for describing individual items within /// a larger inventory or database of physical goods. It includes fields for /// the name of the item and its category. +#[derive(Debug, Clone, Serialize, Deserialize, Model, Referencable)] pub struct Item { + /// The ID is the same as the name + pub _id: String, /// The name of the Item pub name: String, /// Category of the Item @@ -41,6 +35,12 @@ pub struct Item { pub variants: HashMap, } +impl Validate for Item { + async fn validate(&self) -> Result<(), String> { + Ok(()) + } +} + impl Item { /// Creates a new `Item` from a parsed markdown document pub fn new(doc: &mdq::Document) -> Self { @@ -77,39 +77,12 @@ impl Item { } Self { + _id: name.clone(), name, category, variants, } } - - /// Adds the `Item` to the database - pub async fn init_db(&self, mongodb: &mongodb::Client) { - log::info!("Adding item {} to DB", self.name); - let items: Collection = - mongodb.database("cdb").collection("items"); - - let doc = mongodb::bson::doc! { - "_id": self.name.clone(), - "name": self.name.clone(), - "category": self.category.clone(), - "variants": hashmap_to_bson_document(self.variants.iter().map(|x| (x.0.clone(), x.1.as_bson())).collect()) - }; - - if items - .find_one(id_of!(&self.name), None) - .await - .unwrap() - .is_none() - { - items.insert_one(doc, None).await.unwrap(); - } else { - items - .find_one_and_update(id_of!(&self.name), doc! { "$set": doc }, None) - .await - .unwrap(); - } - } } impl Item { diff --git a/src/main.rs b/src/main.rs index 9ec9a4e..f32c5bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use rocket::routes as route; use rocket::{http::Method, launch}; -mod cache; + mod db; mod item; mod routes; diff --git a/src/routes/item/mod.rs b/src/routes/item/mod.rs index 310dcb2..e51678c 100644 --- a/src/routes/item/mod.rs +++ b/src/routes/item/mod.rs @@ -4,6 +4,7 @@ mod supply; pub use demand::*; pub use error::*; +use mongod::Model; pub use supply::*; use rocket::get; @@ -23,6 +24,7 @@ pub fn get_items_route(itemdb: &State) -> serde_json::Value { json!({"items": items}) } +/// Return an API Response for an `Item` #[get("/item/")] pub fn item_route(item_id: &str, itemdb: &State) -> FallibleApiResponse { let item = itemdb @@ -31,6 +33,7 @@ pub fn item_route(item_id: &str, itemdb: &State) -> FallibleApiResponse Ok(item.api_json()) } +/// Returns all variants of an Item #[get("/item//variants")] pub fn item_variants_page(item_id: &str, itemdb: &State) -> FallibleApiResponse { let item = itemdb @@ -44,6 +47,7 @@ pub fn item_variants_page(item_id: &str, itemdb: &State) -> FallibleApiR })) } +/// Returns an API Response for a `Transaction` #[get("/transaction/")] pub async fn transaction_route(transaction: &str) -> FallibleApiResponse { let t = Transaction::get(transaction) diff --git a/src/routes/item/supply.rs b/src/routes/item/supply.rs index 0a4682f..a7e06aa 100644 --- a/src/routes/item/supply.rs +++ b/src/routes/item/supply.rs @@ -14,9 +14,8 @@ use super::{item_does_not_exist_error, variant_does_not_exist_error}; pub struct SupplyForm { item: String, variant: String, - amount: Option, price: String, - origin: String, + origin: Option, } #[post("/supply", data = "
")] @@ -30,12 +29,11 @@ pub async fn supply_route(form: Json, itemdb: &State) -> Fal let transaction_id = variant .supply( - form.amount.unwrap_or(1), form.price .clone() .try_into() .map_err(|()| api_error("Price malformed"))?, - &form.origin, + form.origin.as_deref(), ) .await; diff --git a/src/transaction.rs b/src/transaction.rs index 452a85c..08bddba 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -1,56 +1,47 @@ +use mongod::{derive::{Model, Referencable}, Validate}; use mongodb::bson::doc; -use serde::Serialize; +use serde::{Deserialize, Serialize}; use serde_json::json; -use crate::{cdb_col, get_mongo, id_of}; - -pub enum TransactionType { - Batch(BatchTransaction), - Normal(Transaction), -} - -impl From for TransactionType { - fn from(value: mongodb::bson::Document) -> Self { - if let Ok(kind) = value.get_str("kind") { - if kind == "batch" { - return Self::Batch(value.into()); - } - } - Self::Normal(value.into()) - } -} - +#[derive(Debug, Clone, Serialize, Deserialize, Model, Referencable)] pub struct Transaction { - pub uuid: String, + pub _id: String, pub item: String, pub variant: String, pub price: Price, - pub origin: String, + pub origin: Option, + pub consumed: Option, pub timestamp: i64, } +impl Validate for Transaction { + async fn validate(&self) -> Result<(), String> { + Ok(()) + } +} + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct Consumed { + pub destination: String, + pub price: Price, +} + impl Transaction { - pub fn new(item: &str, variant: &str, price: Price, origin: &str) -> Self { + pub fn new(item: &str, variant: &str, price: Price, origin: Option<&str>) -> Self { Self { - uuid: uuid::Uuid::new_v4().to_string(), + _id: uuid::Uuid::new_v4().to_string(), item: item.to_string(), variant: variant.to_string(), price, - origin: origin.to_string(), + consumed: None, + origin: origin.map(|x| x.to_string()), timestamp: chrono::Utc::now().timestamp(), } } - pub async fn get(uuid: &str) -> Option { - let db = get_mongo!(); - let transactions = cdb_col!(db, "transactions"); - let doc = transactions.find_one(id_of!(uuid), None).await.ok()??; - Some(doc.into()) - } - pub fn api_json(&self) -> serde_json::Value { json!({ - "uuid": self.uuid, + "uuid": self._id, "item": self.item, "variant": self.variant, "price": self.price, @@ -58,90 +49,9 @@ impl Transaction { "timestamp": self.timestamp }) } - - pub fn as_doc(&self) -> mongodb::bson::Document { - mongodb::bson::doc! { - "_id": &self.uuid, - "item": &self.item, - "variant": &self.variant, - "price": Into::::into(self.price.clone()), - "origin": &self.origin, - "timestamp": self.timestamp - } - } } -impl From for Transaction { - fn from(b: mongodb::bson::Document) -> Self { - let uuid = b.get_str("_id").unwrap().to_string(); - let item = b.get_str("item").unwrap().to_string(); - let variant = b.get_str("variant").unwrap().to_string(); - let origin = b.get_str("origin").unwrap().to_string(); - let timestamp = b.get_i64("timestamp").unwrap(); - let price = b.get_document("price").unwrap().clone().into(); - Self { - uuid, - item, - variant, - price, - origin, - timestamp, - } - } -} - -impl From for mongodb::bson::Document { - fn from(value: Transaction) -> Self { - mongodb::bson::doc! { - "_id": &value.uuid, - "item": &value.item, - "variant": &value.variant, - "price": Into::::into(value.price), - "origin": &value.origin, - "timestamp": value.timestamp - } - } -} - -pub struct BatchTransaction { - pub uuid: String, - pub transactions: Vec, -} - -impl BatchTransaction { - pub fn new(transactions: Vec) -> Self { - Self { - uuid: uuid::Uuid::new_v4().to_string(), - transactions, - } - } -} - -impl From for BatchTransaction { - fn from(value: mongodb::bson::Document) -> Self { - let uuid = value.get_str("_id").unwrap().to_string(); - let transactions = value - .get_array("transactions") - .unwrap() - .iter() - .map(|x| x.as_str().unwrap().to_string()) - .collect(); - - Self { uuid, transactions } - } -} - -impl From for mongodb::bson::Document { - fn from(value: BatchTransaction) -> Self { - mongodb::bson::doc! { - "_id": value.uuid, - "kind": "batch", - "transactions": value.transactions - } - } -} - -#[derive(Debug, Clone, Serialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct Price { pub value: f64, pub currency: String, @@ -165,24 +75,6 @@ impl Price { } } -impl From for mongodb::bson::Bson { - fn from(value: Price) -> Self { - mongodb::bson::bson!({ - "value": value.value, - "currency": value.currency - }) - } -} - -impl From for Price { - fn from(value: mongodb::bson::Document) -> Self { - Self { - value: value.get_f64("value").unwrap_or(0.0), - currency: value.get_str("currency").unwrap().to_string(), - } - } -} - impl TryFrom for Price { type Error = (); diff --git a/src/variant.rs b/src/variant.rs index 2aae1e1..a73e0cb 100644 --- a/src/variant.rs +++ b/src/variant.rs @@ -1,11 +1,9 @@ +use mongod::Model; use mongodb::bson::doc; +use serde::{Deserialize, Serialize}; use serde_json::json; -use crate::{ - cache::InventoryCache, - cdb_col, collect_results, get_mongo, id_of, - transaction::{BatchTransaction, Price, Transaction}, -}; +use crate::transaction::{Consumed, Price, Transaction}; /// Represents a specific instance of an item with potential variations. /// @@ -13,7 +11,7 @@ use crate::{ /// in the real world. It may include attributes or properties that deviate from /// the standard definition of the item. For example, different colors, sizes, or /// configurations. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Variant { /// Associated Item pub item: String, @@ -52,133 +50,66 @@ impl Variant { } pub async fn supply_log(&self) -> Vec { - let db = get_mongo!(); - - let supply = cdb_col!(db, "supply"); - let filter = doc! { "item": &self.item, "variant": &self.variant }; - let mut db_res = supply.find(filter, None).await.unwrap(); - - let result: Vec = collect_results!(db_res); + let result = Transaction::find_partial(filter, json!({}), None).await.unwrap(); let mut ret = Vec::new(); for doc in result { - ret.push(doc.get("_id").unwrap().as_str().unwrap().to_string()); + ret.push(doc._id); } ret } pub async fn demand_log(&self) -> Vec { - // todo : add referenced supply - - let db = get_mongo!(); - - let demand = cdb_col!(db, "demand"); - let filter = doc! { "item": &self.item, - "variant": &self.variant + "variant": &self.variant, + "consumed": { "$exists": true } }; - let mut db_res = demand.find(filter, None).await.unwrap(); - - let result: Vec = collect_results!(db_res); + let result = Transaction::find_partial(filter, json!({}), None).await.unwrap(); let mut ret = Vec::new(); for doc in result { - ret.push(doc.get("_id").unwrap().as_str().unwrap().to_string()); + ret.push(doc._id); } ret } - pub async fn demand(uuid: &str, price: Price, destination: &str) -> Option { - let db = get_mongo!(); + pub async fn demand(uuid: &str, price: Price, destination: &str) -> Option<()> { + // check if transaction exists + let mut t = Transaction::get(uuid).await?; + t.update(&json!({ + "consumed": Consumed{ destination: destination.to_string(), price } + })).await.ok()?; - // check if supply transaction exists - let supply_t = cdb_col!(db, "supply"); - supply_t.find_one(id_of!(uuid), None).await.unwrap()?; - - // todo : demand batch - - // mark as used - let demand_t = cdb_col!(db, "demand"); - demand_t - .insert_one( - doc! { - "_id": uuid, - "destination": destination, - "price": Into::::into(price) - }, - None, - ) - .await - .unwrap(); - - // update cache - InventoryCache::remove(uuid).await; - - Some(uuid.to_string()) + Some(()) } /// Records a supply transaction in the database. /// /// # Arguments /// - /// * `amount` - The quantity of items supplied. /// * `price` - The price of the supplied items. /// * `origin` - The origin or source of the supplied items. /// /// # Returns /// /// Returns a UUID string representing the transaction. - pub async fn supply(&self, amount: usize, price: Price, origin: &str) -> String { - let db = get_mongo!(); + pub async fn supply(&self, price: Price, origin: Option<&str>) -> String { + let t = Transaction::new(&self.item, &self.variant, price, origin); - let col: mongodb::Collection = - db.database("cdb").collection("supply"); + t.insert().await.unwrap(); - let mut transactions = vec![]; - for _ in 0..amount { - transactions.push(Transaction::new( - &self.item, - &self.variant, - price.clone(), - origin, - )); - } - - for transaction in &transactions { - col.insert_one(transaction.as_doc(), None).await.unwrap(); - - // update cache - InventoryCache::push(&transaction.uuid).await; - } - - // batch transaction - let ret_uuid = if amount == 1 { - transactions.first().unwrap().uuid.clone() - } else { - let batch = - BatchTransaction::new(transactions.iter().map(|x| x.uuid.clone()).collect()); - let col: mongodb::Collection = - db.database("cdb").collection("transactions_batch"); - let batch_uuid = batch.uuid.clone(); - - col.insert_one(Into::::into(batch), None) - .await - .unwrap(); - batch_uuid - }; - - ret_uuid + t._id } pub fn api_json(&self) -> serde_json::Value { @@ -189,13 +120,4 @@ impl Variant { "depends": self.depends }) } - - pub fn as_bson(&self) -> mongodb::bson::Document { - mongodb::bson::doc! { - "item": &self.item, - "variant": &self.variant, - "amount": self.amount as u32, - "depends": &self.depends - } - } }