diff --git a/Cargo.lock b/Cargo.lock index 58485cd..8be5b9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,7 +39,7 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", "zerocopy", @@ -71,9 +71,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "ascii_utils" @@ -81,6 +81,60 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a" +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" +dependencies = [ + "concurrent-queue", + "event-listener 5.2.0", + "event-listener-strategy 0.5.0", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" +dependencies = [ + "async-lock 3.3.0", + "async-task", + "concurrent-queue", + "fastrand 2.0.1", + "futures-lite 2.2.0", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" +dependencies = [ + "async-channel 2.2.0", + "async-executor", + "async-io 2.3.2", + "async-lock 3.3.0", + "blocking", + "futures-lite 2.2.0", + "once_cell", + "tokio", +] + [[package]] name = "async-graphql" version = "7.0.2" @@ -93,7 +147,7 @@ dependencies = [ "async-stream", "async-trait", "base64", - "bytes 1.5.0", + "bytes", "fast_chemail", "fnv", "futures-util", @@ -137,25 +191,29 @@ version = "3.2.14" dependencies = [ "anyhow", "async-graphql", + "async-std", "async-trait", - "cfg-if 1.0.0", + "cfg-if", "chrono", "derive_builder", - "futures 0.3.30", + "futures", "futures-locks", "libflate", - "prost", - "prost-types", + "prost-build", + "protobuf", + "protobuf-codegen", + "protox", "reqwest", "serde", + "serde-json-wasm", "serde_json", "sha2", - "tokio 1.36.0", - "tonic", + "tokio", "tonic-build", "tracing", - "tracing-futures", + "uname", "uuid", + "wasm-bindgen-futures", ] [[package]] @@ -176,12 +234,97 @@ version = "7.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53ff1287a1283ea772b4099dd556ba4577d35f069ea4a93f337a525beefcfacf" dependencies = [ - "bytes 1.5.0", + "bytes", "indexmap 2.2.5", "serde", "serde_json", ] +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock 2.8.0", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite 1.13.0", + "log", + "parking", + "polling 2.8.0", + "rustix 0.37.27", + "slab", + "socket2 0.4.10", + "waker-fn", +] + +[[package]] +name = "async-io" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" +dependencies = [ + "async-lock 3.3.0", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite 2.2.0", + "parking", + "polling 3.5.0", + "rustix 0.38.31", + "slab", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener 2.5.3", +] + +[[package]] +name = "async-lock" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" +dependencies = [ + "event-listener 4.0.3", + "event-listener-strategy 0.4.0", + "pin-project-lite", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-channel 1.9.0", + "async-global-executor", + "async-io 1.13.0", + "async-lock 2.8.0", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite 1.13.0", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + [[package]] name = "async-stream" version = "0.3.5" @@ -204,6 +347,12 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "async-task" +version = "4.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" + [[package]] name = "async-trait" version = "0.1.77" @@ -216,55 +365,16 @@ dependencies = [ ] [[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "axum" -version = "0.6.20" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" -dependencies = [ - "async-trait", - "axum-core", - "bitflags 1.3.2", - "bytes 1.5.0", - "futures-util", - "http 0.2.12", - "http-body", - "hyper", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "sync_wrapper", - "tower", - "tower-layer", - "tower-service", -] +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] -name = "axum-core" -version = "0.3.4" +name = "autocfg" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" -dependencies = [ - "async-trait", - "bytes 1.5.0", - "futures-util", - "http 0.2.12", - "http-body", - "mime", - "rustversion", - "tower-layer", - "tower-service", -] +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" @@ -274,7 +384,7 @@ checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object", @@ -287,6 +397,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" + [[package]] name = "bitflags" version = "1.3.2" @@ -309,26 +425,26 @@ dependencies = [ ] [[package]] -name = "bumpalo" -version = "3.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" - -[[package]] -name = "byteorder" -version = "1.5.0" +name = "blocking" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" +dependencies = [ + "async-channel 2.2.0", + "async-lock 3.3.0", + "async-task", + "fastrand 2.0.1", + "futures-io", + "futures-lite 2.2.0", + "piper", + "tracing", +] [[package]] -name = "bytes" -version = "0.4.12" +name = "bumpalo" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "bytes" @@ -341,15 +457,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723" - -[[package]] -name = "cfg-if" -version = "0.1.10" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" [[package]] name = "cfg-if" @@ -372,12 +482,12 @@ dependencies = [ ] [[package]] -name = "cloudabi" -version = "0.0.3" +name = "concurrent-queue" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" dependencies = [ - "bitflags 1.3.2", + "crossbeam-utils", ] [[package]] @@ -420,56 +530,14 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils", - "maybe-uninit", + "cfg-if", ] [[package]] name = "crossbeam-utils" -version = "0.7.2" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-common" @@ -610,7 +678,7 @@ version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -629,6 +697,54 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "event-listener" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" +dependencies = [ + "event-listener 4.0.3", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" +dependencies = [ + "event-listener 5.2.0", + "pin-project-lite", +] + [[package]] name = "fast_chemail" version = "0.9.6" @@ -638,6 +754,15 @@ dependencies = [ "ascii_utils", ] +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.0.1" @@ -665,28 +790,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags 1.3.2", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - [[package]] name = "futures" version = "0.3.30" @@ -735,6 +838,34 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-lite" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" +dependencies = [ + "fastrand 2.0.1", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "futures-locks" version = "0.7.1" @@ -743,7 +874,7 @@ checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" dependencies = [ "futures-channel", "futures-task", - "tokio 1.36.0", + "tokio", ] [[package]] @@ -803,9 +934,11 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -814,13 +947,25 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "h2" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ - "bytes 1.5.0", + "bytes", "fnv", "futures-core", "futures-sink", @@ -828,7 +973,7 @@ dependencies = [ "http 0.2.12", "indexmap 2.2.5", "slab", - "tokio 1.36.0", + "tokio", "tokio-util", "tracing", ] @@ -895,7 +1040,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ - "bytes 1.5.0", + "bytes", "fnv", "itoa", ] @@ -906,7 +1051,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ - "bytes 1.5.0", + "bytes", "fnv", "itoa", ] @@ -917,7 +1062,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "bytes 1.5.0", + "bytes", "http 0.2.12", "pin-project-lite", ] @@ -940,7 +1085,7 @@ version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ - "bytes 1.5.0", + "bytes", "futures-channel", "futures-core", "futures-util", @@ -951,8 +1096,8 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", - "tokio 1.36.0", + "socket2 0.5.6", + "tokio", "tower-service", "tracing", "want", @@ -968,22 +1113,10 @@ dependencies = [ "http 0.2.12", "hyper", "rustls", - "tokio 1.36.0", + "tokio", "tokio-rustls", ] -[[package]] -name = "hyper-timeout" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" -dependencies = [ - "hyper", - "pin-project-lite", - "tokio 1.36.0", - "tokio-io-timeout", -] - [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1045,12 +1178,23 @@ dependencies = [ ] [[package]] -name = "iovec" -version = "0.1.4" +name = "instant" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi", "libc", + "windows-sys 0.48.0", ] [[package]] @@ -1084,13 +1228,12 @@ dependencies = [ ] [[package]] -name = "kernel32-sys" -version = "0.2.2" +name = "kv-log-macro" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "log", ] [[package]] @@ -1131,18 +1274,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] -name = "lock_api" -version = "0.3.4" +name = "linux-raw-sys" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -1159,18 +1299,41 @@ name = "log" version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +dependencies = [ + "value-bag", +] [[package]] -name = "matchit" -version = "0.7.3" +name = "logos" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" +dependencies = [ + "logos-derive", +] [[package]] -name = "maybe-uninit" -version = "2.0.0" +name = "logos-codegen" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68" +dependencies = [ + "beef", + "fnv", + "proc-macro2", + "quote", + "regex-syntax 0.6.29", + "syn 2.0.52", +] + +[[package]] +name = "logos-derive" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +checksum = "dbfc0d229f1f42d790440136d941afd806bc9e949e2bcb8faa813b0f00d1267e" +dependencies = [ + "logos-codegen", +] [[package]] name = "memchr" @@ -1179,12 +1342,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] -name = "memoffset" -version = "0.5.6" +name = "miette" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" dependencies = [ - "autocfg", + "cfg-if", + "miette-derive", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", ] [[package]] @@ -1202,25 +1379,6 @@ dependencies = [ "adler", ] -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - [[package]] name = "mio" version = "0.8.11" @@ -1232,36 +1390,13 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio 0.6.23", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - [[package]] name = "multer" version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a15d522be0a9c3e46fd2632e272d178f56387bdb5c9fbb3a36c649062e9b5219" dependencies = [ - "bytes 1.5.0", + "bytes", "encoding_rs", "futures-util", "http 1.1.0", @@ -1279,17 +1414,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" -[[package]] -name = "net2" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "num-traits" version = "0.2.18" @@ -1325,15 +1449,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "parking_lot" -version = "0.9.0" +name = "parking" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.6.3", - "rustc_version", -] +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" @@ -1341,23 +1460,8 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api 0.4.11", - "parking_lot_core 0.9.9", -] - -[[package]] -name = "parking_lot_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "rustc_version", - "smallvec 0.6.14", - "winapi 0.3.9", + "lock_api", + "parking_lot_core", ] [[package]] @@ -1366,10 +1470,10 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", - "redox_syscall 0.4.1", - "smallvec 1.13.1", + "redox_syscall", + "smallvec", "windows-targets 0.48.5", ] @@ -1434,26 +1538,6 @@ dependencies = [ "indexmap 2.2.5", ] -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] - [[package]] name = "pin-project-lite" version = "0.2.13" @@ -1467,10 +1551,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "piper" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.1", + "futures-io", +] + +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "polling" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" +dependencies = [ + "cfg-if", + "concurrent-queue", + "pin-project-lite", + "rustix 0.38.31", + "tracing", + "windows-sys 0.52.0", +] [[package]] name = "prettyplease" @@ -1494,9 +1613,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -1507,7 +1626,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ - "bytes 1.5.0", + "bytes", "prost-derive", ] @@ -1517,7 +1636,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" dependencies = [ - "bytes 1.5.0", + "bytes", "heck", "itertools", "log", @@ -1547,58 +1666,113 @@ dependencies = [ ] [[package]] -name = "prost-types" -version = "0.12.3" +name = "prost-reflect" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9372e3227f3685376a0836e5c248611eafc95a0be900d44bc6cdf225b700f" +dependencies = [ + "logos", + "miette", + "once_cell", + "prost", + "prost-types", +] + +[[package]] +name = "prost-types" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +dependencies = [ + "prost", +] + +[[package]] +name = "protobuf" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58678a64de2fced2bdec6bca052a6716a0efe692d6e3f53d1bda6a1def64cfc0" +dependencies = [ + "once_cell", + "protobuf-support", + "thiserror", +] + +[[package]] +name = "protobuf-codegen" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "32777b0b3f6538d9d2e012b3fad85c7e4b9244b5958d04a6415f4333782b7a77" dependencies = [ - "prost", + "anyhow", + "once_cell", + "protobuf", + "protobuf-parse", + "regex", + "tempfile", + "thiserror", ] [[package]] -name = "quote" -version = "1.0.35" +name = "protobuf-parse" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "96cb37955261126624a25b5e6bda40ae34cf3989d52a783087ca6091b29b5642" dependencies = [ - "proc-macro2", + "anyhow", + "indexmap 1.9.3", + "log", + "protobuf", + "protobuf-support", + "tempfile", + "thiserror", + "which", ] [[package]] -name = "rand" -version = "0.8.5" +name = "protobuf-support" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "e1ed294a835b0f30810e13616b1cd34943c6d1e84a8f3b0dcfe466d256c3e7e7" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "thiserror", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "protox" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "a29b3c5596eb23a849deba860b53ffd468199d9ad5fe4402a7d55379e16aa2d2" dependencies = [ - "ppv-lite86", - "rand_core", + "bytes", + "miette", + "prost", + "prost-reflect", + "prost-types", + "protox-parse", + "thiserror", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "protox-parse" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "033b939d76d358f7c32120c86c71f515bae45e64f2bde455200356557276276c" dependencies = [ - "getrandom", + "logos", + "miette", + "prost-types", + "thiserror", ] [[package]] -name = "redox_syscall" -version = "0.1.57" +name = "quote" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] [[package]] name = "redox_syscall" @@ -1618,7 +1792,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax", + "regex-syntax 0.8.2", ] [[package]] @@ -1629,9 +1803,15 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.2", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.8.2" @@ -1640,12 +1820,12 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.25" +version = "0.11.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eea5a9eb898d3783f17c6407670e3592fd174cb81a10e51d4c37f49450b9946" +checksum = "78bf93c4af7a8bb7d879d51cebe797356ff10ae8516ace542b5182d9dcac10b2" dependencies = [ "base64", - "bytes 1.5.0", + "bytes", "encoding_rs", "futures-core", "futures-util", @@ -1668,7 +1848,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper", "system-configuration", - "tokio 1.36.0", + "tokio", "tokio-rustls", "tower-service", "url", @@ -1686,7 +1866,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", - "cfg-if 1.0.0", + "cfg-if", "getrandom", "libc", "spin", @@ -1707,12 +1887,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] -name = "rustc_version" -version = "0.2.3" +name = "rustix" +version = "0.37.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" dependencies = [ - "semver", + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", ] [[package]] @@ -1724,7 +1909,7 @@ dependencies = [ "bitflags 2.4.2", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.13", "windows-sys 0.52.0", ] @@ -1788,27 +1973,21 @@ dependencies = [ ] [[package]] -name = "semver" -version = "0.9.0" +name = "serde" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ - "semver-parser", + "serde_derive", ] [[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.197" +name = "serde-json-wasm" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5" dependencies = [ - "serde_derive", + "serde", ] [[package]] @@ -1851,7 +2030,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -1876,18 +2055,19 @@ dependencies = [ [[package]] name = "smallvec" -version = "0.6.14" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] -name = "smallvec" -version = "1.13.1" +name = "socket2" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] [[package]] name = "socket2" @@ -1969,20 +2149,20 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "system-configuration" -version = "0.6.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags 2.4.2", + "bitflags 1.3.2", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.6.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ "core-foundation-sys", "libc", @@ -1994,26 +2174,26 @@ version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ - "cfg-if 1.0.0", - "fastrand", - "rustix", + "cfg-if", + "fastrand 2.0.1", + "rustix 0.38.31", "windows-sys 0.52.0", ] [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", @@ -2035,30 +2215,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" -[[package]] -name = "tokio" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "mio 0.6.23", - "num_cpus", - "tokio-codec", - "tokio-current-thread", - "tokio-executor", - "tokio-fs", - "tokio-io", - "tokio-reactor", - "tokio-sync", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", - "tokio-udp", - "tokio-uds", -] - [[package]] name = "tokio" version = "1.36.0" @@ -2066,81 +2222,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", - "bytes 1.5.0", + "bytes", "libc", - "mio 0.8.11", + "mio", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.5.6", "tokio-macros", "windows-sys 0.48.0", ] -[[package]] -name = "tokio-codec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "tokio-io", -] - -[[package]] -name = "tokio-current-thread" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" -dependencies = [ - "futures 0.1.31", - "tokio-executor", -] - -[[package]] -name = "tokio-executor" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils", - "futures 0.1.31", -] - -[[package]] -name = "tokio-fs" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" -dependencies = [ - "futures 0.1.31", - "tokio-io", - "tokio-threadpool", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "log", -] - -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio 1.36.0", -] - [[package]] name = "tokio-macros" version = "2.2.0" @@ -2152,25 +2245,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils", - "futures 0.1.31", - "lazy_static", - "log", - "mio 0.6.23", - "num_cpus", - "parking_lot 0.9.0", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", -] - [[package]] name = "tokio-rustls" version = "0.24.1" @@ -2178,104 +2252,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", - "tokio 1.36.0", -] - -[[package]] -name = "tokio-stream" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio 1.36.0", -] - -[[package]] -name = "tokio-sync" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" -dependencies = [ - "fnv", - "futures 0.1.31", -] - -[[package]] -name = "tokio-tcp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "mio 0.6.23", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" -dependencies = [ - "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils", - "futures 0.1.31", - "lazy_static", - "log", - "num_cpus", - "slab", - "tokio-executor", -] - -[[package]] -name = "tokio-timer" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" -dependencies = [ - "crossbeam-utils", - "futures 0.1.31", - "slab", - "tokio-executor", -] - -[[package]] -name = "tokio-udp" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "log", - "mio 0.6.23", - "tokio-codec", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-uds" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "libc", - "log", - "mio 0.6.23", - "mio-uds", - "tokio-codec", - "tokio-io", - "tokio-reactor", + "tokio", ] [[package]] @@ -2284,11 +2261,11 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "bytes 1.5.0", + "bytes", "futures-core", "futures-sink", "pin-project-lite", - "tokio 1.36.0", + "tokio", "tracing", ] @@ -2309,33 +2286,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tonic" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" -dependencies = [ - "async-stream", - "async-trait", - "axum", - "base64", - "bytes 1.5.0", - "h2", - "http 0.2.12", - "http-body", - "hyper", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost", - "tokio 1.36.0", - "tokio-stream", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tonic-build" version = "0.10.2" @@ -2349,32 +2299,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap 1.9.3", - "pin-project", - "pin-project-lite", - "rand", - "slab", - "tokio 1.36.0", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - [[package]] name = "tower-service" version = "0.3.2" @@ -2412,19 +2336,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "futures 0.3.30", - "futures-task", - "pin-project", - "tokio 0.1.22", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -2443,6 +2354,15 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +[[package]] +name = "uname" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72f89f0ca32e4db1c04e2a72f5345d59796d4866a1ee0609084569f73683dc8" +dependencies = [ + "libc", +] + [[package]] name = "unicode-bidi" version = "0.3.15" @@ -2464,6 +2384,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + [[package]] name = "untrusted" version = "0.9.0" @@ -2488,14 +2414,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom", + "wasm-bindgen", ] +[[package]] +name = "value-bag" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec26a25bd6fca441cdd0f769fd7f891bae119f996de31f86a5eddccef54c1d" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" + [[package]] name = "want" version = "0.3.1" @@ -2517,7 +2456,7 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -2542,7 +2481,7 @@ version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -2602,15 +2541,9 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.31", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -2621,12 +2554,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -2795,20 +2722,10 @@ version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "windows-sys 0.48.0", ] -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "zerocopy" version = "0.7.32" diff --git a/Cargo.toml b/Cargo.toml index 95b5c3a..4fa22e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,11 +10,11 @@ license = "MIT" keywords = ["async_graphql", "async", "graphql", "apollo", "studio"] categories = ["network-programming", "asynchronous"] edition = "2021" +resolver = "2" [features] -default = ["tokio-comp", "compression"] +default = ["compression"] compression = ["libflate"] -tokio-comp = ["tokio"] [dependencies] anyhow = "1" @@ -25,21 +25,33 @@ cfg-if = "1" derive_builder = "0.13" futures = "0.3" futures-locks = "0.7" -prost = "0.12" -prost-types = "0.12" reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] } -serde_json = "1" -serde = { version = "1", features = ["derive"] } sha2 = "0.10" -tonic = "0.10" +serde-json-wasm = "1.0.1" tracing = "0.1" -tracing-futures = { version = "0.2.5", default-features = false, features = ["tokio", "futures-03", "std"] } -uuid = { version = "1.7", features = ["v4"] } # A library to generate and parse UUIDs. +uuid = { version = "1.7", features = ["v4", "js"] } # A library to generate and parse UUIDs. +wasm-bindgen-futures = "0.4.18" +protobuf = "3.4.0" + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +serde = { version = "1", features = ["derive"] } +serde_json = "1" +tokio = { version = "1", features = ["full"] } # Non-feature optional dependencies libflate = { version = "2", optional = true } -tokio = { version = "1", features = ["full"], optional = true } + +[target.'cfg(all(not(target_arch = "wasm32"), not(target_os = "windows")))'.dependencies] +uname = "0.1.1" [build-dependencies] -reqwest = { version = "0.11", default-features = false, features = ["blocking", "rustls-tls"] } +protobuf-codegen = "3.4.0" +async-std = { version = "1", default-features = false, features = ["default", "tokio1"] } +cfg-if = "1.0.0" +reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] } +prost-build = "0.12.3" +protox = "0.6.0" tonic-build = "0.10" + +[target.'cfg(not(target_arch = "wasm32"))'.build-dependencies] +tokio = { version = "1", features = ["full"] } diff --git a/build.rs b/build.rs index 8b5b964..2611918 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,7 @@ // Derived from https://github.com/pellizzetti/router/blob/cc0ebcaf1d68184e1fe06f16534fddff76286b40/apollo-spaceport/build.rs +use protobuf_codegen::Customize; +use std::io::Write; +use std::path::Path; use std::{ error::Error, fs::File, @@ -11,8 +14,18 @@ fn main() -> Result<(), Box> { } else { // Retrieve a live version of the reports.proto file let proto_url = "https://usage-reporting.api.apollographql.com/proto/reports.proto"; - let response = reqwest::blocking::get(proto_url)?; - let mut content = response.text()?; + let fut = reqwest::get(proto_url); + + cfg_if::cfg_if! { + if #[cfg(not(target_arch = "wasm32"))] { + let rt = tokio::runtime::Runtime::new().unwrap(); + let response = rt.block_on(fut)?; + let mut content = rt.block_on(response.text())?; + } else { + let response = async_std::task::block_on(fut)?; + let mut content = async_std::task::block_on(response.text())?; + } + } // Process the retrieved content to: // - Insert a package Report; line after the import lines (currently only one) and before the first message definition @@ -45,19 +58,32 @@ fn main() -> Result<(), Box> { } // Process the proto files - let proto_files = vec!["proto/agents.proto", "proto/reports.proto"]; + let proto_files = vec!["proto/reports.proto"]; + + protobuf_codegen::Codegen::new() + .pure() + .cargo_out_dir("proto") + .inputs(&proto_files) + .include(".") + .customize(Customize::default().gen_mod_rs(false)) + .run_from_script(); + + let out_dir = std::env::var("OUT_DIR")?; + let path = Path::new(&out_dir).join("proto").join("reports.rs"); + let content = std::fs::read_to_string(&path)?; + + let content = content + .lines() + .filter(|line| !(line.contains("#![") || line.contains("//!"))) + .fold(String::new(), |mut content, line| { + content.push_str(line); + content.push('\n'); + content + }); - tonic_build::configure() - .type_attribute("ContextualizedStats", "#[derive(serde::Serialize)]") - .type_attribute("StatsContext", "#[derive(serde::Serialize)]") - .type_attribute("QueryLatencyStats", "#[derive(serde::Serialize)]") - .type_attribute("TypeStat", "#[derive(serde::Serialize)]") - .type_attribute("PathErrorStats", "#[derive(serde::Serialize)]") - .type_attribute("FieldStat", "#[derive(serde::Serialize)]") - .type_attribute("ReferencedFieldsForType", "#[derive(serde::Serialize)]") - .type_attribute("StatsContext", "#[derive(Eq, Hash)]") - .build_server(true) - .compile(&proto_files, &["."])?; + std::fs::remove_file(&path)?; + let mut file = std::fs::File::create(&path)?; + file.write_all(content.as_bytes())?; for file in proto_files { println!("cargo:rerun-if-changed={}", file); diff --git a/src/compression.rs b/src/compression.rs index 88f2a1e..57dc1f9 100644 --- a/src/compression.rs +++ b/src/compression.rs @@ -1,10 +1,10 @@ -#[cfg(feature = "compression")] +#[cfg(all(feature = "compression", not(target_arch = "wasm32")))] use libflate::gzip; -#[cfg(feature = "compression")] +#[cfg(all(feature = "compression", not(target_arch = "wasm32")))] const TARGET_LOG_COMPRESSION: &str = "apollo-studio-extension-compression"; -#[cfg(feature = "compression")] +#[cfg(all(feature = "compression", not(target_arch = "wasm32")))] pub fn compress(msg: Vec) -> Result, std::io::Error> { let mut encoder = gzip::Encoder::new(Vec::new()).unwrap(); let mut msg = std::io::Cursor::new(msg); @@ -20,7 +20,7 @@ pub fn compress(msg: Vec) -> Result, std::io::Error> { encoder.finish().into_result() } -#[cfg(not(feature = "compression"))] +#[cfg(any(not(feature = "compression"), target_arch = "wasm32"))] pub fn compress(msg: Vec) -> Result, std::io::Error> { Ok::, std::io::Error>(msg) } diff --git a/src/lib.rs b/src/lib.rs index b8cf773..732a118 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,23 +26,25 @@ //! //! * `compression` - To enable GZIP Compression when sending traces to Apollo Studio. mod compression; -mod packages; mod proto; pub mod register; mod report_aggregator; mod runtime; +mod packages; + use futures::SinkExt; -use prost_types::Timestamp; +use protobuf::{well_known_types::timestamp::Timestamp, EnumOrUnknown, MessageField}; use report_aggregator::ReportAggregator; use runtime::spawn; +use packages::serde_json; #[macro_use] extern crate tracing; -use futures_locks::RwLock; use std::collections::HashMap; use std::sync::Arc; +use std::sync::RwLock; use async_graphql::QueryPathSegment; use chrono::{DateTime, Utc}; @@ -55,13 +57,13 @@ use async_graphql::extensions::{ }; use async_graphql::parser::types::{ExecutableDocument, OperationType, Selection}; use async_graphql::{Response, ServerResult, Value, Variables}; -use proto::report::{ +use proto::reports::{ trace::{self, node, Node}, Trace, }; use std::convert::TryInto; -pub use proto::report::trace::http::Method; +pub use proto::reports::trace::http::Method; /// Apollo Tracing Extension to send traces to Apollo Studio /// The extension to include to your `async_graphql` instance to connect with Apollo Studio. @@ -185,7 +187,7 @@ impl Extension for ApolloTracingExtension { .any(|(_, operation)| operation.node.selection_set.node.items.iter().any(|selection| matches!(&selection.node, Selection::Field(field) if field.node.name.node == "__schema"))); if !is_schema { let result: String = - ctx.stringify_execute_doc(&document, &Variables::from_json(serde_json::json!({}))); + ctx.stringify_execute_doc(&document, &Variables::from_json(serde_json::from_str("{}").unwrap())); let name = document .operations .iter() @@ -194,7 +196,7 @@ impl Extension for ApolloTracingExtension { .map(|x| x.as_str()) .unwrap_or("no_name"); let query_type = format!("# {name}\n {query}", name = name, query = result); - *self.operation_name.write().await = query_type; + *self.operation_name.write().unwrap() = query_type; } Ok(document) } @@ -227,7 +229,9 @@ impl Extension for ApolloTracingExtension { let client_version = tracing_extension .client_version .unwrap_or_else(|| "no client version".to_string()); - let method = tracing_extension.method.unwrap_or(Method::Unknown); + let method = tracing_extension + .method + .or(::from_str("UNKNOWN")); let status_code = tracing_extension.status_code.unwrap_or(0); let mut trace: Trace = Trace { @@ -245,34 +249,39 @@ impl Extension for ApolloTracingExtension { .map(|x| x.to_string()) .unwrap_or_else(|| "no operation".to_string()), ..Default::default() - }); + }) + .into(); - trace.http = Some(trace::Http { - method: method.into(), + trace.http = Some(trace::HTTP { + method: EnumOrUnknown::new(method.unwrap()), status_code, ..Default::default() - }); + }) + .into(); - trace.end_time = Some(Timestamp { + trace.end_time = MessageField::some(Timestamp { nanos: inner.end_time.timestamp_subsec_nanos().try_into().unwrap(), seconds: inner.end_time.timestamp(), + special_fields: Default::default(), }); - trace.start_time = Some(Timestamp { - nanos: inner - .start_time - .timestamp_subsec_nanos() - .try_into() - .unwrap(), - seconds: inner.start_time.timestamp(), - }); + trace.start_time = + protobuf::MessageField::some(protobuf::well_known_types::timestamp::Timestamp { + nanos: inner + .start_time + .timestamp_subsec_nanos() + .try_into() + .unwrap(), + seconds: inner.start_time.timestamp(), + special_fields: Default::default(), + }); - let root_node = self.root_node.read().await; - trace.root = Some(root_node.clone()); + let root_node = self.root_node.read().unwrap(); + trace.root = Some(root_node.clone()).into(); let mut sender = self.report.sender(); - let operation_name = self.operation_name.read().await.clone(); + let operation_name = self.operation_name.read().unwrap().clone(); let _handle = spawn(async move { if let Err(e) = sender.send((operation_name, trace)).await { @@ -295,7 +304,7 @@ impl Extension for ApolloTracingExtension { let path = info.path_node.to_string_vec().join("."); let field_name = info.path_node.field_name().to_string(); let parent_type = info.parent_type.to_string(); - let return_type = info.return_type.to_string(); + let _return_type = info.return_type.to_string(); let start_time = Utc::now() - self.inner.lock().await.start_time; let path_node = info.path_node; @@ -320,12 +329,11 @@ impl Extension for ApolloTracingExtension { }, parent_type: parent_type.to_string(), original_field_name: field_name, - r#type: return_type, ..Default::default() }; let node = Arc::new(RwLock::new(node)); - self.nodes.write().await.insert(path, node.clone()); + self.nodes.write().unwrap().insert(path, node.clone()); let parent_node = path_node.parent.map(|x| x.to_string_vec().join(".")); // Use the path to create a new node // https://github.com/apollographql/apollo-server/blob/291c17e255122d4733b23177500188d68fac55ce/packages/apollo-server-core/src/plugin/traceTreeBuilder.ts @@ -334,7 +342,7 @@ impl Extension for ApolloTracingExtension { Err(e) => { let json = match serde_json::to_string(&e) { Ok(content) => content, - Err(e) => serde_json::json!({ "error": format!("{:?}", e) }).to_string(), + Err(e) => format!("{{ \"error\": \"{e:?}\" }}"), }; let error = trace::Error { message: e.message.clone(), @@ -345,19 +353,20 @@ impl Extension for ApolloTracingExtension { .map(|x| trace::Location { line: x.line as u32, column: x.column as u32, + special_fields: protobuf::SpecialFields::default(), }) .collect(), json, ..Default::default() }; - node.write().await.error = vec![error]; + node.write().unwrap().error = vec![error]; Err(e) } }; let end_time = Utc::now() - self.inner.lock().await.start_time; - node.write().await.end_time = match end_time + node.write().unwrap().end_time = match end_time .num_nanoseconds() .and_then(|x| u64::try_from(x).ok()) { @@ -371,19 +380,19 @@ impl Extension for ApolloTracingExtension { match parent_node { None => { - let mut root_node = self.root_node.write().await; + let mut root_node = self.root_node.write().unwrap(); let child = &mut root_node.child; - let node = node.read().await; + let node = node.read().unwrap(); // Can't copy or pass a ref to Protobuf // So we clone child.push(node.clone()); } Some(parent) => { - let nodes = self.nodes.read().await; + let nodes = self.nodes.read().unwrap(); let node_read = nodes.get(&parent).unwrap(); - let mut parent = node_read.write().await; + let mut parent = node_read.write().unwrap(); let child = &mut parent.child; - let node = node.read().await; + let node = node.read().unwrap(); // Can't copy or pass a ref to Protobuf // So we clone child.push(node.clone()); diff --git a/src/packages/mod.rs b/src/packages/mod.rs index 97682dd..dfd9139 100644 --- a/src/packages/mod.rs +++ b/src/packages/mod.rs @@ -1 +1,3 @@ -pub mod uname; + +pub mod serde_json; +pub mod uname; \ No newline at end of file diff --git a/src/packages/serde_json.rs b/src/packages/serde_json.rs new file mode 100644 index 0000000..37f3b1d --- /dev/null +++ b/src/packages/serde_json.rs @@ -0,0 +1,5 @@ + +#[cfg(not(target_arch = "wasm32"))] +pub use serde_json::*; +#[cfg(target_arch = "wasm32")] +pub use serde_json_wasm::*; diff --git a/src/packages/uname.rs b/src/packages/uname.rs index 7112ade..76f1d3c 100644 --- a/src/packages/uname.rs +++ b/src/packages/uname.rs @@ -1,84 +1,20 @@ -use std::fmt::Display; -// Taken from project uname-rs -// https://github.com/caverym/uname-rs -use std::io::{Error, ErrorKind, Result}; -use std::os::raw::{c_char, c_int}; -macro_rules! returnerr { - ($e:expr) => { - Err(Error::new(ErrorKind::Other, $e)) - }; -} - -/// Raw `utsname` struct from `/usr/include/sys/utsname.h` C header. -#[repr(C)] -#[derive(Copy, Clone)] -struct utsname { - pub sysname: [c_char; 65usize], - pub nodename: [c_char; 65usize], - pub release: [c_char; 65usize], - pub version: [c_char; 65usize], - pub machine: [c_char; 65usize], - pub _domainname: [c_char; 65usize], -} - -extern "C" { - fn uname(__name: *mut utsname) -> c_int; -} - -/// Safe implementation of `sys/utsname.h` header. -pub struct Uname { - pub sysname: String, - pub nodename: String, - pub release: String, - pub version: String, - pub machine: String, - pub domainname: String, -} - -impl Uname { - /// Collects and converts system information into Uname struct. - /// Returns `Err` on failure, `Ok` on success. - pub fn new() -> Result { - let mut raw: utsname = unsafe { std::mem::zeroed() }; - - if 0 != unsafe { uname(&mut raw) } { - return returnerr!("failed to put information about the system in uname"); +cfg_if::cfg_if! { + if #[cfg(any(target_arch = "wasm32", target_os = "windows"))] { + pub fn uname() -> std::io::Result { + Err(std::io::Error::new(std::io::ErrorKind::NotFound, "not supported on wasm32")) + } + } else { + pub fn uname() -> std::io::Result { + let x = uname::uname()?; + Ok(format!( + "{sysname} {version} {release} {machine} {nodename}", + sysname = x.sysname, + version = x.version, + release = x.release, + machine = x.machine, + nodename = x.nodename + )) } - - let info: Uname = Uname { - sysname: fromraw(&raw.sysname)?, - nodename: fromraw(&raw.nodename)?, - release: fromraw(&raw.release)?, - version: fromraw(&raw.version)?, - machine: fromraw(&raw.machine)?, - domainname: fromraw(&raw._domainname)?, - }; - - Ok(info) - } -} - -impl Display for Uname { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "{sysname} {version} {release} {machine} {nodename}", - sysname = self.sysname, - version = self.version, - release = self.release, - machine = self.machine, - nodename = self.nodename - ) - } -} - -/// The actual function which converts C char arrays into Rust `String`. -fn fromraw(s: &[c_char; 65usize]) -> Result { - let mut v = s.iter().map(|x| *x as u8).collect::>(); - v.retain(|x| *x != 0); - match String::from_utf8(v) { - Ok(res) => Ok(res), - Err(e) => returnerr!(e.to_string()), } } diff --git a/src/proto.rs b/src/proto.rs index cdc024a..c52c24b 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -1,10 +1,18 @@ #![allow(rustdoc::all)] #![allow(clippy::all)] -pub mod report { - tonic::include_proto!("report"); -} - -pub mod agent { - tonic::include_proto!("agent"); +#[allow(unknown_lints)] +#[allow(unused_attributes)] +#[cfg_attr(rustfmt, rustfmt::skip)] +#[allow(box_pointers)] +#[allow(dead_code)] +#[allow(missing_docs)] +#[allow(non_camel_case_types)] +#[allow(non_snake_case)] +#[allow(non_upper_case_globals)] +#[allow(trivial_casts)] +#[allow(unused_results)] +#[allow(unused_mut)] +pub mod reports { + include!(concat!(env!("OUT_DIR"), concat!("/proto/reports.rs"))); } diff --git a/src/register.rs b/src/register.rs index edd69fa..fc22ee3 100644 --- a/src/register.rs +++ b/src/register.rs @@ -112,12 +112,12 @@ pub async fn register< let result = client .post(SCHEMA_URL) - .json(&serde_json::json!({ - "query": mutation, - "variables": { - "schema": schema_sdl, - }, - })) + .body(format!(r#"{{ + \"query\": {mutation}, + \"variables\": {{ + \"schema\": {schema_sdl}, + }}, + }}"#)) .header("content-type", "application/json") .header("X-Api-Key", authorization_token) .send() @@ -210,12 +210,12 @@ pub async fn register_dynamic( let result = client .post(SCHEMA_URL) - .json(&serde_json::json!({ - "query": mutation, - "variables": { - "schema": schema_sdl, - }, - })) + .body(format!(r#"{{ + \"query\": {mutation}, + \"variables\": {{ + \"schema\": {schema_sdl}, + }}, + }}"#)) .header("content-type", "application/json") .header("X-Api-Key", authorization_token) .send() diff --git a/src/report_aggregator/mod.rs b/src/report_aggregator/mod.rs index 8562451..1b8bc99 100644 --- a/src/report_aggregator/mod.rs +++ b/src/report_aggregator/mod.rs @@ -4,17 +4,18 @@ use futures::{ channel::mpsc::{self, Sender}, StreamExt, }; -use tokio::time::Instant; +use protobuf::Message; use crate::{ - packages::uname::Uname, - proto::report::{Report, ReportHeader, Trace, TracesAndStats}, - runtime::{spawn, JoinHandle}, + proto::reports::{Report, ReportHeader, Trace, TracesAndStats}, + packages::uname, + runtime::{abort, spawn, Instant, JoinHandle}, }; /// The [ReportAggregator] is the structure which control the background task spawned to aggregate /// and send data through Apollo Studio by constructing [Report] ready to be send pub struct ReportAggregator { + #[allow(dead_code)] handle: JoinHandle<()>, sender: Sender<(String, Trace)>, } @@ -36,9 +37,8 @@ impl ReportAggregator { let (tx, mut rx) = mpsc::channel::<(String, Trace)>(BUFFER_SLOTS); let reported_header = ReportHeader { - uname: Uname::new() + uname: uname::uname() .ok() - .map(|x| x.to_string()) .unwrap_or_else(|| "No uname provided".to_string()), hostname, graph_ref: format!("{graph_id}@{variant}"), @@ -46,6 +46,7 @@ impl ReportAggregator { agent_version: format!("async-studio-extension-{}", VERSION), runtime_version: "Rust".to_string(), executable_schema_id: graph_id, + special_fields: Default::default(), }; let handle = spawn(async move { @@ -92,11 +93,11 @@ impl ReportAggregator { let report: Report = Report { traces_pre_aggregated: false, traces_per_query: hashmap_to_send, - header: Some(reported_header.clone()), + header: Some(reported_header.clone()).into(), ..Default::default() }; - let msg = prost::Message::encode_to_vec(&report); + let msg = report.write_to_bytes().unwrap(); let mut client = client .post(REPORTING_URL) @@ -143,7 +144,7 @@ impl ReportAggregator { impl Drop for ReportAggregator { fn drop(&mut self) { - self.handle.abort(); + abort(&self.handle); // TODO: Wait for the proper aborted task } } diff --git a/src/runtime.rs b/src/runtime.rs index d3cc6c5..a592bb3 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1,14 +1,43 @@ -use futures::Future; - -#[cfg(feature = "tokio-comp")] -pub use tokio::task::JoinHandle; - cfg_if::cfg_if! { - if #[cfg(all(feature = "tokio-comp", not(feature = "async-std-comp")))] { - pub fn spawn(f: impl Future + Send + 'static) -> JoinHandle<()> { + if #[cfg(not(target_arch = "wasm32"))] { + pub use tokio::task::JoinHandle; + pub fn spawn(f: impl std::future::Future + Send + 'static) -> JoinHandle<()> { tokio::spawn(f) } + + pub fn abort(handle: &JoinHandle<()>) { + handle.abort(); + } + + pub struct Instant(tokio::time::Instant); + impl Instant { + pub fn now() -> Instant { + Instant(tokio::time::Instant::now()) + } + + pub fn elapsed(&self) -> std::time::Duration { + self.0.elapsed() + } + } } else { - compile_error!("tokio-comp or async-std-comp features required"); + pub struct JoinHandle(std::marker::PhantomData); + + pub fn spawn(f: impl futures::future::Future + 'static) -> JoinHandle<()> { + wasm_bindgen_futures::spawn_local(f); + JoinHandle(std::marker::PhantomData) + } + + pub fn abort(_handle: &JoinHandle<()>) {} + + pub struct Instant(std::time::Instant); + impl Instant { + pub fn now() -> Instant { + Instant(std::time::Instant::now()) + } + + pub fn elapsed(&self) -> std::time::Duration { + self.0.elapsed() + } + } } }