Skip to content

Commit f83ca1e

Browse files
committed
Update all dependencies to newest avaible versions
1 parent 8107f3a commit f83ca1e

File tree

8 files changed

+71
-196
lines changed

8 files changed

+71
-196
lines changed

wundergraph/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ description = "A GraphQL ORM build on top of diesel"
1414
[dependencies]
1515
serde = "1"
1616
diesel = { version = "1.4", features = ["r2d2"]}
17-
juniper = "0.11"
17+
juniper = "0.12"
1818
indexmap = "1"
1919
wundergraph_derive = { path = "../wundergraph_derive" }
2020
uuid_internal = { version = "0.7", optional = true, package = "uuid" }
@@ -30,7 +30,7 @@ diesel_migrations = "1.4.0"
3030
serde_json = "1"
3131
criterion = "0.2"
3232
lazy_static = "1"
33-
insta = "0.7"
33+
insta = "0.8"
3434

3535
[features]
3636
default = ["postgres", "extras"]

wundergraph/src/query_builder/mutations/delete.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use juniper::{
1717
};
1818

1919
#[derive(Debug, GraphQLObject, Clone, Copy)]
20-
#[graphql(scalar = "WundergraphScalarValue")]
20+
#[graphql(scalar = WundergraphScalarValue)]
2121
pub struct DeletedCount {
2222
pub count: i64,
2323
}

wundergraph_bench/Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ edition = "2018"
1414
[dependencies]
1515
wundergraph = {path = "../wundergraph", default-features = false, features = ["chrono"]}
1616
diesel = {version = "1.4", features = ["r2d2", "chrono"]}
17-
juniper = "0.11.0"
18-
actix = "0.7"
19-
actix-web = "0.7"
17+
juniper = "0.12.0"
18+
actix-web = "1.0.0-rc"
2019
failure = "0.1"
2120
serde = {version = "1", features = ["derive"]}
2221
serde_json = "1"
23-
futures = "0.1"
24-
env_logger = "0.5"
22+
env_logger = "0.6"
2523
chrono = "0.4"
2624
num_cpus = "1.8"
2725
structopt = "0.2"

wundergraph_bench/src/bin/main.rs

Lines changed: 30 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,16 @@
2929
clippy::wildcard_dependencies
3030
)]
3131

32-
use actix;
33-
34-
use structopt;
35-
36-
#[macro_use]
37-
extern crate serde;
38-
39-
use num_cpus;
40-
use serde_json;
41-
use wundergraph_bench;
42-
43-
use std::sync::Arc;
44-
45-
use actix::{Actor, Addr, Handler, Message, SyncArbiter, SyncContext};
46-
use actix_web::{
47-
http, server, App, AsyncResponder, FutureResponse, HttpRequest, HttpResponse, Json, State,
48-
};
49-
32+
use actix_web::web::{Data, Json};
33+
use actix_web::{middleware, web, App, HttpResponse, HttpServer};
5034
use diesel::pg::PgConnection;
5135
use diesel::r2d2::{ConnectionManager, Pool};
52-
5336
use failure::Error;
54-
use futures::Future;
55-
5637
use juniper::graphiql::graphiql_source;
5738
use juniper::http::GraphQLRequest;
58-
39+
use serde::{Deserialize, Serialize};
40+
use std::sync::Arc;
5941
use structopt::StructOpt;
60-
6142
use wundergraph::scalar::WundergraphScalarValue;
6243

6344
#[derive(Debug, StructOpt)]
@@ -73,65 +54,28 @@ struct Opt {
7354
#[derive(Serialize, Deserialize, Debug)]
7455
pub struct GraphQLData(GraphQLRequest<WundergraphScalarValue>);
7556

76-
impl Message for GraphQLData {
77-
type Result = Result<String, Error>;
78-
}
79-
80-
#[allow(missing_debug_implementations)]
81-
pub struct GraphQLExecutor {
57+
#[derive(Clone)]
58+
struct AppState {
8259
schema: Arc<wundergraph_bench::Schema<PgConnection>>,
8360
pool: Arc<Pool<ConnectionManager<PgConnection>>>,
8461
}
8562

86-
impl GraphQLExecutor {
87-
fn new(
88-
schema: Arc<wundergraph_bench::Schema<PgConnection>>,
89-
pool: Arc<Pool<ConnectionManager<PgConnection>>>,
90-
) -> Self {
91-
Self { schema, pool }
92-
}
93-
}
94-
95-
impl Actor for GraphQLExecutor {
96-
type Context = SyncContext<Self>;
97-
}
98-
99-
impl Handler<GraphQLData> for GraphQLExecutor {
100-
type Result = Result<String, Error>;
101-
102-
fn handle(&mut self, msg: GraphQLData, _: &mut Self::Context) -> Self::Result {
103-
let ctx = self.pool.get()?;
104-
// let ctx = MyContext::new(self.pool.get()?);
105-
let res = msg.0.execute(&*self.schema, &ctx);
106-
let res_text = serde_json::to_string(&res)?;
107-
Ok(res_text)
108-
}
109-
}
110-
111-
struct AppState {
112-
executor: Addr<GraphQLExecutor>,
113-
}
114-
115-
#[cfg_attr(feature = "clippy", allow(needless_pass_by_value))]
116-
fn graphiql(_req: &HttpRequest<AppState>) -> Result<HttpResponse, Error> {
63+
fn graphiql() -> Result<HttpResponse, Error> {
11764
let html = graphiql_source("/graphql");
11865
Ok(HttpResponse::Ok()
11966
.content_type("text/html; charset=utf-8")
12067
.body(html))
12168
}
12269

123-
#[cfg_attr(feature = "clippy", allow(needless_pass_by_value))]
124-
fn graphql((st, data): (State<AppState>, Json<GraphQLData>)) -> FutureResponse<HttpResponse> {
125-
st.executor
126-
.send(data.0)
127-
.from_err()
128-
.and_then(|res| match res {
129-
Ok(user) => Ok(HttpResponse::Ok()
130-
.content_type("application/json")
131-
.body(user)),
132-
Err(_) => Ok(HttpResponse::InternalServerError().into()),
133-
})
134-
.responder()
70+
fn graphql(
71+
Json(GraphQLData(data)): Json<GraphQLData>,
72+
st: Data<AppState>,
73+
) -> Result<HttpResponse, Error> {
74+
let ctx = st.get_ref().pool.get()?;
75+
let res = data.execute(&st.get_ref().schema, &ctx);
76+
Ok(HttpResponse::Ok()
77+
.content_type("application/json")
78+
.body(serde_json::to_string(&res)?))
13579
}
13680

13781
#[allow(clippy::print_stdout)]
@@ -147,36 +91,29 @@ fn main() {
14791
let mutation = wundergraph_bench::api::Mutation::default();
14892
let schema = wundergraph_bench::Schema::new(query, mutation);
14993

150-
let sys = actix::System::new("wundergraph-bench");
151-
15294
let schema = Arc::new(schema);
15395
let pool = Arc::new(pool);
154-
let addr = SyncArbiter::start(num_cpus::get() + 1, move || {
155-
GraphQLExecutor::new(schema.clone(), pool.clone())
156-
});
96+
let data = AppState { schema, pool };
15797
let url = opt.socket;
15898

15999
// Start http server
160-
server::new(move || {
161-
App::with_state(AppState {
162-
executor: addr.clone(),
163-
})
164-
.resource("/graphql", |r| r.method(http::Method::POST).with(graphql))
165-
.resource("/graphql", |r| r.method(http::Method::GET).with(graphql))
166-
.resource("/graphiql", |r| r.method(http::Method::GET).h(graphiql))
167-
.default_resource(|r| {
168-
r.get().f(|_| {
100+
println!("Started http server: http://{}", url);
101+
102+
HttpServer::new(move || {
103+
App::new()
104+
.data(data.clone())
105+
.wrap(middleware::Logger::default())
106+
.route("/graphql", web::get().to(graphql))
107+
.route("/graphql", web::post().to(graphql))
108+
.route("/graphiql", web::get().to(graphiql))
109+
.default_service(web::route().to(|| {
169110
HttpResponse::Found()
170111
.header("location", "/graphiql")
171112
.finish()
172-
})
173-
})
113+
}))
174114
})
175-
.workers(num_cpus::get() * 2)
176115
.bind(&url)
177116
.expect("Failed to start server")
178-
.start();
179-
180-
println!("Started http server: http://{}", url);
181-
let _ = sys.run();
117+
.run()
118+
.unwrap();
182119
}

wundergraph_cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ clap = "2.27"
1616
diesel = "1.2"
1717

1818
[dev-dependencies]
19-
dotenv = "0.10"
19+
dotenv = "0.14"
2020

2121
[features]
2222
default = ["postgres", "sqlite"]

wundergraph_cli/src/print_schema/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn print(database_url: &str, schema_name: Option<&str>) -> Result<(), Box<dy
2727
let mutations = GraphqlMutations {
2828
tables: &table_data,
2929
};
30-
println!("use wundergraph::query_helper::{{HasMany, HasOne}};");
30+
println!("use wundergraph::query_builder::types::{{HasMany, HasOne}};");
3131
println!("use wundergraph::scalar::WundergraphScalarValue;");
3232
println!("use wundergraph::WundergraphEntity;");
3333
println!();

wundergraph_example/Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ edition = "2018"
1414
[dependencies]
1515
diesel = { version = "1.4.0", features = ["r2d2", "sqlite", "chrono", "postgres"]}
1616
diesel_migrations = "1.4.0"
17-
juniper = "0.11.0"
18-
actix = "0.7"
19-
actix-web = "0.7"
17+
juniper = "0.12"
18+
actix-web = "1.0.0-rc"
2019
indexmap = "1"
2120
failure = "0.1"
2221
serde = {version = "1", features = ["derive"]}
2322
serde_json = "1"
24-
futures = "0.1"
25-
env_logger = "0.5"
23+
env_logger = "0.6"
2624
structopt = "0.2"
2725

2826
[dependencies.wundergraph]

0 commit comments

Comments
 (0)