Skip to content

Commit aaf28e9

Browse files
authored
Merge juniper_graphql_transport_ws and juniper_graphql_ws crates (#1196, #1022)
1 parent f3a1a0c commit aaf28e9

File tree

29 files changed

+1220
-1361
lines changed

29 files changed

+1220
-1361
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ jobs:
101101
- { feature: time, crate: juniper }
102102
- { feature: url, crate: juniper }
103103
- { feature: uuid, crate: juniper }
104+
- { feature: graphql-transport-ws, crate: juniper_graphql_ws }
105+
- { feature: graphql-ws, crate: juniper_graphql_ws }
104106
- { feature: <none>, crate: juniper_actix }
105107
- { feature: subscriptions, crate: juniper_actix }
106108
- { feature: <none>, crate: juniper_warp }
@@ -134,7 +136,6 @@ jobs:
134136
- juniper_codegen
135137
- juniper
136138
- juniper_subscriptions
137-
- juniper_graphql_transport_ws
138139
- juniper_graphql_ws
139140
#- juniper_actix
140141
- juniper_hyper
@@ -189,7 +190,6 @@ jobs:
189190
- juniper_codegen
190191
- juniper
191192
- juniper_subscriptions
192-
- juniper_graphql_transport_ws
193193
- juniper_graphql_ws
194194
- juniper_integration_tests
195195
- juniper_codegen_tests
@@ -318,7 +318,6 @@ jobs:
318318
- juniper_codegen
319319
- juniper
320320
- juniper_subscriptions
321-
- juniper_graphql_transport_ws
322321
- juniper_graphql_ws
323322
- juniper_actix
324323
- juniper_hyper

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ members = [
88
"juniper_iron",
99
"juniper_rocket",
1010
"juniper_subscriptions",
11-
"juniper_graphql_transport_ws",
1211
"juniper_graphql_ws",
1312
"juniper_warp",
1413
"juniper_actix",

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ ifeq ($(clean),yes)
9494
cargo clean
9595
endif
9696
$(eval target := $(strip $(shell cargo -vV | sed -n 's/host: //p')))
97-
cargo build
97+
cargo build --all-features
9898
mdbook test book -L target/debug/deps $(strip \
9999
$(if $(call eq,$(findstring windows,$(target)),),,\
100100
$(shell cargo metadata -q \

juniper_actix/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ rustdoc-args = ["--cfg", "docsrs"]
2222
subscriptions = [
2323
"dep:actix",
2424
"dep:actix-web-actors",
25-
"dep:juniper_graphql_transport_ws",
2625
"dep:juniper_graphql_ws",
2726
"dep:tokio",
2827
]
@@ -35,8 +34,7 @@ actix-web-actors = { version = "4.1", optional = true }
3534
anyhow = "1.0.47"
3635
futures = "0.3.22"
3736
juniper = { version = "0.16.0-dev", path = "../juniper", default-features = false }
38-
juniper_graphql_transport_ws = { version = "0.4.0-dev", path = "../juniper_graphql_transport_ws", optional = true }
39-
juniper_graphql_ws = { version = "0.4.0-dev", path = "../juniper_graphql_ws", optional = true }
37+
juniper_graphql_ws = { version = "0.4.0-dev", path = "../juniper_graphql_ws", features = ["graphql-transport-ws", "graphql-ws"], optional = true }
4038
http = "0.2.4"
4139
serde = { version = "1.0.122", features = ["derive"] }
4240
serde_json = "1.0.18"

juniper_actix/src/lib.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub mod subscriptions {
183183
SinkExt as _, Stream, StreamExt as _,
184184
};
185185
use juniper::{GraphQLSubscriptionType, GraphQLTypeAsync, RootNode, ScalarValue};
186-
use juniper_graphql_transport_ws::{ArcSchema, Init};
186+
use juniper_graphql_ws::{graphql_transport_ws, graphql_ws, ArcSchema, Init};
187187
use tokio::sync::Mutex;
188188

189189
/// Serves by auto-selecting between the
@@ -194,11 +194,10 @@ pub mod subscriptions {
194194
/// The `schema` argument is your [`juniper`] schema.
195195
///
196196
/// The `init` argument is used to provide the custom [`juniper::Context`] and additional
197-
/// configuration for connections. This can be a
198-
/// [`juniper_graphql_transport_ws::ConnectionConfig`] if the context and configuration are
199-
/// already known, or it can be a closure that gets executed asynchronously whenever a client
200-
/// sends the subscription initialization message. Using a closure allows to perform an
201-
/// authentication based on the parameters provided by a client.
197+
/// configuration for connections. This can be a [`juniper_graphql_ws::ConnectionConfig`] if the
198+
/// context and configuration are already known, or it can be a closure that gets executed
199+
/// asynchronously whenever a client sends the subscription initialization message. Using a
200+
/// closure allows to perform an authentication based on the parameters provided by a client.
202201
///
203202
/// [new]: https://github.com/enisdenjo/graphql-ws/blob/v5.14.0/PROTOCOL.md
204203
/// [old]: https://github.com/apollographql/subscriptions-transport-ws/blob/v0.11.0/PROTOCOL.md
@@ -262,8 +261,7 @@ pub mod subscriptions {
262261
S: ScalarValue + Send + Sync + 'static,
263262
I: Init<S, CtxT> + Send,
264263
{
265-
let (s_tx, s_rx) =
266-
juniper_graphql_ws::Connection::new(ArcSchema(schema), init).split::<Message>();
264+
let (s_tx, s_rx) = graphql_ws::Connection::new(ArcSchema(schema), init).split::<Message>();
267265

268266
let mut resp = ws::start(
269267
Actor {
@@ -285,10 +283,10 @@ pub mod subscriptions {
285283
/// Serves the [new `graphql-transport-ws` GraphQL over WebSocket Protocol][new].
286284
///
287285
/// The `init` argument is used to provide the context and additional configuration for
288-
/// connections. This can be a [`juniper_graphql_transport_ws::ConnectionConfig`] if the context
289-
/// and configuration are already known, or it can be a closure that gets executed
290-
/// asynchronously when the client sends the `ConnectionInit` message. Using a closure allows to
291-
/// perform an authentication based on the parameters provided by a client.
286+
/// connections. This can be a [`juniper_graphql_ws::ConnectionConfig`] if the context and
287+
/// configuration are already known, or it can be a closure that gets executed asynchronously
288+
/// when the client sends the `ConnectionInit` message. Using a closure allows to perform an
289+
/// authentication based on the parameters provided by a client.
292290
///
293291
/// [new]: https://github.com/enisdenjo/graphql-ws/blob/v5.14.0/PROTOCOL.md
294292
pub async fn graphql_transport_ws_handler<Query, Mutation, Subscription, CtxT, S, I>(
@@ -308,8 +306,8 @@ pub mod subscriptions {
308306
S: ScalarValue + Send + Sync + 'static,
309307
I: Init<S, CtxT> + Send,
310308
{
311-
let (s_tx, s_rx) = juniper_graphql_transport_ws::Connection::new(ArcSchema(schema), init)
312-
.split::<Message>();
309+
let (s_tx, s_rx) =
310+
graphql_transport_ws::Connection::new(ArcSchema(schema), init).split::<Message>();
313311

314312
let mut resp = ws::start(
315313
Actor {
@@ -429,7 +427,7 @@ pub mod subscriptions {
429427
fn into_ws_response(self) -> Result<String, ws::CloseReason>;
430428
}
431429

432-
impl<S: ScalarValue> IntoWsResponse for juniper_graphql_transport_ws::Output<S> {
430+
impl<S: ScalarValue> IntoWsResponse for graphql_transport_ws::Output<S> {
433431
fn into_ws_response(self) -> Result<String, ws::CloseReason> {
434432
match self {
435433
Self::Message(msg) => serde_json::to_string(&msg).map_err(|e| ws::CloseReason {
@@ -444,7 +442,7 @@ pub mod subscriptions {
444442
}
445443
}
446444

447-
impl<S: ScalarValue> IntoWsResponse for juniper_graphql_ws::ServerMessage<S> {
445+
impl<S: ScalarValue> IntoWsResponse for graphql_ws::ServerMessage<S> {
448446
fn into_ws_response(self) -> Result<String, ws::CloseReason> {
449447
serde_json::to_string(&self).map_err(|e| ws::CloseReason {
450448
code: ws::CloseCode::Error,
@@ -456,7 +454,7 @@ pub mod subscriptions {
456454
#[derive(Debug)]
457455
struct Message(ws::Message);
458456

459-
impl<S: ScalarValue> TryFrom<Message> for juniper_graphql_transport_ws::Input<S> {
457+
impl<S: ScalarValue> TryFrom<Message> for graphql_transport_ws::Input<S> {
460458
type Error = Error;
461459

462460
fn try_from(msg: Message) -> Result<Self, Self::Error> {
@@ -470,7 +468,7 @@ pub mod subscriptions {
470468
}
471469
}
472470

473-
impl<S: ScalarValue> TryFrom<Message> for juniper_graphql_ws::ClientMessage<S> {
471+
impl<S: ScalarValue> TryFrom<Message> for graphql_ws::ClientMessage<S> {
474472
type Error = Error;
475473

476474
fn try_from(msg: Message) -> Result<Self, Self::Error> {

juniper_graphql_transport_ws/CHANGELOG.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

juniper_graphql_transport_ws/Cargo.toml

Lines changed: 0 additions & 25 deletions
This file was deleted.

juniper_graphql_transport_ws/LICENSE

Lines changed: 0 additions & 25 deletions
This file was deleted.

juniper_graphql_transport_ws/README.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

juniper_graphql_transport_ws/release.toml

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)