WIP on fixing graphql client
continuous-integration/drone/push Build is failing Details

This commit is contained in:
projectmoon 2021-09-03 09:29:44 +00:00
parent 01cbca7a82
commit ce2f6d458c
5 changed files with 39 additions and 53 deletions

65
Cargo.lock generated
View File

@ -730,12 +730,6 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
[[package]]
name = "doc-comment"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]] [[package]]
name = "dotenv" name = "dotenv"
version = "0.15.0" version = "0.15.0"
@ -1140,8 +1134,9 @@ dependencies = [
[[package]] [[package]]
name = "graphql-introspection-query" name = "graphql-introspection-query"
version = "0.1.0" version = "0.2.0"
source = "git+https://github.com/graphql-rust/graphql-client?branch=master#de2f4aeaa147864b86b7a8abe50f334d7d9f7518" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f2a4732cf5140bd6c082434494f785a19cfb566ab07d1382c3671f5812fed6d"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@ -1168,26 +1163,20 @@ dependencies = [
[[package]] [[package]]
name = "graphql_client" name = "graphql_client"
version = "0.9.0" version = "0.10.0"
source = "git+https://github.com/graphql-rust/graphql-client?branch=master#de2f4aeaa147864b86b7a8abe50f334d7d9f7518" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9b58571cfc3cc42c3e8ff44fc6cfbb6c0dea17ed22d20f9d8f1efc4e8209a3f"
dependencies = [ dependencies = [
"anyhow",
"doc-comment",
"graphql_query_derive", "graphql_query_derive",
"js-sys",
"log",
"serde", "serde",
"serde_json", "serde_json",
"thiserror",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
] ]
[[package]] [[package]]
name = "graphql_client_codegen" name = "graphql_client_codegen"
version = "0.9.0" version = "0.10.0"
source = "git+https://github.com/graphql-rust/graphql-client?branch=master#de2f4aeaa147864b86b7a8abe50f334d7d9f7518" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4bf9cd823359d74ad3d3ecf1afd4a975f4ff2f891cdf9a66744606daf52de8c"
dependencies = [ dependencies = [
"graphql-introspection-query", "graphql-introspection-query",
"graphql-parser 0.2.3", "graphql-parser 0.2.3",
@ -1198,21 +1187,13 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"syn", "syn",
"thiserror",
]
[[package]]
name = "graphql_client_web"
version = "0.9.0"
source = "git+https://github.com/graphql-rust/graphql-client?branch=master#de2f4aeaa147864b86b7a8abe50f334d7d9f7518"
dependencies = [
"graphql_client",
] ]
[[package]] [[package]]
name = "graphql_query_derive" name = "graphql_query_derive"
version = "0.9.0" version = "0.10.0"
source = "git+https://github.com/graphql-rust/graphql-client?branch=master#de2f4aeaa147864b86b7a8abe50f334d7d9f7518" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e56b093bfda71de1da99758b036f4cc811fd2511c8a76f75680e9ffbd2bb4251"
dependencies = [ dependencies = [
"graphql_client_codegen", "graphql_client_codegen",
"proc-macro2", "proc-macro2",
@ -1510,8 +1491,9 @@ dependencies = [
[[package]] [[package]]
name = "juniper" name = "juniper"
version = "0.15.6" version = "0.15.7"
source = "git+https://github.com/graphql-rust/juniper?branch=master#d4fda786ba663974bb5d0600e33cc85609837fbc" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "637ffa8a8d8a05aed3331449e311f145864adcd82442d82e54d0522decb7cecf"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bson", "bson",
@ -1531,8 +1513,9 @@ dependencies = [
[[package]] [[package]]
name = "juniper_codegen" name = "juniper_codegen"
version = "0.15.6" version = "0.15.7"
source = "git+https://github.com/graphql-rust/juniper?branch=master#d4fda786ba663974bb5d0600e33cc85609837fbc" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a040e09482a45e77dd2dafa0d9d2651d17faf0ac674da0c93eabc3075ee24997"
dependencies = [ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
@ -1541,9 +1524,10 @@ dependencies = [
] ]
[[package]] [[package]]
name = "juniper_rocket_async" name = "juniper_rocket"
version = "0.5.1" version = "0.8.0"
source = "git+https://github.com/graphql-rust/juniper?branch=master#d4fda786ba663974bb5d0600e33cc85609837fbc" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c24868ce3d00537b353d2e18882133a317f504782730bb2979df00c1bfcc575c"
dependencies = [ dependencies = [
"futures", "futures",
"juniper", "juniper",
@ -2694,7 +2678,7 @@ dependencies = [
[[package]] [[package]]
name = "rocket_cors" name = "rocket_cors"
version = "0.5.2" version = "0.5.2"
source = "git+https://github.com/lawliet89/rocket_cors?branch=master#dfd3662c49e2f6fc37df35091cb94d82f7fb5915" source = "git+https://github.com/lawliet89/rocket_cors?branch=master#ad80993bcb420437a2998404bde51da9a9c0b151"
dependencies = [ dependencies = [
"log", "log",
"regex", "regex",
@ -3513,7 +3497,7 @@ dependencies = [
"chrono", "chrono",
"jsonwebtoken", "jsonwebtoken",
"juniper", "juniper",
"juniper_rocket_async", "juniper_rocket",
"log", "log",
"prost", "prost",
"rocket", "rocket",
@ -3576,7 +3560,6 @@ name = "tenebrous-web-ui"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"graphql_client", "graphql_client",
"graphql_client_web",
"js-sys", "js-sys",
"jsonwebtoken", "jsonwebtoken",
"serde", "serde",

View File

@ -16,7 +16,9 @@ chrono = "0.4"
serde = {version = "1.0", features = ["derive"] } serde = {version = "1.0", features = ["derive"] }
serde_json = {version = "1.0" } serde_json = {version = "1.0" }
tenebrous-rpc = { path = "../rpc" } tenebrous-rpc = { path = "../rpc" }
juniper = { git = "https://github.com/graphql-rust/juniper", branch = "master" } # juniper = { git = "https://github.com/graphql-rust/juniper", branch = "master" }
juniper_rocket_async = { git = "https://github.com/graphql-rust/juniper", branch = "master" } # juniper_rocket = { git = "https://github.com/graphql-rust/juniper", branch = "master" }
juniper = "0.15.7"
juniper_rocket = "0.8.0"
rocket = { version = "0.5.0-rc.1", features = ["json", "secrets"] } rocket = { version = "0.5.0-rc.1", features = ["json", "secrets"] }
rocket_cors = { git = "https://github.com/lawliet89/rocket_cors", branch = "master" } rocket_cors = { git = "https://github.com/lawliet89/rocket_cors", branch = "master" }

View File

@ -10,25 +10,25 @@ use tracing_subscriber::filter::EnvFilter;
#[rocket::get("/")] #[rocket::get("/")]
fn graphiql() -> content::Html<String> { fn graphiql() -> content::Html<String> {
juniper_rocket_async::graphiql_source("/graphql", None) juniper_rocket::graphiql_source("/graphql", None)
} }
#[rocket::get("/graphql?<request>")] #[rocket::get("/graphql?<request>")]
async fn get_graphql_handler( async fn get_graphql_handler(
context: &State<Context>, context: &State<Context>,
request: juniper_rocket_async::GraphQLRequest, request: juniper_rocket::GraphQLRequest,
schema: &State<Schema>, schema: &State<Schema>,
) -> juniper_rocket_async::GraphQLResponse { ) -> juniper_rocket::GraphQLResponse {
request.execute(&*schema, &*context).await request.execute(&*schema, &*context).await
} }
#[rocket::post("/graphql", data = "<request>")] #[rocket::post("/graphql", data = "<request>")]
async fn post_graphql_handler( async fn post_graphql_handler(
context: &State<Context>, context: &State<Context>,
request: juniper_rocket_async::GraphQLRequest, request: juniper_rocket::GraphQLRequest,
schema: &State<Schema>, schema: &State<Schema>,
user: User, user: User,
) -> juniper_rocket_async::GraphQLResponse { ) -> juniper_rocket::GraphQLResponse {
println!("User is {:?}", user); println!("User is {:?}", user);
request.execute(&*schema, &*context).await request.execute(&*schema, &*context).await
} }

View File

@ -20,8 +20,9 @@ yewdux = { git = "https://github.com/intendednull/yewdux", rev = "v0.6.2"}
wasm-bindgen = { version = "0.2" } wasm-bindgen = { version = "0.2" }
wasm-bindgen-futures = "0.4" wasm-bindgen-futures = "0.4"
js-sys = "0.3" js-sys = "0.3"
graphql_client = { git = "https://github.com/graphql-rust/graphql-client", branch = "master" } #graphql_client = { git = "https://github.com/graphql-rust/graphql-client", branch = "master" }
graphql_client_web = { git = "https://github.com/graphql-rust/graphql-client", branch = "master" } #graphql_client_web = { git = "https://github.com/graphql-rust/graphql-client", branch = "master" }
graphql_client = "0.10.0"
serde = { version = "1.0.67", features = ["derive"] } serde = { version = "1.0.67", features = ["derive"] }
serde_json = {version = "1.0" } serde_json = {version = "1.0" }
thiserror = "1.0" thiserror = "1.0"

View File

@ -1,6 +1,6 @@
use graphql_client::web::Client; use graphql_client::Client;
use graphql_client::GraphQLQuery; use graphql_client::GraphQLQuery;
use graphql_client_web::Response; use graphql_client::Response;
use super::ResponseExt; use super::ResponseExt;
use crate::error::UiError; use crate::error::UiError;
@ -37,7 +37,7 @@ pub async fn get_user_variable(
}; };
let response = client.call(GetUserVariable, variables).await?; let response = client.call(GetUserVariable, variables).await?;
let response: graphql_client_web::Response<get_user_variable::ResponseData> = response; let response: graphql_client::Response<get_user_variable::ResponseData> = response;
Ok(response.data()?.variable.value) Ok(response.data()?.variable.value)
} }