diff --git a/Cargo.lock b/Cargo.lock index 028934b915..683c4ac690 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,24 +27,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" -[[package]] -name = "adler32" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.3" @@ -226,7 +208,6 @@ dependencies = [ "blocking", "futures-lite", "once_cell", - "tokio", ] [[package]] @@ -274,7 +255,7 @@ checksum = "d8e5d0c6697def2f79ccbd972fb106b633173a6066e430b480e1ff9376a7561a" dependencies = [ "Inflector", "async-graphql-parser", - "darling 0.20.10", + "darling", "proc-macro-crate 3.2.0", "proc-macro2", "quote", @@ -283,39 +264,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "async-graphql-extension-apollo-tracing" -version = "3.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c4d3cc0bb90e426ddedb5a0b30bd9c0a9aaec1351d0e96556d5919a18ff954" -dependencies = [ - "anyhow", - "async-graphql", - "async-std", - "async-trait", - "cfg-if", - "chrono", - "derive_builder", - "futures", - "futures-locks", - "libflate", - "prost-build", - "protobuf 3.7.1", - "protobuf-codegen", - "protox 0.6.1", - "reqwest 0.11.27", - "serde", - "serde-json-wasm", - "serde_json", - "sha2 0.10.8", - "tokio", - "tonic-build 0.10.2", - "tracing", - "uname", - "uuid", - "wasm-bindgen-futures", -] - [[package]] name = "async-graphql-parser" version = "7.0.15" @@ -963,7 +911,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -997,7 +945,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -1056,15 +1004,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "core2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" -dependencies = [ - "memchr", -] - [[package]] name = "cpufeatures" version = "0.2.16" @@ -1214,38 +1153,14 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core 0.14.4", - "darling_macro 0.14.4", -] - [[package]] name = "darling" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -1258,38 +1173,21 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.101", ] -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core 0.14.4", - "quote", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.20.10", + "darling_core", "quote", "syn 2.0.101", ] -[[package]] -name = "dary_heap" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04d2cd9c18b9f454ed67da600630b021a8a80bf33f8c95896ab33aaf1c26b728" - [[package]] name = "dashmap" version = "6.1.0" @@ -1336,37 +1234,6 @@ dependencies = [ "syn 2.0.101", ] -[[package]] -name = "derive_builder" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f59169f400d8087f238c5c0c7db6a28af18681717f3b623227d92f397e938c7" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4ec317cc3e7ef0928b0ca6e4a634a4d6c001672ae210438cf114a83e56b018d" -dependencies = [ - "darling 0.14.4", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_builder_macro" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870368c3fb35b8031abb378861d4460f573b92238ec2152c927a21f77e3e0127" -dependencies = [ - "derive_builder_core", - "syn 1.0.109", -] - [[package]] name = "derive_more" version = "1.0.0" @@ -1394,7 +1261,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e8ef033054e131169b8f0f9a7af8f5533a9436fadf3c500ed547f730f07090d" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.101", @@ -1748,17 +1615,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "futures-locks" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" -dependencies = [ - "futures-channel", - "futures-task", - "tokio", -] - [[package]] name = "futures-macro" version = "0.3.31" @@ -2139,10 +1995,6 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "allocator-api2", -] [[package]] name = "hashbrown" @@ -2976,30 +2828,6 @@ version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" -[[package]] -name = "libflate" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45d9dfdc14ea4ef0900c1cddbc8dcd553fbaacd8a4a282cf4018ae9dd04fb21e" -dependencies = [ - "adler32", - "core2", - "crc32fast", - "dary_heap", - "libflate_lz77", -] - -[[package]] -name = "libflate_lz77" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e0d73b369f386f1c44abd9c570d5318f55ccde816ff4b562fa452e5182863d" -dependencies = [ - "core2", - "hashbrown 0.14.5", - "rle-decode-fast", -] - [[package]] name = "libloading" version = "0.7.4" @@ -3017,7 +2845,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -3697,7 +3525,7 @@ dependencies = [ "opentelemetry 0.23.0", "opentelemetry_sdk", "prometheus", - "protobuf 2.28.0", + "protobuf", ] [[package]] @@ -4143,7 +3971,7 @@ dependencies = [ "lazy_static", "memchr", "parking_lot", - "protobuf 2.28.0", + "protobuf", "thiserror 1.0.69", ] @@ -4214,19 +4042,6 @@ dependencies = [ "syn 2.0.101", ] -[[package]] -name = "prost-reflect" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5eec97d5d34bdd17ad2db2219aabf46b054c6c41bd5529767c9ce55be5898f" -dependencies = [ - "logos", - "miette 7.4.0", - "once_cell", - "prost 0.12.6", - "prost-types 0.12.6", -] - [[package]] name = "prost-reflect" version = "0.14.3" @@ -4267,57 +4082,6 @@ version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" -[[package]] -name = "protobuf" -version = "3.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a7c64d9bf75b1b8d981124c14c179074e8caa7dfe7b6a12e6222ddcd0c8f72" -dependencies = [ - "once_cell", - "protobuf-support", - "thiserror 1.0.69", -] - -[[package]] -name = "protobuf-codegen" -version = "3.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e26b833f144769a30e04b1db0146b2aaa53fd2fd83acf10a6b5f996606c18144" -dependencies = [ - "anyhow", - "once_cell", - "protobuf 3.7.1", - "protobuf-parse", - "regex", - "tempfile", - "thiserror 1.0.69", -] - -[[package]] -name = "protobuf-parse" -version = "3.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322330e133eab455718444b4e033ebfac7c6528972c784fcde28d2cc783c6257" -dependencies = [ - "anyhow", - "indexmap 2.9.0", - "log", - "protobuf 3.7.1", - "protobuf-support", - "tempfile", - "thiserror 1.0.69", - "which 4.4.2", -] - -[[package]] -name = "protobuf-support" -version = "3.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b088fd20b938a875ea00843b6faf48579462630015c3788d397ad6a786663252" -dependencies = [ - "thiserror 1.0.69", -] - [[package]] name = "protoc-bin-vendored" version = "3.1.0" @@ -4375,21 +4139,6 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dc55d7dec32ecaf61e0bd90b3d2392d721a28b95cfd23c3e176eccefbeab2f2" -[[package]] -name = "protox" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac532509cee918d40f38c3e12f8ef9230f215f017d54de7dd975015538a42ce7" -dependencies = [ - "bytes", - "miette 7.4.0", - "prost 0.12.6", - "prost-reflect 0.13.1", - "prost-types 0.12.6", - "protox-parse 0.6.1", - "thiserror 1.0.69", -] - [[package]] name = "protox" version = "0.7.2" @@ -4399,21 +4148,9 @@ dependencies = [ "bytes", "miette 7.4.0", "prost 0.13.4", - "prost-reflect 0.14.3", + "prost-reflect", "prost-types 0.13.3", - "protox-parse 0.7.0", - "thiserror 1.0.69", -] - -[[package]] -name = "protox-parse" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6c33f43516fe397e2f930779d720ca12cd057f7da4cd6326a0ef78d69dee96" -dependencies = [ - "logos", - "miette 7.4.0", - "prost-types 0.12.6", + "protox-parse", "thiserror 1.0.69", ] @@ -4806,12 +4543,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rle-decode-fast" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" - [[package]] name = "rquickjs" version = "0.7.0" @@ -5144,15 +4875,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-json-wasm" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5" -dependencies = [ - "serde", -] - [[package]] name = "serde-value" version = "0.7.0" @@ -5499,12 +5221,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784dea3618a8c4f8bba0af715e4075f6d743d766d46f7c3339525dd95776c004" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -5649,7 +5365,6 @@ version = "0.1.0" dependencies = [ "anyhow", "async-graphql", - "async-graphql-extension-apollo-tracing", "async-graphql-value", "async-recursion", "async-std", @@ -5718,9 +5433,9 @@ dependencies = [ "pretty_assertions", "prometheus", "prost 0.13.4", - "prost-reflect 0.14.3", - "protox 0.7.2", - "protox-parse 0.7.0", + "prost-reflect", + "protox", + "protox-parse", "rand", "regex", "reqwest 0.11.27", @@ -5806,7 +5521,7 @@ dependencies = [ "http 0.2.12", "hyper 0.14.32", "lazy_static", - "protox 0.7.2", + "protox", "reqwest 0.11.27", "serde_json", "serde_qs", @@ -5941,7 +5656,7 @@ dependencies = [ "thiserror 1.0.69", "tokio", "tonic 0.11.0", - "tonic-build 0.11.0", + "tonic-build", "tonic-reflection", "tonic-tracing-opentelemetry", "tower", @@ -6361,19 +6076,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tonic-build" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" -dependencies = [ - "prettyplease", - "proc-macro2", - "prost-build", - "quote", - "syn 2.0.101", -] - [[package]] name = "tonic-build" version = "0.11.0" @@ -6593,15 +6295,6 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" -[[package]] -name = "uname" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72f89f0ca32e4db1c04e2a72f5345d59796d4866a1ee0609084569f73683dc8" -dependencies = [ - "libc", -] - [[package]] name = "unicase" version = "2.8.0" @@ -6706,7 +6399,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom 0.2.15", - "wasm-bindgen", ] [[package]] @@ -6966,7 +6658,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -7446,7 +7138,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76ff259533532054cfbaefb115c613203c73707017459206380f03b3b3f266e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.101", diff --git a/Cargo.toml b/Cargo.toml index 5a344242c0..5116b1778a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,8 @@ http = "0.2.12" # previous version until hyper is updated to 1+ insta = { version = "1.38.0", features = ["json"] } tokio = { version = "1.37.0", features = ["rt", "time"] } reqwest = { version = "0.11", features = [ - "json", - "rustls-tls", + "json", + "rustls-tls", ], default-features = false } tracing = "0.1.40" lazy_static = "1.4.0" @@ -36,23 +36,23 @@ tailcall-valid = "0.1.1" mimalloc = { version = "0.1.41", default-features = false, optional = true } http-cache-reqwest = { version = "0.13.0", features = [ - "manager-moka", + "manager-moka", ], default-features = false, optional = true } moka = { version = "0.12.7", default-features = false, features = [ - "future", + "future", ], optional = true } hyper-rustls = { version = "0.25.0", optional = true } rustls = { version = "0.23.5", optional = true, features = [ - "std", + "std", ], default-features = false } rustls-pki-types = "1.5.0" inquire = { version = "0.7.5", optional = true } opentelemetry-otlp = { version = "0.16.0", features = [ - "trace", - "logs", - "metrics", - # required to make grpc requests - "tls-roots", + "trace", + "logs", + "metrics", + # required to make grpc requests + "tls-roots", ], optional = true } opentelemetry-system-metrics = { version = "0.2.0", optional = true } tailcall-http-cache = { path = "tailcall-http-cache", optional = true } @@ -96,8 +96,8 @@ futures-timer = { version = "3.0.3", features = ["wasm-bindgen"] } futures-util = { workspace = true } lru = { version = "0.12.3" } async-std = { version = "1.12.0", features = [ - "wasm-bindgen-futures", - "unstable", + "wasm-bindgen-futures", + "unstable", ] } ttl_cache = "0.5.1" protox = "0.7.0" @@ -105,8 +105,8 @@ protox-parse = "0.7.0" prost-reflect = { version = "0.14.0", features = ["serde"] } prost = "0.13.1" update-informer = { version = "1.1.0", default-features = false, features = [ - "github", - "reqwest", + "github", + "reqwest", ], optional = true } lazy_static = { workspace = true } which = { version = "7.0.0", optional = true } @@ -116,9 +116,9 @@ strum_macros = "0.26.4" # TODO: disable some levels with features? tracing = { workspace = true } tracing-subscriber = { version = "0.3.18", features = [ - "default", - "fmt", - "env-filter", + "default", + "fmt", + "env-filter", ] } tracing-opentelemetry = "0.24.0" getrandom = { version = "0.2.14", features = ["js"] } @@ -127,21 +127,21 @@ tonic = { version = "0.11.0", default-features = false } opentelemetry-semantic-conventions = "0.15.0" opentelemetry = { version = "0.23.0", features = ["trace", "logs", "metrics"] } opentelemetry_sdk = { version = "0.23.0", features = [ - "trace", - "logs", - "metrics", + "trace", + "logs", + "metrics", ] } opentelemetry-http = "0.12.0" opentelemetry-stdout = { version = "0.4.0", features = [ - "trace", - "logs", - "metrics", + "trace", + "logs", + "metrics", ] } opentelemetry-appender-tracing = { version = "0.4.0" } opentelemetry-prometheus = "0.16.0" phonenumber = "0.3.4" chrono = "0.4.38" -async-graphql-extension-apollo-tracing = { version = "3.2.15"} +# async-graphql-extension-apollo-tracing = { version = "3.2.15" } headers = { workspace = true } http = { workspace = true } mime = "0.3.17" @@ -149,10 +149,10 @@ htpasswd-verify = { version = "0.3.0", git = "https://github.com/twistedfall/htp jsonwebtoken = "9.3.0" async-graphql-value = "7.0.9" async-graphql = { workspace = true, features = [ - "dynamic-schema", - "dataloader", - "apollo_tracing", - "opentelemetry", + "dynamic-schema", + "dataloader", + "apollo_tracing", + "opentelemetry", ] } dotenvy = "0.15.7" convert_case = { workspace = true } @@ -179,7 +179,10 @@ unicode-segmentation = "1.12.0" # to build rquickjs bindings on systems without builtin bindings [target.'cfg(all(target_os = "windows", target_arch = "x86"))'.dependencies] -rquickjs = { "version" = "0.7.0", optional = true, features = ["macro", "bindgen"] } +rquickjs = { "version" = "0.7.0", optional = true, features = [ + "macro", + "bindgen", +] } [dev-dependencies] datatest-stable = "0.2.9" @@ -195,16 +198,16 @@ tempfile = "3.10.1" maplit = "1.0.2" tailcall-fixtures = { path = "./tailcall-fixtures" } http-cache-semantics = { version = "1.0.1", default-features = false, features = [ - "with_serde", - "reqwest", + "with_serde", + "reqwest", ] } cacache = { version = "13.0.0", default-features = false, features = [ - "tokio-runtime", - "mmap", + "tokio-runtime", + "mmap", ] } test-log = { version = "0.2.16", default-features = false, features = [ - "color", - "trace", + "color", + "trace", ] } flate2 = "1.0.30" bincode = "1.3.3" @@ -219,25 +222,25 @@ js = ["dep:rquickjs"] # This is created to control what we expose for WASM. # Will be deprecated once we move CLI to it's own crate and WASM builds won't depend on it. cli = [ - "tokio/fs", - "tokio/rt-multi-thread", - "dep:mimalloc", - "dep:http-cache-reqwest", - "dep:moka", - "dep:hyper-rustls", - "dep:rustls", - "dep:inquire", - "dep:which", - "dep:update-informer", - "opentelemetry_sdk/testing", - "opentelemetry_sdk/rt-tokio", - "dep:opentelemetry-otlp", - "dep:opentelemetry-system-metrics", - "dep:tailcall-tracker", - "dep:tailcall-http-cache", - "dep:tailcall-version", - "dep:genai", - "dep:ctrlc", + "tokio/fs", + "tokio/rt-multi-thread", + "dep:mimalloc", + "dep:http-cache-reqwest", + "dep:moka", + "dep:hyper-rustls", + "dep:rustls", + "dep:inquire", + "dep:which", + "dep:update-informer", + "opentelemetry_sdk/testing", + "opentelemetry_sdk/rt-tokio", + "dep:opentelemetry-otlp", + "dep:opentelemetry-system-metrics", + "dep:tailcall-tracker", + "dep:tailcall-http-cache", + "dep:tailcall-version", + "dep:genai", + "dep:ctrlc", ] # Feature flag to enable all default features. @@ -250,20 +253,20 @@ force_jit = [] [workspace] members = [ - ".", - "tailcall-typedefs-common", - "tailcall-typedefs", - "tailcall-aws-lambda", - "tailcall-cloudflare", - "tailcall-macros", - "tailcall-prettier", - "tailcall-fixtures", - "tailcall-upstream-grpc", - "tailcall-tracker", - "tailcall-wasm", - "tailcall-hasher", - "tailcall-http-cache", - "tailcall-version", + ".", + "tailcall-typedefs-common", + "tailcall-typedefs", + "tailcall-aws-lambda", + "tailcall-cloudflare", + "tailcall-macros", + "tailcall-prettier", + "tailcall-fixtures", + "tailcall-upstream-grpc", + "tailcall-tracker", + "tailcall-wasm", + "tailcall-hasher", + "tailcall-http-cache", + "tailcall-version", ] # Boost execution_spec snapshot diffing performance diff --git a/src/cli/server/server_config.rs b/src/cli/server/server_config.rs index b6fd3899c0..1451ce360c 100644 --- a/src/cli/server/server_config.rs +++ b/src/cli/server/server_config.rs @@ -1,7 +1,7 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::Arc; -use async_graphql_extension_apollo_tracing::ApolloTracing; +// use async_graphql_extension_apollo_tracing::ApolloTracing; use crate::cli::runtime::init; use crate::core::app_context::AppContext; @@ -24,16 +24,16 @@ impl ServerConfig { let mut extensions = vec![]; - if let Some(TelemetryExporter::Apollo(apollo)) = blueprint.telemetry.export.as_ref() { - let (graph_id, variant) = apollo.graph_ref.split_once('@').unwrap(); - extensions.push(SchemaExtension::new(ApolloTracing::new( - apollo.api_key.clone(), - apollo.platform.clone().unwrap_or_default(), - graph_id.to_string(), - variant.to_string(), - apollo.version.clone().unwrap_or_default(), - ))); - } + // if let Some(TelemetryExporter::Apollo(apollo)) = blueprint.telemetry.export.as_ref() { + // let (graph_id, variant) = apollo.graph_ref.split_once('@').unwrap(); + // extensions.push(SchemaExtension::new(ApolloTracing::new( + // apollo.api_key.clone(), + // apollo.platform.clone().unwrap_or_default(), + // graph_id.to_string(), + // variant.to_string(), + // apollo.version.clone().unwrap_or_default(), + // ))); + // } rt.add_extensions(extensions); let endpoints = endpoints.into_checked(&blueprint, rt.clone()).await?; diff --git a/src/core/jit/builder.rs b/src/core/jit/builder.rs index db3cfcf7f8..3273f1ca62 100644 --- a/src/core/jit/builder.rs +++ b/src/core/jit/builder.rs @@ -349,7 +349,11 @@ impl<'a> Builder<'a> { } #[inline(always)] - pub fn build(&self, operation_name: Option<&str>) -> Result, BuildError> { + pub fn build( + &self, + operation_name: Option<&str>, + variables: Variables, + ) -> Result, BuildError> { let mut fragments: HashMap<&str, &FragmentDefinition> = HashMap::new(); for (name, fragment) in self.document.fragments.iter() { @@ -379,6 +383,7 @@ impl<'a> Builder<'a> { self.index.clone(), is_introspection_query, Some(self.index.get_interfaces()), + variables, ); Ok(plan) } @@ -400,7 +405,9 @@ mod tests { let config = Config::from_sdl(CONFIG).to_result().unwrap(); let blueprint = Blueprint::try_from(&config.into()).unwrap(); let document = async_graphql::parser::parse_query(query).unwrap(); - Builder::new(&blueprint, &document).build(None).unwrap() + Builder::new(&blueprint, &document) + .build(None, Variables::new()) + .unwrap() } #[tokio::test] @@ -668,24 +675,26 @@ mod tests { let config = Config::from_sdl(CONFIG).to_result().unwrap(); let blueprint = Blueprint::try_from(&config.into()).unwrap(); let document = async_graphql::parser::parse_query(query).unwrap(); - let error = Builder::new(&blueprint, &document).build(None).unwrap_err(); + let error = Builder::new(&blueprint, &document) + .build(None, Variables::new()) + .unwrap_err(); assert_eq!(error, BuildError::OperationNameRequired); let error = Builder::new(&blueprint, &document) - .build(Some("unknown")) + .build(Some("unknown"), Variables::new()) .unwrap_err(); assert_eq!(error, BuildError::OperationNotFound("unknown".to_string())); let plan = Builder::new(&blueprint, &document) - .build(Some("GetPosts")) + .build(Some("GetPosts"), Variables::new()) .unwrap(); assert!(plan.is_query()); insta::assert_debug_snapshot!(plan.selection); let plan = Builder::new(&blueprint, &document) - .build(Some("CreateNewPost")) + .build(Some("CreateNewPost"), Variables::new()) .unwrap(); assert!(!plan.is_query()); insta::assert_debug_snapshot!(plan.selection); diff --git a/src/core/jit/fixtures/jp.rs b/src/core/jit/fixtures/jp.rs index f743fdc281..4a5449b9c6 100644 --- a/src/core/jit/fixtures/jp.rs +++ b/src/core/jit/fixtures/jp.rs @@ -90,8 +90,14 @@ impl<'a, Value: Deserialize<'a> + Clone + 'a + JsonLike<'a> + std::fmt::Debug> J let config = ConfigModule::from(Config::from_sdl(Self::CONFIG).to_result().unwrap()); let doc = async_graphql::parser::parse_query(query).unwrap(); let builder = Builder::new(&Blueprint::try_from(&config).unwrap(), &doc); - - let plan = builder.build(None).unwrap(); + let v: Variables = Variables::from_iter( + variables + .clone() + .into_hashmap() + .into_iter() + .map(|(k, v)| (k, v.into())), + ); + let plan = builder.build(None, v).unwrap(); let plan = transform::Skip::new(variables) .transform(plan) .to_result() diff --git a/src/core/jit/graphql_executor.rs b/src/core/jit/graphql_executor.rs index e1c131c374..ee0aad01dc 100644 --- a/src/core/jit/graphql_executor.rs +++ b/src/core/jit/graphql_executor.rs @@ -65,6 +65,7 @@ impl JITExecutor { fn req_hash(request: &async_graphql::Request) -> OPHash { let mut hasher = TailcallHasher::default(); request.query.hash(&mut hasher); + request.variables.to_string().hash(&mut hasher); OPHash::new(hasher.finish()) } diff --git a/src/core/jit/model.rs b/src/core/jit/model.rs index edaee37730..2de20fea37 100644 --- a/src/core/jit/model.rs +++ b/src/core/jit/model.rs @@ -318,6 +318,7 @@ pub struct OperationPlan { pub selection: Vec>, pub before: Option, pub interfaces: Option>, + pub variables: Variables, } impl OperationPlan { @@ -343,6 +344,7 @@ impl OperationPlan { min_cache_ttl: self.min_cache_ttl, before: self.before, interfaces: None, + variables: self.variables.try_map(&map)?, }) } } @@ -356,6 +358,7 @@ impl OperationPlan { index: Arc, is_introspection_query: bool, interfaces: Option>, + variables: Variables, ) -> Self where Input: Clone, @@ -372,6 +375,7 @@ impl OperationPlan { min_cache_ttl: None, before: Default::default(), interfaces, + variables, } } diff --git a/src/core/jit/request.rs b/src/core/jit/request.rs index f37c4a721e..2676868ebd 100644 --- a/src/core/jit/request.rs +++ b/src/core/jit/request.rs @@ -43,7 +43,14 @@ impl Request { ) -> Result> { let doc = async_graphql::parser::parse_query(&self.query)?; let builder = Builder::new(blueprint, &doc); - let plan = builder.build(self.operation_name.as_deref())?; + let variables = Variables::from_iter( + self.variables + .clone() + .into_hashmap() + .into_iter() + .map(|(k, v)| (k, v.into())), + ); + let plan = builder.build(self.operation_name.as_deref(), variables)?; transform::CheckConst::new() .pipe(transform::CheckProtected::new()) diff --git a/src/core/jit/synth/synth.rs b/src/core/jit/synth/synth.rs index 221fa95da2..fc68e73dd8 100644 --- a/src/core/jit/synth/synth.rs +++ b/src/core/jit/synth/synth.rs @@ -346,7 +346,7 @@ mod tests { let config = ConfigModule::from(config); let builder = Builder::new(&Blueprint::try_from(&config).unwrap(), &doc); - let plan = builder.build(None).unwrap(); + let plan = builder.build(None, Variables::new()).unwrap(); let plan = plan .try_map(|v| { // Earlier we hard OperationPlan which has impl Deserialize diff --git a/src/core/jit/transform/graphql.rs b/src/core/jit/transform/graphql.rs index d15b9f35f3..ef5a228172 100644 --- a/src/core/jit/transform/graphql.rs +++ b/src/core/jit/transform/graphql.rs @@ -4,11 +4,12 @@ use std::convert::Infallible; use std::fmt::{Debug, Display}; use std::marker::PhantomData; +use async_graphql_value::Value; use tailcall_valid::Valid; use crate::core::document::print_directives; use crate::core::ir::model::{IO, IR}; -use crate::core::jit::{Field, OperationPlan}; +use crate::core::jit::{Field, OperationPlan, Variables}; use crate::core::json::JsonLikeOwned; use crate::core::{Mustache, Transform}; @@ -21,9 +22,10 @@ impl GraphQL { } } -fn compute_selection_set( +fn compute_selection_set + JsonLikeOwned>( base_field: &mut [Field], interfaces: &HashSet, + variables: &Variables, ) { for field in base_field.iter_mut() { if let Some(ir) = field.ir.as_mut() { @@ -33,17 +35,18 @@ fn compute_selection_set( field.selection.iter(), interfaces, interfaces.contains(field.type_of.name()), + variables, ) { req_template.selection = Some(Mustache::parse(&v).into()); } } }); } - compute_selection_set(field.selection.as_mut(), interfaces); + compute_selection_set(field.selection.as_mut(), interfaces, variables); } } -impl Transform for GraphQL { +impl> Transform for GraphQL { type Value = OperationPlan; type Error = Infallible; @@ -52,16 +55,17 @@ impl Transform for GraphQL { Some(ref interfaces) => interfaces, None => &HashSet::new(), }; - compute_selection_set(&mut plan.selection, interfaces); + compute_selection_set(&mut plan.selection, interfaces, &plan.variables); Valid::succeed(plan) } } -fn format_selection_set<'a, A: 'a + Display + JsonLikeOwned>( +fn format_selection_set<'a, A: 'a + Display + Debug + Clone + Into + JsonLikeOwned>( selection_set: impl Iterator>, interfaces: &HashSet, is_parent_interface: bool, + variables: &Variables, ) -> Option { let mut fragments_fields = HashMap::new(); let mut normal_fields = vec![]; @@ -76,8 +80,13 @@ fn format_selection_set<'a, A: 'a + Display + JsonLikeOwned>( field.name.to_string() }; let is_this_field_interface = interfaces.contains(field.type_of.name()); - let formatted_selection_fields = - format_selection_field(field, &field_name, interfaces, is_this_field_interface); + let formatted_selection_fields = format_selection_field( + field, + &field_name, + interfaces, + is_this_field_interface, + variables, + ); is_typename_requested = is_typename_requested || (field_name == "__typename" && field.parent_fragment.is_none()); match &field.parent_fragment { @@ -113,15 +122,20 @@ fn format_selection_set<'a, A: 'a + Display + JsonLikeOwned>( Some(format!("{{ {} }}", normal_fields.join(" "))) } -fn format_selection_field( +fn format_selection_field + JsonLikeOwned>( field: &Field, name: &str, interfaces: &HashSet, is_parent_interface: bool, + variables: &Variables, ) -> String { - let arguments = format_selection_field_arguments(field); - let selection_set = - format_selection_set(field.selection.iter(), interfaces, is_parent_interface); + let arguments = format_selection_field_arguments(field, variables); + let selection_set = format_selection_set( + field.selection.iter(), + interfaces, + is_parent_interface, + variables, + ); let mut output = format!("{}{}", name, arguments); @@ -142,12 +156,18 @@ fn format_selection_field( output } -fn format_selection_field_arguments(field: &Field) -> Cow<'static, str> { +fn format_selection_field_arguments>( + field: &Field, + variables: &Variables, +) -> Cow<'static, str> { let arguments = field .args .iter() .filter(|a| a.value.is_some()) - .map(|arg| arg.to_string()) + .map(|arg| { + let a = render_value(&arg.value.as_ref().unwrap().to_owned().into(), variables); + format!("{}: {}", arg.name, a) + }) .collect::>() .join(","); @@ -157,3 +177,27 @@ fn format_selection_field_arguments(field: &Field) -> Cow<'static Cow::Owned(format!("({})", arguments.escape_default())) } } + +fn render_value(value: &Value, variables: &Variables) -> Value +where + A: Into + Display + Clone, +{ + match value { + Value::Null + | Value::Number(_) + | Value::String(_) + | Value::Boolean(_) + | Value::Binary(_) + | Value::Enum(_) => value.clone(), + Value::Variable(s) => variables + .get(s.as_str()) + .map(|x| x.clone().into()) + .unwrap_or(Value::Null), + Value::List(v) => Value::List(v.iter().map(|v| render_value(v, variables)).collect()), + Value::Object(o) => Value::Object( + o.into_iter() + .map(|(k, v)| (k.clone(), render_value(v, variables))) + .collect(), + ), + } +} diff --git a/src/core/jit/transform/input_resolver.rs b/src/core/jit/transform/input_resolver.rs index 3787719c1d..f57909844a 100644 --- a/src/core/jit/transform/input_resolver.rs +++ b/src/core/jit/transform/input_resolver.rs @@ -70,7 +70,6 @@ where // this check? .map(|field| Self::resolve_field(&index, field?)) .collect::, _>>()?; - // adjust the pre-computed values in selection set like graphql query for // @graphql directive. Self::resolve_graphql_selection_set(&mut selection, variables); @@ -87,6 +86,7 @@ where interfaces: None, selection, before: self.plan.before, + variables: variables.clone(), }) } diff --git a/tests/core/snapshots/graphql-conformance-020.md_0.snap b/tests/core/snapshots/graphql-conformance-020.md_0.snap new file mode 100644 index 0000000000..67348a973f --- /dev/null +++ b/tests/core/snapshots/graphql-conformance-020.md_0.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "queryNodeA": [ + { + "name": "nodeA", + "nodeA_id": "nodeA_id", + "nodeB": { + "name": "NodeB", + "nodeB_id": "nodeB_id" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/graphql-conformance-020.md_client.snap b/tests/core/snapshots/graphql-conformance-020.md_client.snap new file mode 100644 index 0000000000..c56989d027 --- /dev/null +++ b/tests/core/snapshots/graphql-conformance-020.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: formatted +--- +type NodeA { + name: String + nodeA_id: String + nodeB(nodeB_id: String): NodeB +} + +type NodeB { + name: String + nodeB_id: String +} + +type Query { + queryNodeA: [NodeA!] + queryNodeB: [NodeB!] +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/graphql-conformance-020.md_merged.snap b/tests/core/snapshots/graphql-conformance-020.md_merged.snap new file mode 100644 index 0000000000..379e19e3c7 --- /dev/null +++ b/tests/core/snapshots/graphql-conformance-020.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: formatter +--- +schema @server @upstream @link(src: "schema_0.graphql", type: Config) { + query: Query +} + +type NodeA { + name: String + nodeA_id: String + nodeB(nodeB_id: String): NodeB +} + +type NodeB { + name: String + nodeB_id: String +} + +type Query { + queryNodeA: [NodeA!] @graphQL(url: "http://upstream/graphql", name: "nodeA") + queryNodeB: [NodeB!] @graphQL(url: "http://upstream/graphql", name: "nodeB") +} diff --git a/tests/execution/graphql-conformance-020.md b/tests/execution/graphql-conformance-020.md new file mode 100644 index 0000000000..7a648f2532 --- /dev/null +++ b/tests/execution/graphql-conformance-020.md @@ -0,0 +1,58 @@ +```graphql @schema +schema @server(port: 8000, hostname: "0.0.0.0") { + query: Query +} + +type Query { + queryNodeA: [NodeA!] @graphQL(url: "http://upstream/graphql", name: "nodeA") + queryNodeB: [NodeB!] @graphQL(url: "http://upstream/graphql", name: "nodeB") +} + +type NodeA { + name: String + nodeA_id: String + nodeB(nodeB_id: String): NodeB +} + +type NodeB { + name: String + nodeB_id: String +} +``` + +```yml @mock +- request: + method: POST + url: http://upstream/graphql + textBody: {"query": "query { nodeA { name nodeA_id nodeB(nodeB_id:) { name nodeB_id } } }"} + expectedHits: 1 + response: + status: 200 + body: + data: + nodeA: + - name: nodeA + nodeA_id: nodeA_id + nodeB: + name: NodeB + nodeB_id: nodeB_id +``` + +```yml @test +- method: POST + url: http://localhost:8080/graphql + body: + query: | + query queryNodeA($nodeB: String) { + queryNodeA { + name + nodeA_id + nodeB(nodeB_id: $nodeB) { + name + nodeB_id + } + } + } + variables: + nodeB: "nodeB_id" +```