This commit is contained in:
sunli 2020-05-16 21:16:30 +08:00
parent c16d239b65
commit b31639e3e9
9 changed files with 27 additions and 32 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "async-graphql" name = "async-graphql"
version = "1.12.9" version = "1.12.10"
authors = ["sunli <scott_s829@163.com>"] authors = ["sunli <scott_s829@163.com>"]
edition = "2018" edition = "2018"
description = "The GraphQL server library implemented by rust" description = "The GraphQL server library implemented by rust"
@ -17,8 +17,8 @@ readme = "README.md"
default = ["bson", "uuid", "url", "chrono-tz"] default = ["bson", "uuid", "url", "chrono-tz"]
[dependencies] [dependencies]
async-graphql-parser = { path = "async-graphql-parser", version = "0.4.0" } async-graphql-parser = { path = "async-graphql-parser", version = "0.5.0" }
async-graphql-derive = { path = "async-graphql-derive", version = "1.12.9" } async-graphql-derive = { path = "async-graphql-derive", version = "1.12.10" }
anyhow = "1.0.26" anyhow = "1.0.26"
thiserror = "1.0.11" thiserror = "1.0.11"
async-trait = "0.1.30" async-trait = "0.1.30"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "async-graphql-actix-web" name = "async-graphql-actix-web"
version = "1.4.8" version = "1.4.10"
authors = ["sunli <scott_s829@163.com>"] authors = ["sunli <scott_s829@163.com>"]
edition = "2018" edition = "2018"
description = "async-graphql for actix-web" description = "async-graphql for actix-web"
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"] categories = ["network-programming", "asynchronous"]
[dependencies] [dependencies]
async-graphql = { path = "..", version = "1.12.9" } async-graphql = { path = "..", version = "1.12.10" }
actix-web = "2.0.0" actix-web = "2.0.0"
actix-web-actors = "2.0.0" actix-web-actors = "2.0.0"
actix = "0.9.0" actix = "0.9.0"

View File

@ -127,6 +127,8 @@ where
Subscription: SubscriptionType + Send + Sync + 'static, Subscription: SubscriptionType + Send + Sync + 'static,
{ {
fn handle(&mut self, data: Bytes, ctx: &mut Self::Context) { fn handle(&mut self, data: Bytes, ctx: &mut Self::Context) {
ctx.text(std::str::from_utf8(&data).ok().unwrap_or_default()); if let Ok(text) = std::str::from_utf8(&data) {
ctx.text(text);
}
} }
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "async-graphql-derive" name = "async-graphql-derive"
version = "1.12.9" version = "1.12.10"
authors = ["sunli <scott_s829@163.com>"] authors = ["sunli <scott_s829@163.com>"]
edition = "2018" edition = "2018"
description = "Macros for async-graphql" description = "Macros for async-graphql"
@ -16,7 +16,7 @@ categories = ["network-programming", "asynchronous"]
proc-macro = true proc-macro = true
[dependencies] [dependencies]
async-graphql-parser = { path = "../async-graphql-parser", version = "0.4.0" } async-graphql-parser = { path = "../async-graphql-parser", version = "0.5.0" }
proc-macro2 = "1.0.6" proc-macro2 = "1.0.6"
syn = { version = "1.0.20", features = ["full", "extra-traits"] } syn = { version = "1.0.20", features = ["full", "extra-traits"] }
quote = "1.0.3" quote = "1.0.3"

View File

@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"] categories = ["network-programming", "asynchronous"]
[dependencies] [dependencies]
async-graphql = { path = "..", version = "1.12.9" } async-graphql = { path = "..", version = "1.12.10" }
lambda_http = { git = "https://github.com/awslabs/aws-lambda-rust-runtime" } lambda_http = { git = "https://github.com/awslabs/aws-lambda-rust-runtime" }
futures = "0.3.0" futures = "0.3.0"
async-trait = "0.1.30" async-trait = "0.1.30"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "async-graphql-parser" name = "async-graphql-parser"
version = "0.4.0" version = "0.5.0"
authors = ["sunli <scott_s829@163.com>"] authors = ["sunli <scott_s829@163.com>"]
edition = "2018" edition = "2018"
description = "GraphQL query parser for async-graphql" description = "GraphQL query parser for async-graphql"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "async-graphql-tide" name = "async-graphql-tide"
version = "1.4.9" version = "1.4.10"
authors = ["vkill <vkill.net@gmail.com>"] authors = ["vkill <vkill.net@gmail.com>"]
edition = "2018" edition = "2018"
description = "async-graphql for tide" description = "async-graphql for tide"
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"] categories = ["network-programming", "asynchronous"]
[dependencies] [dependencies]
async-graphql = { path = "..", version = "1.12.9" } async-graphql = { path = "..", version = "1.12.10" }
tide = "0.8" tide = "0.8"
async-trait = "0.1.30" async-trait = "0.1.30"
serde_json = "1.0.51" serde_json = "1.0.51"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "async-graphql-warp" name = "async-graphql-warp"
version = "1.4.9" version = "1.4.10"
authors = ["sunli <scott_s829@163.com>"] authors = ["sunli <scott_s829@163.com>"]
edition = "2018" edition = "2018"
description = "async-graphql for warp" description = "async-graphql for warp"
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"] categories = ["network-programming", "asynchronous"]
[dependencies] [dependencies]
async-graphql = { path = "..", version = "1.12.9" } async-graphql = { path = "..", version = "1.12.10" }
warp = "0.2.2" warp = "0.2.2"
futures = "0.3.0" futures = "0.3.0"
bytes = "0.5.4" bytes = "0.5.4"

View File

@ -175,14 +175,11 @@ where
select! { select! {
bytes = srx.next() => { bytes = srx.next() => {
if let Some(bytes) = bytes { if let Some(bytes) = bytes {
if tx if let Ok(text) = String::from_utf8(bytes.to_vec()) {
.send(Message::text( if tx.send(Message::text(text)).await.is_err()
String::from_utf8(bytes.to_vec()).unwrap() {
)) return;
.await }
.is_err()
{
return;
} }
} else { } else {
return; return;
@ -203,8 +200,8 @@ where
}) })
}, },
).map(|reply| { ).map(|reply| {
warp::reply::with_header(reply, "Sec-WebSocket-Protocol", "graphql-ws") warp::reply::with_header(reply, "Sec-WebSocket-Protocol", "graphql-ws")
}) })
.boxed() .boxed()
} }
@ -240,14 +237,10 @@ where
select! { select! {
bytes = srx.next() => { bytes = srx.next() => {
if let Some(bytes) = bytes { if let Some(bytes) = bytes {
if tx if let Ok(text) = String::from_utf8(bytes.to_vec()) {
.send(Message::text( if tx.send(Message::text(text)).await.is_err() {
String::from_utf8(bytes.to_vec()).unwrap() return;
)) }
.await
.is_err()
{
return;
} }
} else { } else {
return; return;